Alpine3D  Alpine3D-3.2.0
SnowpackInterfaceWorker Class Reference

#include <SnowpackInterfaceWorker.h>

Public Member Functions

 SnowpackInterfaceWorker (const mio::Config &io_cfg, const mio::DEMObject &dem_in, const mio::Grid2DObject &landuse_in, const std::vector< std::pair< size_t, size_t > > &pts_in, const std::vector< SnowStation *> &snow_stations, const std::vector< std::pair< size_t, size_t > > &snow_stations_coord, const size_t offset_in)
 Constructs and initialise Snowpack Interface Worker. Create one worker and init values for slice which the worker need to simulate it slice. More...
 
 ~SnowpackInterfaceWorker ()
 
void setUseDrift (const bool useDrift_in)
 
void setUseEBalance (const bool useEBalance_in)
 
void getOutputSNO (std::vector< SnowStation *> &snow_station) const
 method that returns SnowCover files for specific date. More...
 
void getOutputSpecialPoints (std::vector< SnowStation *> &ptr_snow_pixel, std::vector< CurrentMeteo *> &ptr_meteo_pixel, std::vector< SurfaceFluxes *> &ptr_surface_flux)
 
void clearSpecialPointsData ()
 
mio::Grid2DObject getGrid (const SnGrids::Parameters &param) const
 Method that the Master can search the neded data (in grids) from Worker (Pull from client) More...
 
double & getGridPoint (const SnGrids::Parameters &param, const size_t &ii, const size_t &jj)
 Retrieve one point (ii,jj) from the specified grid. More...
 
void runModel (const mio::Date &julian, const mio::Grid2DObject &psum, const mio::Grid2DObject &psum_ph, const mio::Grid2DObject &psum_tech, const mio::Grid2DObject &rh, const mio::Grid2DObject &ta, const mio::Grid2DObject &vw, const mio::Grid2DObject &dw, const mio::Grid2DObject &mns, const mio::Grid2DObject &shortwave, const mio::Grid2DObject &diffuse, const mio::Grid2DObject &longwave, const double solarElevation)
 method which prepares all data for simulation and then access correctly the Snowpack model interfaces. More...
 
void grooming (const mio::Date &current_date, const mio::Grid2DObject &grooming_map)
 
void getLateralFlow (std::vector< SnowStation *> &snow_station)
 method called by SnowpackInterface to retrieve all snow_pixels, to read the lateral flow variable More...
 
void setLateralFlow (const std::vector< SnowStation *> &snow_station)
 method called by SnowpackInterface to send back the source/sink term for treating lateral flow More...
 

Static Public Member Functions

static int round_landuse (const double &landuse_dbl)
 optimised way to round landuse More...
 
static bool skipThisCell (const double &landuse_val, const double &dem_val)
 check if a cell should be simulated or skipped More...
 
static bool is_special (const std::vector< std::pair< size_t, size_t > > &pts_in, const size_t &ix, const size_t &iy)
 
static void uniqueOutputGrids (std::vector< std::string > &output_grids)
 Make sure all requested grids only appear once. More...
 

Constructor & Destructor Documentation

◆ SnowpackInterfaceWorker()

SnowpackInterfaceWorker::SnowpackInterfaceWorker ( const mio::Config &  io_cfg,
const mio::DEMObject &  dem_in,
const mio::Grid2DObject &  landuse_in,
const std::vector< std::pair< size_t, size_t > > &  pts_in,
const std::vector< SnowStation *> &  snow_stations,
const std::vector< std::pair< size_t, size_t > > &  snow_stations_coord,
const size_t  offset_in 
)

Constructs and initialise Snowpack Interface Worker. Create one worker and init values for slice which the worker need to simulate it slice.

Parameters
io_cfgconfiguration to pass to Snowpack
dem_ingives the demographic Data. Also tetermines size and position of the slice
landuse_ingives the landuse Data. Also tetermines size and position of the landuse for slice
pts_ingives the spezial points. For this points more output is done then for the others. Calcualtion is the same.
snow_stationsgives a vector of pointers to the SnowStation objects relevant for this thread
snow_stations_coordprovide the (ii,jj) coordinates of each snow station. This is necessary because the slices might be irregular
offset_ingives the offsett on X for this slice (needed to read data and error messages)

◆ ~SnowpackInterfaceWorker()

SnowpackInterfaceWorker::~SnowpackInterfaceWorker ( )

Member Function Documentation

◆ clearSpecialPointsData()

void SnowpackInterfaceWorker::clearSpecialPointsData ( )

◆ getGrid()

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

Method that the Master can search the neded data (in grids) from Worker (Pull from client)

Parameters
paramsays which grid param the Master wants to have
Returns
the 2D output grid, which gives back the data to the master

◆ getGridPoint()

double & SnowpackInterfaceWorker::getGridPoint ( const SnGrids::Parameters param,
const size_t &  ii,
const size_t &  jj 
)

Retrieve one point (ii,jj) from the specified grid.

Parameters
paramsays which grid param the Master wants to have
iiii index
jjjj index
Returns
grid value at point (ii,jj) for parameter param

◆ getLateralFlow()

void SnowpackInterfaceWorker::getLateralFlow ( std::vector< SnowStation *> &  ptr_snow_pixel)

method called by SnowpackInterface to retrieve all snow_pixels, to read the lateral flow variable

Parameters
ptr_snow_pixelto vector of SnowStations, where the variable SlopeParFlux contains the lateral flow

◆ getOutputSNO()

void SnowpackInterfaceWorker::getOutputSNO ( std::vector< SnowStation *> &  snow_station) const

method that returns SnowCover files for specific date.

Parameters
snow_stationvector that will be filled with the SnowStation data for each pixels

◆ getOutputSpecialPoints()

void SnowpackInterfaceWorker::getOutputSpecialPoints ( std::vector< SnowStation *> &  ptr_snow_pixel,
std::vector< CurrentMeteo *> &  ptr_meteo_pixel,
std::vector< SurfaceFluxes *> &  ptr_surface_flux 
)

◆ grooming()

void SnowpackInterfaceWorker::grooming ( const mio::Date &  current_date,
const mio::Grid2DObject &  grooming_map 
)

◆ is_special()

bool SnowpackInterfaceWorker::is_special ( const std::vector< std::pair< size_t, size_t > > &  pts_in,
const size_t &  ix,
const size_t &  iy 
)
static

◆ round_landuse()

int SnowpackInterfaceWorker::round_landuse ( const double &  landuse_dbl)
static

optimised way to round landuse

Parameters
landuse_dblis the landuse to round

◆ runModel()

void SnowpackInterfaceWorker::runModel ( const mio::Date &  date,
const mio::Grid2DObject &  psum,
const mio::Grid2DObject &  psum_ph,
const mio::Grid2DObject &  psum_tech,
const mio::Grid2DObject &  rh,
const mio::Grid2DObject &  ta,
const mio::Grid2DObject &  vw,
const mio::Grid2DObject &  dw,
const mio::Grid2DObject &  mns,
const mio::Grid2DObject &  shortwave,
const mio::Grid2DObject &  diffuse,
const mio::Grid2DObject &  longwave,
const double  solarElevation 
)

method which prepares all data for simulation and then access correctly the Snowpack model interfaces.

Parameters
datecurrent simulation time step
psumprecipitation grid (kg m-2)
psum_phprecipitation phase grid (between 0 and 1)
psum_techtechnical precipitation grid (kg m-2)
rhrelative humidity grid (% or 1)
taair temperature grid (K)
vwwind velocity grid (m s-1)
dwwind direction grid (degrees north)
mnsmap of the Precipitation (mm/h) HACK get this map only if per pull from Master if Drift is used !!
shortwaveincoming shortwave radiation grid (W m-2)
diffusediffuse radiation from the sky grid (W m-2)
longwaveincoming longwave grid (W m-2)
solarElevationsolar elevation (in dec)

◆ setLateralFlow()

void SnowpackInterfaceWorker::setLateralFlow ( const std::vector< SnowStation *> &  ptr_snow_pixel)

method called by SnowpackInterface to send back the source/sink term for treating lateral flow

Parameters
ptr_snow_pixelto vector of SnowStations, in which the lwc_source variable is set to contain the lateral flow.

◆ setUseDrift()

void SnowpackInterfaceWorker::setUseDrift ( const bool  useDrift_in)
inline

◆ setUseEBalance()

void SnowpackInterfaceWorker::setUseEBalance ( const bool  useEBalance_in)
inline

◆ skipThisCell()

bool SnowpackInterfaceWorker::skipThisCell ( const double &  landuse_val,
const double &  dem_val 
)
static

check if a cell should be simulated or skipped

Parameters
landuse_valland use parameter for this pixel
dem_valdem altitude for this pixel

◆ uniqueOutputGrids()

void SnowpackInterfaceWorker::uniqueOutputGrids ( std::vector< std::string > &  output_grids)
static

Make sure all requested grids only appear once.

Parameters
output_gridsvector of requeste grids to sort and filter

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