ARTS  2.2.66
surface.cc
Go to the documentation of this file.
1 /* Copyright (C) 2012
2  Patrick Eriksson <Patrick.Eriksson@chalmers.se>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License as published by the
6  Free Software Foundation; either version 2, or (at your option) any
7  later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17  USA. */
18 
19 
20 
21 
22 /*===========================================================================
23  === File description
24  ===========================================================================*/
25 
36 /*===========================================================================
37  === External declarations
38  ===========================================================================*/
39 
40 #include <cmath>
41 #include "auto_md.h"
42 #include "check_input.h"
43 #include "complex.h"
44 #include "geodetic.h"
45 #include "matpackI.h"
46 #include "math_funcs.h"
47 #include "physics_funcs.h"
48 #include "workspace_ng.h"
49 #include "surface.h"
50 
51 
52 
53 
54 
55 /*===========================================================================
56  === The functions (in alphabetical order)
57  ===========================================================================*/
58 
59 
61 
73  ConstVectorView rte_los,
74  ConstVectorView specular_los )
75 {
76  return ( 180-abs(rte_los[0]) + abs(specular_los[0]) ) / 2;
77 }
78 
79 
80 
82 
107  Workspace& ws,
108  MatrixView surface_rmatrix,
109  VectorView surface_emission,
110  const Complex& Rv,
111  const Complex& Rh,
112  const Numeric& f,
113  const Index& stokes_dim,
114  const Numeric& surface_skin_t,
115  const Agenda& blackbody_radiation_agenda )
116 {
117  assert( surface_rmatrix.nrows() == stokes_dim );
118  assert( surface_rmatrix.ncols() == stokes_dim );
119  assert( surface_emission.nelem() == stokes_dim );
120 
121  // Expressions are derived in the surface chapter in the user guide
122 
123  surface_rmatrix = 0.0;
124  surface_emission = 0.0;
125 
126  Vector B;
127  blackbody_radiation_agendaExecute( ws, B, surface_skin_t, Vector(1,f),
128  blackbody_radiation_agenda );
129 
130  const Numeric rv = pow( abs(Rv), 2.0 );
131  const Numeric rh = pow( abs(Rh), 2.0 );
132  const Numeric rmean = ( rv + rh ) / 2;
133 
134  surface_rmatrix(0,0) = rmean;
135  surface_emission[0] = B[0] * ( 1 - rmean );
136 
137  if( stokes_dim > 1 )
138  {
139  const Numeric rdiff = ( rv - rh ) / 2;
140 
141  surface_rmatrix(1,0) = rdiff;
142  surface_rmatrix(0,1) = rdiff;
143  surface_rmatrix(1,1) = rmean;
144  surface_emission[1] = -B[0] * rdiff;
145 
146  if( stokes_dim > 2 )
147  {
148  const Complex a = Rh * conj(Rv);
149  const Complex b = Rv * conj(Rh);
150  const Numeric c = real( a + b ) / 2.0;
151 
152  surface_rmatrix(2,2) = c;
153 
154  if( stokes_dim > 3 )
155  {
156  const Numeric d = imag( a - b ) / 2.0;
157 
158  surface_rmatrix(2,3) = d;
159  surface_rmatrix(3,2) = -d;
160  surface_rmatrix(3,3) = c;
161  }
162  }
163  }
164 }
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
The VectorView class.
Definition: matpackI.h:372
A class implementing complex numbers for ARTS.
The Agenda class.
Definition: agenda_class.h:44
The Vector class.
Definition: matpackI.h:556
The MatrixView class.
Definition: matpackI.h:679
Numeric calc_incang(ConstVectorView rte_los, ConstVectorView specular_los)
calc_incang
Definition: surface.cc:72
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:180
This file contains the declaration and partly the implementation of the workspace class...
Index ncols() const
Returns the number of columns.
Definition: matpackI.cc:838
std::complex< Numeric > Complex
Definition: complex.h:32
#define abs(x)
Definition: continua.cc:20458
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
void blackbody_radiation_agendaExecute(Workspace &ws, Vector &blackbody_radiation, const Numeric rtp_temperature, const Vector &f_grid, const Agenda &input_agenda)
Definition: auto_md.cc:13205
A constant view of a Vector.
Definition: matpackI.h:292
Workspace class.
Definition: workspace_ng.h:47
float real
Definition: continua.cc:20315
Index nrows() const
Returns the number of rows.
Definition: matpackI.cc:832
void surface_specular_R_and_b(Workspace &ws, MatrixView surface_rmatrix, VectorView surface_emission, const Complex &Rv, const Complex &Rh, const Numeric &f, const Index &stokes_dim, const Numeric &surface_skin_t, const Agenda &blackbody_radiation_agenda)
surface_specular_R_and_b
Definition: surface.cc:106