PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
OrographicPrecipitationSerial.hh
Go to the documentation of this file.
1 // Copyright (C) 2018, 2020 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 #include <fftw3.h>
24 
25 #include "pism/util/petscwrappers/Vec.hh"
26 
27 namespace pism {
28 
29 class Config;
30 
31 namespace atmosphere {
32 
33 //! Class implementing the linear model of orographic precipitation [@ref
34 //! SmithBarstad2004], [@ref SmithBarstadBonneau2005].
36 public:
38  int Mx, int My,
39  double dx, double dy,
40  int Nx, int Ny);
42 
43  Vec precipitation() const;
44 
45  void update(petsc::Vec &surface_elevation);
46 
47 private:
48  // regularization
49  double m_eps;
50 
51  // grid size
52  int m_Mx;
53  int m_My;
54 
55  //! truncate
56  bool m_truncate;
57  //! precipitation scale factor
59  //! background precipitation
61  //! cloud conversion time
62  double m_tau_c;
63  //! cloud fallout time
64  double m_tau_f;
65  //! water vapor scale height
66  double m_Hw;
67  //! moist stability frequency
68  double m_Nm;
69  //! wind direction
71  //! wind speed
72  double m_wind_speed;
73  //! moist adiabatic lapse rate
74  double m_Theta_m;
75  //! moist lapse rate
76  double m_gamma;
77  //! reference density
78  double m_rho_Sref;
79  //! Coriolis force
80  double m_f;
81  //! uplift sensitivity factor
82  double m_Cw;
83  //! latitude for Coriolis force
84  double m_latitude;
85  //! horizontal wind component
86  double m_u;
87  //! vertical wind component
88  double m_v;
89 
90  // extended grid size
91  int m_Nx;
92  int m_Ny;
93 
94  // indices into extended grid for the corner of the physical grid
97 
98  std::vector<double> m_kx, m_ky;
99 
100  // resulting orographic precipitation
102 
103  fftw_complex *m_fftw_input;
104  fftw_complex *m_fftw_output;
105 
106  // FFT(Gaussian) used to smooth surface elevation
107  fftw_complex *m_G_hat;
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 */
A class for storing and accessing PISM configuration flags and parameters.
OrographicPrecipitationSerial(const Config &config, int Mx, int My, double dx, double dy, int Nx, int Ny)