Skip to content

Commit

Permalink
schaer mountain working and settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tommbendall committed Dec 20, 2024
1 parent 8275ce8 commit e1fcec4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 34 deletions.
4 changes: 2 additions & 2 deletions examples/compressible_euler/schaer_mountain.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def schaer_mountain(
cp = 1004.5 # specific heat capacity at constant pressure
mu_dt = 1.2 # strength of sponge layer, no units
exner_surf = 1.0 # maximum value of Exner pressure at surface
max_iterations = 100 # maximum number of hydrostatic balance iterations
tolerance = 1e-12 # tolerance for hydrostatic balance iteration
max_iterations = 20 # maximum number of hydrostatic balance iterations
tolerance = 1e-8 # tolerance for hydrostatic balance iteration

# ------------------------------------------------------------------------ #
# Our settings for this set up
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gusto/solvers/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ def mass_parameters(V, spaces=None, ignore_vertical=True):
'sub_pc_type': 'ilu'
}
}
}
}
11 changes: 6 additions & 5 deletions gusto/time_discretisation/time_discretisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,12 @@ def update_subcycling(self):

# Cap number of subcycles
if max_subcycles is not None:
self.ncycles = min(self.ncycles, max_subcycles)
logger.warning(
'Adaptive subcycling: capping number of subcycles at '
f'{max_subcycles}'
)
if self.ncycles > max_subcycles:
logger.warning(
'Adaptive subcycling: capping number of subcycles at '
f'{max_subcycles}'
)
self.ncycles = max_subcycles

logger.debug(f'Performing {self.ncycles} subcycles')
self.dt.assign(self.original_dt/self.ncycles)
Expand Down
35 changes: 9 additions & 26 deletions plotting/compressible_euler/plot_schaer_mountain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
import matplotlib.pyplot as plt
from netCDF4 import Dataset
import numpy as np
import pandas as pd
from tomplot import (
set_tomplot_style, tomplot_cmap, plot_contoured_field,
add_colorbar_ax, tomplot_field_title, tomplot_contours,
extract_gusto_coords, extract_gusto_field, reshape_gusto_data
)

test = 'schaer_alpha_0p51'
test = 'schaer_mountain'

# ---------------------------------------------------------------------------- #
# Directory for results and plots
Expand All @@ -35,8 +34,8 @@
r'$w$ (m s$^{-1}$)', r'$\Delta\theta$ (K)'
]
final_contours = [
np.linspace(-1.0, 1.0, 21), np.linspace(-1.0, 1.0, 21),
np.linspace(-1.0, 1.0, 21), np.linspace(-1.0, 1.0, 21)
np.linspace(-1.1, 1.1, 23), np.linspace(-1.4, 1.4, 15),
np.linspace(-1.1, 1.1, 23), np.linspace(-1.4, 1.4, 31)
]

# ---------------------------------------------------------------------------- #
Expand Down Expand Up @@ -129,25 +128,6 @@
coords_X, coords_Y = extract_gusto_coords(data_file, field_name)
time = data_file['time'][time_idx]

# # Filter data for panels that are zoomed in mountain region
# if i in [2, 3]:
# data_dict = {
# 'X': coords_X,
# 'Y': coords_Y,
# 'field': field_data
# }
# data_frame = pd.DataFrame(data_dict)

# data_frame = data_frame[
# (data_frame['X'] >= xlims_zoom[0])
# & (data_frame['X'] <= xlims_zoom[1])
# & (data_frame['Y'] >= ylims_zoom[0])
# & (data_frame['Y'] <= ylims_zoom[1])
# ]
# field_data = data_frame['field'].values[:]
# coords_X = data_frame['X'].values[:]
# coords_Y = data_frame['Y'].values[:]

field_data, coords_X, coords_Y = \
reshape_gusto_data(field_data, coords_X, coords_Y)

Expand All @@ -160,9 +140,12 @@
)

add_colorbar_ax(ax, cf, field_label, location='bottom')
tomplot_field_title(
ax, None, minmax=True, field_data=field_data, minmax_format='.3f'
)

if i in [0, 1]:
# Only print min/max for top plots
tomplot_field_title(
ax, None, minmax=True, field_data=field_data, minmax_format='.3f'
)

# Labels -------------------------------------------------------------------
ax.set_xlabel(r'$x$ (km)', labelpad=-10)
Expand Down

0 comments on commit e1fcec4

Please sign in to comment.