working helmholtz
This commit is contained in:
@@ -57,18 +57,23 @@ namespace FluidSim.Tests
|
||||
float rho0 = 101325f / (287f * 300f);
|
||||
pipeSystem = new PipeSystem(neckCells, pipeStart, pipeEnd, areas, dxs, rho0, 0f, 101325f);
|
||||
|
||||
|
||||
// Energy loss
|
||||
cavity.EnergyRelaxationRate = 80f;
|
||||
pipeSystem.EnergyRelaxationRate = 0f;
|
||||
pipeSystem.DampingMultiplier = 2000f;
|
||||
|
||||
// --- Boundary system ---
|
||||
boundaries = new BoundarySystem(pipeSystem, maxOrifices: 1, maxOpenEnds: 1);
|
||||
|
||||
float ComputeResistance(float decayTimeSeconds, float rho, float L_eff, float A)
|
||||
{
|
||||
// R = 2 * rho * L_eff / (A * decayTimeSeconds)
|
||||
return 2f * rho * L_eff / (A * MathF.Max(decayTimeSeconds, 1e-6f));
|
||||
}
|
||||
|
||||
// Use steady orifice – the pipe already provides the inertia
|
||||
boundaries.AddOrifice(cavityPort, pipeIndex: 0, isLeftEnd: true, areaIndex: cavityOrificeIdx, dischargeCoeff: 1f, lossCoefficient: 0.1f);
|
||||
// LOSS COEFFICIENT BREAKS THE SYSTEM AT ~0.55, AT VALUES LOWER THAN THAT, IT SEEMS TO ONLY AFFECT VOLUME, NOT COMPOUND
|
||||
boundaries.AddOrificeWithInertance(
|
||||
cavityPort, pipeIndex: 0, isLeftEnd: true,
|
||||
areaIndex: cavityOrificeIdx,
|
||||
dischargeCoeff: 0.9f,
|
||||
effectiveLength: neckLength, // physical length (or L_eff)
|
||||
lossCoefficient: 9000 // start with this, adjust for decay time
|
||||
);
|
||||
|
||||
// Open end at right side of pipe
|
||||
boundaries.AddOpenEnd(pipeIndex: 0, isLeftEnd: false, 101325f, neckArea);
|
||||
@@ -78,7 +83,7 @@ namespace FluidSim.Tests
|
||||
|
||||
// --- Solver ---
|
||||
// Slightly higher sub‑step count to ensure stability of the resonant oscillation
|
||||
solver = new Solver { SubStepCount = 6, EnableProfiling = true };
|
||||
solver = new Solver { SubStepCount = 6, EnableProfiling = false };
|
||||
solver.SetTimeStep(dt);
|
||||
solver.SetPipeSystem(pipeSystem);
|
||||
solver.SetBoundarySystem(boundaries);
|
||||
|
||||
Reference in New Issue
Block a user