-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7d3711
commit 1d87a0d
Showing
19 changed files
with
146 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[requires] | ||
catch2/3.6.0 | ||
mp-units/0.8.0 | ||
mp-units/2.2.0@mpusz/testing | ||
|
||
[options] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
#include "air.hpp" | ||
|
||
#include <units/isq/si/heat_capacity.h> | ||
|
||
#include <units/math.h> | ||
#include <mp-units/math.h> | ||
|
||
namespace ra { | ||
auto densityOfAir(si::thermodynamic_temperature<si::kelvin> temp, si::pressure<si::pascal> pressure) noexcept | ||
-> si::density<si::kilogram_per_metre_cub> | ||
auto densityOfAir( | ||
quantity<isq::thermodynamic_temperature[si::kelvin]> temp, | ||
quantity<isq::pressure[si::pascal]> pressure | ||
) noexcept -> quantity<isq::density[si::kilogram / cubic(si::metre)]> | ||
{ | ||
static constexpr auto GasConstant = si::specific_heat_capacity<si::joule_per_kilogram_kelvin>{287.05}; | ||
using namespace mp_units::si::unit_symbols; | ||
|
||
static constexpr auto GasConstant = 287.05 * J / (kg * K); | ||
return pressure / (GasConstant * temp); | ||
} | ||
|
||
auto soundVelocity(si::thermodynamic_temperature<si::kelvin> temp) noexcept -> si::speed<si::metre_per_second> | ||
auto soundVelocity(quantity<isq::thermodynamic_temperature[si::kelvin]> temp | ||
) noexcept -> quantity<isq::speed[si::metre / si::second]> | ||
{ | ||
using namespace mp_units::si::unit_symbols; | ||
|
||
static constexpr auto SpecificHeatRatio = 1.402; | ||
static constexpr auto DensityAtZeroC = si::density<si::kilogram_per_metre_cub>{1.293}; | ||
return sqrt((SpecificHeatRatio * OneAtmosphere<double>) / DensityAtZeroC) | ||
* sqrt(temp / si::thermodynamic_temperature<si::kelvin>{273.15}); | ||
static constexpr auto DensityAtZeroC = 1.293 * si::kilogram / cubic(si::metre); | ||
return sqrt((SpecificHeatRatio * OneAtmosphere<double>) / DensityAtZeroC) * sqrt(temp / (273.15 * si::kelvin)); | ||
} | ||
|
||
auto impedanceOfAir(si::thermodynamic_temperature<si::kelvin> temp, si::pressure<si::pascal> pressure) noexcept | ||
-> double | ||
auto impedanceOfAir( | ||
quantity<isq::thermodynamic_temperature[si::kelvin]> temp, | ||
quantity<isq::pressure[si::pascal]> pressure | ||
) noexcept -> double | ||
{ | ||
using namespace mp_units::si::unit_symbols; | ||
auto const i = soundVelocity(temp) * densityOfAir(temp, pressure); | ||
return i.number(); | ||
return i.numerical_value_in((m / s) * (kg / m3)); | ||
} | ||
|
||
} // namespace ra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.