ARTS 2.5.4 (git: 31ce4f0e)
m_physics.cc
Go to the documentation of this file.
1/* Copyright (C) 2002-2012
2 Patrick Eriksson <Patrick.Eriksson@chalmers.se>
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
36/*===========================================================================
37 === External declarations
38 ===========================================================================*/
39
40#include "arts.h"
41#include "arts_constants.h"
42#include "auto_md.h"
43#include "check_input.h"
44#include "logic.h"
45#include "math_funcs.h"
46#include "messages.h"
47#include "physics_funcs.h"
48
51
52/*===========================================================================
53 === The functions (in alphabetical order)
54 ===========================================================================*/
55
56/* Workspace method: Doxygen documentation will be auto-generated */
57void MatrixCBR( // WS Output:
58 Matrix& m,
59 // WS Input:
60 const Index& stokes_dim,
61 // WS Generic Input:
62 const Vector& f,
63 const Verbosity&) {
64 const Index n = f.nelem();
65
66 if (n == 0) throw runtime_error("The given frequency vector is empty.");
67
68 m.resize(n, stokes_dim);
69 m = 0;
70
71 planck(m(joker, 0), f, COSMIC_BG_TEMP);
72}
73
74/* Workspace method: Doxygen documentation will be auto-generated */
75void MatrixPlanck( // WS Output:
76 Matrix& m,
77 // WS Input:
78 const Index& stokes_dim,
79 // WS Generic Input:
80 const Vector& f,
81 const Numeric& t,
82 const Verbosity& verbosity) {
84
85 const Index n = f.nelem();
86
87 if (n == 0) throw runtime_error("The given frequency vector is empty.");
88
89 out2 << " Setting blackbody radiation for a temperature of " << t << " K.\n";
90
91 m.resize(n, stokes_dim);
92 m = 0;
93
94 planck(m(joker, 0), f, t);
95}
96
97/* Workspace method: Doxygen documentation will be auto-generated */
98void MatrixUnitIntensity( // WS Output:
99 Matrix& m,
100 // WS Input:
101 const Index& stokes_dim,
102 // WS Generic Input:
103 const Vector& f,
104 const Verbosity& verbosity) {
106
107 const Index n = f.nelem();
108
109 if (n == 0) throw runtime_error("The given frequency vector is empty.");
110
111 out2 << " Setting unpolarised radiation with an intensity of 1.\n";
112
113 m.resize(n, stokes_dim);
114 m = 0;
115
116 for (Index i = 0; i < n; i++) {
117 m(i, 0) = 1.0;
118 }
119}
120
121/* Workspace method: Doxygen documentation will be auto-generated */
122void water_p_eq_fieldMK05(Tensor3& water_p_eq_field,
123 const Tensor3& t_field,
124 const Index& only_liquid,
125 const Verbosity&) {
126 const Index n1 = t_field.npages();
127 const Index n2 = t_field.nrows();
128 const Index n3 = t_field.ncols();
129
130 water_p_eq_field.resize(n1, n2, n3);
131
132 for (Index i = 0; i < n1; i++) {
133 for (Index j = 0; j < n2; j++) {
134 for (Index k = 0; k < n3; k++) {
135 const Numeric t = t_field(i, j, k);
136 if (t > TEMP_0_C || only_liquid) {
137 water_p_eq_field(i, j, k) =
138 exp(54.842763 - 6763.22 / t - 4.21 * log(t) + 0.000367 * t +
139 tanh(0.0415 * (t - 218.8)) *
140 (53.878 - 1331.22 / t - 9.44523 * log(t) + 0.014025 * t));
141 } else {
142 water_p_eq_field(i, j, k) =
143 exp(9.550426 - 5723.265 / t + 3.53068 * log(t) - 0.00728332 * t);
144 }
145 }
146 }
147 }
148}
The global header file for ARTS.
Constants of physical expressions as constexpr.
Index npages() const
Returns the number of pages.
Definition: matpackIII.h:140
Index nrows() const
Returns the number of rows.
Definition: matpackIII.h:143
Index ncols() const
Returns the number of columns.
Definition: matpackIII.h:146
Index nelem() const noexcept
Returns the number of elements.
Definition: matpackI.h:536
The Matrix class.
Definition: matpackI.h:1261
void resize(Index r, Index c)
Resize function.
Definition: matpackI.cc:1010
The Tensor3 class.
Definition: matpackIII.h:346
void resize(Index p, Index r, Index c)
Resize function.
Definition: matpackIII.cc:661
The Vector class.
Definition: matpackI.h:899
Header file for logic.cc.
void water_p_eq_fieldMK05(Tensor3 &water_p_eq_field, const Tensor3 &t_field, const Index &only_liquid, const Verbosity &)
WORKSPACE METHOD: water_p_eq_fieldMK05.
Definition: m_physics.cc:122
void MatrixPlanck(Matrix &m, const Index &stokes_dim, const Vector &f, const Numeric &t, const Verbosity &verbosity)
WORKSPACE METHOD: MatrixPlanck.
Definition: m_physics.cc:75
void MatrixUnitIntensity(Matrix &m, const Index &stokes_dim, const Vector &f, const Verbosity &verbosity)
WORKSPACE METHOD: MatrixUnitIntensity.
Definition: m_physics.cc:98
constexpr Numeric COSMIC_BG_TEMP
Definition: m_physics.cc:50
constexpr Numeric TEMP_0_C
Definition: m_physics.cc:49
void MatrixCBR(Matrix &m, const Index &stokes_dim, const Vector &f, const Verbosity &)
WORKSPACE METHOD: MatrixCBR.
Definition: m_physics.cc:57
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
const Joker joker
Declarations having to do with the four output streams.
#define CREATE_OUT2
Definition: messages.h:205
constexpr Numeric cosmic_microwave_background_temperature
Global constant, Planck temperature for cosmic background radiation [K].
constexpr Numeric k
Boltzmann constant convenience name [J/K].
constexpr Numeric temperature_at_0c
Global constant, Temperature in Celsius of 0 Kelvin.
Numeric planck(const Numeric &f, const Numeric &t)
planck
This file contains declerations of functions of physical character.