JURASSIC
planck.c
Go to the documentation of this file.
1/*
2 This file is part of JURASSIC.
3
4 JURASSIC is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 JURASSIC 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 JURASSIC. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright (C) 2003-2024 Forschungszentrum Juelich GmbH
18*/
19
25#include "jurassic.h"
26
27int main(
28 int argc,
29 char *argv[]) {
30
31 /* Check arguments... */
32 if (argc != 3 && argc != 7)
33 ERRMSG
34 ("Give parameters: [ <t> <nu> | <t0> <t1> <dt> <nu0> <nu1> <dnu> ]");
35
36 /* Calculate single value... */
37 if (argc == 3) {
38
39 /* Read arguments... */
40 double t = atof(argv[1]);
41 double nu = atof(argv[2]);
42
43 /* Compute Planck function... */
44 printf("%.10g\n", PLANCK(t, nu));
45 }
46
47 /* Calculate table... */
48 else if (argc == 7) {
49
50 /* Read arguments... */
51 double t0 = atof(argv[1]);
52 double t1 = atof(argv[2]);
53 double dt = atof(argv[3]);
54 double nu0 = atof(argv[4]);
55 double nu1 = atof(argv[5]);
56 double dnu = atof(argv[6]);
57
58 /* Write header... */
59 printf("# $1 = brightness temperature [K]\n"
60 "# $2 = wavenumber [cm^-1]\n"
61 "# $3 = radiance [W/(m^2 sr cm^-1)]\n");
62
63 /* Compute Planck function... */
64 for (double t = t0; t <= t1; t += dt) {
65 printf("\n");
66 for (double nu = nu0; nu <= nu1; nu += dnu)
67 printf("%.10g %.4f %.10g\n", t, nu, PLANCK(t, nu));
68 }
69 }
70
71 return EXIT_SUCCESS;
72}
JURASSIC library declarations.
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237
#define PLANCK(T, nu)
Compute Planck function.
Definition: jurassic.h:183
int main(int argc, char *argv[])
Definition: planck.c:27