REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_init_from_netcdf.cpp File Reference
#include <REMORA.H>
#include <REMORA_Constants.H>
#include <REMORA_prob_common.H>
#include <REMORA_DataStruct.H>
Include dependency graph for REMORA_init_from_netcdf.cpp:

Go to the source code of this file.

Functions

void read_data_from_netcdf (int, const Box &domain, const std::string &fname, FArrayBox &NC_temp_fab, FArrayBox &NC_salt_fab, FArrayBox &NC_xvel_fab, FArrayBox &NC_yvel_fab)
 helper function for reading in initial state data from netcdf
 
void read_data_full_domain_from_netcdf (int, const Box &domain, const std::string &fname, FArrayBox &NC_temp_fab, FArrayBox &NC_salt_fab, FArrayBox &NC_xvel_fab, FArrayBox &NC_yvel_fab, IntVect ngrow)
 helper function for reading in full domain high-resolution initial state data from netcdf
 
void read_biology_from_netcdf (int, const Box &domain, const std::string &fname, const Vector< std::string > &biology_names, Vector< FArrayBox > &NC_biology_fab)
 helper function for reading in initial biology data from netcdf
 
void read_biology_full_domain_from_netcdf (int, const Box &domain, const std::string &fname, const Vector< std::string > &biology_names, Vector< FArrayBox > &NC_biology_fab, IntVect ngrow)
 helper function for reading in full domain high-resolution initial biology data from netcdf
 
void read_scalars_from_netcdf (int, const Box &domain, const std::string &fname, const Vector< std::string > &scalar_names, Vector< FArrayBox > &NC_scalar_fab, Vector< int > &scalar_in_file)
 helper function for reading in initial passive (dye) scalar data from netcdf
 
void read_scalars_full_domain_from_netcdf (int, const Box &domain, const std::string &fname, const Vector< std::string > &scalar_names, Vector< FArrayBox > &NC_scalar_fab, Vector< int > &scalar_in_file, IntVect ngrow)
 helper function for reading in full domain high-resolution initial passive (dye) scalar data from netcdf
 
void check_hires_dims_from_netcdf (const std::string &fname, const std::string &var_name, const Box &domain, const IntVect &ngrow)
 helper function checking that a high-resolution file covers the refined domain plus grow cells
 
void read_masks_from_netcdf (int, const Box &domain, const std::string &fname, FArrayBox &NC_mskr_fab, FArrayBox &NC_msku_fab, FArrayBox &NC_mskv_fab)
 helper function for reading in land-sea masks from netcdf
 
void init_state_from_netcdf (int lev, FArrayBox &temp_fab, FArrayBox &salt_fab, FArrayBox &x_vel_fab, FArrayBox &y_vel_fab, const Vector< FArrayBox > &NC_temp_fab, const Vector< FArrayBox > &NC_salt_fab, const Vector< FArrayBox > &NC_xvel_fab, const Vector< FArrayBox > &NC_yvel_fab)
 helper function to initialize state from netcdf
 
void init_biology_state_from_netcdf (int lev, FArrayBox &biology_fab, const Vector< Vector< FArrayBox > > &NC_biology_fab)
 helper function to initialize biology tracer state from netcdf
 
void init_scalar_state_from_netcdf (int lev, FArrayBox &scalar_fab, const Vector< Vector< FArrayBox > > &NC_scalar_fab, const Vector< Vector< int > > &scalar_in_file)
 helper function to initialize passive (dye) scalar state from netcdf
 
void read_bathymetry_from_netcdf (int lev, const Box &domain, const std::string &fname, FArrayBox &NC_h_fab)
 helper function to read bathymetry from netcdf
 
void read_grid_vars_from_netcdf (int lev, const Box &domain, const std::string &fname, FArrayBox &NC_pm_fab, FArrayBox &NC_pn_fab, FArrayBox &NC_xr_fab, FArrayBox &NC_yr_fab, FArrayBox &NC_xu_fab, FArrayBox &NC_yu_fab, FArrayBox &NC_xv_fab, FArrayBox &NC_yv_fab, FArrayBox &NC_xp_fab, FArrayBox &NC_yp_fab)
 helper function to read grid variables from netcdf
 
bool read_spherical_grid_vars_from_netcdf (int lev, const Box &domain, const std::string &fname, FArrayBox &NC_lonp_fab, FArrayBox &NC_latp_fab)
 helper function to read optional spherical psi coordinates from netcdf
 
void read_bathymetry_full_domain_from_netcdf (const Box &domain, const std::string &fname, FArrayBox &NC_h_fab, IntVect ngrow)
 helper function to read full-domain high resolution bathymetry from netcdf
 
void read_grid_vars_full_domain_from_netcdf (const Box &domain, const std::string &fname, FArrayBox &NC_pm_fab, FArrayBox &NC_pn_fab, IntVect ngrow)
 helper function to read full-domain high resolution grid variables from netcdf
 
void read_coriolis_from_netcdf (int lev, const Box &domain, const std::string &fname, FArrayBox &NC_fcor_fab)
 helper function to read coriolis factor from netcdf
 
void read_zeta_from_netcdf (int lev, const Box &domain, const std::string &fname, FArrayBox &NC_zeta_fab)
 helper function to read sea surface height from netcdf
 
void read_zeta_full_domain_from_netcdf (int lev, const Box &domain, const std::string &fname, FArrayBox &NC_zeta_fab, IntVect ngrow)
 helper function to read high-resolution full-domain sea surface height from netcdf
 
void read_clim_nudg_coeff_from_netcdf (int lev, const Box &domain, const std::string &fname, bool do_m2_clim_nudg, bool do_m3_clim_nudg, const amrex::Vector< int > &do_cons_clim_nudg, const amrex::Vector< std::string > &cons_names, FArrayBox &NC_M2NC_fab, FArrayBox &NC_M3NC_fab, amrex::Vector< FArrayBox > &NC_ConsNC_fab, amrex::Vector< int > &cons_coeff_in_file)
 helper function to read climatology nudging from netcdf
 
void read_vec_from_netcdf (int lev, const amrex::Vector< std::string > &fnames, const std::string &field_name, amrex::Vector< int > &vec_dat)
 helper function to read in vector of data from netcdf
 

Function Documentation

◆ check_hires_dims_from_netcdf()

void check_hires_dims_from_netcdf ( const std::string &  fname,
const std::string &  var_name,
const Box &  domain,
const IntVect &  ngrow 
)

helper function checking that a high-resolution file covers the refined domain plus grow cells

Parameters
fnamefile name the hires data will be read from
var_namea rho-point variable in that file whose horizontal extent is checked
domainthe refined full-domain box the data has to cover
ngrowgrow cells the read asks for, i.e. cum_ref_ratios[hires_*_level]

A high-resolution file has to carry the refined domain plus ngrow rings on every side (Docs/sphinx_doc/Inputs.rst). Checking that up front is not a nicety: BuildFABsFromNetCDFFile copies on intersection and fill_fab_from_arrays only asserts that the destination box is big enough for the source, so a file with too FEW grow cells reads cleanly and silently leaves the outer rings of the FAB at whatever they held – which then gets averaged down into level 0. Only rho-point variables are checked; that is enough to catch an undersized file, and it avoids re-deriving the staggered offsets here.

Definition at line 153 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_bathymetry_full_domain_from_netcdf(), REMORA::init_data_full_domain_from_netcdf(), REMORA::init_grid_vars_full_domain_from_netcdf(), and REMORA::init_zeta_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_biology_state_from_netcdf()

void init_biology_state_from_netcdf ( int  ,
FArrayBox &  biology_fab,
const Vector< Vector< FArrayBox > > &  NC_biology_fab 
)

helper function to initialize biology tracer state from netcdf

Parameters
levInteger specifying current level
biology_fabFArrayBox object holding the biology components we initialize
NC_biology_fabVector of FArrayBox objects with the REMORA dataset specifying each biological tracer, one per component per box

Definition at line 883 of file REMORA_init_from_netcdf.cpp.

Referenced by REMORA::init_biology_from_netcdf(), and REMORA::init_biology_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_scalar_state_from_netcdf()

void init_scalar_state_from_netcdf ( int  ,
FArrayBox &  scalar_fab,
const Vector< Vector< FArrayBox > > &  NC_scalar_fab,
const Vector< Vector< int > > &  scalar_in_file 
)

helper function to initialize passive (dye) scalar state from netcdf

Parameters
levInteger specifying current level
scalar_fabFArrayBox object holding the passive scalar components we initialize
NC_scalar_fabVector of FArrayBox objects with the REMORA dataset specifying each dye, one per component per box
scalar_in_filePer box and component, whether the file carried that dye; a dye the file omits keeps the zero written before the read

Definition at line 905 of file REMORA_init_from_netcdf.cpp.

Referenced by REMORA::init_scalars_from_netcdf(), and REMORA::init_scalars_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_state_from_netcdf()

void init_state_from_netcdf ( int  ,
FArrayBox &  temp_fab,
FArrayBox &  salt_fab,
FArrayBox &  x_vel_fab,
FArrayBox &  y_vel_fab,
const Vector< FArrayBox > &  NC_temp_fab,
const Vector< FArrayBox > &  NC_salt_fab,
const Vector< FArrayBox > &  NC_xvel_fab,
const Vector< FArrayBox > &  NC_yvel_fab 
)

helper function to initialize state from netcdf

Helper function to initialize state and velocity data in a Fab.

Parameters
levInteger specifying current level
state_fabFArrayBox object holding the state data we initialize
temp_fabFArrayBox object holding the temperature data we initialize
salt_fabFArrayBox object holding the salt data we initialize
x_vel_fabFArrayBox object holding the x-velocity data we initialize
y_vel_fabFArrayBox object holding the y-velocity data we initialize
NC_temp_fabVector of FArrayBox objects with the REMORA dataset specifying temperature
NC_salt_fabVector of FArrayBox objects with the REMORA dataset specifying salinity
NC_xvel_fabVector of FArrayBox objects with the REMORA dataset specifying x-velocity
NC_yvel_fabVector of FArrayBox objects with the REMORA dataset specifying y-velocity

Definition at line 854 of file REMORA_init_from_netcdf.cpp.

Referenced by REMORA::init_data_from_netcdf(), and REMORA::init_data_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_bathymetry_from_netcdf()

void read_bathymetry_from_netcdf ( int  lev,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_h_fab 
)

helper function to read bathymetry from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_h_fabcontainer for bathymetry data

Definition at line 368 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_bathymetry_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_bathymetry_full_domain_from_netcdf()

void read_bathymetry_full_domain_from_netcdf ( const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_h_fab,
IntVect  ngrow 
)

helper function to read full-domain high resolution bathymetry from netcdf

Parameters
domainsimulation domain at nc_hires_grid_level
fnamefile name to read from
NC_h_fabcontainer for bathymetry data
ngrownumber of grow cells to read in, if not default

Definition at line 480 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_bathymetry_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_biology_from_netcdf()

void read_biology_from_netcdf ( int  ,
const Box &  domain,
const std::string &  fname,
const Vector< std::string > &  biology_names,
Vector< FArrayBox > &  NC_biology_fab 
)

helper function for reading in initial biology data from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
biology_namesnames of the biological tracer variables to read
NC_biology_fabcontainers for the biological tracer data, one per name

Definition at line 80 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_biology_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_biology_full_domain_from_netcdf()

void read_biology_full_domain_from_netcdf ( int  ,
const Box &  domain,
const std::string &  fname,
const Vector< std::string > &  biology_names,
Vector< FArrayBox > &  NC_biology_fab,
IntVect  ngrow 
)

helper function for reading in full domain high-resolution initial biology data from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
biology_namesnames of the biological tracer variables to read
NC_biology_fabcontainers for the biological tracer data, one per name
ngrownumber of grow cells to read

Definition at line 113 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_biology_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_clim_nudg_coeff_from_netcdf()

void read_clim_nudg_coeff_from_netcdf ( int  lev,
const Box &  domain,
const std::string &  fname,
bool  do_m2_clim_nudg,
bool  do_m3_clim_nudg,
const amrex::Vector< int > &  do_cons_clim_nudg,
const amrex::Vector< std::string > &  cons_names,
FArrayBox &  NC_M2NC_fab,
FArrayBox &  NC_M3NC_fab,
amrex::Vector< FArrayBox > &  NC_ConsNC_fab,
amrex::Vector< int > &  cons_coeff_in_file 
)

helper function to read climatology nudging from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
do_m2_clim_nudgwhether to do 2d momentum climatology nudging
do_m3_clim_nudgwhether to do 3d momentum climatology nudging
do_cons_clim_nudgper cons component, whether to do climatology nudging
cons_namesper cons component, name of the tracer
NC_M2NC_fabcontainer for 2d momentum climatology data
NC_M3NC_fabcontainer for 3d momentum climatology data
NC_ConsNC_fabper cons component, container for tracer climatology data
cons_coeff_in_filefilled on output: per cons component, whether a spatially varying coefficient was found in the file

Definition at line 591 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_clim_nudg_coeff_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_coriolis_from_netcdf()

void read_coriolis_from_netcdf ( int  lev,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_fcor_fab 
)

helper function to read coriolis factor from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_fcor_fabcontainer for Coriolis parameter data

Definition at line 529 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_coriolis_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_data_from_netcdf()

void read_data_from_netcdf ( int  ,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_temp_fab,
FArrayBox &  NC_salt_fab,
FArrayBox &  NC_xvel_fab,
FArrayBox &  NC_yvel_fab 
)

helper function for reading in initial state data from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_temp_fabcontainer for temperature data
NC_salt_fabcontainer for salinity data
NC_u_fabcontainer for u velocity data
NC_v_fabcontainer for v velocity data

Definition at line 18 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_data_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_data_full_domain_from_netcdf()

void read_data_full_domain_from_netcdf ( int  ,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_temp_fab,
FArrayBox &  NC_salt_fab,
FArrayBox &  NC_xvel_fab,
FArrayBox &  NC_yvel_fab,
IntVect  ngrow 
)

helper function for reading in full domain high-resolution initial state data from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_temp_fabcontainer for temperature data
NC_salt_fabcontainer for salinity data
NC_u_fabcontainer for u velocity data
NC_v_fabcontainer for v velocity data
ngrownumber of grow cells to read

Definition at line 50 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_data_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_grid_vars_from_netcdf()

void read_grid_vars_from_netcdf ( int  lev,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_pm_fab,
FArrayBox &  NC_pn_fab,
FArrayBox &  NC_xr_fab,
FArrayBox &  NC_yr_fab,
FArrayBox &  NC_xu_fab,
FArrayBox &  NC_yu_fab,
FArrayBox &  NC_xv_fab,
FArrayBox &  NC_yv_fab,
FArrayBox &  NC_xp_fab,
FArrayBox &  NC_yp_fab 
)

helper function to read grid variables from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_pm_fabcontainer for pm data
NC_pn_fabcontainer for pn data
NC_xr_fabcontainer for x_rho data
NC_yr_fabcontainer for y_rho data
NC_xu_fabcontainer for x_u data
NC_yu_fabcontainer for y_u data
NC_xv_fabcontainer for x_v data
NC_yv_fabcontainer for y_v data
NC_xp_fabcontainer for x_p data
NC_yp_fabcontainer for y_p data

Definition at line 401 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_grid_vars_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_grid_vars_full_domain_from_netcdf()

void read_grid_vars_full_domain_from_netcdf ( const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_pm_fab,
FArrayBox &  NC_pn_fab,
IntVect  ngrow 
)

helper function to read full-domain high resolution grid variables from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_pm_fabcontainer for pm data
NC_pn_fabcontainer for pn data
ngrownumber of grow cells to read in, if not default

Definition at line 505 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_grid_vars_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_masks_from_netcdf()

void read_masks_from_netcdf ( int  ,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_mskr_fab,
FArrayBox &  NC_msku_fab,
FArrayBox &  NC_mskv_fab 
)

helper function for reading in land-sea masks from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_mskr_fabcontainer for rho-point land/sea mask data
NC_msku_fabcontainer for u-point land/sea mask data
NC_mskv_fabcontainer for v-point land/sea mask data

Definition at line 555 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_masks_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_scalars_from_netcdf()

void read_scalars_from_netcdf ( int  ,
const Box &  domain,
const std::string &  fname,
const Vector< std::string > &  scalar_names,
Vector< FArrayBox > &  NC_scalar_fab,
Vector< int > &  scalar_in_file 
)

helper function for reading in initial passive (dye) scalar data from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
scalar_namesnames of the passive scalar variables to look for
NC_scalar_fabcontainers for the passive scalar data, one per name
scalar_in_fileset per name to whether the file carried that variable

Definition at line 278 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_scalars_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_scalars_full_domain_from_netcdf()

void read_scalars_full_domain_from_netcdf ( int  ,
const Box &  domain,
const std::string &  fname,
const Vector< std::string > &  scalar_names,
Vector< FArrayBox > &  NC_scalar_fab,
Vector< int > &  scalar_in_file,
IntVect  ngrow 
)

helper function for reading in full domain high-resolution initial passive (dye) scalar data from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
scalar_namesnames of the passive scalar variables to look for
NC_scalar_fabcontainers for the passive scalar data, one per name
scalar_in_fileset per name to whether the file carried that variable
ngrownumber of grow cells to read

Definition at line 299 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_scalars_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_spherical_grid_vars_from_netcdf()

bool read_spherical_grid_vars_from_netcdf ( int  lev,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_lonp_fab,
FArrayBox &  NC_latp_fab 
)

helper function to read optional spherical psi coordinates from netcdf

Parameters
domainsimulation domain
fnamefile name to read from
NC_lonp_fabcontainer for lon_psi data
NC_latp_fabcontainer for lat_psi data
Returns
whether the file carried spherical psi coordinates and they were read

ROMS grid files for spherical grids carry lon_psi/lat_psi alongside x_psi/y_psi, and those degree-valued corner arrays are what a coupled driver needs when the two components do not share a projected Cartesian frame (SCRIP/COAWST selects the same way; see Lib/SCRIP_COAWST/read_roms.f). Idealized grid files carry no spherical coordinates, so this read is optional and reports whether it happened rather than aborting.

Definition at line 446 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_grid_vars_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_vec_from_netcdf()

void read_vec_from_netcdf ( int  lev,
const amrex::Vector< std::string > &  fnames,
const std::string &  field_name,
amrex::Vector< int > &  vec_dat 
)

helper function to read in vector of data from netcdf

Parameters
levlevel of data to read
fnamesfile name(s) to read from
field_namefield name to read
vec_datvector to fill data

Definition at line 651 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_riv_pos_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_zeta_from_netcdf()

void read_zeta_from_netcdf ( int  lev,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_zeta_fab 
)

helper function to read sea surface height from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_zeta_fabcontainer for sea surface height data

Definition at line 318 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_zeta_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_zeta_full_domain_from_netcdf()

void read_zeta_full_domain_from_netcdf ( int  lev,
const Box &  domain,
const std::string &  fname,
FArrayBox &  NC_zeta_fab,
IntVect  ngrow 
)

helper function to read high-resolution full-domain sea surface height from netcdf

Parameters
levlevel of data to read
domainsimulation domain
fnamefile name to read from
NC_zeta_fabcontainer for sea surface height data
ngrownumber of grow cells to read in, if not default

Definition at line 343 of file REMORA_ReadFromInitNetcdf.cpp.

Referenced by REMORA::init_zeta_full_domain_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function: