Added boundary states for correct resonances
This commit is contained in:
@@ -50,13 +50,26 @@ namespace FluidSim.Components
|
||||
Port.SpecificEnthalpy = SpecificEnthalpy;
|
||||
}
|
||||
|
||||
// Original integrate (uses the constructor’s 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 sub‑steps)
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user