18#ifndef SNOWPACKINTERFACE_H
19#define SNOWPACKINTERFACE_H
22#include <meteoio/MeteoIO.h>
23#include <snowpack/libsnowpack.h>
130 const mio::DEMObject& dem_in,
131 const mio::Grid2DObject& landuse_in,
const std::vector<mio::Coords>& vec_pts,
132 const mio::Date& startTime,
const std::string& grids_requirements,
const bool is_restart_in);
150 void assimilate(
const mio::Grid2DObject& daData,
const mio::Date& timestamp);
151 void setSnowMassChange(
const mio::Grid2DObject& new_mns,
const mio::Date& timestamp);
152 void setMeteo(
const mio::Grid2DObject& new_psum,
153 const mio::Grid2DObject& new_psum_ph,
154 const mio::Grid2DObject& new_vw,
155 const mio::Grid2DObject& new_dw,
156 const mio::Grid2DObject& new_rh,
157 const mio::Grid2DObject& new_ta,
158 const mio::Date& timestamp);
160 const mio::Array2D<double>& longwave,
161 const mio::Array2D<double>& diff,
162 const mio::Array2D<double>& terrain_shortwave_in,
163 const mio::Array2D<double>& terrain_longwave_in,
164 const double& solarElevation,
165 const mio::Date& timestamp);
171 static const std::vector<std::string> grids_not_computed_in_worker;
172 std::string getGridsRequirements()
const;
173 mio::Config readAndTweakConfig(
const mio::Config& io_cfg,
const bool have_pts);
174 bool do_grid_output(
const mio::Date &date)
const;
175 void setInitGlacierThickness();
176 SN_SNOWSOIL_DATA getIcePixel(
const double glacier_thickness,
const std::stringstream& GRID_sno,
const bool seaIce);
177 void readInitalSnowCover(std::vector<SnowStation*>& snow_stations,
178 std::vector<std::pair<size_t,size_t> >& snow_stations_coord);
179 void readSnowCover(
const std::string& GRID_sno,
const std::string& LUS_sno,
const bool& is_special_point,
180 SN_SNOWSOIL_DATA &sno, ZwischenData &zwischenData,
const bool& read_seaice);
181 void writeSnowCover(
const mio::Date& date,
const std::vector<SnowStation*>& snow_station);
183 void write_SMET_header(
const mio::StationData& meta,
const double& landuse_code)
const;
184 void write_SMET(
const CurrentMeteo& met,
const mio::StationData& meta,
const SurfaceFluxes& surf)
const;
185 void writeOutputSpecialPoints(
const mio::Date& date,
const std::vector<SnowStation*>& snow_pixel,
const std::vector<CurrentMeteo*>& meteo_pixel,
186 const std::vector<SurfaceFluxes*>& surface_flux);
187 void write_special_points();
188 void calcLateralFlow();
195 std::vector< std::pair<size_t,size_t> > pts;
197 const mio::DEMObject dem;
198 mio::DEMObject omp_dem;
201 bool is_restart, useCanopy, enable_lateral_flow, a3d_view;
203 std::string station_name;
204 bool glacier_katabatic_flow, snow_production, snow_grooming;
206 std::vector<std::string> Tsoil_idx;
207 std::vector<std::string> soil_runoff_idx;
208 double grids_start, grids_days_between;
209 double ts_start, ts_days_between;
210 double prof_start, prof_days_between;
211 bool grids_write, ts_write, prof_write, snow_write, write_poi_meteo, snow_poi_written, glacier_from_grid;
212 std::string meteo_outpath;
216 mio::Grid2DObject maskGlacier;
219 SnowpackConfig sn_cfg;
221 SnowpackIO snowpackIO;
224 size_t mpi_offset, mpi_nx;
225 mio::Grid2DObject landuse, omp_landuse;
227 mio::Grid2DObject mns, shortwave, longwave, diffuse, terrain_shortwave, terrain_longwave;
228 mio::Grid2DObject psum, psum_ph, psum_tech, grooming, vw, dw, rh, ta, init_glaciers_thickness;
229 double solarElevation;
231 std::vector<std::string> output_grids;
232 std::vector<SnowpackInterfaceWorker*> workers;
233 std::vector<size_t> worker_startx;
234 std::vector<size_t> worker_deltax;
235 std::vector<std::vector<std::pair<size_t,size_t> > > worker_stations_coord;
238 mio::Date nextStepTimestamp;
241 bool dataMeteo2D, dataDa, dataSnowDrift, dataRadiation;
Definition: DataAssimilation.h:30
Definition: EnergyBalance.h:69
Definition: Glaciers.h:48
Parameters
this enum provides names for possible Snowpack grids
Definition: MeteoObj.h:33
Definition: SnowDrift.h:89
Definition: SnowpackInterfaceWorker.h:26
Definition: SnowpackInterface.h:126
void setSnowMassChange(const mio::Grid2DObject &new_mns, const mio::Date ×tamp)
Interface that SnowDrift can push the data to the SnowpackInterface.
Definition: SnowpackInterface.cc:649
SnowpackInterface & operator=(const SnowpackInterface &)
Assignment operator, required because of pointer member.
Definition: SnowpackInterface.cc:292
void assimilate(const mio::Grid2DObject &daData, const mio::Date ×tamp)
Interface that DataAssimilation can push the data to the SnowpackInterface This is currently never us...
Definition: SnowpackInterface.cc:607
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 ×tamp)
get values from Energy Balance
Definition: SnowpackInterface.cc:726
mio::Grid2DObject getGrid(const SnGrids::Parameters ¶m) const
Request specific grid by parameter type.
Definition: SnowpackInterface.cc:756
void setSnowDrift()
Send required fields to SnowDrift module.
Definition: SnowpackInterface.cc:552
void writeOutput(const mio::Date &julian)
Internal method to allow the master (in case of parallel execution) or the normal thread (non-paralle...
Definition: SnowpackInterface.cc:449
void writeOutputSNO(const mio::Date &julian)
commands worker to write .sno files. Is triggered by Alpine Control
Definition: SnowpackInterface.cc:493
void setDataAssimilation(DataAssimilation &init_da)
Set reference to DataAssimilation module, to comunicate with it.
Definition: SnowpackInterface.cc:595
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 f...
Definition: SnowpackInterface.cc:92
void setEnergyBalance()
Send required fields to EnergyBalance module.
Definition: SnowpackInterface.cc:582
void calcNextStep()
Get data from other modules and run one simulation step. Once the simulation step has been performed,...
Definition: SnowpackInterface.cc:824
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 ×tamp)
get Meteo changes from AlpineControl or SnowDrift module
Definition: SnowpackInterface.cc:680
~SnowpackInterface()
Destructor of SnowpackInterface Master. Handels special cases with POP-C++ and also free correctly wo...
Definition: SnowpackInterface.cc:425
double getTiming() const
get time who was used to exchange Data with Workers and run on each Pixel the Snowpack Model throught...
Definition: SnowpackInterface.cc:436
SnowpackInterface(const SnowpackInterface &)
Definition: TechSnowA3D.h:71