Added boundary states for correct resonances

This commit is contained in:
max
2026-05-03 01:52:55 +02:00
parent 3926ed7ef9
commit a006a07049
9 changed files with 432 additions and 244 deletions

View File

@@ -50,13 +50,26 @@ namespace FluidSim.Components
Port.SpecificEnthalpy = SpecificEnthalpy;
}
// Original integrate (uses the constructors sample rate)
public void Integrate()
{
Integrate(_dt);
}
public void SetPressure(double newPressure)
{
InternalEnergy = newPressure * Volume / (Gamma - 1.0);
// Mass stays the same, so density is unchanged
}
// New overload: integrate with a custom time step (for substeps)
public void Integrate(double dtOverride)
{
double mdot = Port.MassFlowRate;
double h_in = Port.SpecificEnthalpy;
double dm = mdot * _dt;
double dE = (mdot * h_in) * _dt - Pressure * dVdt * _dt;
double dm = mdot * dtOverride;
double dE = (mdot * h_in) * dtOverride - Pressure * dVdt * dtOverride;
Mass += dm;
InternalEnergy += dE;