670 const Index& stokes_dim,
672 const Index& atmosphere_dim,
684 const Index& cloudbox_on,
691 const Index& jacobian_do,
694 const Agenda& propmat_clearsky_agenda,
695 const Agenda& water_p_eq_agenda,
696 const Agenda& iy_transmitter_agenda,
697 const Index& iy_agenda_call1,
698 const Tensor3& iy_transmittance,
702 const Index j_analytical_do = jacobian_do ? do_analytical_jacobian<1>(jacobian_quantities) : 0;
708 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
715 if (!iy_agenda_call1)
717 "Recursive usage not possible (iy_agenda_call1 must be 1)");
718 if (!iy_transmittance.
empty())
719 throw runtime_error(
"*iy_transmittance* must be empty");
720 if (rbi < 1 || rbi > 9)
722 "ppath.background is invalid. Check your "
723 "calculation of *ppath*?");
725 if (dpnd_field_dx.
nelem() != jacobian_quantities.
nelem())
727 "*dpnd_field_dx* not properly initialized:\n"
728 "Number of elements in dpnd_field_dx must be equal number of jacobian"
729 " quantities.\n(Note: jacobians have to be defined BEFORE *pnd_field*"
730 " is calculated/set.");
738 ppath.
pos(np - 1,
Range(0, atmosphere_dim)),
740 iy_transmitter_agenda);
743 os <<
"The size of *iy* returned from *iy_transmitter_agenda* is\n"
745 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n"
746 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols() <<
"]\n";
747 throw runtime_error(os.str());
766 Index auxOptDepth = -1;
768 for (
Index i = 0; i < naux; i++) {
769 iy_aux[i].resize(nf,
ns);
772 if (iy_aux_vars[i] ==
"Radiative background")
774 else if (iy_aux_vars[i] ==
"Optical depth")
778 os <<
"The only allowed strings in *iy_aux_vars* are:\n"
779 <<
" \"Radiative background\"\n"
780 <<
" \"Optical depth\"\n"
781 <<
"but you have selected: \"" << iy_aux_vars[i] <<
"\"";
782 throw runtime_error(os.str());
803 if (np == 1 && rbi == 1) {
812 ppvar_trans_cumulat = 0;
813 ppvar_trans_partial = 0;
814 for (
Index iv = 0; iv < nf; iv++) {
815 for (
Index is = 0; is <
ns; is++) {
816 ppvar_trans_cumulat(0,iv,is,is) = 1;
817 ppvar_trans_partial(0,iv,is,is) = 1;
847 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
862 clear2cloudy.resize(np);
863 for (
Index ip = 0; ip < np; ip++) clear2cloudy[ip] = -1;
876 Index temperature_derivative_position = -1;
879 if (j_analytical_do) {
888 temperature_derivative_position = iq;
889 do_hse = jacobian_quantities[iq].Subtag() ==
895 for (
Index ip = 0; ip < np; ip++) {
902 propmat_clearsky_agenda,
905 ppvar_mag(
joker, ip),
908 ppvar_vmr(
joker, ip),
913 if (j_analytical_do) {
924 if (clear2cloudy[ip] + 1) {
935 ppvar_t[
Range(ip, 1)],
940 if (j_analytical_do) {
948 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
950 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
961 temperature_derivative_position);
964 swap(K_past, K_this);
965 swap(dK_past_dx, dK_this_dx);
973 if (auxOptDepth >= 0) {
974 for (
Index iv = 0; iv < nf; iv++)
975 iy_aux[auxOptDepth](iv, 0) = -std::log(tot_tra[np - 1](iv, 0, 0));
978 lvl_rad[np - 1] = iy;
981 for (
Index ip = np - 2; ip >= 0; ip--) {
982 lvl_rad[ip] = lvl_rad[ip + 1];
992 dlyr_tra_above[ip + 1],
993 dlyr_tra_below[ip + 1],
1010 for (
Index ip = 0; ip < lvl_rad.
nelem(); ip++) {
1014 if (j_analytical_do)
1021 if (j_analytical_do) {
1036 jacobian_quantities,
1043 const Index& stokes_dim,
1049 if (instrument_pol.
nelem() != nf)
1050 throw runtime_error(
1051 "The length of *f_grid* and the number of elements "
1052 "in *instrument_pol* must be equal.");
1054 iy.
resize(nf, stokes_dim);
1056 for (
Index i = 0; i < nf; i++) {
1063 const Index& stokes_dim,
1069 if (instrument_pol.
nelem() != 1)
1070 throw runtime_error(
1071 "The number of elements in *instrument_pol* must be 1.");
1073 iy.
resize(nf, stokes_dim);
1077 for (
Index i = 1; i < nf; i++) {
Array< Index > ArrayOfIndex
An array of Index.
Array< Tensor3 > ArrayOfTensor3
An array of Tensor3.
The global header file for ARTS.
void iy_transmitter_agendaExecute(Workspace &ws, Matrix &iy, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Agenda &input_agenda)
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Index nrows() const noexcept
Index ncols() const noexcept
bool empty() const noexcept
Index nelem() const noexcept
Returns the number of elements.
void resize(Index r, Index c)
Resize function.
Stokes vector is as Propagation matrix but only has 4 possible values.
void resize(Index p, Index r, Index c)
Resize function.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void resize(Index n)
Resize function.
ArrayOfIndex get_pointers_for_analytical_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species)
Help function for analytical jacobian calculations.
ArrayOfTensor3 get_standard_starting_diy_dx(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
ArrayOfTensor3 get_standard_diy_dpath(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
ArrayOfIndex get_pointers_for_scat_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfString &scat_species, const bool cloudbox_on)
Help function for analytical jacobian calculations.
Routines for setting up the jacobian.
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Linear algebra functions.
Header file for logic.cc.
void iy_transmitterSinglePol(Matrix &iy, const Index &stokes_dim, const Vector &f_grid, const ArrayOfIndex &instrument_pol, const Verbosity &)
WORKSPACE METHOD: iy_transmitterSinglePol.
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 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 Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &iy_transmitter_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmittance, const Numeric &rte_alonglos_v, const Verbosity &)
WORKSPACE METHOD: iyTransmissionStandard.
const Numeric SPEED_OF_LIGHT
void iy_transmitterMultiplePol(Matrix &iy, const Index &stokes_dim, const Vector &f_grid, const ArrayOfIndex &instrument_pol, const Verbosity &)
WORKSPACE METHOD: iy_transmitterMultiplePol.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
Declarations having to do with the four output streams.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
Index ppath_what_background(const Ppath &ppath)
Returns the case number for the radiative background.
Array< PropagationMatrix > ArrayOfPropagationMatrix
void get_stepwise_scattersky_propmat(StokesVector &ap, PropagationMatrix &Kp, ArrayOfStokesVector &dap_dx, ArrayOfPropagationMatrix &dKp_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ConstMatrixView &ppath_1p_pnd, const ArrayOfMatrix &ppath_dpnd_dx, const Index ppath_1p_id, const ArrayOfArrayOfSingleScatteringData &scat_data, const ConstVectorView &ppath_line_of_sight, const ConstVectorView &ppath_temperature, const Index &atmosphere_dim, const bool &jacobian_do)
Computes the contribution by scattering at propagation path point.
void get_stepwise_clearsky_propmat(Workspace &ws, PropagationMatrix &K, StokesVector &S, Index <e, ArrayOfPropagationMatrix &dK_dx, ArrayOfStokesVector &dS_dx, const Agenda &propmat_clearsky_agenda, const ArrayOfRetrievalQuantity &jacobian_quantities, const ConstVectorView &ppath_f_grid, const ConstVectorView &ppath_magnetic_field, const ConstVectorView &ppath_line_of_sight, const EnergyLevelMap &ppath_nlte, const ConstVectorView &ppath_vmrs, const Numeric &ppath_temperature, const Numeric &ppath_pressure, const bool &jacobian_do)
Gets the clearsky propgation matrix and NLTE contributions.
void get_ppath_atmvars(Vector &ppath_p, Vector &ppath_t, EnergyLevelMap &ppath_nlte, Matrix &ppath_vmr, Matrix &ppath_wind, Matrix &ppath_mag, const Ppath &ppath, const Index &atmosphere_dim, const ConstVectorView &p_grid, const ConstTensor3View &t_field, const EnergyLevelMap &nlte_field, const ConstTensor4View &vmr_field, const ConstTensor3View &wind_u_field, const ConstTensor3View &wind_v_field, const ConstTensor3View &wind_w_field, const ConstTensor3View &mag_u_field, const ConstTensor3View &mag_v_field, const ConstTensor3View &mag_w_field)
Determines pressure, temperature, VMR, winds and magnetic field for each propgataion path point.
void get_ppath_f(Matrix &ppath_f, const Ppath &ppath, const ConstVectorView &f_grid, const Index &atmosphere_dim, const Numeric &rte_alonglos_v, const ConstMatrixView &ppath_wind)
Determines the Doppler shifted frequencies along the propagation path.
void rtmethods_jacobian_finalisation(Workspace &ws, ArrayOfTensor3 &diy_dx, ArrayOfTensor3 &diy_dpath, const Index &ns, const Index &nf, const Index &np, const Index &atmosphere_dim, const Ppath &ppath, const Vector &ppvar_p, const Vector &ppvar_t, const Matrix &ppvar_vmr, const Index &iy_agenda_call1, const Tensor3 &iy_transmittance, const Agenda &water_p_eq_agenda, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfIndex &jac_species_i)
This function fixes the last steps to made on the Jacobian in some radiative transfer WSMs.
void adapt_stepwise_partial_derivatives(ArrayOfPropagationMatrix &dK_dx, ArrayOfStokesVector &dS_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ConstVectorView &ppath_f_grid, const ConstVectorView &ppath_line_of_sight, const Index <e, const Index &atmosphere_dim, const bool &jacobian_do)
Adapts clearsky partial derivatives.
void get_ppath_cloudvars(ArrayOfIndex &clear2cloudy, Matrix &ppath_pnd, ArrayOfMatrix &ppath_dpnd_dx, const Ppath &ppath, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx)
Determines the particle fields along a propagation path.
Declaration of functions in rte.cc.
void stokes2pol(VectorView w, const Index &stokes_dim, const Index &ipol_1based, const Numeric nv)
stokes2pol
Sensor modelling functions.
The structure to describe a propagation path and releated quantities.
Matrix los
Line-of-sight at each ppath point.
Index np
Number of points describing the ppath.
Matrix pos
The distance between start pos and the last position in pos.
Vector lstep
The length between ppath points.
Radiation Vector for Stokes dimension 1-4.
Class to keep track of Transmission Matrices for Stokes Dim 1-4.
ArrayOfTransmissionMatrix cumulative_transmission(const ArrayOfTransmissionMatrix &T, const CumulativeTransmission type)
Accumulate the transmission matrix over all layers.
void update_radiation_vector(RadiationVector &I, ArrayOfRadiationVector &dI1, ArrayOfRadiationVector &dI2, const RadiationVector &J1, const RadiationVector &J2, const ArrayOfRadiationVector &dJ1, const ArrayOfRadiationVector &dJ2, const TransmissionMatrix &T, const TransmissionMatrix &PiT, const ArrayOfTransmissionMatrix &dT1, const ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric r, const Vector &dr1, const Vector &dr2, const Index ia, const Index iz, const RadiativeTransferSolver solver)
Update the Radiation Vector.
void stepwise_transmission(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dtemp1, const Numeric &dr_dtemp2, const Index temp_deriv_pos)
Set the stepwise transmission matrix.
Array< RadiationVector > ArrayOfRadiationVector
Array< TransmissionMatrix > ArrayOfTransmissionMatrix