tOrographicPrecipitationSerial.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tOrographicPrecipitationSerial.hh (2927B)
---
1 // Copyright (C) 2018 Constantine Khroulev and Andy Aschwanden
2 //
3 // This file is part of PISM.
4 //
5 // PISM is free software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the Free Software
7 // Foundation; either version 3 of the License, or (at your option) any later
8 // version.
9 //
10 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with PISM; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 #ifndef OROGRAPHICPRECIPITATIONSERIAL_H
20 #define OROGRAPHICPRECIPITATIONSERIAL_H
21
22 #include <vector>
23
24 #include <fftw3.h>
25 #include <petscvec.h>
26 #include <vector>
27
28 #include "pism/util/petscwrappers/Vec.hh"
29
30 namespace pism {
31
32 class Config;
33
34 namespace atmosphere {
35
36 //! Class implementing the linear model of orographic precipitation [@ref
37 //! SmithBarstad2004], [@ref SmithBarstadBonneau2005].
38 class OrographicPrecipitationSerial {
39 public:
40 OrographicPrecipitationSerial(const Config &config,
41 int Mx, int My,
42 double dx, double dy,
43 int Nx, int Ny);
44 ~OrographicPrecipitationSerial();
45
46 Vec precipitation() const;
47
48 void update(Vec surface_elevation);
49
50 private:
51 // regularization
52 double m_eps;
53
54 // grid size
55 int m_Mx;
56 int m_My;
57
58 //! truncate
59 bool m_truncate;
60 //! precipitation scale factor
61 double m_precip_scale_factor;
62 //! background precipitation
63 double m_background_precip_pre, m_background_precip_post;
64 //! cloud conversion time
65 double m_tau_c;
66 //! cloud fallout time
67 double m_tau_f;
68 //! water vapor scale height
69 double m_Hw;
70 //! moist stability frequency
71 double m_Nm;
72 //! wind direction
73 double m_wind_direction;
74 //! wind speed
75 double m_wind_speed;
76 //! moist adiabatic lapse rate
77 double m_Theta_m;
78 //! moist lapse rate
79 double m_gamma;
80 //! reference density
81 double m_rho_Sref;
82 //! Coriolis force
83 double m_f;
84 //! uplift sensitivity factor
85 double m_Cw;
86 //! latitude for Coriolis force
87 double m_latitude;
88 //! horizontal wind component
89 double m_u;
90 //! vertical wind component
91 double m_v;
92
93 // extended grid size
94 int m_Nx;
95 int m_Ny;
96
97 // indices into extended grid for the corner of the physical grid
98 int m_i0_offset;
99 int m_j0_offset;
100
101 std::vector<double> m_kx, m_ky;
102
103 // orographic precipitation
104 petsc::Vec m_precipitation;
105
106 fftw_complex *m_fftw_input;
107 fftw_complex *m_fftw_output;
108
109 fftw_plan m_dft_forward;
110 fftw_plan m_dft_inverse;
111 };
112
113 } // end of namespace atmosphere
114 } // end of namespace pism
115
116 #endif /* OROGRAPHICPRECIPITATIONSERIAL_H */