Basic question - I've solved a scalar Laplacian and I want to output the gradient #3590
Replies: 3 comments 3 replies
-
To do this exactly, find a finite element space that contains the gradient and interpolate to it. For the example of CG1, the gradient is in (rotated) RT0 but you might as well interpolate to DG1 which contains RT0 as a subspace. |
Beta Was this translation helpful? Give feedback.
-
Thanks so much, I try VV = VectorFunctionSpace(mesh,"DG",0) but I get that error can't interpolate an expression with an argument into a Function ... how do I do this pls? (aside I guess rotated RT0 is RTE0 ... i.e. tangentially-continuous ...) |
Beta Was this translation helpful? Give feedback.
-
Any chance a TrialFunction instead of a Function is being interpolated in the code?On May 24, 2024, at 4:51 PM, Colin J Cotter ***@***.***> wrote:
huh! project should work here anyway, and is cheap for DG (you need DG1 though)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Dear community,
Apologies in advance for what's probably a silly question.
I've solved a Laplace eq for a potential phi (let's say it's on a function space of CG 1 elements); I can output phi fine, but how do I output grad(phi)? The interface doesn't allow me to set up a Function (on whatever space) and interpolate grad(phi), saying "cannot interpolate an expression with an argument into a Function".
Also I'd like to output grad phi to the accuracy of the phi solve (i.e. not enforce continuity in the gradient that isn't there in the true gradient of phi).
Thanks!
(Search for matching discussions done - nada.)
Beta Was this translation helpful? Give feedback.
All reactions