On Tue, Mar 18, 2014 at 11:38 AM, Adrian Jacobo < [email protected]> wrote:
> Hi, > > I'm trying to solve a system where an equation for a field is coupled to > an equation for a scalar. But I'm having problems writing this into FiPy. > To illustrate the point here I show you a simplified version of the > equations I'm trying to solve: > > [image: $$\partial_t A^*=(\rho+\zeta A^*)A-d \nabla^2A^*$$] > [image: $$\partial_t A = -\int (\rho+\zeta A^*)A $$] > Here [image: $$A^*$$] is a one dimensional field and [image: $$A$$] is a > number. > > I tried defining the equations like this: > > a_s = fp.CellVariable(name = "a_s", mesh = mesh, value = 0.5) > > a = fp.Variable(name = "a",value=0.) > eqa_s = fp.TransientTerm(var=a_s) == > (-fp.DiffusionTerm(var=a,coeff=d_a)+(rho+zeta*a_s)*a) > eqa= fp.TransientTerm(var=a) == (-(rho+zeta*numerix.sum(a_s))*a) > > > And then I try to concatenate the equations: > > > eq=eqa_s & eqa > > > This doesn't work because the variables a and a_s are of different size. > Is there any clever way of implementing this without having to define "a" > as a CellVariable with it's value repeated for all of its points? > Hi Adrian, in this example, there doesn't seem to be a benefit to joining the equations and solving with a single matrix. The dependence on A* in the second equation is in the integral so there is no easy to get tighter coupling than by simply using alternating solutions of the equations separately (Peclet iteration). -- Daniel Wheeler
<<inline: tblatex-1.png>>
<<inline: tblatex-2.png>>
<<inline: tblatex-3.png>>
<<inline: tblatex-4.png>>
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
