Canoe
Comprehensive Atmosphere N' Ocean Engine
freedman_simple.cpp
Go to the documentation of this file.
1 // C/C++ headers
2 #include <algorithm>
3 #include <cassert> // assert
4 #include <cmath>
5 #include <cstring>
6 #include <iostream>
7 #include <stdexcept>
8 #include <string>
9 
10 // athena
11 #include <athena/athena_arrays.hpp>
12 #include <athena/mesh/mesh.hpp>
13 
14 // canoe
15 #include <air_parcel.hpp>
16 #include <constants.hpp>
17 #include <impl.hpp>
18 
19 // snap
21 
22 // opacity
23 #include "freedman.hpp"
24 
25 // xiz semigrey
26 Real FreedmanSimple::GetAttenuation(Real wave1, Real wave2,
27  AirParcel const &var) const {
28  auto pthermo = Thermodynamics::GetInstance();
29  Real mu = Constants::Rgas / pthermo->GetRd();
30  Real result;
31  Real p = var.w[IPR];
32  Real T = var.w[IDN];
33  Real scale = GetPar<Real>("scale");
34 
35  /*xiz semigrey
36  //Tan and Komacek 2019 simple fit m^2/kg
37  // k_VIS= 10.0_dp**(0.0478_dp*Pl10**2 - 0.1366_dp*Pl10 - 3.2095_dp)
38  // k_IR = 10.0_dp**(0.0498_dp*Pl10**2 - 0.1329_dp*Pl10 - 2.9457_dp)
39  Real logp = log10(p); // Pa
40  if (wave < 40000.) //for semigrey
41  result = pow(10.0, (0.0498*pow(logp,2.) - 0.1329*logp - 2.9457));
42  else
43  result = pow(10.0, (0.0478*pow(logp,2.) - 0.1366*logp - 3.2095));
44  */
45 
46  // Komacek et al. 2017
47  // if (wave < 40000.) //for semigrey
48  // result = 2.28e-6*pow(p, 0.53);
49  // else
50  result = 2.28e-6 * pow(p, 0.53); // visible opacity scale in disort
51  //
52 
53  Real dens = p * mu / (Constants::Rgas * T); // kg/m^3
54  // if (p > 5e1)
55  return scale * dens * result; // -> 1/m
56  // else
57  // return 0.;
58 }
Real *const w
Definition: air_parcel.hpp:36
Real GetAttenuation(Real wave1, Real wave2, AirParcel const &var) const
Get attenuation coefficient [1/m].
static Thermodynamics const * GetInstance()
Return a pointer to the one and only instance of Thermodynamics.
double const Rgas
Definition: constants.hpp:5