Alpine3D 20241222.625fd38
SnowpackInterface Class Reference

#include <SnowpackInterface.h>

Public Member Functions

 SnowpackInterface (const mio::Config &io_cfg, const size_t &nbworkers, const mio::DEMObject &dem_in, const mio::Grid2DObject &landuse_in, const std::vector< mio::Coords > &vec_pts, const mio::Date &startTime, const std::string &grids_requirements, const bool is_restart_in)
 Constructs and initialise Snowpack Interface Master. He creates the Worker and Distributes the Data from the other modules to the Worker. Is the acces interface A3D side. More...
 
 SnowpackInterface (const SnowpackInterface &)
 
 ~SnowpackInterface ()
 Destructor of SnowpackInterface Master. Handels special cases with POP-C++ and also free correctly workers. More...
 
SnowpackInterfaceoperator= (const SnowpackInterface &)
 Assignment operator, required because of pointer member. More...
 
double getTiming () const
 get time who was used to exchange Data with Workers and run on each Pixel the Snowpack Model throught workers. More...
 
void writeOutput (const mio::Date &julian)
 Internal method to allow the master (in case of parallel execution) or the normal thread (non-parallel execution) to write gridded outputs. More...
 
void writeOutputSNO (const mio::Date &julian)
 commands worker to write .sno files. Is triggered by Alpine Control More...
 
void setSnowDrift (SnowDriftA3D &drift)
 Set reference to SnowDrift module, to comunicate with it. More...
 
void setEnergyBalance (EnergyBalance &myeb)
 Set reference to EnergyBalance module, to comunicate with it. More...
 
void setDataAssimilation (DataAssimilation &init_da)
 Set reference to DataAssimilation module, to comunicate with it. More...
 
void setSnowDrift ()
 Send required fields to SnowDrift module. More...
 
void setEnergyBalance ()
 Send required fields to EnergyBalance module. More...
 
void assimilate (const mio::Grid2DObject &daData, const mio::Date &timestamp)
 Interface that DataAssimilation can push the data to the SnowpackInterface This is currently never used... More...
 
void setSnowMassChange (const mio::Grid2DObject &new_mns, const mio::Date &timestamp)
 Interface that SnowDrift can push the data to the SnowpackInterface. More...
 
void setMeteo (const mio::Grid2DObject &new_psum, const mio::Grid2DObject &new_psum_ph, const mio::Grid2DObject &new_vw, const mio::Grid2DObject &new_dw, const mio::Grid2DObject &new_rh, const mio::Grid2DObject &new_ta, const mio::Date &timestamp)
 get Meteo changes from AlpineControl or SnowDrift module More...
 
void setRadiationComponents (const mio::Array2D< double > &shortw, const mio::Array2D< double > &longwave, const mio::Array2D< double > &diff, const mio::Array2D< double > &terrain_shortwave_in, const mio::Array2D< double > &terrain_longwave_in, const double &solarElevation, const mio::Date &timestamp)
 get values from Energy Balance More...
 
mio::Grid2DObject getGrid (const SnGrids::Parameters &param) const
 Request specific grid by parameter type. More...
 
void calcNextStep ()
 Get data from other modules and run one simulation step. Once the simulation step has been performed, the data are pushed to ther other modules. More...
 

Constructor & Destructor Documentation

◆ SnowpackInterface() [1/2]

SnowpackInterface::SnowpackInterface ( const mio::Config &  io_cfg,
const size_t &  nbworkers,
const mio::DEMObject &  dem_in,
const mio::Grid2DObject &  landuse_in,
const std::vector< mio::Coords > &  vec_pts,
const mio::Date &  startTime,
const std::string &  grids_requirements,
const bool  is_restart_in 
)

Constructs and initialise Snowpack Interface Master. He creates the Worker and Distributes the Data from the other modules to the Worker. Is the acces interface A3D side.

Parameters
io_cfgis used to create IOManager, which is used to write the standart output
nbworkersgives the new values for the wind speed
dem_ingives the demographic Data. Also tetermines size and position of the geographical modeling scope
landuse_ingives the landuse Data. Also tetermines size and position of the landuse for modeling scope
vec_ptsgives the spezial points. For this points more output is done then for the others. Calcualtion is the same.
startTimeis the time and date the first simulation step is done
grids_requirementslist of grids that must be prepared for other modules (similar to the Output::GRIDS_PARAMETERS configuration key)
is_restart_inis used to know which files the worker needs to read to init the pixel

◆ SnowpackInterface() [2/2]

SnowpackInterface::SnowpackInterface ( const SnowpackInterface )

◆ ~SnowpackInterface()

SnowpackInterface::~SnowpackInterface ( )

Destructor of SnowpackInterface Master. Handels special cases with POP-C++ and also free correctly workers.

Member Function Documentation

◆ assimilate()

void SnowpackInterface::assimilate ( const mio::Grid2DObject &  daData,
const mio::Date &  timestamp 
)

Interface that DataAssimilation can push the data to the SnowpackInterface This is currently never used...

Parameters
daDataare the data from the DataAssimilation module
timestampfor controlle if data from DataAssimilation are form the correct simulation step

◆ calcNextStep()

void SnowpackInterface::calcNextStep ( )

Get data from other modules and run one simulation step. Once the simulation step has been performed, the data are pushed to ther other modules.

◆ getGrid()

mio::Grid2DObject SnowpackInterface::getGrid ( const SnGrids::Parameters param) const

Request specific grid by parameter type.

Parameters
paramparameter
Returns
2D output grid (empty if the requested parameter was not available)

◆ getTiming()

double SnowpackInterface::getTiming ( ) const

get time who was used to exchange Data with Workers and run on each Pixel the Snowpack Model throught workers.

◆ operator=()

SnowpackInterface & SnowpackInterface::operator= ( const SnowpackInterface source)

Assignment operator, required because of pointer member.

◆ setDataAssimilation()

void SnowpackInterface::setDataAssimilation ( DataAssimilation init_da)

Set reference to DataAssimilation module, to comunicate with it.

Parameters
init_dais the reference to the DataAssimilation module

◆ setEnergyBalance() [1/2]

void SnowpackInterface::setEnergyBalance ( )

Send required fields to EnergyBalance module.

◆ setEnergyBalance() [2/2]

void SnowpackInterface::setEnergyBalance ( EnergyBalance myeb)

Set reference to EnergyBalance module, to comunicate with it.

Parameters
myebis the reference to the EnergyBalance module

◆ setMeteo()

void SnowpackInterface::setMeteo ( const mio::Grid2DObject &  new_psum,
const mio::Grid2DObject &  new_psum_ph,
const mio::Grid2DObject &  new_vw,
const mio::Grid2DObject &  new_dw,
const mio::Grid2DObject &  new_rh,
const mio::Grid2DObject &  new_ta,
const mio::Date &  timestamp 
)

get Meteo changes from AlpineControl or SnowDrift module

Parameters
new_psumgives the new values for new Water High
new_psum_phgives the new values for the precipitation phase
new_vwgives the new values for the wind speed
new_dwgives the new values for the wind direction
new_rhgives the new values for the realtiv Humidity
new_tagives the new values for the Aire temperature
timestampis the time of the calculation step from which this new values are comming

◆ setRadiationComponents()

void SnowpackInterface::setRadiationComponents ( const mio::Array2D< double > &  shortwave_in,
const mio::Array2D< double > &  longwave_in,
const mio::Array2D< double > &  diff_in,
const mio::Array2D< double > &  terrain_shortwave_in,
const mio::Array2D< double > &  terrain_longwave_in,
const double &  solarElevation_in,
const mio::Date &  timestamp 
)

get values from Energy Balance

Parameters
[in]shortwave_inis the 2D double Array map of ISWR [W m-2]
[in]longwave_inis the 2D double Array map of ILWR [W m-2]
[in]diff_inis the 2D double Array map of Diffuse radiation from the sky [W m-2]
[in]terrain_shortwave_in2D double Array map of ISWR reflected by the surrounding terrain [W m-2]
[in]terrain_longwave_in2Ddouble Array map of ILWR emitted by the surrounding terrain [W m-2]
[in]solarElevation_indouble of Solar elevation to be used for Canopy (in dec)
[in]timestampis the time of the calculation step from which this new values are comming

◆ setSnowDrift() [1/2]

void SnowpackInterface::setSnowDrift ( )

Send required fields to SnowDrift module.

◆ setSnowDrift() [2/2]

void SnowpackInterface::setSnowDrift ( SnowDriftA3D mydrift)

Set reference to SnowDrift module, to comunicate with it.

Parameters
mydriftis the reference to the SnowDrift module

◆ setSnowMassChange()

void SnowpackInterface::setSnowMassChange ( const mio::Grid2DObject &  new_mns,
const mio::Date &  timestamp 
)

Interface that SnowDrift can push the data to the SnowpackInterface.

Parameters
new_mnsare the data about the new Snow masses from the DataAssimilation module
timestampfor controlle if data from DataAssimilation are form the correct simulation step

◆ writeOutput()

void SnowpackInterface::writeOutput ( const mio::Date &  date)

Internal method to allow the master (in case of parallel execution) or the normal thread (non-parallel execution) to write gridded outputs.

In order to generate ARC ASCI files compatible with the legacy Alpine3D grids viewer, set A3D_VIEW to TRUE in the [Output] section!

Parameters
dateis the date for which the output is done

◆ writeOutputSNO()

void SnowpackInterface::writeOutputSNO ( const mio::Date &  date)

commands worker to write .sno files. Is triggered by Alpine Control

Hack --> Find better software architecture to do this then SnowpackInterface also does output for other modules of A3D here..

Parameters
dateis the date witch the output is done

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