-
Notifications
You must be signed in to change notification settings - Fork 1
/
FluidExtended.cs
99 lines (73 loc) · 4.04 KB
/
FluidExtended.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
namespace SharpProp.Tests;
/// <summary>
/// An example of how to add new properties to the <see cref="Fluid"/> class.
/// </summary>
/// <seealso cref="IFluidExtended"/>
public class FluidExtended(FluidsList name, Ratio? fraction = null)
: Fluid(name, fraction),
IFluidExtended
{
private MolarMass? _molarDensity;
private double? _ozoneDepletionPotential;
private SpecificEntropy? _specificHeatConstVolume;
public SpecificEntropy SpecificHeatConstVolume =>
_specificHeatConstVolume ??= SpecificEntropy
.FromJoulesPerKilogramKelvin(KeyedOutput(Parameters.iCvmass))
.ToUnit(SpecificEntropyUnit.KilojoulePerKilogramKelvin);
public MolarMass? MolarDensity =>
_molarDensity ??= KeyedOutputIsNotNull(Parameters.iDmolar, out var output)
? UnitsNet.MolarMass.FromKilogramsPerMole(output!.Value)
: null;
public double? OzoneDepletionPotential =>
_ozoneDepletionPotential ??= NullableKeyedOutput(Parameters.iODP);
public override void Reset()
{
base.Reset();
_specificHeatConstVolume = null;
_molarDensity = null;
_ozoneDepletionPotential = null;
}
public new IFluidExtended SpecifyPhase(Phases phase) => (FluidExtended)base.SpecifyPhase(phase);
public new IFluidExtended UnspecifyPhase() => (FluidExtended)base.UnspecifyPhase();
public new IFluidExtended WithState(
IKeyedInput<Parameters> firstInput,
IKeyedInput<Parameters> secondInput
) => (FluidExtended)base.WithState(firstInput, secondInput);
public new IFluidExtended IsentropicCompressionTo(Pressure pressure) =>
(FluidExtended)base.IsentropicCompressionTo(pressure);
public new IFluidExtended CompressionTo(Pressure pressure, Ratio isentropicEfficiency) =>
(FluidExtended)base.CompressionTo(pressure, isentropicEfficiency);
public new IFluidExtended IsenthalpicExpansionTo(Pressure pressure) =>
(FluidExtended)base.IsenthalpicExpansionTo(pressure);
public new IFluidExtended IsentropicExpansionTo(Pressure pressure) =>
(FluidExtended)base.IsentropicExpansionTo(pressure);
public new IFluidExtended ExpansionTo(Pressure pressure, Ratio isentropicEfficiency) =>
(FluidExtended)base.ExpansionTo(pressure, isentropicEfficiency);
public new IFluidExtended CoolingTo(Temperature temperature, Pressure? pressureDrop = null) =>
(FluidExtended)base.CoolingTo(temperature, pressureDrop);
public new IFluidExtended CoolingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null) =>
(FluidExtended)base.CoolingTo(enthalpy, pressureDrop);
public new IFluidExtended HeatingTo(Temperature temperature, Pressure? pressureDrop = null) =>
(FluidExtended)base.HeatingTo(temperature, pressureDrop);
public new IFluidExtended HeatingTo(SpecificEnergy enthalpy, Pressure? pressureDrop = null) =>
(FluidExtended)base.HeatingTo(enthalpy, pressureDrop);
public new IFluidExtended BubblePointAt(Pressure pressure) =>
(FluidExtended)base.BubblePointAt(pressure);
public new IFluidExtended BubblePointAt(Temperature temperature) =>
(FluidExtended)base.BubblePointAt(temperature);
public new IFluidExtended DewPointAt(Pressure pressure) =>
(FluidExtended)base.DewPointAt(pressure);
public new IFluidExtended DewPointAt(Temperature temperature) =>
(FluidExtended)base.DewPointAt(temperature);
public new IFluidExtended TwoPhasePointAt(Pressure pressure, Ratio quality) =>
(FluidExtended)base.TwoPhasePointAt(pressure, quality);
public IFluidExtended Mixing(
Ratio firstSpecificMassFlow,
IFluidExtended first,
Ratio secondSpecificMassFlow,
IFluidExtended second
) => (FluidExtended)base.Mixing(firstSpecificMassFlow, first, secondSpecificMassFlow, second);
public new IFluidExtended Clone() => (FluidExtended)base.Clone();
public new IFluidExtended Factory() => (FluidExtended)base.Factory();
protected override AbstractFluid CreateInstance() => new FluidExtended(Name, Fraction);
}