JURASSIC
climatology.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-2025 Forschungszentrum Juelich GmbH
18*/
19
25#include "jurassic.h"
26
27int main(
28 int argc,
29 char *argv[]) {
30
31 static atm_t atm;
32 static ctl_t ctl;
33
34 double clk[NCL], sfeps[NSF];
35
36 /* Check arguments... */
37 if (argc < 3)
38 ERRMSG("Give parameters: <ctl> <atm>");
39
40 /* Read control parameters... */
41 read_ctl(argc, argv, &ctl);
42 const double t0 = scan_ctl(argc, argv, "T0", -1, "0", NULL);
43 const double t1 = scan_ctl(argc, argv, "T1", -1, "0", NULL);
44 const double dt = scan_ctl(argc, argv, "DT", -1, "1", NULL);
45 const double z0 = scan_ctl(argc, argv, "Z0", -1, "0", NULL);
46 const double z1 = scan_ctl(argc, argv, "Z1", -1, "90", NULL);
47 const double dz = scan_ctl(argc, argv, "DZ", -1, "1", NULL);
48 const double clz = scan_ctl(argc, argv, "CLZ", -1, "0", NULL);
49 const double cldz = scan_ctl(argc, argv, "CLDZ", -1, "0", NULL);
50 for (int icl = 0; icl < ctl.ncl; icl++)
51 clk[icl] = scan_ctl(argc, argv, "CLK", icl, "0", NULL);
52 const double sft = scan_ctl(argc, argv, "SFT", -1, "0", NULL);
53 for (int isf = 0; isf < ctl.nsf; isf++)
54 sfeps[isf] = scan_ctl(argc, argv, "SFEPS", isf, "1", NULL);
55
56 /* Set atmospheric grid... */
57 for (double t = t0; t <= t1; t += dt)
58 for (double z = z0; z <= z1; z += dz) {
59 atm.time[atm.np] = t;
60 atm.z[atm.np] = z;
61 if ((++atm.np) >= NP)
62 ERRMSG("Too many atmospheric grid points!");
63 }
64
65 /* Interpolate climatological data... */
66 climatology(&ctl, &atm);
67
68 /* Set cloud layer... */
69 atm.clz = clz;
70 atm.cldz = cldz;
71 for (int icl = 0; icl < ctl.ncl; icl++)
72 atm.clk[icl] = clk[icl];
73
74 /* Set surface layer... */
75 atm.sft = sft;
76 for (int isf = 0; isf < ctl.nsf; isf++)
77 atm.sfeps[isf] = sfeps[isf];
78
79 /* Write data to disk... */
80 write_atm(NULL, argv[2], &ctl, &atm);
81
82 return EXIT_SUCCESS;
83}
int main(int argc, char *argv[])
Definition: climatology.c:27
void write_atm(const char *dirname, const char *filename, const ctl_t *ctl, const atm_t *atm)
Write atmospheric profile data to a text file.
Definition: jurassic.c:6075
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
Definition: jurassic.c:4889
double scan_ctl(int argc, char *argv[], const char *varname, const int arridx, const char *defvalue, char *value)
Scan control file or command-line arguments for a configuration variable.
Definition: jurassic.c:5738
void climatology(const ctl_t *ctl, atm_t *atm)
Initializes atmospheric climatology profiles.
Definition: jurassic.c:200
JURASSIC library declarations.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: jurassic.h:948
#define NP
Maximum number of atmospheric data points.
Definition: jurassic.h:247
#define NSF
Maximum number of surface layer spectral grid points.
Definition: jurassic.h:257
#define NCL
Maximum number of cloud layer spectral grid points.
Definition: jurassic.h:232
Atmospheric profile data.
Definition: jurassic.h:998
double time[NP]
Time (seconds since 2000-01-01T00:00Z).
Definition: jurassic.h:1004
double sfeps[NSF]
Surface emissivity.
Definition: jurassic.h:1040
double clz
Cloud layer height [km].
Definition: jurassic.h:1028
int np
Number of data points.
Definition: jurassic.h:1001
double cldz
Cloud layer depth [km].
Definition: jurassic.h:1031
double sft
Surface temperature [K].
Definition: jurassic.h:1037
double z[NP]
Altitude [km].
Definition: jurassic.h:1007
double clk[NCL]
Cloud layer extinction [km^-1].
Definition: jurassic.h:1034
Control parameters.
Definition: jurassic.h:1051
int ncl
Number of cloud layer spectral grid points.
Definition: jurassic.h:1084
int nsf
Number of surface layer spectral grid points.
Definition: jurassic.h:1090