<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Ok, I think what I will do is the
following:<br>
<br>
<div>
<div>void top_bc(const PetscReal x[], PetscScalar *u, void *ctx)</div>
<div>{</div>
<div> *u = 0.2;</div>
<div>}</div>
</div>
<div>
<div>
<div>void bottom_bc(const PetscReal x[], PetscScalar *u, void
*ctx)</div>
<div>{</div>
<div> *u = 0.0;</div>
<div>}</div>
</div>
</div>
<br>
<br>
ierr = DMPlexAddBoundary(dm, PETSC_TRUE,"bottom","Face
Sets",0,(void (*)())bottom_bc,1,ids[0],&user);CHKERRQ(ierr);<br>
ierr = DMPlexAddBoundary(dm, PETSC_TRUE,"top","Face Sets",0,(void
(*)())top_bc,1,ids[1],&user);CHKERRQ(ierr);<br>
<br>
Matt, have you started writing some documentation for these
function?<br>
If not I could probably get something started since I'm reading
them.<br>
<br>
Another question, how do I explain to my DMPlex that I am solving
an elasticity problem and hence my solution field will be a 2
components vector and not a scalar? I haven't seen where you set
this info in snes example 12...<br>
<pre class="moz-signature" cols="72">Best,
Luc</pre>
On 01/22/2015 05:19 PM, Matthew Knepley wrote:<br>
</div>
<blockquote
cite="mid:CAMYG4G=4P-QvO2xxXAMEeDRDKsCmqHmH35Mm37wq8WAJpNfDQQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, Jan 22, 2015 at 4:17 PM, Luc
Berger-Vergiat <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:lb2653@columbia.edu"
target="_blank">lb2653@columbia.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Yes you are right, I corrected for the machine
epsilon.<br>
I also looked deeper in Petsc's source code and I
think I understand better how you implemented the GMSH
reader.<br>
For instance the label I really care about is "Face
Sets" since it detects automatically the BC's for me.<br>
An issue is that "Face Sets" contains 4 strata and I
only care about two of these strata.<br>
How can I get the names of the Strata and how can I
loop over the strata to assign my BCs?<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Instead of "marker" give "Face Sets"</div>
<div><br>
</div>
<div>Instead of 1, give 2</div>
<div><br>
</div>
<div>Instead of &id give ids, where PetscInt ids[2] =
{stratumValue1, stratumValue2}</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>
<pre cols="72">Best,
Luc</pre>
On 01/22/2015 05:12 PM, Matthew Knepley wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, Jan 22, 2015 at
12:08 PM, Luc Berger-Vergiat <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:lb2653@columbia.edu"
target="_blank">lb2653@columbia.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi
all,<br>
I'm trying to test some functionalities in
DMPlex, specifically I want to do a 2d fem
simulation using a mesh generated by GMSH.<br>
At this point I am trying to understand how
Dirichlet BC can be applied.<br>
<br>
Can you explain to me what arguments I have to
pass to:<br>
DMPlexAddBoundary()?<br>
</blockquote>
<div><br>
</div>
<div>
<div> ierr = DMPlexAddBoundary(dm,
PETSC_TRUE,"wall","marker",(void
(*)())top_displacement,1,&id,user)</div>
</div>
<div><br>
</div>
<div>PETSC_TRUE means that these unknowns will
be eliminated from the global system</div>
<div><br>
</div>
<div>"wall" is the name of the BC</div>
<div><br>
</div>
<div>"marker" is the name of the DMLabel that
you want to use to identify the mesh points</div>
<div><br>
</div>
<div>1 is the number of label IDs that identify
constrained mesh points</div>
<div><br>
</div>
<div>id is the label ID which identifies
constrained mesh points</div>
<div><br>
</div>
<div>top_displacement is the function used to
set boundary values</div>
<div> </div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I
am attaching a little bit of c code and my
mesh.geo and mesh.msh so that you understand
the context.<br>
The BCs I want to apply are displacement of
0.2 in the y direction if y==1.0<br>
0.0 in the x direction if y==0.0</blockquote>
<div><br>
</div>
<div>I might do this:</div>
<div><br>
</div>
<div>
<div>void top_displacement(const PetscReal
x[], PetscScalar *u, void *ctx)</div>
<div>{</div>
<div> *u = x[1] < PETSC_MACHINE_EPSILON ?
0.0 : 0.2;</div>
<div>}</div>
</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font
color="#888888"><br>
<span class="HOEnZb"><font color="#888888">
-- <br>
Best,<br>
Luc<br>
<br>
</font></span></font></span></blockquote>
<span class="HOEnZb"><font color="#888888"> </font></span></div>
<span class="HOEnZb"><font color="#888888"> <br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>What most experimenters take for granted
before they begin their experiments is
infinitely more interesting than any results
to which their experiments lead.<br>
-- Norbert Wiener</div>
</font></span></div>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">What most experimenters take for
granted before they begin their experiments is infinitely
more interesting than any results to which their experiments
lead.<br>
-- Norbert Wiener</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>