File: tutorial.html

package info (click to toggle)
petsc 3.1.dfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 131,360 kB
  • ctags: 491,710
  • sloc: ansic: 288,064; cpp: 66,909; python: 28,799; fortran: 19,153; makefile: 13,945; sh: 3,502; f90: 1,655; xml: 620; csh: 230; java: 13
file content (115 lines) | stat: -rw-r--r-- 5,122 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>multi-physics</title>
</head>
<body>
<br>
<br>
<div style="text-align: center;"><big><big><big>PETSc multi-physics tutorial</big></big></big> <br>
<br>
<div style="text-align: left;"><span style="font-weight: bold;">Model problem 1:</span><br>
<br>
Three unknowns (u,v, Omega) that satisfy <br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Lap(U) - Grad_y(Omega) = 0<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; - Lap(V) + Grad_x(Omega) = 0<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; - Lap(Omega) + Div([U*Omega,V*Omega]) - GR*Grad_x(T) = 0<br>
<br>
on the unit square discretized with standard finite differences. Here GR is the grashof number.<br>
<br>
<br>
<span style="font-weight: bold;">Model problem 2:</span><br>
<br>
One unknown (T) that satisfies<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; - Lap(T) + PR*Div([U*T,V*T]) =
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
<br>
again on the unit square. Here PR is the prandtl number. <br>
<br>
For boundary conditions, no-slip, rigid-wall Dirichlet conditions are
used for [U,V]. Dirichlet conditions are used for Omega, based on the
definition of vorticity: Omega = - Grad_y(U) + Grad_x(V), where along
each constant coordinate boundary, the tangential derivative is zero.
Dirichlet conditions are used for T on the left and right walls, and
insulation homogeneous Neumann conditions are used for T on the top and
bottom walls. <br>
<br>
<span style="font-weight: bold;">Step 1<br>
<br>
</span>Define C structs that contains the field variables (u,v,Omega) and (T) <a href="mp.h.html">mp.h.html</a><br>
<br>
<span style="font-weight: bold;">Step 2</span><br>
<br>
Define a C struct to contain all the problem parameters <a href="mp.h.html#line12">mp.h.html</a><br>
<br>
<span style="font-weight: bold;">Step 3</span><br>
<br>
Write the <span style="font-style: italic;">physics </span>routines that define the nonlinear algebraic system for each physics <a href="ff1.c.html#FormFunctionLocal1">ff1.c.html</a> and <a href="ff2.c.html#FormFunctionLocal2">ff2.c.html.</a>
Note that these routines work on the local patch of the domain and
already have suitable ghost values set into the ghost nodes. Note also
that if values of the "other" physics is not available a value of zero
is used; more generally the "other" physics values would be provided as
fixed parameters.<br>
<br>
<span style="font-weight: bold;">Step 4 </span>(Optional)<br>
<br>
Write routines that generate the initial guess for each physics <a href="ff1.c.html#FormInitialGuessLocal1">ff1.c.html</a> and <a href="ff2.c.html#FormInitialGuessLocal2">ff2.c.html</a><br>
<br>
<span style="font-weight: bold;">For single physics <br>
<br>
</span>
<div style="margin-left: 40px;"><span style="font-weight: bold;">Step 5&nbsp;</span><br>
</div>
<br>
<div style="margin-left: 40px;">Write a main program <a href="p1.c.html#main">p1.c.html</a> and <a href="p2.c.html#main">p2.c.html </a><br>
</div>
<br>
<div style="margin-left: 40px;">This creates a DA to manage the layout
of the fields across the processes and a solver object DMMG that
manages the solution process. <br>
</div>
<br>
<div style="margin-left: 40px;"><span style="font-weight: bold;">Step 6</span><br>
<br>
Write a routine that maps from the global solution vector into the
local arrays (with ghost points) that is needed for the physics
computations <a href="p1.c.html#FormFunction">p1.c.html</a> and <a href="p2.c.html#FormFunction">p2.c.html</a><br>
<span style="font-weight: bold;"><br>
</span></div>
<span style="font-weight: bold;">For multi-physics </span><br>
<span style="font-weight: bold;"></span><br>
<span style="font-weight: bold;"></span>
<div style="margin-left: 40px;"><span style="font-weight: bold;">Step 5&nbsp;</span><br>
</div>
<br>
<div style="margin-left: 40px;">Write a main program <a href="mp.c.html#main">mp.c.html</a><a href="mp.c.html#main"></a><br>
</div>
<br>
<div style="margin-left: 40px;">This
creates a DA to manage the layout of each of&nbsp; the two fields across the processes
and a DMComposite object to combine them, then&nbsp;a solver object DMMG that manages the solution process. <br>
</div>
<br>
<div style="margin-left: 40px;"><span style="font-weight: bold;">Step 6</span><br>
<br>
Write
a routine that maps from the global solution vector into the local
arrays (with ghost points) that is needed for the multi-physics computations <a href="mp.c.html#FormFunctionComp">mp.c.html</a> </div>
<div style="margin-left: 80px;"><br>
</div>
<br>
<br>
<span style="font-weight: bold;"></span></div>
</div>
</body>
</html>