getfem-users
[Top][All Lists]

## Re: [Getfem-users] gf_global_function Matlab interface.

 From: Ronan Perrussel Subject: Re: [Getfem-users] gf_global_function Matlab interface. Date: Thu, 14 Oct 2010 16:55:52 +0200 User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Lightning/1.0b1 Thunderbird/3.0.8

```Dear Yves,

```
thanks a lot for the explanations. I am going to try to adapt the idea to my problem.
```
```
In fact, I already dealt with my problem using the c++ code (but for many reasons it would more practical under matlab) and in the corresponding program, I refer to global function but never to level-set function. I start from the example of Roman Putanowicz concerning axisymmetric problems :
```http://www.mail-archive.com/address@hidden

Thanks again,
Best regards,
Ronan

Le 14/10/2010 16:14, Yves Renard a écrit :
```
```
Dear Ronan,

You have to define both the two level-set functions. A levelset object can
contain in fact two level-set functions. This is due to the fact that the goal
was to model a crack geometry. The first level-set describe the geometry of the
crack and the second one the crack front (the intersection of the two level-
set is the crack front). This is rather standard. The two level-set functions
have to be such that the iso-values are nearly orthogonal and define a system
of coordinate. So x,y is defined relatively to this system of coordinate whan
level-set are used.

Moreoever, you have to replace 'outside' by 'inside' in your mesh_im (and in
fact you can use a regular integration method in your case). this gives:

m = gfMesh('cartesian', 0:1, 0:1); % Unit square with only one element.
gf = gfGlobalFunction('parser', '1'); % Global function is 1.
ls  = gfLevelSet(m, 1, 'x-2', 'y-2');
mls = gfMeshLevelSet(m);
mfg = gfMeshFem('global function', m, ls, {gf});
volume = gf_asm('volumic', m.get('cvid'), 'V(#1)+=comp(Base(#1))(:)', mim,
mfg);

But of course, you are right, it should be possible to use it without a level-
set (but this is not possible for the moment even in the c++ code). In fact it
would be sufficient to define a "global_function_not_on_levelseté similar to
"global_function_on_levelset" in getfem_mesh_fem_global_function.cc and
interface it in gf_mesh_fem.cc.

Yves.

On jeudi 14 octobre 2010, Ronan Perrussel wrote:
```
```Dear getfem users,

I am still trying to use gf_global_function with the Matlab interface.
It seems not possible to use gf_global_function under the Matlab
interface without using  levelset (but it is possible in C++) and I try
to understand how it works.

I try a (new) stupid example to understand :
m = gfMesh('cartesian', 0:1, 0:1); % Unit square with only one element.
gf = gfGlobalFunction('parser', '1'); % Global function is 1.
ls  = gfLevelSet(m, 1);
ls.set('values', 'x-2.'); % With this levelset p(x, y)<  0 inside the
domain.
mls = gfMeshLevelSet(m);
mfg = gfMeshFem('global function', m, ls, {gf});
mils = gf_mesh_im('levelset', mls, 'outside', gf_integ('IM_QUAD(3)'));
volume = gf_asm('volumic', m.get('cvid'), 'V(#1)+=comp(Base(#1))(:)',
mils, mfg); % I integrate my global function over the whole domain.

As my global function is 1 over the domain (and the mesh contains only
one element), I thought that I would obtain the area of the domain but I
just got zero. What is wrong?

Best regards,
Ronan
```
```
```
```
```

ronan_perrussel.vcf
Description: Vcard