48 ERRMSG(
"Missing or invalid command-line arguments.\n\n"
49 "Usage: sedi <p> <T> <r_p> <rho_p>\n\n" "Use -h for full help.");
52 const double p = atof(argv[1]);
53 const double T = atof(argv[2]);
54 const double r_p = atof(argv[3]);
55 const double rho_p = atof(argv[4]);
58 const double vs =
sedi(p, T, r_p, rho_p);
61 const double rho = 100. * p / (
RA * T);
64 const double eta = 1.8325e-5 * (416.16 / (T + 120.)) * pow(T / 296.16, 1.5);
67 const double Re = 2e-6 * r_p * vs * rho / eta;
70 printf(
" p= %g hPa\n", p);
71 printf(
" T= %g K\n", T);
72 printf(
" r_p= %g microns\n", r_p);
73 printf(
"rho_p= %g kg/m^3\n", rho_p);
74 printf(
"rho_a= %g kg/m^3\n",
RHO(p, T));
75 printf(
" v_s= %g m/s\n", vs);
76 printf(
" Re= %g\n", Re);
87 printf(
"\nMPTRAC sedi tool.\n\n");
89 (
"Calculate sedimentation velocity for aerosol or cloud particles.\n");
92 printf(
" sedi <p> <T> <r_p> <rho_p>\n");
94 printf(
"Arguments:\n");
95 printf(
" <p> Pressure [hPa].\n");
96 printf(
" <T> Temperature [K].\n");
97 printf(
" <r_p> Particle radius [um].\n");
98 printf(
" <rho_p> Particle density [kg/m3].\n");
99 printf(
"\nFurther information:\n");
100 printf(
" Manual: https://slcs-jsc.github.io/mptrac/\n");
double sedi(const double p, const double T, const double rp, const double rhop)
Calculates the sedimentation velocity of a particle in air.
MPTRAC library declarations.
#define RA
Specific gas constant of dry air [J/(kg K)].
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.
#define RHO(p, t)
Compute density of air.
int main(int argc, char *argv[])
void usage(void)
Print command-line help.