Derek Park
2018-06-12 20:09:13 UTC
Hello Fipy,
I've run into a problem in designing/implementing my model and was wondering what the best practice would be.
Currently, I am trying to model a 1D PDE that is a cell species, H, along a linear axis, x:
\begin{equation}\label{FiPyFinal}
\underbrace{\frac{\delta H}{\delta t}}_{Transient} + \underbrace{(v_A + C_\Phi \Phi \frac{\delta S}{\delta x})\frac{\delta H}{\delta x}}_{Convection} = \underbrace{D\frac{\delta^2 H}{\delta x^2}}_{Diffusion} + \underbrace{r_H C_A A H\Big(1 - \frac{\bar{H}}{K_H}\Big) - \delta_H H - \delta_D S H}_{Source}
\end{equation}
H is the cell species I am interested in modeling, but S and A are also CellVariables. Currently they are invariant, but this will probably change as the model develops.
Importantly, \bar{H} is the total population of H. \Phi is also a globally calculated feedback function.
My questions pertain to uncertainty in how to implement the Convection and Source terms.
For the source term:
I see in the FiPy docs that for source terms, "The dependence can only be included in a linear manner".
So does this imply that the correct way to implement this source term would be:
ImplicitSourceTerm(coeff = r_H * C_A * A * (1 - H_bar()/K_H) - delta_H - delta_D * S)
With H_bar() being a function:
# Set up the summing of HSCs
def H_bar():
return H.cellVolumeAverage * mesh.cellVolumes.sum()
Am I incorrect in manually computing H_bar() at every timestep and then using it as the source term coefficient?
Also, will there be any problems with A and S also being CellVariables in this coupled PDE system?
For the Convection term:
And as another question, for the convection term, is it appropriate to have it as:
ConvectionTerm(coeff = v_A + C_phi + Phi() + S.faceGrad)
As in the source term, will there be issues with having Phi() as a function which changes at every timestep?
Thank you,
Derek Park
---------------------------
Derek Park | D. Phil student, University of Oxford
I've run into a problem in designing/implementing my model and was wondering what the best practice would be.
Currently, I am trying to model a 1D PDE that is a cell species, H, along a linear axis, x:
\begin{equation}\label{FiPyFinal}
\underbrace{\frac{\delta H}{\delta t}}_{Transient} + \underbrace{(v_A + C_\Phi \Phi \frac{\delta S}{\delta x})\frac{\delta H}{\delta x}}_{Convection} = \underbrace{D\frac{\delta^2 H}{\delta x^2}}_{Diffusion} + \underbrace{r_H C_A A H\Big(1 - \frac{\bar{H}}{K_H}\Big) - \delta_H H - \delta_D S H}_{Source}
\end{equation}
H is the cell species I am interested in modeling, but S and A are also CellVariables. Currently they are invariant, but this will probably change as the model develops.
Importantly, \bar{H} is the total population of H. \Phi is also a globally calculated feedback function.
My questions pertain to uncertainty in how to implement the Convection and Source terms.
For the source term:
I see in the FiPy docs that for source terms, "The dependence can only be included in a linear manner".
So does this imply that the correct way to implement this source term would be:
ImplicitSourceTerm(coeff = r_H * C_A * A * (1 - H_bar()/K_H) - delta_H - delta_D * S)
With H_bar() being a function:
# Set up the summing of HSCs
def H_bar():
return H.cellVolumeAverage * mesh.cellVolumes.sum()
Am I incorrect in manually computing H_bar() at every timestep and then using it as the source term coefficient?
Also, will there be any problems with A and S also being CellVariables in this coupled PDE system?
For the Convection term:
And as another question, for the convection term, is it appropriate to have it as:
ConvectionTerm(coeff = v_A + C_phi + Phi() + S.faceGrad)
As in the source term, will there be issues with having Phi() as a function which changes at every timestep?
Thank you,
Derek Park
---------------------------
Derek Park | D. Phil student, University of Oxford