Skip to content

Commit

Permalink
Longer QU dynamic adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Aug 15, 2023
1 parent 72f441c commit df096c1
Showing 1 changed file with 34 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def __init__(self, test_group, mesh, init, time_integrator):
time_integrator : {'split_explicit', 'RK4'}
The time integrator to use for the forward run
"""
restart_times = ['0001-01-02_00:00:00', '0001-01-03_00:00:00']
restart_times = ['0001-01-11_00:00:00', '0001-01-21_00:00:00',
'0001-01-31_00:00:00']
restart_filenames = [
f'restarts/rst.{restart_time.replace(":", ".")}.nc'
for restart_time in restart_times]
Expand All @@ -52,41 +53,64 @@ def __init__(self, test_group, mesh, init, time_integrator):
subdir=step_name, get_dt_from_min_res=True)

namelist_options = {
'config_run_duration': "'00-00-01_00:00:00'",
'config_run_duration': "'00-00-10_00:00:00'",
'config_implicit_bottom_drag_type': "'constant_and_rayleigh'",
'config_Rayleigh_damping_coeff': '1.0e-4'}
namelist_options.update(shared_options)
step.add_namelist_options(namelist_options)

stream_replacements = {
'output_interval': '00-00-01_00:00:00',
'restart_interval': '00-00-01_00:00:00'}
'output_interval': '00-00-10_00:00:00',
'restart_interval': '00-00-10_00:00:00'}
step.add_streams_file(module, 'streams.template',
template_replacements=stream_replacements)

step.add_output_file(filename=f'../{restart_filenames[0]}')
self.add_step(step)

# second step
step_name = 'damped_adjustment_2'
step = ForwardStep(test_case=self, mesh=mesh, init=init,
time_integrator=time_integrator, name=step_name,
subdir=step_name, get_dt_from_min_res=True)

namelist_options = {
'config_run_duration': "'00-00-10_00:00:00'",
'config_implicit_bottom_drag_type': "'constant_and_rayleigh'",
'config_Rayleigh_damping_coeff': '1.0e-5'}
namelist_options.update(shared_options)
step.add_namelist_options(namelist_options)

stream_replacements = {
'output_interval': '00-00-10_00:00:00',
'restart_interval': '00-00-10_00:00:00'}
step.add_streams_file(module, 'streams.template',
template_replacements=stream_replacements)

step.add_input_file(filename=f'../{restart_filenames[0]}')
step.add_output_file(filename=f'../{restart_filenames[1]}')
self.add_step(step)

# final step
step_name = 'simulation'
step = ForwardStep(test_case=self, mesh=mesh, init=init,
time_integrator=time_integrator, name=step_name,
subdir=step_name, get_dt_from_min_res=True)

namelist_options = {
'config_run_duration': "'00-00-01_00:00:00'",
'config_run_duration': "'00-00-10_00:00:00'",
'config_do_restart': '.true.',
'config_start_time': f"'{restart_times[0]}'"}
'config_start_time': f"'{restart_times[1]}'"}
namelist_options.update(shared_options)
step.add_namelist_options(namelist_options)

stream_replacements = {
'output_interval': '00-00-01_00:00:00',
'restart_interval': '00-00-01_00:00:00'}
'output_interval': '00-00-10_00:00:00',
'restart_interval': '00-00-10_00:00:00'}
step.add_streams_file(module, 'streams.template',
template_replacements=stream_replacements)

step.add_input_file(filename=f'../{restart_filenames[0]}')
step.add_output_file(filename=f'../{restart_filenames[1]}')
step.add_input_file(filename=f'../{restart_filenames[1]}')
step.add_output_file(filename=f'../{restart_filenames[2]}')
step.add_output_file(filename='output.nc')
self.add_step(step)

0 comments on commit df096c1

Please sign in to comment.