8.4 Examples

The regression tests under solvers/ADRSolverRedesign/Tests are complete, runnable session files; two are quoted here.

Weak-DG advection with a time-dependent Dirichlet condition

From UnsteadyAdvection1D_TimeDependentDirichlet_DG.xml: a 1D advection problem, integrated with fourth-order Runge-Kutta, whose boundary value is a function of time.

1<SOLVERINFO> 
2  <I PROPERTY="EQTYPE"               VALUE="UnsteadyAdvection" /> 
3  <I PROPERTY="Projection"           VALUE="DisContinuous"     /> 
4  <I PROPERTY="AdvectionType"        VALUE="WeakDG"            /> 
5  <I PROPERTY="UpwindType"           VALUE="Upwind"            /> 
6  <I PROPERTY="AdvectionAdvancement" VALUE="Explicit"          /> 
7</SOLVERINFO> 
8<TIMEINTEGRATIONSCHEME> 
9  <METHOD> RungeKutta </METHOD> 
10  <ORDER> 4 </ORDER> 
11</TIMEINTEGRATIONSCHEME> 
12<PARAMETERS> 
13  <P> TimeStep       = 0.001              </P> 
14  <P> NumSteps       = 100                </P> 
15  <P> FinTime        = NumSteps*TimeStep  </P> 
16  <P> advx           = 1.0                </P> 
17</PARAMETERS>

Interior-penalty diffusion on a hybrid mesh

From ExDiffusion_2D_IP_hybrid_m3.xml: explicit diffusion on a mesh of triangles and quadrilaterals, with the interior-penalty scheme at its default coefficients.

1<SOLVERINFO> 
2  <I PROPERTY="EQTYPE"                VALUE="UnsteadyDiffusion" /> 
3  <I PROPERTY="Projection"            VALUE="DisContinuous"     /> 
4  <I PROPERTY="AdvectionType"         VALUE="WeakDG"            /> 
5  <I PROPERTY="DiffusionType"         VALUE="InteriorPenalty"   /> 
6  <I PROPERTY="DiffusionAdvancement"  VALUE="Explicit"          /> 
7</SOLVERINFO> 
8<TIMEINTEGRATIONSCHEME> 
9  <METHOD> RungeKutta </METHOD> 
10  <ORDER> 4 </ORDER> 
11</TIMEINTEGRATIONSCHEME> 
12<PARAMETERS> 
13  <P> TimeStep        = 0.000001          </P> 
14  <P> NumSteps        = 500               </P> 
15  <P> FinTime         = TimeStep*NumSteps </P> 
16</PARAMETERS>

The companion files _Neumann, _mixedBC and _periodic run the same problem under those boundary conditions, and ExDiffusion_3D_IP_prism_hex.xml the 3D case on prisms and hexahedra.

Spatially varying diffusion tensors

For steady systems and implicit continuous diffusion, a DiffusionCoefficient function replaces the constant Dij parameters. Define every independent component in packed upper-triangular order: D00 in one coordinate dimension; D00,D01,D11 in two; and D00,D01,D11,D02,D12,D22 in three. For example,

1<FUNCTION NAME="DiffusionCoefficient"> 
2  <E VAR="D00" VALUE="1 + x*x" /> 
3  <E VAR="D01" VALUE="0.2" /> 
4  <E VAR="D11" VALUE="2 + y*y" /> 
5</FUNCTION>

The solver multiplies all components by epsilon. Unsteady implicit solves evaluate the function at each stage time, including expressions that use t, and rebuild the preconditioner after updating the tensor. Variable coefficients are not yet supported by the explicit DG diffusion flux operators. On homogeneous expansions the tensor describes diffusion in the expansion plane; the homogeneous contribution retains its unit coefficient and has no cross-plane coupling.

For diffusion parallel and perpendicular to a magnetic field, use Dij = κ⊥δij +(κ∥-κ⊥)BiBj∕|B|2 to form the component expressions. The element operators also accept this tensor as a physical-space Field through their SetVarDiffCoeff method. They retain non-owning pointers: the field must outlive every application, and updates to its values are read on the next application.