Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Lambert Theisen
fenicsR13
Commits
22480695
Commit
22480695
authored
Jul 29, 2019
by
Lambert Theisen
Browse files
Add lid driven cavity as first example
- Can maybe used later to compare against torrilhon2013
parent
877f575e
Changes
3
Hide whitespace changes
Inline
Side-by-side
fenicsR13/examples/lid_driven_cavity/create_mesh.py
0 → 100755
View file @
22480695
#!/usr/bin/env python3
"Script to generate a set of ring meshes"
import
os
import
dolfin
as
df
GMSH_PATH
=
"gmsh"
GEO_NAME
=
"lid"
def
create_mesh
(
exponent
):
"Generates a mesh using gmsh"
mesh_name
=
"{}{}"
.
format
(
GEO_NAME
,
exponent
)
os
.
system
(
"{} -setnumber p {} -2 -o {}.msh {}.geo"
.
format
(
GMSH_PATH
,
exponent
,
mesh_name
,
GEO_NAME
))
os
.
system
(
"dolfin-convert {0}.msh {0}.xml"
.
format
(
mesh_name
))
mesh
=
df
.
Mesh
(
"{}.xml"
.
format
(
mesh_name
))
subdomains
=
df
.
MeshFunction
(
"size_t"
,
mesh
,
"{}_physical_region.xml"
.
format
(
mesh_name
))
boundaries
=
df
.
MeshFunction
(
"size_t"
,
mesh
,
"{}_facet_region.xml"
.
format
(
mesh_name
))
file
=
df
.
HDF5File
(
mesh
.
mpi_comm
(),
"{}.h5"
.
format
(
mesh_name
),
"w"
)
file
.
write
(
mesh
,
"/mesh"
)
file
.
write
(
subdomains
,
"/subdomains"
)
file
.
write
(
boundaries
,
"/boundaries"
)
return
(
mesh
,
subdomains
,
boundaries
)
for
p
in
range
(
0
+
1
,
5
+
1
):
create_mesh
(
p
)
fenicsR13/examples/lid_driven_cavity/input.yml
0 → 100644
View file @
22480695
# Case name, used as output folder
case_name
:
lid_driven_cavity
# Meshes
# ======
# Input files in h5 format.
# List containing one or more meshes to perform simulation on.
meshes
:
# - lid0.h5
# - lid1.h5
# - lid2.h5
# - lid3.h5
# - lid4.h5
-
lid5.h5
# - lid6.h5
# - lid7.h5
# - lid6.h5
elements
:
"
theta"
:
"
shape"
:
"
Lagrange"
"
degree"
:
1
"
s"
:
"
shape"
:
"
Lagrange"
"
degree"
:
1
"
p"
:
"
shape"
:
"
Lagrange"
"
degree"
:
1
"
u"
:
"
shape"
:
"
Lagrange"
"
degree"
:
1
"
sigma"
:
"
shape"
:
"
Lagrange"
"
degree"
:
1
# Stabilization
# =============
# - continous interior penalty (cip) with three parameters delta_i
stabilization
:
cip
:
enable
:
True
delta_1
:
1.0
delta_2
:
1.0
delta_3
:
0.01
# Formulation Parameters
# ======================
# Number of spatial dimensions, currently only two-dimensional.
nsd
:
2
# heat, stress, coupled
mode
:
"
stress"
# Coefficients as in westerkamp2019 or without as in torrilhon2017
use_coeffs
:
True
# Knudsen number
tau
:
0.08
# Refaction coefficient
xi_tilde
:
1.0
# xi_tilde: 0.7978845608 # sqrt(2/pi)
bcs
:
3000
:
"
name"
:
"
upper"
"
theta_w"
:
1.0
"
v_t"
:
-1.0
3100
:
"
name"
:
"
lower"
"
theta_w"
:
0.5
"
v_t"
:
0.0
# heat source
heat_source
:
"
2.0
-
1.0
*
pow(sqrt(pow(x[0],2)+pow(x[1],2)),2)"
# mass source
mass_source
:
"
0"
# Perform convergence study on given set of meshes with exact solution
convergence_study
:
enable
:
False
exact_solution
:
esols/01_source_rot.cpp
plot
:
False
write_systemmatrix
:
False
fenicsR13/examples/lid_driven_cavity/lid.geo
0 → 100644
View file @
22480695
// Command line Parameters
If(!Exists(p))
p = 5;
EndIf
// Settings
res = 100;
Mesh.CharacteristicLengthMax = 1.0 * 2^(-p);
Mesh.MshFileVersion = 2.0;
Point(1001) = {0, 0, 0, res};
Point(1002) = {1, 0, 0, res};
Point(1003) = {1, 1, 0, res};
Point(1004) = {0, 1, 0, res};
Line(2001) = {1001,1002};
Line(2002) = {1002,1003};
Line(2003) = {1003,1004};
Line(2004) = {1004,1001};
Line Loop(3000) = {2003}; Physical Curve("upper",3000) = {2003};
Line Loop(3100) = {2004,2001,2002}; Physical Curve("lower",3100) = {2004,2001,2002};
Plane Surface(4000) = {3000,3100}; Physical Surface("mesh",4000) = {4000};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment