MPTRAC
tnat.c
Go to the documentation of this file.
1/*
2 This file is part of MPTRAC.
3
4 MPTRAC 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 MPTRAC 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 MPTRAC. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright (C) 2013-2026 Forschungszentrum Juelich GmbH
18*/
19
25#include "mptrac.h"
26
27/* ------------------------------------------------------------
28 Functions...
29 ------------------------------------------------------------ */
30
32void usage(
33 void);
34
35/* ------------------------------------------------------------
36 Main...
37 ------------------------------------------------------------ */
38
39int main(
40 int argc,
41 char *argv[]) {
42
43 /* Print usage information... */
44 USAGE;
45
46 /* Check arguments... */
47 if (argc < 3)
48 ERRMSG("Missing or invalid command-line arguments.\n\n"
49 "Usage: tnat <p> <h2o> <hno3>\n\n" "Use -h for full help.");
50
51 /* Get varibles... */
52 const double p = atof(argv[1]);
53 const double h2o = atof(argv[2]);
54 const double hno3 = atof(argv[3]);
55
56 /* Write output... */
57 printf(" p= %g hPa\n", p);
58 printf(" q_H2O= %g ppv\n", h2o);
59 printf("q_HNO3= %g ppv\n", hno3);
60 printf(" T_dew= %g K\n", TDEW(p, h2o));
61 printf(" T_ice= %g K\n", TICE(p, h2o));
62 printf(" T_NAT= %g K\n", nat_temperature(p, h2o, hno3));
63
64 return EXIT_SUCCESS;
65}
66
67/*****************************************************************************/
68
70void usage(
71 void) {
72
73 printf("\nMPTRAC tnat tool.\n\n");
74 printf("Calculate PSC formation temperatures.\n");
75 printf("\n");
76 printf("Usage:\n");
77 printf(" tnat <p> <h2o> <hno3>\n");
78 printf("\n");
79 printf("Arguments:\n");
80 printf(" <p> Pressure [hPa].\n");
81 printf(" <h2o> Water vapor volume mixing ratio [ppv].\n");
82 printf(" <hno3> Nitric acid volume mixing ratio [ppv].\n");
83 printf("\nFurther information:\n");
84 printf(" Manual: https://slcs-jsc.github.io/mptrac/\n");
85}
double nat_temperature(const double p, const double h2o, const double hno3)
Calculates the nitric acid trihydrate (NAT) temperature.
Definition: mptrac.c:6721
MPTRAC library declarations.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: mptrac.h:2102
#define USAGE
Print usage information on -h or --help.
Definition: mptrac.h:1909
#define TICE(p, h2o)
Calculate frost point temperature (WMO, 2018).
Definition: mptrac.h:1796
#define TDEW(p, h2o)
Calculate dew point temperature.
Definition: mptrac.h:1771
int main(int argc, char *argv[])
Definition: tnat.c:39
void usage(void)
Print command-line help.
Definition: tnat.c:70