[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Behaviour of compute_gradient

From: Konstantinos Poulios
Subject: Re: Behaviour of compute_gradient
Date: Thu, 2 Jun 2022 14:14:03 +0200

Dear Eloi,

This function normally expects VD to have either the same Qdim as V.qdim() or 1. In your case, where V is a scalar MeshFem, the only option that I see for VD is to also be a scalar MeshFem.


On Wed, Jun 1, 2022 at 9:56 AM Eloi Martinet <> wrote:
I'm using the python interface of GetFEM. I am a bit confused about the behaviour of the function compute_gradient. I would expect to use it the following way (for a planar 2D mesh) :

V = gf.MeshFem(mesh_2D, 1)
V.set_fem(gf.Fem("FEM_PK(2, 1)"))
VD = gf.MeshFem(V.linked_mesh(), 2)   # HERE
VD.set_fem(gf.Fem("FEM_PK_DISCONTINUOUS(2, 0)"))
f = some function over V
grad_f = gf.compute_gradient(V, f, VD)

However, when I do this, I have a Dimension mismatch, whereas there is no error when I put
VD = gf.MeshFem(V.linked_mesh(), 1)
even if grad_f is of size [2, VD.nbdof()] afterward.

Could you please explain this behaviour ? 
Sincerly yours,

LJK, PhD Student.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]