Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new checkpointing for the mountain examples #380

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/compressible/mountain_hydrostatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,26 @@
# ---------------------------------------------------------------------------- #

# Domain
# Make an normal extruded mesh which will be distorted to describe the mountain
nlayers = res*20 # horizontal layers
columns = res*12 # number of columns
m = PeriodicIntervalMesh(columns, L)

ext_mesh = ExtrudedMesh(m, layers=nlayers, layer_height=H/nlayers)
Vc = VectorFunctionSpace(ext_mesh, "DG", 2)
coord = SpatialCoordinate(ext_mesh)
x = Function(Vc).interpolate(as_vector([coord[0], coord[1]]))

# Describe the mountain
a = 10000.
xc = L/2.
x, z = SpatialCoordinate(ext_mesh)
hm = 1.
zs = hm*a**2/((x-xc)**2 + a**2)

zh = 5000.
xexpr = as_vector([x, conditional(z < zh, z + cos(0.5*pi*z/zh)**6*zs, z)])

# Make new mesh
new_coords = Function(Vc).interpolate(xexpr)
mesh = Mesh(new_coords)
mesh._base_mesh = m # Force new mesh to inherit original base mesh
domain = Domain(mesh, dt, "CG", 1)

# Equation
Expand All @@ -63,7 +64,6 @@
output = OutputParameters(dirname=dirname,
dumpfreq=dumpfreq,
dumplist=['u'],
checkpoint_method='dumbcheckpoint',
log_level='INFO')
diagnostic_fields = [CourantNumber(), VelocityZ(), HydrostaticImbalance(eqns),
Perturbation('theta'), Perturbation('rho')]
Expand Down
8 changes: 5 additions & 3 deletions examples/compressible/mountain_nonhydrostatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,24 @@
# ---------------------------------------------------------------------------- #

# Domain
# Make an normal extruded mesh which will be distorted to describe the mountain
m = PeriodicIntervalMesh(columns, L)
ext_mesh = ExtrudedMesh(m, layers=nlayers, layer_height=H/nlayers)
Vc = VectorFunctionSpace(ext_mesh, "DG", 2)
coord = SpatialCoordinate(ext_mesh)
x = Function(Vc).interpolate(as_vector([coord[0], coord[1]]))

# Describe the mountain
a = 1000.
xc = L/2.
x, z = SpatialCoordinate(ext_mesh)
hm = 1.
zs = hm*a**2/((x-xc)**2 + a**2)

zh = 5000.
xexpr = as_vector([x, conditional(z < zh, z + cos(0.5*pi*z/zh)**6*zs, z)])

# Make new mesh
new_coords = Function(Vc).interpolate(xexpr)
mesh = Mesh(new_coords)
mesh._base_mesh = m # Force new mesh to inherit original base mesh
domain = Domain(mesh, dt, "CG", 1)

# Equation
Expand Down