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