<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
I want to use PETSC for large problem about diffusive model in
epidemiological field.<br>
I'm using the slides 'Advanced PETSc Tutorial, Maison de la
Simulation, Orsay, France, June 2013 (Matt)'.<br>
<br>
My first step is to simulated a problem 0=-\nabla u + f(u), where f
is a linear or non-linear function, with FEM. To do this I'm
adapting the example ex12.c for the linear problem:<br>
<br>
0=-\nabla u + w*w*u<br>
with the exact solution u(x,y)=exp(w*x)+exp(w*y). The Dirichlet
boundary condition are defined from the exact solution, like in
example ex12.<br>
<br>
To do this, I change only the two following functions:<br>
<br>
double WW=1.0;<br>
void quadratic_u_2d(const PetscReal x[], PetscScalar *u)<br>
{<br>
*u = exp(WW*(x[0])) +exp(WW*(x[1])) ;<br>
}<br>
<br>
void f0_u(const PetscScalar u[], const PetscScalar gradU[], const
PetscReal x[], PetscScalar f0[])<br>
{<br>
const PetscInt Ncomp = NUM_BASIS_COMPONENTS_0;<br>
PetscInt comp;<br>
<br>
for (comp = 0; comp < Ncomp; ++comp) f0[comp] = WW*WW*u[comp] ;<br>
}<br>
<br>
<br>
The result is :<br>
$ ./ex12 -refinement_limit 0.01 -snes_monitor_short
-snes_converged_reason<br>
0 SNES Function norm 22.1518 <br>
1 SNES Function norm 0.364312 <br>
2 SNES Function norm 0.0165162 <br>
3 SNES Function norm 0.000792446 <br>
4 SNES Function norm 3.81143e-05 <br>
5 SNES Function norm 1.83353e-06 <br>
6 SNES Function norm 8.8206e-08 <br>
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations
6<br>
Number of SNES iterations = 6<br>
L_2 Error: 0.00511<br>
<br>
<br>
Something is wrong because it is a linear problem, why the snes
didn't converge in one iteration ?<br>
<br>
Thanks a lot.<br>
<br>
Olivier B<br>
<br>
On 07/18/2013 03:39 PM, Olivier Bonnefon wrote:
<blockquote cite="mid:51E7F011.2020408@avignon.inra.fr" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
On 07/18/2013 03:26 PM, Matthew Knepley wrote:
<blockquote
cite="mid:CAMYG4GmXRoVSctf57BnThOut=SZ+Ay_yKk_fwzH3786GKF212Q@mail.gmail.com"
type="cite">
<div dir="ltr">On Thu, Jul 18, 2013 at 8:17 AM, Olivier Bonnefon
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:olivier.bonnefon@avignon.inra.fr"
target="_blank">olivier.bonnefon@avignon.inra.fr</a>></span>
wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> It is what I
wanted, it works. <br>
If I well understand the code, ex12.h contains the P1
implementation. To simulate an other system, with time
dependences for examples (du/dt), I have to adapt the
plugin functions.<br>
</div>
</blockquote>
<div><br>
</div>
<div>The way I would add time dependence is to convert
this from a SNES example into a TS example. I can help
you</div>
<div>do this since I want to start using TS by default.
Does this sound reasonable?</div>
</div>
</div>
</div>
</blockquote>
Yes, of course. My goal is to simulate diffusive equation with non
linear sources, for example Lotka-Voltera competion. <br>
<br>
Olivier B<br>
<blockquote
cite="mid:CAMYG4GmXRoVSctf57BnThOut=SZ+Ay_yKk_fwzH3786GKF212Q@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<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"> Thanks a lot.<br>
<br>
Olivier B<br>
<br>
On 07/18/2013 01:12 PM, Matthew Knepley wrote:
<blockquote type="cite">
<div dir="ltr">On Thu, Jul 18, 2013 at 5:08 AM,
Olivier Bonnefon <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:olivier.bonnefon@avignon.inra.fr"
target="_blank">olivier.bonnefon@avignon.inra.fr</a>></span>
wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">Hello,<br>
<br>
I have a 2-d heat equation that I want to
simulate with Finit Element Method, to do
this, I'm looking for an example solving 2D
poisson equation with FEM (DMDA or DMPlex).
Is there an example like this ?<br>
</blockquote>
<div><br>
</div>
<div>There is, but there it is still somewhat
problematic. I use FIAT to generate the
basis function tabulation,</div>
<div>so you have to configure with</div>
<div><br>
</div>
<div> --download-fiat
--download-scientificpython
--download-generator</div>
<div><br>
</div>
<div>and you need mesh generation and
partitioning</div>
<div><br>
</div>
<div> --download-triangle --download-chaco</div>
<div><br>
</div>
<div>and then you can run SNES ex12 using
Builder (which will make the header file)</div>
<div><br>
</div>
<div> python2.7 ./config/builder2.py check
src/snes/examples/tutorials/ex12.c</div>
<div><br>
</div>
<div>Jed and I are working on an all C version
of tabulation which would mean that you
could bypass</div>
<div> the Python code generation step. Once
the header is generated for the element you
want, then</div>
<div>you can just run the example as normal.</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"> Thanks a lot.<span><font
color="#888888"><br>
<br>
Olivier Bonnefon<br>
<br>
-- <br>
Olivier Bonnefon<br>
INRA PACA-Avignon, Unité BioSP<br>
Tel: <a moz-do-not-send="true"
href="tel:%2B33%20%280%294%2032%2072%2021%2058"
value="+33432722158" target="_blank">+33
(0)4 32 72 21 58</a><br>
<br>
</font></span></blockquote>
</div>
<br>
<br clear="all">
<span class="HOEnZb"><font color="#888888">
<div><br>
</div>
-- <br>
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 </font></span></div>
<span class="HOEnZb"><font color="#888888"> </font></span></div>
<span class="HOEnZb"><font color="#888888"> </font></span></blockquote>
<span class="HOEnZb"><font color="#888888"> <br>
<br>
<pre cols="72">--
Olivier Bonnefon
INRA PACA-Avignon, Unité BioSP
Tel: <a moz-do-not-send="true" href="tel:%2B33%20%280%294%2032%2072%2021%2058" value="+33432722158" target="_blank">+33 (0)4 32 72 21 58</a></pre>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
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>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Olivier Bonnefon
INRA PACA-Avignon, Unité BioSP
Tel: +33 (0)4 32 72 21 58</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Olivier Bonnefon
INRA PACA-Avignon, Unité BioSP
Tel: +33 (0)4 32 72 21 58</pre>
</body>
</html>