21#include "matpack_complex.h"
24#include "matpack_data.h"
33Numeric
calc_incang(ConstVectorView rte_los, ConstVectorView specular_los) {
34 return (180 - abs(rte_los[0]) + abs(specular_los[0])) / 2;
38 ConstVectorView z_profile) {
40 while (z_surface >= z_profile[ip+1]) {
48 ConstMatrixView surface_los,
49 ConstTensor4View surface_rmatrix,
50 ConstMatrixView surface_emission) {
52 const Index nf = I.nrows();
53 const Index stokes_dim = I.ncols();
54 const Index nlos = surface_los.nrows();
56 iy = surface_emission;
60 for (Index ilos = 0; ilos < nlos; ilos++) {
61 Vector rtmp(stokes_dim);
63 for (Index iv = 0; iv < nf; iv++) {
64 mult(rtmp, surface_rmatrix(ilos, iv, joker, joker), I(ilos, iv, joker));
65 iy(iv, joker) += rtmp;
72 VectorView surface_emission,
76 const Index& stokes_dim,
77 const Numeric& surface_skin_t) {
80 ARTS_ASSERT(surface_emission.nelem() == stokes_dim);
84 surface_rmatrix = 0.0;
85 surface_emission = 0.0;
87 Numeric B =
planck(f, surface_skin_t);
89 const Numeric rv = pow(abs(Rv), 2.0);
90 const Numeric rh = pow(abs(Rh), 2.0);
91 const Numeric rmean = (rv + rh) / 2;
93 surface_rmatrix(0, 0) = rmean;
94 surface_emission[0] = B * (1 - rmean);
97 const Numeric rdiff = (rv - rh) / 2;
99 surface_rmatrix(1, 0) = rdiff;
100 surface_rmatrix(0, 1) = rdiff;
101 surface_rmatrix(1, 1) = rmean;
102 surface_emission[1] = -B * rdiff;
104 if (stokes_dim > 2) {
105 const Complex
a = Rh * conj(Rv);
106 const Complex
b = Rv * conj(Rh);
107 const Numeric
c = real(
a +
b) / 2.0;
109 surface_rmatrix(2, 2) =
c;
111 if (stokes_dim > 3) {
112 const Numeric
d = imag(
a -
b) / 2.0;
114 surface_rmatrix(2, 3) =
d;
115 surface_rmatrix(3, 2) = -
d;
116 surface_rmatrix(3, 3) =
c;
123 const Vector& lat_grid,
124 const Vector& lon_grid,
125 const Tensor3& surface_props_data,
129 "The number of pages in *surface_props_data* and "
130 "length of *surface_props_names* differ.");
132 if (surface_props_names.
nelem() == 0) {
136 (atmosphere_dim == 1 ? 1 : lat_grid.nelem()),
137 "Row-size of *surface_props_data* not as expected.");
139 (atmosphere_dim <= 2 ? 1 : lon_grid.nelem()),
140 "Column-size of *surface_props_data* not as expected.");
142 for (Index i = 0; i < surface_props_names.
nelem(); i++) {
144 "Element ", i,
" (0-based) of *surface_props_names* is empty.")
145 for (Index j = i + 1; j < surface_props_names.
nelem(); j++) {
147 "Two surface properties with same name found!\n"
148 "This found for these two properties\n"
151 " name: ", surface_props_names[i])
158 const Index& atmosphere_dim,
162 const Tensor3& surface_props_data,
167 for (Index i = 0; i < surface_props_names.
nelem(); i++) {
168 if (surface_props_names[i] == vname) {
171 surface_props_data(i, joker, joker),
180 "The following property was requested\n"
182 "but it could not be found in *surface_props_names*.")
187 const ArrayOfTensor4 dsurface_rmatrix_dx,
188 const ArrayOfMatrix& dsurface_emission_dx) {
189 const Index nq = dsurface_names.
nelem();
192 "The lengths of *dsurface_names* and *dsurface_rmatrix_dx* differ.");
194 "The lengths of *dsurface_names* and *dsurface_emission_dx* differ.");
196 for (Index i = 0; i < nq; i++) {
198 for (Index j = 0; j < surface_props_names.
nelem() && !found; j++) {
199 if (dsurface_names[i] == surface_props_names[j]) {
204 "String ", i,
" (0-based) of *dsurface_names* is \"",
205 dsurface_names[i],
"\"\n"
206 "but this string could not be found in *surface_props_names*.\n"
207 "This is likely due to incorrect choice of quantity when\n"
208 " calling *jacobianAddSurfaceQuantity*.")
216 Index& stars_visible,
217 Vector& specular_los,
218 const Vector& rtp_pos,
219 const Vector& rtp_los,
220 const Index& stokes_dim,
221 const Vector& f_grid,
222 const Index& atmosphere_dim,
223 const Vector& p_grid,
224 const Vector& lat_grid,
225 const Vector& lon_grid,
226 const Tensor3& z_field,
227 const Tensor3& t_field,
229 const Tensor4& vmr_field,
231 const Tensor3& wind_u_field,
232 const Tensor3& wind_v_field,
233 const Tensor3& wind_w_field,
234 const Tensor3& mag_u_field,
235 const Tensor3& mag_v_field,
236 const Tensor3& mag_w_field,
237 const Matrix& z_surface,
238 const Vector& refellipsoid,
239 const Tensor4& pnd_field,
240 const ArrayOfTensor4& dpnd_field_dx,
243 const Numeric& ppath_lmax,
244 const Numeric& ppath_lraytrace,
245 const Index& ppath_inside_cloudbox_do,
246 const Index& cloudbox_on,
248 const Index& gas_scattering_do,
249 const Index& jacobian_do,
252 const Numeric& rte_alonglos_v,
253 const Agenda& propmat_clearsky_agenda,
254 const Agenda& water_p_eq_agenda,
255 const Agenda& gas_scattering_agenda,
256 const Agenda& ppath_step_agenda,
260 Vector surface_normal;
295 ppath_inside_cloudbox_do,
315 ArrayOfMatrix iy_aux_dummy;
317 Vector ppvar_p_dummy;
318 Vector ppvar_t_dummy;
320 Matrix ppvar_vmr_dummy;
321 Matrix ppvar_wind_dummy;
322 Matrix ppvar_mag_dummy;
323 Matrix ppvar_pnd_dummy;
324 Matrix ppvar_f_dummy;
325 Tensor3 ppvar_iy_dummy;
326 Tensor4 ppvar_trans_cumulat_dummy;
327 Tensor4 ppvar_trans_partial_dummy;
328 ArrayOfTensor3 diy_incoming_dummy;
344 ppvar_trans_cumulat_dummy,
345 ppvar_trans_partial_dummy,
372 propmat_clearsky_agenda,
374 gas_scattering_agenda,
381 iy_incoming.resize(f_grid.nelem(),stokes_dim);
Index nelem() const ARTS_NOEXCEPT
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR(...)
#define ARTS_USER_ERROR_IF(condition,...)
void specular_losCalc(Vector &specular_los, Vector &surface_normal, const Vector &rtp_pos, const Vector &rtp_los, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &refellipsoid, const Matrix &z_surface, const Index &ignore_surface_slope, const Verbosity &verbosity)
WORKSPACE METHOD: specular_losCalc.
void iyTransmissionStandard(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, ArrayOfTensor3 &diy_dx, Vector &ppvar_p, Vector &ppvar_t, EnergyLevelMap &ppvar_nlte, Matrix &ppvar_vmr, Matrix &ppvar_wind, Matrix &ppvar_mag, Matrix &ppvar_pnd, Matrix &ppvar_f, Tensor3 &ppvar_iy, Tensor4 &ppvar_trans_cumulat, Tensor4 &ppvar_trans_partial, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &gas_scattering_do, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, const Matrix &iy_transmitter, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmittance, const Numeric &rte_alonglos_v, const Verbosity &)
WORKSPACE METHOD: iyTransmissionStandard.
Numeric planck(const Numeric &f, const Numeric &t)
planck
This file contains declerations of functions of physical character.
void ppath_calc(Workspace &ws, Ppath &ppath, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &f_grid, const Vector &refellipsoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &rte_pos, const Vector &rte_los, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const bool &ppath_inside_cloudbox_do, const Verbosity &verbosity)
This is the core for the WSM ppathStepByStep.
void interp_atmsurface_by_itw(VectorView x, const Index &atmosphere_dim, ConstMatrixView x_surface, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
Interpolates a surface-type variable with pre-calculated weights by interp_atmsurface_gp2itw.
The structure to describe a propagation path and releated quantities.
void get_sun_background(Matrix &iy, Index &suns_visible, const ArrayOfSun &suns, const Ppath &ppath, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &refellipsoid)
Gets the sun background for a given ppath.
void surface_get_incoming_direct(Workspace &ws, Matrix &iy_incoming, Index &stars_visible, Vector &specular_los, const Vector &rtp_pos, const Vector &rtp_los, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Matrix &z_surface, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &ppath_inside_cloudbox_do, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &gas_scattering_do, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfSun &suns, const Numeric &rte_alonglos_v, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
Calculate the incoming direct radiation at the surface for a given line of sight.
void dsurface_check(const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const ArrayOfTensor4 dsurface_rmatrix_dx, const ArrayOfMatrix &dsurface_emission_dx)
Peforms basic checks of the dsurface variables.
void surface_calc(Matrix &iy, ConstTensor3View I, ConstMatrixView surface_los, ConstTensor4View surface_rmatrix, ConstMatrixView surface_emission)
Weights together downwelling radiation and surface emission.
void surface_props_check(const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names)
Peforms basic checks of surface_props_data and surface_props_names
Numeric calc_incang(ConstVectorView rte_los, ConstVectorView specular_los)
Calculates the incidence angle for a flat surface, based on rte_los and specular_los.
void surface_props_interp(Vector &v, const String &vname, const Index &atmosphere_dim, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, const Matrix &itw, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names)
Peforms an interpolation of surface_props_data
Index index_of_zsurface(const Numeric &z_surface, ConstVectorView z_profile)
Lccates the surface with respect to pressure levels.
void surface_specular_R_and_b(MatrixView surface_rmatrix, VectorView surface_emission, const Complex &Rv, const Complex &Rh, const Numeric &f, const Index &stokes_dim, const Numeric &surface_skin_t)
Sets up the surface reflection matrix and emission vector for the case of specular reflection.
This file contains the Workspace class.