File Formats
OFELI files use the XML syntax. They are valid XML documents. Input files can be given separately or gathered in one or more files.
A typical set of header lines of OFELI XML files is the following lines:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<OFELI_File>
<info>
<title></title>
<date></date>
<author></author>
</info>
...
...
</OFELI_File>
Tags title, date and author
can be filled in order to keep useful information for a user.
After the preamble given by the element <info>,
the XML file can contain any of the following elements in any order:
To describe project data: parameters, input and output files, ...
This information enables constructing the class IPF.
To describe domain geometry
To describe mesh data
To describe prescription of boundary conditions, body and boundary forces, ...
To describe material data
To describe input and output field data
To describe a tabulated function
The element Project enables giving various parameters to control program execution as well as various file names. All acquired data are used to construct the class IPF. When invoking this element, one must supply the attribute that gives the projects name as follows:
<Project name="project_name">
...
...
</Project>
The element Project has a large choice of subelements. Each subelement is a parameter that can be retrieved by calling a member function of class IPF. These parameters either have a predefined name, e.g. max_time that clearly chooses the maximal time for computations and whose is retrieved in the class IPF by the member function getMaxTime, or by a generic parameter for which a user can define a label. For instance, in the line
<parameter label="deltat" value="0.1"&/>
the read parameter is retrieved by the code line
dt = ipf.getDouble("deltat");
or equivalently
ipf.get("deltat",dt);
where ipf is an instance of class
IPF.The following table describes the list of parameters in the Prescription file:
verbose |
Level for information output. Typically, the integer number must be between 1 and 10. Its default value is 1 |
output |
Level for solution output. Its default value is 0 |
save |
Level for solution saving in file. Its default value is 0 |
plot |
An integer that defines a level for solution saving in plot file. Its default value is 0 |
bc |
Flag for boundary condition (Dirichlet) handling. 1: Boundary condition vector is described in a prescription file (Default value) 2: Boundary condition vector is in a field file |
bf |
Flag for body force handling. 1: Body force is described in a prescription file (Default value) 2: Body force vector is in a field file |
sf |
Flag for surface force (Neumann boundary condition) handling. 1: Surface force vector in a prescription file (Default value) 2: Read surface force vector in a field file |
init |
Flag for initial condition handling. 1: Initial solution in a prescription file (Default value) 2: Read initial solution in a field file |
max_time |
A real number that defines maximal time for a time dependent calculation. Its default value is 1.0 |
time_step | Time step for a time dependent calculation. Its default value is 0.1 |
nb_steps |
Number of time steps for a time dependent calculation. Its default value is 10 |
nb_iter |
Maximum number of iterations for an iterative scheme. Its default value is 100 |
tolerance |
Tolerance for convergence for an iterative scheme. Its default value is 1.e-6 |
integer |
An integer parameter that can be retrieved by the member function getIntPar(i) where i is the rank of appearance of this keyword. Up to 10 integer parameters can be contained in the file. This maximal number is defined by the constant MAX_NB_PAR in the OFELI constants |
double |
A double precision parameter that can be retrieved by the member function getDoublePar(i) where i is the rank of appearance of this keyword. Up to 10 double precision parameters can be contained in the file. This maximal number is defined by the constant MAX_NB_PAR in the OFELI constants |
complex |
A complex parameter that can be retrieved by the member function getComplexPar(i) where i is the rank of appearance of this keyword. Up to 10 complex parameters can be contained in the file. This maximal number is defined by the constant MAX_NB_PAR in the OFELI constants |
mesh_file |
Name of file that contains mesh data. The default mesh file name has as extension project_name.m |
init_file |
Name of file that contains initial data |
restart_file |
Name of file that contains restarting field file. This file is useful when an iteration process (or time stepping procedure) is used and the programs stops to restart later |
bc_file |
Name of file that contains (Dirichlet) boundary condition data |
bf_file |
Name of file that contains body force initial data |
sf_file |
Name of file that contains surface force data |
save_file |
Name of file that fields to save |
plot_file |
Name of file that contains fields to plot |
data_file |
Name of file that contains various data |
aux_file |
Name of file that contains any other data in any format. Any occurrence of this keyword will define a new file name that can be retrieved through the member function getAuxFile(i) where i is the rank of the appearance of this keyword. Up to 10 occurrences can be contained in the file. This maximal number is defined by the constant MAX_NB_PAR in the OFELI constants |
parameter |
As explained in the example above, this subelement must contain an option called label that identifies the parameters and then optionally the option value to specify a value. If this option is not present, a value must be given before closing the subelement |
Note that the argument of each subelement can be given either through the attribute value or through a value that given between the opening and the closing of the subelement.
Let us give a simple example of XML file using the Project element, where we have used both possibilities of defining subelements.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<OFELI_File>
<info>
<title>Project file</title>
<date>August 18, 2008</date>
<author>R. Touzani</author>
</info>
<Project name="beam">
<mesh_file>beam.m</mesh_file>
<data_file>beam.pr</data_file>
<parameter label="d-file">beam.d</parameter>
<parameter label="density" value="1.2"/>
<nb_iter>100</nb_iter>
<tolerance value="1.e-5"></tolerance>
<verbose>1</verbose>
<output>1</output>
<save value="1"/>
</Project>
</OFELI_File>
<Domain dim="2">
<vertex> 0. 0. 1 0.1</vertex>
<vertex> 1. 0. 1 0.1</vertex>
<vertex> 1. 1. 1 0.1</vertex>
<vertex> 0. 1. 1 0.1</vertex>
<vertex> 0.5 0.5 2 0.1</vertex>
<vertex> 0.6 0.5 2 0.1</vertex>
<line> 1 2 1</line>
<line> 2 3 1</line>
<line> 3 4 -2</line>
<line> 4 1 -2</line>
<circle> 6 6 5 1</circle>
<subdomain> 1 1 10</subdomain>
</Domain>
Let us describe the subelements of element Domain:
vertex |
To describe a vertex in the domain |
line |
To describe a straight line that joins 2 vertices |
circle |
To describe a circular arc |
subdomain |
To describe a subdomain with a specific code |
x y c h
where x and y are the vertex coordinates, h
is the mesh size around the vertex and c is the code to assign to the vertex. This code
will be transferred to the vertex once a mesh is generated
n1 n2 c
where the line goes from vertex n1 to vertex n2 and c
is the boundary condition code. This one is assigned to the nodes
generated on the line (Dirichlet) if it is positive and its opposite
value is assigned
to the sides generated on the line (Neumann) if it is
negative. Note the line is actually oriented from n1
to n2
n1 n2 n3 c
where the arc goes from vertex n1 to vertex
n2.
Note that we can have n1=n2 which in this case generates an entire circle.
The center of the circle is located at vertex n3.
The integer c stands for the code to assign
to nodes generated on the line (Dirichlet) if the code is positive
and its opposite value is assigned to the
to sides generated on the line (Neumann) if it is negative.
n i c
where n is a line (or arc) that belongs to
the boundary of the subdomain, i is the arc
orientation. It must be equal to 1 (anti-clockwise) or -1, and
c is a code (integer number) to associate to the subdomain
<Mesh dim="3" nb_dof="2">
...
...
</Mesh>
This element has the following subelements:
Nodes |
To describe nodes |
Elements |
To describe elements |
Sides |
To describe sides |
Material |
To describe materials for elements |
<Nodes>
x1 y1 z1 c1 x2 y2 z2 c2 x3 y3 z3 c3
x4 y4 z4 c4 ...
...
... ... xn yn zn cn
</Nodes>
More precisely, each node is given by its coordinates. In this example, a 3-D problem requires
three coordinates. For a 2-D problem only x and y-coordinates are required. The coordinates are
followed by an integer number that describes a code to associate to the node. This code is used
to prescribe boundary conditions. It is important to mention that any nonzero code enforces a
boundary condition of a given DOF (Degree Of Freedom). By convention, this code is chosen such
that it has as many digits as the number of DOF for the node. For instance if the number of DOF
of a node is 3, then the code number 231 yields a code 2
for the first DOF, 3 for the second DOF and 1 for
the third one. <Elements shape="triangle" nodes="3">
1 2 5 1 2 3 5 1
3 4 5 1 4 1 5 1
</Elements>
<Elements shape="quadrilateral" nodes="4">
2 6 7 3 2
</Elements>
Note that the elements are grouped shape by shape.
<Sides shape="line" nodes="2">
1 2 1 2 3 1
</Sides>
Note that the sides are grouped shape by shape.
<Material>
1 Rubber
5 Copper
</Material>
More precisely, each material is given by an integer that is the code and a string that is the
material name. Either the material file exists in the given list of OFELI
materials (here files Rubber.md and
Copper.md), or the user provides in his
own directory the required material file.
BoundaryCondition |
To prescribe (essential or Dirichlet) boundary conditions |
BodyForce |
To prescribe body forces or sources, ... |
Source |
Identical to BodyForce |
BoundaryForce |
To prescribe boundary forces (Neumann boundary conditions), like tractions, fluxes, ... |
Traction |
Identical to BoundaryForce |
Flux |
Identical to BoundaryForce |
Initial |
To prescribe an initial condition |
<BoundaryCondition code="1" dof="2">x*exp(t)</BoundaryCondition>
More precisely, this subelement has the following attributes:
<BodyForce dof="2">1.0</BodyForce>
As it can be noticed, this subelement works like BoundaryCondition
except the attribute code which has no meaning in this context
<BoundaryForce code ="5" dof="2">x-y</BoundaryForce>
As it can be noticed, this subelement works like BoundaryCondition,
The difference being that this condition is generally applied to sides (edges or faces)
whereas the Dirichlet boundary condition applies generally to nodes.
<Initial dof="1">(1.0+sin(x))*exp(-t)</Initial>
As it can be noticed, this subelement works like BodyForce
for instance.
Let us give as example the material file for the material Copper. Here is the listing of the file Copper.md the
<?xml version="1.0" encoding="ISO-8859-1" ?>
<OFELI_File>
<info>
<title>Material data for Copper</title>
<date></date>
<author></author>
</info>
<Material name="Copper">
<Density>1.</Density>
<SpecificHeat>8920.</SpecificHeat>
<ThermalConductivity>401.</ThermalConductivity>
<ElectricConductivity>5.9302e07</ElectricConductivity>
<ElectricResistivity>1.6863e-8</ElectricResistivity>
<MagneticPermeability>12.566371e-7</MagneticPermeability>
<PoissonRatio>0.34</PoissonRatio>
<YoungModulus>15.e10</YoungModulus>
</Material>
</OFELI_File>
Density |
Density of material (Heat and Mass Transfer) |
SpecificHeat |
Specific Heat (Heat Transfer) |
ThermalConductivity |
Thermal Conductivity (Heat Transfer) |
MeltingTemperature |
Melting Temperature (Heat Transfer) |
EvaporationTemperature |
Evaporation Temperature (Heat Transfer) |
ThermalExpansion |
Thermal Expansion (Heat and Mass Transfer) |
LatentHeatMelting |
Latent Heat for Melting (Heat Transfer) |
LatentHeatEvaporation |
Latent Heat for Evaporation (Heat Transfer) |
DielectricConstant |
Dielectric Constant (Electromagnetism) |
ElectricConductivity |
Electric Conductivity (Electromagnetism) |
ElectricResistivity |
Electric Resistivity: Inverse of Conductivity (Electromagnetism) |
MagneticPermeability |
Magnetic Permeability (Electromagnetism) |
Viscosity |
Kinematic Viscosity (Fuid Dynamics) |
YoungModulus |
Young Modulus (Solid Mechanics) |
PoissonRatio |
Poisson Ratio (Solid Mechanics) |
Fields can be divided into 3 types depending on the degree of freedom support: Fields can be given by nodes, elements or sides. In addition, in view of handling time-dependent problems, the file can contain as many vectors as necessary, each one corresponding to a given time step.
A typical file containing fields looks like this
<OFELI_File>
... ...
<Field name="Temperature" type="Node" nb_dof="1">
<Step time="0.1">
... ...
... ...
</Step>
<Step time="0.2">
... ...
... ...
</Step>
</Field>
<Field name="Displacement" type="Element" nb_dof="2">
<Step time="0.1">
<constant dof="1">1.0</constant>
<expression dof="2">x*exp(t)</expression>
</Step>
</Field>
</OFELI_File>
<Function name="Density">
<Variable label="x" nb_pts="5" min="0" max="1"/>
<Variable label="y" nb_pts="4" min="10" max="12"/>
<Data>
1.0 2.0 5.0 7.0
2.0 3.0 5.0 8.0
7.0 2.0 5.0 9.0
0.0 2.0 8.0 10.0
11.0 20.0 25.0 30.0
</Data>
</Function>
Let us describe the subelements of element Function:
Variable |
To describe a variable |
Data |
To give list of function values |
val(1,1) val(1,2) ... val(1,n2)
val(2,1) val(2,2) ... val(2,n2)
...
val(n1,1) val(n1,2) ... val(n1,n2)
where n1 and n2 are the number of points for the first and
second variable respectively.