The BioCro C++ Library
rasmussen_specific_heat.cpp
Go to the documentation of this file.
2#include "../framework/constants.h" // For conversion_constants
3
4using conversion_constants::celsius_to_kelvin;
5using conversion_constants::joules_per_calorie;
7
9 double air_temperature, // K
10 double mole_fraction_h2o // dimensionless
11)
12{
13 // Define conversion factors uesd to convert the original units to coherent
14 // SI units
15 double constexpr g_per_kg = 1e3; // g / kg
16 double constexpr cf = g_per_kg * joules_per_calorie; // J * g / (cal / kg)
17
18 // Define coefficients for the heat capacity equation
19 double constexpr a0 = +2.51625e-01 * cf; // J / kg / K
20 double constexpr a1 = -9.25250e-05 * cf; // J / kg / K
21 double constexpr a2 = +2.13340e-07 * cf; // J / kg / K
22 double constexpr a3 = -1.00430e-10 * cf; // J / kg / K
23 double constexpr a4 = +1.24770e-01 * cf; // J / kg / K
24 double constexpr a5 = -2.28300e-05 * cf; // J / kg / K
25 double constexpr a6 = +1.26700e-07 * cf; // J / kg / K
26 double constexpr a7 = +1.11600e-02 * cf; // J / kg / K
27 double constexpr a8 = +4.61000e-06 * cf; // J / kg / K
28 double constexpr a9 = +1.74000e-08 * cf; // J / kg / K
29
30 // Calculate the specific heat capacity at constant pressure
31
32 double const b_0 = a0 +
33 a1 * air_temperature +
34 a2 * pow(air_temperature, 2) +
35 a3 * pow(air_temperature, 3);
36
37 double const b_1 = a4 +
38 a5 * air_temperature +
39 a6 * pow(air_temperature, 2);
40
41 double const b_2 = a7 +
42 a8 * air_temperature +
43 a9 * pow(air_temperature, 2);
44
45 return b_0 +
46 b_1 * mole_fraction_h2o +
47 b_2 * pow(mole_fraction_h2o, 2); // J / kg / K
48}
49
50string_vector rasmussen_specific_heat::get_inputs()
51{
52 return {
53 "temp", // degrees C
54 "mole_fraction_h2o_atmosphere" // dimensionless
55 };
56}
57
59{
60 return {
61 "specific_heat_of_air" // J / kg / K
62 };
63}
64
65void rasmussen_specific_heat::do_operation() const
66{
67 // Convert temperature to Kelvin. (Note: this step will be unnecessary once
68 // inputs have been standardized to coherent SI units and air temperature is
69 // always given in Kelvin)
70 double const air_temperature_kelvin = temp + celsius_to_kelvin; // K
71
72 // Update the output quantity list
73 update(specific_heat_of_air_op,
75 air_temperature_kelvin,
76 mole_fraction_h2o_atmosphere)); // J / kg / K
77}
Determines the specific heat capacity of atmospheric air at constant pressure using the rasmussen_spe...
double rasmussen_specific_heat_of_air(double air_temperature, double mole_fraction_h2o)
Calculates the specific heat capacity of air at contant pressure from its temperature and moisture co...