Canoe
Comprehensive Atmosphere N' Ocean Engine
profile_inversion.hpp
Go to the documentation of this file.
1 #ifndef SRC_INVERSION_PROFILE_INVERSION_HPP_
2 #define SRC_INVERSION_PROFILE_INVERSION_HPP_
3 
4 // C/C++ headers
5 #include <string>
6 #include <vector>
7 
8 // canoe
9 #include <configure.hpp>
10 
11 // inversion
12 #include "inversion.hpp"
13 
14 class MeshBlock;
15 
16 class ProfileInversion : public Inversion {
17  public:
18  ProfileInversion(MeshBlock *pmb, ParameterInput *pin, std::string name);
20 
21  size_t samples() const { return plevel_.size() - 2; }
22 
23  void InitializePositions() override;
24 
25  void UpdateHydro(Hydro *phydro, ParameterInput *pin) const override;
26 
27  Real LogPosteriorProbability(Radiation *prad, Hydro *phydro, Real const *par,
28  Real *val, int k) const override;
29 
30  void UpdateProfiles(Hydro *phydro, Real **XpSample, int k, int jl,
31  int ju) const;
32 
33  void ConvectiveAdjustment(Hydro *phydro, int k, int ju) const;
34 
35  virtual Real LogPriorProbability(Real **XpSample) const;
36 
37  int getX2Span() const override { return idx_.size() + 1; }
38 
39  protected:
40  // pressure levels
41  std::vector<Real> plevel_;
42 
43  // inversion variable id
44  std::vector<int> idx_;
45 
46  // hyper-parameters
47  Real chi_;
48  Real Xstd_[1 + NVAPOR];
49  Real Xlen_[1 + NVAPOR];
50 };
51 
53  public:
54  // functions
55  VLAProfileInversion(MeshBlock *pmb, ParameterInput *pin)
56  : ProfileInversion(pmb, pin, "profile") {}
57 
59 
60  void CalculateFitTarget(Radiation const *prad, Real *val, int nvalue, int k,
61  int j) const override;
62 };
63 
65  public:
66  // functions
67  JunoProfileInversion(MeshBlock *pmb, ParameterInput *pin)
68  : ProfileInversion(pmb, pin, "profile") {}
69 
71 
72  void CalculateFitTarget(Radiation const *prad, Real *val, int nvalue, int k,
73  int j) const override;
74 };
75 
76 #endif // SRC_INVERSION_PROFILE_INVERSION_HPP_
void CalculateFitTarget(Radiation const *prad, Real *val, int nvalue, int k, int j) const override
JunoProfileInversion(MeshBlock *pmb, ParameterInput *pin)
virtual Real LogPriorProbability(Real **XpSample) const
Real Xstd_[1+NVAPOR]
std::vector< int > idx_
void UpdateHydro(Hydro *phydro, ParameterInput *pin) const override
Real LogPosteriorProbability(Radiation *prad, Hydro *phydro, Real const *par, Real *val, int k) const override
void InitializePositions() override
int getX2Span() const override
Real Xlen_[1+NVAPOR]
std::vector< Real > plevel_
void ConvectiveAdjustment(Hydro *phydro, int k, int ju) const
ProfileInversion(MeshBlock *pmb, ParameterInput *pin, std::string name)
void UpdateProfiles(Hydro *phydro, Real **XpSample, int k, int jl, int ju) const
size_t samples() const
void CalculateFitTarget(Radiation const *prad, Real *val, int nvalue, int k, int j) const override
VLAProfileInversion(MeshBlock *pmb, ParameterInput *pin)