Added pipe friction

This commit is contained in:
max
2026-05-03 02:10:28 +02:00
parent a006a07049
commit c427c1f7d3
2 changed files with 25 additions and 9 deletions

View File

@@ -15,17 +15,18 @@ namespace FluidSim.Core
private static float sample;
private static double ambientPressure = 1.0 * Units.atm;
private static bool enableLogging = false;
public static void Initialize(int sampleRate)
{
dt = 1.0 / sampleRate;
double length = 0.2;
double radius = 5 * Units.mm;
double length = 2;
double radius = 20 * Units.mm;
double area = Units.AreaFromDiameter(radius);
pipe = new Pipe1D(length, area, sampleRate, forcedCellCount: 80);
pipe.SetUniformState(1.225, 0.0, ambientPressure);
pipe.FrictionFactor = 0.0;
solver = new Solver();
solver.SetTimeStep(dt);
@@ -56,6 +57,7 @@ namespace FluidSim.Core
public static void Log()
{
if (!enableLogging) return;
if (stepCount % 10 == 0 && stepCount < 1000)
{
double pMid = pipe.GetPressureAtFraction(0.5);