Commit 22480695 authored by Lambert Theisen's avatar Lambert Theisen
Browse files

Add lid driven cavity as first example

- Can maybe used later to compare against torrilhon2013
parent 877f575e
#!/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)
# 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
// 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};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment