getfem-users
[Top][All Lists]
Advanced

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

Re: simple assemble questions


From: Edouard Oudet
Subject: Re: simple assemble questions
Date: Sat, 19 Jun 2021 07:59:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

Great!
Thanks a lot,
best.

On 6/18/21 8:52 PM, Yves Renard wrote:


Dear Edouard,

In your example, 'a' seems to be a data, so that it has to be declared
md.add_fem_data('a', fem)

If you declare it as a variable, the matrix given by gf.asm will have some entries for the variable 'a'.

And concerning your second example, you can of course reference a matrix data. For instance for a 3x3 matrix field with

md.add_initialized_fem_data('M', fem, VM, [3,3])

where VM is the vector of the values of the matrix field in each dof (and in the fortran order for the components of the matrices).

Best regards,

Yves


Le 18/06/2021 à 19:36, Edouard Oudet a écrit :
Dear getfem users,

I am interested in computing the following fem matrices on a domain Omega for Lagrange elements of order k

1) ∫∂Ω (∇u.n) v  a dσ

where a is a vector of length the number of dof, u and v are test functions and n the normal. I tried the following steps

md = gf.Model("real")
md.add_fem_variable('u', fem)
md.add_fem_variable('a', fem)
md.set_variable('a', ones(nbdof))

faces = gf.Mesh.get(tmesh, 'outer_faces')
bregion_id = 1
tmesh.set_region(bregion_id, faces)

 B = gf.asm('generic', mim, 2, 'Normal.Grad_Test_u * Test2_u. a', bregion_id, md)

Does it look correct?

2) ∫Ω (M ∇u) . ∇v dx

where again u and v are scalar functions and M a matrix field (defined for every dof). I had in mind to do something like

A = gf.asm("generic", mim, 2, "(M * Grad_Test2_u).Grad_Test_u", -1, md)

but I do not know how how to define the matrix field and how to manage its product with my gradients.

Any comments are welcome..

I apologize one again for these naive questions,

best

Edouard.



--
Edouard Oudet : http://www-ljk.imag.fr/membres/Edouard.Oudet/
IMAG - Bureau 164
700 avenue Centrale
38400 Saint Martin d'Hères
+33 (0)4 57 42 17 71  (office LJK)




reply via email to

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