refactoring (broken right now)

This commit is contained in:
2026-05-06 15:24:39 +02:00
parent bc4e077924
commit bc0df51ddb
25 changed files with 1184 additions and 1983 deletions

43
Components/Atmosphere.cs Normal file
View File

@@ -0,0 +1,43 @@
using FluidSim.Interfaces;
namespace FluidSim.Components
{
/// <summary>
/// Represents the ambient atmosphere constant pressure/temperature reservoir.
/// </summary>
public class Atmosphere : IComponent
{
public double Pressure { get; set; } = 101325.0;
public double Temperature { get; set; } = 300.0;
public double GasConstant { get; set; } = 287.0;
public double Gamma => 1.4;
public double Density => Pressure / (GasConstant * Temperature);
public double SpecificEnthalpy => Gamma / (Gamma - 1.0) * Pressure / Density;
public Port Port { get; }
public Atmosphere()
{
Port = new Port { Owner = this };
UpdatePort();
}
public IReadOnlyList<Port> Ports => new[] { Port };
public void UpdateState(double dt)
{
// Atmosphere is static just ensure the port reflects current values
UpdatePort();
}
private void UpdatePort()
{
Port.Pressure = Pressure;
Port.Density = Density;
Port.Temperature = Temperature;
Port.SpecificEnthalpy = SpecificEnthalpy;
// MassFlowRate is set by the solver connector
}
}
}