Improve physical geometry, fluid solvers, audio, and profiling
This commit is contained in:
@@ -794,6 +794,38 @@ int main(int argc,char** argv) {
|
||||
"thermal relaxation differs from exact exponential");
|
||||
});
|
||||
|
||||
test("pipe solver scratch follows runtime solver changes", [] {
|
||||
Pipe1D pipe(.001f,.2f,16);
|
||||
pipe.left_ghost=pipe.state(0);
|
||||
pipe.right_ghost=pipe.state(15);
|
||||
pipe.solver=PipeSolver::Rusanov;
|
||||
pipe.prepare_step();
|
||||
const auto rusanov_bytes=pipe.scratch_bytes();
|
||||
pipe.solver=PipeSolver::Hlle;
|
||||
pipe.prepare_step();
|
||||
const auto hlle_bytes=pipe.scratch_bytes();
|
||||
pipe.solver=PipeSolver::Muscl;
|
||||
pipe.prepare_step();
|
||||
const auto muscl_bytes=pipe.scratch_bytes();
|
||||
check(rusanov_bytes<hlle_bytes && hlle_bytes<muscl_bytes,
|
||||
"solver-specific work buffers were not allocated on demand");
|
||||
for(auto solver : {PipeSolver::Rusanov,PipeSolver::Hlle,PipeSolver::Hllc,
|
||||
PipeSolver::Muscl,PipeSolver::Rusanov}) {
|
||||
pipe.solver=solver;
|
||||
for(int step=0;step<8;++step) {
|
||||
pipe.left_ghost=pipe.state(0);
|
||||
pipe.right_ghost=pipe.state(15);
|
||||
const float dt=.5f*pipe.prepare_step();
|
||||
pipe.advance(dt);
|
||||
}
|
||||
}
|
||||
for(int i=0;i<16;++i) {
|
||||
const auto state=pipe.state(i);
|
||||
check(std::isfinite(state.rho)&&std::isfinite(state.pressure)&&
|
||||
state.rho>0&&state.pressure>0,"solver switch produced a nonphysical pipe state");
|
||||
}
|
||||
});
|
||||
|
||||
test("sealed crankcase compression conserves mass above five bar", [] {
|
||||
Crankshaft crank;
|
||||
crank.angle = 0;
|
||||
|
||||
Reference in New Issue
Block a user