Run Configurations

The RunConfiguration is the underlying class used by the initialize_adcirc command, and stores individual JSON configurations (configure_adcirc.json, configure_nems.json, etc.) as Python ConfigurationJSON objects.

The following Python script generates a set of JSON configuration files, encapsulating all values for a NEMS+ADCIRC+tidal+WW3DATA run, to be submitted via Slurm to Hera.

from datetime import datetime, timedelta

from adcircpy.forcing.tides import Tides
from adcircpy.forcing.tides.tides import TidalSource
from adcircpy.forcing.waves.ww3 import WaveWatch3DataForcing
from adcircpy.forcing.winds.atmesh import AtmosphericMeshForcing

from coupledmodeldriver import Platform
from coupledmodeldriver.generate import NEMSADCIRCRunConfiguration

# initialize `adcircpy` forcing objects
tidal_forcing = Tides(
    tidal_source=TidalSource.TPXO,
    resource='/scratch2/COASTAL/coastal/save/shared/models/forcings/tides/h_tpxo9.v1.nc',
)
tidal_forcing.use_all()
wind_forcing = AtmosphericMeshForcing(
    filename='/scratch2/COASTAL/coastal/save/shared/models/forcings/shinnecock/ike/wind_atm_fin_ch_time_vec.nc',
    nws=17,
    interval_seconds=3600,
)
wave_forcing = WaveWatch3DataForcing(
    filename='/scratch2/COASTAL/coastal/save/shared/models/forcings/shinnecock/ike/ww3.Constant.20151214_sxy_ike_date.nc',
    nrs=5,
    interval_seconds=3600,
)
forcings = [tidal_forcing, wind_forcing, wave_forcing]

# initialize configuration object
configuration = NEMSADCIRCRunConfiguration(
    mesh_directory='/scratch2/COASTAL/coastal/save/shared/models/meshes/shinnecock/v1.0',
    modeled_start_time=datetime(year=2008, month=8, day=23),
    modeled_end_time=datetime(year=2008, month=8, day=23) + timedelta(days=14.5),
    modeled_timestep=timedelta(seconds=2),
    nems_interval=timedelta(hours=1),
    nems_connections=['ATM -> OCN', 'WAV -> OCN'],
    nems_mediations=None,
    nems_sequence=['ATM -> OCN', 'WAV -> OCN', 'ATM', 'WAV', 'OCN'],
    tidal_spinup_duration=timedelta(days=12.5),
    platform=Platform.HERA,
    perturbations=None,
    forcings=forcings,
    adcirc_processors=256,
    slurm_partition=None,
    slurm_job_duration=timedelta(hours=6),
    slurm_email_address=None,
    nems_executable='/scratch2/COASTAL/coastal/save/shared/repositories/CoastalApp/ALLBIN_INSTALL/NEMS-adcirc-atmesh-ww3data.x',
    adcprep_executable='/scratch2/COASTAL/coastal/save/shared/repositories/CoastalApp/ALLBIN_INSTALL/adcprep',
    source_filename='/scratch2/COASTAL/coastal/save/shared/repositories/CoastalApp/modulefiles/envmodules_intel.hera',
)

# write configuration to `*.json` files
configuration.write_directory('hera_shinnecock_ike_spinup_tidal_atmesh_ww3data')

ADCIRC-only run configuration

class coupledmodeldriver.generate.ADCIRCRunConfiguration(mesh_directory: PathLike, modeled_start_time: datetime, modeled_end_time: datetime, modeled_timestep: timedelta, tidal_spinup_duration: timedelta | None = None, platform: Platform | None = None, perturbations: Dict[str, Dict[str, Any]] | None = None, forcings: List[ForcingJSON] | None = None, adcirc_processors: int | None = None, slurm_job_duration: timedelta | None = None, slurm_partition: str | None = None, slurm_email_address: str | None = None, adcirc_executable: PathLike | None = None, adcprep_executable: PathLike | None = None, aswip_executable: PathLike | None = None, source_filename: PathLike | None = None)

run configuration for ADCIRC-only run, with optional tidal and / or best track forcing using ADCIRC’s input capability

Parameters:
  • mesh_directory – path to input mesh directory (containing fort.13, fort.14)

  • modeled_start_time – start time within the modeled system

  • modeled_end_time – end time within the modeled system

  • modeled_timestep – time interval within the modeled system

  • tidal_spinup_duration – spinup time for ADCIRC tidal coldstart

  • platform – HPC platform for which to configure

  • perturbations – dictionary of runs encompassing run names to parameter values

  • forcings – list of forcing configurations to connect to ADCIRC

  • adcirc_processors – numbers of processors to assign for ADCIRC

  • slurm_job_duration – wall clock time of job

  • slurm_partition – Slurm partition

  • slurm_email_address – email address to send Slurm notifications

  • adcirc_executable – filename of compiled adcirc

  • adcprep_executable – filename of compiled adcprep

  • aswip_executable – filename of compiled aswip

  • source_filename – path to module file to source

write_directory(directory: PathLike, absolute: bool = False, overwrite: bool = False)
Parameters:
  • directory – directory in which to write generated JSON configuration files

  • absolute – whether to write absolute paths

  • overwrite – whether to overwrite existing files

NEMS-ADCIRC run configuration

class coupledmodeldriver.generate.NEMSADCIRCRunConfiguration(mesh_directory: PathLike, modeled_start_time: datetime, modeled_end_time: datetime, modeled_timestep: timedelta, nems_interval: timedelta, nems_connections: List[str], nems_mediations: List[str], nems_sequence: List[str], tidal_spinup_duration: timedelta | None = None, platform: Platform | None = None, perturbations: Dict[str, Dict[str, Any]] | None = None, forcings: List[ForcingJSON] | None = None, adcirc_processors: int | None = None, slurm_job_duration: timedelta | None = None, slurm_partition: str | None = None, slurm_email_address: str | None = None, nems_executable: PathLike | None = None, adcprep_executable: PathLike | None = None, aswip_executable: PathLike | None = None, source_filename: PathLike | None = None)

run configuration coupling ADCIRC with other models / forcings using NUOPC NEMS

Parameters:
  • mesh_directory – path to input mesh directory (containing fort.13, fort.14)

  • modeled_start_time – start time within the modeled system

  • modeled_end_time – end time within the modeled system

  • modeled_timestep – time interval within the modeled system

  • nems_interval – modeled time interval of main NEMS loop

  • nems_connections – list of NEMS connections as strings (i.e. ATM -> OCN)

  • nems_mediations – list of NEMS mediations, including functions

  • nems_sequence – list of NEMS entries in sequence order

  • adcirc_processors – numbers of processors to assign for ADCIRC

  • platform – HPC platform for which to configure

  • tidal_spinup_duration – spinup time for ADCIRC tidal coldstart

  • perturbations – dictionary of runs encompassing run names to parameter values

  • forcings – list of forcing configurations to connect to ADCIRC

  • slurm_job_duration – wall clock time of job

  • slurm_partition – Slurm partition

  • slurm_email_address – email address to send Slurm notifications

  • nems_executable – filename of compiled adcirc

  • adcprep_executable – filename of compiled adcprep

  • aswip_executable – filename of compiled aswip

  • source_filename – path to module file to source

write_directory(directory: PathLike, absolute: bool = False, overwrite: bool = False)
Parameters:
  • directory – directory in which to write generated JSON configuration files

  • absolute – whether to write absolute paths

  • overwrite – whether to overwrite existing files