REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
NCTimeSeries Class Reference

A class to hold and interpolate time series data read from a NetCDF file. More...

#include <REMORA_NCTimeSeries.H>

Collaboration diagram for NCTimeSeries:

Public Member Functions

 NCTimeSeries (const std::string a_file_name, const std::string a_field_name, const std::string a_time_name, const amrex::Box &a_domain, amrex::MultiFab *a_mf_var, bool a_is2d, bool a_save_interpolated)
 Constructor.
 
void Initialize ()
 Read in time array from file and allocate data arrays.
 
void update_interpolated_to_time (amrex::Real time, int lev, amrex::MultiFab *mf_lev, const amrex::Vector< amrex::Geometry > &geom, const amrex::Vector< amrex::IntVect > &ref_ratio)
 Calculate interpolated values at time and fill data for level lev.
 
const amrex::MultiFab * get_interpolated_mf (int lev) const
 Access interpolated data saved for a specific level.
 

Private Member Functions

void read_in_at_time (amrex::MultiFab *mf, int itime)
 Read in data from file at time index itime and fill into mf.
 
amrex::IntVect cumulative_ref_ratio (int lev, const amrex::Vector< amrex::IntVect > &ref_ratio) const
 Build cumulative refinement ratio from level 0 to lev.
 

Private Attributes

std::string file_name
 File name to read from.
 
std::string field_name
 Field name in netcdf file.
 
std::string time_name
 Field name for time series in netcdf file.
 
amrex::Box domain
 Domain.
 
bool is2d
 Whether the field we're reading in is 2d.
 
bool save_interpolated
 
amrex::Vector< amrex::Real > ocean_times
 Time points in netcdf file.
 
int i_time_before
 Time index immediately before the last time interpolated to.
 
amrex::Real time_before
 Time in ocean_times immediately before the last time interpolated to.
 
amrex::Real time_after
 Time in ocean_times immediately after the last time interpolated to.
 
amrex::MultiFab * mf_before
 Multifab to store data at time_before.
 
amrex::MultiFab * mf_after
 Multifab to store data at time_after.
 
amrex::MultiFab * mf_interp_lev0
 Multifab storing temporally interpolated data on level 0.
 
amrex::Vector< std::unique_ptr< amrex::MultiFab > > mf_interpolated_lev
 Interpolated data on each requested AMR level if save_interpolated=true.
 
amrex::MultiFab * mf_var
 

Detailed Description

A class to hold and interpolate time series data read from a NetCDF file.

The class only ever holds the two time steps necessary to interpoplate to the current simulation time.

Definition at line 16 of file REMORA_NCTimeSeries.H.

Constructor & Destructor Documentation

◆ NCTimeSeries()

NCTimeSeries::NCTimeSeries ( const std::string  a_file_name,
const std::string  a_field_name,
const std::string  a_time_name,
const amrex::Box &  a_domain,
amrex::MultiFab *  a_mf_var,
bool  a_is2d,
bool  a_save_interpolated 
)

Constructor.

Parameters
[in]a_file_namefile name to read from
[in]a_field_namename of field to read in
[in]a_time_namename of time variable in NetCDF file
[in]a_domainsimulation domain
[in,out]a_mf_varMultiFab of data to either store into or reference for dimensions
[in]a_is2dWhether the variable we're working with is 2D
[in]a_save_interpolatedWhether the interpolated value should be saved internally

Definition at line 20 of file REMORA_NCTimeSeries.cpp.

Member Function Documentation

◆ cumulative_ref_ratio()

amrex::IntVect NCTimeSeries::cumulative_ref_ratio ( int  lev,
const amrex::Vector< amrex::IntVect > &  ref_ratio 
) const
private

Build cumulative refinement ratio from level 0 to lev.

Definition at line 199 of file REMORA_NCTimeSeries.cpp.

Referenced by update_interpolated_to_time().

Here is the caller graph for this function:

◆ get_interpolated_mf()

const amrex::MultiFab * NCTimeSeries::get_interpolated_mf ( int  lev) const

Access interpolated data saved for a specific level.

Definition at line 211 of file REMORA_NCTimeSeries.cpp.

◆ Initialize()

void NCTimeSeries::Initialize ( )

Read in time array from file and allocate data arrays.

Definition at line 33 of file REMORA_NCTimeSeries.cpp.

Here is the call graph for this function:

◆ read_in_at_time()

void NCTimeSeries::read_in_at_time ( amrex::MultiFab *  mf,
int  itime 
)
private

Read in data from file at time index itime and fill into mf.

Parameters
[in,out]mfmultifab to store time step data into
[in]itimeindex of time step to read from file

Definition at line 222 of file REMORA_NCTimeSeries.cpp.

Referenced by update_interpolated_to_time().

Here is the caller graph for this function:

◆ update_interpolated_to_time()

void NCTimeSeries::update_interpolated_to_time ( amrex::Real  time,
int  lev,
amrex::MultiFab *  mf_lev,
const amrex::Vector< amrex::Geometry > &  geom,
const amrex::Vector< amrex::IntVect > &  ref_ratio 
)

Calculate interpolated values at time and fill data for level lev.

Parameters
timetime to interpolate to

Definition at line 103 of file REMORA_NCTimeSeries.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ domain

amrex::Box NCTimeSeries::domain
private

Domain.

Definition at line 53 of file REMORA_NCTimeSeries.H.

Referenced by NCTimeSeries(), and read_in_at_time().

◆ field_name

std::string NCTimeSeries::field_name
private

Field name in netcdf file.

Definition at line 49 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), NCTimeSeries(), and read_in_at_time().

◆ file_name

std::string NCTimeSeries::file_name
private

File name to read from.

Definition at line 47 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), NCTimeSeries(), and read_in_at_time().

◆ i_time_before

int NCTimeSeries::i_time_before
private

Time index immediately before the last time interpolated to.

Definition at line 64 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and update_interpolated_to_time().

◆ is2d

bool NCTimeSeries::is2d
private

Whether the field we're reading in is 2d.

Definition at line 56 of file REMORA_NCTimeSeries.H.

Referenced by NCTimeSeries(), and read_in_at_time().

◆ mf_after

amrex::MultiFab* NCTimeSeries::mf_after
private

Multifab to store data at time_after.

Definition at line 73 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and update_interpolated_to_time().

◆ mf_before

amrex::MultiFab* NCTimeSeries::mf_before
private

Multifab to store data at time_before.

Definition at line 71 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and update_interpolated_to_time().

◆ mf_interp_lev0

amrex::MultiFab* NCTimeSeries::mf_interp_lev0
private

Multifab storing temporally interpolated data on level 0.

Definition at line 75 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and update_interpolated_to_time().

◆ mf_interpolated_lev

amrex::Vector<std::unique_ptr<amrex::MultiFab> > NCTimeSeries::mf_interpolated_lev
private

Interpolated data on each requested AMR level if save_interpolated=true.

Definition at line 77 of file REMORA_NCTimeSeries.H.

Referenced by get_interpolated_mf(), and update_interpolated_to_time().

◆ mf_var

amrex::MultiFab* NCTimeSeries::mf_var
private

Pointer to REMORA data that corresponds to the variable being interpolated. Filled by update_interpolated_to_time if save_interpolated==false. Otherwise, just used for getting box array, nodality, and distribution mapping

Definition at line 81 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and NCTimeSeries().

◆ ocean_times

amrex::Vector<amrex::Real> NCTimeSeries::ocean_times
private

Time points in netcdf file.

Definition at line 62 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and update_interpolated_to_time().

◆ save_interpolated

bool NCTimeSeries::save_interpolated
private

Whether to save interpolated results in mf_interpolated. If false, data will be calculated to mf_var

Definition at line 59 of file REMORA_NCTimeSeries.H.

Referenced by get_interpolated_mf(), NCTimeSeries(), and update_interpolated_to_time().

◆ time_after

amrex::Real NCTimeSeries::time_after
private

Time in ocean_times immediately after the last time interpolated to.

Definition at line 68 of file REMORA_NCTimeSeries.H.

Referenced by update_interpolated_to_time().

◆ time_before

amrex::Real NCTimeSeries::time_before
private

Time in ocean_times immediately before the last time interpolated to.

Definition at line 66 of file REMORA_NCTimeSeries.H.

Referenced by update_interpolated_to_time().

◆ time_name

std::string NCTimeSeries::time_name
private

Field name for time series in netcdf file.

Definition at line 51 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and NCTimeSeries().


The documentation for this class was generated from the following files: