Skip to content

How to construct an input XML file

My Linh Würzburger edited this page Dec 17, 2020 · 2 revisions

Automated Construction

In order to keep usage errors as low as possible, a supporting script xml-builder.shscript in the ARTSS/tools folder (used from the terminal) is provided for setting up XML files. The xml-builder.sh has built-in options for different solvers:

  • Pure advection (--advection)
  • Pure diffusion (--diffusion) and turbulent diffusion (--diffturb)
  • Pure pressure (--pressure)
  • Advection and diffusion (--burgers)
  • Navier-Stokes equations for velocity (--ns)
    • with turbulence modelling (--nsturb)
    • with energy equation for temperature (--nstemp)
      • with turbulence modelling (--nstempturb)
      • with passive scalar equation for concentration (--nstempcon)
      • with turbulence modelling (--nstempturbcon)

Mandatory to provide are appropriate initial (--initialconditions) and boundary conditions (--boundaryconditions), which are declared in corresponding txt files. If applicable, also all domain obstacles (--domainobstacles) and all surface patches (--domainsurfaces) have to be explicitly declared via txt files, which the script then parses. In order to build various XML files with different simulation times, time and/ or spatial resolutions or iterations, the entry of multiple parameters for --nx, --ny, --nz, --dt, --tend, and --maxiter is possible by the separation of values with commas. To assure that the different setups are saved in different XML files use the printf specifier %d for multiple files (as in --xml testcase_No_%d.xml).

It is worth mentioning that there is no validation of the chosen (or default) parameters (all shown with ./xml-builder.sh -h).

Example of xml-builder.sh Usage

# 1. To get an overview of the options, type
./xml-builder.sh -h

# 2. To build up a Navier-Stokes solver
# with no external forces in domain [0,1]ˆ3
# with set time and spatial resolution, type e.g.,
./xml-builder.sh --ns \
	--forcefct Zero --forcedir xyz \
	--initialconditions ifile.txt \
	--boundaryconditions bfile.txt \
	--xstart 0. --xend 1. \
	--ystart 0. --yend 1. \
	--zstart 0. --zend 1. \
	--tend 10. --dt 0.01 --nu 0.001 \
	--nx 514 --ny 514 --nz 514 \
	--vtkplots 100 --solavail No \
	--xml filename.xml

Example of an XML input file

An example XML file for solving the Navier-Stokes and energy equation with an LES turbulence model is described below. It utilised the Semi-Lagrangian method for advection, the Jacobi method for diffusion with the Constant Smagorinsky-Lilly method, the explicit Euler method for adding buoyancy forces, a V-cycle multigrid method for pressure.

<?xml version="1.0" encoding="UTF-8" ?>
<ARTSS>
  <physical_parameters>
    <t_end> 300. </t_end>       <!-- simulation end time -->
    <dt> 0.01 </dt>             <!-- time stepping -->
    <nu> 2.44139e-05 </nu>      <!-- kinematic viscosity -->
    <beta> 3.28e-3 </beta>      <!-- thermal expansion -->
    <g> -9.81 </g>              <!-- gravitation -->
    <kappa> 3.31e-5 </kappa>    <!-- thermal diffusion -->
    </physical_parameters>

  <solver description = "NSTempTurbSolver" > 
    <advection type = "SemiLagrangian" field = "u,v,w"/>
    <diffusion type = "Jacobi" field = "u,v,w">
      <max_iter> 100 </max_iter>
      <tol_res> 1e-07 </tol_res>
      <w> 1 </w>
    </diffusion>
    <turbulence type = "ConstSmagorinsky">
      <Cs> 0.2 </Cs>
    </turbulence>
    <source type = "ExplicitEuler" force_fct = "Buoyancy" dir = "y">
    </source>
    <pressure type = "VCycleMG" field = "p">
      <n_level> 6 </n_level>
      <n_cycle> 2 </n_cycle>
      <max_cycle> 4 </max_cycle>
      <tol_res> 1e-07 </tol_res>
      <diffusion type = "Jacobi" field = "p">
        <n_relax> 4 </n_relax>
        <max_solve> 100 </max_solve>
        <tol_res> 1e-07 </tol_res>
        <w> 0.6666666667 </w>
      </diffusion>
    </pressure>
    <temperature>
      <advection type = "SemiLagrangian" field = "T"/>
      <diffusion type = "Jacobi" field = "T">
        <max_iter> 100 </max_iter>
        <tol_res> 1e-07 </tol_res>
        <w> 1 </w>
      </diffusion>
      <turbulence include = "Yes">
        <Pr_T> 0.9 </Pr_T>
      </turbulence>
      <source type = "ExplicitEuler" temp_fct = "Zero" dissipation = "No"/>
    </temperature>
    <solution available = "No"/>
  </solver>

  <domain_parameters>
    <X1> -0.3675 </X1>  <!-- physical domain -->
    <X2> 0.3675 </X2>   <!-- defined by opposing corners -->
    <Y1> -0.06 </Y1>
    <Y2> 0.59 </Y2>
    <Z1> -0.2875 </Z1>
    <Z2> 0.2875 </Z2>
    <x1> -0.3675 </x1>  <!-- computational domain -->
    <x2> 0.3675 </x2>   <!-- defined by opposing corners -->
    <y1> -0.06 </y1>
    <y2> 0.59 </y2>
    <z1> -0.2875 </z1>
    <z2> 0.2875 </z2>
    <Nx> 130 </Nx>      <!-- computational grid resolution -->
    <Ny> 130 </Ny>
    <Nz> 130 </Nz>
  </domain_parameters>
	
  <boundaries>
    <boundary field="u,v,w"
            patch="front,back,left,right,top,bottom"
            type="dirichlet"
            value="0.0" />
		<boundary field="p"
            patch="front,back,left,right,top,bottom"
            type="neumann"
            value="0.0" />
		<boundary field="T"
            patch="front,back,left,right,top,bottom"
            type="dirichlet"
            value="304.64" />
		<obstacle ID="0" field="T"
            patch="front,back,left,right,top"
            type="dirichlet"
            value="423.17" />
  </boundaries>
	
	<initial_conditions usr_fct = "LayersT" dir="y">
		<n_layers> 5 </n_layers>
		<border_1> 0.11 </border_1>         <!-- at cell face -->
		<border_2> 0.23 </border_2>
		<border_3> 0.35 </border_3>
		<border_4> 0.47 </border_4>
		<value_1> 303.64 </value_1>         <!-- in Kelvin -->
		<value_2> 304.04 </value_2>
		<value_3> 305.24 </value_3>
		<value_4> 308.84 </value_4>
		<value_5> 310.54 </value_5>
	</initial_conditions>
	
	<visualisation save_vtk="Yes" save_csv="No">
                <vtk_nth_plot> 100 </vtk_nth_plot>        <!-- every 100th time step, resulting in 4 files (0, 100, 200, 300) -->
	</visualisation>
</ARTSS>

Here, the heat source is defined via boundary conditions. In case of a volumetric heat source prescribing the heat release rate, use (not in combination!)

	<source type = "ExplicitEuler" temp_fct = "GaussST" dissipation = "No">
		<HRR> 50.3 </HRR> <!-- total HRR (in kW) -->
		<cp> 1. </cp> <!-- c_p (in kJ/kgK) -->
		<x0> 0. </x0> <!-- center of Gaussian -->
		<y0> 0.02 </y0>
		<z0> 0. </z0>
		<sigma_x> 0.25 </sigma_x> <!-- FWHM -->
		<sigma_y> 0.6 </sigma_y>
		<sigma_z> 0.25 </sigma_z>
		<tau> 5. </tau> <!-- ramp up time -->
	</source>

Error Sources and Restrictions

Be cautious about potential sources of errors:

  • When setting attributes in quotes, never include whitespaces
  • The number of levels, <n_level> [...] </n_level>, in the multigrid method must be at least l = max(o-1, p-1, q-1) with Nx=2^o +2, Ny=2^p +2, Nz=2^q +2 for o,p,q being natural numbers (including zero)
  • Do not use one cell thick obstacles or multiple obstacles occupying all inner cells (especially when restricting to the lowest level in the multigrid method)

Back to Wiki home

Clone this wiki locally