MPTRAC
Functions
sedi.c File Reference

Calculate sedimentation velocity. More...

#include "mptrac.h"

Go to the source code of this file.

Functions

void usage (void)
 Print command-line help. More...
 
int main (int argc, char *argv[])
 

Detailed Description

Calculate sedimentation velocity.

Definition in file sedi.c.

Function Documentation

◆ usage()

void usage ( void  )

Print command-line help.

Definition at line 84 of file sedi.c.

85 {
86
87 printf("\nMPTRAC sedi tool.\n\n");
88 printf
89 ("Calculate sedimentation velocity for aerosol or cloud particles.\n");
90 printf("\n");
91 printf("Usage:\n");
92 printf(" sedi <p> <T> <r_p> <rho_p>\n");
93 printf("\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");
101}

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 39 of file sedi.c.

41 {
42
43 /* Print usage information... */
44 USAGE;
45
46 /* Check arguments... */
47 if (argc < 5)
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.");
50
51 /* Read arguments... */
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]);
56
57 /* Calculate sedimentation velocity... */
58 const double vs = sedi(p, T, r_p, rho_p);
59
60 /* Density of dry air [kg / m^3]... */
61 const double rho = 100. * p / (RA * T);
62
63 /* Dynamic viscosity of air [kg / (m s)]... */
64 const double eta = 1.8325e-5 * (416.16 / (T + 120.)) * pow(T / 296.16, 1.5);
65
66 /* Particle Reynolds number... */
67 const double Re = 2e-6 * r_p * vs * rho / eta;
68
69 /* Write output... */
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);
77
78 return EXIT_SUCCESS;
79}
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:10817
#define RA
Specific gas constant of dry air [J/(kg K)].
Definition: mptrac.h:306
#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 RHO(p, t)
Compute density of air.
Definition: mptrac.h:1657
Here is the call graph for this function: