ARTS  2.2.66
fastem.cc
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012
2  Sreerekha Ravi<rekha@sat.physik.uni-bremen.de>
3  Stefan Buehler <sbuehler@ltu.se>
4 
5  This program is free software; you can redistribute it and/or modify it
6  under the terms of the GNU General Public License as published by the
7  Free Software Foundation; either version 2, or (at your option) any
8  later version.
9 
10  This program 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 General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18  USA.
19 */
20 
31 /*===========================================================================
32  === External declarations
33  ===========================================================================*/
34 
35 #include <stdexcept>
36 #include <cmath>
37 #include "matpackI.h"
38 #include "exceptions.h"
39 #include "complex.h"
40 
41 using std::ostringstream;
42 using std::runtime_error;
43 
44 extern const Numeric PI;
45 extern const Numeric DEG2RAD;
46 extern const Numeric RAD2DEG;
48 
60 void fastem(// Output:
61  VectorView surface_emiss,
62  // Input:
63  const Numeric& surface_temp,
64  ConstVectorView surface_wind,
65  ConstVectorView surface_fastem_constants,
66  const Numeric& freq
67  )
68 {
69  // Calculate PIOM (Ellison et al.) xperm
70  //Calculate xperm using the dclamkaouchi method
71  // Calculate PIOM (Ellison et al.) xperm
72 
73  // Convert the surface temperature in Kelvin to centigrade.
74  Numeric temp_c = surface_temp - 273.15;
75  Numeric temp_cc = temp_c * temp_c;
76  Numeric temp_ccc = temp_cc * temp_c;
77 
78  if ( (temp_c < -5.0) || (temp_c > 100.0) ||
79  (freq < 10e+9) || (freq > 500e+9) )
80  {
81 
82  ostringstream os;
83  os << "Severe warning from dclamkaouchi: "
84  << "The accepted temperature range in centigrade is "
85  << "[-5,100],\nbut a value of " << temp_c
86  << "degree C was found. Also the allowed frequency range is "
87  << "[10 GHz,500 GHz],\nbut a value of " << freq
88  << " was found.";
89 
90  throw runtime_error( os.str() );
91  }
92  else
93  if ( (freq < 20e+9) || (freq > 200e+9) )
94  {
95 
96  ostringstream os;
97  os << "Warning from dclamkaouchi: "
98  << "The accepted temperature range in centigrade is "
99  << "[-5,100],\nbut a value of " << temp_c
100  << "degree C was found. Also the allowed frequency range is "
101  << "[10 GHz,500 GHz],\nbut a value of " << freq
102  << " was found."<< surface_wind; //remove surface_wind, it
103  //was only to avoid
104  //
105  //compilation error due to unused variable
106 
107 
108  throw runtime_error( os.str() );
109  }
110 
111  // define the two relaxation frequencies, tau1 and tau2
112  Numeric tau1 = surface_fastem_constants[0] + surface_fastem_constants[1]* temp_c +
113  surface_fastem_constants[2] * temp_cc;
114 
115  Numeric tau2 = surface_fastem_constants[3] + surface_fastem_constants[4]* temp_c +
116  surface_fastem_constants[5] * temp_cc + surface_fastem_constants[6] * temp_ccc;
117 
118  // define static xperm - FIXME TRS
119  Numeric del1 = surface_fastem_constants[7] + surface_fastem_constants[8]* temp_c +
120  surface_fastem_constants[9] * temp_cc + surface_fastem_constants[10] * temp_ccc;
121 
122  Numeric del2 = surface_fastem_constants[11] + surface_fastem_constants[12]* temp_c +
123  surface_fastem_constants[13] * temp_cc + surface_fastem_constants[14] * temp_ccc;
124 
125  Numeric einf = surface_fastem_constants[17] + surface_fastem_constants[18] * temp_c;
126 
127  //calculate xperm using double debye formula
128  Numeric fen = 2.0 * surface_fastem_constants[19] * freq/1e+9 * 0.001;
129  Numeric fen2 = pow(fen,2);
130  Numeric den1 = 1.0 + fen2 * tau1 * tau1;
131  Numeric den2 = 1.0 + fen2 * tau2 * tau2;
132  Numeric perm_real1 = del1/den1;
133  Numeric perm_real2 = del2/den2;
134  Numeric perm_imag1 = del1 * fen * tau1/den1;
135  Numeric perm_imag2 = del2 * fen * tau2/den2;
136  Numeric perm_real = perm_real1 + perm_real2 + einf;
137  Numeric perm_imag = perm_imag1 + perm_imag2;
138 
139  Complex xperm (perm_real, perm_imag); //FIXME use complex here
140 
141  //Now the fresnel calculations
142  // This is used to calculate vertical and horizontal polarised
143  //reflectivities given xperm at local incidence angle. I am not sure
144  // how to include this theta now!!! FIXME
145  Numeric theta = 55.0;
146 
147  Numeric cos_theta = cos(theta * DEG2RAD);
148  Numeric sin_theta = sin(theta * DEG2RAD);
149 
150  //Numeric cos_2 = pow(cos_theta, 2);
151  Numeric sin_2 = pow(sin_theta, 2);
152 
153  Complex perm1 = sqrt(xperm - sin_2);
154  Complex perm2 = xperm * cos_theta;
155 
156  Complex rhth = (cos_theta - perm1)/(cos_theta + perm1);
157  Complex rvth = (perm2 - perm1)/(perm2 + perm1);
158 
159  //Numeric rvertsr = real.rvth();
160  //Numeric rvertsi = imag.rvth();
161  Numeric rvertsr = real(rvth);
162  Numeric rvertsi = imag(rvth);
163 
164  Numeric rverts = pow(rvertsr, 2) + pow(rvertsi, 2);
165 
166  //Numeric rhorzsr = real.rhth();
167  //Numeric rhorzsi = imag.rhth();
168  Numeric rhorzsr = real(rhth);
169  Numeric rhorzsi = imag(rhth);
170  Numeric rhorzs = pow(rhorzsr, 2) + pow(rhorzsi, 2);
171 
172  surface_emiss[0] = rverts;
173  surface_emiss[1] = rhorzs;
174  surface_emiss[2] = 0;
175  surface_emiss[3] = 0;
176 
177 
178 }
179 
180 
RAD2DEG
const Numeric RAD2DEG
exceptions.h
The declarations of all the exception classes.
Complex
std::complex< Numeric > Complex
Definition: complex.h:32
matpackI.h
complex.h
A class implementing complex numbers for ARTS.
VectorView
The VectorView class.
Definition: matpackI.h:372
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
real
float real
Definition: continua.cc:20315
DEG2RAD
const Numeric DEG2RAD
PI
const Numeric PI
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:292
fastem
void fastem(VectorView surface_emiss, const Numeric &surface_temp, ConstVectorView surface_wind, ConstVectorView surface_fastem_constants, const Numeric &freq)
Calculate the surface emissivity using Fastem model.
Definition: fastem.cc:60