Files
MeanField/extension_example/demo.cpp
2026-09-06 10:15:00 -04:00

44 lines
1.4 KiB
C++

#include <iomanip>
#include <iostream>
import mean_field;
import mean_field_extension_example.rotating_stellar_model;
int main() {
using namespace mean_field;
using namespace mean_field::extension_example;
const IdealGasRadiation equationOfState({
.meanMolecularWeight = 0.61,
.boltzmannConstant = 1.380649e-16,
.atomicMassUnit = 1.66053906660e-24,
.radiationConstant = 7.5657e-15
});
const dimensions::DensityValue density{10.0}; // g cm^-3
const dimensions::TemperatureValue temperature{1.5e7}; // K
const auto pressure = eos::evaluate<dimensions::quantity::Pressure>(
equationOfState,
density,
temperature
);
const auto model = makeRotatingStellarModel({
.equationOfState = equationOfState.parameters(),
.surfacePressure = dimensions::PressureValue{0.0},
.totalMass = dimensions::MassValue{1.0},
.totalAngularMomentum = dimensions::AngularMomentumValue{0.2}
});
std::cout << std::scientific
<< "P(rho = 10 g cm^-3, T = 1.5e7 K) = "
<< pressure.value() << " dyn cm^-2\n"
<< "Compiled specification count = "
<< model.specificationCount << '\n'
<< "Current barotropic backend accepts this thermal model = "
<< std::boolalpha
<< currentEquilibriumBackendSupportsIdealGasRadiation << '\n';
return 0;
}