Dear Jon --
I am having a bit of a problem with your technique. All of my
coefficients vary in space, e.g. they are define as follows:
mesh = Grid2D(Lx=Lx,Ly=Ly, nx=nx, ny=ny)
convCoeff=FaceVariable(mesh=mesh,rank=1)
convCoeff.value[0,:]=....
convCoeff.value[1,:]= ....
DiffCoeff=CellVariable(mesh=mesh, rank=0)
DiffCoeff.value = ...
eq =
(DiffusionTerm(var=Psi,coeff=DiffCoeff)+ExponentialConvectionTerm(var=Psi,coeff=convCoeff))
eq.solve(var=Psi)
So when I try to implement your suggestions of (DiffCoeff *
Psi.faceGrad).divergence or (Psi * convCoeff).divergence I get errors
because DiffCoeff is a Cell variable, and Psi.faceGrad is a face variable.
Likewise for Psi*convCoeff
So what is the most numerically constant way to solve this issue -- map
DiffCoeff to face, or Psi.faceGrad to cell? Likewise should I map convCoeff
to cell or Psi to face? I want to do it in the way that is most consistent
with the underlying numerics.
Thanks
Jamie
On Wed, Feb 17, 2016 at 9:43 AM, James Pringle <[email protected]> wrote:
> Thank you, Jon, that is helpful. I would love to have the ability to find
> the individual terms of the equation as calculated in the matrix that is
> solved by fiPy. This would make closing budgets, etc, easier. But your
> solution is a good start.
>
> Thanks again
> Jamie Pringle
> University of New Hampshire
>
> On Tue, Feb 16, 2016 at 4:53 PM, Guyer, Jonathan E. Dr. <
> [email protected]> wrote:
>
>> James -
>>
>> I don't think there's a straightforward way to get at this.
>>
>> You can certainly write the explicit forms, e.g.,
>>
>> (DiffCoeff * Psi.faceGrad).divergence
>>
>> or
>>
>> (Psi * convCoeff).divergence
>>
>> but this isn't exactly the same as the matrix FiPy builds, as discussed
>> at https://github.com/usnistgov/fipy/issues/461.
>>
>> I can see the value for diagnosing and simply understanding mechanisms,
>> so I'll think about ways we might provide access to this.
>>
>> - Jon
>>
>> On Feb 12, 2016, at 10:18 AM, James Pringle <[email protected]> wrote:
>>
>> > I feel this should be an elementary question, but I can't seem to
>> figure out how to answer it. I am solving a simple linear elleptic-ish
>> equation with
>> >
>> > eq =
>> (DiffusionTerm(var=Psi,coeff=DiffCoeff)+ExponentialConvectionTerm(var=Psi,coeff=convCoeff))
>> > eq.solve(var=Psi)
>> >
>> > This works fine; the solution matches what I would expect. I have two
>> questions:
>> >
>> > First, how can I obtain the value of the individual terms of the
>> equation, evaluated with the solution in Psi?
>> >
>> > Second, is there any way to define my own new Psi (which is not an
>> exact solution to the equation), and easily evaluate the DiffusionTerm and
>> ExponentialConvectionTerm for that Psi?
>> >
>> > I am trying to illustrate how various parts of the solution evolve over
>> the solution space, and how various approximations to the full solution
>> differ from the full solution.
>> >
>> > Thanks to all who glance at this
>> > James Pringle
>> > University of New Hampshire
>> >
>> > _______________________________________________
>> > fipy mailing list
>> > [email protected]
>> > http://www.ctcms.nist.gov/fipy
>> > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>>
>>
>> _______________________________________________
>> fipy mailing list
>> [email protected]
>> http://www.ctcms.nist.gov/fipy
>> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>>
>
>
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]