MPTRAC
sedi.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-2024 Forschungszentrum Juelich GmbH
18*/
19
25#include "mptrac.h"
26
27int main(
28 int argc,
29 char *argv[]) {
30
31 /* Check arguments... */
32 if (argc < 5)
33 ERRMSG("Give parameters: <p> <T> <r_p> <rho_p>");
34
35 /* Read arguments... */
36 double p = atof(argv[1]);
37 double T = atof(argv[2]);
38 double r_p = atof(argv[3]);
39 double rho_p = atof(argv[4]);
40
41 /* Calculate sedimentation velocity... */
42 double vs = sedi(p, T, r_p, rho_p);
43
44 /* Density of dry air [kg / m^3]... */
45 double rho = 100. * p / (RA * T);
46
47 /* Dynamic viscosity of air [kg / (m s)]... */
48 double eta = 1.8325e-5 * (416.16 / (T + 120.)) * pow(T / 296.16, 1.5);
49
50 /* Particle Reynolds number... */
51 double Re = 2e-6 * r_p * vs * rho / eta;
52
53 /* Write output... */
54 printf(" p= %g hPa\n", p);
55 printf(" T= %g K\n", T);
56 printf(" r_p= %g microns\n", r_p);
57 printf("rho_p= %g kg/m^3\n", rho_p);
58 printf("rho_a= %g kg/m^3\n", RHO(p, T));
59 printf(" v_s= %g m/s\n", vs);
60 printf(" Re= %g\n", Re);
61
62 return EXIT_SUCCESS;
63}
double sedi(const double p, const double T, const double rp, const double rhop)
Calculates the sedimentation velocity of a particle in air.
Definition: mptrac.c:8015
MPTRAC library declarations.
#define RA
Specific gas constant of dry air [J/(kg K)].
Definition: mptrac.h:212
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: mptrac.h:1881
#define RHO(p, t)
Compute density of air.
Definition: mptrac.h:1415
int main(int argc, char *argv[])
Definition: sedi.c:27