Using data fields as coefficients

Asked by Ryan Walker

I understand how variable coefficients work when they're given by a formula and can be defined by an Expression.
However, for most of the geophysical problems I'm interested in, some of the coefficients are observed (scalar) fields, so I have arrays of values at given points. In Matlab, I would interpolate these onto the mesh to define the coefficients. Is there a corresponding way of doing this in Dolfin? Couldn't figure this out from the tutorial.

New to Dolfin, so hope this question isn't too vague. Mostly want to be sure a reasonable solution exists before committing to using Dolfin for a particular project. Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Anders Logg (logg) said :
#1

On Wed, Jan 18, 2012 at 10:00:58PM -0000, Ryan Walker wrote:
> New question #185127 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/185127
>
> I understand how variable coefficients work when they're given by a
> formula and can be defined by an Expression. However, for most of
> the geophysical problems I'm interested in, some of the coefficients
> are observed (scalar) fields, so I have arrays of values at given
> points. In Matlab, I would interpolate these onto the mesh to define
> the coefficients. Is there a corresponding way of doing this in
> Dolfin? Couldn't figure this out from the tutorial.
>
> New to Dolfin, so hope this question isn't too vague. Mostly want to
> be sure a reasonable solution exists before committing to using
> Dolfin for a particular project. Thanks!

Yes, this can be done. Take a look at this demo:

  demo/undocumented/tensor-weighted-poisson

--
Anders

Can you help with this problem?

Provide an answer of your own, or ask Ryan Walker for more information if necessary.

To post a message you must log in.