Replies: 1 comment 4 replies
-
It's a little weird to state one as a vector equation and the other as a 1D ODE. Further, all derivatives should be partials. First, write the second equation in vector form: then substitute that equation for These terms are now in canonical form for FiPy.
So, either eq1 = (fp.TransientTerm(var=C1)
== fp.ConvectionTerm(coeff=(z1 * D1e * F / (R * T)) * phi.faceGrad, var=C1)
+ fp.DiffusionTerm(coeff=D1e, var=C1))
eq2 = (fp.TransientTerm(var=C2)
== fp.ConvectionTerm(coeff=(z2 * D2e * F / (R * T)) * phi.faceGrad, var=C2)
+ fp.DiffusionTerm(coeff=D2e, var=C2))
:
: and solve them one by one, or eq1 = (fp.TransientTerm(var=C1)
== fp.DiffusionTerm(coeff=(z1 * D1e * F * C1.faceValue/ (R * T)), var=phi)
+ fp.DiffusionTerm(coeff=D1e, var=C1))
eq2 = (fp.TransientTerm(var=C2)
== fp.DiffusionTerm(coeff=(z2 * D2e * F * C2.faceValue/ (R * T)), var=phi)
+ fp.DiffusionTerm(coeff=D2e, var=C2))
:
:
eq = eq1 & eq2 & ... & eq9 and solve the coupled equation As to [15] & [16], they would need to be coupled. I would try eq15 = (fp.TransientTerm(var=C_CO3m2) + fp.TransientTerm(var=C_HCO3m1)
== fp.DiffusionTerm(coeff=(z_CO3m2 * D_CO3m2_e * F * C_CO3m2.faceValue/ (R * T)), var=phi)
+ fp.DiffusionTerm(coeff=D_CO3m2_e, var=C_CO3m2)
+ fp.DiffusionTerm(coeff=(z_HCO3m1 * D_HCO3m1_e * F * C_HCO3m1.faceValue/ (R * T)), var=phi)
+ fp.DiffusionTerm(coeff=D_HCO3m1_e, var=C_HCO3m1)) and similarly for |
Beta Was this translation helpful? Give feedback.
-
I have been trying to write Python code to solve the set of PDEs listed in the paper here: https://www.researchgate.net/publication/238140924_Mathematical_Modeling_of_the_Formation_of_Calcareous_Deposits_on_Cathodically_Protected_Steel_in_Seawater
The simplest equations are as follows:
with
How would I generally use fipy to represent these equations? I figured a transient term for the time derivative but not sure for the other parts.
Also if possible, how would I continue to use this to represent equations 15 & 16?
Beta Was this translation helpful? Give feedback.
All reactions