On Wed, Dec 12, 2012 at 11:04 AM, Phil Miller <[email protected]> wrote:
> I'm attempting to reimplement the model from this paper > <http://eprints.maths.ox.ac.uk/1519/> in order to build a small > extension. Most of the equations are made up of straightforward > DiffusionTerm or ConvectionTerm or source term elements, some of which > I've been able to solve with FiPy in isolation. However, I've > encountered trouble in encoding the vector-valued momentum balance > equation (eq 19 in the paper) for the low-R flow of mixed viscous > fluids. > At first glance it seems like it would be an ideal problem for FiPy. > > Given these definitions (which I may have gotten wrong - please tell > me if I have) > > mesh = Gmsh2D( . . . ) > thetas = [ CellVariable(mesh = mesh, value = initialT[i]) for i in > species ] # Scalar > pressure = [ CellVariable(mesh = mesh, value = initialP[i]) for i in > species ] # Scalar > fluxes = [ FaceVariable(mesh = mesh, value = [[0.0], [0.0]], rank = 1) > for i in species ] # (x, y) vector > The definitions look okay, I assume they work and the shapes make sense. If you want to use vector equations then you'll have to use higher ranked variables rather than lists. > > I'm trying to represent the following equation in fipy's terms, and > failing to understand how to express it correctly so that fipy can > solve it: > > \theta_i \nabla \dot (c_1 pressures[i] I) + \nabla \dot ( theta_i ( > c_2 (\nabla \vec{u}_i + (\nabla \vec{u}_i)^T ) + c_3 ( \nabla \dot > \vec{u}_i) I ) ) = 0 > I think FiPy will have a problem with the transposed term if you use coupled or vector equations. See http://thread.gmane.org/gmane.comp.python.fipy/2819/focus=2833 and http://matforge.org/fipy/ticket/485 Having acknowledged that issue, you don't have to implement these equations in a coupled manner or you can implement them in a coupled manner, but represent the transposed term explicitly. I've done this in a number of cases and it has worked fine. > > I've written 'I' for the identity matrix, and \vec{u} for the flux. > > I've read through the FAQ, and the closest thing I've found in the > examples is the Cahn-Hilliard case, and some additional mailing list > messages [1], but I've not been able to figure out how to put the > pieces together properly. From those, it seems like I may need to > expand some of the derivatives explicitly, Have you looked through some of these examples? http://www.ctcms.nist.gov/fipy/documentation/USAGE.html#coupled-and-vector-equations and possibly include some > higher-order DiffusionTerms, Not sure you need that, which equation has higher order diffusion? but I'm unsure how to push that all > through. Can someone offer a pointer on how to accomplish this, or > links to some other resource? > Maybe this will be helpful in some way http://www.ctcms.nist.gov/fipy/examples/reactiveWetting/generated/examples.reactiveWetting.liquidVapor1D.html#module-examples.reactiveWetting.liquidVapor1D I acknowledge that we need some more complex examples. Maybe try and implement something even if it doesn't work and that will give us specifics to work with. You might want to use the ipython notebook to implement it and then you can put the TeX for the equation you are trying to solve above each equation and it will be a real help for us to help you debug it. Possibly just implement each equation in an uncoupled manner to start (that should be easy enough) and just time step to get it all working. Only later worry about optimizing with coupled or vector equations and sweeps. Good luck! -- Daniel Wheeler
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
