Model problem 1:
Three unknowns (u,v, Omega) that satisfy
- Lap(U) - Grad_y(Omega) = 0
- Lap(V) + Grad_x(Omega) = 0
- Lap(Omega) + Div([U*Omega,V*Omega]) - GR*Grad_x(T) = 0
on the unit square discretized with standard finite differences. Here GR is the grashof number.
Model problem 2:
One unknown (T) that satisfies
- Lap(T) + PR*Div([U*T,V*T]) =
0
again on the unit square. Here PR is the prandtl number.
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.
Step 1
Define C structs that contains the field variables (u,v,Omega) and (T)
mp.h.html
Step 2
Define a C struct to contain all the problem parameters
mp.h.html
Step 3
Write the
physics routines that define the nonlinear algebraic system for each physics
ff1.c.html and
ff2.c.html.
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.
Step 4 (Optional)
Write routines that generate the initial guess for each physics
ff1.c.html and
ff2.c.html
For single physics
Step 5
This creates a DA to manage the layout
of the fields across the processes and a solver object DMMG that
manages the solution process.
Step 6
Write a routine that maps from the global solution vector into the
local arrays (with ghost points) that is needed for the physics
computations
p1.c.html and
p2.c.html
For multi-physics
Step 5
This
creates a DA to manage the layout of each of the two fields across the processes
and a DMComposite object to combine them, then a solver object DMMG that manages the solution process.
Step 6
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
mp.c.html