Skip to content

Class emulator::EmulatorAtm

ClassList > emulator > EmulatorAtm

Atmosphere emulator component. More...

  • #include <emulator_atm.hpp>

Inherits the following classes: emulator::EmulatorComp

Public Functions

Type Name
EmulatorAtm ()
const inference::InferenceConfig & get_inference_config () const
Get current inference configuration.
void init_coupling_indices (const std::string & export_fields, const std::string & import_fields)
Initialize coupling field indices from MCT field lists.
void set_inference_config (const inference::InferenceConfig & config)
Configure inference backend.
void set_log_file (const std::string & filename)
Set logging file.
~EmulatorAtm () override

Public Functions inherited from emulator::EmulatorComp

See emulator::EmulatorComp

Type Name
EmulatorComp (CompType type)
Construct an emulator component of the given type.
MPI_Comm comm () const
Get MPI communicator.
int comp_id () const
Get component ID.
void create_instance (MPI_Comm comm, int comp_id, const char * input_file, int run_type, int start_ymd, int start_tod)
Initialize the component instance.
void finalize ()
Finalize and clean up the component.
void get_cols_area (double * area) const
Get area for local columns.
void get_cols_latlon (double * lat, double * lon) const
Get lat/lon for local columns.
void get_local_col_gids (int * gids) const
Get global IDs for local columns.
int get_num_global_cols () const
Get total number of columns globally.
int get_num_local_cols () const
Get number of columns on this MPI rank.
int get_nx () const
Get number of grid points in x-direction (longitude).
int get_ny () const
Get number of grid points in y-direction (latitude).
void initialize ()
Initialize the component (phase 2).
bool is_root () const
Check if this is the root rank (rank 0).
int rank () const
Get MPI rank within component communicator.
void run (int dt)
Execute one time step.
void set_grid_data (int nx, int ny, int num_local_cols, int num_global_cols, const int * col_gids, const double * lat, const double * lon, const double * area)
Set grid decomposition data from the driver.
void setup_coupling (double * import_data, double * export_data, int num_imports, int num_exports, int field_size)
Set up coupling data buffers.
CompType type () const
Get component type.
virtual ~EmulatorComp () = default

Protected Attributes inherited from emulator::EmulatorComp

See emulator::EmulatorComp

Type Name
std::vector< double > m_area
Cell area [km²].
std::vector< int > m_col_gids
Global IDs for local columns.
MPI_Comm m_comm
MPI communicator.
int m_comp_id
Component ID from driver.
int m_current_tod = 0
Current time of day [seconds].
int m_current_ymd = 0
Current date as YYYYMMDD.
double * m_export_data = nullptr
Export buffer pointer (a2x)
int m_field_size = 0
Size per field (should = num_local_cols)
double * m_import_data = nullptr
Import buffer pointer (x2a)
std::string m_input_file
Path to configuration file.
std::vector< double > m_lat
Latitude [radians].
Logger m_logger
Component logger.
std::vector< double > m_lon
Longitude [radians].
int m_nprocs
Number of MPI processes.
int m_num_exports = 0
Number of export fields.
int m_num_global_cols = 0
Global column count.
int m_num_imports = 0
Number of import fields.
int m_num_local_cols = 0
Local column count.
int m_nx = 0
Grid points in x (longitude)
int m_ny = 0
Grid points in y (latitude)
int m_rank
MPI rank within component.
int m_run_type
Run type (startup/continue/branch)
int m_step_count = 0
Number of steps executed.
CompType m_type
Component type enum.

Protected Functions

Type Name
virtual void final_impl () override
Component-specific finalization.
virtual void init_impl () override
Component-specific initialization (load model, read ICs).
virtual void run_impl (int dt) override
Execute one time step of inference.
virtual void run_inference (const std::vector< double > & inputs, std::vector< double > & outputs) override
Run AI inference via the configured backend.

Protected Functions inherited from emulator::EmulatorComp

See emulator::EmulatorComp

Type Name
virtual void export_to_coupler ()
Export fields to coupler (override as needed).
virtual void final_impl () = 0
Component-specific finalization.
virtual void import_from_coupler ()
Import fields from coupler (override as needed).
virtual void init_impl () = 0
Component-specific initialization.
virtual void run_impl (int dt) = 0
Component-specific time step execution.
virtual void run_inference (const std::vector< double > & inputs, std::vector< double > & outputs) = 0
Run AI inference on packed input/output vectors.

Detailed Description

Public Functions Documentation

function EmulatorAtm

emulator::EmulatorAtm::EmulatorAtm () 

function get_inference_config

Get current inference configuration.

inline const inference::InferenceConfig & emulator::EmulatorAtm::get_inference_config () const

Returns:

Reference to the current InferenceConfig


function init_coupling_indices

Initialize coupling field indices from MCT field lists.

void emulator::EmulatorAtm::init_coupling_indices (
    const std::string & export_fields,
    const std::string & import_fields
) 

Parses the colon-separated field lists provided by the MCT layer and sets up internal index mappings for import/export operations.

Parameters:

  • export_fields Colon-separated list of a2x field names
  • import_fields Colon-separated list of x2a field names

function set_inference_config

Configure inference backend.

void emulator::EmulatorAtm::set_inference_config (
    const inference::InferenceConfig & config
) 

Must be called before initialize() to select the inference backend and set model parameters.

Parameters:

  • config Inference configuration (backend type, model path, etc.)

function set_log_file

Set logging file.

void emulator::EmulatorAtm::set_log_file (
    const std::string & filename
) 

Redirects the component logger to the specified file. If empty, logging goes to stdout.

Parameters:

  • filename Path to log file

function ~EmulatorAtm

emulator::EmulatorAtm::~EmulatorAtm () override

Protected Functions Documentation

function final_impl

Component-specific finalization.

virtual void emulator::EmulatorAtm::final_impl () override

Implements emulator::EmulatorComp::final_impl


function init_impl

Component-specific initialization (load model, read ICs).

virtual void emulator::EmulatorAtm::init_impl () override

Implements emulator::EmulatorComp::init_impl


function run_impl

Execute one time step of inference.

virtual void emulator::EmulatorAtm::run_impl (
    int dt
) override

Implements emulator::EmulatorComp::run_impl


function run_inference

Run AI inference via the configured backend.

virtual void emulator::EmulatorAtm::run_inference (
    const std::vector< double > & inputs,
    std::vector< double > & outputs
) override

Run inference using the configured backend.

For spatial_mode, the backend is called with batch_size=1 and the full [C*H*W] flattened tensor. For pointwise mode, batch_size=H*W.

Note:

If inference fails, this function will abort the simulation with a clear error message.

Implements emulator::EmulatorComp::run_inference



The documentation for this class was generated from the following file components/emulator_comps/eatm/src/emulator_atm.hpp