Hi Clément, There is a lot going on in those equations and they are not trivial to implement in FiPy, but I think the problem is tractable in FiPy.
On Tue, Mar 22, 2016 at 8:26 AM, douarre <doua...@creatis.insa-lyon.fr> wrote: > > #==== Variables > =============================================================================== > n = CellVariable(mesh=m) > c = CellVariable(mesh=m) > v = CellVariable(mesh=m,rank=1) #v is a vector field I think that it would be better to treat `v` as a two separate variables. This is unfortunate, but a requirement in FiPy as the interface doesn't really support vector equations yet. So use, vx = CellVariable(mesh=m) vy = CellVariable(mesh=m and v = CellVariable(mesh=m, rank=1) and then assign the values of vx and vy to v during the loop. I'm not sure if there is way to do this implicity, so just do it explicity for now. > #equations > eq1 = TransientTerm(var=n) == UpwindConvectionTerm(coeff=v,var=n); `eq1` is okay > eq2 = TransientTerm(var=v) == -v*v.getGrad()+mu*c.getGrad(); `eq2` should be nx = CellVariable(mesh=m, rank=1, value=0.) ny = CellVariable(mesh=m, rank=1, value=0.) nx[0] = 1. ny[1] = 1. eq2x = TransientTerm(var=vx) +UpwindConvectionTerm(coeff=v / 2, var=vx) == CentralDifferenceConvectionTerm(coeff=mu * nx, var=c); eq2x = TransientTerm(var=vy) +UpwindConvectionTerm(coeff=v / 2, var=vy) == CentralDifferenceConvectionTerm(coeff=mu * ny, var=c); > eq3 = TransientTerm(var=c) + PowerLaw== DiffusionTerm(coeff=D, var=c) +alpha > * n - > c/tau; eq3 = TransientTerm(var=c) == DiffusionTerm(coeff=D, var=c) + ImplicitSourceTerm(coeff=alpha, var=n) - ImplicitSourceTerm(var=c, coeff=1. / tau) Remember that the `v` needs to be updated by `vx` and `vy` explicitly. I hope that helps some. Thanks, Daniel -- Daniel Wheeler _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]