getfem-users
[Top][All Lists]

## Re: simple assemble questions

 From: Yves Renard Subject: Re: simple assemble questions Date: Fri, 18 Jun 2021 20:52:53 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

```

Dear Edouard,

In your example, 'a' seems to be a data, so that it has to be declared

```
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
```

```
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.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
```

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

I apologize one again for these naive questions,

best

Edouard.

```
```
--

Yves Renard (Yves.Renard@insa-lyon.fr)       tel : (33) 04.72.43.87.08
INSA-Lyon
20, rue Albert Einstein
69621 Villeurbanne Cedex, FRANCE
http://math.univ-lyon1.fr/~renard

---------

```