Alpine3D  Alpine3D-3.2.0
TerrainRadiationPETSc.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009-2015 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3 /***********************************************************************************/
4 /* This file is part of Alpine3D.
5  Alpine3D is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Alpine3D is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Alpine3D. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef TERRAINRADIATIONPETSC_H
19 #define TERRAINRADIATIONPETSC_H
20 
21 #include <petscksp.h>
22 
23 #include <meteoio/MeteoIO.h>
24 
25 #include <alpine3d/MPIControl.h>
28 
30 
31  public:
32  TerrainRadiationPETSc(const mio::Config& i_cfg, const mio::DEMObject& dem_in, const int& i_nbworkers, const std::string& method);
34 
35  void getRadiation(const mio::Array2D<double>& direct, mio::Array2D<double>& diffuse, mio::Array2D<double>& terrain);
36  void setMeteo(const mio::Array2D<double>& albedo, const mio::Array2D<double>& ta,
37  const mio::Array2D<double>& rh, const mio::Array2D<double>& ilwr);
38 
39  private:
40  const mio::DEMObject& dem;
41  const unsigned int dimx, dimy;
42 
43  Mat M, VF;
44  Vec ALBEDO, x, b;
45  KSP ksp;
46 
47  PetscInt Mstart, Mend;
48  PetscInt Istart, Iend, N, B;
49 
50  int multiIndexToRowIndex(const PetscInt& i, const PetscInt& N);
51  int multiIndexToColIndex(const PetscInt& i, const PetscInt& N);
52  PetscInt indexToMultiIndex(const unsigned int& i, const unsigned int& j, const PetscInt& N);
53 };
54 
55 #endif
Definition: TerrainRadiationAlgorithm.h:35
void getRadiation(const mio::Array2D< double > &direct, mio::Array2D< double > &diffuse, mio::Array2D< double > &terrain)
Definition: TerrainRadiationPETSc.cc:118
void setMeteo(const mio::Array2D< double > &albedo, const mio::Array2D< double > &ta, const mio::Array2D< double > &rh, const mio::Array2D< double > &ilwr)
Definition: TerrainRadiationPETSc.cc:177
Definition: TerrainRadiationPETSc.h:29
TerrainRadiationPETSc(const mio::Config &i_cfg, const mio::DEMObject &dem_in, const int &i_nbworkers, const std::string &method)
Definition: TerrainRadiationPETSc.cc:23
~TerrainRadiationPETSc()
Definition: TerrainRadiationPETSc.cc:108