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)
 Calculate interpolated values at time, reading in data as necessary.
 

Public Attributes

amrex::MultiFab * mf_interpolated
 

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.
 

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_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 17 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 18 of file REMORA_NCTimeSeries.cpp.

Member Function Documentation

◆ Initialize()

void NCTimeSeries::Initialize ( )

Read in time array from file and allocate data arrays.

Definition at line 31 of file REMORA_NCTimeSeries.cpp.

Referenced by REMORA::init_only().

Here is the call graph for this function:
Here is the caller 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 150 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)

Calculate interpolated values at time, reading in data as necessary.

Parameters
timetime to interpolate to

Definition at line 96 of file REMORA_NCTimeSeries.cpp.

Referenced by REMORA::advance_2d(), REMORA::advance_3d(), REMORA::set_smflux(), REMORA::set_wind(), and REMORA::setup_step().

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

Member Data Documentation

◆ domain

amrex::Box NCTimeSeries::domain
private

Domain.

Definition at line 47 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 43 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 41 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 58 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 50 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 67 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 65 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and update_interpolated_to_time().

◆ mf_interpolated

amrex::MultiFab* NCTimeSeries::mf_interpolated

Container for interpolated data; Only used if save_interpolated == true

Definition at line 35 of file REMORA_NCTimeSeries.H.

Referenced by REMORA::advance_2d(), REMORA::advance_3d(), Initialize(), REMORA::setup_step(), 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 71 of file REMORA_NCTimeSeries.H.

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

◆ ocean_times

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

Time points in netcdf file.

Definition at line 56 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 53 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), 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 62 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 60 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 45 of file REMORA_NCTimeSeries.H.

Referenced by Initialize(), and NCTimeSeries().


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