| Version 1 (modified by ccantwel, 14 months ago) (diff) |
|---|
XML Conditions definition
The final section of the file defines parameters and boundary conditions which define the nature of the problem to be solved. These are enclosed in the CONDITIONS tag.
Parameters
Parameters may be required by a particular solver (for instance time-integration parameters or solver-specific parameters), or arbitrary and only used within the context of the session file (e.g. parameters in the definition of an initial condition). All parameters are enclosed in the PARAMETERS XML element.
<PARAMETERS> ... </PARAMETERS>
A parameter may be of integer or real type and may reference other parameters defined previous to it. It is expressed in the file as
<P> [PARAMETER NAME] = [PARAMETER VALUE] </P>
For example,
<P> NumSteps = 1000 </P> <P> TimeStep = 0.01 </P> <P> FinTime = NumSteps*TimeStep </P>
Solver Information
These specify properties to define the actions specific to solvers, typically including the equation to solve, the projection type and the method of time integration. The property/value pairs are specified as XML attributes. For example,
<SOLVERINFO>
<I PROPERTY="EQTYPE" VALUE="UnsteadyAdvection" />
<I PROPERTY="Projection" VALUE="Continuous" />
<I PROPERTY="TimeIntegrationMethod" VALUE="ClassicalRungeKutta4" />
</SOLVERINFO>
The list of available solvers in Nektar++ can be found here?. Some of the solver pages provides the details on their properties, e.g. PulseWaveSolver?.
Variables
These define the number (and name) of solution variables. Each variable is prescribed a unique ID. For example a two-dimensional flow simulation may define the velocity variables using
<VARIABLES>
<V ID="0"> u </V>
<V ID="1"> v </V>
</VARIABLES>
Boundary Regions and Conditions
Boundary conditions are defined by two XML elements. The first defines the various boundary regions in the domain in terms of composite entities from the GEOMETRY section of the file. Each boundary region has a unique ID and are defined as, for example,
<BOUNDARYREGIONS>
<B ID="0"> C[2] </B>
<B ID="1"> C[3] </B>
</BOUNDARYREGIONS>
The second defines the actual boundary condition to impose on that composite region for each of the defined solution variables, and has the form,
<BOUNDARYCONDITIONS>
<REGION REF="0">
<D VAR="u" VALUE="sin(PI*x)*cos(PI*y)" />
<D VAR="v" VALUE="sin(PI*x)*cos(PI*y)" />
</REGION>
</BOUNDARYCONDITIONS>
Boundary condition specifications may refer to any parameters defined in the session file. The REF attribute corresponds to a defined boundary region. The tag used for each variable specifies the type of boundary condition to enforce. These can be either
- D: Dirichlet
- N: Neumann
- R: Robin
- P: Periodic
This page provides the list of all acceptable boundary condition types and syntax of their declarations.
Time-dependent boundary conditions may be specified through setting the USERDEFINEDTYPE attribute. For example,
<D VAR="u" USERDEFINEDTYPE="TimeDependent" VALUE="sin(PI*(x-t))" />
Periodic boundary conditions reference the corresponding boundary region with which to enforce periodicity.
The following example provides an example of three boundary conditions for a two-dimensional flow,
<BOUNDARYCONDITIONS>
<REGION REF="0">
<D VAR="u" USERDEFINEDTYPE="TimeDependent" VALUE="-cos(x)*sin(y)*exp(-2*t*Kinvis)" />
<D VAR="v" USERDEFINEDTYPE="TimeDependent" VALUE="sin(x)*cos(y)*exp(-2*t*Kinvis)" />
<P VAR="p" VALUE=[2]/>
</REGION>
<REGION REF="1">
<D VAR="u" USERDEFINEDTYPE="TimeDependent" VALUE="-cos(x)*sin(y)*exp(-2*t*Kinvis)" />
<D VAR="v" USERDEFINEDTYPE="TimeDependent" VALUE="sin(x)*cos(y)*exp(-2*t*Kinvis)" />
<N VAR="p" USERDEFINEDTYPE="H" VALUE="0.0"/>
</REGION>
<REGION REF="2">
<D VAR="u" USERDEFINEDTYPE="TimeDependent" VALUE="-cos(x)*sin(y)*exp(-2*t*Kinvis)" />
<D VAR="v" USERDEFINEDTYPE="TimeDependent" VALUE="sin(x)*cos(y)*exp(-2*t*Kinvis)" />
<P VAR="p" VALUE=[0]/>
</REGION>
<REGION REF="3">
<D VAR="u" USERDEFINEDTYPE="TimeDependent" VALUE="-cos(x)*sin(y)*exp(-2*t*Kinvis)" />
<D VAR="v" USERDEFINEDTYPE="TimeDependent" VALUE="sin(x)*cos(y)*exp(-2*t*Kinvis)" />
<D VAR="p" USERDEFINEDTYPE="TimeDependent" VALUE="-0.25*(cos(2*x)+cos(2*y))*exp(-4*t*Kinvis)"/>
</REGION>
</BOUNDARYCONDITIONS>
where the boundary regions which are periodic are linked via their region identifier (Region 0 and Region 2).
Boundary conditions can also be loaded from file, here an example from the Incompressible Navier-Stokes cases,
<REGION REF="1">
<D VAR="u" FILE="Test_ChanFlow2D_bcsfromfiles_u_1.bc" />
<D VAR="v" VALUE="0" />
<N VAR="p" USERDEFINEDTYPE="H" VALUE="0" />
</REGION>
Analytic functions
Finally, multi-variable functions such as initial conditions and analytic solutions may be specified for use in, or comparison with, simulations. These may be specified using expressions (<E>) or imported from a file (<F>) using the Nektar++ FLD file format
<FUNCTION NAME="ExactSolution">
<E VAR="u" VALUE="sin(PI*x-advx*t))*cos(PI*(y-advy*t))" />
</FUNCTION>
<FUNCTION NAME="InitialConditions">
<F FILE="session.rst" />
</FUNCTION>
A restart file is a solution file (in other words an .fld renamed as .rst) where the field data is specified. The expansion order used to generate the .rst file must be the same as that for the simulation. The filename must be specified relative to the location of the .xml file.
Other examples of this input features can be the insertion of a forcing term,
<FUNCTION NAME="BodyForce">
<E VAR="u" VALUE="0" />
<E VAR="v" VALUE="0" />
</FUNCTION>
<FUNCTION NAME="Forcing">
<E VAR="u" VALUE="-(Lambda + 2*PI*PI)*sin(PI*x)*sin(PI*y)" />
</FUNCTION>
or of a linear advection term
<FUNCTION NAME="AdvectionVelocity"> <E VAR="Vx" VALUE="1.0" /> <E VAR="Vy" VALUE="1.0" /> <E VAR="Vz" VALUE="1.0" /> </FUNCTION>
This page provides the list of acceptable mathematical functions and other related technical details.
Quasi-3D approach
To generate a Quasi-3D appraoch with Nektar++ we only need to create a 2D or a 1D mesh, as reported above, and then specify the parameters to extend the problem to a 3D case. For a 2D spectral/hp element problem, we have a 2D mesh and along with the parameters we need to define the problem (i.e. equation type, boundary conditions, etc.). The only thing we need to do, to extend it to a Quasi-3D approach, is to specify some additional parameters which characterise the harmonic expansion in the third direction. First we need to specify in the solver information section that that the problem will be extended to have one homogeneouns dimension; here an example
<SOLVERINFO> <I PROPERTY="SolverType" VALUE="VelocityCorrectionScheme"/> <I PROPERTY="EQTYPE" VALUE="UnsteadyNavierStokes"/> <I PROPERTY="AdvectionForm" VALUE="Convective"/> <I PROPERTY="Projection" VALUE="Galerkin"/> <I PROPERTY="TimeIntegrationMethod" VALUE="IMEXOrder2"/> <I PROPERTY="HOMOGENEOUS" VALUE="1D"/> </SOLVERINFO>
then we need to specify the parameters which define the 1D harmonic expanson along the z-axis, namely the homogeneous length (LZ) and the number of modes in the homogeneous direction (HomModesZ). HomModesZ corresponds also to the number of quadrature points in the homogenous direction, hence on the number of 2D planes discretized with a specral/hp element method.
<PARAMETERS> <P> TimeStep = 0.001 </P> <P> NumSteps = 1000 </P> <P> IO_CheckSteps = 100 </P> <P> IO_InfoSteps = 10 </P> <P> Kinvis = 0.025 </P> <P> HomModesZ = 4 </P> <P> LZ = 1.0 </P> </PARAMETERS>
In case we want to create a Quasi-3D approach starting form a 1D spectral/hp element mesh, the procedure is the same, but we need to specify the parameters for two harmonic directions (in Y and Z direction). For Example,
<SOLVERINFO> <I PROPERTY="EQTYPE" VALUE="UnsteadyAdvectionDiffusion" /> <I PROPERTY="Projection" VALUE="Continuous"/> <I PROPERTY="HOMOGENEOUS" VALUE="2D"/> <I PROPERTY="DiffusionAdvancement" VALUE="Implicit"/> <I PROPERTY="AdvectionAdvancement" VALUE="Explicit"/> <I PROPERTY="TimeIntegrationMethod" VALUE="IMEXOrder2"/> </SOLVERINFO> <PARAMETERS> <P> TimeStep = 0.001 </P> <P> NumSteps = 200 </P> <P> IO_CheckSteps = 200 </P> <P> IO_InfoSteps = 10 </P> <P> wavefreq = PI </P> <P> epsilon = 1.0 </P> <P> Lambda = 1.0 </P> <P> HomModesY = 10 </P> <P> LY = 6.5 </P> <P> HomModesZ = 6 </P> <P> LZ = 2.0 </P> </PARAMETERS>
By default the opeartions associated with the harmonic expansions are performed with the Matix-Vector-Multiplication (MVM) defined inside the code. The Fast Fourier Transofrm (FFT) can be used to speed up the operations (if the FFTW library has been compiled in ThirdParty, see the compilation instructions). To use the FFT routines we need just to insert a flag in the solver information as below:
<SOLVERINFO> <I PROPERTY="EQTYPE" VALUE="UnsteadyAdvectionDiffusion" /> <I PROPERTY="Projection" VALUE="Continuous"/> <I PROPERTY="HOMOGENEOUS" VALUE="2D"/> <I PROPERTY="DiffusionAdvancement" VALUE="Implicit"/> <I PROPERTY="AdvectionAdvancement" VALUE="Explicit"/> <I PROPERTY="TimeIntegrationMethod" VALUE="IMEXOrder2"/> <I PROPERTY="USEFFT" VALUE="FFTW"/> </SOLVERINFO>
The number of homogenenous modes has to be even. The Quasi-3D apporach can be created starting from a 2D mesh and adding one homogenous expansion or starting form a 1D mesh and adding two homogeneous expansions. Not other options available. In case of a 1D homogeneous extension, the homogeneous direction will be the z-axis. In case of a 2D homogeneous extension, the homogeneous directions will be the y-axis and the z-axis.
