Update
This commit is contained in:
@@ -48,6 +48,23 @@ int main() {
|
||||
std::cout << "FAIL " << n << ": " << e.what() << '\n';
|
||||
}
|
||||
};
|
||||
test("tracer underflow preserves bulk gas and normal concentrations", [] {
|
||||
for (float fraction : {1e-40f, 1e-30f, .5f}) {
|
||||
Pipe1D p(.001f, 1, 8);
|
||||
for (int i=0; i<8; ++i) set(p, i, 101325, 1.2f, 0, fraction);
|
||||
p.left_ghost = p.state(0);
|
||||
p.right_ghost = p.state(7);
|
||||
const double before_mass = mass(p), before_energy = energy(p);
|
||||
p.advance(1e-6f);
|
||||
near(mass(p), before_mass, 0, "tracer truncation changed total mass");
|
||||
near(energy(p), before_energy, 0, "tracer truncation changed energy");
|
||||
for (auto cell : p.cells) {
|
||||
check(std::fpclassify(cell.air) != FP_SUBNORMAL, "subnormal tracer survived");
|
||||
near(cell.air, fraction < std::numeric_limits<float>::min() ? 0 : fraction,
|
||||
fraction * 1e-6, "normal tracer concentration changed");
|
||||
}
|
||||
}
|
||||
});
|
||||
test("invalid uniform geometry", [] {
|
||||
bool caught = false;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user