ARTS  2.0.49
fastem.cc
Go to the documentation of this file.
1 /* Copyright (C) 2002-2008
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 extern const Numeric PI;
42 extern const Numeric DEG2RAD;
43 extern const Numeric RAD2DEG;
45 
57 void fastem(// Output:
58  VectorView surface_emiss,
59  // Input:
60  const Numeric& surface_temp,
61  ConstVectorView surface_wind,
62  ConstVectorView surface_fastem_constants,
63  const Numeric& freq
64  )
65 {
66  // Calculate PIOM (Ellison et al.) xperm
67  //Calculate xperm using the dclamkaouchi method
68  // Calculate PIOM (Ellison et al.) xperm
69 
70  // Convert the surface temperature in Kelvin to centigrade.
71  Numeric temp_c = surface_temp - 273.15;
72  Numeric temp_cc = temp_c * temp_c;
73  Numeric temp_ccc = temp_cc * temp_c;
74 
75  if ( (temp_c < -5.0) || (temp_c > 100.0) ||
76  (freq < 10e+9) || (freq > 500e+9) )
77  {
78 
79  ostringstream os;
80  os << "Severe warning from dclamkaouchi: "
81  << "The accepted temperature range in centigrade is "
82  << "[-5,100],\nbut a value of " << temp_c
83  << "degree C was found. Also the allowed frequency range is "
84  << "[10 GHz,500 GHz],\nbut a value of " << freq
85  << " was found.";
86 
87  throw runtime_error( os.str() );
88  }
89  else
90  if ( (freq < 20e+9) || (freq > 200e+9) )
91  {
92 
93  ostringstream os;
94  os << "Warning from dclamkaouchi: "
95  << "The accepted temperature range in centigrade is "
96  << "[-5,100],\nbut a value of " << temp_c
97  << "degree C was found. Also the allowed frequency range is "
98  << "[10 GHz,500 GHz],\nbut a value of " << freq
99  << " was found."<< surface_wind; //remove surface_wind, it
100  //was only to avoid
101  //
102  //compilation error due to unused variable
103 
104 
105  throw runtime_error( os.str() );
106  }
107 
108  // define the two relaxation frequencies, tau1 and tau2
109  Numeric tau1 = surface_fastem_constants[0] + surface_fastem_constants[1]* temp_c +
110  surface_fastem_constants[2] * temp_cc;
111 
112  Numeric tau2 = surface_fastem_constants[3] + surface_fastem_constants[4]* temp_c +
113  surface_fastem_constants[5] * temp_cc + surface_fastem_constants[6] * temp_ccc;
114 
115  // define static xperm - FIXME TRS
116  Numeric del1 = surface_fastem_constants[7] + surface_fastem_constants[8]* temp_c +
117  surface_fastem_constants[9] * temp_cc + surface_fastem_constants[10] * temp_ccc;
118 
119  Numeric del2 = surface_fastem_constants[11] + surface_fastem_constants[12]* temp_c +
120  surface_fastem_constants[13] * temp_cc + surface_fastem_constants[14] * temp_ccc;
121 
122  Numeric einf = surface_fastem_constants[17] + surface_fastem_constants[18] * temp_c;
123 
124  //calculate xperm using double debye formula
125  Numeric fen = 2.0 * surface_fastem_constants[19] * freq/1e+9 * 0.001;
126  Numeric fen2 = pow(fen,2);
127  Numeric den1 = 1.0 + fen2 * tau1 * tau1;
128  Numeric den2 = 1.0 + fen2 * tau2 * tau2;
129  Numeric perm_real1 = del1/den1;
130  Numeric perm_real2 = del2/den2;
131  Numeric perm_imag1 = del1 * fen * tau1/den1;
132  Numeric perm_imag2 = del2 * fen * tau2/den2;
133  Numeric perm_real = perm_real1 + perm_real2 + einf;
134  Numeric perm_imag = perm_imag1 + perm_imag2;
135 
136  Complex xperm (perm_real, perm_imag); //FIXME use complex here
137 
138  //Now the fresnel calculations
139  // This is used to calculate vertical and horizontal polarised
140  //reflectivities given xperm at local incidence angle. I am not sure
141  // how to include this theta now!!! FIXME
142  Numeric theta = 55.0;
143 
144  Numeric cos_theta = cos(theta * DEG2RAD);
145  Numeric sin_theta = sin(theta * DEG2RAD);
146 
147  //Numeric cos_2 = pow(cos_theta, 2);
148  Numeric sin_2 = pow(sin_theta, 2);
149 
150  Complex perm1 = sqrt(xperm - sin_2);
151  Complex perm2 = xperm * cos_theta;
152 
153  Complex rhth = (cos_theta - perm1)/(cos_theta + perm1);
154  Complex rvth = (perm2 - perm1)/(perm2 + perm1);
155 
156  //Numeric rvertsr = real.rvth();
157  //Numeric rvertsi = imag.rvth();
158  Numeric rvertsr = real(rvth);
159  Numeric rvertsi = imag(rvth);
160 
161  Numeric rverts = pow(rvertsr, 2) + pow(rvertsi, 2);
162 
163  //Numeric rhorzsr = real.rhth();
164  //Numeric rhorzsi = imag.rhth();
165  Numeric rhorzsr = real(rhth);
166  Numeric rhorzsi = imag(rhth);
167  Numeric rhorzs = pow(rhorzsr, 2) + pow(rhorzsi, 2);
168 
169  surface_emiss[0] = rverts;
170  surface_emiss[1] = rhorzs;
171  surface_emiss[2] = 0;
172  surface_emiss[3] = 0;
173 
174 
175 }
176 
177 
RAD2DEG
const Numeric RAD2DEG
exceptions.h
The declarations of all the exception classes.
matpackI.h
complex.h
A class implementing complex numbers for ARTS.
VectorView
The VectorView class.
Definition: matpackI.h:373
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
real
float real
Definition: continua.cc:12951
DEG2RAD
const Numeric DEG2RAD
PI
const Numeric PI
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:300
complex
Definition: continua.cc:12953
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:57