On Mar 28, 2016, at 12:20 PM, Djoeke Schoonenberg <[email protected]> wrote:
> So it seems that I’m implementing the variable speed in a wrong way. What I > did was ConvectionTerm(FaceVariable(mesh=mesh, value=vgas(x)), var=S_vap), > where vgas(x) is the speed as function of position. How should this be done > instead? I think the immediate issue is that you're defining a FaceVariable in terms of cell centers: x = mesh.cellCenters()[0] ConvectionTerm(FaceVariable(mesh=mesh, value=vgas(x)+p*Dif/x),var=S_vap) Instead, I would do: xface = mesh.faceCenters[0] # note the removal of the '()' ConvectionTerm(coeff=vgas(xface)+p*Dif/xface), var=S_vap) mesh.faceCenters[0] is a FaceVariable already, so no need to cast it, and it has the proper shape, which x = mesh.cellCenters[0] does not. Strictly, you should not pass a scalar coefficient to a ConvectionTerm, although it generally works in 1D. (vgas(xface)+p*Dif/xface))*[[1]] should give you a proper vector velocity. Also, it's rank-0 which is strictly wrong, but often works, particularly in 1D. _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
