gerris
-
Upload
somdeb-bandopadhyay -
Category
Documents
-
view
22 -
download
1
description
Transcript of gerris
1 0 GfsSimulation GfsBox GfsGEdge {} { Refine 5 # Code Gerris here!!}GfsBox { # Boundary conditions here!!}
Simplest gerris code :: an empty box
Simple, but does nothing...
One box
Zero connection Reserved keywords
Grid description
Box description
Refine 5 Refine 2 Refine 2 Refine 6
Refine (y < x ? 6 : 3)
The Refine keyword
Specifying conditions on the box’ sides
Boundary conditions can be specified on the top, left, bottom and right sides of the box
These conditions take the general form
GfsBoundary { [ GfsBc ] [ GfsBc ]}
where GfsBc is one of
• GfsBcDirichlet (Dirichlet condition)
• GfsBcNeumann (Neumann condition)
• GfsBcNavier (Navier/Robin condition)
Examples:GfsBox { left = Boundary { BcDirichlet U 1 } right = BoundaryOutflow}
GfsBox { left = Boundary { BcDirichlet P 1 } right = Boundary { BcDirichlet P 0 }}
GfsBox { left = Boundary { BcDirichlet U ( sin(2.*M_PI*0.05*t) ) } right = BoundaryOutflow}
1 0 GfsSimulation GfsBox GfsGEdge {} { Refine 5}GfsBox { left = Boundary { BcDirichlet P 1 } right = Boundary { BcDirichlet P 0 }}
How to output?
Our first nontrivial simulation can be written as:
and executed with:
gerris2D tutorial1.gfs
but nothing happens! (again)
We here need to output the various fields computed by gerris at given times.
The time, as seen by gerris, can be either expressed in physical time units, or in computational time (number of iterations). For example,
GfsTime { t = 1.4 i = 32 }
will set the initial time to 1.4 and the initial number of iterations to 32. Analogously,
GfsTime { end = 2 iend = 32 }
will force the simulation to end either when the physical time reaches 2, either when 32 iterations have been performed.
To output results, we will call GfsOutput or its children:
GfsOutputSimulation { start = 0.6 step = 0.3 } file.gfs
or
GfsOutputLocation { step = 1 } data given_pts
How to output?
Where given_pts is a file like:
0 -0.5 0 0 -0.49 0 0 -0.48 00 -0.47 00 -0.46 00 -0.45 0......0 0.44 00 0.45 00 0.46 00 0.47 00 0.48 00 0.49 00 0.5 0
0.0 0.2 0.4 0.6 0.8 1.0 1.2
�0.4
�0.2
0.0
0.2
0.4
Plotting data then gives our parabolic profile:
???
We should have obtained a parabolic profile, no?
Including viscosity
GfsSourceViscosity Value
The value of viscosity can be set via the keyword:
Setting the adherence conditions, we finally get:
1 0 GfsSimulation GfsBox GfsGEdge {} { Refine 5 GfsTime { end = 5 } GfsSourceViscosity 1 GfsOutputLocation { step = 1 } data given_pts}GfsBox { left = Boundary { BcDirichlet U 1 } right = BoundaryOutflow top = Boundary { BcDirichlet U 0 BcDirichlet V 0 } bottom = Boundary { BcDirichlet U 0 BcDirichlet V 0 }}
0.0 0.5 1.0 1.5
�0.4
�0.2
0.0
0.2
0.4
And we finally get our parabolic profile!
Including solids
4 3 GfsSimulation GfsBox GfsGEdge {} { Refine 5 Solid (x*x + y*y - 0.125*0.125) Time {end = 10} SourceViscosity 1./400. OutputSimulation { start = end } file10.gts }GfsBox { left = Boundary { BcDirichlet U 1 }}GfsBox {}GfsBox {}GfsBox { right = BoundaryOutflow}1 2 right2 3 right3 4 right 34s 1min58s 17min02s
Adaptive meshing
GfsAdaptVorticity { istep = 1 } { maxlevel = 6 cmax = 1e-2 }
9min04s
17min02s
Passive tracers
4 3 GfsSimulation GfsBox GfsGEdge {} { Refine 5 Time { end = 20 } VariableTracer T SourceViscosity 1./400 AdaptGradient { istep = 1 } {maxlevel = 6 cmax = 1e-2} T OutputSimulation { step = 1 } stdout}GfsBox { left = Boundary { BcDirichlet U ( (y > -0.05 && y < 0.05 ) ? 1 : 0 )" BcDirichlet T ( (y > -0.05 && y < 0.05 ) ? 1 : 0 ) }}GfsBox {}GfsBox {}GfsBox { right = BoundaryOutflow}1 2 right2 3 right3 4 right
Passive tracers with diffusion
SourceDiffusion T 0.001
15min15s
Non-miscible tracers :: the VOF technique
VariableTracerVOF T1InitFraction T1 ((x)*(x) + y*y - 0.125*0.125)
Adding surface tension
VariableCurvature K T1SourceTension T1 0.1 K
VariableCurvature K T1SourceTension T1 0.001 K
20min33s
5min47s
The Rayleigh-Plateau instability# Air/water physical parametersDefine RHO_L 998.Define RHO_G 1.2Define MU_L 1.003e-3Define MU_G 1.8e-5
# Initial conditionsDefine RADIUS 0.2Define EPSILON 0.02
# Make sure that volume fraction is between [0:1]Define VAR(T,min,max) (min + CLAMP(T,0,1)*(max - min))Define RHO(T) VAR(T, RHO_G/RHO_L, 1.)Define MUR(T) VAR(T, MU_G/MU_L, 1.)
1 0 GfsSimulation GfsBox GfsGEdge {} { Time { end = 1.7 } Refine 5
VariableTracerVOF T PhysicalParams { alpha = 1./RHO(T1) }
# We need Kmax as well as K(mean) for adaptivity VariableCurvature K T Kmax SourceTension T 1 K SourceViscosity 1e-2*MUR(T1)
(...)
The Rayleigh-Plateau instability(...) # Initial deformed tube (only a quarter of it) InitFraction {} T ({" x -= 0.5; " y += 0.5; z += 0.5;" double r = RADIUS*(1. + EPSILON*cos(M_PI*x));" return r*r - y*y - z*z; })
# Adapt according to interface curvature. Make sure we have at # least 5 grid points per radius of curvature, up to level # 10. Only start after 5 timesteps to ignore transients due to # initialisation AdaptFunction { istart = 5 istep = 10 } {" cmax = 0.2" maxlevel = 10" cfactor = 2 } (T > 0 && T < 1 ? dL*Kmax : 0)
# Remove small satellite droplets (only keep the two largest pieces) RemoveDroplets { istep = 10 } T -2
OutputSimulation { istep = 1000 } plateau-%ld.gfs
# Generate three movies on the fly # Generate figures}(...)
The Rayleigh-Plateau instability(...)GfsBox { top = BoundaryOutflow bottom = Boundary back = Boundary front = BoundaryOutflow left = Boundary right = Boundary}