XML v4.0 GUIDE
XML v4.0 GUIDE
April 2016
DualSPHysics team
1
Post-Processing Pre-Processing
Input & output files
2
Input & output files: Format files
XML File
Case_Def.xml
• The eXtensible Markup Language is textual data format compatible
Case.xml with any hardware and software.
• Information is structured and organised by using labels.
• They can be easily edited using any text editor.
BINARY File
Case.bi4 • Binary format consumes six times less memory than text format.
• Reading or writing is several times faster using a binary format.
Part_xxxx.bi4
PartOut.obi4 • A special code is required to read the data (JPartDataBi4.cpp/.h).
• “.bi4” is the new binary format that also includes double precision.
• The user can also define new arrays that post-processing tools can
automatic manage.
3
Input & output files
Constants and configuration
parameters for simulation
5
STRUCTURE OF THE XML FILE
“casedef”
“execution”
6
STRUCTURE OF THE XML FILE
• “casedef” :
- constantsdef constants needed in SPH
• “execution”
- special automatic wave generation and external forces
- wavepaddles (piston & piston_spectrum)
- accinputs
8
XML file CASEDEF-CONSTANTSDEF
Lattice
9
XML file CASEDEF-CONSTANTSDEF
Gravity
d va Pb Pa
mb ab a Wab g
dt b b a
10
XML file CASEDEF-CONSTANTSDEF
Speed of sound
𝑠𝑝𝑒𝑒𝑑𝑠𝑦𝑠𝑡𝑒𝑚 = 𝑔 ∙ ℎ𝑠𝑤𝑙
cs2 w
P 1
w
11
XML file CASEDEF-CONSTANTSDEF
Speed of sound
𝑠𝑝𝑒𝑒𝑑𝑠𝑦𝑠𝑡𝑒𝑚 = 𝑔 ∙ ℎ𝑠𝑤𝑙
cs2 w
P 1
w
12
XML file CASEDEF-CONSTANTSDEF
Speed of sound
𝑠𝑝𝑒𝑒𝑑𝑠𝑦𝑠𝑡𝑒𝑚 = 𝑔 ∙ ℎ𝑠𝑤𝑙
cs2 w
P 1
w
13
XML file CASEDEF-CONSTANTSDEF
Kernel size
ℎ = 𝑐𝑜𝑒𝑓ℎ ∙ 𝑑𝑥 2 + 𝑑𝑦 2 + 𝑑𝑧 2
coefh=1 typical value
ℎ = 𝑐𝑜𝑒𝑓ℎ ∙ 3 ∙ 𝑑𝑝2
coefh=1.2, 1.5 better for wave propagation
ℎ = 𝑐𝑜𝑒𝑓ℎ ∙ 3 ∙ 𝑑𝑝
Other option is to define:
ℎ𝑑𝑝 = ℎ/𝑑𝑝 14
XML file CASEDEF-CONSTANTSDEF
Time-step
15
CASEDEF-MKCONFIG
mkorientfluid = “xyz”
16
XML file CASEDEF-GEOMETRY-DEFINITION
A 2-D configuration can be generated by imposing the same values along Y-direction
<pointmin> = <pointmax>
18
XML file CASEDEF-GEOMETRY-COMMANDS-MAINLIST
19
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
This command indicates the mode to create points where particles will be generated
wire face
<setdrawmode>:
– “wire”: wire mode
– “face”: draw faces
– “solid”: draw inside
– “full”: combines face and solid
solid full
20
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
21
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
shapeout: creates VTK files (polygons) shapeout: creates VTK files (polygons)
of only some bound objects of all the bound objects
Case_Box_Dp.vtk Case__Real.vtk
Case_Building_Dp.vtk Case__Dp.vtk
reset=“true” objects created after this command will be saved on a different VTK file
22
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
These commands indicate the type of particles to be generated
23
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
Transformation utilities
<rotate>:a starting vector and angle are given for object rotation
<matrixreset>: the modified matrix is replaced by the original one (identity matrix)
24
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
26
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
TRIANGLES
27
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
TRIANGLES
0 2
4
6
8
1
3
5
7
28
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
TRIANGLES
4
3
5
0 1
5
6
0
4
7
3
8
2
9
1/10
29
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
TRIANGLES
7
6
1
30
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
FIGURE
DrawFigure DrawTriangles or
(drawmode=solid) DrawFigure (drawmode=face)
31
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
Pyramid1 Pyramid2
(mask=0) (mask=2=0010)
32
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
PRISM
33
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
PRISM
34
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
PRISM
35
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
MASK
mask=“12” decimal 12 is 1100 in binary third and fourth face are hidden
36
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
PRISM
There is a second and easiest system to use mask
mask can be also defined using the index of the faces instead of bits
In this example, faces 1, 2, 6 and 7 are not created, only 3,4 and 5
It is important to use symbol “|” to detect this system!!!
EXAMPLE: CaseWavemaker_Def.xml
2 3
7 4
1 6
5
3
37
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
BOX
<drawbox>: draws a box with an initial point and the size
<boxfill> indicates if solid or face and the faces to be hidden
back
top
right
left
bottom
front
BoxSolid (solid) BoxA (all)
BeachFace
BeachFace
(mask=“128”)
<drawbeach>: draws a beach with the lateral points that formed the profile of the beach
mask indicates the faces to be hidden .
39
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
SPHERE
<drawsphere>: draws a sphere with the center point and the radius
Sphere Sphere
(drawmode=solid) (drawmode=face)
when face:
ctesphere indicates the width of the sphere
ctespherenumsides indicates the number of triangles used
to create the VTK of polygons
40
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
CYLINDER
<drawcylinder>: draws a cylinder with two points and radius
mask indicates the faces to be hide
Cylinder Cylinder
(drawmode=solid) (drawmode=face)
when face:
ctecylindertube indicates the width of the tube
ctecylindercover indicates the width of the covers
ctespherenumsides indicates the number of triangles used
to create the VTK of polygons
41
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
IMPORTING EXTERNAL GEOMETRIES
42
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
IMPORTING EXTERNAL GEOMETRIES
43
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
FILLING DOMAINS
44
CASEDEF-GEOMETRY-COMMANDS-MAINLIST
FILLING DOMAINS
seed point
limits of the
domain to fill
46
CASEDEF-INITIALS
INITIAL VELOCITIES
vbox = (-0.875,0,5.886)
vsphere = (1.05,0,4.905)
47
CASEDEF-INITIALS
INITIAL VELOCITIES
48
CASEDEF-FLOATINGS
DEFINING FLOATINGS
When the interaction of solids (boundaries or floatings) is computed using Discrete Element Method (DEM)
some extra properties with parameters used in DEM are loaded from “Floating_Materials.xml”:
50
CASEDEF-PROPERTIES
DEFINING OTHER VARIABLES
Using section properties, users can define variables to be assigned to one or more mk.
Each label of property has a name and can group several values
that can be text (other) or a number (weight)
51
CASEDEF-PROPERTIES
These properties can be loaded from an external file using propertyfile.
In this case, users have to indicate file name and path to access section with properties.
Section links assigns one or more property to one or several values of mk:
- Values of material_1 are assigned to fluid particles with mk=0
- Values of material_2 and data_x are assigned to boundary particles with mk=1,3,4,5,6
It is also possible to indicate one property directly in the definition of the floatings:
52
CASEDEF-PROPERTIES
GenCase reads the information from case.casedef.properties and writes in case.execution.particles.properties.
53
CASEDEF-MOTION
•Motion01: uniform rectilinear motion (<mvrect />) that also includes pauses (<wait />)
54
CASEDEF-MOTION
•Motion01: uniform rectilinear motion (<mvrect />) that also includes pauses (<wait />)
55
CASEDEF-MOTION
•Motion02: combination of two uniform rectilinear motions (<mvrect />)
56
CASEDEF-MOTION
•Motion02: combination of two uniform rectilinear motions (<mvrect />)
57
CASEDEF-MOTION
•Motion03: movement of an object depending on the
movement of another (hierarchy of objects)
58
CASEDEF-MOTION
•Motion03: movement of an object depending on the movement of another (hierarchy of objects)
59
CASEDEF-MOTION
•Motion04: accelerated rectilinear motion (<mvrectace />)
60
CASEDEF-MOTION
•Motion04: accelerated rectilinear motion (<mvrectace />)
61
CASEDEF-MOTION
•Motion05: rotational motion (<mvrot />)
62
CASEDEF-MOTION
•Motion05: rotational motion (<mvrot />)
63
CASEDEF-MOTION
•Motion06: accelerated rotation motion (<mvrotace />) and accelerated circular motion (<mvcirace />).
64
CASEDEF-MOTION
•Motion06: accelerated rotation motion (<mvrotace />) and accelerated circular motion (<mvcirace />).
65
CASEDEF-MOTION
•Motion07: sinusoidal movement (<mvrectsinu />, <mvrotsinu />, <mvcirsinu />)
66
CASEDEF-MOTION
•Motion07: sinusoidal movement (<mvrectsinu />, <mvrotsinu />, <mvcirsinu />)
67
CASEDEF-MOTION
•Motion08: predefined movement with data from an external file (<mvpredef /> or <mvfile />)
68
CASEDEF-MOTION
•Motion08: predefined movement with data from an external file (<mvpredef /> or <mvfile />)
69
CASEDEF-MOTION
•Motion09: predefined movement with data from an external file (<mvrotfile />)
70
CASEDEF-MOTION
•Motion09: predefined movement with data from an external file (<mvrotfile />)
71
XML file EXECUTION-SPECIAL-WAVEPADDLES-PISTON
•savemotion: saves theoretical results of elevation and orbital velocities at xpos and zpos
73
EXECUTION-SPECIAL-WAVEPADDLES-PISTON_SPECTRUM
Generation of irregular waves
74
EXECUTION-SPECIAL-WAVEPADDLES-PISTON_SPECTRUM
Generation of irregular waves
•waveorder: order of wave generation (1st order or 2nd order)
•spectrum: type of spectrum (Jonswap or Pierson-Moskowitz)
•waveheight: significant wave height Hs
•waveperiod: peak wave period Tp
•serieini: initial series of the irregular train is chosen from “WavePaddle_mkb0010_Serie.csv”
•ramptime: time to slowly start a smoothed movement of the piston (being zpos=-depth of the measuring point)
•savemotion: saves theoretical results of elevation and orbital velocities at xpos and zpos
75
XML file EXECUTION-PARAMETERS
76
XML file EXECUTION-PARAMETERS
Double precision
depth: hSWL=0.18 m
length=18 m
length>depth>>dp
77
XML file EXECUTION-PARAMETERS
Time integrator scheme
t n t n 2
1 1 1
n n
n 1
ra r 2
a
n
va v va
a
2
Fa
Symplectic algorithm 2 2
t n1
1
t n n
1
n n 1
a 2 an Da ra ra 2 va
2 2
Predictor Corrector 78
XML file EXECUTION-PARAMETERS
Kernel function
d va Pb Pa
mb ab a Wab g
dt b b a
Cubic Spline 3 2 3 3
1 2 q 4 q 0 q 1
1
W r,h α D 2 q 3 1 q 2
4
0 q2
where 𝛼𝐷 is equal to 10/7πh2 in 2-D and 1/πh3 in 3-D
Wendland 4
q
W r,h αD 1 2q 1 0 q 2
2
d va Pb Pa
mb
ab a Wab g
dt b b a
α cab μab
v ab rab 0
Π ab ρab
v ab rab 0
0
α=0.01 for wave tanks
higher values of α for dam-break (depends on dp)
80
XML file EXECUTION-PARAMETERS
Viscosity treatment
d va Pb Pa
mb
ab a Wab g
dt b b a
α cab μab
v ab rab 0
Π ab ρab
0 v ab rab 0
81
XML file EXECUTION-PARAMETERS
Viscosity treatment
dv a P P
mb b2 a2 aWab g
dt b ρb ρa
P P 4υ0 rab aWab
mb b2 a2 aWab g mb
dv a v
2 ab
(ρa ρb )( rab η )
2
dt b ρb ρa b
dv a Pb Pa 4υ0 rab aWab τ ijb τ ija
mb 2 2 aWab g mb v mb 2 2 aWab
2 ab ρ
ρb ρa (ρa ρb )( rab η ) b ρa
2
dt b b b
4υ0 rab aWab τ ijb τ ija
mb v ab mb aW-6ab 2
a ρ 2 υ is2 kinematic
η ρ(typically
viscosity 2 10 m s for water
b ρa
b (ρ b )( rab o ) b
2
τ ijb τ ija
mb 2 2 aWab
ρ
b b ρa
82
XML file EXECUTION-PARAMETERS
DeltaSPH formulation
dρa ρa 1
mb v ab aWab 2 h mb cab 1 2 aWab
ρb rab η
2
dt b b
83
XML file EXECUTION-PARAMETERS
Shifting algorithm
r D Ci No Shifting
mj
D As h u i t Ci Wij
j j
Shifting update Concentration gradient
Shifting that ignores fixed boundaries
SHIFTING
SHIFTING IN THE NORMAL DIRECTION
IS NOT APPLIED FOR PARTICLES
AT THE FREE SURFACE
r 1.5 r
mj
rij iWij
Particle divergence j ρj
XML file EXECUTION-PARAMETERS
Interaction between solids
DEM is recommended
ℎ
∆𝑡𝑚𝑖𝑛𝑖𝑚𝑢𝑚 = 0.05 ∙
𝑐𝑠
ℎ
∆𝑡𝑖𝑛𝑖𝑡 =
𝑐𝑠
0: b ϵ fluid/floating
OR
1: b ϵ fluid/floating + boundaries
86
XML file EXECUTION-PARAMETERS
Physical time and frequency to store data
87
XML file EXECUTION-PARAMETERS
Δz=0.3 m
Δz=0 m
89
object.ply
object.vtk
XML file Case_Def.xml object.stl GENCASE mov.dat Case.xml
object.ply
forces.csv
Case_All.vtk Case.bi2
Case.xml Case_Bound.vtk
GENCASE mov.dat
Case_Fluid.vtk
forces.csv
Case_All.vtk Case.bi2 DUALSPHYSICS
Case__Actual.vtk
mov.dat Case.xml Case_Bound.vtk Case__Dp.vtk
Case_Fluid.vtk
forces.csv Case.bi2 DUALSPHYSICS
Case__Actual.vtk Part_xxxx.bi2 Run.out
Case__Dp.vtk PartOut.bi2
90
XML file Summary of the number of created
particles and computed constants
mass=rhop0*dp*dp*dp in 3D
mass=rhop0*dp*dp in 2D
xx.bi2 Run.out
.bi2 PointsPos.csv
Text file with execution log
Points.txt
ISOSURFACE MEASURETOOL
Surface_xxxx.vtk Pressure.csv
Velocity.csv
Height_xxxx.vtk
Acceleration.ascii
Domain dimensions
computed starting from
minimum and maximum
positions of the particles
created initially
92
Case__Dp.vtk
Input & output files
PHYSICS
xx.bi2 Run.out
.bi2 PointsPos.csv
Text file with execution log
Points.txt
ISOSURFACE MEASURETOOL
Surface_xxxx.vtk Pressure.csv
Velocity.csv
Height_xxxx.vtk
Acceleration.ascii
93
Case__Dp.vtk
Input & output files
PHYSICS
xx.bi2 Run.out
.bi2 PointsPos.csv
Text file with execution log
Points.txt
ISOSURFACE MEASURETOOL
Surface_xxxx.vtk Pressure.csv
Velocity.csv
Height_xxxx.vtk
Acceleration.ascii
94
Post-Processing Pre-Processing
Input & output files
95