Thank you.
Jamie

On Thu, Feb 18, 2016 at 11:15 AM, Guyer, Jonathan E. Dr. <
[email protected]> wrote:

> That's exactly what FiPy does if you pass in a CellVariable diffusion
> coefficient. There can be times you'll want to choose a different average,
> but if that's the case, you should have been doing it when you declared
> your DiffusionTerm.
>
> The ConvectionTerm is more complicated, as discussed in
> https://github.com/usnistgov/fipy/issues/461. The exact weighting between
> values at cell centers and values at faces depends on both the convection
> scheme you choose and on the Peclet number (which depends on the diffusion
> coefficient and how you interpolate that). What you've written is about as
> good as you're going to get without doing a *lot* more work.
>
> You should not try to cast convCoeff or Psi.faceGrad to a cell-centered
> value, as we provide no divergence operator on cell vectors.
>
> On Feb 18, 2016, at 9:35 AM, James Pringle <[email protected]> wrote:
>
> > p.s. the following code works fairly well --
> >
> >     crossIsoAdvec_modGrid=(Psi.arithmeticFaceValue *
> convCoeff).divergence
> >     botFricCurl_modGrid=(DiffCoeff.arithmeticFaceValue *
> Psi.faceGrad).divergence
> >
> > I just want to make sure it is somewhat sensible...
> >
> > On Thu, Feb 18, 2016 at 9:28 AM, James Pringle <[email protected]> wrote:
> > 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 ]
>
>
> _______________________________________________
> 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 ]

Reply via email to