diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java index 96463403e..76efa73c7 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java @@ -167,7 +167,7 @@ public static void main(String[] args) { // testSystem.chemicalReactionInit(); testSystem.createDatabase(true); testSystem.setMixingRule(10); - // testSystem.setPhysicalPropertyModel(3); + // testSystem.setPhysicalPropertyModel(PhysicalPropertyModel.AMINE); // testSystem.setNumericDerivatives(true); testSystem.initPhysicalProperties(); testSystem.getPhase(0).setTemperature(273.15 + 85); diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java index 1f54a3f18..b02161998 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java @@ -5,6 +5,7 @@ import neqsim.fluidmechanics.flownode.twophasenode.TwoPhaseFlowNode; import neqsim.fluidmechanics.geometrydefinitions.GeometryDefinitionInterface; import neqsim.fluidmechanics.geometrydefinitions.reactor.ReactorData; +import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel; import neqsim.thermo.system.SystemFurstElectrolyteEos; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicoperations.ThermodynamicOperations; @@ -232,7 +233,7 @@ public static void main(String[] args) { testSystem.setMixingRule(4); testOps.TPflash(); testSystem.addComponent("CO2", 2000.11152181, "Nlitre/min", 0); - testSystem.setPhysicalPropertyModel(3); + testSystem.setPhysicalPropertyModel(PhysicalPropertyModel.AMINE); testSystem.init_x_y(); testSystem.getPhases()[1].setTemperature(313.0); testSystem.getPhases()[0].setTemperature(325.0); diff --git a/src/main/java/neqsim/fluidmechanics/flowsystem/twophaseflowsystem/twophasepipeflowsystem/TwoPhasePipeFlowSystemReac.java b/src/main/java/neqsim/fluidmechanics/flowsystem/twophaseflowsystem/twophasepipeflowsystem/TwoPhasePipeFlowSystemReac.java index 492c721ce..a0d5e9737 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsystem/twophaseflowsystem/twophasepipeflowsystem/TwoPhasePipeFlowSystemReac.java +++ b/src/main/java/neqsim/fluidmechanics/flowsystem/twophaseflowsystem/twophasepipeflowsystem/TwoPhasePipeFlowSystemReac.java @@ -1,5 +1,6 @@ package neqsim.fluidmechanics.flowsystem.twophaseflowsystem.twophasepipeflowsystem; +import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel; import neqsim.thermo.system.SystemFurstElectrolyteEos; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicoperations.ThermodynamicOperations; @@ -42,7 +43,7 @@ public static void main(String[] args) { testSystem.chemicalReactionInit(); testSystem.createDatabase(true); testSystem.setMixingRule(4); - testSystem.setPhysicalPropertyModel(3); + testSystem.setPhysicalPropertyModel(PhysicalPropertyModel.AMINE); // testOps.TPflash(); // testSystem.display(); diff --git a/src/main/java/neqsim/physicalproperties/PhysicalPropertyHandler.java b/src/main/java/neqsim/physicalproperties/PhysicalPropertyHandler.java index 3b4e07afb..68964c228 100644 --- a/src/main/java/neqsim/physicalproperties/PhysicalPropertyHandler.java +++ b/src/main/java/neqsim/physicalproperties/PhysicalPropertyHandler.java @@ -3,6 +3,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.physicalproperties.physicalpropertysystem.PhysicalProperties; +import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel; import neqsim.physicalproperties.physicalpropertysystem.commonphasephysicalproperties.DefaultPhysicalProperties; import neqsim.physicalproperties.physicalpropertysystem.gasphysicalproperties.GasPhysicalProperties; import neqsim.physicalproperties.physicalpropertysystem.liquidphysicalproperties.AminePhysicalProperties; @@ -15,7 +16,7 @@ /** *
- * PhysicalPropertyHandler class. + * PhysicalPropertyHandler class. Group together the physical property functions (density for *
* * @author ESOL @@ -44,36 +45,36 @@ public PhysicalPropertyHandler() {} * * * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @param type 0 Orginal/default 1 Water 2 Glycol 3 Amine 4 CO2Water 6 Basic + * @param ppm PhysicalPropertyModel enum object */ - public void setPhysicalProperties(PhaseInterface phase, int type) { - switch (type) { - case 0: // Default + public void setPhysicalProperties(PhaseInterface phase, PhysicalPropertyModel ppm) { + switch (ppm) { + case DEFAULT: // Default gasPhysicalProperties = new GasPhysicalProperties(phase, 0, 0); oilPhysicalProperties = new LiquidPhysicalProperties(phase, 0, 0); aqueousPhysicalProperties = new WaterPhysicalProperties(phase, 0, 0); break; - case 1: // Water + case WATER: // Water gasPhysicalProperties = new GasPhysicalProperties(phase, 0, 0); oilPhysicalProperties = new LiquidPhysicalProperties(phase, 0, 0); aqueousPhysicalProperties = new WaterPhysicalProperties(phase, 0, 0); break; - case 2: // Glycol + case GLYCOL: // Glycol gasPhysicalProperties = new GasPhysicalProperties(phase, 0, 0); oilPhysicalProperties = new LiquidPhysicalProperties(phase, 0, 0); aqueousPhysicalProperties = new GlycolPhysicalProperties(phase, 0, 0); break; - case 3: // Amine + case AMINE: // Amine gasPhysicalProperties = new GasPhysicalProperties(phase, 0, 0); oilPhysicalProperties = new LiquidPhysicalProperties(phase, 0, 0); aqueousPhysicalProperties = new AminePhysicalProperties(phase, 0, 0); break; - case 4: // CO2water + case CO2WATER: gasPhysicalProperties = new GasPhysicalProperties(phase, 0, 0); oilPhysicalProperties = new LiquidPhysicalProperties(phase, 0, 0); aqueousPhysicalProperties = new CO2waterPhysicalProperties(phase, 0, 0); break; - case 6: // Basic? + case BASIC: gasPhysicalProperties = new DefaultPhysicalProperties(phase, 0, 0); oilPhysicalProperties = new DefaultPhysicalProperties(phase, 0, 0); aqueousPhysicalProperties = new DefaultPhysicalProperties(phase, 0, 0); @@ -81,7 +82,7 @@ public void setPhysicalProperties(PhaseInterface phase, int type) { default: logger .error("error selecting physical properties model.\n Continue using default model..."); - setPhysicalProperties(phase, 0); + setPhysicalProperties(phase, PhysicalPropertyModel.DEFAULT); break; } solidPhysicalProperties = new SolidPhysicalProperties(phase); @@ -94,13 +95,13 @@ public void setPhysicalProperties(PhaseInterface phase, int type) { /** *- * getPhysicalProperty. + * Get PhysicalProperty *
* * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @return a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalProperties} object */ - public PhysicalProperties getPhysicalProperty(PhaseInterface phase) { + public PhysicalProperties getPhysicalProperties(PhaseInterface phase) { switch (phase.getType()) { case GAS: return gasPhysicalProperties; diff --git a/src/main/java/neqsim/physicalproperties/PhysicalPropertyType.java b/src/main/java/neqsim/physicalproperties/PhysicalPropertyType.java index 9116ad438..1a58a8aa1 100644 --- a/src/main/java/neqsim/physicalproperties/PhysicalPropertyType.java +++ b/src/main/java/neqsim/physicalproperties/PhysicalPropertyType.java @@ -10,9 +10,8 @@ public enum PhysicalPropertyType { MASS_DENSITY, DYNAMIC_VISCOSITY, THERMAL_CONDUCTIVITY; - // We know we'll never mutate this, so we can keep - // a local copy for fast lookup in byName - /** ConstantcopyOfValues
*/
+ // We know we'll never mutate this, so we can keep a local copy for fast lookup in byName
+ /** Constant copyOfValues
. */
private static final PhysicalPropertyType[] copyOfValues = values();
/**
diff --git a/src/main/java/neqsim/physicalproperties/physicalpropertysystem/PhysicalPropertyModel.java b/src/main/java/neqsim/physicalproperties/physicalpropertysystem/PhysicalPropertyModel.java
new file mode 100644
index 000000000..17cc2b3e3
--- /dev/null
+++ b/src/main/java/neqsim/physicalproperties/physicalpropertysystem/PhysicalPropertyModel.java
@@ -0,0 +1,71 @@
+package neqsim.physicalproperties.physicalpropertysystem;
+
+import neqsim.util.exception.InvalidInputException;
+
+/**
+ * Types of PhysicalPropertyModel. This is used when initializing PhysicalPropertyhandler.
+ *
+ * @author ASMF
+ */
+public enum PhysicalPropertyModel {
+ DEFAULT(0), WATER(1), GLYCOL(2), AMINE(3), CO2WATER(4), BASIC(6);
+
+ /** Holder for old style integer pt. */
+ private final int value;
+ /** Holder for old style string physical property description. */
+
+ // We know we'll never mutate this, so we can keep
+ // a local copy for fast lookup in forName
+ private static final PhysicalPropertyModel[] copyOfValues = values();
+
+ /**
+ * Constructor for PhysicalPropertyModel enum.
+ *
+ * @param value Numeric value index for phase type
+ */
+ private PhysicalPropertyModel(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Getter for property value.
+ *
+ * @return Numeric index of phase type
+ */
+ @Deprecated
+ public int getValue() {
+ return this.value;
+ }
+
+ /**
+ * Get PhysicalPropertyType by name.
+ *
+ * @param name Name to get PhysicalPropertyType for.
+ * @return PhysicalPropertyType object
+ */
+ public static PhysicalPropertyModel byName(String name) {
+ for (PhysicalPropertyModel pt : copyOfValues) {
+ if (pt.name().equals(name.toUpperCase())) {
+ return pt;
+ }
+ }
+ throw new RuntimeException(
+ new InvalidInputException("PhysicalPropertyModel", "byName", "name", "is not valid."));
+ }
+
+ /**
+ * Get PhysicalPropertyModel by value.
+ *
+ * @param value Value to get PhysicalPropertyModel for.
+ * @return PhysicalPropertyModel object
+ */
+ public static PhysicalPropertyModel byValue(int value) {
+ for (PhysicalPropertyModel pt : copyOfValues) {
+ if (pt.getValue() == (value)) {
+ return pt;
+ }
+ }
+ throw new RuntimeException(
+ new InvalidInputException("PhysicalPropertyModel", "byValue", "value", "is not valid."));
+ }
+}
diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java
index 248097821..301cf8e10 100644
--- a/src/main/java/neqsim/thermo/phase/Phase.java
+++ b/src/main/java/neqsim/thermo/phase/Phase.java
@@ -12,6 +12,7 @@
import neqsim.physicalproperties.PhysicalPropertyHandler;
import neqsim.physicalproperties.PhysicalPropertyType;
import neqsim.physicalproperties.physicalpropertysystem.PhysicalProperties;
+import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel;
import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentInterface;
@@ -19,7 +20,19 @@
import neqsim.util.exception.InvalidInputException;
/**
- * Phase class.
+ * Abstract Phase class. All Phase classes shall subclass this class.
+ *
+ * + * From wiki: A phase is a region of a space (a thermodynamic system), in neqsim named a + * SystemInterface, throughout which all physical properties of a material are essentially uniform. + * A SystemInterface can contain a single or multiple PhaseInterface objects. + * + * See PhaseType for the types of Phases that NeqSim is aware of. See also StateOfMatter. + * + * In NeqSim, there are multiple Phase classes, each representing a specific set of Equations Of + * State. Phases have corresponding Component classes and System classes to ensure same EoS is used + * throughout. + *
* * @author Even Solbraa */ @@ -37,10 +50,10 @@ public abstract class Phase implements PhaseInterface { private boolean constantPhaseVolume = false; - public int physicalPropertyType = 0; + private PhysicalPropertyModel ppm = PhysicalPropertyModel.DEFAULT; + public PhysicalPropertyHandler physicalPropertyHandler = null; protected boolean useVolumeCorrection = true; - public neqsim.physicalproperties.PhysicalPropertyHandler physicalPropertyHandler = null; protected double molarVolume = 1.0; protected double phaseVolume = 1.0; @@ -64,7 +77,11 @@ public abstract class Phase implements PhaseInterface { private int initType = 0; int mixingRuleNumber = 0; + + /** Temperature of phase. */ double temperature = 0; + + /** Pressure of phase. */ double pressure = 0; protected PhaseInterface[] refPhase = null; @@ -429,10 +446,8 @@ public void setTemperature(double temp) { public PhysicalProperties getPhysicalProperties() { if (physicalPropertyHandler == null) { initPhysicalProperties(); - return physicalPropertyHandler.getPhysicalProperty(this); - } else { - return physicalPropertyHandler.getPhysicalProperty(this); } + return physicalPropertyHandler.getPhysicalProperties(this); } /** {@inheritDoc} */ @@ -459,20 +474,25 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType /** {@inheritDoc} */ @Override - public void setPhysicalProperties() { - // System.out.println("Physical properties: Default model"); - setPhysicalProperties(physicalPropertyType); - // physicalProperty = new - // physicalproperties.physicalPropertySystem.commonPhasePhysicalProperties.DefaultPhysicalProperties(this,0,0); + public void setPpm(PhysicalPropertyModel ppm) { + this.ppm = ppm; } /** {@inheritDoc} */ @Override - public void setPhysicalProperties(int type) { + public PhysicalPropertyModel getPhysicalPropertyModel() { + // todo: still inconsistent + return this.ppm; + } + + /** {@inheritDoc} */ + @Override + public void setPhysicalPropertyModel(PhysicalPropertyModel ppm) { + setPpm(ppm); if (physicalPropertyHandler == null) { physicalPropertyHandler = new PhysicalPropertyHandler(); } - physicalPropertyHandler.setPhysicalProperties(this, type); + physicalPropertyHandler.setPhysicalProperties(this, ppm); } /** {@inheritDoc} */ @@ -488,8 +508,8 @@ public void initPhysicalProperties() { physicalPropertyHandler = new PhysicalPropertyHandler(); } - if (physicalPropertyHandler.getPhysicalProperty(this) == null) { - setPhysicalProperties(physicalPropertyType); + if (physicalPropertyHandler.getPhysicalProperties(this) == null) { + setPhysicalPropertyModel(ppm); } getPhysicalProperties().init(this); } @@ -500,19 +520,19 @@ public void initPhysicalProperties(PhysicalPropertyType ppt) { if (physicalPropertyHandler == null) { physicalPropertyHandler = new PhysicalPropertyHandler(); } - if (physicalPropertyHandler.getPhysicalProperty(this) == null) { - setPhysicalProperties(physicalPropertyType); + + if (physicalPropertyHandler.getPhysicalProperties(this) == null) { + setPhysicalPropertyModel(ppm); } getPhysicalProperties().setPhase(this); - - // if (physicalProperty == null || phaseTypeAtLastPhysPropUpdate != phaseType || - // !phaseTypeNameAtLastPhysPropUpdate.equals(phaseTypeName)) { - // this.setPhysicalProperties(); - // } - // physicalProperty.init(this, type); getPhysicalProperties().init(this, ppt); } + /** {@inheritDoc} */ + public void setPhysicalProperties(PhysicalPropertyModel ppm) { + physicalPropertyHandler.setPhysicalProperties(this, ppm); + } + /** {@inheritDoc} */ @Override public double geta(PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -1911,18 +1931,6 @@ public void setRefPhase(neqsim.thermo.phase.PhaseInterface[] refPhase) { this.refPhase = refPhase; } - /** {@inheritDoc} */ - @Override - public final int getPhysicalPropertyType() { - return physicalPropertyType; - } - - /** {@inheritDoc} */ - @Override - public void setPhysicalPropertyType(int physicalPropertyType) { - this.physicalPropertyType = physicalPropertyType; - } - /** {@inheritDoc} */ @Override public void setParams(PhaseInterface phase, double[][] alpha, double[][] Dij, double[][] DijT, diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index fbb50d2d0..3bb13d39a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -8,6 +8,7 @@ import neqsim.physicalproperties.PhysicalPropertyType; import neqsim.physicalproperties.physicalpropertysystem.PhysicalProperties; +import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel; import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.component.ComponentInterface; import neqsim.thermo.system.SystemInterface; @@ -99,13 +100,6 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab */ public double[] getMolarComposition(); - /** - *- * resetPhysicalProperties. - *
- */ - public void resetPhysicalProperties(); - /** * method to return phase volume note: without Peneloux volume correction. * @@ -789,19 +783,65 @@ public default void addMolesChemReac(int component, double dn) { /** *- * setPhysicalProperties. + * getPhysicalProperties. + *
+ * + * @return a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalProperties} object + */ + public PhysicalProperties getPhysicalProperties(); + + /** + *+ * resetPhysicalProperties. + *
+ */ + public void resetPhysicalProperties(); + + /** + *+ * Specify the type of the physical properties. + *
+ */ + public default void setPhysicalProperties() { + setPhysicalProperties(getPhysicalPropertyModel()); + } + + /** + *+ * Specify the type of the physical properties. + *
+ * + * @param ppm PhysicalPropertyModel enum object + */ + public void setPhysicalProperties(PhysicalPropertyModel ppm); + + /** + *+ * Getter for property ppm. + *
+ * + * @return a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel} object + */ + public PhysicalPropertyModel getPhysicalPropertyModel(); + + /** + *+ * Setter for property ppm. *
+ * + * @param ppm PhysicalPropertyModel enum object */ - public void setPhysicalProperties(); + public void setPpm(PhysicalPropertyModel ppm); /** *- * specify the type model for the physical properties you want to use. + * setPhysicalPropertyModel. *
* - * @param type 0 Orginal/default 1 Water 2 Glycol 3 Amine 4 CO2Water 6 Basic + * @param ppm a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel} + * object */ - public void setPhysicalProperties(int type); + public void setPhysicalPropertyModel(PhysicalPropertyModel ppm); /** *@@ -837,15 +877,6 @@ public default void addMolesChemReac(int component, double dn) { */ public void setTemperature(double temperature); - /** - *
- * getPhysicalProperties. - *
- * - * @return a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalProperties} object - */ - public PhysicalProperties getPhysicalProperties(); - /** ** molarVolume. @@ -1829,24 +1860,6 @@ public default void addMolesChemReac(int component, double dn) { */ public void setRefPhase(neqsim.thermo.phase.PhaseInterface[] refPhase); - /** - *
- * Getter for property physicalPropertyType. - *
- * - * @return a int - */ - public int getPhysicalPropertyType(); - - /** - *- * Setter for property physicalPropertyType. - *
- * - * @param physicalPropertyType a int - */ - public void setPhysicalPropertyType(int physicalPropertyType); - /** ** setParams. diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index 4cc8025a5..e7f6c6bc3 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -3,6 +3,7 @@ import neqsim.chemicalreactions.ChemicalReactionOperations; import neqsim.physicalproperties.PhysicalPropertyType; import neqsim.physicalproperties.interfaceproperties.InterphasePropertiesInterface; +import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel; import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.characterization.WaxModelInterface; import neqsim.thermo.component.ComponentInterface; @@ -2448,9 +2449,22 @@ public void setImplementedTemperatureDeriativesofFugacity( /** * Set the physical property model type for each phase of the System. * - * @param type 0 Orginal/default 1 Water 2 Glycol 3 Amine 4 CO2Water 6 Basic + * @param ppm PhysicalPropertyModel enum object */ - public void setPhysicalPropertyModel(int type); + public default void setPhysicalPropertyModel(PhysicalPropertyModel ppm) { + for (int i = 0; i < getNumberOfPhases(); i++) { + getPhase(i).setPhysicalPropertyModel(ppm); + } + } + + /** + * Set the physical property model type for each phase of the System. + * + * @param type 0 Default, 1 Water, 2 Glycol, 3 Amine, 4 CO2Water, 6 Basic + */ + public default void setPhysicalPropertyModel(int type) { + setPhysicalPropertyModel(PhysicalPropertyModel.byValue(type)); + } /** * method to set the pressure of a fluid (same pressure for all phases). diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 8322f9057..7125e89dc 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -4786,14 +4786,6 @@ public void setPhaseType(int phaseToChange, PhaseType pt) { } } - /** {@inheritDoc} */ - @Override - public void setPhysicalPropertyModel(int type) { - for (int i = 0; i < numberOfPhases; i++) { - getPhase(i).setPhysicalProperties(type); - } - } - /** {@inheritDoc} */ @Override public final void setPressure(double newPressure) { diff --git a/src/test/java/neqsim/physicalproperties/physicalpropertysystem/PhysicalPropertyModelTest.java b/src/test/java/neqsim/physicalproperties/physicalpropertysystem/PhysicalPropertyModelTest.java new file mode 100644 index 000000000..012ef78e1 --- /dev/null +++ b/src/test/java/neqsim/physicalproperties/physicalpropertysystem/PhysicalPropertyModelTest.java @@ -0,0 +1,27 @@ +package neqsim.physicalproperties.physicalpropertysystem; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +public class PhysicalPropertyModelTest { + @Test + void testByName() { + assertEquals(PhysicalPropertyModel.AMINE, PhysicalPropertyModel.byName("amine")); + assertEquals(PhysicalPropertyModel.BASIC, PhysicalPropertyModel.byName("basic")); + assertEquals(PhysicalPropertyModel.CO2WATER, PhysicalPropertyModel.byName("co2water")); + assertEquals(PhysicalPropertyModel.DEFAULT, PhysicalPropertyModel.byName("default")); + assertEquals(PhysicalPropertyModel.GLYCOL, PhysicalPropertyModel.byName("glycol")); + assertEquals(PhysicalPropertyModel.WATER, PhysicalPropertyModel.byName("water")); + } + + + @Test + void testByValue() { + assertEquals(PhysicalPropertyModel.AMINE, PhysicalPropertyModel.byValue(3)); + assertEquals(PhysicalPropertyModel.BASIC, PhysicalPropertyModel.byValue(6)); + assertEquals(PhysicalPropertyModel.CO2WATER, PhysicalPropertyModel.byValue(4)); + assertEquals(PhysicalPropertyModel.DEFAULT, PhysicalPropertyModel.byValue(0)); + assertEquals(PhysicalPropertyModel.GLYCOL, PhysicalPropertyModel.byValue(2)); + assertEquals(PhysicalPropertyModel.WATER, PhysicalPropertyModel.byValue(1)); + } +} diff --git a/src/test/java/neqsim/physicalproperties/util/examples/TPflashTest.java b/src/test/java/neqsim/physicalproperties/util/examples/TPflashTest.java index 24a7fcf31..ab2dfaadd 100644 --- a/src/test/java/neqsim/physicalproperties/util/examples/TPflashTest.java +++ b/src/test/java/neqsim/physicalproperties/util/examples/TPflashTest.java @@ -67,7 +67,7 @@ public static void main(String args[]) { testSystem.createDatabase(true); testSystem.setMixingRule(10); // testSystem.setMultiPhaseCheck(true); - // testSystem.setPhysicalPropertyModel(6); + // testSystem.setPhysicalPropertyModel(PhysicalPropertyType.BASIC); // testSystem.initPhysicalProperties(); // testSystem.getInterphaseProperties().setInterfacialTensionModel(3); // testSystem.useVolumeCorrection(true); @@ -93,7 +93,7 @@ public static void main(String args[]) { // double a = // testSystem.getPhase("oil").getPhysicalProperties().getDiffusionCoefficient(0, // 1); - // testSystem.setPhysicalPropertyModel(6); + // testSystem.setPhysicalPropertyModel(PhysicalPropertyType.BASIC); // testSystem.getPhase(0).initPhysicalProperties("viscosity"); double visc = testSystem.getPhase(1).getPhysicalProperties().getViscosityModel().calcViscosity(); diff --git a/src/test/java/neqsim/physicalproperties/util/examples/TestCondensate.java b/src/test/java/neqsim/physicalproperties/util/examples/TestCondensate.java index 8da23620e..3cdc83c80 100644 --- a/src/test/java/neqsim/physicalproperties/util/examples/TestCondensate.java +++ b/src/test/java/neqsim/physicalproperties/util/examples/TestCondensate.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel; import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemPrEos; @@ -57,7 +58,7 @@ public static void main(String args[]) { testSystem.setMixingRule("classic"); testSystem.init(0); testSystem.init(1); - testSystem.setPhysicalPropertyModel(6); + testSystem.setPhysicalPropertyModel(PhysicalPropertyModel.BASIC); try { testOps.TPflash(); } catch (Exception ex) { diff --git a/src/test/java/neqsim/processsimulation/util/example/simpleGasScrubber.java b/src/test/java/neqsim/processsimulation/util/example/simpleGasScrubber.java index 47b84be2a..2ce0e1663 100644 --- a/src/test/java/neqsim/processsimulation/util/example/simpleGasScrubber.java +++ b/src/test/java/neqsim/processsimulation/util/example/simpleGasScrubber.java @@ -19,7 +19,6 @@ public class simpleGasScrubber { * * @param args an array of {@link java.lang.String} objects */ - @SuppressWarnings("unused") public static void main(String args[]) { neqsim.thermo.system.SystemInterface testSystem = new neqsim.thermo.system.SystemSrkEos((273.15 + 25.0), 20.00); diff --git a/src/test/java/neqsim/thermo/util/example/ReactiveDesmukhMather.java b/src/test/java/neqsim/thermo/util/example/ReactiveDesmukhMather.java index 33cbaea31..f2e12e3a3 100644 --- a/src/test/java/neqsim/thermo/util/example/ReactiveDesmukhMather.java +++ b/src/test/java/neqsim/thermo/util/example/ReactiveDesmukhMather.java @@ -31,7 +31,7 @@ public static void main(String args[]) { testSystem.chemicalReactionInit(); testSystem.setMixingRule(2); testSystem.createDatabase(true); - // testSystem.setPhysicalPropertyModel(3); + // testSystem.setPhysicalPropertyModel(PhysicalPropertyModel.AMINE); ThermodynamicOperations ops = new ThermodynamicOperations(testSystem); diff --git a/src/test/java/neqsim/thermo/util/example/ReactiveKentEisenberg.java b/src/test/java/neqsim/thermo/util/example/ReactiveKentEisenberg.java index 78e6ab9f5..7d1e34c6d 100644 --- a/src/test/java/neqsim/thermo/util/example/ReactiveKentEisenberg.java +++ b/src/test/java/neqsim/thermo/util/example/ReactiveKentEisenberg.java @@ -38,7 +38,7 @@ public static void main(String args[]) { testSystem.chemicalReactionInit(); testSystem.createDatabase(true); testSystem.setMixingRule(4); - // testSystem.setPhysicalPropertyModel(3); + // testSystem.setPhysicalPropertyModel(PhysicalPropertyModel.AMINE); ThermodynamicOperations ops = new ThermodynamicOperations(testSystem);