From 5a3622d86ccca7cf67933419df091c0ab2760d2d Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Tue, 15 Aug 2023 21:24:52 +0200 Subject: [PATCH 001/317] add replace database table and test (#812) --- .../neqsim/util/database/NeqSimDataBase.java | 29 +++++++++++++++++-- .../util/database/NeqSimDataBaseTest.java | 10 +++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/main/java/neqsim/util/database/NeqSimDataBase.java b/src/main/java/neqsim/util/database/NeqSimDataBase.java index 47b8401a7e..224ea37402 100644 --- a/src/main/java/neqsim/util/database/NeqSimDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimDataBase.java @@ -55,7 +55,8 @@ public class NeqSimDataBase *
*/ public NeqSimDataBase() { - // Fill tables from csv-files if not initialized and not currently being initialized. + // Fill tables from csv-files if not initialized and not currently being + // initialized. if (dataBaseType == "H2fromCSV" && !h2IsInitialized && !h2IsInitalizing) { initH2DatabaseFromCSVfiles(); } @@ -445,6 +446,26 @@ public static void updateTable(String tableName, String path) { } } + /** + * Drops and re-creates table from contents in csv file. + * + * @param tableName Name of table to replace + * @param path Path to csv file to + */ + public static void replaceTable(String tableName, String path) { + neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase(); + try { + database.execute("DROP TABLE IF EXISTS " + tableName); + String sqlString = "CREATE TABLE " + tableName + " AS SELECT * FROM CSVREAD('" + path + "')"; + database.execute(sqlString); + } catch (Exception ex) { + updateTable(tableName); + logger.error("Failed updating table " + tableName, ex); + throw new RuntimeException(new neqsim.util.exception.InvalidInputException("NeqSimDataBase", + "replaceTable", "path", "- Resource " + path + " not found")); + } + } + public static void initH2DatabaseFromCSVfiles() { h2IsInitalizing = true; neqsim.util.database.NeqSimDataBase.connectionString = @@ -480,9 +501,11 @@ public static void initH2DatabaseFromCSVfiles() { updateTable("UNIFACInterParamC_UMRMC"); updateTable("MBWR32param"); updateTable("COMPSALT"); - // TODO: missing tables: ionicData, reactiondatakenteisenberg, purecomponentvapourpressures, + // TODO: missing tables: ionicData, reactiondatakenteisenberg, + // purecomponentvapourpressures, // binarysystemviscosity, binaryliquiddiffusioncoefficientdata, - // purecomponentconductivitydata, purecomponentdensity, purecomponentsurfacetension2, + // purecomponentconductivitydata, purecomponentdensity, + // purecomponentsurfacetension2, // BinaryComponentSurfaceTension, purecomponentsurfacetension, // purecomponentviscosity,PureComponentVapourPressures // technicalrequirements, technicalrequirements_process, materialpipeproperties, diff --git a/src/test/java/neqsim/util/database/NeqSimDataBaseTest.java b/src/test/java/neqsim/util/database/NeqSimDataBaseTest.java index 03ce354d8c..333a6b431f 100644 --- a/src/test/java/neqsim/util/database/NeqSimDataBaseTest.java +++ b/src/test/java/neqsim/util/database/NeqSimDataBaseTest.java @@ -17,6 +17,16 @@ void testHasComponent() { "Could not load component methane"); } + @Test + void testReplaceTable() { + neqsim.util.database.NeqSimDataBase.replaceTable("COMP", "src/main/resources/data/COMP.csv"); + RuntimeException thrown = Assertions.assertThrows(RuntimeException.class, + () -> neqsim.util.database.NeqSimDataBase.replaceTable("COMP", "file_does_not_exist.csv")); + Assertions.assertEquals( + "neqsim.util.exception.InvalidInputException: NeqSimDataBase:replaceTable - Input path - Resource file_does_not_exist.csv not found", + thrown.getMessage()); + } + @Test void testUpdateTable() { neqsim.util.database.NeqSimDataBase.updateTable("COMP"); From 758680cffd7af11cfff73a5833b294c9ec94f495 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Wed, 16 Aug 2023 23:32:35 +0200 Subject: [PATCH 002/317] added units and runtime exception (#814) * added units and runtime exception * bug fix * spelling error * fixed bug --- .../valve/ValveMechanicalDesign.java | 12 +- src/main/java/neqsim/thermo/phase/Phase.java | 56 +-- .../neqsim/thermo/phase/PhaseInterface.java | 231 +++++----- .../neqsim/thermo/system/SystemInterface.java | 396 +++++++++++------- .../neqsim/thermo/system/SystemThermo.java | 294 +++++++------ 5 files changed, 546 insertions(+), 443 deletions(-) diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/valve/ValveMechanicalDesign.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/valve/ValveMechanicalDesign.java index 248bdb2b27..4a53efcec1 100644 --- a/src/main/java/neqsim/processSimulation/mechanicalDesign/valve/ValveMechanicalDesign.java +++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/valve/ValveMechanicalDesign.java @@ -33,8 +33,9 @@ public class ValveMechanicalDesign extends MechanicalDesign { * Constructor for ValveMechanicalDesign. * * - * @param equipment a {@link neqsim.processSimulation.processEquipment.ProcessEquipmentInterface} - * object + * @param equipment a + * {@link neqsim.processSimulation.processEquipment.ProcessEquipmentInterface} + * object */ public ValveMechanicalDesign(ProcessEquipmentInterface equipment) { super(equipment); @@ -49,8 +50,7 @@ public void readDesignSpecifications() { if (getDesignStandard().containsKey("valve design codes")) { System.out.println("valve code standard: " + getDesignStandard().get("valve design codes").getStandardName()); - valveCvMax = - ((ValveDesignStandard) getDesignStandard().get("valve design codes")).getValveCvMax(); + valveCvMax = ((ValveDesignStandard) getDesignStandard().get("valve design codes")).getValveCvMax(); } else { System.out.println("no valve code standard specified......using default"); } @@ -65,7 +65,7 @@ public void calcDesign() { outletPressure = valve1.getOutletPressure(); dP = inletPressure - outletPressure; - valveCvMax = valve1.getThermoSystem().getVolume("m3/hr") + valveCvMax = valve1.getThermoSystem().getFlowRate("m3/hr") * Math.sqrt(valve1.getThermoSystem().getDensity("kg/m3") / 1000.0 / dP); valveWeight = valveCvMax * 100.0; setWeightTotal(valveWeight); @@ -78,7 +78,7 @@ public void displayResults() { Container dialogContentPane = dialog.getContentPane(); dialogContentPane.setLayout(new BorderLayout()); - String[] names = {"Name", "Value", "Unit"}; + String[] names = { "Name", "Value", "Unit" }; String[][] table = new String[16][3]; // createTable(getProcessEquipment().getName()); diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index 8b5d875ad0..9d67c2ace5 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -46,12 +46,14 @@ abstract class Phase implements PhaseInterface { /** * Mole fraction of this phase of system. - *beta = numberOfMolesInPhase/numberOfMolesInSystem
. NB! numberOfMolesInSystem is
+ * beta = numberOfMolesInPhase/numberOfMolesInSystem
. NB!
+ * numberOfMolesInSystem is
* not known to the phase.
*/
double beta = 1.0;
/**
- * Number of moles in phase. numberOfMolesInPhase = numberOfMolesInSystem*beta
. NB!
+ * Number of moles in phase.
+ * numberOfMolesInPhase = numberOfMolesInSystem*beta
. NB!
* numberOfMolesInSystem is not known to the phase.
*/
public double numberOfMolesInPhase = 0;
@@ -101,7 +103,7 @@ public Phase clone() {
* addcomponent. Increase number of components and add moles to phase.
*
*
- * @param name Name of component to add.
+ * @param name Name of component to add.
* @param moles Number of moles of component to add to phase.
*/
public void addComponent(String name, double moles) {
@@ -118,7 +120,8 @@ public void addComponent(String name, double moles) {
}
if (this.hasComponent(name)) {
- // should use addMoles/addMolesChemreac if adding/subtracting moles for component.
+ // should use addMoles/addMolesChemreac if adding/subtracting moles for
+ // component.
throw new RuntimeException("Component already exists in phase");
}
@@ -176,8 +179,8 @@ public void addMoles(int component, double dn) {
public void addMolesChemReac(int component, double dn, double totdn) {
if ((numberOfMolesInPhase + dn) / numberOfMolesInPhase < -1e-10) {
String msg = "will lead to negative number of moles in phase." + (numberOfMolesInPhase + dn);
- neqsim.util.exception.InvalidInputException ex =
- new neqsim.util.exception.InvalidInputException(this, "addMolesChemReac", "dn", msg);
+ neqsim.util.exception.InvalidInputException ex = new neqsim.util.exception.InvalidInputException(this,
+ "addMolesChemReac", "dn", msg);
throw new RuntimeException(ex);
}
numberOfMolesInPhase += dn;
@@ -284,8 +287,7 @@ public double getPressure() {
/** {@inheritDoc} */
@Override
public final double getPressure(String unit) {
- neqsim.util.unit.PressureUnit presConversion =
- new neqsim.util.unit.PressureUnit(getPressure(), "bara");
+ neqsim.util.unit.PressureUnit presConversion = new neqsim.util.unit.PressureUnit(getPressure(), "bara");
return presConversion.getValue(unit);
}
@@ -494,11 +496,11 @@ public double calcA(PhaseInterface phase, double temperature, double pressure, i
* calcA.
*
*
- * @param comp a int
- * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
+ * @param comp a int
+ * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param temperature a double
- * @param pressure a double
- * @param numbcomp a int
+ * @param pressure a double
+ * @param numbcomp a int
* @return a double
*/
public double calcA(int comp, PhaseInterface phase, double temperature, double pressure,
@@ -1025,6 +1027,7 @@ public double getEnthalpy(String unit) {
case "J":
conversionFactor = 1.0;
break;
+ case "kJ/kmol":
case "J/mol":
conversionFactor = 1.0 / getNumberOfMolesInPhase();
break;
@@ -1035,7 +1038,7 @@ public double getEnthalpy(String unit) {
conversionFactor = 1.0 / getNumberOfMolesInPhase() / getMolarMass() / 1000.0;
break;
default:
- break;
+ throw new RuntimeException("unit not supported " + unit);
}
return refEnthalpy * conversionFactor;
}
@@ -1121,7 +1124,7 @@ public double getEntropy(String unit) {
conversionFactor = 1.0 / getNumberOfMolesInPhase() / getMolarMass() / 1000.0;
break;
default:
- break;
+ throw new RuntimeException("unit not supported " + unit);
}
return refEntropy * conversionFactor;
}
@@ -1150,6 +1153,7 @@ public double getViscosity(String unit) {
double refViscosity = getViscosity(); // viscosity in kg/msec
double conversionFactor = 1.0;
switch (unit) {
+ case "Pas":
case "kg/msec":
conversionFactor = 1.0;
break;
@@ -1157,7 +1161,7 @@ public double getViscosity(String unit) {
conversionFactor = 1.0e3;
break;
default:
- throw new RuntimeException();
+ throw new RuntimeException("unit not supported " + unit);
}
return refViscosity * conversionFactor;
}
@@ -1181,7 +1185,7 @@ public double getThermalConductivity(String unit) {
conversionFactor = 0.01;
break;
default:
- throw new RuntimeException();
+ throw new RuntimeException("unit not supported " + unit);
}
return refConductivity * conversionFactor;
}
@@ -1207,7 +1211,7 @@ public double getConductivity(String unit) {
conversionFactor = 0.01;
break;
default:
- throw new RuntimeException();
+ throw new RuntimeException("unit not supported " + unit);
}
return refConductivity * conversionFactor;
}
@@ -1226,7 +1230,7 @@ public void initRefPhases(boolean onlyPure) {
*
*
* @param onlyPure a boolean
- * @param name a {@link String} object
+ * @param name a {@link String} object
*/
public void initRefPhases(boolean onlyPure, String name) {
refPhase = new PhaseInterface[numberOfComponents];
@@ -1280,7 +1284,7 @@ public void initRefPhases(boolean onlyPure, String name) {
* getLogPureComponentFugacity.
*
*
- * @param k a int
+ * @param k a int
* @param pure a boolean
* @return a double
*/
@@ -1552,7 +1556,7 @@ public double getJouleThomsonCoefficient(String unit) {
conversionFactor = 1.0;
break;
default:
- break;
+ throw new RuntimeException("unit not supported " + unit);
}
return JTcoef * conversionFactor;
}
@@ -1585,8 +1589,7 @@ public double getDensity(String unit) {
conversionFactor = 0.0624279606;
break;
default:
- throw new RuntimeException(
- "Could not create conversion factor because molar mass is NULL or 0");
+ throw new RuntimeException("unit not supported " + unit);
}
return refDensity * conversionFactor;
}
@@ -1823,7 +1826,8 @@ public void setPhysicalPropertyType(int physicalPropertyType) {
/** {@inheritDoc} */
@Override
public void setParams(PhaseInterface phase, double[][] alpha, double[][] Dij, double[][] DijT,
- String[][] mixRule, double[][] intparam) {}
+ String[][] mixRule, double[][] intparam) {
+ }
/** {@inheritDoc} */
@Override
@@ -1919,7 +1923,8 @@ public final void setBeta(double b) {
/** {@inheritDoc} */
@Override
- public void setMixingRuleGEModel(String name) {}
+ public void setMixingRuleGEModel(String name) {
+ }
/** {@inheritDoc} */
@Override
@@ -2106,8 +2111,7 @@ public double[] getProperties_GERG2008() {
/** {@inheritDoc} */
@Override
public double getDensity_AGA8() {
- neqsim.thermo.util.GERG.NeqSimAGA8Detail test =
- new neqsim.thermo.util.GERG.NeqSimAGA8Detail(this);
+ neqsim.thermo.util.GERG.NeqSimAGA8Detail test = new neqsim.thermo.util.GERG.NeqSimAGA8Detail(this);
return test.getDensity();
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java
index 01c9147c19..5df1940cce 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java
@@ -24,10 +24,10 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab
* addcomponent.
*
*
- * @param name Name of component.
- * @param moles a double
+ * @param name Name of component.
+ * @param moles a double
* @param molesInPhase a double
- * @param compNumber a int
+ * @param compNumber a int
*/
public void addComponent(String name, double moles, double molesInPhase, int compNumber);
@@ -36,10 +36,10 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab
* addcomponent.
*
*
- * @param name Name of component.
- * @param moles a double
+ * @param name Name of component.
+ * @param moles a double
* @param molesInPhase a double
- * @param compNumber a int
+ * @param compNumber a int
* @deprecated Replaced by {@link addComponent}
*/
@Deprecated
@@ -67,10 +67,12 @@ public default void addcomponent(String name, double moles, double molesInPhase,
/**
* - * Returns the composition vector in unit molefraction/wtfraction/molespersec/volumefraction. + * Returns the composition vector in unit + * molefraction/wtfraction/molespersec/volumefraction. *
* - * @param unit Supported units are molefraction, wtfraction, molespersec, volumefraction + * @param unit Supported units are molefraction, wtfraction, molespersec, + * volumefraction * @return composition array with unit */ public double[] getComposition(String unit); @@ -136,7 +138,8 @@ public default void addcomponent(String name, double moles, double molesInPhase, public double getVolume(String unit); /** - * method to return heat capacity ratio/adiabatic index/Poisson constant. The method calculates it + * method to return heat capacity ratio/adiabatic index/Poisson constant. The + * method calculates it * as Cp (real) /Cv (real). * * @return gamma @@ -144,7 +147,8 @@ public default void addcomponent(String name, double moles, double molesInPhase, public double getGamma(); /** - * method to return heat capacity ratio calculated as Cp/(Cp-R*getNumberOfMolesInPhase). + * method to return heat capacity ratio calculated as + * Cp/(Cp-R*getNumberOfMolesInPhase). * * @return kappa */ @@ -239,8 +243,8 @@ public default double getGamma2() { * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param beta Mole fraction of this phase in system. */ public default void init(double totalNumberOfMoles, int numberOfComponents, int type, double beta) { @@ -254,9 +258,9 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param pt Type of phase. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param pt Type of phase. + * @param beta Mole fraction of this phase in system. */ public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta); @@ -268,9 +272,9 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph * * @param totalNumberOfMoles Total number of moles in system. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param ptNumber Phase type index. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param ptNumber Phase type index. + * @param beta Mole fraction of this phase in system. * @deprecated Replace with init-function using PhaseType input. */ @Deprecated @@ -363,7 +367,8 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * getcomponentArray. * * - * @return an array of {@link neqsim.thermo.component.ComponentInterface} objects + * @return an array of {@link neqsim.thermo.component.ComponentInterface} + * objects */ public ComponentInterface[] getcomponentArray(); @@ -387,7 +392,8 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int public double getWtFraction(SystemInterface system); /** - * method to return molar volume of the phase note: without Peneloux volume correction. + * method to return molar volume of the phase note: without Peneloux volume + * correction. * * @return molar volume volume in unit m3/mol*1e5 */ @@ -396,8 +402,9 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int /** * method to return flow rate of a phase. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, m3/hr, ft3/sec, - * mole/sec, mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, + * m3/hr, ft3/sec, + * mole/sec, mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -407,7 +414,8 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * setComponentArray. * * - * @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects + * @param components an array of + * {@link neqsim.thermo.component.ComponentInterface} objects */ public void setComponentArray(ComponentInterface[] components); @@ -428,7 +436,8 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int public double[] getProperties_GERG2008(); /** - * method to get density of a phase note: does not use Peneloux volume correction. + * method to get density of a phase note: does not use Peneloux volume + * correction. * * @return density with unit kg/m3 */ @@ -447,10 +456,10 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * removeComponent. * * - * @param name a {@link String} object - * @param moles a double + * @param name a {@link String} object + * @param moles a double * @param molesInPhase a double - * @param compNumber a int + * @param compNumber a int */ public void removeComponent(String name, double moles, double molesInPhase, int compNumber); @@ -619,7 +628,8 @@ public default double getExessGibbsEnergySymetric() { /** *
- * Getter for property beta
. Beta is the mole fraction of a phase of all the moles of
+ * Getter for property beta
. Beta is the mole fraction of a phase
+ * of all the moles of
* a system.
*
- * Setter for property beta
. Beta is the mole fraction of a phase of all the moles of
+ * Setter for property beta
. Beta is the mole fraction of a phase
+ * of all the moles of
* a system.
*
- * Change the number of moles of component of phase,i.e., numberOfMolesInPhase
but do
+ * Change the number of moles of component of phase,i.e.,
+ * numberOfMolesInPhase
but do
* not change the total number of moles of component in system.
*
- * NB! Phase fraction beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of of total number of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be
+ * done separately to
+ * keep consistency between phase and component calculation of of total number
+ * of moles in system.
*
- * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
, and
- * total number of moles of component in system, i.e., numberOfMoles
with the same
+ * Change the number of moles of component of phase, i.e.,
+ * numberOfMolesInPhase
, and
+ * total number of moles of component in system, i.e.,
+ * numberOfMoles
with the same
* amount.
*
- * NB! Phase fraction beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of of total number of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be
+ * done separately to
+ * keep consistency between phase and component calculation of of total number
+ * of moles in system.
*
- * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
and
- * Component
properties for the number of moles of component of phase, i.e.,
- * numberOfMolesInPhase
, and total number of moles of component in system, i.e.,
+ * Change the number of moles of component of phase, i.e.,
+ * numberOfMolesInPhase
and
+ * Component
properties for the number of moles of component of
+ * phase, i.e.,
+ * numberOfMolesInPhase
, and total number of moles of component in
+ * system, i.e.,
* numberOfMoles
with separate amounts.
*
- * NB! Phase fraction beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of of total number of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be
+ * done separately to
+ * keep consistency between phase and component calculation of of total number
+ * of moles in system.
*
- * Get sum of mole fractions for all components. NB! init(0) must be called first. + * Get sum of mole fractions for all components. NB! init(0) must be called + * first. *
* * @return a double @@ -234,7 +247,8 @@ public default String[][] calcResultTable() { public double getMoleFractionsSum(); /** - * method to get the speed of sound of a system. The sound speed is implemented based on a molar + * method to get the speed of sound of a system. The sound speed is implemented + * based on a molar * average over the phases * * @param unit Supported units are m/s, km/h @@ -243,7 +257,8 @@ public default String[][] calcResultTable() { public double getSoundSpeed(String unit); /** - * method to get the speed of sound of a system. The sound speed is implemented based on a molar + * method to get the speed of sound of a system. The sound speed is implemented + * based on a molar * average over the phases * * @return speed of sound in m/s @@ -272,7 +287,8 @@ public default String[][] calcResultTable() { public void initPhysicalProperties(String propertyName); /** - * Calculates thermodynamic and physical properties of a fluid using initThermoProperties() and + * Calculates thermodynamic and physical properties of a fluid using + * initThermoProperties() and * initPhysicalProperties(). */ public void initProperties(); @@ -290,13 +306,15 @@ public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterfa return newFluid; } - /** * method to return interfacial tension between two phases. * - * @param phase1 phase type of phase1 as string (valid phases are gas, oil, aqueous) - * @param phase2 phase type of phase2 as string (valid phases are gas, oil, aqueous) - * @return interfacial tension with unit N/m. If one or both phases does not exist - the method + * @param phase1 phase type of phase1 as string (valid phases are gas, oil, + * aqueous) + * @param phase2 phase type of phase2 as string (valid phases are gas, oil, + * aqueous) + * @return interfacial tension with unit N/m. If one or both phases does not + * exist - the method * will return NaN */ public double getInterfacialTension(String phase1, String phase2); @@ -317,7 +335,7 @@ public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterfa * * @param phase1 phase number of phase1 * @param phase2 phase number of phase2 - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object * @return interfacial tension with specified unit */ public double getInterfacialTension(int phase1, int phase2, String unit); @@ -356,8 +374,10 @@ public default double getGamma2() { /** * method to return flow rate of fluid. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, m3/min, m3/hr, - * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, + * m3/min, m3/hr, + * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, + * mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -373,7 +393,7 @@ public default double getGamma2() { * method to set the pressure of a fluid (same pressure for all phases). * * @param newPressure in specified unit - * @param unit unit can be bar, bara, barg or atm + * @param unit unit can be bar, bara, barg or atm */ public void setPressure(double newPressure, String unit); @@ -392,7 +412,7 @@ public default double getGamma2() { * * * @param newTemperature a double - * @param phaseNumber a int + * @param phaseNumber a int */ public void setTemperature(double newTemperature, int phaseNumber); @@ -400,12 +420,13 @@ public default double getGamma2() { * method to set the temperature of a fluid (same temperature for all phases). * * @param newTemperature in specified unit - * @param unit unit can be C or K (Celsius or Kelvin) + * @param unit unit can be C or K (Celsius or Kelvin) */ public void setTemperature(double newTemperature, String unit); /** - * method to return the volume fraction of a phase note: without Peneloux volume correction. + * method to return the volume fraction of a phase note: without Peneloux volume + * correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -413,7 +434,8 @@ public default double getGamma2() { public double getVolumeFraction(int phaseNumber); /** - * method to return the volume fraction of a phase note: with Peneloux volume correction. + * method to return the volume fraction of a phase note: with Peneloux volume + * correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -507,7 +529,7 @@ public default void removeMoles() { * saveObjectToFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object */ public void saveObjectToFile(String filePath, String fluidName); @@ -517,7 +539,7 @@ public default void removeMoles() { * readObjectFromFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object * @return a {@link neqsim.thermo.system.SystemInterface} object */ @@ -585,7 +607,7 @@ public default void removeMoles() { * changeComponentName. * * - * @param name a {@link java.lang.String} object + * @param name a {@link java.lang.String} object * @param newName a {@link java.lang.String} object */ public void changeComponentName(String name, String newName); @@ -697,8 +719,10 @@ public default boolean IsPhase(int i) { * * * @param flowRate a double - * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, kg/min, kg/hr - * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, Sm3/day, idSm3/hr, idSm3/day + * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, + * kg/min, kg/hr + * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, + * Sm3/day, idSm3/hr, idSm3/day */ public void setTotalFlowRate(double flowRate, String flowunit); @@ -850,7 +874,7 @@ public default boolean IsPhase(int i) { * saveObject. * * - * @param ID a int + * @param ID a int * @param text a {@link java.lang.String} object */ public void saveObject(int ID, String text); @@ -933,7 +957,8 @@ public default boolean IsPhase(int i) { /** *- * This method is used to set the total molar composition of a fluid. The total flow rate will be + * This method is used to set the total molar composition of a fluid. The total + * flow rate will be * kept constant. The input mole fractions will be normalized. *
* @@ -942,10 +967,12 @@ public default boolean IsPhase(int i) { public void setMolarComposition(double[] moles); /** - * return the phase of to specified type if the phase does not exist, the method will return null. + * return the phase of to specified type if the phase does not exist, the method + * will return null. * - * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, hydrate are - * supported) + * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, + * hydrate are + * supported) * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ public PhaseInterface getPhaseOfType(String phaseTypeName); @@ -964,8 +991,8 @@ public default boolean IsPhase(int i) { * * @param componentName selected name of the component to be added * @param numberOfMoles number of moles to be added - * @param molarMass molar mass of the component in kg/mol - * @param density density of the component in g/cm3 + * @param molarMass molar mass of the component in kg/mol + * @param density density of the component in g/cm3 */ public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, double density); @@ -975,13 +1002,13 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo * addTBPfraction. * * - * @param componentName a {@link java.lang.String} object - * @param numberOfMoles a double - * @param molarMass a double - * @param density a double + * @param componentName a {@link java.lang.String} object + * @param numberOfMoles a double + * @param molarMass a double + * @param density a double * @param criticalTemperature a double - * @param criticalPressure a double - * @param acentricFactor a double + * @param criticalPressure a double + * @param acentricFactor a double */ public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, double density, double criticalTemperature, double criticalPressure, double acentricFactor); @@ -993,8 +1020,8 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo * * @param componentName a {@link java.lang.String} object * @param numberOfMoles a double - * @param molarMass a double - * @param density a double + * @param molarMass a double + * @param density a double */ public void addPlusFraction(String componentName, double numberOfMoles, double molarMass, double density); @@ -1005,7 +1032,7 @@ public void addPlusFraction(String componentName, double numberOfMoles, double m * * * @param componentName a {@link java.lang.String} object - * @param value a double + * @param value a double */ public void addSalt(String componentName, double value); @@ -1096,13 +1123,14 @@ public default boolean hasSolidPhase() { * * * @param model a {@link java.lang.String} object - * @param val a double + * @param val a double * @param phase a int */ public void tuneModel(String model, double val, int phase); /** - * add a component to a fluid. If component already exists, the moles will be added to the + * add a component to a fluid. If component already exists, the moles will be + * added to the * existing component. * * @param inComponent Component object to add. @@ -1110,30 +1138,38 @@ public default boolean hasSolidPhase() { public void addComponent(ComponentInterface inComponent); /** - * add a component to a fluid. If component already exists, the moles will be added to the + * add a component to a fluid. If component already exists, the moles will be + * added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for component in the database. + * @param name Name of the component to add. See NeqSim database for component + * in the database. */ public void addComponent(String name); /** - * add a component to a fluid. If component already exists, the moles will be added to the + * add a component to a fluid. If component already exists, the moles will be + * added to the * existing component. * - * @param moles number of moles (per second) of the component to be added to the fluid - * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the + * fluid + * @param name Name of the component to add. See NeqSim database for component + * in the database. */ public void addComponent(String name, double moles); /** - * add a component to a fluid. If component already exists, the moles will be added to the + * add a component to a fluid. If component already exists, the moles will be + * added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param value The amount - * @param unitName the unit of rate (sported units are kg/sec, mol/sec, Nlitre/min, kg/hr, - * Sm^3/hr, Sm^3/day, MSm^3/day .. + * @param name Name of the component to add. See NeqSim database for + * component in the database. + * @param value The amount + * @param unitName the unit of rate (sported units are kg/sec, mol/sec, + * Nlitre/min, kg/hr, + * Sm^3/hr, Sm^3/day, MSm^3/day .. */ public void addComponent(String name, double value, String unitName); @@ -1142,30 +1178,37 @@ public default boolean hasSolidPhase() { * addComponent. * * - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param moles number of moles (per second) of the component to be added to the fluid - * @param TC Critical temperature - * @param PC Critical pressure - * @param acs a double + * @param name Name of the component to add. See NeqSim database for component + * in the database. + * @param moles number of moles (per second) of the component to be added to the + * fluid + * @param TC Critical temperature + * @param PC Critical pressure + * @param acs a double */ public void addComponent(String name, double moles, double TC, double PC, double acs); /** - * add a component to a fluid. If component already exists, the moles will be added to the + * add a component to a fluid. If component already exists, the moles will be + * added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param moles number of moles (per second) of the component to be added to the fluid + * @param name Name of the component to add. See NeqSim database for + * component in the database. + * @param moles number of moles (per second) of the component to be added + * to the fluid * @param phaseNumber Number of the phase to add the component to */ public void addComponent(String name, double moles, int phaseNumber); /** - * add a component to a fluid. I component already exists, it will be added to the component + * add a component to a fluid. I component already exists, it will be added to + * the component * - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param value rate of the component to add to the fluid - * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) + * @param name Name of the component to add. See NeqSim database for + * component in the database. + * @param value rate of the component to add to the fluid + * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) * @param phaseNumber Number of the phase to add the component to */ public void addComponent(String name, double value, String unitName, int phaseNumber); @@ -1176,7 +1219,8 @@ public default boolean hasSolidPhase() { * * * @param index Component number to add - * @param moles number of moles (per second) of the component to be added to the fluid + * @param moles number of moles (per second) of the component to be added to the + * fluid */ public void addComponent(int index, double moles); @@ -1185,8 +1229,9 @@ public default boolean hasSolidPhase() { * addComponent. * * - * @param index Component number to add - * @param moles number of moles (per second) of the component to be added to the fluid + * @param index Component number to add + * @param moles number of moles (per second) of the component to be added + * to the fluid * @param phaseNumber Number of the phase to add the component to */ public void addComponent(int index, double moles, int phaseNumber); @@ -1196,7 +1241,8 @@ public default boolean hasSolidPhase() { * removeComponent. * * - * @param name Name of the component to remove. See NeqSim database for component in the database. + * @param name Name of the component to remove. See NeqSim database for + * component in the database. */ public void removeComponent(String name); @@ -1223,7 +1269,8 @@ public default boolean hasSolidPhase() { /** *
- * Setter for property beta
. NB! Sets beta = b for first phase and 1-b for second
+ * Setter for property beta
. NB! Sets beta = b for first phase and
+ * 1-b for second
* phase, not for multiphase systems.
*
this.phaseIndex[index] = phaseIndex;
*
*
- * @param index a int
+ * @param index a int
* @param phaseIndex a int
*/
public void setPhaseIndex(int index, int phaseIndex);
/**
*
- * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure and temperature
+ * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure
+ * and temperature
* from the currently existing phase object at index numb
*
- * Calculate system beta values using Phase.getNumberOfMolesInPhase and getTotalNumberOfMoles. + * Calculate system beta values using Phase.getNumberOfMolesInPhase and + * getTotalNumberOfMoles. *
*/ public void initBeta(); @@ -1924,7 +2005,7 @@ public double calcBeta() * Change the phase type of a given phase. * * @param phaseToChange the phase number of the phase to set phase type - * @param newPhaseType the phasetype number to set + * @param newPhaseType the phasetype number to set * @deprecated Replaced by {@link setPhaseType} */ @Deprecated @@ -1946,14 +2027,14 @@ public default void setPhaseType(int phaseToChange, String phaseTypeName) { * Change the phase type of a given phase. * * @param phaseToChange the phase number of the phase to set phase type - * @param pt PhaseType to set + * @param pt PhaseType to set */ public void setPhaseType(int phaseToChange, PhaseType pt); /** * Set phase type of all phases. * - * @param phases Set to "all" to set all phases, else nothing happens. + * @param phases Set to "all" to set all phases, else nothing happens. * @param newPhaseType the phasetype number to set * @deprecated Replaced by {@link setAllPhaseType} */ @@ -2177,7 +2258,8 @@ public default ComponentInterface getComponent(int i) { public PhaseInterface getLiquidPhase(); /** - * method to return compressibility factor of a fluid compressibility factor is defined in EoS + * method to return compressibility factor of a fluid compressibility factor is + * defined in EoS * from PV=ZnRT where V is total volume of fluid. * * @return compressibility factor Z @@ -2194,7 +2276,7 @@ public default ComponentInterface getComponent(int i) { /** * method to return viscosity in a specified unit. * - * @param unit Supported units are kg/msec, cP (centipoise) + * @param unit Supported units are kg/msec, cP (centipoise), Pas (Pascal*second) * @return viscosity in specified unit */ public double getViscosity(String unit); @@ -2280,7 +2362,7 @@ public default ComponentInterface getComponent(int i) { * method to return phase fraction of selected phase. * * @param phaseTypeName gas/oil/aqueous - * @param unit mole/volume/weight + * @param unit mole/volume/weight * @return phase: fraction in specified unit */ public double getPhaseFraction(String phaseTypeName, String unit); @@ -2290,9 +2372,9 @@ public default ComponentInterface getComponent(int i) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param compName a {@link java.lang.String} object - * @param phase a int + * @param phase a int * @return a double */ public double getProperty(String prop, String compName, int phase); @@ -2302,7 +2384,7 @@ public default ComponentInterface getComponent(int i) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param phase a int * @return a double */ @@ -2582,10 +2664,10 @@ public void setImplementedCompositionDeriativesofFugacity( * addCharacterized. * * - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects * @param lastIsPlusFraction True if last fraction is a Plus fraction */ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, @@ -2596,12 +2678,12 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] * addCharacterized. * * - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects - * @param lastIsPlusFraction True if last fraction is a Plus fraction - * @param lumpComponents True if component should be lumped + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects + * @param lastIsPlusFraction True if last fraction is a Plus fraction + * @param lumpComponents True if component should be lumped * @param numberOfPseudoComponents number of pseudo components */ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, @@ -2613,9 +2695,9 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] * addCharacterized. * * - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects * @param relativedensity an array of {@link double} objects */ public void addCharacterized(String[] charNames, double[] charFlowrate, double[] molarMass, diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 58fa393a12..b4ea48097e 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -72,8 +72,10 @@ abstract class SystemThermo implements SystemInterface { protected double criticalPressure = 0; private double totalNumberOfMoles = 0; - // TODO: componentNameTag is not working yet, a kind of alias-postfix for Components from this - // system that will be passed on to other systems. used to find originator of specific components + // TODO: componentNameTag is not working yet, a kind of alias-postfix for + // Components from this + // system that will be passed on to other systems. used to find originator of + // specific components // or public String componentNameTag = ""; protected neqsim.thermo.characterization.WaxCharacterise waxCharacterisation = null; @@ -84,7 +86,7 @@ abstract class SystemThermo implements SystemInterface { protected int numberOfComponents = 0; // protected ArrayList- * Constructor for ChemicalReactionOperations. - *
- */ - public ChemicalReactionOperations() {} - /** ** Constructor for ChemicalReactionOperations. @@ -67,7 +60,6 @@ public ChemicalReactionOperations() {} * @param system a {@link neqsim.thermo.system.SystemInterface} object */ public ChemicalReactionOperations(SystemInterface system) { - initCalc = new LinearProgrammingChemicalEquilibrium(); boolean newcomps = true; int old = system.getPhase(0).getNumberOfComponents(); this.system = system; @@ -292,8 +284,21 @@ public String[] getAllElements() { *
* * @return a boolean + * @deprecated Replaced by hasReactions() */ + @Deprecated public boolean hasRections() { + return this.hasReactions(); + } + + /** + *+ * hasRections. + *
+ * + * @return a boolean + */ + public boolean hasReactions() { return components.length > 0; } diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java index 30ccb7e132..2cb1fce758 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java @@ -51,13 +51,6 @@ public class LinearProgrammingChemicalEquilibrium ChemicalReactionOperations operations; - /** - *- * Constructor for LinearProgrammingChemicalEquilibrium. - *
- */ - public LinearProgrammingChemicalEquilibrium() {} - /** ** Constructor for LinearProgrammingChemicalEquilibrium. diff --git a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java index fd76986e6c..44de80d170 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java @@ -37,13 +37,6 @@ public class ChemicalReactionList implements ThermodynamicConstantsInterface { double[][] tempReacMatrix; double[][] tempStocMatrix; - /** - *
- * Constructor for ChemicalReactionList. - *
- */ - public ChemicalReactionList() {} - /** ** readReactions. diff --git a/src/main/java/neqsim/chemicalReactions/kinetics/Kinetics.java b/src/main/java/neqsim/chemicalReactions/kinetics/Kinetics.java index ecc03c6f67..80b922cf48 100644 --- a/src/main/java/neqsim/chemicalReactions/kinetics/Kinetics.java +++ b/src/main/java/neqsim/chemicalReactions/kinetics/Kinetics.java @@ -25,13 +25,6 @@ public class Kinetics implements java.io.Serializable { double phiInfinite = 0.0; boolean isIrreversible; - /** - *
- * Constructor for Kinetics. - *
- */ - public Kinetics() {} - /** *
* Constructor for Kinetics.
@@ -62,7 +55,10 @@ public void calcKinetics() {}
*/
public double calcReacMatrix(PhaseInterface phase, PhaseInterface interPhase, int comp) {
ChemicalReaction reaction;
- double reacCoef = 0.0, irr = 0.0, ktemp = 0.0, exponent = 0.0;
+ double reacCoef = 0.0;
+ double irr = 0.0;
+ double ktemp = 0.0;
+ double exponent = 0.0;
Iterator
* Constructor for SampleXYDataSource.
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java
index 2fd33b1aaa..0656a2906c 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java
@@ -61,13 +61,6 @@ public abstract class FluidBoundary implements FluidBoundaryInterface, java.io.S
protected double[] prandtlNumber;
protected int solverType = 0;
- /**
- *
- * Constructor for FluidBoundary.
- *
* Constructor for FluidBoundary.
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/equilibriumFluidBoundary/EquilibriumFluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/equilibriumFluidBoundary/EquilibriumFluidBoundary.java
index 87f1bdeb68..bdba405441 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/equilibriumFluidBoundary/EquilibriumFluidBoundary.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/equilibriumFluidBoundary/EquilibriumFluidBoundary.java
@@ -19,13 +19,6 @@ public class EquilibriumFluidBoundary
extends neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.FluidBoundary {
private static final long serialVersionUID = 1000;
- /**
- *
- * Constructor for EquilibriumFluidBoundary.
- *
* Constructor for EquilibriumFluidBoundary.
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java
index 9e1db0eecc..4458546fc0 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java
@@ -26,13 +26,6 @@ public abstract class NonEquilibriumFluidBoundary
public double[][] molFractionDifference;
- /**
- *
- * Constructor for NonEquilibriumFluidBoundary.
- *
* Constructor for NonEquilibriumFluidBoundary.
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java
index b9a562bdef..bc527dfac1 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java
@@ -27,13 +27,6 @@ public class KrishnaStandartFilmModel extends
Matrix redCorrectionMatrix;
Matrix betaMatrix;
- /**
- *
- * Constructor for KrishnaStandartFilmModel.
- *
* Constructor for KrishnaStandartFilmModel.
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java
index fa2eb461a0..1f57f01475 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java
@@ -26,13 +26,6 @@ public abstract class ReactiveFluidBoundary extends KrishnaStandartFilmModel {
public double[][] molFractionDifference;
- /**
- *
- * Constructor for ReactiveFluidBoundary.
- *
* Constructor for ReactiveFluidBoundary.
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveKrishnaStandartFilmModel.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveKrishnaStandartFilmModel.java
index b65f1e4f94..eee40422b8 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveKrishnaStandartFilmModel.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveKrishnaStandartFilmModel.java
@@ -26,13 +26,6 @@ public class ReactiveKrishnaStandartFilmModel extends KrishnaStandartFilmModel {
int enhancementType = 1;
- /**
- *
- * Constructor for ReactiveKrishnaStandartFilmModel.
- *
* Constructor for ReactiveKrishnaStandartFilmModel.
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java
index cfbeb38504..7a7eb94443 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java
@@ -60,12 +60,7 @@ public WaxDepositionFlowNode(SystemInterface system, GeometryDefinitionInterface
*/
public WaxDepositionFlowNode(SystemInterface system, SystemInterface interphaseSystem,
GeometryDefinitionInterface pipe) {
- super(system, pipe);
- this.flowNodeType = "wax deposition node";
- this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this);
- this.fluidBoundary =
- new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel(
- this);
+ this(system, pipe);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java
index fde87bc08a..283ba84cb2 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java
@@ -17,13 +17,6 @@ public class HeaterResponse {
public Double dischargeTemperature;
public Double duty;
- /**
- *
- * Constructor for HeaterResponse.
- *
* Constructor for HeaterResponse.
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java
index 6778269202..b33c98f311 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java
@@ -29,13 +29,6 @@ public class PumpResponse {
public Double massflow;
public Integer speed;
- /**
- *
- * Constructor for PumpResponse.
- *
* Constructor for PumpResponse.
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java
index 756230a71b..b8510364c1 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java
@@ -17,13 +17,6 @@ public class SeparatorResponse {
public Double massflow;
public Fluid gasFluid, liquidFluid, oilFluid, waterFluid;
- /**
- *
- * Constructor for SeparatorResponse.
- *
* Constructor for SeparatorResponse.
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
index 113f470538..fea4ade7d4 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
@@ -21,12 +21,6 @@ public class StreamResponse {
public Double massflowOil;
public Double massflowAqueous;
- /**
- * Constructor for StreamResponse. Constructor for StreamResponse.
- * Constructor for ThreePhaseSeparatorResponse.
- *
* Constructor for ThreePhaseSeparatorResponse.
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index b4ea48097e..a59ab638f2 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -2269,7 +2269,7 @@ public void setPhysicalPropertyModel(int type) {
@Override
public void chemicalReactionInit() {
chemicalReactionOperations = new ChemicalReactionOperations(this);
- chemicalSystem = chemicalReactionOperations.hasRections();
+ chemicalSystem = chemicalReactionOperations.hasReactions();
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/util/constants/FurstElectrolyteConstants.java b/src/main/java/neqsim/thermo/util/constants/FurstElectrolyteConstants.java
index 5bf1bae416..0a960a4ae9 100644
--- a/src/main/java/neqsim/thermo/util/constants/FurstElectrolyteConstants.java
+++ b/src/main/java/neqsim/thermo/util/constants/FurstElectrolyteConstants.java
@@ -14,7 +14,7 @@
* @author esol
* @version $Id: $Id
*/
-public class FurstElectrolyteConstants implements java.io.Serializable {
+public final class FurstElectrolyteConstants implements java.io.Serializable {
private static final long serialVersionUID = 1000;
// public static double[] furstParams = {0.0982e-6, 7.003e-6, 77.22e-6,
@@ -50,12 +50,11 @@ public class FurstElectrolyteConstants implements java.io.Serializable {
// 0.0000001880, 0.0000014139, 0.0000284666, 0.0000389043, -0.0000000451,
// 0.0000088136
+
/**
- *
- * Constructor for FurstElectrolyteConstants.
- *
From 8c9a45221b72aa5fb03e60797746266eccdfd3d9 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Sun, 3 Sep 2023 22:59:13 +0200
Subject: [PATCH 005/317] add test for pump chart (#816)
* add test
* added test for pump curve calculations
---
.../processEquipment/pump/Pump.java | 3 +-
.../processEquipment/pump/PumpTest.java | 146 +++++++++++-------
2 files changed, 93 insertions(+), 56 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java b/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java
index 02ce2e55b4..8163cff914 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java
@@ -169,7 +169,7 @@ public void run(UUID id) {
thermoOps.TPflash();
thermoSystem.init(3);
} else {
- if (calculateAsCompressor) {
+ if (!pumpChart.isUsePumpChart() && calculateAsCompressor) {
thermoSystem = inStream.getThermoSystem().clone();
thermoSystem.setPressure(pressure, pressureUnit);
// System.out.println("entropy inn.." + entropy);
@@ -185,6 +185,7 @@ public void run(UUID id) {
thermoOps = new ThermodynamicOperations(getThermoSystem());
thermoOps.PHflash(hout, 0);
} else if (pumpChart.isUsePumpChart()) {
+ thermoSystem = inStream.getThermoSystem().clone();
double pumpHead = 0.0;
pumpHead = getPumpChart().getHead(thermoSystem.getFlowRate("m3/hr"), getSpeed());
isentropicEfficiency =
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java
index bf1a16bf28..24a8688a47 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java
@@ -1,70 +1,106 @@
package neqsim.processSimulation.processEquipment.pump;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import neqsim.processSimulation.processEquipment.stream.Stream;
/**
- * PumpTest class.
+ * PumpTest class.
+ * referencePressure
.
*
referencePressure
.
*
*
- * @param referencePressure a double
+ * @param referencePressure Reference pressure to set in in bara
*/
public void setReferencePressure(double referencePressure) {
this.referencePressure = referencePressure;
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java
index 688b3cfbb1..6ab3770606 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java
@@ -99,7 +99,7 @@ public double getMeasuredValue(String unit) {
* Getter for the field referencePressure
.
*
*
- * @return a double
+ * @return Reference pressure in bara
*/
public double getReferencePressure() {
return referencePressure;
@@ -110,7 +110,7 @@ public double getReferencePressure() {
* Setter for the field referencePressure
.
*
*
- * @param referencePressure a double
+ * @param referencePressure Reference pressure to set in in bara
*/
public void setReferencePressure(double referencePressure) {
this.referencePressure = referencePressure;
diff --git a/src/main/java/neqsim/standards/Standard.java b/src/main/java/neqsim/standards/Standard.java
index 4a27d526e0..0373ede6f8 100644
--- a/src/main/java/neqsim/standards/Standard.java
+++ b/src/main/java/neqsim/standards/Standard.java
@@ -199,11 +199,15 @@ public void setReferenceState(String referenceState) {
this.referenceState = referenceState;
}
- public void setReferencePressure(double referencePressure) {
- this.referencePressure = referencePressure;
+ /** {@inheritDoc} */
+ @Override
+ public double getReferencePressure() {
+ return referencePressure;
}
- public double getReferencePressure(){
- return referencePressure;
+ /** {@inheritDoc} */
+ @Override
+ public void setReferencePressure(double referencePressure) {
+ this.referencePressure = referencePressure;
}
}
diff --git a/src/main/java/neqsim/standards/StandardInterface.java b/src/main/java/neqsim/standards/StandardInterface.java
index 7140224cc2..6449ccb17b 100644
--- a/src/main/java/neqsim/standards/StandardInterface.java
+++ b/src/main/java/neqsim/standards/StandardInterface.java
@@ -165,5 +165,21 @@ public interface StandardInterface {
*/
public void setResultTable(String[][] resultTable);
+ /**
+ *
+ * Getter for the field referencePressure
.
+ *
+ * Setter for the field referencePressure
.
+ *
referencePressure
.
*
*
- * @return a double
+ * @return Reference pressure in bara
*/
public double getReferencePressure() {
return referencePressure;
@@ -213,7 +213,7 @@ public double getReferencePressure() {
* Setter for the field referencePressure
.
*
*
- * @param referencePressure a double
+ * @param referencePressure Reference pressure to set in in bara
*/
public void setReferencePressure(double referencePressure) {
this.referencePressure = referencePressure;
From 2bc4ab619abccdf0165733e2c3c17244068b158a Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Mon, 9 Oct 2023 23:37:31 +0200
Subject: [PATCH 013/317] fix: upgrade org.ojalgo:ojalgo from 53.0.0 to 53.1.0
(#828)
Snyk has created this PR to upgrade org.ojalgo:ojalgo from 53.0.0 to 53.1.0.
See this package in Maven Repository:
https://mvnrepository.com/artifact/org.ojalgo/ojalgo/
See this project in Snyk:
https://app.snyk.io/org/evensol/project/5734e76a-5ebe-4fe0-9fb9-776e0cbc8504?utm_source=github&utm_medium=referral&page=upgrade-pr
Co-authored-by: snyk-bot setComposition.
+ *+ * setComposition. + *
* * @param fluid a {@link neqsim.thermo.system.SystemInterface} object * @param inputFile a {@link java.lang.String} object @@ -36,7 +38,9 @@ public static void setComposition(SystemInterface fluid, String inputFile, Strin } /** - *setComposition.
+ *+ * setComposition. + *
* * @param fluid a {@link neqsim.thermo.system.SystemInterface} object * @param inputFile a {@link java.lang.String} object @@ -107,7 +111,9 @@ public static void setComposition(SystemInterface fluid, String inputFile) { } /** - *read.
+ *+ * read. + *
* * @param inputFile a {@link java.lang.String} object * @param pseudoNameIn a {@link java.lang.String} object @@ -161,7 +167,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("CNAMES")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } names.add(st); @@ -169,7 +175,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("TCRIT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } TC.add(Double.parseDouble(st)); @@ -177,7 +183,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("PCRIT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } PC.add(Double.parseDouble(st)); @@ -185,7 +191,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("ACF")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } ACF.add(Double.parseDouble(st)); @@ -193,7 +199,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("MW")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } MW.add(Double.parseDouble(st)); @@ -201,7 +207,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("TBOIL")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } TBOIL.add(Double.parseDouble(st)); @@ -209,7 +215,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("VCRIT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } VCRIT.add(Double.parseDouble(st)); @@ -217,7 +223,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("SSHIFT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } SSHIFT.add(Double.parseDouble(st)); @@ -225,7 +231,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("PARACHOR")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } PARACHOR.add(Double.parseDouble(st)); @@ -233,7 +239,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("ZI")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } ZI.add(Double.parseDouble(st)); @@ -245,7 +251,7 @@ public static SystemInterface read(String inputFile) { kij = new double[names.size()][names.size()]; while ((st = br.readLine().replace("/", "")) != null) { numb++; - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } diff --git a/src/test/java/neqsim/thermo/util/readwrite/A-1.E300 b/src/test/java/neqsim/thermo/util/readwrite/A-1.E300 new file mode 100644 index 0000000000..f7f1e1c43b --- /dev/null +++ b/src/test/java/neqsim/thermo/util/readwrite/A-1.E300 @@ -0,0 +1,434 @@ +-- Dummy EOS for FluidMagic Test case +-- +-- Copyright (C) 2022 Equinor + +-- Units +METRIC +-- Number of components: +NCOMPS +22 / +-- Equation of state +EOS +PR / +PRCORR + +-- Reservoir temperature (C) +RTEMP + 90.00 / + +-- Standard Conditions (C and bara) +STCOND + 15.00000 1.01325 / + +-- Component names +CNAMES +N2 +CO2 +C1 +C2 +C3 +iC4 +C4 +iC5 +C5 +C6 +C7 +C8 +C9 +C10-C12 +C13-C14 +C15-C17 +C18-C21 +C22-C28 +C29-C36 +C37-C45 +C46-C58 +C59-C80 / +-- Tc (K) +TCRIT + 126.200 + 304.200 + 190.600 + 305.400 + 369.800 + 408.100 + 425.200 + 460.400 + 469.600 + 507.400 + 548.083 + 568.470 + 592.686 + 631.845 + 680.299 + 727.035 + 774.284 + 851.846 + 943.373 + 1038.592 + 1152.236 + 1317.304 / +-- Pc (Bar) +PCRIT + 33.9439 + 73.7646 + 46.0015 + 48.8387 + 42.4552 + 36.4770 + 37.9969 + 33.8426 + 33.7412 + 29.6882 + 29.4519 + 27.6423 + 25.5535 + 22.7296 + 20.0143 + 18.1224 + 16.7108 + 15.1759 + 14.0297 + 13.2891 + 12.7370 + 12.2645 +/ +-- Omega +ACF + 0.04000 + 0.22500 + 0.00800 + 0.09800 + 0.15200 + 0.17600 + 0.19300 + 0.22700 + 0.25100 + 0.29600 + 0.33744 + 0.37547 + 0.42325 + 0.50535 + 0.61393 + 0.72473 + 0.83712 + 1.00708 + 1.15740 + 1.21951 + 1.12382 + 0.62590 / +-- OmegaA +OMEGAA + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 / +-- OmegaB +OMEGAB + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 / +-- Molecular weights +MW + 28.0135 + 44.0098 + 16.0429 + 30.0698 + 44.0968 + 58.1237 + 58.1237 + 72.1507 + 72.1506 + 86.1776 + 96.0000 + 107.0000 + 121.0000 + 145.7094 + 181.9678 + 220.6919 + 264.4041 + 342.9118 + 447.3217 + 565.3735 + 714.4236 + 942.2227 / +-- Boiling points (K) +TBOIL + 77.400 + 194.650 + 111.600 + 184.600 + 231.100 + 261.400 + 272.700 + 301.000 + 309.200 + 341.900 + 365.100 + 389.900 + 415.400 + 459.042 + 509.712 + 555.777 + 599.945 + 669.261 + 738.465 + 799.356 + 865.446 + 950.674 / +-- Critical volumes (m3/kg-mole) +VCRIT + 0.08980 + 0.09400 + 0.09900 + 0.14800 + 0.20300 + 0.26300 + 0.25500 + 0.30600 + 0.30400 + 0.37000 + 0.47555 + 0.48784 + 0.52918 + 0.62175 + 0.75937 + 0.92679 + 1.12076 + 1.49307 + 2.00337 + 2.60288 + 3.39260 + 4.64881 / +-- Critical Z-factors +ZCRIT + 0.29049 + 0.27414 + 0.28737 + 0.28465 + 0.28029 + 0.28272 + 0.27406 + 0.27052 + 0.26270 + 0.26037 + 0.30733 + 0.28530 + 0.27440 + 0.26900 + 0.26869 + 0.27784 + 0.29091 + 0.31991 + 0.35833 + 0.40055 + 0.45103 + 0.52054 / +-- Volume translation/co-volume +SSHIFT + -0.175888 + -0.049181 + -0.194020 + -0.143142 + -0.112702 + -0.099214 + -0.089659 + -0.070455 + -0.056872 + 0.012573 + 0.074067 + 0.085121 + 0.081268 + 0.069060 + 0.048755 + 0.018239 + -0.017443 + -0.077518 + -0.156174 + -0.235730 + -0.320950 + -0.420868 / +-- Parachors (dyn/cm) +PARACHOR + 41.000 + 78.000 + 77.300 + 108.900 + 151.900 + 181.500 + 191.700 + 225.000 + 233.900 + 271.000 + 283.940 + 309.680 + 342.440 + 402.209 + 485.824 + 577.490 + 679.641 + 866.931 + 1111.372 + 1387.629 + 1739.859 + 2282.641 / +-- Overall dummy oil composition +ZI + 0.003912 + 0.003010 + 0.403275 + 0.076341 + 0.079752 + 0.011938 + 0.040929 + 0.013944 + 0.021568 + 0.027988 + 0.042936 + 0.043237 + 0.030898 + 0.043939 + 0.045143 + 0.022571 + 0.025180 + 0.021188 + 0.014111 + 0.012845 + 0.008955 + 0.006340 / +-- Binary interaction coefficients for PR +BIC + -0.0170 + 0.0311 0.1200 + 0.0515 0.1200 0.0000 + 0.0852 0.1200 0.0000 0.0000 + 0.1033 0.1200 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 + 0.0922 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1000 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 +/ +BICS + -0.0170 + 0.0311 0.1200 + 0.0515 0.1200 0.0000 + 0.0852 0.1200 0.0000 0.0000 + 0.1033 0.1200 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 + 0.0922 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1000 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 +/ +-- LBC coefficients +LBCCOEF + 0.1023000 0.0233640 0.0585330 -0.0407580 0.0093324 / + +-- Volume translation/co-volume at surface conditions +SSHIFTS + -0.175888 + -0.061524 + -0.194020 + -0.143142 + -0.112702 + -0.099214 + -0.089659 + -0.070455 + -0.056872 + 0.012573 + 0.073289 + 0.087351 + 0.090562 + 0.088354 + 0.076389 + 0.053077 + 0.022966 + -0.030899 + -0.104022 + -0.179642 + -0.262040 + -0.361298 / diff --git a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java index 6fa3b5feb7..e4048296a2 100644 --- a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java +++ b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java @@ -14,6 +14,7 @@ class EclipseFluidReadWriteTest extends neqsim.NeqSimTest { static neqsim.thermo.system.SystemInterface testSystem = null; File file = new File("src/test/java/neqsim/thermo/util/readwrite"); + String fileA1 = file.getAbsolutePath() + "/A-1.E300"; String fileA13 = file.getAbsolutePath() + "/A-13.E300"; String fileA17 = file.getAbsolutePath() + "/A-17.E300"; String fileA19 = file.getAbsolutePath() + "/A-19.E300"; @@ -22,8 +23,7 @@ class EclipseFluidReadWriteTest extends neqsim.NeqSimTest { * @throws java.lang.Exception */ @BeforeAll - static void setUpBeforeClass() throws Exception { - } + static void setUpBeforeClass() throws Exception {} /** * Test method for @@ -54,6 +54,17 @@ void testReadAndAddFluids() throws IOException { testOps.TPflash(); } + @Test + void testReadAndAddFluids2() throws IOException { + EclipseFluidReadWrite.pseudoName = "_A1"; + testSystem = EclipseFluidReadWrite.read(fileA1); + + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testSystem.setPressure(100.0, "bara"); + testSystem.setTemperature(25.0, "C"); + testOps.TPflash(); + } + @Test void testSetComposition() throws IOException { EclipseFluidReadWrite.pseudoName = "_A19"; From 40a30c4e0bf945f34f5ec9c89eb23d6b274bdbfd Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:20:14 +0200 Subject: [PATCH 017/317] Update NeqSimDataBase.java (#832) --- .../java/neqsim/util/database/NeqSimDataBase.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/neqsim/util/database/NeqSimDataBase.java b/src/main/java/neqsim/util/database/NeqSimDataBase.java index 224ea37402..359699b00e 100644 --- a/src/main/java/neqsim/util/database/NeqSimDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimDataBase.java @@ -55,11 +55,7 @@ public class NeqSimDataBase * */ public NeqSimDataBase() { - // Fill tables from csv-files if not initialized and not currently being - // initialized. - if (dataBaseType == "H2fromCSV" && !h2IsInitialized && !h2IsInitalizing) { - initH2DatabaseFromCSVfiles(); - } + setDataBaseType(dataBaseType); try { @@ -296,6 +292,12 @@ public static void setDataBaseType(String aDataBaseType) { public static void setDataBaseType(String aDataBaseType, String connectionString) { dataBaseType = aDataBaseType; + // Fill tables from csv-files if not initialized and not currently being + // initialized. + if (dataBaseType == "H2fromCSV" && !h2IsInitialized && !h2IsInitalizing) { + initH2DatabaseFromCSVfiles(); + } + if (connectionString != null) { NeqSimDataBase.connectionString = connectionString; } From 527ad4c21e6cf26f75f1a6ba903753be2593f525 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:27:19 +0200 Subject: [PATCH 018/317] add logo (#833) * Add files via upload * Update README.md * Update README.md * Add files via upload * Update README.md * Update README.md * Update README.md * Add files via upload * Delete docs/wiki/logonobackgroundsmalll.png * Delete docs/wiki/logonobackground.png * Update README.md * Update README.md * Update README.md --- README.md | 2 +- docs/wiki/neqsimlogocircleflatsmall.png | Bin 0 -> 17579 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 docs/wiki/neqsimlogocircleflatsmall.png diff --git a/README.md b/README.md index 4f91d6b382..d59048f6a5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# NeqSim +![NeqSim Logo](https://github.com/equinor/neqsim/main/logo/docs/wiki/neqsimlogocircleflatsmall.png) [![Build Status](https://neqsim.visualstudio.com/neqsim_cicd/_apis/build/status/neqsim_build?branchName=master)](https://neqsim.visualstudio.com/neqsim_cicd/_build/latest?definitionId=1&branchName=master) ![Build maven](https://github.com/equinor/neqsim/workflows/Build%20maven/badge.svg?branch=master) diff --git a/docs/wiki/neqsimlogocircleflatsmall.png b/docs/wiki/neqsimlogocircleflatsmall.png new file mode 100644 index 0000000000000000000000000000000000000000..a7bfa57b263e889f74260d4af8fdefefccac434a GIT binary patch literal 17579 zcmV(^K-IsAP)I0JJ&y-lVeH*9i5qCsyc-1vQD
z=A$AhOE=OWfnr`1+KrLW%63pv;M$vGLq2U{ 50d!J*W7F
z{>Wny*n4b-myxHOxcCY?a_8-qtt&ugnwDO?Jpqo@(D5W)z>7R7&i|(n=?Pn9!+W2S
zhj@je(jTCq4{T@1CQmz9CeM7f#KB O+n614?YvKQSnR@y`>eFU0{GfyJvRold#G
z;9iNmt`LAlf;!>~07#*=5NJd2$k;&QU0Bj*q~QGIxP8aZ{gf+#<-YIURu+BA BG7-SoG=W{ty#
z{pm7P(Ny67DT78S+d^jJcEQzexAM^Gnxf8E^~>$kH~owM{>o*~ewMxQl`q#6GHct<
zxyHuF&$CSVQoHBgd+bHmU2Cs+@zplBP_Z-4*d;z=_NO=8C=YhElyrfefBE%x*L?@9
z#1A*Cy$b&=tB4pSP}aW_&5KdiTCiI_^}AL*G9zzt*go{(|7&};Y_*2KUDfngH|Iw^XK)%1$3;!@wgXy>**Ij}m&oW#supGz39x(Qea1pr4}4%6`3KnZ;Oa}Al&
z9X-CY8UIz$iVSf~%76azo@4*xJ#Vq2$L2gQeD#Dw^7y{VynXmLf80L#_aC#*eEy?$
z#%1TrL*(2*mtS&@^3C4*BmdJ5JaWKxTy(j=v-_GizelMpd-EG#1p4gGyYCl3584~P
z`;}I!JYc``hd*mGOG`2^^Dq5YyV2Pu4_jkL`CrxQ@+haBw!=R3yFYDbUwDqa>6I_D
zh30}yA2}!wCqO~V9&JB0>aVZWDcUXQtUs;J)0YYS*aR0bHlZL&4@yu~2TEkXl(Qzq
zwp6D(@K#U+TR+e(7giF;AVZ_0c9A@WoVxwO`+v;7`^C@Eb;Va5v=jc2xnj?}?3wn`
z7rof7zxI`O$pz>5v<1u3KzO(HTaP^M@8&*s#~1BiZvKe>j;-dq@Oq{CH@{T3T^GID
z?)>^4Rvg%5Z-4X4ZT~%Au&bVRwmgagV-Y{12r(50!Vvn*XYIMyNluO2H@)FHyXV#q
zd+ytR;3w_gdmpr7UgbQnT}3hLq_mE>?gBwae`BYJz|p6`
- * Constructor for DataSmoothor.
- *
@@ -42,7 +44,7 @@ public DataSmoothor() {}
* @param ld a int
* @param m a int
*/
- public DataSmoothor(double[] nonSmoothedNumbers, int nl, int nr, int ld, int m) {
+ public DataSmoother(double[] nonSmoothedNumbers, int nl, int nr, int ld, int m) {
this.nonSmoothedNumbers = new double[nonSmoothedNumbers.length];
this.smoothedNumbers = new double[nonSmoothedNumbers.length];
this.cCoef = new double[nonSmoothedNumbers.length];
@@ -157,21 +159,4 @@ public void setSmoothedNumbers() {
public double[] getSmoothedNumbers() {
return smoothedNumbers;
}
-
- /**
- *
- * main.
- * K-}asa2WtppK5Z>Sdc1d+&?3+Vp~eh=))eXrMIUWqV6#{^?KEU4wiiWh3>|
z?|Ssz0}0;4BO#@7&@%mWk#zt}$?om)kpP%msB8Q_f{?fJpy@CQ0;7=DU+9%}yJZmq
z{Yc5)5yb=GhaJUX0R=fjdGoi_o-sA(uMD&`70^jWv8>cJQt(zPFYn+7d8B(<7}1=A
zhoKG%(piU4<9SU2W%2Pi2au`p0KDK~@F0ONzzlU97|7{u!4J9cG}J?mj?GqD_JUn`
zyL@}W>J1DM+GTabiYMqq2i`^3u0?%xb(PX9X|%H}jk?EC;0gGWN1e$L>QN`~(ji%*
zOl$*qx~`$vPBx;*kwk_k_b7ILsaH?eyxik+u}Dif7K8-19i?}8t|7sTrBat`R1T1Q^zec`
z_}HwLo|
3%v{AE
zPIB;4IB)aMAHLhZe(T?<>`|9xt-beta = numberOfMolesInPhase/numberOfMolesInSystem
. NB!
- * numberOfMolesInSystem is
+ * beta = numberOfMolesInPhase/numberOfMolesInSystem
. NB! numberOfMolesInSystem is
* not known to the phase.
*/
double beta = 1.0;
/**
- * Number of moles in phase.
- * numberOfMolesInPhase = numberOfMolesInSystem*beta
. NB!
+ * Number of moles in phase. numberOfMolesInPhase = numberOfMolesInSystem*beta
. NB!
* numberOfMolesInSystem is not known to the phase.
*/
public double numberOfMolesInPhase = 0;
@@ -103,7 +101,7 @@ public Phase clone() {
* addcomponent. Increase number of components and add moles to phase.
*
+ * testMolarVolume. + *
+ */ + @Test + @DisplayName("test testMolarVolume calc whre unit as input") + public void testMolarVolume() { + neqsim.thermo.system.SystemInterface testSystem = + new neqsim.thermo.system.SystemPrEos(298.0, 10.0); + testSystem.addComponent("nitrogen", 0.01); + testSystem.addComponent("CO2", 0.01); + testSystem.addComponent("methane", 0.68); + testSystem.addComponent("ethane", 0.1); + testSystem.setMixingRule("classic"); + testModel = new neqsim.thermo.ThermodynamicModelTest(testSystem); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testOps.TPflash(); + testSystem.initProperties(); + assertEquals(testSystem.getMolarVolume("m3/mol"), + testSystem.getMolarMass("kg/mol") / testSystem.getDensity("kg/m3")); + } + + + /** *
* testTPflash2.
From 5e0caba6e31af611df15299084bbad96d3923782 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Tue, 7 Nov 2023 18:17:39 +0100
Subject: [PATCH 022/317] fix: upgrade org.ojalgo:ojalgo from 53.1.0 to 53.1.1
(#837)
Snyk has created this PR to upgrade org.ojalgo:ojalgo from 53.1.0 to 53.1.1.
See this package in Maven Repository:
https://mvnrepository.com/artifact/org.ojalgo/ojalgo/
See this project in Snyk:
https://app.snyk.io/org/evensol/project/5734e76a-5ebe-4fe0-9fb9-776e0cbc8504?utm_source=github&utm_medium=referral&page=upgrade-pr
Co-authored-by: snyk-bot
- * calcIdealAirGasRatio
- *
+ * FlowSetter class. + *
+ * + * @author esol + * @version $Id: $Id + */ +public class FlowSetter extends TwoPortEquipment { + private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(GORfitter.class); + + double pressure = 1.01325; + double temperature = 15.0; + String unitT = "C"; + String unitP = "bara"; + + private double gasFlowRate; + private double oilFlowRate; + private double waterFlowRate; + String unitGasFlowRate = "Sm3/day"; + String unitOilFlowRate = "m3/hr"; + String unitWaterFlowRate = "m3/hr"; + + @Deprecated + /** + *+ * Constructor for FlowSetter. + *
+ */ + public FlowSetter() { + super("Flow Setter"); + } + + /** + *+ * Constructor for FlowSetter. + *
+ * + * @param stream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object + */ + @Deprecated + public FlowSetter(StreamInterface stream) { + this("Flow Setter", stream); + } + + /** + *+ * Constructor for FlowSetter. + *
+ * + * @param name a {@link java.lang.String} object + * @param stream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object + */ + public FlowSetter(String name, StreamInterface stream) { + super(name, stream); + } + + + /** + * {@inheritDoc} + * + *
+ * Setter for the field inletStream
.
+ *
+ * Getter for the field pressure
.
+ *
+ * Setter for the field pressure
.
+ *
+ * getTemperature. + *
+ * + * @return a double + */ + public double getTemperature() { + return temperature; + } + + /** + *
+ * Setter for the field temperature
.
+ *
+ * Get setGasFlowRate + *
+ * + * @param flowRate flow rate + * @param flowUnit Supported units are Sm3/sec, Sm3/hr, Sm3/day, MSm3/day + * + */ + public void setGasFlowRate(double flowRate, String flowUnit) { + double conversionFactor = 1.0; + switch (flowUnit) { + case "Sm3/sec": + conversionFactor = 1.0; + break; + case "Sm3/hr": + conversionFactor = 1.0 / 3600.0; + break; + case "Sm3/day": + conversionFactor = 1.0 / 3600.0 / 24.0; + break; + default: + throw new RuntimeException("unit not supported " + flowUnit); + } + gasFlowRate = flowRate * conversionFactor; + } + + /** + *+ * Get getGasFlowRate + *
+ * + * @param flowUnit Supported units are Sm3/sec, Sm3/hr, Sm3/day, MSm3/day + * @return gas flow rate in unit sm3/sec + */ + public double getGasFlowRate(String flowUnit) { + double conversionFactor = 1.0; + switch (flowUnit) { + case "Sm3/sec": + conversionFactor = 1.0; + break; + case "Sm3/hr": + conversionFactor = 1.0 / 3600.0; + break; + case "Sm3/day": + conversionFactor = 1.0 / 3600.0 / 24.0; + break; + case "MSm3/day": + conversionFactor = 1.0 / 3600.0 / 24.0 / 1e6; + break; + default: + throw new RuntimeException("unit not supported " + flowUnit); + } + return gasFlowRate * conversionFactor; + } + + /** + *+ * Get setOilFlowRate + *
+ * + * @param flowRate flow rate + * @param flowUnit Supported units are m3/sec, m3/hr, m3/day + * + */ + public void setOilFlowRate(double flowRate, String flowUnit) { + double conversionFactor = 1.0; + switch (flowUnit) { + case "m3/sec": + conversionFactor = 1.0; + break; + case "m3/hr": + conversionFactor = 1.0 / 3600.0; + break; + case "m3/day": + conversionFactor = 1.0 / 3600.0 / 24.0; + break; + default: + throw new RuntimeException("unit not supported " + flowUnit); + } + oilFlowRate = flowRate * conversionFactor; + } + + /** + *+ * Get getOilFlowRate + *
+ * + * @param flowUnit Supported units are m3/sec, m3/hr, m3/day + * @return oil flow rate in unit m3/sec + */ + public double getOilFlowRate(String flowUnit) { + double conversionFactor = 1.0; + switch (flowUnit) { + case "m3/sec": + conversionFactor = 1.0; + break; + case "m3/hr": + conversionFactor = 1.0 / 3600.0; + break; + case "m3/day": + conversionFactor = 1.0 / 3600.0 / 24.0; + break; + default: + throw new RuntimeException("unit not supported " + flowUnit); + } + return oilFlowRate * conversionFactor; + } + + /** + *+ * Get setWaterFlowRate + *
+ * + * @param flowRate flow rate + * @param flowUnit Supported units are m3/sec, m3/hr, m3/day + * + */ + public void setWaterFlowRate(double flowRate, String flowUnit) { + double conversionFactor = 1.0; + switch (flowUnit) { + case "m3/sec": + conversionFactor = 1.0; + break; + case "m3/hr": + conversionFactor = 1.0 / 3600.0; + break; + case "m3/day": + conversionFactor = 1.0 / 3600.0 / 24.0; + break; + default: + throw new RuntimeException("unit not supported " + flowUnit); + } + waterFlowRate = flowRate * conversionFactor; + } + + /** + *+ * Get getWaterFlowRate + *
+ * + * @param flowUnit Supported units are m3/sec, m3/hr, m3/day + * @return water flow rate in unit m3/sec + */ + public double getWaterFlowRate(String flowUnit) { + double conversionFactor = 1.0; + switch (flowUnit) { + case "m3/sec": + conversionFactor = 1.0; + break; + case "m3/hr": + conversionFactor = 1.0 / 3600.0; + break; + case "m3/day": + conversionFactor = 1.0 / 3600.0 / 24.0; + break; + default: + throw new RuntimeException("unit not supported " + flowUnit); + } + return waterFlowRate * conversionFactor; + } + + /** {@inheritDoc} */ + @Override + public void run(UUID id) { + SystemInterface tempFluid = inStream.getThermoSystem().clone(); + double flow = tempFluid.getFlowRate("kg/sec"); + + if (flow < 1e-6) { + outStream.setThermoSystem(tempFluid); + return; + } + + tempFluid.setTemperature(temperature, unitT); + tempFluid.setPressure(pressure, unitP); + + ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid); + try { + thermoOps.TPflash(); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + + tempFluid.initPhysicalProperties("density"); + + double[] moleChange = new double[tempFluid.getNumberOfComponents()]; + for (int i = 0; i < tempFluid.getNumberOfComponents(); i++) { + moleChange[i] = tempFluid.getPhase("gas").getComponent(i).getx() + * (getGasFlowRate("Sm3/sec") / tempFluid.getPhase("gas").getMolarVolume("m3/mol")) + + tempFluid.getPhase("oil").getComponent(i).getx() + * (getOilFlowRate("m3/sec") / tempFluid.getPhase("oil").getMolarVolume("m3/mol")) + - tempFluid.getComponent(i).getNumberOfmoles(); + } + tempFluid.init(0); + for (int i = 0; i < tempFluid.getNumberOfComponents(); i++) { + tempFluid.addComponent(i, moleChange[i]); + } + if (waterFlowRate > 0) { + tempFluid.addComponent("water", waterFlowRate * 1000.0, "kg/sec"); + } + tempFluid.setPressure((inStream.getThermoSystem()).getPressure()); + tempFluid.setTemperature((inStream.getThermoSystem()).getTemperature()); + + try { + thermoOps.TPflash(); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + outStream.setThermoSystem(tempFluid); + outStream.setCalculationIdentifier(id); + setCalculationIdentifier(id); + } + +} diff --git a/src/main/java/neqsim/statistics/dataAnalysis/dataSmoothing/DataSmoother.java b/src/main/java/neqsim/statistics/dataanalysis/datasmoothing/DataSmoother.java similarity index 100% rename from src/main/java/neqsim/statistics/dataAnalysis/dataSmoothing/DataSmoother.java rename to src/main/java/neqsim/statistics/dataanalysis/datasmoothing/DataSmoother.java diff --git a/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java b/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java new file mode 100644 index 0000000000..0f71fec185 --- /dev/null +++ b/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java @@ -0,0 +1,53 @@ +package neqsim.processSimulation.processEquipment.util; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import neqsim.processSimulation.measurementDevice.MultiPhaseMeter; +import neqsim.processSimulation.processEquipment.stream.Stream; +import neqsim.thermo.system.SystemInterface; +import neqsim.thermo.system.SystemSrkEos; + +public class FlowSetterTest { + @Test + void testMain() { + SystemInterface testFluid = new SystemSrkEos(338.15, 50.0); + testFluid.addComponent("nitrogen", 1.205); + testFluid.addComponent("CO2", 1.340); + testFluid.addComponent("methane", 87.974); + testFluid.addComponent("ethane", 5.258); + testFluid.addComponent("propane", 3.283); + testFluid.addComponent("i-butane", 0.082); + testFluid.addComponent("n-butane", 0.487); + testFluid.addComponent("i-pentane", 0.056); + testFluid.addComponent("n-pentane", 1.053); + testFluid.addComponent("nC10", 4.053); + testFluid.addComponent("water", 10.00); + testFluid.setMixingRule(2); + testFluid.setMultiPhaseCheck(true); + + Stream stream_1 = new Stream("Stream1", testFluid); + stream_1.run(); + + MultiPhaseMeter multiPhaseMeter = new MultiPhaseMeter("test", stream_1); + multiPhaseMeter.setTemperature(15.0, "C"); + multiPhaseMeter.setPressure(1.01325, "bara"); + + FlowSetter flowset = new FlowSetter("flowset", stream_1); + flowset.setTemperature(15.0, "C"); + flowset.setPressure(1.01325, "bara"); + flowset.setGasFlowRate(multiPhaseMeter.getMeasuredValue("Gas Flow Rate", "Sm3/hr"), "Sm3/hr"); + flowset.setOilFlowRate(multiPhaseMeter.getMeasuredValue("Oil Flow Rate", "m3/hr"), "m3/hr"); + flowset.setWaterFlowRate(multiPhaseMeter.getMeasuredValue("Water Flow Rate", "m3/hr"), "m3/hr"); + neqsim.processSimulation.processSystem.ProcessSystem operations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + operations.add(stream_1); + operations.add(multiPhaseMeter); + operations.add(flowset); + operations.run(); + + assertEquals(flowset.getOutletStream().getFlowRate("kg/sec"), stream_1.getFlowRate("kg/sec"), + 1.0); + + flowset.getOutletStream().getFluid().prettyPrint(); + } +} From d80d2b7b238b16d3c45f5c2a7c84e26fb616935b Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:25:46 +0100 Subject: [PATCH 024/317] fix: upgrade org.apache.logging.log4j:log4j-core from 2.20.0 to 2.21.0 (#840) Snyk has created this PR to upgrade org.apache.logging.log4j:log4j-core from 2.20.0 to 2.21.0. See this package in Maven Repository: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core/ See this project in Snyk: https://app.snyk.io/org/evensol/project/5734e76a-5ebe-4fe0-9fb9-776e0cbc8504?utm_source=github&utm_medium=referral&page=upgrade-pr Co-authored-by: snyk-bot@@ -18,10 +24,9 @@ */ public class FlowSetter extends TwoPortEquipment { private static final long serialVersionUID = 1000; - static Logger logger = LogManager.getLogger(GORfitter.class); - - double pressure = 1.01325; - double temperature = 15.0; + private static final Logger logger = LogManager.getLogger(FlowSetter.class); + double[] pressure = new double[] {1.01325}; + double[] temperature = new double[] {15.0}; String unitT = "C"; String unitP = "bara"; @@ -32,6 +37,8 @@ public class FlowSetter extends TwoPortEquipment { String unitOilFlowRate = "m3/hr"; String unitWaterFlowRate = "m3/hr"; + ProcessSystem referenceProcess = null; + @Deprecated /** *
@@ -83,54 +90,6 @@ public void setInletStream(StreamInterface inletStream) { } } - /** - *
- * Getter for the field pressure
.
- *
- * Setter for the field pressure
.
- *
- * getTemperature. - *
- * - * @return a double - */ - public double getTemperature() { - return temperature; - } - - /** - *
- * Setter for the field temperature
.
- *
* Get setGasFlowRate
@@ -176,13 +135,13 @@ public double getGasFlowRate(String flowUnit) {
conversionFactor = 1.0;
break;
case "Sm3/hr":
- conversionFactor = 1.0 / 3600.0;
+ conversionFactor = 1.0 * 3600.0;
break;
case "Sm3/day":
- conversionFactor = 1.0 / 3600.0 / 24.0;
+ conversionFactor = 1.0 * 3600.0 * 24.0;
break;
case "MSm3/day":
- conversionFactor = 1.0 / 3600.0 / 24.0 / 1e6;
+ conversionFactor = 1.0 * 3600.0 * 24.0 / 1e6;
break;
default:
throw new RuntimeException("unit not supported " + flowUnit);
@@ -232,10 +191,10 @@ public double getOilFlowRate(String flowUnit) {
conversionFactor = 1.0;
break;
case "m3/hr":
- conversionFactor = 1.0 / 3600.0;
+ conversionFactor = 1.0 * 3600.0;
break;
case "m3/day":
- conversionFactor = 1.0 / 3600.0 / 24.0;
+ conversionFactor = 1.0 * 3600.0 * 24.0;
break;
default:
throw new RuntimeException("unit not supported " + flowUnit);
@@ -285,10 +244,10 @@ public double getWaterFlowRate(String flowUnit) {
conversionFactor = 1.0;
break;
case "m3/hr":
- conversionFactor = 1.0 / 3600.0;
+ conversionFactor = 1.0 * 3600.0;
break;
case "m3/day":
- conversionFactor = 1.0 / 3600.0 / 24.0;
+ conversionFactor = 1.0 * 3600.0 * 24.0;
break;
default:
throw new RuntimeException("unit not supported " + flowUnit);
@@ -301,49 +260,148 @@ public double getWaterFlowRate(String flowUnit) {
public void run(UUID id) {
SystemInterface tempFluid = inStream.getThermoSystem().clone();
+ if (referenceProcess == null) {
+ referenceProcess = createReferenceProcess(inStream);
+ }
+
if (tempFluid.getFlowRate("kg/sec") < 1e-6) {
outStream.setThermoSystem(tempFluid);
return;
}
- tempFluid.setTemperature(temperature, unitT);
- tempFluid.setPressure(pressure, unitP);
+ double error = 0.0;
+ do {
+ error = 0.0;
+ // ((StreamInterface) referenceProcess.getUnit("feed stream")).setFluid(tempFluid);
+ Stream ins = new Stream(tempFluid);
+ ins.run();
+ referenceProcess = createReferenceProcess(ins);
+ referenceProcess.run();
+ ((StreamInterface) referenceProcess.getUnit("gas")).getFluid()
+ .initPhysicalProperties("density");
+ ((StreamInterface) referenceProcess.getUnit("oil")).getFluid()
+ .initPhysicalProperties("density");
- ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
- try {
- thermoOps.TPflash();
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
- }
+ double[] moleChange = new double[tempFluid.getNumberOfComponents()];
+ for (int i = 0; i < tempFluid.getNumberOfComponents(); i++) {
+ moleChange[i] = ((StreamInterface) referenceProcess.getUnit("gas")).getFluid()
+ .getComponent(i).getNumberOfMolesInPhase()
+ * (getGasFlowRate("Sm3/hr")
+ / ((StreamInterface) referenceProcess.getUnit("gas")).getFlowRate("Sm3/hr"))
+ - ((StreamInterface) referenceProcess.getUnit("gas")).getFluid().getComponent(i)
+ .getNumberOfMolesInPhase()
- tempFluid.initPhysicalProperties("density");
+ + ((StreamInterface) referenceProcess.getUnit("oil")).getFluid().getComponent(i)
+ .getNumberOfMolesInPhase()
+ * (getOilFlowRate("m3/hr")
+ / ((StreamInterface) referenceProcess.getUnit("oil")).getFlowRate("m3/hr"))
+ - ((StreamInterface) referenceProcess.getUnit("oil")).getFluid().getComponent(i)
+ .getNumberOfMolesInPhase();
+ error += Math.abs(moleChange[i]);
+ }
+ tempFluid.init(0);
+ for (int i = 0; i < tempFluid.getNumberOfComponents(); i++) {
+ tempFluid.addComponent(i, moleChange[i]);
+ }
+
+ } while (error > ((StreamInterface) referenceProcess.getUnit("feed stream")).getFluid()
+ .getTotalNumberOfMoles() / 1e6);
- double[] moleChange = new double[tempFluid.getNumberOfComponents()];
- for (int i = 0; i < tempFluid.getNumberOfComponents(); i++) {
- moleChange[i] = tempFluid.getPhase("gas").getComponent(i).getx()
- * (getGasFlowRate("Sm3/sec") / tempFluid.getPhase("gas").getMolarVolume("m3/mol"))
- + tempFluid.getPhase("oil").getComponent(i).getx()
- * (getOilFlowRate("m3/sec") / tempFluid.getPhase("oil").getMolarVolume("m3/mol"))
- - tempFluid.getComponent(i).getNumberOfmoles();
- }
- tempFluid.init(0);
- for (int i = 0; i < tempFluid.getNumberOfComponents(); i++) {
- tempFluid.addComponent(i, moleChange[i]);
- }
if (waterFlowRate > 0) {
- tempFluid.addComponent("water", waterFlowRate * 1000.0, "kg/sec");
+ tempFluid.addComponent("water", getWaterFlowRate("m3/hr") * 1000.0, "kg/hr");
}
- tempFluid.setPressure((inStream.getThermoSystem()).getPressure());
- tempFluid.setTemperature((inStream.getThermoSystem()).getTemperature());
+ ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
+
outStream.setThermoSystem(tempFluid);
+ outStream.run();
+ outStream.getFluid().initPhysicalProperties();
+
outStream.setCalculationIdentifier(id);
setCalculationIdentifier(id);
}
+ public ProcessSystem createReferenceProcess(StreamInterface feedStream) {
+
+ ProcessSystem referenceProcess = new ProcessSystem();
+
+ StreamInterface feedStream1 = new Stream("feed stream", feedStream.getFluid().clone());
+ feedStream1.setTemperature(temperature[0], unitT);
+ feedStream1.setPressure(pressure[0], unitP);
+ referenceProcess.add(feedStream1);
+
+ ThreePhaseSeparator separator1ststage =
+ new ThreePhaseSeparator("1st stage separator", feedStream1);
+ referenceProcess.add(separator1ststage);
+
+ Mixer gasMixer = new Mixer("gas mixer");
+ gasMixer.addStream(separator1ststage.getGasOutStream());
+
+ StreamInterface gasExport = new Stream("gas", gasMixer.getOutletStream());
+ StreamInterface oilExport = null;
+
+ if (temperature.length == 0 || temperature == null) {
+ throw new RuntimeException(
+ new InvalidInputException(this, "getReferenceProcess", "temperature", "can not be null"));
+ } else if (temperature.length == 1) {
+ oilExport = new Stream("oil", separator1ststage.getOilOutStream());
+ } else if (temperature.length == 2) {
+ Heater heater2ndstage = new Heater("2nd stage heater", separator1ststage.getOilOutStream());
+ heater2ndstage.setOutPressure(pressure[1]);
+ heater2ndstage.setOutTemperature(temperature[1]);
+ referenceProcess.add(heater2ndstage);
+
+ ThreePhaseSeparator separator2ndstage =
+ new ThreePhaseSeparator("2nd stage separator", heater2ndstage.getOutletStream());
+ referenceProcess.add(separator2ndstage);
+
+ gasMixer.addStream(separator2ndstage.getGasOutStream());
+ oilExport = new Stream("oil", separator2ndstage.getOilOutStream());
+ } else if (temperature.length == 3) {
+ Heater heater2ndstage = new Heater("2nd stage heater", separator1ststage.getOilOutStream());
+ heater2ndstage.setOutPressure(pressure[1]);
+ heater2ndstage.setOutTemperature(temperature[1]);
+ referenceProcess.add(heater2ndstage);
+
+ ThreePhaseSeparator separator2ndstage =
+ new ThreePhaseSeparator("2nd stage separator", heater2ndstage.getOutletStream());
+ referenceProcess.add(separator2ndstage);
+
+ Heater heater3rdstage = new Heater("3rd stage heater", separator2ndstage.getOilOutStream());
+ heater3rdstage.setOutPressure(pressure[2]);
+ heater3rdstage.setOutTemperature(temperature[2]);
+ referenceProcess.add(heater3rdstage);
+
+ ThreePhaseSeparator separator3rdstage =
+ new ThreePhaseSeparator("3rd stage separator", heater3rdstage.getOutletStream());
+ referenceProcess.add(separator3rdstage);
+
+ gasMixer.addStream(separator2ndstage.getGasOutStream());
+ gasMixer.addStream(separator3rdstage.getGasOutStream());
+ oilExport = new Stream("oil", separator3rdstage.getOilOutStream());
+ }
+
+ referenceProcess.add(gasMixer);
+ referenceProcess.add(gasExport);
+ referenceProcess.add(oilExport);
+
+ return referenceProcess;
+ }
+
+ public ProcessSystem getReferenceProcess() {
+ return referenceProcess;
+ }
+
+ public void setSeparationPT(double[] pressure, String unitP, double[] temperature, String unitT) {
+ this.pressure = pressure;
+ this.unitP = unitP;
+ this.temperature = temperature;
+ this.unitT = unitT;
+ }
+
}
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java
index d0fcbc2785..5e63916e54 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java
@@ -375,8 +375,8 @@ public void stabilityAnalysis() {
iter++;
err = 0;
- if (iter <= 250 || !system.isImplementedCompositionDeriativesofFugacity()) {
- if (iter % 7 == 0) {
+ if (iter <= 150 || !system.isImplementedCompositionDeriativesofFugacity()) {
+ if (iter % 7 == 0 && iter < 150) {
double vec1 = 0.0;
double vec2 = 0.0;
@@ -396,6 +396,9 @@ public void stabilityAnalysis() {
err += Math.abs((logWi[i] - oldlogw[i]) / oldlogw[i]);
Wi[j][i] = Math.exp(logWi[i]);
}
+ if (err > errOld) {
+ continue;
+ }
} else {
for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) {
oldoldoldlogw[i] = oldoldlogw[i];
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java b/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java
index 3c07b50124..e101f2e17b 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java
@@ -35,8 +35,8 @@ void testMain() {
multiPhaseMeter.setPressure(1.01325, "bara");
FlowSetter flowset = new FlowSetter("flowset", stream_1);
- flowset.setTemperature(15.0, "C");
- flowset.setPressure(1.01325, "bara");
+ // flowset.setTemperature(15.0, "C");
+ // flowset.setPressure(1.01325, "bara");
flowset.setGasFlowRate(multiPhaseMeter.getMeasuredValue("Gas Flow Rate", "Sm3/hr"), "Sm3/hr");
flowset.setOilFlowRate(multiPhaseMeter.getMeasuredValue("Oil Flow Rate", "m3/hr"), "m3/hr");
flowset.setWaterFlowRate(multiPhaseMeter.getMeasuredValue("Water Flow Rate", "m3/hr"), "m3/hr");
@@ -50,7 +50,7 @@ void testMain() {
assertEquals(flowset.getOutletStream().getFlowRate("kg/sec"), stream_1.getFlowRate("kg/sec"),
1.0);
- flowset.getOutletStream().getFluid().prettyPrint();
+ // flowset.getOutletStream().getFluid().prettyPrint();
}
@Test
@@ -80,8 +80,6 @@ void testProcessWithFlowSetter() {
stream_1.setTemperature(80.0, "C");
FlowSetter flowset = new FlowSetter("flowset", stream_1);
- flowset.setTemperature(15.0, "C");
- flowset.setPressure(1.01325, "bara");
flowset.setGasFlowRate(gasFlow, "MSm3/day");
flowset.setOilFlowRate(oilFlow, "m3/hr");
flowset.setWaterFlowRate(waterFLow, "m3/hr");
@@ -100,7 +98,55 @@ void testProcessWithFlowSetter() {
operations.add(separator);
operations.run();
- feedStream.getThermoSystem().prettyPrint();
+ // feedStream.getThermoSystem().prettyPrint();
assertEquals(gasFlow, gasFromSepStream.getFlowRate("MSm3/day"), 1.0);
}
+
+ @Test
+ void testProcessWithFlowSetter2() {
+
+ double gasFlow = 10.0; // MSm3/day
+ double oilFlow = 2000.0; // m3/hr
+ double waterFlow = 1000.0; // m3/hr
+ SystemInterface testFluid = new SystemSrkEos(338.15, 50.0);
+ testFluid.addComponent("nitrogen", 1.205);
+ testFluid.addComponent("CO2", 1.340);
+ testFluid.addComponent("methane", 87.974);
+ testFluid.addComponent("ethane", 5.258);
+ testFluid.addComponent("propane", 3.283);
+ testFluid.addComponent("i-butane", 0.082);
+ testFluid.addComponent("n-butane", 0.487);
+ testFluid.addComponent("i-pentane", 0.056);
+ testFluid.addComponent("n-pentane", 1.053);
+ testFluid.addComponent("nC10", 40.053);
+ testFluid.addComponent("water", 10.00);
+ testFluid.setMixingRule(2);
+ testFluid.setMultiPhaseCheck(true);
+
+ Stream stream_1 = new Stream("Stream1", testFluid);
+ stream_1.run();
+ stream_1.setPressure(60.01325, "bara");
+ stream_1.setTemperature(50.0, "C");
+
+ FlowSetter flowset = new FlowSetter("flowset", stream_1);
+ double[] pressure = new double[] {50.0, 10.0, 1.01325};
+ double[] temperature = new double[] {15.0, 15.0, 15.0};
+ flowset.setSeparationPT(pressure, "bara", temperature, "C");
+ flowset.setGasFlowRate(gasFlow, "MSm3/day");
+ flowset.setOilFlowRate(oilFlow, "m3/hr");
+ flowset.setWaterFlowRate(waterFlow, "m3/hr");
+ flowset.run();
+
+
+ assertEquals(gasFlow,
+ ((StreamInterface) flowset.getReferenceProcess().getUnit("gas")).getFlowRate("MSm3/day"),
+ 0.01);
+ assertEquals(oilFlow,
+ ((StreamInterface) flowset.getReferenceProcess().getUnit("oil")).getFlowRate("m3/hr"),
+ 0.01);
+ assertEquals(waterFlow * 1000, ((StreamInterface) flowset.getOutletStream()).getFluid()
+ .getPhase("aqueous").getFlowRate("kg/hr"), waterFlow * 1000 / 100.0);
+
+ assertEquals(16.09, 16.09, 0.1);
+ }
}
diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/GudrunDegasser.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/GudrunDegasser.java
index 4525c9cb79..95a3d11523 100644
--- a/src/test/java/neqsim/thermodynamicOperations/flashOps/GudrunDegasser.java
+++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/GudrunDegasser.java
@@ -34,12 +34,12 @@ void setUp() throws Exception {
}
/**
- * Test method for {@link neqsim.thermodynamicOperations.flashOps.PHFlash#run()}.
+ * Test method for
+ * {@link neqsim.thermodynamicOperations.flashOps.PHFlash#run()}.
*/
@Test
void testRun() {
- neqsim.thermo.system.SystemInterface fluid1 =
- new neqsim.thermo.system.SystemSrkCPAstatoil(273.15 + 42.0, 10.00);
+ neqsim.thermo.system.SystemInterface fluid1 = new neqsim.thermo.system.SystemSrkCPAstatoil(273.15 + 42.0, 10.00);
fluid1.addComponent("nitrogen", 0.110282450914383);
fluid1.addComponent("CO2", 8.92014980316162);
@@ -84,7 +84,6 @@ void testRun() {
};
-
String[] componentNames = fluid1.getComponentNames();
for (int i = 0; i < intParameter.length; i++) {
@@ -122,41 +121,36 @@ void testRun() {
molarComposition.add(2.732003176453634);
molarComposition.add(27.978388438425913);
- double[] molarCompositionArray =
- molarComposition.stream().mapToDouble(Double::doubleValue).toArray();
+ double[] molarCompositionArray = molarComposition.stream().mapToDouble(Double::doubleValue).toArray();
neqsim.thermo.system.SystemInterface fluid_test_separator = fluid1.clone();
fluid_test_separator.setMolarComposition(molarCompositionArray);
- neqsim.processSimulation.processEquipment.stream.Stream inlet_stream_test_sep =
- new neqsim.processSimulation.processEquipment.stream.Stream("TEST_SEPARATOR_INLET",
- fluid_test_separator);
+ neqsim.processSimulation.processEquipment.stream.Stream inlet_stream_test_sep = new neqsim.processSimulation.processEquipment.stream.Stream(
+ "TEST_SEPARATOR_INLET",
+ fluid_test_separator);
inlet_stream_test_sep.setTemperature(72.6675872802734, "C");
inlet_stream_test_sep.setPressure(10.6767892837524, "bara");
inlet_stream_test_sep.setFlowRate(721.3143271348611, "kg/hr");
inlet_stream_test_sep.run();
-
- neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator test_separator =
- new neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator(
- inlet_stream_test_sep);
+ neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator test_separator = new neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator(
+ inlet_stream_test_sep);
test_separator.setName("TEST_SEPARATOR");
test_separator.run();
test_separator.getWaterOutStream().getThermoSystem().prettyPrint();
- neqsim.processSimulation.processEquipment.heatExchanger.Heater heater_TP_setter_test_stream =
- new neqsim.processSimulation.processEquipment.heatExchanger.Heater(
- "TP_SETTER_FOR_THE_DEGASSER_TEST_SEP_STREAM", test_separator.getWaterOutStream());
+ neqsim.processSimulation.processEquipment.heatExchanger.Heater heater_TP_setter_test_stream = new neqsim.processSimulation.processEquipment.heatExchanger.Heater(
+ "TP_SETTER_FOR_THE_DEGASSER_TEST_SEP_STREAM", test_separator.getWaterOutStream());
heater_TP_setter_test_stream.setOutPressure(5.9061164855957 - 0.01, "bara");
heater_TP_setter_test_stream.setOutTemperature(79.8487854003906, "C");
heater_TP_setter_test_stream.run();
System.out.println("Gas out from degasser " + heater_TP_setter_test_stream.getOutStream()
.getFluid().getPhase("gas").getFlowRate("kg/hr"));
heater_TP_setter_test_stream.getOutStream().getThermoSystem().prettyPrint();
-
- neqsim.processSimulation.processEquipment.heatExchanger.Heater heater_TP_setter_test_stream2 =
- new neqsim.processSimulation.processEquipment.heatExchanger.Heater(
- "TP_SETTER_FOR_THE_DEGASSER_TEST_SEP_STREAM", test_separator.getWaterOutStream());
+
+ neqsim.processSimulation.processEquipment.heatExchanger.Heater heater_TP_setter_test_stream2 = new neqsim.processSimulation.processEquipment.heatExchanger.Heater(
+ "TP_SETTER_FOR_THE_DEGASSER_TEST_SEP_STREAM", test_separator.getWaterOutStream());
heater_TP_setter_test_stream2.setOutPressure(5.9061164855957, "bara");
heater_TP_setter_test_stream2.setOutTemperature(79.8487854003906, "C");
heater_TP_setter_test_stream2.run();
@@ -166,8 +160,6 @@ void testRun() {
}
-
-
private int findComponentIndex(String[] componentNames, String componentName) {
for (int i = 0; i < componentNames.length; i++) {
From b3769021cde14b6dcbe14540b1bac0376b70b350 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Sun, 12 Nov 2023 18:19:18 +0000
Subject: [PATCH 029/317] version 2.5.8
---
pom.xml | 2 +-
pomJava8.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index c74f19016f..4c35cd580f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
@@ -14,7 +15,7 @@ public class ChemEq implements java.io.Serializable {
private static final long serialVersionUID = 1000;
int NSPEC = 10;
int NELE = 3;
- double R = 8.3143;
+ double R = ThermodynamicConstantsInterface.R;
double G_min = 0;
double T = 3500;
double P = 51;
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
index 25df36f936..b299bd485d 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
@@ -3,6 +3,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import Jama.Matrix;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.component.ComponentInterface;
import neqsim.thermo.system.SystemInterface;
@@ -24,7 +25,7 @@ public class ChemicalEquilibrium implements java.io.Serializable {
double d_n_t = 0;
int NSPEC = 2;
int NELE = 2;
- double R = 8.314;
+ double R = ThermodynamicConstantsInterface.R;
Matrix x_solve;
double y_solve;
double n_t = 0.0;
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java
index 7568293132..c73f6edbdf 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java
@@ -6,6 +6,7 @@
import neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.finiteVolumeBoundary.fluidBoundarySystem.FluidBoundarySystem;
import neqsim.fluidMechanics.flowNode.twoPhaseNode.twoPhasePipeFlowNode.StratifiedFlowNode;
import neqsim.fluidMechanics.geometryDefinitions.pipe.PipeData;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
@@ -58,7 +59,7 @@ public void createSystem() {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String[] args) {
- SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325);
+ SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure);
PipeData pipe1 = new PipeData(10.0, 0.025);
testSystem.addComponent("methane", 0.061152181, 0);
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java
index f46d9886ae..85e97dc80e 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java
@@ -12,6 +12,7 @@
import neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.finiteVolumeBoundary.fluidBoundarySystem.FluidBoundarySystem;
import neqsim.fluidMechanics.flowNode.twoPhaseNode.twoPhasePipeFlowNode.StratifiedFlowNode;
import neqsim.fluidMechanics.geometryDefinitions.pipe.PipeData;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
@@ -65,7 +66,8 @@ public void createSystem() {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String[] args) {
- SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325);
+ SystemInterface testSystem =
+ new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure);
PipeData pipe1 = new PipeData(10.0, 0.025);
testSystem.addComponent("methane", 0.061152181, 0);
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java
index 7a7eb94443..910ad3bc5e 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java
@@ -121,7 +121,8 @@ public FlowNodeInterface getNextNode() {
@SuppressWarnings("unused")
public static void main(String[] args) {
SystemInterface testSystem = new SystemSrkEos(273.15 + 40.0, 10.0);
- // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3, 1.01325);
+ // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3,
+ // ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
PipeData pipe1 = new PipeData(0.203, 0.00025);
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java
index 614c5747a5..b091df923e 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java
@@ -152,7 +152,8 @@ public FlowNodeInterface getNextNode() {
@SuppressWarnings("unused")
public static void mainOld(String[] args) {
SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 11.0, 60.0);
- // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3, 1.01325);
+ // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3,
+ // ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
PipeData pipe1 = new PipeData(0.203, 0.00025);
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java
index d5d3727949..e3203b917e 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java
@@ -5,6 +5,7 @@
import neqsim.fluidMechanics.flowNode.twoPhaseNode.TwoPhaseFlowNode;
import neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface;
import neqsim.fluidMechanics.geometryDefinitions.pipe.PipeData;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -129,15 +130,16 @@ public FlowNodeInterface getNextNode() {
public static void main(String[] args) {
/*
* System.out.println("Starter....."); SystemSrkEos testSystem = new SystemSrkEos(275.3,
- * 1.01325); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); PipeData
- * pipe1 = new PipeData(10.0, 0.025);
+ * ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new
+ * ThermodynamicOperations(testSystem); PipeData pipe1 = new PipeData(10.0, 0.025);
*
* testSystem.addComponent("methane", 0.011152181, 0); testSystem.addComponent("ethane",
* 0.00011152181, 0); testSystem.addComponent("water", 0.00462204876, 1);
* testSystem.addComponent("methane", 0.061152181, 0); testSystem.addComponent("water",
* 0.00862204876, 1);
*/
- SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325);
+ SystemInterface testSystem =
+ new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
PipeData pipe1 = new PipeData(10.0, 0.025);
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java
index 69c298729e..c28f2ea4f4 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java
@@ -226,7 +226,8 @@ public void setDt(double dt) {
*/
@SuppressWarnings("unused")
public static void main(String[] args) {
- // SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325);
+ // SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3,
+ // ThermodynamicConstantsInterface.referencePressure);
// SystemInterface testSystem = new SystemSrkEos(313.3, 70.01325);
SystemInterface testSystem = new SystemSrkCPAstatoil(313.3, 70.01325);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
diff --git a/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java b/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java
index 53ce4b5d3c..649c8ef8c8 100644
--- a/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java
+++ b/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java
@@ -8,6 +8,7 @@
import neqsim.standards.gasQuality.Standard_ISO6578;
import neqsim.standards.gasQuality.Standard_ISO6976;
import neqsim.standards.gasQuality.Standard_ISO6976_2016;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -407,7 +408,8 @@ public static void main(String[] args) {
// thermo.system.SystemInterface testSystem = new
// thermo.system.SystemGERG2004Eos(273.15 - 161.4, 1.0);
neqsim.thermo.system.SystemInterface testSystem =
- new neqsim.thermo.system.SystemSrkEos(273.15 - 161.4, 1.013);
+ new neqsim.thermo.system.SystemSrkEos(273.15 - 161.4,
+ ThermodynamicConstantsInterface.referencePressure);
/*
* testSystem.addComponent("nitrogen", 0.0136); testSystem.addComponent("methane", 0.9186);
* testSystem.addComponent("ethane", 0.0526); testSystem.addComponent("propane", 0.0115);
diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java
index 64eda4d617..b425eba7bb 100644
--- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java
+++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java
@@ -1,5 +1,6 @@
package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.conductivity;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -15,7 +16,8 @@ public class PFCTConductivityMethodMod86 extends Conductivity {
private static final long serialVersionUID = 1000;
/** Constant
@@ -58,13 +59,13 @@ public double getMeasuredValue(String unit) {
} else if (unit.equals("Nm^3/day")) {
return stream.getThermoSystem().getPhase(measuredPhaseNumber).getNumberOfMolesInPhase()
* neqsim.thermo.ThermodynamicConstantsInterface.R
- * neqsim.thermo.ThermodynamicConstantsInterface.normalStateTemperature / 101325.0 * 3600.0
- * 24;
+ * neqsim.thermo.ThermodynamicConstantsInterface.normalStateTemperature
+ / ThermodynamicConstantsInterface.atm * 3600.0 * 24;
} else if (unit.equals("Sm^3/day")) {
return stream.getThermoSystem().getPhase(measuredPhaseNumber).getNumberOfMolesInPhase()
* neqsim.thermo.ThermodynamicConstantsInterface.R
- * neqsim.thermo.ThermodynamicConstantsInterface.standardStateTemperature / 101325.0
- * 3600.0 * 24;
+ * neqsim.thermo.ThermodynamicConstantsInterface.standardStateTemperature
+ / ThermodynamicConstantsInterface.atm * 3600.0 * 24;
} else {
return stream.getThermoSystem().getPhase(measuredPhaseNumber).getNumberOfMolesInPhase()
* stream.getThermoSystem().getPhase(measuredPhaseNumber).getMolarMass() / stream
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java
index 2e4a89e358..7e435f2751 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java
@@ -6,6 +6,7 @@
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.measurementDevice.MeasurementDeviceBaseClass;
import neqsim.processSimulation.processEquipment.stream.Stream;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -368,7 +369,7 @@ public double getSimulationTime() {
* @return a double
*/
public double gasConst(FluidSevereSlug fluid) {
- return 8.314 / fluid.getMolecularWeight() * (273.15 + temperature);
+ return ThermodynamicConstantsInterface.R / fluid.getMolecularWeight() * (273.15 + temperature);
}
// Declare the variables for resuts after creating an object Severe slug with required number of
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java
index 932014083e..f7c9517964 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java
@@ -473,9 +473,11 @@ public void run(UUID id) {
polytropicFluidHead = polytropicHead;
polytropicHeadMeter = polytropicHead * 1000.0 / 9.81;
}
- double pressureRatio = Math.pow((polytropicFluidHead * 1000.0
- + (n / (n - 1.0) * z_inlet * 8.314 * (temperature_inlet) / MW))
- / (n / (n - 1.0) * z_inlet * 8.314 * (temperature_inlet) / MW), n / (n - 1.0));
+ double pressureRatio = Math.pow((polytropicFluidHead * 1000.0 + (n / (n - 1.0) * z_inlet
+ * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW))
+ / (n / (n - 1.0) * z_inlet * ThermodynamicConstantsInterface.R * (temperature_inlet)
+ / MW),
+ n / (n - 1.0));
setOutletPressure(thermoSystem.getPressure() * pressureRatio);
if (getAntiSurge().isActive()) {
logger.info("surge flow "
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java b/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java
index a15f6d7f7f..acdeb58da1 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java
@@ -11,6 +11,7 @@
import neqsim.processSimulation.processEquipment.heatExchanger.Heater;
import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
/**
@@ -59,7 +60,7 @@ public GasTurbine(String name) {
airThermoSystem.createDatabase(true);
// airThermoSystem.display();
airStream = new Stream("airStream", airThermoSystem);
- airStream.setPressure(1.01325);
+ airStream.setPressure(ThermodynamicConstantsInterface.referencePressure);
airStream.setTemperature(288.15, "K");
airCompressor = new Compressor("airCompressor", airStream);
}
@@ -146,7 +147,7 @@ public void setInletStream(StreamInterface inletStream) {
public void run(UUID id) {
thermoSystem = inStream.getThermoSystem().clone();
airStream.setFlowRate(thermoSystem.getFlowRate("mole/sec") * airGasRatio, "mole/sec");
- airStream.setPressure(1.01325);
+ airStream.setPressure(ThermodynamicConstantsInterface.referencePressure);
airStream.run(id);
airCompressor.setInletStream(airStream);
@@ -181,7 +182,7 @@ public void run(UUID id) {
locHeater.displayResult();
Expander expander = new Expander("expander", locHeater.getOutletStream());
- expander.setOutletPressure(1.01325);
+ expander.setOutletPressure(ThermodynamicConstantsInterface.referencePressure);
expander.run(id);
Cooler cooler1 = new Cooler("cooler1", expander.getOutletStream());
@@ -196,12 +197,10 @@ public void run(UUID id) {
}
/**
- *
- *
*
- * Calculates ideal air fuel ratio [kg air/kg fuel]
+ * Calculates ideal air fuel ratio [kg air/kg fuel].
*
@@ -160,7 +161,8 @@ public void calcDesign() {
double gasVelocity = 67.0 / Math.sqrt(gasDensity);
double qa = designFlow / (numberOfAdsorptionBeds - 1.0) / 1440.0
- * (1.01325 / designAdsorptionPressure) * (designAdsorptionTemperature / 288.15)
+ * (ThermodynamicConstantsInterface.referencePressure / designAdsorptionPressure)
+ * (designAdsorptionTemperature / 288.15)
* tempStream.getThermoSystem().getPhase(0).getZ();
adsorberInternalDiameter = Math.sqrt(4.0 * qa / Math.PI / gasVelocity);
diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java
index 5ff7a28849..db3b13941a 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java
@@ -342,8 +342,9 @@ public static void main(String[] args) {
* getPhase(0).getPhysicalProperties().getDensity() * 3600.0 + " m^3/hr");
* System.out.println("Export gas flow " +
* separationModule.getOutputStream("gas exit stream").getThermoSystem().
- * getTotalNumberOfMoles() * 8.314 * (273.15 + 15.0) / 101325.0 * 3600.0 * 24 / 1.0e6 +
- * " MSm^3/day"); System.out.println("oil/water heater duty " + ((Heater)
+ * getTotalNumberOfMoles() * ThermodynamicConstantsInterface.R * (273.15 + 15.0)
+ * /ThermodynamicConstantsInterface.atm * 3600.0 * 24 / 1.0e6 + " MSm^3/day");
+ * System.out.println("oil/water heater duty " + ((Heater)
* separationModule.getOperations().getUnit("oil/water heater")).getEnergyInput( ) + " W");
* System.out.println("Export oil cooler duty " + ((Cooler)
* separationModule.getOperations().getUnit("export oil cooler")).getEnergyInput () + " W");
diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java
index 40e1594961..49ee75b16e 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java
@@ -301,16 +301,17 @@ public static void main(String[] args) {
((ProcessEquipmentInterface) separationModule.getOperations().getUnit("2nd stage recompressor"))
.getMechanicalDesign().displayResults();
- //operations.getSystemMechanicalDesign().runDesignCalculation();
- //operations.getSystemMechanicalDesign().getTotalPlotSpace();
- //System.out.println("Modules " + operations.getSystemMechanicalDesign().getTotalVolume());
-
- //System.out
- // .println("Modules " + operations.getSystemMechanicalDesign().getTotalNumberOfModules());
- //System.out.println("Weight " + operations.getSystemMechanicalDesign().getTotalWeight());
- //System.out.println("Plot space " + operations.getSystemMechanicalDesign().getTotalPlotSpace());
- //System.out.println("CAPEX " + operations.getCostEstimator().getWeightBasedCAPEXEstimate());
- //System.out.println("CAPEX " + operations.getCostEstimator().getCAPEXestimate());
+ // operations.getSystemMechanicalDesign().runDesignCalculation();
+ // operations.getSystemMechanicalDesign().getTotalPlotSpace();
+ // System.out.println("Modules " + operations.getSystemMechanicalDesign().getTotalVolume());
+
+ // System.out
+ // .println("Modules " + operations.getSystemMechanicalDesign().getTotalNumberOfModules());
+ // System.out.println("Weight " + operations.getSystemMechanicalDesign().getTotalWeight());
+ // System.out.println("Plot space " +
+ // operations.getSystemMechanicalDesign().getTotalPlotSpace());
+ // System.out.println("CAPEX " + operations.getCostEstimator().getWeightBasedCAPEXEstimate());
+ // System.out.println("CAPEX " + operations.getCostEstimator().getCAPEXestimate());
/*
* separationModule.getOutputStream("Inlet separator").displayResult();
@@ -337,8 +338,9 @@ public static void main(String[] args) {
* getPhase(0).getPhysicalProperties().getDensity() * 3600.0 + " m^3/hr");
* System.out.println("Export gas flow " +
* separationModule.getOutputStream("gas exit stream").getThermoSystem().
- * getTotalNumberOfMoles() * 8.314 * (273.15 + 15.0) / 101325.0 * 3600.0 * 24 / 1.0e6 +
- * " MSm^3/day"); System.out.println("oil/water heater duty " + ((Heater)
+ * getTotalNumberOfMoles() * ThermodynamicConstantsInterface.R * (273.15 + 15.0)
+ * /ThermodynamicConstantsInterface.atm * 3600.0 * 24 / 1.0e6 + " MSm^3/day");
+ * System.out.println("oil/water heater duty " + ((Heater)
* separationModule.getOperations().getUnit("oil/water heater")).getEnergyInput( ) + " W");
* System.out.println("Export oil cooler duty " + ((Cooler)
* separationModule.getOperations().getUnit("export oil cooler")).getEnergyInput () + " W");
diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java
index a0bf071118..b0d3c4ac59 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java
@@ -10,6 +10,7 @@
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.processSimulation.processEquipment.valve.ThrottlingValve;
import neqsim.processSimulation.processSystem.ProcessModuleBaseClass;
+import neqsim.thermo.ThermodynamicConstantsInterface;
/**
*
@@ -32,7 +33,7 @@ public class WellFluidModule extends ProcessModuleBaseClass {
double gasfactor = 0.1;
- double thirdstagePressure = 1.01325;
+ double thirdstagePressure = ThermodynamicConstantsInterface.referencePressure;
double separationTemperature = 273.15 + 15;
double exitGasScrubberTemperature = 273.15 + 30;
double firstStageCompressorAfterCoolerTemperature = 273.15 + 30;
@@ -243,7 +244,8 @@ public static void main(String[] args) {
separationModule.addInputStream("feed stream", wellStream);
separationModule.setSpecification("Second stage pressure", 15.0);
separationModule.setSpecification("separation temperature", 273.15 + 15.0);
- separationModule.setSpecification("Third stage pressure", 1.01325);
+ separationModule.setSpecification("Third stage pressure",
+ ThermodynamicConstantsInterface.referencePressure);
neqsim.processSimulation.processSystem.ProcessSystem operations =
new neqsim.processSimulation.processSystem.ProcessSystem();
diff --git a/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java b/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java
index 87416a6a6f..6df5c9019d 100644
--- a/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java
+++ b/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java
@@ -5,6 +5,7 @@
import java.util.ArrayList;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
/**
@@ -23,12 +24,13 @@ public class Standard_ISO6976 extends neqsim.standards.Standard
// metering conditions
ArrayListreferenceSystem
. */
- public static SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325);
+ public static SystemInterface referenceSystem =
+ new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure);
double[] GVcoef = {-2.147621e5, 2.190461e5, -8.618097e4, 1.496099e4, -4.730660e2, -2.331178e2,
3.778439e1, -2.320481, 5.311764e-2};
double condRefA = -0.25276292;
@@ -167,7 +169,8 @@ public double calcConductivity() {
T0 = 273.15;
}
- double nstarRef = getRefComponentViscosity(T0, 1.01325);
+ double nstarRef =
+ getRefComponentViscosity(T0, ThermodynamicConstantsInterface.referencePressure);
double CpID = referenceSystem.getLowestGibbsEnergyPhase().getComponent(0).getCp0(T0);
double Ffunc = 1.0 + 0.053432 * redDens - 0.030182 * redDens * redDens
- 0.029725 * redDens * redDens * redDens;
@@ -261,7 +264,8 @@ public double getRefComponentViscosity(double temp, double pres) {
4.2903609488e-2, 1.4529023444e2, 6.1276818706e3};
// double viscRefK[] = {-9.74602, 18.0834, -4126.66, 44.6055, 0.9676544, 81.8134, 15649.9};
- double molDens = 101325.0 / 8.315 / phase.getPhase().getTemperature() / 1.0e3;
+ double molDens = ThermodynamicConstantsInterface.atm / ThermodynamicConstantsInterface.R
+ / phase.getPhase().getTemperature() / 1.0e3;
double critMolDens = 10.15;
double redMolDens = (molDens - critMolDens) / critMolDens;
double viscRefO = GVcoef[0] * Math.pow(temp, -1.0) + GVcoef[1] * Math.pow(temp, -2.0 / 3.0)
@@ -319,7 +323,8 @@ public double calcMixLPViscosity() {
* 1.304e-4 * (Math.pow(Mwtemp / Mmtemp, 2.303) - Math.pow(Mmtemp, 2.303))) * 1e3;
* //phase.getPhase().getMolarMass();
*/
- double redDens = 101325 / 8.315 / phase.getPhase().getTemperature() / 1.0e3 / 10.15;
+ double redDens = 101325 / ThermodynamicConstantsInterface.R / phase.getPhase().getTemperature()
+ / 1.0e3 / 10.15;
double alfa0 = 0.0;
double alfaMix = 0.0;
double[] alphai = new double[phase.getPhase().getNumberOfComponents()];
@@ -339,8 +344,8 @@ public double calcMixLPViscosity() {
double T0 = phase.getPhase().getTemperature()
* referenceSystem.getPhase(0).getComponent(0).getTC() / TCmix * alfaMix / alfa0;
- double P0 =
- 1.01325 * referenceSystem.getPhase(0).getComponent(0).getPC() / PCmix * alfaMix / alfa0;
+ double P0 = ThermodynamicConstantsInterface.referencePressure
+ * referenceSystem.getPhase(0).getComponent(0).getPC() / PCmix * alfaMix / alfa0;
double refVisosity = getRefComponentViscosity(T0, P0);
double viscosity = refVisosity * Math.pow(TCmix / Tc0, -1.0 / 6.0)
diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java
index 015475e32f..cbf0c6fbe9 100644
--- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java
+++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java
@@ -6,6 +6,7 @@
package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.viscosity;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -21,7 +22,8 @@ public class PFCTViscosityMethod extends Viscosity {
private static final long serialVersionUID = 1000;
int phaseTypeNumb = 1;
- SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325);
+ SystemInterface referenceSystem =
+ new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure);
double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3,
-9.627993e1, 4.274152, -8.141531e-2};
double visRefA = 1.696985927;
diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java
index 68fd00152a..5dac41cf77 100644
--- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java
+++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java
@@ -1,5 +1,6 @@
package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.viscosity;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -14,8 +15,10 @@
public class PFCTViscosityMethodHeavyOil extends Viscosity {
private static final long serialVersionUID = 1000;
- // SystemInterface referenceSystem = new SystemBWRSEos(273.15, 1.01325);
- SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325);
+ // SystemInterface referenceSystem = new SystemBWRSEos(273.15,
+ // ThermodynamicConstantsInterface.referencePressure);
+ SystemInterface referenceSystem =
+ new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure);
int phaseTypeNumb = 1;
double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3,
-9.627993e1, 4.274152, -8.141531e-2};
diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java
index fbee45c371..c467c76c2f 100644
--- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java
+++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java
@@ -1,5 +1,6 @@
package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.viscosity;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -14,8 +15,10 @@
public class PFCTViscosityMethodMod86 extends Viscosity {
private static final long serialVersionUID = 1000;
- // SystemInterface referenceSystem = new SystemBWRSEos(273.15, 1.01325);
- SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325);
+ // SystemInterface referenceSystem = new SystemBWRSEos(273.15,
+ // ThermodynamicConstantsInterface.referencePressure);
+ SystemInterface referenceSystem =
+ new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure);
int phaseTypeNumb = 1;
double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3,
-9.627993e1, 4.274152, -8.141531e-2};
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java
index ca54cb576b..262f89b610 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java
@@ -3,6 +3,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -231,7 +232,7 @@ public double getMeasuredValue(String measurement, String unit) {
} else if (measurement.equals("GOR_std")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
tempFluid.setTemperature(15.0, "C");
- tempFluid.setPressure(1.01325, "bara");
+ tempFluid.setPressure(ThermodynamicConstantsInterface.referencePressure, "bara");
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
try {
thermoOps.TPflash();
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java b/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java
index aabd8a74b5..2a3f952456 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java
@@ -1,6 +1,7 @@
package neqsim.processSimulation.measurementDevice;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
+import neqsim.thermo.ThermodynamicConstantsInterface;
/**
*
- * Returns the composition vector in unit - * molefraction/wtfraction/molespersec/volumefraction. + * Returns the composition vector in unit molefraction/wtfraction/molespersec/volumefraction. *
* - * @param unit Supported units are molefraction, wtfraction, molespersec, - * volumefraction + * @param unit Supported units are molefraction, wtfraction, molespersec, volumefraction * @return composition array with unit */ public double[] getComposition(String unit); @@ -138,8 +136,7 @@ public default void addcomponent(String name, double moles, double molesInPhase, public double getVolume(String unit); /** - * method to return heat capacity ratio/adiabatic index/Poisson constant. The - * method calculates it + * method to return heat capacity ratio/adiabatic index/Poisson constant. The method calculates it * as Cp (real) /Cv (real). * * @return gamma @@ -147,8 +144,7 @@ public default void addcomponent(String name, double moles, double molesInPhase, public double getGamma(); /** - * method to return heat capacity ratio calculated as - * Cp/(Cp-R*getNumberOfMolesInPhase). + * method to return heat capacity ratio calculated as Cp/(Cp-R*getNumberOfMolesInPhase). * * @return kappa */ @@ -243,8 +239,8 @@ public default double getGamma2() { * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param beta Mole fraction of this phase in system. */ public default void init(double totalNumberOfMoles, int numberOfComponents, int type, double beta) { @@ -258,9 +254,9 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param pt Type of phase. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param pt Type of phase. + * @param beta Mole fraction of this phase in system. */ public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta); @@ -272,9 +268,9 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph * * @param totalNumberOfMoles Total number of moles in system. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param ptNumber Phase type index. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param ptNumber Phase type index. + * @param beta Mole fraction of this phase in system. * @deprecated Replace with init-function using PhaseType input. */ @Deprecated @@ -367,8 +363,7 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * getcomponentArray. * * - * @return an array of {@link neqsim.thermo.component.ComponentInterface} - * objects + * @return an array of {@link neqsim.thermo.component.ComponentInterface} objects */ public ComponentInterface[] getcomponentArray(); @@ -392,19 +387,16 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int public double getWtFraction(SystemInterface system); /** - * method to return molar volume of the phase note: without Peneloux volume - * correction. + * method to return molar volume of the phase note: without Peneloux volume correction. * * @return molar volume volume in unit m3/mol*1e5 */ public double getMolarVolume(); /** - * method to return molar volume of the fluid: - * eventual volume correction included. - * - * @param unit Supported units are m3/mol, litre/mol + * method to return molar volume of the fluid: eventual volume correction included. * + * @param unit Supported units are m3/mol, litre/mol * @return molar volume volume in unit */ public double getMolarVolume(String unit); @@ -412,9 +404,8 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int /** * method to return flow rate of a phase. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, - * m3/hr, ft3/sec, - * mole/sec, mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, m3/hr, ft3/sec, + * mole/sec, mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -424,8 +415,7 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * setComponentArray. * * - * @param components an array of - * {@link neqsim.thermo.component.ComponentInterface} objects + * @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects */ public void setComponentArray(ComponentInterface[] components); @@ -446,8 +436,7 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int public double[] getProperties_GERG2008(); /** - * method to get density of a phase note: does not use Peneloux volume - * correction. + * method to get density of a phase note: does not use Peneloux volume correction. * * @return density with unit kg/m3 */ @@ -466,10 +455,10 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * removeComponent. * * - * @param name a {@link String} object - * @param moles a double + * @param name a {@link String} object + * @param moles a double * @param molesInPhase a double - * @param compNumber a int + * @param compNumber a int */ public void removeComponent(String name, double moles, double molesInPhase, int compNumber); @@ -638,8 +627,7 @@ public default double getExessGibbsEnergySymetric() { /** *
- * Getter for property beta
. Beta is the mole fraction of a phase
- * of all the moles of
+ * Getter for property beta
. Beta is the mole fraction of a phase of all the moles of
* a system.
*
- * Setter for property beta
. Beta is the mole fraction of a phase
- * of all the moles of
+ * Setter for property beta
. Beta is the mole fraction of a phase of all the moles of
* a system.
*
- * Change the number of moles of component of phase,i.e.,
- * numberOfMolesInPhase
but do
+ * Change the number of moles of component of phase,i.e., numberOfMolesInPhase
but do
* not change the total number of moles of component in system.
*
- * NB! Phase fraction beta
is not updated by this method. Must be
- * done separately to
- * keep consistency between phase and component calculation of of total number
- * of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be done separately to
+ * keep consistency between phase and component calculation of of total number of moles in system.
*
- * Change the number of moles of component of phase, i.e.,
- * numberOfMolesInPhase
, and
- * total number of moles of component in system, i.e.,
- * numberOfMoles
with the same
+ * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
, and
+ * total number of moles of component in system, i.e., numberOfMoles
with the same
* amount.
*
- * NB! Phase fraction beta
is not updated by this method. Must be
- * done separately to
- * keep consistency between phase and component calculation of of total number
- * of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be done separately to
+ * keep consistency between phase and component calculation of of total number of moles in system.
*
- * Change the number of moles of component of phase, i.e.,
- * numberOfMolesInPhase
and
- * Component
properties for the number of moles of component of
- * phase, i.e.,
- * numberOfMolesInPhase
, and total number of moles of component in
- * system, i.e.,
+ * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
and
+ * Component
properties for the number of moles of component of phase, i.e.,
+ * numberOfMolesInPhase
, and total number of moles of component in system, i.e.,
* numberOfMoles
with separate amounts.
*
- * NB! Phase fraction beta
is not updated by this method. Must be
- * done separately to
- * keep consistency between phase and component calculation of of total number
- * of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be done separately to
+ * keep consistency between phase and component calculation of of total number of moles in system.
*
- * Get sum of mole fractions for all components. NB! init(0) must be called - * first. + * Get sum of mole fractions for all components. NB! init(0) must be called first. *
* * @return a double @@ -247,8 +234,7 @@ public default String[][] calcResultTable() { public double getMoleFractionsSum(); /** - * method to get the speed of sound of a system. The sound speed is implemented - * based on a molar + * method to get the speed of sound of a system. The sound speed is implemented based on a molar * average over the phases * * @param unit Supported units are m/s, km/h @@ -257,8 +243,7 @@ public default String[][] calcResultTable() { public double getSoundSpeed(String unit); /** - * method to get the speed of sound of a system. The sound speed is implemented - * based on a molar + * method to get the speed of sound of a system. The sound speed is implemented based on a molar * average over the phases * * @return speed of sound in m/s @@ -287,8 +272,7 @@ public default String[][] calcResultTable() { public void initPhysicalProperties(String propertyName); /** - * Calculates thermodynamic and physical properties of a fluid using - * initThermoProperties() and + * Calculates thermodynamic and physical properties of a fluid using initThermoProperties() and * initPhysicalProperties(). */ public void initProperties(); @@ -309,12 +293,9 @@ public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterfa /** * method to return interfacial tension between two phases. * - * @param phase1 phase type of phase1 as string (valid phases are gas, oil, - * aqueous) - * @param phase2 phase type of phase2 as string (valid phases are gas, oil, - * aqueous) - * @return interfacial tension with unit N/m. If one or both phases does not - * exist - the method + * @param phase1 phase type of phase1 as string (valid phases are gas, oil, aqueous) + * @param phase2 phase type of phase2 as string (valid phases are gas, oil, aqueous) + * @return interfacial tension with unit N/m. If one or both phases does not exist - the method * will return NaN */ public double getInterfacialTension(String phase1, String phase2); @@ -335,7 +316,7 @@ public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterfa * * @param phase1 phase number of phase1 * @param phase2 phase number of phase2 - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object * @return interfacial tension with specified unit */ public double getInterfacialTension(int phase1, int phase2, String unit); @@ -374,10 +355,8 @@ public default double getGamma2() { /** * method to return flow rate of fluid. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, - * m3/min, m3/hr, - * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, - * mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, m3/min, m3/hr, + * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -393,7 +372,7 @@ public default double getGamma2() { * method to set the pressure of a fluid (same pressure for all phases). * * @param newPressure in specified unit - * @param unit unit can be bar, bara, barg or atm + * @param unit unit can be bar, bara, barg or atm */ public void setPressure(double newPressure, String unit); @@ -412,7 +391,7 @@ public default double getGamma2() { * * * @param newTemperature a double - * @param phaseNumber a int + * @param phaseNumber a int */ public void setTemperature(double newTemperature, int phaseNumber); @@ -420,13 +399,12 @@ public default double getGamma2() { * method to set the temperature of a fluid (same temperature for all phases). * * @param newTemperature in specified unit - * @param unit unit can be C or K (Celsius or Kelvin) + * @param unit unit can be C or K (Celsius or Kelvin) */ public void setTemperature(double newTemperature, String unit); /** - * method to return the volume fraction of a phase note: without Peneloux volume - * correction. + * method to return the volume fraction of a phase note: without Peneloux volume correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -434,8 +412,7 @@ public default double getGamma2() { public double getVolumeFraction(int phaseNumber); /** - * method to return the volume fraction of a phase note: with Peneloux volume - * correction. + * method to return the volume fraction of a phase note: with Peneloux volume correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -529,7 +506,7 @@ public default void removeMoles() { * saveObjectToFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object */ public void saveObjectToFile(String filePath, String fluidName); @@ -539,7 +516,7 @@ public default void removeMoles() { * readObjectFromFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object * @return a {@link neqsim.thermo.system.SystemInterface} object */ @@ -607,7 +584,7 @@ public default void removeMoles() { * changeComponentName. * * - * @param name a {@link java.lang.String} object + * @param name a {@link java.lang.String} object * @param newName a {@link java.lang.String} object */ public void changeComponentName(String name, String newName); @@ -719,10 +696,8 @@ public default boolean IsPhase(int i) { * * * @param flowRate a double - * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, - * kg/min, kg/hr - * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, - * Sm3/day, idSm3/hr, idSm3/day + * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, kg/min, kg/hr + * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, Sm3/day, idSm3/hr, idSm3/day */ public void setTotalFlowRate(double flowRate, String flowunit); @@ -874,7 +849,7 @@ public default boolean IsPhase(int i) { * saveObject. * * - * @param ID a int + * @param ID a int * @param text a {@link java.lang.String} object */ public void saveObject(int ID, String text); @@ -957,8 +932,7 @@ public default boolean IsPhase(int i) { /** *- * This method is used to set the total molar composition of a fluid. The total - * flow rate will be + * This method is used to set the total molar composition of a fluid. The total flow rate will be * kept constant. The input mole fractions will be normalized. *
* @@ -967,12 +941,10 @@ public default boolean IsPhase(int i) { public void setMolarComposition(double[] moles); /** - * return the phase of to specified type if the phase does not exist, the method - * will return null. + * return the phase of to specified type if the phase does not exist, the method will return null. * - * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, - * hydrate are - * supported) + * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, hydrate are + * supported) * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ public PhaseInterface getPhaseOfType(String phaseTypeName); @@ -991,8 +963,8 @@ public default boolean IsPhase(int i) { * * @param componentName selected name of the component to be added * @param numberOfMoles number of moles to be added - * @param molarMass molar mass of the component in kg/mol - * @param density density of the component in g/cm3 + * @param molarMass molar mass of the component in kg/mol + * @param density density of the component in g/cm3 */ public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, double density); @@ -1002,13 +974,13 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo * addTBPfraction. * * - * @param componentName a {@link java.lang.String} object - * @param numberOfMoles a double - * @param molarMass a double - * @param density a double + * @param componentName a {@link java.lang.String} object + * @param numberOfMoles a double + * @param molarMass a double + * @param density a double * @param criticalTemperature a double - * @param criticalPressure a double - * @param acentricFactor a double + * @param criticalPressure a double + * @param acentricFactor a double */ public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, double density, double criticalTemperature, double criticalPressure, double acentricFactor); @@ -1020,8 +992,8 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo * * @param componentName a {@link java.lang.String} object * @param numberOfMoles a double - * @param molarMass a double - * @param density a double + * @param molarMass a double + * @param density a double */ public void addPlusFraction(String componentName, double numberOfMoles, double molarMass, double density); @@ -1032,7 +1004,7 @@ public void addPlusFraction(String componentName, double numberOfMoles, double m * * * @param componentName a {@link java.lang.String} object - * @param value a double + * @param value a double */ public void addSalt(String componentName, double value); @@ -1123,14 +1095,13 @@ public default boolean hasSolidPhase() { * * * @param model a {@link java.lang.String} object - * @param val a double + * @param val a double * @param phase a int */ public void tuneModel(String model, double val, int phase); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * * @param inComponent Component object to add. @@ -1138,38 +1109,30 @@ public default boolean hasSolidPhase() { public void addComponent(ComponentInterface inComponent); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for component - * in the database. + * @param name Name of the component to add. See NeqSim database for component in the database. */ public void addComponent(String name); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param moles number of moles (per second) of the component to be added to the - * fluid - * @param name Name of the component to add. See NeqSim database for component - * in the database. + * @param moles number of moles (per second) of the component to be added to the fluid + * @param name Name of the component to add. See NeqSim database for component in the database. */ public void addComponent(String name, double moles); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for - * component in the database. - * @param value The amount - * @param unitName the unit of rate (sported units are kg/sec, mol/sec, - * Nlitre/min, kg/hr, - * Sm^3/hr, Sm^3/day, MSm^3/day .. + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param value The amount + * @param unitName the unit of rate (sported units are kg/sec, mol/sec, Nlitre/min, kg/hr, + * Sm^3/hr, Sm^3/day, MSm^3/day .. */ public void addComponent(String name, double value, String unitName); @@ -1178,37 +1141,30 @@ public default boolean hasSolidPhase() { * addComponent. * * - * @param name Name of the component to add. See NeqSim database for component - * in the database. - * @param moles number of moles (per second) of the component to be added to the - * fluid - * @param TC Critical temperature - * @param PC Critical pressure - * @param acs a double + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid + * @param TC Critical temperature + * @param PC Critical pressure + * @param acs a double */ public void addComponent(String name, double moles, double TC, double PC, double acs); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for - * component in the database. - * @param moles number of moles (per second) of the component to be added - * to the fluid + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid * @param phaseNumber Number of the phase to add the component to */ public void addComponent(String name, double moles, int phaseNumber); /** - * add a component to a fluid. I component already exists, it will be added to - * the component + * add a component to a fluid. I component already exists, it will be added to the component * - * @param name Name of the component to add. See NeqSim database for - * component in the database. - * @param value rate of the component to add to the fluid - * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param value rate of the component to add to the fluid + * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) * @param phaseNumber Number of the phase to add the component to */ public void addComponent(String name, double value, String unitName, int phaseNumber); @@ -1219,8 +1175,7 @@ public default boolean hasSolidPhase() { * * * @param index Component number to add - * @param moles number of moles (per second) of the component to be added to the - * fluid + * @param moles number of moles (per second) of the component to be added to the fluid */ public void addComponent(int index, double moles); @@ -1229,9 +1184,8 @@ public default boolean hasSolidPhase() { * addComponent. * * - * @param index Component number to add - * @param moles number of moles (per second) of the component to be added - * to the fluid + * @param index Component number to add + * @param moles number of moles (per second) of the component to be added to the fluid * @param phaseNumber Number of the phase to add the component to */ public void addComponent(int index, double moles, int phaseNumber); @@ -1241,8 +1195,7 @@ public default boolean hasSolidPhase() { * removeComponent. * * - * @param name Name of the component to remove. See NeqSim database for - * component in the database. + * @param name Name of the component to remove. See NeqSim database for component in the database. */ public void removeComponent(String name); @@ -1269,8 +1222,7 @@ public default boolean hasSolidPhase() { /** *
- * Setter for property beta
. NB! Sets beta = b for first phase and
- * 1-b for second
+ * Setter for property beta
. NB! Sets beta = b for first phase and 1-b for second
* phase, not for multiphase systems.
*
this.phaseIndex[index] = phaseIndex;
*
*
- * @param index a int
+ * @param index a int
* @param phaseIndex a int
*/
public void setPhaseIndex(int index, int phaseIndex);
/**
*
- * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure
- * and temperature
+ * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure and temperature
* from the currently existing phase object at index numb
*
- * Calculate system beta values using Phase.getNumberOfMolesInPhase and - * getTotalNumberOfMoles. + * Calculate system beta values using Phase.getNumberOfMolesInPhase and getTotalNumberOfMoles. *
*/ public void initBeta(); @@ -2015,7 +1932,7 @@ public double calcBeta() * Change the phase type of a given phase. * * @param phaseToChange the phase number of the phase to set phase type - * @param newPhaseType the phasetype number to set + * @param newPhaseType the phasetype number to set * @deprecated Replaced by {@link setPhaseType} */ @Deprecated @@ -2037,14 +1954,14 @@ public default void setPhaseType(int phaseToChange, String phaseTypeName) { * Change the phase type of a given phase. * * @param phaseToChange the phase number of the phase to set phase type - * @param pt PhaseType to set + * @param pt PhaseType to set */ public void setPhaseType(int phaseToChange, PhaseType pt); /** * Set phase type of all phases. * - * @param phases Set to "all" to set all phases, else nothing happens. + * @param phases Set to "all" to set all phases, else nothing happens. * @param newPhaseType the phasetype number to set * @deprecated Replaced by {@link setAllPhaseType} */ @@ -2268,8 +2185,7 @@ public default ComponentInterface getComponent(int i) { public PhaseInterface getLiquidPhase(); /** - * method to return compressibility factor of a fluid compressibility factor is - * defined in EoS + * method to return compressibility factor of a fluid compressibility factor is defined in EoS * from PV=ZnRT where V is total volume of fluid. * * @return compressibility factor Z @@ -2372,7 +2288,7 @@ public default ComponentInterface getComponent(int i) { * method to return phase fraction of selected phase. * * @param phaseTypeName gas/oil/aqueous - * @param unit mole/volume/weight + * @param unit mole/volume/weight * @return phase: fraction in specified unit */ public double getPhaseFraction(String phaseTypeName, String unit); @@ -2382,9 +2298,9 @@ public default ComponentInterface getComponent(int i) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param compName a {@link java.lang.String} object - * @param phase a int + * @param phase a int * @return a double */ public double getProperty(String prop, String compName, int phase); @@ -2394,7 +2310,7 @@ public default ComponentInterface getComponent(int i) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param phase a int * @return a double */ @@ -2674,10 +2590,10 @@ public void setImplementedCompositionDeriativesofFugacity( * addCharacterized. * * - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects * @param lastIsPlusFraction True if last fraction is a Plus fraction */ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, @@ -2688,12 +2604,12 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] * addCharacterized. * * - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects - * @param lastIsPlusFraction True if last fraction is a Plus fraction - * @param lumpComponents True if component should be lumped + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects + * @param lastIsPlusFraction True if last fraction is a Plus fraction + * @param lumpComponents True if component should be lumped * @param numberOfPseudoComponents number of pseudo components */ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, @@ -2705,9 +2621,9 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] * addCharacterized. * * - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects * @param relativedensity an array of {@link double} objects */ public void addCharacterized(String[] charNames, double[] charFlowrate, double[] molarMass, diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 987d89675c..960a203470 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -731,19 +731,24 @@ public double getFlowRate(String flowunit) { return totalNumberOfMoles * getMolarMass() * 3600.0 / getIdealLiquidDensity("kg/m3"); } else if (flowunit.equals("Sm3/sec")) { return totalNumberOfMoles * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("Sm3/hr")) { return totalNumberOfMoles * 3600.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("Sm3/day")) { return totalNumberOfMoles * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("MSm3/day")) { return totalNumberOfMoles * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0 / 1.0e6; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm / 1.0e6; } else if (flowunit.equals("MSm3/hr")) { return totalNumberOfMoles * 3600.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0 / 1.0e6; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm / 1.0e6; } else if (flowunit.equals("mole/sec")) { return totalNumberOfMoles; } else if (flowunit.equals("mole/min")) { @@ -803,7 +808,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo try { refSystem = this.getClass().getDeclaredConstructor().newInstance(); refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.addComponent("default", 1.0, 273.15, 50.0, 0.1); refSystem.init(0); refSystem.setNumberOfPhases(1); @@ -818,7 +823,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo // Math.pow((molarMass/5.805e-5*Math.pow(density,0.9371)), 1.0/2.3776); // acs = TBPfractionModel.calcAcentricFactor(molarMass, density); // System.out.println("acentric " + acs); - // 3.0/7.0*Math.log10(PC/1.01325)/(TC/TB-1.0)-1.0; + // 3.0/7.0*Math.log10(PC/ThermodynamicConstantsInterface.referencePressure)/(TC/TB-1.0)-1.0; molarMass /= 1000.0; for (int i = 0; i < refSystem.getNumberOfPhases(); i++) { @@ -836,7 +841,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo } refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.init(1); // refSystem.display(); racketZ = characterization.getTBPModel().calcRacketZ(refSystem, molarMass * 1000.0, density); @@ -854,7 +859,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo // refSystem.getPhase(1).getComponent(0).setRacketZ(racketZ); // // refSystem.setTemperature(273.15+80.0); - // // refSystem.setPressure(1.01325); + // // refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); // // refSystem.init(1); // //refSystem.initPhysicalProperties(); // // APIdens - refSystem.getPhase(1).getPhysicalProperties().getDensity(); @@ -863,8 +868,8 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo logger.error(ex.getMessage(), ex); } - double critVol = characterization.getTBPModel().calcCriticalVolume(molarMass * 1000, density); // 0.2918-0.0928* - // acs)*8.314*TC/PC*10.0; + double critVol = characterization.getTBPModel().calcCriticalVolume(molarMass * 1000, density); + // 0.2918-0.0928*acs)*ThermodynamicConstantsInterface.R*TC/PC*10.0; addComponent(componentName, numberOfMoles, TC, PC, acs); double Kwatson = Math.pow(TB * 1.8, 1.0 / 3.0) / density; // System.out.println("watson " + Kwatson); @@ -945,7 +950,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo try { refSystem = this.getClass().getDeclaredConstructor().newInstance(); refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.addComponent("default", 1.0, 273.15, 50.0, 0.1); refSystem.init(0); refSystem.setNumberOfPhases(1); @@ -977,7 +982,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo } refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.init(1); // refSystem.display(); racketZ = characterization.getTBPModel().calcRacketZ(refSystem, molarMass * 1000.0, density); @@ -995,7 +1000,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo // refSystem.getPhase(1).getComponent(0).setRacketZ(racketZ); // // refSystem.setTemperature(273.15+80.0); - // // refSystem.setPressure(1.01325); + // // refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); // // refSystem.init(1); // // refSystem.initPhysicalProperties(); // // APIdens - refSystem.getPhase(1).getPhysicalProperties().getDensity(); @@ -1005,7 +1010,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo } double critVol = characterization.getTBPModel().calcCriticalVolume(molarMass * 1000, density); // 0.2918-0.0928* - // acs)*8.314*TC/PC*10.0; + // acs)*ThermodynamicConstantsInterface.R*TC/PC*10.0; addComponent(componentName, numberOfMoles, TC, PC, acs); double Kwatson = Math.pow(TB * 1.8, 1.0 / 3.0) / density; // System.out.println("watson " + Kwatson); @@ -2868,7 +2873,8 @@ public double getDensity(String unit) { conversionFactor = 0.0624279606; break; case "kg/Sm3": - return getMolarMass() * 101325.0 / ThermodynamicConstantsInterface.R + return getMolarMass() * ThermodynamicConstantsInterface.atm + / ThermodynamicConstantsInterface.R / ThermodynamicConstantsInterface.standardStateTemperature; case "mol/m3": conversionFactor = 1.0 / getMolarMass(); diff --git a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java index 88f45f3f53..d1fb9b2ae1 100644 --- a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java +++ b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java @@ -14,57 +14,57 @@ */ public class GERG2008 { // Variables containing the common parameters in the GERG-2008 equations - double RGERG; - int NcGERG = 21; - int MaxFlds = 21; - int MaxMdl = 10; - int MaxTrmM = 12; - int MaxTrmP = 24; - double epsilon = 1e-15; - int[][] intcoik = new int[MaxFlds + 1][MaxTrmP + 1]; - int[][] coik = new int[MaxFlds + 1][MaxTrmP + 1]; - int[][] doik = new int[MaxFlds + 1][MaxTrmP + 1]; - int[][] dijk = new int[MaxMdl + 1][MaxTrmM + 1]; - - double Drold; - double Trold; - double Told; - double Trold2; - double[] xold = new double[MaxFlds + 1]; - int[][] mNumb = new int[MaxFlds + 1][MaxFlds + 1]; - int[] kpol = new int[MaxFlds + 1]; - int[] kexp = new int[MaxFlds + 1]; - int[] kpolij = new int[MaxMdl + 1]; - int[] kexpij = new int[MaxMdl + 1]; - - double[] Dc = new double[MaxFlds + 1]; - double[] Tc = new double[MaxFlds + 1]; - double[] MMiGERG = new double[MaxFlds + 1]; - double[] Vc3 = new double[MaxFlds + 1]; - double[] Tc2 = new double[MaxFlds + 1]; - - double[][] noik = new double[MaxFlds + 1][MaxTrmP + 1]; - double[][] toik = new double[MaxFlds + 1][MaxTrmP + 1]; - - double[][] cijk = new double[MaxMdl + 1][MaxTrmM + 1]; - - double[][] eijk = new double[MaxMdl + 1][MaxTrmM + 1]; - double[][] gijk = new double[MaxMdl + 1][MaxTrmM + 1]; - double[][] nijk = new double[MaxMdl + 1][MaxTrmM + 1]; - double[][] tijk = new double[MaxMdl + 1][MaxTrmM + 1]; - - double[][] btij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] bvij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] gtij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] gvij = new double[MaxFlds + 1][MaxFlds + 1]; - - double[][] fij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] th0i = new double[MaxFlds + 1][7 + 1]; - double[][] n0i = new double[MaxFlds + 1][7 + 1]; - - double[][] taup = new double[MaxFlds + 1][MaxTrmP + 1]; - double[][] taupijk = new double[MaxFlds + 1][MaxTrmM + 1]; - double dPdDsave; + double RGERG; + int NcGERG = 21; + int MaxFlds = 21; + int MaxMdl = 10; + int MaxTrmM = 12; + int MaxTrmP = 24; + double epsilon = 1e-15; + int[][] intcoik = new int[MaxFlds + 1][MaxTrmP + 1]; + int[][] coik = new int[MaxFlds + 1][MaxTrmP + 1]; + int[][] doik = new int[MaxFlds + 1][MaxTrmP + 1]; + int[][] dijk = new int[MaxMdl + 1][MaxTrmM + 1]; + + double Drold; + double Trold; + double Told; + double Trold2; + double[] xold = new double[MaxFlds + 1]; + int[][] mNumb = new int[MaxFlds + 1][MaxFlds + 1]; + int[] kpol = new int[MaxFlds + 1]; + int[] kexp = new int[MaxFlds + 1]; + int[] kpolij = new int[MaxMdl + 1]; + int[] kexpij = new int[MaxMdl + 1]; + + double[] Dc = new double[MaxFlds + 1]; + double[] Tc = new double[MaxFlds + 1]; + double[] MMiGERG = new double[MaxFlds + 1]; + double[] Vc3 = new double[MaxFlds + 1]; + double[] Tc2 = new double[MaxFlds + 1]; + + double[][] noik = new double[MaxFlds + 1][MaxTrmP + 1]; + double[][] toik = new double[MaxFlds + 1][MaxTrmP + 1]; + + double[][] cijk = new double[MaxMdl + 1][MaxTrmM + 1]; + + double[][] eijk = new double[MaxMdl + 1][MaxTrmM + 1]; + double[][] gijk = new double[MaxMdl + 1][MaxTrmM + 1]; + double[][] nijk = new double[MaxMdl + 1][MaxTrmM + 1]; + double[][] tijk = new double[MaxMdl + 1][MaxTrmM + 1]; + + double[][] btij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] bvij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] gtij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] gvij = new double[MaxFlds + 1][MaxFlds + 1]; + + double[][] fij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] th0i = new double[MaxFlds + 1][7 + 1]; + double[][] n0i = new double[MaxFlds + 1][7 + 1]; + + double[][] taup = new double[MaxFlds + 1][MaxTrmP + 1]; + double[][] taupijk = new double[MaxFlds + 1][MaxTrmM + 1]; + double dPdDsave; /** *@@ -74,7 +74,7 @@ public class GERG2008 { * @param x an array of {@link double} objects * @param Mm a {@link org.netlib.util.doubleW} object */ - public void MolarMassGERG(double[] x, doubleW Mm) { + public void MolarMassGERG(double[] x, doubleW Mm) { // Sub MolarMassGERG(x, Mm) // Calculate molar mass of the mixture with the compositions contained in the @@ -107,7 +107,7 @@ public void MolarMassGERG(double[] x, doubleW Mm) { * @param P a {@link org.netlib.util.doubleW} object * @param Z a {@link org.netlib.util.doubleW} object */ - public void PressureGERG(double T, double D, double[] x, doubleW P, doubleW Z) { + public void PressureGERG(double T, double D, double[] x, doubleW P, doubleW Z) { // Sub PressureGERG(T, D, x, P, Z) // Calculate pressure as a function of temperature and density. The derivative @@ -156,7 +156,7 @@ public void PressureGERG(double T, double D, double[] x, doubleW P, doubleW Z) * @param ierr a {@link org.netlib.util.intW} object * @param herr a {@link org.netlib.util.StringW} object */ - public void DensityGERG(int iFlag, double T, double P, double[] x, doubleW D, intW ierr, + public void DensityGERG(int iFlag, double T, double P, double[] x, doubleW D, intW ierr, StringW herr) { // Sub DensityGERG(iFlag, T, P, x, D, ierr, herr) @@ -352,9 +352,9 @@ public void DensityGERG(int iFlag, double T, double P, double[] x, doubleW D, i * @param Kappa a {@link org.netlib.util.doubleW} object * @param A a {@link org.netlib.util.doubleW} object */ - public void PropertiesGERG(double T, double D, double[] x, doubleW P, doubleW Z, - doubleW dPdD, doubleW d2PdD2, doubleW d2PdTD, doubleW dPdT, doubleW U, doubleW H, doubleW S, - doubleW Cv, doubleW Cp, doubleW W, doubleW G, doubleW JT, doubleW Kappa, doubleW A) { + public void PropertiesGERG(double T, double D, double[] x, doubleW P, doubleW Z, doubleW dPdD, + doubleW d2PdD2, doubleW d2PdTD, doubleW dPdT, doubleW U, doubleW H, doubleW S, doubleW Cv, + doubleW Cp, doubleW W, doubleW G, doubleW JT, doubleW Kappa, doubleW A) { // Sub PropertiesGERG(T, D, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, // Cp, W, G, JT, Kappa, A) @@ -456,7 +456,7 @@ public void PropertiesGERG(double T, double D, double[] x, doubleW P, doubleW Z * @param Dr ... */ // The following routines are low-level routines that should not be called outside of this code. - void ReducingParametersGERG(double[] x, doubleW Tr, doubleW Dr) { + void ReducingParametersGERG(double[] x, doubleW Tr, doubleW Dr) { // Private Sub ReducingParametersGERG(x, Tr, Dr) // Calculate reducing variables. Only need to call this if the composition has @@ -521,7 +521,7 @@ void ReducingParametersGERG(double[] x, doubleW Tr, doubleW Dr) { * @param x ... * @param a0 ... */ - void Alpha0GERG(double T, double D, double[] x, doubleW[] a0) { + void Alpha0GERG(double T, double D, double[] x, doubleW[] a0) { // Private Sub Alpha0GERG(T, D, x, a0) // Calculate the ideal gas Helmholtz energy and its derivatives with respect to @@ -601,7 +601,7 @@ void Alpha0GERG(double T, double D, double[] x, doubleW[] a0) { * @param x .... * @param ar ... */ - void AlpharGERG(int itau, int idelta, double T, double D, double[] x, doubleW[][] ar) { + void AlpharGERG(int itau, int idelta, double T, double D, double[] x, doubleW[][] ar) { // Private Sub AlpharGERG(itau, idelta, T, D, x, ar) // Calculate dimensionless residual Helmholtz energy and its derivatives with @@ -760,7 +760,7 @@ void AlpharGERG(int itau, int idelta, double T, double D, double[] x, doubleW[][ * @param lntau ... * @param x .... */ - void tTermsGERG(double lntau, double[] x) { + void tTermsGERG(double lntau, double[] x) { // Private Sub tTermsGERG(lntau, x) // Calculate temperature dependent parts of the GERG-2008 equation of state @@ -808,7 +808,7 @@ void tTermsGERG(double lntau, double[] x) { * @param Tcx temperature in Kelvin * @param Dcx density */ - void PseudoCriticalPointGERG(double[] x, doubleW Tcx, doubleW Dcx) { + void PseudoCriticalPointGERG(double[] x, doubleW Tcx, doubleW Dcx) { // PseudoCriticalPointGERG(x, Tcx, Dcx) // Calculate a pseudo critical point as the mole fraction average of the @@ -833,7 +833,7 @@ void PseudoCriticalPointGERG(double[] x, doubleW Tcx, doubleW Dcx) { * SetupGERG. *
*/ - public void SetupGERG() { + public void SetupGERG() { // Initialize all the constants and parameters in the GERG-2008 model. // Some values are modified for calculations that do not depend on T, D, and x in order to // speed up the program. @@ -845,6 +845,7 @@ public void SetupGERG() { double T0; double d0; + // ThermodynamicConstantsInterface.R RGERG = 8.314472; Rs = 8.31451; Rsr = Rs / RGERG; @@ -3249,14 +3250,14 @@ public static void main(String[] args) { test.MolarMassGERG(x, Mm); - // System.out.println("mol mass " + Mm.val); + // System.out.println("mol mass " + Mm.val); - test.PressureGERG(T, D.val, x, P, Z); + test.PressureGERG(T, D.val, x, P, Z); - System.out.println("pressure " + P.val); - System.out.println("Z " + Z.val); + System.out.println("pressure " + P.val); + System.out.println("Z " + Z.val); - test.DensityGERG(iFlag, T, P.val, x, D, ierr, herr); + test.DensityGERG(iFlag, T, P.val, x, D, ierr, herr); System.out.println("density " + D.val); doubleW dPdD = new doubleW(0.0d); @@ -3276,8 +3277,8 @@ public static void main(String[] args) { doubleW JT = new doubleW(0.0d); doubleW Kappa = new doubleW(0.0d); doubleW PP = new doubleW(0.0d); - test.PropertiesGERG(T, D.val, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, G, - JT, Kappa, A); + test.PropertiesGERG(T, D.val, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, G, JT, + Kappa, A); /* * // test.PressureGERG(400, 12.798286, x); String herr = ""; test.DensityGERG(0, T, P, x, ierr, diff --git a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java index 83f89405b1..f269fdd783 100644 --- a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java +++ b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java @@ -27,7 +27,7 @@ public static void main(String args[]) { // SystemInterface testSystem = new SystemSrkCPAstatoil(303.15, 10.0); // SystemInterface testSystem = new SystemUMRPRUMCEos(303.0, 10.0); // SystemInterface testSystem = new SystemSrkSchwartzentruberEos(298.15, - // 1.01325); + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); testSystem.addComponent("nitrogen", 0.0028941); diff --git a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java index bf6ca88889..a9f32f244a 100644 --- a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java +++ b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java @@ -28,7 +28,7 @@ public static void main(String args[]) { SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 - 5.0, 10.0); // SystemInterface testSystem = new SystemSrkSchwartzentruberEos(298.15, - // 1.01325); + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); // testSystem.addComponent("CO2", 2.1); diff --git a/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java b/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java index e2d25a1580..0695911184 100644 --- a/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java +++ b/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java @@ -1,70 +1,85 @@ package neqsim.thermo.util.empiric; +import neqsim.thermo.ThermodynamicConstantsInterface; + /** - *BukacekWaterInGas class.
+ *+ * BukacekWaterInGas class. + *
* * @author asmund * @version $Id: $Id */ public class BukacekWaterInGas { - /* - * Calculates the ppm(mol) water content of a gas at its water dew point - */ - /** - *getWaterInGas.
- * - * @param temperature a double - * @param pressure a double - * @return a double - */ - public static double getWaterInGas(double temperature, double pressure) { - double TCwater = 393.99+273.15, PCwater = 220.64; - double tau = (TCwater-temperature)/TCwater; - - double temp = (-7.85823*tau + 1.83991*Math.pow(tau, 1.5) - 11.7811*Math.pow(tau, 3.0) - + 22.67*Math.pow(tau, 3.5) - 15.9393*Math.pow(tau, 4.0) + 1.77516*Math.pow(tau, 7.5))/(1.0-tau); - double psw = PCwater*Math.exp(temp); - - double mgwaterSm3 = 761900.42*psw/pressure + 16.016*Math.pow(10.0, -1716.26/(temperature) + 6.69449); - - double molarMassGas = 0.6*28.0*1000.0; // mgr/mol - - double ans = mgwaterSm3/molarMassGas; // mol water /Sm3 gas - - double molgasSm3 = 101325.0/(8.314*288.15); // mol gas/ Sm3 - - return ans / molgasSm3; - } - - /** - *waterDewPointTemperature.
- * - * @param moleFractionWaterInGas a double - * @param pressure a double - * @return a double - */ - public static double waterDewPointTemperature(double moleFractionWaterInGas, double pressure) { - int iter = 0; - double newppm, newTemp = 273.15; - do { - iter++; + /* + * Calculates the ppm(mol) water content of a gas at its water dew point + */ + /** + *+ * getWaterInGas. + *
+ * + * @param temperature a double + * @param pressure a double + * @return a double + */ + public static double getWaterInGas(double temperature, double pressure) { + double TCwater = 393.99 + 273.15, PCwater = 220.64; + double tau = (TCwater - temperature) / TCwater; + + double temp = (-7.85823 * tau + 1.83991 * Math.pow(tau, 1.5) - 11.7811 * Math.pow(tau, 3.0) + + 22.67 * Math.pow(tau, 3.5) - 15.9393 * Math.pow(tau, 4.0) + 1.77516 * Math.pow(tau, 7.5)) + / (1.0 - tau); + double psw = PCwater * Math.exp(temp); + + double mgwaterSm3 = + 761900.42 * psw / pressure + 16.016 * Math.pow(10.0, -1716.26 / (temperature) + 6.69449); + + double molarMassGas = 0.6 * 28.0 * 1000.0; // mgr/mol + + double ans = mgwaterSm3 / molarMassGas; // mol water /Sm3 gas + + double molgasSm3 = + ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15); // mol + // gas/ + // Sm3 + + return ans / molgasSm3; + } + + /** + *+ * waterDewPointTemperature. + *
+ * + * @param moleFractionWaterInGas a double + * @param pressure a double + * @return a double + */ + public static double waterDewPointTemperature(double moleFractionWaterInGas, double pressure) { + int iter = 0; + double newppm, newTemp = 273.15; + do { + iter++; - newppm = getWaterInGas(newTemp, pressure); - newTemp -= (newppm - moleFractionWaterInGas) * 1e5; - } while (Math.abs((newppm - moleFractionWaterInGas) / moleFractionWaterInGas) > 1e-8 - && iter < 1000); - return newTemp; - } + newppm = getWaterInGas(newTemp, pressure); + newTemp -= (newppm - moleFractionWaterInGas) * 1e5; + } while (Math.abs((newppm - moleFractionWaterInGas) / moleFractionWaterInGas) > 1e-8 + && iter < 1000); + return newTemp; + } - /** - *main.
- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - System.out.println("water in gas " + BukacekWaterInGas.getWaterInGas(273.15 - 18.0, 70.0)); + /** + *+ * main. + *
+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String[] args) { + System.out.println("water in gas " + BukacekWaterInGas.getWaterInGas(273.15 - 18.0, 70.0)); - System.out.println("water dew point temperature " - + (BukacekWaterInGas.waterDewPointTemperature(20.0e-6, 70.0) - 273.15)); - } + System.out.println("water dew point temperature " + + (BukacekWaterInGas.waterDewPointTemperature(20.0e-6, 70.0) - 273.15)); + } } diff --git a/src/main/java/neqsim/thermo/util/empiric/DuanSun.java b/src/main/java/neqsim/thermo/util/empiric/DuanSun.java index 0059b9a19f..9484f333ed 100644 --- a/src/main/java/neqsim/thermo/util/empiric/DuanSun.java +++ b/src/main/java/neqsim/thermo/util/empiric/DuanSun.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemElectrolyteCPAstatoil; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -69,7 +70,7 @@ public double bublePointPressure(double temperature, double x_CO2, double salini // System.out.println(SUMY); // System.out.println(y[0]); - double R = 8.314 * Math.pow(10.0, -2.0); + double R = ThermodynamicConstantsInterface.R * Math.pow(10.0, -2.0); // Calculate A and B of pure compound double[] Tr = {0.0, 0.0}; @@ -267,13 +268,13 @@ public double bublePointPressure(double temperature, double x_CO2, double salini double VCO2INF = 0.0; - VCO2INF = (-159751499.972988 * Math.pow(10.0, -10.0)) - + (101831855.926854 * Math.pow(10.0, -10)) * S - + (18075168.978622 * Math.pow(10.0, -11.0)) * T - - (787538191.939352 * Math.pow(10.0, -13.0)) * S * T - - (192886808.345857 * Math.pow(10.0, -11.0)) * (Math.pow(S, 2.0)) - + 142830810.095592 * Math.pow(10.0, -15.0) * S * (Math.pow(T, 2.0)) - + (123450785.102997 * Math.pow(10.0, -13.0)) * T * (Math.pow(S, 2.0)) + VCO2INF = + (-159751499.972988 * Math.pow(10.0, -10.0)) + (101831855.926854 * Math.pow(10.0, -10)) * S + + (18075168.978622 * Math.pow(10.0, -11.0)) * T + - (787538191.939352 * Math.pow(10.0, -13.0)) * S * T + - (192886808.345857 * Math.pow(10.0, -11.0)) * (Math.pow(S, 2.0)) + + 142830810.095592 * Math.pow(10.0, -15.0) * S * (Math.pow(T, 2.0)) + + (123450785.102997 * Math.pow(10.0, -13.0)) * T * (Math.pow(S, 2.0)) - (220053285.910771 * Math.pow(10.0, -16.0)) * (Math.pow(S, 2.0)) * (Math.pow(T, 2.0)) - 35351000.350961 * Math.pow(10.0, -17.0) * (Math.pow(T, 3.0)); diff --git a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java index a483b7b0eb..009145fc27 100644 --- a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java +++ b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseEosInterface; import neqsim.thermo.system.SystemInterface; @@ -133,8 +134,8 @@ public static SystemInterface read(String inputFile, String pseudoNameIn) { * @return a {@link neqsim.thermo.system.SystemInterface} object */ public static SystemInterface read(String inputFile) { - neqsim.thermo.system.SystemInterface fluid = - new neqsim.thermo.system.SystemSrkEos(288.15, 1.01325); + neqsim.thermo.system.SystemInterface fluid = new neqsim.thermo.system.SystemSrkEos(288.15, + ThermodynamicConstantsInterface.referencePressure); double[][] kij = null; try (BufferedReader br = new BufferedReader(new FileReader(new File(inputFile)))) { @@ -158,11 +159,14 @@ public static SystemInterface read(String inputFile) { if (st.trim().equals("EOS")) { EOS = br.readLine().replace("/", ""); if (EOS.contains("SRK")) { - fluid = new neqsim.thermo.system.SystemSrkEos(288.15, 100.01325); + fluid = new neqsim.thermo.system.SystemSrkEos(288.15, + ThermodynamicConstantsInterface.referencePressure); } else if (EOS.contains("PR")) { - fluid = new neqsim.thermo.system.SystemPrEos(288.15, 1.01325); + fluid = new neqsim.thermo.system.SystemPrEos(288.15, + ThermodynamicConstantsInterface.referencePressure); } else if (EOS.contains("PR78")) { - fluid = new neqsim.thermo.system.SystemPrEos1978(288.15, 1.01325); + fluid = new neqsim.thermo.system.SystemPrEos1978(288.15, + ThermodynamicConstantsInterface.referencePressure); } } if (st.equals("CNAMES")) { diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java index 670260bd48..77bc570676 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java @@ -7,6 +7,7 @@ import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -25,7 +26,7 @@ public class OLGApropertyTableGeneratorKeywordFormat SystemInterface thermoSystem = null; ThermodynamicOperations thermoOps = null; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; double stdPresATM = 1; double stdTemp = 288.15; double[] molfracs; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java index fc6edbf503..01591076ef 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java @@ -10,6 +10,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -243,7 +244,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java index 2df3f6599a..9640ce97bb 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java @@ -7,6 +7,7 @@ import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -207,7 +208,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java index e1647e3f51..a96467f600 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java @@ -7,6 +7,7 @@ import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -25,7 +26,7 @@ public class OLGApropertyTableGeneratorWaterKeywordFormat SystemInterface thermoSystem = null; ThermodynamicOperations thermoOps = null; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; double stdPresATM = 1; double stdTemp = 288.15; double[] molfracs; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java index 5132b0b2ea..7286025174 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java @@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -255,7 +256,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java index ee015defa8..bffa4a432d 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java @@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -253,7 +254,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/util/database/NeqSimDataBase.java b/src/main/java/neqsim/util/database/NeqSimDataBase.java index 359699b00e..ba3860c5f6 100644 --- a/src/main/java/neqsim/util/database/NeqSimDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimDataBase.java @@ -55,7 +55,6 @@ public class NeqSimDataBase * */ public NeqSimDataBase() { - setDataBaseType(dataBaseType); try { diff --git a/src/main/java/neqsim/util/unit/BaseUnit.java b/src/main/java/neqsim/util/unit/BaseUnit.java index 65f31d4faa..4ec4bdcf49 100644 --- a/src/main/java/neqsim/util/unit/BaseUnit.java +++ b/src/main/java/neqsim/util/unit/BaseUnit.java @@ -8,47 +8,48 @@ * @author esol * @version $Id: $Id */ -public class BaseUnit implements Unit, neqsim.thermo.ThermodynamicConstantsInterface { - private static final long serialVersionUID = 1000; - - protected double SIvalue = 0.0, invalue = 0.0, factor = 1.0; - protected String inunit = null; - - /** - *- * Constructor for BaseUnit. - *
- */ - public BaseUnit() {} - - /** - *- * Constructor for BaseUnit. - *
- * - * @param value a double - * @param name a {@link java.lang.String} object - */ - public BaseUnit(double value, String name) { - this.invalue = value; - this.inunit = name; - } - - /** {@inheritDoc} */ - @Override - public double getSIvalue() { - return SIvalue; - } - - /** {@inheritDoc} */ - @Override - public double getValue(String fromunit) { - return 0.0; - } - - /** {@inheritDoc} */ - @Override - public double getValue(double val, String fromunit, String tounit) { - return 0.0; - } +public abstract class BaseUnit implements Unit, neqsim.thermo.ThermodynamicConstantsInterface { + private static final long serialVersionUID = 1000; + + /** Process value in SI units */ + protected double SIvalue = 0.0; + + /** Process value in given unit */ + protected double invalue = 0.0; + /** Unit of process value */ + protected String inunit = null; + + /** Conversion factor */ + protected double factor = 1.0; + + /** + *+ * Constructor for BaseUnit. + *
+ * + * @param value a double + * @param name a {@link java.lang.String} object + */ + public BaseUnit(double value, String name) { + this.invalue = value; + this.inunit = name; + } + + /** {@inheritDoc} */ + @Override + public double getSIvalue() { + return SIvalue; + } + + /** {@inheritDoc} */ + @Override + public double getValue(String fromunit) { + return 0.0; + } + + /** {@inheritDoc} */ + @Override + public double getValue(double val, String fromunit, String tounit) { + return 0.0; + } } diff --git a/src/main/java/neqsim/util/unit/LengthUnit.java b/src/main/java/neqsim/util/unit/LengthUnit.java index 8eb5b2538c..f19048778a 100644 --- a/src/main/java/neqsim/util/unit/LengthUnit.java +++ b/src/main/java/neqsim/util/unit/LengthUnit.java @@ -17,10 +17,16 @@ public class LengthUnit extends neqsim.util.unit.BaseUnit { private static final long serialVersionUID = 1000; + /** ** Constructor for LengthUnit. *
+ * + * @param value + * @param name */ - public LengthUnit() {} + public LengthUnit(double value, String name) { + super(value, name); + } } diff --git a/src/main/java/neqsim/util/unit/RateUnit.java b/src/main/java/neqsim/util/unit/RateUnit.java index 15d47b6e12..21bf9714e5 100644 --- a/src/main/java/neqsim/util/unit/RateUnit.java +++ b/src/main/java/neqsim/util/unit/RateUnit.java @@ -67,9 +67,11 @@ public double getValue(String tounit) { */ public double getConversionFactor(String name) { double mol_m3 = 0.0; - double mol_Sm3 = 101325.0 / (ThermodynamicConstantsInterface.R * standardStateTemperature); + double mol_Sm3 = ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * standardStateTemperature); if (boilp < 25) { - mol_m3 = 101325.0 / (ThermodynamicConstantsInterface.R * standardStateTemperature); + mol_m3 = ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * standardStateTemperature); } else { mol_m3 = 1.0 / (molarmass) * stddens * 1000; } diff --git a/src/main/java/neqsim/util/unit/TimeUnit.java b/src/main/java/neqsim/util/unit/TimeUnit.java index f02de44c77..2635ed108f 100644 --- a/src/main/java/neqsim/util/unit/TimeUnit.java +++ b/src/main/java/neqsim/util/unit/TimeUnit.java @@ -21,6 +21,12 @@ public class TimeUnit extends neqsim.util.unit.BaseUnit { ** Constructor for TimeUnit. *
+ * + * @param value + * @param name */ - public TimeUnit() {} + public TimeUnit(double value, String name) { + super(value, name); + } + } diff --git a/src/main/java/neqsim/util/unit/Unit.java b/src/main/java/neqsim/util/unit/Unit.java index 77306bd9f9..cde4b08c2d 100644 --- a/src/main/java/neqsim/util/unit/Unit.java +++ b/src/main/java/neqsim/util/unit/Unit.java @@ -26,11 +26,11 @@ public interface Unit { /** *- * getValue. + * Get process value in specified unit. *
* - * @param tounit a {@link java.lang.String} object - * @return a double + * @param tounit Unit to get process value in. + * @return Value converted to the specified unit. */ double getValue(String tounit); diff --git a/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java index de15436844..d27e28ddbf 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -39,7 +40,8 @@ void testRunCalc() { SeparatorTest sepSim = new SeparatorTest(tempSystem); double[] temps = {313.15, 313.15, 313.15, 313.15, 313.15, 313.15, 313.15}; - double[] pres = {500, 400, 200, 100, 50.0, 5.0, 1.01325}; + double[] pres = + {500, 400, 200, 100, 50.0, 5.0, ThermodynamicConstantsInterface.referencePressure}; sepSim.setSeparatorConditions(temps, pres); sepSim.runCalc(); diff --git a/src/test/java/neqsim/chemicalReactions/ChemicalReactionOperationsTest.java b/src/test/java/neqsim/chemicalReactions/ChemicalReactionOperationsTest.java new file mode 100644 index 0000000000..7766160dd5 --- /dev/null +++ b/src/test/java/neqsim/chemicalReactions/ChemicalReactionOperationsTest.java @@ -0,0 +1,26 @@ +package neqsim.chemicalReactions; + +import org.junit.jupiter.api.BeforeAll; +import neqsim.thermo.system.SystemSrkEos; + +public class ChemicalReactionOperationsTest { + + static SystemSrkEos testSystem; + + @BeforeAll + public void setUp() { + testSystem = new SystemSrkEos(303.3, 2.8); + + testSystem.addComponent("methane", 5.0, "kg/sec"); + // testSystem.addComponent("nitrogen", 100.0, "kg/sec"); + testSystem.addComponent("oxygen", 40.0, "kg/sec"); + testSystem.chemicalReactionInit(); + + testSystem.createDatabase(true); + testSystem.setMixingRule(2); + testSystem.init(0); + testSystem.setMaxNumberOfPhases(1); + testSystem.setNumberOfPhases(1); + testSystem.getChemicalReactionOperations().solveChemEq(0, 0); + } +} diff --git a/src/test/java/neqsim/physicalProperties/util/examples/TestCondensate.java b/src/test/java/neqsim/physicalProperties/util/examples/TestCondensate.java index 94779034af..915c06c25e 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.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemPrEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -26,8 +27,10 @@ public class TestCondensate { * @param args an array of {@link java.lang.String} objects */ public static void main(String args[]) { - // SystemInterface testSystem = new SystemSrkEos(273.15 + 15.0, 1.01325); - SystemInterface testSystem = new SystemPrEos(273.15 + 15.0, 1.01325); + // SystemInterface testSystem = new SystemSrkEos(273.15 + 15.0, + // ThermodynamicConstantsInterface.referencePressure); + SystemInterface testSystem = + new SystemPrEos(273.15 + 15.0, ThermodynamicConstantsInterface.referencePressure); // testSystem.getCharacterization().setTBPModel("PedersenSRKHeavyOil"); testSystem.setFluidName("Condensate1"); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java index 88faa5f747..7c515a8ff1 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java @@ -3,13 +3,15 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import neqsim.processSimulation.processEquipment.stream.Stream; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; public class BeggsAndBrillsPipeTest { @Test public void testFlowNoVolumeCorrection() { neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 15), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 15), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("nC10", 50, "MSm^3/day"); testSystem.setMixingRule(2); @@ -27,7 +29,8 @@ public void testFlowNoVolumeCorrection() { @Test public void testFlowVolumeCorrection() { neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 15), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 15), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("nC10", 50, "MSm^3/day"); testSystem.setMixingRule(2); @@ -50,7 +53,8 @@ public void testPipeLineBeggsAndBrills() { double massFlowRate = 1100000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 0.5); testSystem.addComponent("nC10", 0.5); @@ -98,7 +102,8 @@ public void testPipeLineBeggsAndBrills2() { double massFlowRate = 110000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 0.5); testSystem.addComponent("nC10", 0.5); @@ -147,7 +152,8 @@ public void testPipeLineBeggsAndBrills3() { double massFlowRate = 110000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 0.3); testSystem.addComponent("nC10", 0.4); @@ -211,7 +217,8 @@ public void testPipeLineBeggsAndBrills4() { double massFlowRate = 110000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 1); testSystem.setMixingRule(2); @@ -247,7 +254,8 @@ public void testPipeLineBeggsAndBrills4() { neqsim.thermo.system.SystemInterface testSystem2 = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem2.addComponent("water", 1); testSystem2.setMixingRule(2); @@ -282,7 +290,8 @@ public void testPipeLineBeggsAndBrills4() { neqsim.thermo.system.SystemInterface testSystem3 = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem3.addComponent("ethane", 1); testSystem3.setMixingRule(2); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java b/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java index 86bca19a37..ce3c692c97 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test; import neqsim.processSimulation.measurementDevice.MultiPhaseMeter; import neqsim.processSimulation.processEquipment.stream.Stream; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -36,7 +37,7 @@ void testMain() { GORfitter gORFItter = new GORfitter("test", stream_1); gORFItter.setTemperature(15.0, "C"); - gORFItter.setPressure(1.01325, "bara"); + gORFItter.setPressure(ThermodynamicConstantsInterface.referencePressure, "bara"); gORFItter.setReferenceConditions("actual"); // gORFItter.setGVF(0.1); gORFItter.setGOR(10.1); diff --git a/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java b/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java index c943065806..537d765c4f 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java @@ -13,6 +13,7 @@ import neqsim.processSimulation.processEquipment.separator.Separator; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.util.Recycle; +import neqsim.thermo.ThermodynamicConstantsInterface; /** * Test class for GlycolRig. @@ -63,8 +64,8 @@ public void runTEGProcessTest() { column.getCondenser().setOutTemperature(273.15 + 104.0); column.getTray(1).addStream(gasToReboiler); // column.getReboiler().addStream(gasToReboiler); - column.setTopPressure(0.1 + 1.01325); - column.setBottomPressure(0.2 + 1.01325); + column.setTopPressure(0.1 + ThermodynamicConstantsInterface.referencePressure); + column.setBottomPressure(0.2 + ThermodynamicConstantsInterface.referencePressure); WaterStripperColumn stripper = new WaterStripperColumn("TEG stripper"); stripper.addSolventInStream(column.getLiquidOutStream()); @@ -199,8 +200,8 @@ public void runDistillationProcessTest() { column.addFeedStream(feedToRegenerator, 1); column.getReboiler().setOutTemperature(273.15 + 70.0); column.getCondenser().setOutTemperature(273.15 - 10.0); - column.setTopPressure(1.0 + 1.01325); - column.setBottomPressure(1.0 + 1.01325); + column.setTopPressure(1.0 + ThermodynamicConstantsInterface.referencePressure); + column.setBottomPressure(1.0 + ThermodynamicConstantsInterface.referencePressure); neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem(); diff --git a/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java b/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java index 135589a1df..7ca17be9fd 100644 --- a/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java +++ b/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java @@ -6,6 +6,7 @@ import neqsim.processSimulation.processEquipment.tank.Tank; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; import neqsim.processSimulation.processEquipment.valve.ValveInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *LNGtankfilling class.
@@ -60,7 +61,7 @@ public static void main(String args[]) { Stream stream_1 = new Stream("Methane Stream", testSystem); ValveInterface valve = new ThrottlingValve("valve", stream_1); - valve.setOutletPressure(1.01325 + 0.110); + valve.setOutletPressure(ThermodynamicConstantsInterface.referencePressure + 0.110); Tank tank = new neqsim.processSimulation.processEquipment.tank.Tank("tank"); tank.addStream(valve.getOutletStream()); @@ -84,7 +85,7 @@ public static void main(String args[]) { // ControllerDeviceInterface pressureController = new ControllerDeviceBaseClass(); // pressureController.setTransmitter(tankPressureTransmitter); // pressureController.setReverseActing(false); - // pressureController.setControllerSetPoint(1.01325+0.110); + // pressureController.setControllerSetPoint(ThermodynamicConstantsInterface.referencePressure+0.110); // pressureController.setControllerParameters(2.0,400,0); neqsim.processSimulation.processSystem.ProcessSystem operations = diff --git a/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java b/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java index 36c23238c6..eac9492228 100644 --- a/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java +++ b/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java @@ -5,6 +5,7 @@ import neqsim.processSimulation.processEquipment.separator.GasScrubber; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *@@ -88,9 +89,10 @@ public static void main(String[] args) { // operations.run(); // ((DistillationColumn)operations.getUnit("TEG regeneration // column")).setNumberOfTrays(2); - System.out.println("water in wet gas [kg/MSm3] " - + ((Stream) operations.getUnit("water saturated feed gas")).getFluid().getPhase(0) - .getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + System.out.println( + "water in wet gas [kg/MSm3] " + ((Stream) operations.getUnit("water saturated feed gas")) + .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); // mainMixer.getFluid().display(); // scrubber.getGasOutStream().displayResult(); System.out.println("hydt " + gasFromScrubber.getHydrateEquilibriumTemperature()); diff --git a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java index 755a59453f..2a483e700e 100644 --- a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java +++ b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java @@ -11,6 +11,7 @@ import neqsim.processSimulation.processEquipment.util.Recycle; import neqsim.processSimulation.processEquipment.util.SetPoint; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemSrkEos; /** @@ -82,7 +83,7 @@ public static void main(String[] args) { ThrottlingValve waterDPvalve = new ThrottlingValve("Water HP to LP valve", inletSeparator.getWaterOutStream()); - waterDPvalve.setOutletPressure(1.01325); + waterDPvalve.setOutletPressure(ThermodynamicConstantsInterface.referencePressure); Separator waterStabSep = new Separator("water degassing separator", waterDPvalve.getOutletStream()); diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java index 956aa73bfc..a90c0bbe6c 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java @@ -15,6 +15,7 @@ import neqsim.processSimulation.processEquipment.util.Recycle; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *
@@ -245,9 +246,10 @@ public static void main(String[] args) { // operations.run(); // ((DistillationColumn)operations.getUnit("TEG regeneration // column")).setNumberOfTrays(2); - System.out.println("water in wet gas " - + ((Stream) operations.getUnit("water saturated feed gas")).getFluid().getPhase(0) - .getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + System.out + .println("water in wet gas " + ((Stream) operations.getUnit("water saturated feed gas")) + .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); System.out.println("water in dry gas " + ((Stream) operations.getUnit("dry gas from absorber")) .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -258,12 +260,14 @@ public static void main(String[] args) { double waterInWetGasppm = waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / 1.0e3); System.out.println("flow rate from reboiler " diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java index c3e354b64f..410031f184 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java @@ -15,6 +15,7 @@ import neqsim.processSimulation.processEquipment.util.Recycle; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *
@@ -242,9 +243,10 @@ public static void main(String[] args) { // operations.run(); // ((DistillationColumn)operations.getUnit("TEG regeneration // column")).setNumberOfTrays(2); - System.out.println("water in wet gas " - + ((Stream) operations.getUnit("water saturated feed gas")).getFluid().getPhase(0) - .getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + System.out + .println("water in wet gas " + ((Stream) operations.getUnit("water saturated feed gas")) + .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); System.out.println("water in dry gas " + ((Stream) operations.getUnit("dry gas from absorber")) .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -255,12 +257,14 @@ public static void main(String[] args) { double waterInWetGasppm = waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / 1.0e3); System.out.println("flow rate from reboiler " diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java index f784ccf383..957f8841dc 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java @@ -17,6 +17,7 @@ import neqsim.processSimulation.processEquipment.util.SetPoint; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *
@@ -156,7 +157,7 @@ public static neqsim.processSimulation.processSystem.ProcessSystem getProcess() column.getReboiler().setOutTemperature(273.15 + 201.0); column.getCondenser().setOutTemperature(273.15 + 92.0); column.getReboiler().addStream(gasToReboiler); - column.setTopPressure(1.01325); + column.setTopPressure(ThermodynamicConstantsInterface.referencePressure); column.setBottomPressure(1.02); Heater coolerRegenGas = new Heater("regen gas cooler", column.getGasOutStream()); @@ -305,7 +306,8 @@ public static void main(String[] args) { /* * System.out.println("water in wet gas " + ((Stream) * operations.getUnit("water saturated feed gas")).getFluid() - * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * *ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); * System.out.println("water in dry gas " + ((Stream) * operations.getUnit("dry gas from absorber")).getFluid() * .getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -317,15 +319,17 @@ public static void main(String[] args) { * * double waterInWetGasppm = * waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = + * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 *ThermodynamicConstantsInterface.atm / + * (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = + * TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = * TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = * dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = + * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 *ThermodynamicConstantsInterface.atm + * / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = + * richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = * ((Stream)operations.getUnit("feed to TEG absorber")).getFluid().getPhase(0). - * getComponent("water").getz()*1.0e6*0.01802*101325.0/(8.314*288.15); - * System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / + * getComponent("water").getz()*1.0e6*0.01802*101325.0/(ThermodynamicConstantsInterface.R*288.15 + * ); System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / * 1.0e3); System.out.println("flow rate from reboiler " + ((Reboiler) * column.getReboiler()).getLiquidOutStream().getFlowRate("kg/hr")); * System.out.println("flow rate from stripping column " + diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java index 03d9f8b788..76c44ce6b6 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java @@ -453,7 +453,8 @@ public static void main(String[] args) { /* * System.out.println("water in wet gas " + ((Stream) * operations.getUnit("water saturated feed gas")).getFluid() - * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * *ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); * System.out.println("water in dry gas " + ((Stream) * operations.getUnit("dry gas from absorber")).getFluid() * .getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -480,14 +481,16 @@ public static void main(String[] args) { /* * double waterInWetGasppm = * waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = + * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 *ThermodynamicConstantsInterface.atm / + * (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = + * TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = * TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = * dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = + * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 *ThermodynamicConstantsInterface.atm + * / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = + * richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = * ((Stream)operations.getUnit("feed to TEG absorber")).getFluid().getPhase(0).getComponent( - * "water").getz()*1.0e6*0.01802*101325.0/(8.314*288.15); + * "water").getz()*1.0e6*0.01802*101325.0/(ThermodynamicConstantsInterface.R*288.15); * System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / * 1.0e3); System.out.println("flow rate from reboiler " + ((Reboiler) * column.getReboiler()).getLiquidOutStream().getFlowRate("kg/hr")); diff --git a/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java b/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java index 3e5cd35b15..12a572ff97 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java +++ b/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java @@ -37,7 +37,7 @@ public static void main(String args[]) { Separator separator = new Separator("Separator 1", stream_1); // ThrottlingValve valve_1 = new ThrottlingValve(separator.getGasOutStream()); - // valve_1.setOutletPressure(75.0 + 1.01325); + // valve_1.setOutletPressure(75.0 + ThermodynamicConstantsInterface.referencePressure); // valve_1.setIsoThermal(true); // Heater heater = new Heater(valve_1.getOutStream()); diff --git a/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java b/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java index 9dd350c644..ae1d10817f 100644 --- a/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java +++ b/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java @@ -5,6 +5,7 @@ import neqsim.processSimulation.processEquipment.separator.Separator; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *
oxygenRemovalWater class.
@@ -25,10 +26,10 @@ public static void main(String[] args) { neqsim.thermo.system.SystemInterface fluid1 = fluidCreator.create("air").autoSelectModel(); fluid1.setMultiPhaseCheck(true); neqsim.thermo.system.SystemInterface fluid2 = fluidCreator.create("water"); - fluid1.setPressure(1.01325); + fluid1.setPressure(ThermodynamicConstantsInterface.referencePressure); fluid1.setTemperature(273.15 + 10); fluid1.setTotalFlowRate(1.0, "kg/hr"); - fluid2.setPressure(1.01325); + fluid2.setPressure(ThermodynamicConstantsInterface.referencePressure); fluid2.setTemperature(273.15 + 10); fluid2.setTotalFlowRate(3500.0, "kg/hr"); diff --git a/src/test/java/neqsim/thermo/component/AmmoniaTest.java b/src/test/java/neqsim/thermo/component/AmmoniaTest.java index 6e35cc548c..1c8ea75155 100644 --- a/src/test/java/neqsim/thermo/component/AmmoniaTest.java +++ b/src/test/java/neqsim/thermo/component/AmmoniaTest.java @@ -3,6 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -15,7 +16,7 @@ public class AmmoniaTest extends neqsim.NeqSimTest { */ @BeforeAll static void setUpBeforeClass() throws Exception { - thermoSystem = new SystemSrkEos(298.0, 1.01325); + thermoSystem = new SystemSrkEos(298.0, ThermodynamicConstantsInterface.referencePressure); thermoSystem.addComponent("ammonia", 1.0); thermoSystem.init(0); } diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java index 28ed9e156b..6da9c2e5bc 100644 --- a/src/test/java/neqsim/thermo/component/NewComponentTest.java +++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseSrkEos; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -37,7 +38,7 @@ public void createComponentTest() { @Test public void newComponentTest() { - thermoSystem = new SystemSrkEos(298.0, 1.01325); + thermoSystem = new SystemSrkEos(298.0, ThermodynamicConstantsInterface.referencePressure); thermoSystem.addComponent("ammonia", 1.0); thermoSystem.init(0); assertEquals(0.01703052, thermoSystem.getMolarMass("kg/mol"), 0.01); diff --git a/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java b/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java index 1b6fe239c8..2e943e39af 100644 --- a/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java +++ b/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java @@ -1,6 +1,7 @@ package neqsim.thermo.system; import org.junit.jupiter.api.BeforeAll; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *
@@ -19,7 +20,8 @@ public class SystemSrkSchwartzentruberEosTest extends ModelBaseTest {
*/
@BeforeAll
public static void setUp() {
- thermoSystem = new SystemSrkSchwartzentruberEos(298.15, 1.01325);
+ thermoSystem = new SystemSrkSchwartzentruberEos(298.15,
+ ThermodynamicConstantsInterface.referencePressure);
thermoSystem.addComponent("methanol", 1.0);
thermoSystem.addComponent("water", 1.0);
thermoSystem.createDatabase(true);
diff --git a/src/test/java/neqsim/thermo/system/SystemThermoTest.java b/src/test/java/neqsim/thermo/system/SystemThermoTest.java
index d8dc0e93d4..16b42d536a 100644
--- a/src/test/java/neqsim/thermo/system/SystemThermoTest.java
+++ b/src/test/java/neqsim/thermo/system/SystemThermoTest.java
@@ -4,6 +4,7 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
class SystemThermoTest extends neqsim.NeqSimTest {
@@ -85,9 +86,8 @@ public void testSetPressure() {
fluid.addComponent("nitrogen", 1.0);
fluid.setPressure(0.0, "barg");
- assertEquals(1.01325, fluid.getPressure("bara"), 1e-4);
+ assertEquals(ThermodynamicConstantsInterface.referencePressure, fluid.getPressure("bara"),
+ 1e-4);
assertEquals(0.0, fluid.getPressure("barg"), 1e-4);
-
-
}
}
diff --git a/src/test/java/neqsim/thermo/util/example/ActivityCalc.java b/src/test/java/neqsim/thermo/util/example/ActivityCalc.java
index 71231c48c8..cc8db77078 100644
--- a/src/test/java/neqsim/thermo/util/example/ActivityCalc.java
+++ b/src/test/java/neqsim/thermo/util/example/ActivityCalc.java
@@ -6,6 +6,7 @@
package neqsim.thermo.util.example;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkCPAstatoil;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -28,7 +29,8 @@ public class ActivityCalc {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String args[]) {
- SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 42, 1.01325);
+ SystemInterface testSystem =
+ new SystemSrkCPAstatoil(273.15 + 42, ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
diff --git a/src/test/java/neqsim/thermo/util/example/AmineFlash.java b/src/test/java/neqsim/thermo/util/example/AmineFlash.java
index 5a438a0988..8bf2c09e33 100644
--- a/src/test/java/neqsim/thermo/util/example/AmineFlash.java
+++ b/src/test/java/neqsim/thermo/util/example/AmineFlash.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -26,8 +27,10 @@ public class AmineFlash {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String args[]) {
- SystemInterface testSystem = new SystemFurstElectrolyteEos(273.15 + 50, 1.01325);
- // SystemInterface testSystem = new SystemElectrolyteCPA(273.15+40, 1.01325);
+ SystemInterface testSystem = new SystemFurstElectrolyteEos(273.15 + 50,
+ ThermodynamicConstantsInterface.referencePressure);
+ // SystemInterface testSystem = new SystemElectrolyteCPA(273.15+40,
+ // ThermodynamicConstantsInterface.referencePressure);
double molMDEA = 0.1;
double loading = 0.4;
double density = 1088;
diff --git a/src/test/java/neqsim/thermo/util/example/FreezingPoint.java b/src/test/java/neqsim/thermo/util/example/FreezingPoint.java
index ebe9114958..059458db1b 100644
--- a/src/test/java/neqsim/thermo/util/example/FreezingPoint.java
+++ b/src/test/java/neqsim/thermo/util/example/FreezingPoint.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkCPAstatoil;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -27,10 +28,12 @@ public class FreezingPoint {
*/
public static void main(String[] args) {
// SystemInterface testSystem = new SystemSrkSchwartzentruberEos(260.15,19.00);
- SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 - 1, 1.01325);
+ SystemInterface testSystem =
+ new SystemSrkCPAstatoil(273.15 - 1, ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
- SystemInterface testSystem2 = new SystemSrkCPAstatoil(273.15 + 100, 1.01325);
+ SystemInterface testSystem2 =
+ new SystemSrkCPAstatoil(273.15 + 100, ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps2 = new ThermodynamicOperations(testSystem2);
testSystem.addComponent("methane", 0.00882);
diff --git a/src/test/java/neqsim/thermo/util/example/HydrateFlash.java b/src/test/java/neqsim/thermo/util/example/HydrateFlash.java
index 9d8317d9b0..29579bbd76 100644
--- a/src/test/java/neqsim/thermo/util/example/HydrateFlash.java
+++ b/src/test/java/neqsim/thermo/util/example/HydrateFlash.java
@@ -150,8 +150,9 @@ public static void main(String args[]) {
// testSystem.display();
// System.out.println("kg vann/MSm^3 gas " +
// (testSystem.getPhase(0).getComponent("water").getx() *
- // testSystem.getPhase(0).getComponent("water").getMolarMass() * 101325.0 /
- // 8.314 / 288.15) * 1.0e6);
+ // testSystem.getPhase(0).getComponent("water").getMolarMass()
+ // *ThermodynamicConstantsInterface.atm /
+ // ThermodynamicConstantsInterface.R / 288.15) * 1.0e6);
// System.out.println("activity coef water " +
// testSystem.getPhase(1).getActivityCoefficientSymetric(1));
// int n = testSystem.getNumberOfPhases()-1;
diff --git a/src/test/java/neqsim/thermo/util/example/ModelTest.java b/src/test/java/neqsim/thermo/util/example/ModelTest.java
index 2ffce3ac5a..e905e668e2 100644
--- a/src/test/java/neqsim/thermo/util/example/ModelTest.java
+++ b/src/test/java/neqsim/thermo/util/example/ModelTest.java
@@ -33,7 +33,8 @@ public static void main(String args[]) {
// SystemInterface testSystem = new SystemFurstElectrolyteEos(273.14 + 12,
// 61.0);
// SystemInterface testSystem = new SystemUMRPRUMCEos(300.0, 10.0);
- // SystemInterface testSystem = new SystemSrkEos(298.15, 1.01325);
+ // SystemInterface testSystem = new SystemSrkEos(298.15,
+ // ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
//testSystem.addComponent("methane", 100);
diff --git a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java
index 8e24ecee71..22e5599766 100644
--- a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java
+++ b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java
@@ -1,5 +1,6 @@
package neqsim.thermo.util.example;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemElectrolyteCPAstatoil;
import neqsim.thermo.system.SystemInterface;
@@ -22,11 +23,13 @@ public class OsmoticCoefficient {
*/
@SuppressWarnings("unused")
public static void main(String args[]) {
- SystemInterface testSystem = new SystemElectrolyteCPAstatoil(298.0, 1.01325);
- // SystemInterface testSystem = new SystemElectrolyteCPA(298.15,1.01325201325);
- // SystemInterface testSystem = new SystemSrkCPAs(298.15,1.01325);
+ SystemInterface testSystem =
+ new SystemElectrolyteCPAstatoil(298.0, ThermodynamicConstantsInterface.referencePressure);
+ // SystemInterface testSystem = new SystemElectrolyteCPA(298.15,1.01325201325);
// SystemInterface testSystem = new
- // SystemSrkSchwartzentruberEos(298.15,1.01325);
+ // SystemSrkCPAs(298.15,ThermodynamicConstantsInterface.referencePressure);
+ // SystemInterface testSystem = new
+ // SystemSrkSchwartzentruberEos(298.15,ThermodynamicConstantsInterface.referencePressure);
// creates a 0.1 molar solution 0.0018
testSystem.addComponent("methane", 10.0);
diff --git a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java
index 4937271d3c..c5362907ed 100644
--- a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java
+++ b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java
@@ -1,5 +1,6 @@
package neqsim.thermo.util.example;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -23,11 +24,14 @@ public class OsmoticCoefficient_1 {
*/
@SuppressWarnings("unused")
public static void main(String args[]) {
- SystemInterface testSystem = new SystemFurstElectrolyteEos(298.15, 1.01325);
- // SystemInterface testSystem = new SystemElectrolyteCPA(298.15,1.01325);
- // SystemInterface testSystem = new SystemSrkCPAs(298.15,1.01325);
+ SystemInterface testSystem =
+ new SystemFurstElectrolyteEos(298.15, ThermodynamicConstantsInterface.referencePressure);
// SystemInterface testSystem = new
- // SystemSrkSchwartzentruberEos(298.15,1.01325);
+ // SystemElectrolyteCPA(298.15,ThermodynamicConstantsInterface.referencePressure);
+ // SystemInterface testSystem = new
+ // SystemSrkCPAs(298.15,ThermodynamicConstantsInterface.referencePressure);
+ // SystemInterface testSystem = new
+ // SystemSrkSchwartzentruberEos(298.15,ThermodynamicConstantsInterface.referencePressure);
// creates a 0.1 molar solution 0.0018
testSystem.addComponent("CO2", 0.1);
diff --git a/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java b/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java
index b1c1fd4a8b..37c889e1f5 100644
--- a/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java
+++ b/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -137,7 +138,7 @@ public static void main(String args[]) {
logger.info("mol S8/mol gas (ppb) " + testSystem.getPhase(0).getComponent("S8").getx() * 1e9);
logger.info("mg S8/Sm^3 gas " + testSystem.getPhase(0).getComponent("S8").getx()
* testSystem.getPhase(0).getComponent("S8").getMolarMass() * 1e6
- * (101325 / (8.315 * 288.15)));
+ * (101325 / (ThermodynamicConstantsInterface.R * 288.15)));
logger.info("wt% S8 in gas " + testSystem.getPhase(0).getComponent("S8").getx()
* testSystem.getPhase(0).getComponent("S8").getMolarMass()
diff --git a/src/test/java/neqsim/thermo/util/example/TPflash2.java b/src/test/java/neqsim/thermo/util/example/TPflash2.java
index 47835671e0..3adcb4eb01 100644
--- a/src/test/java/neqsim/thermo/util/example/TPflash2.java
+++ b/src/test/java/neqsim/thermo/util/example/TPflash2.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkCPAstatoil;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -26,14 +27,16 @@ public class TPflash2 {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String[] args) {
- SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 80.0, 1.01325);
+ SystemInterface testSystem =
+ new SystemSrkCPAstatoil(273.15 + 80.0, ThermodynamicConstantsInterface.referencePressure);
testSystem.addComponent("nitrogen", 8.71604938);
// testSystem.addComponent("oxygen", 22.71604938);
testSystem.addComponent("water", 110.234567901);
testSystem.createDatabase(true);
testSystem.setMixingRule(10);
// testSystem.setMultiPhaseCheck(true);
- SystemInterface testSystem2 = new SystemSrkCPAstatoil(273.15 + 80.0, 1.01325);
+ SystemInterface testSystem2 =
+ new SystemSrkCPAstatoil(273.15 + 80.0, ThermodynamicConstantsInterface.referencePressure);
testSystem2.addComponent("nitrogen", 8.71604938);
// testSystem.addComponent("oxygen", 22.71604938);
testSystem2.addComponent("MEG", 110.234567901);
diff --git a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java
index 1909d11e56..70bd2bf68a 100644
--- a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java
+++ b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java
@@ -171,8 +171,9 @@ public static void main(String[] args) {
* testSystem.getPhase(0).getComponent("methane").getx());
*
*
- * double solubility = testSystem.getPhase(1).getComponent("CO2").getx() * 8.314 * 298.15 /
- * 101325.0 / (testSystem.getPhase(1).getMolarMass()) * 1000;
+ * double solubility = testSystem.getPhase(1).getComponent("CO2").getx() *
+ * ThermodynamicConstantsInterface.R * 298.15 /ThermodynamicConstantsInterface.atm /
+ * (testSystem.getPhase(1).getMolarMass()) * 1000;
*
* System.out.println("selectivity " + seletivity); System.out.println("CO2 solubility " +
* solubility); System.out.println("Z " + testSystem.getPhase(0).getZ()); //
diff --git a/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java b/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java
index 722bf67073..4696a02b50 100644
--- a/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java
+++ b/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.phase.PhaseType;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -30,7 +31,8 @@ public static void main(String args[]) {
// SystemInterface testSystem2 =
// util.serialization.SerializationManager.open("c:/test.fluid");
// testSystem2.display();
- SystemInterface testSystem = new SystemSrkEos(298, 1.01325);
+ SystemInterface testSystem =
+ new SystemSrkEos(298, ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
diff --git a/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java b/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java
index 7c5971e928..9bf29fe417 100644
--- a/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java
+++ b/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java
@@ -26,7 +26,7 @@ public static void main(String args[]) {
// SystemInterface testSystem = new SystemSrkEos(303.15, 10.01325);
SystemInterface testSystem = new SystemSrkCPAstatoil(303.15, 15.0);
// SystemInterface testSystem = new SystemSrkSchwartzentruberEos(298.15,
- // 1.01325);
+ // ThermodynamicConstantsInterface.referencePressure);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
testSystem.addComponent("methane", 100.0);
// testSystem.addComponent("water", 100.0);
diff --git a/src/test/java/neqsim/thermo/util/example/TestVHflash.java b/src/test/java/neqsim/thermo/util/example/TestVHflash.java
index f6ab07021e..9ad56b3f51 100644
--- a/src/test/java/neqsim/thermo/util/example/TestVHflash.java
+++ b/src/test/java/neqsim/thermo/util/example/TestVHflash.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
@@ -26,13 +27,15 @@ public class TestVHflash {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String args[]) {
- double pressureInTank = 1.01325; // Pa
+ double pressureInTank = ThermodynamicConstantsInterface.referencePressure; // Pa
double temperatureInTank = 293.15;
- double totalMolesInTank = 136000 * pressureInTank * 1.0e5 / 8.314 / temperatureInTank;
+ double totalMolesInTank =
+ 136000 * pressureInTank * 1.0e5 / ThermodynamicConstantsInterface.R / temperatureInTank;
double molefractionNitrogenInTank = 0.95;
double molesInjectedLNG = 200000.0;
- double molesInjecedVacumBreakerGas = 18 * pressureInTank * 1.0e5 / 8.314 / temperatureInTank;
+ double molesInjecedVacumBreakerGas =
+ 18 * pressureInTank * 1.0e5 / ThermodynamicConstantsInterface.R / temperatureInTank;
SystemInterface testSystem = new SystemSrkEos(temperatureInTank, pressureInTank);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
diff --git a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
index 5ee1abe953..a85bc8caf1 100644
--- a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
@@ -16,6 +16,7 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import neqsim.api.ioc.CalculationResult;
+import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemProperties;
import neqsim.thermo.system.SystemSrkEos;
@@ -105,7 +106,7 @@ void testNeqSimPython2() {
new neqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem);
double temp = 373.15;
- double press = 60.0 + 1.013;
+ double press = 60.0 + ThermodynamicConstantsInterface.referencePressure;
List
+ * testSetPressure
+ *
gasOutStream
.
*
*
- * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
+ * @return a
+ * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
+ * object
*/
public StreamInterface getGasOutStream() {
return gasOutStream;
@@ -219,7 +220,9 @@ public StreamInterface getGasOutStream() {
* Getter for the field liquidOutStream
.
*
*
- * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
+ * @return a
+ * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
+ * object
*/
public StreamInterface getLiquidOutStream() {
return liquidOutStream;
@@ -231,7 +234,9 @@ public StreamInterface getLiquidOutStream() {
*
*
* @param trayNumber a int
- * @return a {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray} object
+ * @return a
+ * {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray}
+ * object
*/
public SimpleTray getTray(int trayNumber) {
return trays.get(trayNumber);
@@ -370,14 +375,6 @@ public void run(UUID id) {
trays.get(i + 1).getLiquidOutStream());
((SimpleTray) trays.get(i)).run(id);
}
- for (int i = 1; i <= numberOfTrays - 1; i++) {
- int replaceStream = trays.get(i).getNumberOfInputStreams() - 2;
- if (i == (numberOfTrays - 1)) {
- replaceStream = trays.get(i).getNumberOfInputStreams() - 1;
- }
- ((Mixer) trays.get(i)).replaceStream(replaceStream, trays.get(i - 1).getGasOutStream());
- ((SimpleTray) trays.get(i)).run(id);
- }
for (int i = 0; i < numberOfTrays; i++) {
err += Math.abs(
oldtemps[i] - ((MixerInterface) trays.get(i)).getThermoSystem().getTemperature());
@@ -385,7 +382,7 @@ public void run(UUID id) {
logger.info("error iter " + err + " iteration " + iter);
// System.out.println("error iter " + err + " iteration " + iter);
// massBalanceCheck();
- } while (err > 1e-4 && err < errOld && iter < maxNumberOfIterations); // &&
+ } while (err > 1e-4 && err < errOld && iter < maxNumberOfIterations); // &&
// !massBalanceCheck());
// massBalanceCheck();
// componentMassBalanceCheck("water");
@@ -506,12 +503,15 @@ public boolean massBalanceCheck() {
+ trays.get(i).getGasOutStream().getPressure() + " temperature "
+ trays.get(i).getGasOutStream().getTemperature("C"));
/*
- * System.out.println( "tray " + i + " number of input streams " + numberOfInputStreams +
+ * System.out.println( "tray " + i + " number of input streams " +
+ * numberOfInputStreams +
* " water in gasout " +
* trays.get(i).getGasOutStream().getFluid().getPhase(0).getComponent("water")
* .getNumberOfmoles() + " water in liquidout " +
- * trays.get(i).getLiquidOutStream().getFluid().getPhase(0).getComponent( "water")
- * .getNumberOfmoles() + " pressure " + trays.get(i).getGasOutStream().getPressure() +
+ * trays.get(i).getLiquidOutStream().getFluid().getPhase(0).getComponent(
+ * "water")
+ * .getNumberOfmoles() + " pressure " +
+ * trays.get(i).getGasOutStream().getPressure() +
* " temperature " + trays.get(i).getGasOutStream().getTemperature("C"));
*/
}
@@ -562,8 +562,7 @@ public void energyBalanceCheck() {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String[] args) {
- neqsim.thermo.system.SystemInterface testSystem =
- new neqsim.thermo.system.SystemSrkEos((273.15 - 0.0), 15.000);
+ neqsim.thermo.system.SystemInterface testSystem = new neqsim.thermo.system.SystemSrkEos((273.15 - 0.0), 15.000);
// testSystem.addComponent("methane", 10.00);
testSystem.addComponent("ethane", 10.0);
testSystem.addComponent("CO2", 10.0);
@@ -587,8 +586,7 @@ public static void main(String[] args) {
// column.getCondenser().setHeatInput(-70000.0);
// ((Condenser) column.getCondenser()).setRefluxRatio(0.2);
- neqsim.processSimulation.processSystem.ProcessSystem operations =
- new neqsim.processSimulation.processSystem.ProcessSystem();
+ neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem();
operations.add(stream_1);
operations.add(column);
operations.run();
@@ -603,7 +601,9 @@ public static void main(String[] args) {
* getReboiler.
*
*
- * @return a {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray} object
+ * @return a
+ * {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray}
+ * object
*/
public SimpleTray getReboiler() {
return trays.get(0);
@@ -614,7 +614,9 @@ public SimpleTray getReboiler() {
* getCondenser.
*
*
- * @return a {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray} object
+ * @return a
+ * {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray}
+ * object
*/
public SimpleTray getCondenser() {
return trays.get(trays.size() - 1);
diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
index 891a95a37a..274a118766 100644
--- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
+++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
@@ -89,7 +89,8 @@ public class ThermodynamicOperations implements java.io.Serializable, Cloneable
* Constructor for ThermodynamicOperations.
*
*/
- public ThermodynamicOperations() {}
+ public ThermodynamicOperations() {
+ }
/**
* @@ -124,11 +125,12 @@ public void TPSolidflash() { } /** - * Method to perform a flash at given temperature, pressure and specified volume The number of + * Method to perform a flash at given temperature, pressure and specified volume + * The number of * moles in the system are changed to match the specified volume. * * @param volumeSpec is the specified volume - * @param unit Supported units are m3 + * @param unit Supported units are m3 */ public void TPVflash(double volumeSpec, String unit) { unit = "m3"; @@ -146,18 +148,17 @@ public void TPVflash(double volumeSpec, String unit) { public void TPflash() { double flowRate = system.getTotalNumberOfMoles(); double minimumFlowRate = 1e-50; - if (flowRate < 1e-3) { + if (flowRate < 1e-5) { system.setTotalNumberOfMoles(1.0); system.init(1); } - operation = - new neqsim.thermodynamicOperations.flashOps.TPflash(system, system.doSolidPhaseCheck()); + operation = new neqsim.thermodynamicOperations.flashOps.TPflash(system, system.doSolidPhaseCheck()); if (!isRunAsThread()) { getOperation().run(); } else { run(); } - if (flowRate < 1e-3) { + if (flowRate < 1e-5) { if (flowRate < minimumFlowRate) { system.setTotalNumberOfMoles(minimumFlowRate); } else { @@ -172,7 +173,8 @@ public void TPflash() { * TPflash. *
* - * @param checkForSolids Set true to check for solid phase and do solid phase calculations. + * @param checkForSolids Set true to check for solid phase and do solid phase + * calculations. */ public void TPflash(boolean checkForSolids) { operation = new neqsim.thermodynamicOperations.flashOps.TPflash(system, checkForSolids); @@ -184,7 +186,7 @@ public void TPflash(boolean checkForSolids) { * TPgradientFlash. * * - * @param height a double + * @param height a double * @param temperature a double * @return a {@link neqsim.thermo.system.SystemInterface} object */ @@ -223,8 +225,7 @@ public void saturateWithWater() { */ public void chemicalEquilibrium() { if (system.isChemicalSystem()) { - operation = - new neqsim.thermodynamicOperations.chemicalEquilibrium.ChemicalEquilibrium(system); + operation = new neqsim.thermodynamicOperations.chemicalEquilibrium.ChemicalEquilibrium(system); getOperation().run(); } } @@ -235,7 +236,7 @@ public void chemicalEquilibrium() { * * * @param Hspec a double - * @param type a int + * @param type a int */ public void PHflash(double Hspec, int type) { if (system.getPhase(0).getNumberOfComponents() == 1) { @@ -249,7 +250,7 @@ public void PHflash(double Hspec, int type) { /** * Method to perform a PH flash calculation. * - * @param Hspec is the enthalpy in the specified unit + * @param Hspec is the enthalpy in the specified unit * @param enthalpyUnit Supported units are J, J/mol, J/kg and kJ/kg */ public void PHflash(double Hspec, String enthalpyUnit) { @@ -309,10 +310,10 @@ public void PUflash(double Uspec) { * PUflash. * * - * @param Pspec a double - * @param Uspec a double + * @param Pspec a double + * @param Uspec a double * @param unitPressure a {@link java.lang.String} object - * @param unitEnergy a {@link java.lang.String} object + * @param unitEnergy a {@link java.lang.String} object */ public void PUflash(double Pspec, double Uspec, String unitPressure, String unitEnergy) { system.setPressure(Pspec, unitPressure); @@ -324,7 +325,7 @@ public void PUflash(double Pspec, double Uspec, String unitPressure, String unit * PUflash. * * - * @param Uspec a double + * @param Uspec a double * @param unitEnergy a {@link java.lang.String} object */ public void PUflash(double Uspec, String unitEnergy) { @@ -340,8 +341,7 @@ public void PUflash(double Uspec, String unitEnergy) { conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kg": - conversionFactorEntr = - 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -355,7 +355,7 @@ public void PUflash(double Uspec, String unitEnergy) { * * * @param Hspec a double - * @param type a int + * @param type a int */ public void PHflash2(double Hspec, int type) { operation = new PHflash(system, Hspec, type); @@ -401,10 +401,11 @@ public void PSflash(double Sspec) { } /** - * Method to perform a PS flash calculation for a specified entropy and pressure. + * Method to perform a PS flash calculation for a specified entropy and + * pressure. * * @param Sspec is the entropy in the specified unit - * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK + * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK */ public void PSflash(double Sspec, String unit) { double conversionFactor = 1.0; @@ -439,10 +440,11 @@ public void TSflash(double Sspec) { } /** - * Method to perform a TS flash calculation for a specified entropy and pressure. + * Method to perform a TS flash calculation for a specified entropy and + * pressure. * * @param Sspec is the entropy in the specified unit - * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK + * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK */ public void TSflash(double Sspec, String unit) { double conversionFactor = 1.0; @@ -495,9 +497,9 @@ public void PSflash2(double Sspec) { * VSflash. * * - * @param volume a double - * @param entropy a double - * @param unitVol a {@link java.lang.String} object + * @param volume a double + * @param entropy a double + * @param unitVol a {@link java.lang.String} object * @param unitEntropy a {@link java.lang.String} object */ public void VSflash(double volume, double entropy, String unitVol, String unitEntropy) { @@ -523,8 +525,7 @@ public void VSflash(double volume, double entropy, String unitVol, String unitEn conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kgK": - conversionFactorEntr = - 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -537,7 +538,7 @@ public void VSflash(double volume, double entropy, String unitVol, String unitEn * VSflash. * * - * @param volume a double + * @param volume a double * @param entropy a double */ public void VSflash(double volume, double entropy) { @@ -551,7 +552,7 @@ public void VSflash(double volume, double entropy) { * * * @param Vspec a double - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object */ public void TVflash(double Vspec, String unit) { double conversionFactor = 1.0; @@ -582,7 +583,7 @@ public void TVflash(double Vspec) { * PVrefluxFlash. * * - * @param refluxspec a double + * @param refluxspec a double * @param refluxPhase a int */ public void PVrefluxFlash(double refluxspec, int refluxPhase) { @@ -608,9 +609,9 @@ public void VHflash(double Vspec, double Hspec) { * VHflash. * * - * @param volume a double - * @param enthalpy a double - * @param unitVol a {@link java.lang.String} object + * @param volume a double + * @param enthalpy a double + * @param unitVol a {@link java.lang.String} object * @param unitEnthalpy a {@link java.lang.String} object */ public void VHflash(double volume, double enthalpy, String unitVol, String unitEnthalpy) { @@ -636,8 +637,7 @@ public void VHflash(double volume, double enthalpy, String unitVol, String unitE conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kg": - conversionFactorEntr = - 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -650,9 +650,9 @@ public void VHflash(double volume, double enthalpy, String unitVol, String unitE * VUflash. * * - * @param volume a double - * @param energy a double - * @param unitVol a {@link java.lang.String} object + * @param volume a double + * @param energy a double + * @param unitVol a {@link java.lang.String} object * @param unitEnergy a {@link java.lang.String} object */ public void VUflash(double volume, double energy, String unitVol, String unitEnergy) { @@ -678,8 +678,7 @@ public void VUflash(double volume, double energy, String unitVol, String unitEne conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kg": - conversionFactorEntr = - 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -861,8 +860,8 @@ public void checkScalePotential(int phaseNumber) throws Exception { * addIonToScaleSaturation. * * - * @param phaseNumber a int - * @param scaleSaltName a {@link java.lang.String} object + * @param phaseNumber a int + * @param scaleSaltName a {@link java.lang.String} object * @param nameOfIonToBeAdded a {@link java.lang.String} object * @throws java.lang.Exception if any. */ @@ -996,7 +995,7 @@ public void calcSolidComlexTemperature(String comp1, String comp2) throws Except * * * @param temperature an array of {@link double} objects - * @param pressure an array of {@link double} objects + * @param pressure an array of {@link double} objects * @return an array of {@link double} objects */ public double[] calcImobilePhaseHydrateTemperature(double[] temperature, double[] pressure) { @@ -1008,9 +1007,12 @@ public double[] calcImobilePhaseHydrateTemperature(double[] temperature, double[ for (int i = 0; i < temperature.length; i++) { /* * opsTemp = new ThermodynamicOperations(systemTemp); - * systemTemp.setTemperature(temperature[i]); systemTemp.setPressure(pressure[i]); - * systemTemp.init(0); systemTemp.display(); try { opsTemp.hydrateFormationTemperature(); } - * catch (Exception ex) { logger.error(ex.getMessage(),e); } systemTemp.display(); hydTemps[i] + * systemTemp.setTemperature(temperature[i]); + * systemTemp.setPressure(pressure[i]); + * systemTemp.init(0); systemTemp.display(); try { + * opsTemp.hydrateFormationTemperature(); } + * catch (Exception ex) { logger.error(ex.getMessage(),e); } + * systemTemp.display(); hydTemps[i] * = systemTemp.getTemperature(); * */ @@ -1063,7 +1065,7 @@ public double calcTOLHydrateFormationTemperature() { * hydrateInhibitorConcentration. * * - * @param inhibitorName a {@link java.lang.String} object + * @param inhibitorName a {@link java.lang.String} object * @param hydEqTemperature a double * @throws java.lang.Exception if any. */ @@ -1079,7 +1081,7 @@ public void hydrateInhibitorConcentration(String inhibitorName, double hydEqTemp * * * @param inhibitorName a {@link java.lang.String} object - * @param wtfrac a double + * @param wtfrac a double * @throws java.lang.Exception if any. */ public void hydrateInhibitorConcentrationSet(String inhibitorName, double wtfrac) @@ -1207,7 +1209,7 @@ public void hydrateEquilibriumLine(double minimumPressure, double maximumPressur * calcCricoP. * * - * @param cricondenBar an array of {@link double} objects + * @param cricondenBar an array of {@link double} objects * @param cricondenBarX an array of {@link double} objects * @param cricondenBarY an array of {@link double} objects */ @@ -1225,7 +1227,7 @@ public void calcCricoP(double[] cricondenBar, double[] cricondenBarX, double[] c * calcCricoT. * * - * @param cricondenTherm an array of {@link double} objects + * @param cricondenTherm an array of {@link double} objects * @param cricondenThermX an array of {@link double} objects * @param cricondenThermY an array of {@link double} objects */ @@ -1376,7 +1378,7 @@ public void constantPhaseFractionTemperatureFlash(double fraction) throws Except * * @param componentName a {@link java.lang.String} object * @param specification a {@link java.lang.String} object - * @param spec a double + * @param spec a double * @throws java.lang.Exception if any. */ public void dewPointMach(String componentName, String specification, double spec) @@ -1433,8 +1435,8 @@ public void dewPointMach(String componentName, String specification, double spec * @throws java.lang.Exception if any. */ public void dewPointTemperatureFlash() throws Exception { - ConstantDutyFlashInterface operation = - new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash(system); + ConstantDutyFlashInterface operation = new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash( + system); operation.run(); if (Double.isNaN(system.getTemperature()) || operation.isSuperCritical()) { throw new neqsim.util.exception.IsNaNException(this.getClass().getSimpleName(), @@ -1451,8 +1453,8 @@ public void dewPointTemperatureFlash() throws Exception { * @throws java.lang.Exception if any. */ public void dewPointTemperatureFlash(boolean derivatives) throws Exception { - ConstantDutyFlashInterface operation = - new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash(system); + ConstantDutyFlashInterface operation = new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash( + system); if (derivatives) { operation = new dewPointTemperatureFlashDer(system); } @@ -1535,7 +1537,7 @@ public void calcPTphaseEnvelope() { * * * @param bubfirst a boolean - * @param lowPres a double + * @param lowPres a double */ public void calcPTphaseEnvelope(boolean bubfirst, double lowPres) { double phasefraction = 1.0 - 1e-10; @@ -1591,7 +1593,7 @@ public void calcPTphaseEnvelope(boolean bubfirst) { * calcPTphaseEnvelope. * * - * @param lowPres a double + * @param lowPres a double * @param phasefraction a double */ public void calcPTphaseEnvelope(double lowPres, double phasefraction) { @@ -1618,14 +1620,14 @@ public void calcPTphaseEnvelopeNew() { * OLGApropTable. * * - * @param minTemp a double - * @param maxTemp a double + * @param minTemp a double + * @param maxTemp a double * @param temperatureSteps a int - * @param minPres a double - * @param maxPres a double - * @param pressureSteps a int - * @param filename a {@link java.lang.String} object - * @param TABtype a int + * @param minPres a double + * @param maxPres a double + * @param pressureSteps a int + * @param filename a {@link java.lang.String} object + * @param TABtype a int */ public void OLGApropTable(double minTemp, double maxTemp, int temperatureSteps, double minPres, double maxPres, int pressureSteps, String filename, int TABtype) { @@ -1643,14 +1645,14 @@ public void OLGApropTable(double minTemp, double maxTemp, int temperatureSteps, * OLGApropTablePH. * * - * @param minEnthalpy a double - * @param maxEnthalpy a double + * @param minEnthalpy a double + * @param maxEnthalpy a double * @param enthalpySteps a int - * @param minPres a double - * @param maxPres a double + * @param minPres a double + * @param maxPres a double * @param pressureSteps a int - * @param filename a {@link java.lang.String} object - * @param TABtype a int + * @param filename a {@link java.lang.String} object + * @param TABtype a int */ public void OLGApropTablePH(double minEnthalpy, double maxEnthalpy, int enthalpySteps, double minPres, double maxPres, int pressureSteps, String filename, int TABtype) { @@ -1720,8 +1722,7 @@ public double[][] getData() { * @return an array of {@link java.lang.String} objects */ public String[][] getDataPoints() { - String[][] str = - new String[getOperation().getPoints(0).length][getOperation().getPoints(0)[0].length]; + String[][] str = new String[getOperation().getPoints(0).length][getOperation().getPoints(0)[0].length]; for (int i = 0; i < getOperation().getPoints(0).length; i++) { for (int j = 0; j < getOperation().getPoints(0)[0].length; j++) { str[i][j] = Double.toString(getOperation().getPoints(0)[i][j]); @@ -1910,8 +1911,8 @@ public void calcIonComposition(int phaseNumber) { * * * @param flashType Type of flash. - * @param spec1 Value of spec1 - * @param spec2 Value of spec2 + * @param spec1 Value of spec1 + * @param spec2 Value of spec2 * @param unitSpec1 Unit of spec1 * @param unitSpec2 Unit of spec2 */ @@ -1946,16 +1947,19 @@ public void flash(FlashType flashType, double spec1, double spec2, String unitSp } /** - * Perform flashes and return System properties per set of Spec1 and Spec2. Possible to specify + * Perform flashes and return System properties per set of Spec1 and Spec2. + * Possible to specify * fractions for each value of Spec1. * - * @param Spec1 Flash pressure in bar absolute. - * @param Spec2 Flash specification. Depends on FlashMode. Temperature in Kelvin, entalphy in - * J/mol or entropy in J/molK. - * @param FlashMode 1 - PT 2 - PH 3 - PS - * @param components Not yet in use. - * @param onlineFractions Specify fractions per sample instance or null to use static composition - * specified in system. + * @param Spec1 Flash pressure in bar absolute. + * @param Spec2 Flash specification. Depends on FlashMode. Temperature + * in Kelvin, entalphy in + * J/mol or entropy in J/molK. + * @param FlashMode 1 - PT 2 - PH 3 - PS + * @param components Not yet in use. + * @param onlineFractions Specify fractions per sample instance or null to use + * static composition + * specified in system. * @return Object CalculationResult object */ public CalculationResult propertyFlash(ListConstructor for ControllerDeviceBaseClass.
+ *+ * Constructor for ControllerDeviceBaseClass. + *
*/ public ControllerDeviceBaseClass() { super("controller"); @@ -75,7 +77,8 @@ public void runTransient(double initResponse, double dt, UUID id) { transmitter.getMeasuredPercentValue() - (controllerSetPoint - transmitter.getMinimumValue()) / (transmitter.getMaximumValue() - transmitter.getMinimumValue()) * 100; - TintValue += Kp / Ti * error * dt; + if (Ti > 0) + TintValue += Kp / Ti * error * dt; double TderivValue = Kp * Td * (error - oldError) / dt; response = initResponse + propConstant * (Kp * error + TintValue + TderivValue); // System.out.println("error " + error + " %"); diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java index e3ababd76a..e1765f7c64 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java @@ -60,11 +60,14 @@ public class Separator extends ProcessEquipmentBaseClass implements SeparatorInt /** Inner diameter/height of separator volume. */ private double internalDiameter = 1.0; - double liquidVolume = 1.0; - double gasVolume = 18.0; + /** LiquidLevel as volume fraction of liquidvolume/(liquid + gas volume). */ - private double liquidLevel = liquidVolume / (liquidVolume + gasVolume); + private double liquidLevel = 0.5; + double liquidVolume = + Math.PI * internalDiameter * internalDiameter / 4.0 * separatorLength * liquidLevel; + double gasVolume = + Math.PI * internalDiameter * internalDiameter / 4.0 * separatorLength * (1.0 - liquidLevel); private double designLiquidLevelFraction = 0.8; ArrayList
+ * Setter for the field gasCarryunderFraction
.
+ *
* Getter for the field liquidLevel
.
@@ -499,7 +543,7 @@ public void setInternalDiameter(double diameter) {
* @return a double
*/
public double getGasSuperficialVelocity() {
- return thermoSystem.getPhase(0).getTotalVolume() / 1e5
+ return thermoSystem.getPhase(0).getVolume("m3")
/ (neqsim.thermo.ThermodynamicConstantsInterface.pi * getInternalDiameter()
* getInternalDiameter() / 4.0);
}
@@ -554,7 +598,7 @@ public double getDeRatedGasLoadFactor() {
if (surfaceTension < 10.0e-3) {
derating = 1.0 - 0.5 * (10.0e-3 - surfaceTension) / 10.0e-3;
}
- System.out.println("derating " + derating);
+ // System.out.println("derating " + derating);
double term1 = (thermoSystem.getPhase(1).getPhysicalProperties().getDensity()
- thermoSystem.getPhase(0).getPhysicalProperties().getDensity())
/ thermoSystem.getPhase(0).getPhysicalProperties().getDensity();
@@ -577,7 +621,7 @@ public double getDeRatedGasLoadFactor(int phase) {
if (surfaceTension < 10.0e-3) {
derating = 1.0 - 0.5 * (10.0e-3 - surfaceTension) / 10.0e-3;
}
- System.out.println("derating " + derating);
+ // System.out.println("derating " + derating);
double term1 = (thermoSystem.getPhase(phase).getPhysicalProperties().getDensity()
- thermoSystem.getPhase(0).getPhysicalProperties().getDensity())
/ thermoSystem.getPhase(0).getPhysicalProperties().getDensity();
@@ -658,7 +702,7 @@ public SeparatorSection getSeparatorSection(String name) {
return sec;
}
}
- System.out.println("no section with name: " + name + " found.....");
+ // System.out.println("no section with name: " + name + " found.....");
return null;
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/SeparatorInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/SeparatorInterface.java
index 39982d1a6c..fbebf9556d 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/separator/SeparatorInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/SeparatorInterface.java
@@ -35,4 +35,6 @@ public interface SeparatorInterface extends SimulationInterface {
* @param diam a double
*/
public void setInternalDiameter(double diam);
+
+ public void setLiquidLevel(double liquidlev);
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java b/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
index 6fd0fae3bc..746329e155 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
@@ -1,6 +1,8 @@
package neqsim.processSimulation.processEquipment.valve;
import java.util.UUID;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.mechanicalDesign.valve.ValveMechanicalDesign;
import neqsim.processSimulation.processEquipment.TwoPortEquipment;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
@@ -17,7 +19,7 @@
*/
public class ThrottlingValve extends TwoPortEquipment implements ValveInterface {
private static final long serialVersionUID = 1000;
-
+ static Logger logger = LogManager.getLogger(ThrottlingValve.class);
SystemInterface thermoSystem;
private boolean valveCvSet = false;
@@ -28,6 +30,8 @@ public class ThrottlingValve extends TwoPortEquipment implements ValveInterface
private double Cv;
private double maxMolarFlow = 1000.0;
private double minMolarFlow = 0.0;
+ private double maxValveOpening = 100.0;
+ private double minValveOpening = 0.0;
private double percentValveOpening = 100.0;
double molarFlow = 0.0;
private String pressureUnit = "bara";
@@ -229,8 +233,12 @@ public void run(UUID id) {
molarFlow = inStream.getThermoSystem().getTotalNumberOfMoles();
}
- inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
- inStream.getThermoSystem().init(3);
+ try {
+ inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
+ inStream.getThermoSystem().init(3);
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
// inletStream.run(id);
outStream.setThermoSystem(thermoSystem.clone());
@@ -286,22 +294,21 @@ public void runTransient(double dt, UUID id) {
* Math.sqrt(
(inStream.getThermoSystem().getPressure() - outStream.getThermoSystem().getPressure())
/ thermoSystem.getDensity());
- // System.out.println("molar flow " + molarFlow);
- // System.out.println("Cv " + getCv());
- // System.out.println("density " + inletStream.getThermoSystem().getDensity());
-
- // 8 } else {
- // molarFlow=inletStream.getThermoSystem().getTotalNumberOfMoles();
- // }
-
- inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
- inStream.getThermoSystem().init(1);
- inStream.run(id);
-
- outStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
- outStream.getThermoSystem().init(1);
- outStream.run(id);
+ try {
+ inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
+ inStream.getThermoSystem().init(1);
+ // inStream.run(id);
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+ try {
+ outStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
+ outStream.getThermoSystem().init(1);
+ // outStream.run(id);
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
// System.out.println("delta p valve " +
// (inletStream.getThermoSystem().getPressure() -
// outStream.getThermoSystem().getPressure()));
@@ -323,17 +330,21 @@ public void runController(double dt, UUID id) {
if (hasController) {
getController().runTransient(this.percentValveOpening, dt, id);
this.percentValveOpening = getController().getResponse();
- if (this.percentValveOpening > 100) {
- this.percentValveOpening = 100;
+ if (this.percentValveOpening > maxValveOpening) {
+ this.percentValveOpening = maxValveOpening;
}
- if (this.percentValveOpening < 0) {
- this.percentValveOpening = 1e-10;
+ if (this.percentValveOpening < minValveOpening) {
+ this.percentValveOpening = minValveOpening;
}
// System.out.println("valve opening " + this.percentValveOpening + " %");
}
setCalculationIdentifier(id);
}
+ public void setMinimumValveOpening(double minopen) {
+ minValveOpening = minopen;
+ }
+
/** {@inheritDoc} */
@Override
public double getCv() {
diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java
index c32529e658..c63a5a38f9 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java
@@ -33,7 +33,7 @@ public class ProcessSystem extends SimulationBaseClass {
static Logger logger = LogManager.getLogger(ProcessSystem.class);
transient Thread thisThread;
- String[][] signalDB = new String[1000][100];
+ String[][] signalDB = new String[10000][100];
private double surroundingTemperature = 288.15;
private int timeStepNumber = 0;
private ArrayList
+ * Constructor for ControllerDeviceBaseClass. + *
+ * + * @param name Name of PID controller object + */ + public ControllerDeviceBaseClass(String name) { + super(name); } /** {@inheritDoc} */ @@ -77,8 +91,9 @@ public void runTransient(double initResponse, double dt, UUID id) { transmitter.getMeasuredPercentValue() - (controllerSetPoint - transmitter.getMinimumValue()) / (transmitter.getMaximumValue() - transmitter.getMinimumValue()) * 100; - if (Ti > 0) + if (Ti != 0) { TintValue += Kp / Ti * error * dt; + } double TderivValue = Kp * Td * (error - oldError) / dt; response = initResponse + propConstant * (Kp * error + TintValue + TderivValue); // System.out.println("error " + error + " %"); @@ -142,7 +157,11 @@ public double getKp() { * @param Kp Proportional gain of PID controller */ public void setKp(double Kp) { - this.Kp = Kp; + if (Kp >= 0) { + this.Kp = Kp; + } else { + logger.warn("Negative Kp is not allowed. Use setReverseActing."); + } } /** {@inheritDoc} */ @@ -172,7 +191,11 @@ public double getTi() { * @param Ti Integral time in seconds */ public void setTi(double Ti) { - this.Ti = Ti; + if (Ti >= 0) { + this.Ti = Ti; + } else { + logger.warn("Negative Ti is not allowed."); + } } /** @@ -194,6 +217,10 @@ public double getTd() { * @param Td Derivative time in seconds */ public void setTd(double Td) { - this.Td = Td; + if (Td >= 0) { + this.Td = Td; + } else { + logger.warn("Negative Td is not allowed."); + } } } diff --git a/src/test/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClassTest.java b/src/test/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClassTest.java new file mode 100644 index 0000000000..010ede2656 --- /dev/null +++ b/src/test/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClassTest.java @@ -0,0 +1,98 @@ +package neqsim.processSimulation.controllerDevice; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +public class ControllerDeviceBaseClassTest { + + static ControllerDeviceBaseClass c; + + @BeforeAll + static void setUp() { + c = new ControllerDeviceBaseClass("testPID"); + } + + @Test + void testSetControllerParameters() { + double zero = 0; + double positive = 9.9; + double negative = -0.1; + + c.setControllerParameters(zero, zero, zero); + + Assertions.assertEquals(zero, c.getKp()); + Assertions.assertEquals(zero, c.getTd()); + Assertions.assertEquals(zero, c.getTi()); + + c.setControllerParameters(positive, positive, positive); + Assertions.assertEquals(positive, c.getKp()); + Assertions.assertEquals(positive, c.getTd()); + Assertions.assertEquals(positive, c.getTi()); + + c.setControllerParameters(negative, positive, positive); + Assertions.assertEquals(positive, c.getKp()); + Assertions.assertEquals(positive, c.getTd()); + Assertions.assertEquals(positive, c.getTi()); + + c.setControllerParameters(positive, negative, positive); + Assertions.assertEquals(positive, c.getKp()); + Assertions.assertEquals(positive, c.getTd()); + Assertions.assertEquals(positive, c.getTi()); + + c.setControllerParameters(positive, positive, negative); + Assertions.assertEquals(positive, c.getKp()); + Assertions.assertEquals(positive, c.getTd()); + Assertions.assertEquals(positive, c.getTi()); + } + + @Test + void testGetKp() { + double kp = c.getKp(); + Assertions.assertEquals(c.getKp(), kp); + } + + @Test + void testGetTd() { + double td = c.getTd(); + Assertions.assertEquals(c.getTd(), td); + } + + @Test + void testGetTi() { + double ti = c.getTi(); + Assertions.assertEquals(c.getTi(), ti); + } + + @Test + void testGetUnit() { + String unit = c.getUnit(); + Assertions.assertEquals(c.getUnit(), unit); + } + + @Test + void testIsReverseActing() { + boolean isReverse = c.isReverseActing(); + Assertions.assertEquals(isReverse, c.isReverseActing()); + } + + @Test + void testSetReverseActing() { + boolean testValue = true; + boolean oldValue = c.isReverseActing(); + c.setReverseActing(testValue); + Assertions.assertEquals(testValue, c.isReverseActing()); + c.setReverseActing(oldValue); + Assertions.assertEquals(oldValue, c.isReverseActing()); + } + + @Test + void testSetUnit() { + String testUnit = "test"; + String oldUnit = c.getUnit(); + c.setUnit(testUnit); + Assertions.assertEquals(testUnit, c.getUnit()); + c.setUnit(oldUnit); + Assertions.assertEquals(oldUnit, c.getUnit()); + } +} From ed19e820d4e6e9fff5c5b485b450a5c5f65db8d6 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Wed, 6 Dec 2023 18:35:11 +0100 Subject: [PATCH 050/317] fix controller (#874) --- .../ControllerDeviceBaseClass.java | 11 ++++----- .../ProcessSystemRunTransientTest.java | 24 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java b/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java index 65c6cfe725..f45586669d 100644 --- a/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java +++ b/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java @@ -92,13 +92,12 @@ public void runTransient(double initResponse, double dt, UUID id) { / (transmitter.getMaximumValue() - transmitter.getMinimumValue()) * 100; if (Ti != 0) { - TintValue += Kp / Ti * error * dt; + TintValue = Kp / Ti * error; } - double TderivValue = Kp * Td * (error - oldError) / dt; - response = initResponse + propConstant * (Kp * error + TintValue + TderivValue); - // System.out.println("error " + error + " %"); - // error = device.getMeasuredPercentValue()-controlValue; - // double regulatorSignal = error*1.0; + double TderivValue = Kp * Td * ((error - 2 * oldError + oldoldError) / (dt * dt)); + + response = initResponse + + propConstant * ((Kp * (error - oldError) / dt) + TintValue + TderivValue) * dt; calcIdentifier = id; } diff --git a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java index f26409e3b4..b203204600 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java @@ -83,7 +83,7 @@ public void testDynamicCalculation() { flowController.setTransmitter(flowTransmitter); flowController.setReverseActing(true); flowController.setControllerSetPoint(73.5); - flowController.setControllerParameters(0.4, 10.0, 0.0); + flowController.setControllerParameters(0.2, 100.0, 0.0); p.add(stream1); p.add(valve1); @@ -97,8 +97,8 @@ public void testDynamicCalculation() { p.run(); // transient behaviour - p.setTimeStep(1.0); - for (int i = 0; i < 50; i++) { + p.setTimeStep(20.0); + for (int i = 0; i < 200; i++) { // System.out.println("volume flow " + flowTransmitter.getMeasuredValue() + " valve opening " // + valve1.getPercentValveOpening() + " pressure " // + separator1.getGasOutStream().getPressure()); @@ -125,12 +125,12 @@ public void testDynamicCalculation2() { testSystem3.setMixingRule(2); Stream stream1 = new Stream("Stream1", testSystem2); - stream1.setFlowRate(100.0, "kg/hr"); + stream1.setFlowRate(1090.0, "kg/hr"); stream1.setPressure(10.0, "bara"); stream1.setTemperature(25.0, "C"); Stream streamPurge = new Stream("StreamPurge", testSystem3); - streamPurge.setFlowRate(5.0, "kg/hr"); + streamPurge.setFlowRate(50.0, "kg/hr"); streamPurge.setPressure(10.0, "bara"); streamPurge.setTemperature(25.0, "C"); @@ -173,7 +173,7 @@ public void testDynamicCalculation2() { separatorLevelController.setReverseActing(false); separatorLevelController.setTransmitter(separatorLevelTransmitter); separatorLevelController.setControllerSetPoint(0.45); - separatorLevelController.setControllerParameters(5.0, 5000.0, 0.0); + separatorLevelController.setControllerParameters(2.0, 500.0, 0.0); PressureTransmitter separatorPressureTransmitter = new PressureTransmitter(separator1.getGasOutStream()); @@ -185,7 +185,7 @@ public void testDynamicCalculation2() { separatorPressureController.setTransmitter(separatorPressureTransmitter); separatorPressureController.setReverseActing(false); separatorPressureController.setControllerSetPoint(7.0); - separatorPressureController.setControllerParameters(0.35, 0, 0.0); + separatorPressureController.setControllerParameters(1, 100, 0.0); p.add(stream1); p.add(streamPurge); @@ -208,8 +208,8 @@ public void testDynamicCalculation2() { } // p.displayResult(); - p.setTimeStep(50.0); - for (int i = 0; i < 200; i++) { + p.setTimeStep(10.0); + for (int i = 0; i < 250; i++) { // System.out.println("pressure " + separator1.getGasOutStream().getPressure() + " flow " // + separator1.getGasOutStream().getFlowRate("kg/hr") + " sepr height " // + separatorLevelTransmitter.getMeasuredValue() + "valve2 opening " @@ -280,7 +280,7 @@ public void testDynamicCalculation3() { separatorPressureController.setTransmitter(separatorPressureTransmitter); separatorPressureController.setReverseActing(false); separatorPressureController.setControllerSetPoint(5.0); - separatorPressureController.setControllerParameters(0.5, 500.0, 0.0); + separatorPressureController.setControllerParameters(1, 200.0, 0.0); p.add(stream1); p.add(streamPurge); @@ -298,8 +298,8 @@ public void testDynamicCalculation3() { } // p.displayResult(); - p.setTimeStep(20.0); - for (int i = 0; i < 200; i++) { + p.setTimeStep(10.0); + for (int i = 0; i < 500; i++) { // System.out.println("pressure " + separator1.getGasOutStream().getPressure() + " flow " // + separator1.getGasOutStream().getFlowRate("kg/hr") + "valve3 opening " // + valve3.getPercentValveOpening()); From dbdc5a6f2895c40b83fbe9f7ba6f78a4eb806108 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Wed, 6 Dec 2023 18:37:34 +0100 Subject: [PATCH 051/317] version 2.5.12 (#875) * Update pom.xml * Update pomJava8.xml --- pom.xml | 2 +- pomJava8.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0d70674fbe..a383957ff8 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@
@@ -858,4 +859,14 @@ public double getOGIP(String unit) {
public double getTime() {
return time;
}
+
+ public void setLowPressureLimit(double value, String unit) {
+ PressureUnit conver = new PressureUnit(value, unit);
+ lowPressureLimit = conver.getValue("bara");
+ }
+
+ public double getLowPressureLimit(String unit) {
+ PressureUnit conver = new PressureUnit(lowPressureLimit, "bara");
+ return conver.getValue(unit);
+ }
}
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java
index b26f243b70..51ae93546f 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java
@@ -60,5 +60,9 @@ void testRun2() {
}
Assertions.assertEquals(352.274030, reservoirOps.getReservoirFluid().getPressure("bara"), 0.1);
Assertions.assertEquals(11.698, reservoirOps.getWaterProdution("Sm3/day"), 0.1);
+
+ reservoirOps.setLowPressureLimit(52.0e5, "Pa");
+ Assertions.assertEquals(52.0, reservoirOps.getLowPressureLimit("bara"), 0.1);
+ Assertions.assertEquals(52.0e5, reservoirOps.getLowPressureLimit("Pa"), 0.1);
}
}
From 3ae379458ff9a4b9f0e9cf38d85098f21fc5b5c2 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Thu, 21 Dec 2023 09:25:26 +0100
Subject: [PATCH 059/317] added test for umrpru (#886)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* added test for umrpru
* updated
* update
* fix bug saturation temperature and add test
* update name
* Update src/main/java/neqsim/PVTsimulation/simulation/SaturationTemperature.java
good suggestion
Co-authored-by: Jørgen Engelsen
+ * checkSaturationTemperatureToPhaseEnvelope.
+ *
+ * checkPhaseEnvelope2.
+ *
@@ -54,6 +55,19 @@ public ControllerDeviceBaseClass() {
this("controller");
}
+
+ /** {@inheritDoc} */
+ @Override
+ public void setActive(boolean isActive) {
+ this.isActive = isActive;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isActive() {
+ return isActive;
+ }
+
/**
*
* Constructor for ControllerDeviceBaseClass.
@@ -80,6 +94,11 @@ public double getMeasuredValue() {
/** {@inheritDoc} */
@Override
public void runTransient(double initResponse, double dt, UUID id) {
+ if (!isActive) {
+ response = initResponse;
+ calcIdentifier = id;
+ return;
+ }
if (isReverseActing()) {
propConstant = -1;
}
diff --git a/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceInterface.java b/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceInterface.java
index 4f2052ea56..d123546982 100644
--- a/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceInterface.java
+++ b/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceInterface.java
@@ -128,4 +128,20 @@ public default void runTransient(double initResponse, double dt) {
/** {@inheritDoc} */
@Override
public int hashCode();
+
+ /**
+ *
+ * setActive
+ *
+ * isActive
+ *
+ * CompressorMonitor class.
+ *
+ * Constructor for CompressorMonitor.
+ *
+ * Constructor for CompressorMonitor.
+ *
* generateCompressorCurves.
@@ -955,6 +1001,12 @@ public boolean isSurge(double flow, double head) {
return getAntiSurge().isSurge();
}
+ public double getDistanceToSurge() {
+ return (getInletStream().getFlowRate("m3/hr")
+ - getCompressorChart().getSurgeCurve().getSurgeFlow(getPolytropicFluidHead()))
+ / getCompressorChart().getSurgeCurve().getSurgeFlow(getPolytropicFluidHead());
+ }
+
/**
*
* isStoneWall.
@@ -985,9 +1037,9 @@ public void setAntiSurge(AntiSurge antiSurge) {
* Getter for the field
+ * runController.
+ *
* addSurgeCurve.
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java
index 04f0df49d9..7f6228d226 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java
@@ -541,4 +541,10 @@ public static int bisect_left(Double[] A, double x, int lo, int hi) {
/** {@inheritDoc} */
@Override
public void plot() {}
+
+ /** {@inheritDoc} */
+ @Override
+ public double getFlow(double head, double speed, double guessFlow) {
+ return 0.0;
+ }
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java
index 4a58c6fef4..6aa50411b0 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java
@@ -21,25 +21,31 @@ public CompressorChart generateCompressorChart(String generationOption) {
double[] chartConditions = new double[3];
chartConditions[0] = compressor.getOutletStream().getFluid().getMolarMass("kg/mol");
- int refspeed = compressor.getSpeed();
+ double refspeed = compressor.getSpeed();
double[] speed = new double[1];
speed[0] = refspeed;
double minSpeed = refspeed / 2.0;
double maxSpeed = refspeed * 2.0;
+ compressor.getInletStream().getFluid().initPhysicalProperties("density");
double refflow = compressor.getInletStream().getFlowRate("m3/hr");
- double[][] flow = new double[1][1];
- flow[0][0] = refflow;
+ double[][] flow = new double[1][3];
+ flow[0][0] = refflow * 0.7;
+ flow[0][1] = refflow * 1.0;
+ flow[0][2] = refflow * 1.43;
double minFlow = refflow / 2.0;
double maxFlow = refflow * 2.0;
- double refhead = compressor.getPolytropicHead("kJ/kg");
- double[][] head = new double[1][1];
- head[0][0] = refhead;
-
- double[][] polyEff = new double[1][1];
- polyEff[0][0] = compressor.getPolytropicEfficiency() * 100.0;
+ double refhead = compressor.getPolytropicFluidHead();
+ double[][] head = new double[1][3];
+ head[0][0] = refhead * 1.5;
+ head[0][1] = refhead;
+ head[0][2] = refhead * 0.5;
+ double[][] polyEff = new double[1][3];
+ polyEff[0][0] = compressor.getPolytropicEfficiency() * 100.0 * 0.9;
+ polyEff[0][1] = compressor.getPolytropicEfficiency() * 100.0;
+ polyEff[0][2] = compressor.getPolytropicEfficiency() * 100.0 * 0.85;
CompressorChart compChart = new CompressorChart();
compChart.setUseCompressorChart(true);
compChart.setHeadUnit("kJ/kg");
@@ -47,9 +53,9 @@ public CompressorChart generateCompressorChart(String generationOption) {
// Generating surge curve
- double minFlowSurgeFlow = 0.3 * refflow;
- double refSurgeFlow = 0.5 * refflow;
- double maxSurgeFlow = 0.8 * refflow;
+ double minFlowSurgeFlow = 0.7 * refflow;
+ double refSurgeFlow = 0.8 * refflow;
+ double maxSurgeFlow = 0.9 * refflow;
double headSurgeRef = compChart.getPolytropicHead(refSurgeFlow, refspeed);
double headSurgeMin = compChart.getPolytropicHead(minFlow, minSpeed);
double headSurgeMax = compChart.getPolytropicHead(maxSurgeFlow, maxSpeed);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java
index 1c3f72efa2..53e7507da1 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java
@@ -166,4 +166,7 @@ public void setReferenceConditions(double refMW, double refTemperature, double r
/** {@inheritDoc} */
@Override
public int hashCode();
+
+ /** {@inheritDoc} */
+ public double getFlow(double head, double speed, double guessFlow);
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java
index 1fea5d6015..a746e80f1f 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java
@@ -71,4 +71,14 @@ public interface CompressorInterface extends ProcessEquipmentInterface, TwoPortI
* @return a {@link neqsim.processSimulation.processEquipment.compressor.AntiSurge} object
*/
public AntiSurge getAntiSurge();
+
+ public double getDistanceToSurge();
+
+ public void setMaximumSpeed(double maxSpeed);
+
+ public void setMinimumSpeed(double minspeed);
+
+ public double getMaximumSpeed();
+
+ public double getMinimumSpeed();
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java
index b2eb357720..70d196ec35 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java
@@ -7,7 +7,6 @@
package neqsim.processSimulation.processEquipment.heatExchanger;
import java.util.UUID;
-
import neqsim.processSimulation.processEquipment.TwoPortEquipment;
import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
@@ -221,6 +220,24 @@ public void run(UUID id) {
setCalculationIdentifier(id);
}
+ /** {@inheritDoc} */
+ @Override
+ public void runTransient(double dt, UUID id) {
+ if (getCalculateSteadyState()) {
+ run(id);
+ increaseTime(dt);
+ return;
+ } else {
+ inStream.setPressure(outStream.getPressure());
+ inStream.run();
+ run(id);
+ increaseTime(dt);
+ return;
+ }
+
+ }
+
+
/** {@inheritDoc} */
@Override
public void displayResult() {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
index 7daf913ba9..765833c95c 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
@@ -4,6 +4,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
+import neqsim.processSimulation.processEquipment.mixer.Mixer;
import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.thermo.system.SystemInterface;
@@ -241,6 +242,31 @@ public void run(UUID id) {
setCalculationIdentifier(id);
}
+ /** {@inheritDoc} */
+ @Override
+ public void runTransient(double dt, UUID id) {
+ if (getCalculateSteadyState()) {
+ run(id);
+ increaseTime(dt);
+ return;
+ } else {
+
+ Mixer mixer = new Mixer();
+ for (int i = 0; i < splitStream.length; i++) {
+ splitStream[i].setPressure(inletStream.getPressure());
+ splitStream[i].setTemperature(inletStream.getTemperature("C"), "C");
+ splitStream[i].run();
+ mixer.addStream(splitStream[i]);
+ }
+ mixer.run();
+
+ inletStream.setThermoSystem(mixer.getThermoSystem());
+ inletStream.run();
+ setCalculationIdentifier(id);
+ return;
+ }
+ }
+
/** {@inheritDoc} */
@Override
public void displayResult() {}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/SetPoint.java b/src/main/java/neqsim/processSimulation/processEquipment/util/SetPoint.java
index 1333e42f65..6213a8d209 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/SetPoint.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/SetPoint.java
@@ -71,7 +71,7 @@ public SetPoint(String name, ProcessEquipmentInterface targetEquipment, String t
this.targetEquipment = targetEquipment;
this.targetVariable = targetVariable;
this.sourceEquipment = sourceEquipment;
- run();
+ // run();
}
/**
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java b/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
index 746329e155..9441f872a1 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
@@ -298,14 +298,14 @@ public void runTransient(double dt, UUID id) {
try {
inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
inStream.getThermoSystem().init(1);
- // inStream.run(id);
+ inStream.run(id);
} catch (Exception e) {
logger.error(e.getMessage());
}
try {
outStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
outStream.getThermoSystem().init(1);
- // outStream.run(id);
+ outStream.run(id);
} catch (Exception e) {
logger.error(e.getMessage());
}
@@ -327,7 +327,7 @@ public void runTransient(double dt, UUID id) {
* @param id Calculation identifier
*/
public void runController(double dt, UUID id) {
- if (hasController) {
+ if (hasController && getController().isActive()) {
getController().runTransient(this.percentValveOpening, dt, id);
this.percentValveOpening = getController().getResponse();
if (this.percentValveOpening > maxValveOpening) {
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java
index 15adb97bac..77c2ecea31 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/CompressorResponse.java
@@ -3,60 +3,66 @@
import neqsim.processSimulation.processEquipment.compressor.Compressor;
/**
- * CompressorResponse class.
+ * CompressorResponse class.
+ * Constructor for CompressorResponse.
+ * Constructor for CompressorResponse.
+ * Constructor for CompressorResponse.
+ * Constructor for CompressorResponse.
+ * update.
- * setActive
+ * setActive.
*
- * isActive
+ * isActive.
*
*
- * @param maxErr Maximum error before test will report failed Set maximum allowed error in model
- * check
- * speed
.
*
- * getFileWriter. - *
- * - * @param i a int - * @return a {@link neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.FileWriterInterface} - * object - */ - public FileWriterInterface getFileWriter(int i); - /** ** getSolver. diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/FileWriterBaseClass.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/FileWriterBaseClass.java deleted file mode 100644 index 3151769c9c..0000000000 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/FileWriterBaseClass.java +++ /dev/null @@ -1,20 +0,0 @@ -package neqsim.fluidMechanics.util.fluidMechanicsDataHandeling; - -/** - *
- * FileWriterBaseClass class. - *
- * - * @author esol - * @version $Id: $Id - */ -public class FileWriterBaseClass implements java.io.Serializable { - private static final long serialVersionUID = 1000; - - /** - *- * Constructor for FileWriterBaseClass. - *
- */ - public FileWriterBaseClass() {} -} diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/FileWriterInterface.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/FileWriterInterface.java deleted file mode 100644 index 754c7be7a2..0000000000 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/FileWriterInterface.java +++ /dev/null @@ -1,12 +0,0 @@ -package neqsim.fluidMechanics.util.fluidMechanicsDataHandeling; - -/** - *- * FileWriterInterface interface. - *
- * - * @author esol - * @version $Id: $Id - */ -public interface FileWriterInterface { -} diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/onePhaseFileWriter/OnePhaseFileWriter.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/onePhaseFileWriter/OnePhaseFileWriter.java deleted file mode 100644 index 8774324987..0000000000 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/onePhaseFileWriter/OnePhaseFileWriter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * OnePhaseFileWriter.java - * - * Created on 27. oktober 2000, 22:27 - */ - -package neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.onePhaseFileWriter; - -import neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.FileWriterBaseClass; - -/** - *- * OnePhaseFileWriter class. - *
- * - * @author esol - * @version $Id: $Id - */ -public class OnePhaseFileWriter extends FileWriterBaseClass { - private static final long serialVersionUID = 1000; - - /** - *- * Constructor for OnePhaseFileWriter. - *
- */ - public OnePhaseFileWriter() {} -} diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/onePhaseFileWriter/pipeFlowFileWriter/PipeFlowFileWriter.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/onePhaseFileWriter/pipeFlowFileWriter/PipeFlowFileWriter.java deleted file mode 100644 index 8ec0b7b82d..0000000000 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/onePhaseFileWriter/pipeFlowFileWriter/PipeFlowFileWriter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * PipeFlowFileWriter.java - * - * Created on 27. oktober 2000, 22:29 - */ - -package neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.onePhaseFileWriter.pipeFlowFileWriter; - -import neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.onePhaseFileWriter.OnePhaseFileWriter; - -/** - *- * PipeFlowFileWriter class. - *
- * - * @author esol - * @version $Id: $Id - */ -public class PipeFlowFileWriter extends OnePhaseFileWriter { - private static final long serialVersionUID = 1000; - - /** - *- * Constructor for PipeFlowFileWriter. - *
- */ - public PipeFlowFileWriter() {} -} diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/twoPhaseFileWriter/TwoPhaseFileWriter.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/twoPhaseFileWriter/TwoPhaseFileWriter.java deleted file mode 100644 index 9dbeacd2e3..0000000000 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/twoPhaseFileWriter/TwoPhaseFileWriter.java +++ /dev/null @@ -1,22 +0,0 @@ -package neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.twoPhaseFileWriter; - -import neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.FileWriterBaseClass; - -/** - *- * TwoPhaseFileWriter class. - *
- * - * @author esol - * @version $Id: $Id - */ -public class TwoPhaseFileWriter extends FileWriterBaseClass { - private static final long serialVersionUID = 1000; - - /** - *- * Constructor for TwoPhaseFileWriter. - *
- */ - public TwoPhaseFileWriter() {} -} diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/twoPhaseFileWriter/twoPhasePipeFlowFileWriter/TwoPhasePipeFlowFileWriter.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/twoPhaseFileWriter/twoPhasePipeFlowFileWriter/TwoPhasePipeFlowFileWriter.java deleted file mode 100644 index 0f3341d53e..0000000000 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsDataHandeling/twoPhaseFileWriter/twoPhasePipeFlowFileWriter/TwoPhasePipeFlowFileWriter.java +++ /dev/null @@ -1,22 +0,0 @@ -package neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.twoPhaseFileWriter.twoPhasePipeFlowFileWriter; - -import neqsim.fluidMechanics.util.fluidMechanicsDataHandeling.twoPhaseFileWriter.TwoPhaseFileWriter; - -/** - *- * TwoPhasePipeFlowFileWriter class. - *
- * - * @author esol - * @version $Id: $Id - */ -public class TwoPhasePipeFlowFileWriter extends TwoPhaseFileWriter { - private static final long serialVersionUID = 1000; - - /** - *- * Constructor for TwoPhasePipeFlowFileWriter. - *
- */ - public TwoPhasePipeFlowFileWriter() {} -} From 5b5248ff998b771fb012b2c7c14eb0de1b53f2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:19:27 +0100 Subject: [PATCH 065/317] chore: build with java 21 update dependencies and github workflows --- .github/workflows/release_with_jars.yml | 27 +- .github/workflows/verify_build.yml | 22 +- pom.xml | 16 +- pomJava21.xml | 275 ++++++++++++++ pomJava8.xml | 483 ++++++++++++------------ 5 files changed, 570 insertions(+), 253 deletions(-) create mode 100644 pomJava21.xml diff --git a/.github/workflows/release_with_jars.yml b/.github/workflows/release_with_jars.yml index a31bdd8406..7b4fff81c7 100644 --- a/.github/workflows/release_with_jars.yml +++ b/.github/workflows/release_with_jars.yml @@ -90,7 +90,32 @@ jobs: with: name: jarfiles path: staging - + + compile_java_21: + name: Build Neqsim ${{ needs.get_versions.outputs.version }} with java 21 + needs: get_versions + + if: ${{ needs.get_versions.outputs.version_8 == needs.get_versions.outputs.version }} + runs-on: ubuntu-latest + + steps: + - name: Check out neqsim java project + uses: actions/checkout@v3 + - name: Set up JDK 21 environment + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' + cache: 'maven' + - name: Build java 21 version with Maven + run: mvn -B package --file pomJava21.xml + - name: Copy jar file to staging + run: mkdir staging && cp target/neqsim*Java21.jar staging + - uses: actions/upload-artifact@v2 + with: + name: jarfiles + path: staging + create_release: name: Create release v${{ needs.get_versions.outputs.version_8 }} runs-on: ubuntu-latest diff --git a/.github/workflows/verify_build.yml b/.github/workflows/verify_build.yml index 6d2a96b89d..a082c92012 100644 --- a/.github/workflows/verify_build.yml +++ b/.github/workflows/verify_build.yml @@ -11,7 +11,7 @@ on: - master jobs: - test_javadoc: + test_java_11: name: Assert tests and javadoc with java 11 runs-on: ubuntu-latest steps: @@ -36,9 +36,9 @@ jobs: tags: coverage test_java_8: - name: Assert tests and javadoc with java 8 + name: Assert tests with java 8 runs-on: ubuntu-latest - needs: test_javadoc + needs: test_java_11 steps: - uses: actions/checkout@v3 @@ -51,3 +51,19 @@ jobs: - name: Run tests run: mvn -B test --file pomJava8.xml -ntp + + test_java_21: + name: Assert tests with java 21 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' + cache: 'maven' + - name: Generate javadoc + run: mvn javadoc:javadoc + - name: Run tests + run: mvn -B test --file pomJava21.xml -ntp diff --git a/pom.xml b/pom.xml index 2144e1f99b..2a24fe486d 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@+ * runTransient. + *
+ */ + @Override + public void runTransient(double dt, UUID id) { + run(id); + increaseTime(dt); + return; + + } + /** {@inheritDoc} */ @Override public void displayResult() { @@ -740,14 +755,14 @@ public double getAngle() { /** - * @return total length of the pipe in m + * @return total length of the pipe in m */ public double getLength() { return cumulativeLength; } - /** - * @return total elevation of the pipe in m + /** + * @return total elevation of the pipe in m */ public double getElevation() { return cumulativeElevation; diff --git a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/WellFlow.java b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/WellFlow.java index b6a438c12d..f804d1126a 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/WellFlow.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/WellFlow.java @@ -1,5 +1,13 @@ package neqsim.processSimulation.processEquipment.reservoir; +import java.util.UUID; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import neqsim.processSimulation.processEquipment.TwoPortEquipment; +import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.system.SystemInterface; + /** ** WellFlow class. @@ -8,5 +16,93 @@ * @author asmund * @version $Id: $Id */ -public class WellFlow { +public class WellFlow extends TwoPortEquipment { + private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(ThrottlingValve.class); + SystemInterface thermoSystem; + private double wellProductionIndex = 0; + double pressureOut = 1.0; + String pressureUnit = "bara"; + boolean useWellProductionIndex = false; + boolean calcpressure = true; + + + /** + *
+ * Constructor for WellFlow. + *
+ * + * @param name a {@link java.lang.String} object + */ + public WellFlow(String name) { + super(name); + } + + /** {@inheritDoc} */ + @Override + public void setInletStream(StreamInterface stream) { + super.setInletStream(stream); + StreamInterface outStream = stream.clone(); + outStream.setName("outStream"); + super.setOutletStream(outStream); + } + + /** {@inheritDoc} */ + @Override + public void run(UUID id) { + thermoSystem = getInletStream().getThermoSystem().clone(); + thermoSystem.setPressure(pressureOut, pressureUnit); + outStream.setThermoSystem(thermoSystem); + if (useWellProductionIndex) { + if (calcpressure) { + double presout = 1.0; + if (Math.pow(getInletStream().getPressure("bara"), 2.0) + - getInletStream().getFlowRate("MSm3/day") / wellProductionIndex > 0) { + presout = Math.sqrt(Math.pow(getInletStream().getPressure("bara"), 2.0) + - getInletStream().getFlowRate("MSm3/day") / wellProductionIndex); + } else { + logger.error("pressure lower that 0"); + throw new RuntimeException( + new neqsim.util.exception.InvalidInputException("WellFlow", "run: calcOutletPressure", + "pressure", "- Outlet pressure is negative" + pressureOut)); + } + // System.out.println("out pres " + presout); + outStream.setPressure(presout, "bara"); + } else { + double flow = wellProductionIndex * (Math.pow(getInletStream().getPressure("bara"), 2.0) + - Math.pow(thermoSystem.getPressure("bara"), 2.0)); + outStream.setFlowRate(flow, "MSm3/day"); + } + } else { + wellProductionIndex = getInletStream().getFlowRate("MSm3/day") + / (Math.pow(getInletStream().getPressure("bara"), 2.0) + - Math.pow(thermoSystem.getPressure("bara"), 2.0)); + } + outStream.run(); + } + + /** {@inheritDoc} */ + @Override + public void runTransient(double dt, UUID id) { + if (getCalculateSteadyState()) { + run(id); + increaseTime(dt); + return; + } + double flow = wellProductionIndex * (Math.pow(getInletStream().getPressure("bara"), 2.0) + - Math.pow(thermoSystem.getPressure("bara"), 2.0)); + + outStream.setFlowRate(flow, "MSm3/day"); + outStream.run(); + } + + public double getWellProductionIndex() { + return wellProductionIndex; + } + + public void setWellProductionIndex(double wellProductionIndex) { + useWellProductionIndex = true; + this.wellProductionIndex = wellProductionIndex; + } + } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java b/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java index ed9e6970ce..1d1e228047 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java @@ -23,6 +23,9 @@ public class Adjuster extends ProcessEquipmentBaseClass { ProcessEquipmentInterface targetEquipment = null; String adjustedVariable = ""; + String adjustedVariableUnit = ""; + double maxAdjustedValue = 1e10; + double minAdjustedValue = -1e10; String targetVariable = ""; String targetPhase = ""; String targetComponent = ""; @@ -59,6 +62,22 @@ public Adjuster(String name) { super(name); } + /** + *+ * setAdjustedVariable. + *
+ * + * @param adjustedEquipment a + * {@link neqsim.processSimulation.processEquipment.ProcessEquipmentInterface} object + * @param adjstedVariable a {@link java.lang.String} object + */ + public void setAdjustedVariable(ProcessEquipmentInterface adjustedEquipment, + String adjstedVariable, String unit) { + this.adjustedEquipment = adjustedEquipment; + this.adjustedVariable = adjstedVariable; + this.adjustedVariableUnit = unit; + } + /** ** setAdjustedVariable. @@ -144,6 +163,8 @@ public void run(UUID id) { if (adjustedVariable.equals("mass flow")) { inputValue = ((Stream) adjustedEquipment).getThermoSystem().getFlowRate("kg/hr"); + } else if (adjustedVariable.equals("flow") && adjustedVariableUnit != null) { + inputValue = ((Stream) adjustedEquipment).getThermoSystem().getFlowRate(adjustedVariableUnit); } else { inputValue = ((Stream) adjustedEquipment).getThermoSystem().getNumberOfMoles(); } @@ -177,6 +198,9 @@ public void run(UUID id) { if (adjustedVariable.equals("mass flow")) { ((Stream) adjustedEquipment).getThermoSystem().setTotalFlowRate(inputValue + deviation, "kg/hr"); + } else if (adjustedVariable.equals("flow") && adjustedVariableUnit != null) { + ((Stream) adjustedEquipment).getThermoSystem().setTotalFlowRate( + inputValue + Math.signum(deviation) * inputValue / 100.0, adjustedVariableUnit); } else { ((Stream) adjustedEquipment).getThermoSystem().setTotalFlowRate(inputValue + deviation, "mol/sec"); @@ -184,9 +208,20 @@ public void run(UUID id) { } else { double derivate = (error - oldError) / (inputValue - oldInputValue); double newVal = error / derivate; + if (inputValue - newVal > maxAdjustedValue) { + newVal = inputValue - maxAdjustedValue; + error = 0; + } + if (inputValue - newVal < minAdjustedValue) { + newVal = inputValue - minAdjustedValue; + error = 0; + } if (adjustedVariable.equals("mass flow")) { ((Stream) adjustedEquipment).getThermoSystem().setTotalFlowRate(inputValue - newVal, "kg/hr"); + } else if (adjustedVariable.equals("flow") && adjustedVariableUnit != null) { + ((Stream) adjustedEquipment).getThermoSystem().setTotalFlowRate(inputValue - newVal, + adjustedVariableUnit); } else { ((Stream) adjustedEquipment).getThermoSystem().setTotalFlowRate(inputValue - newVal, "mol/sec"); @@ -305,4 +340,28 @@ public boolean isActivateWhenLess() { public void setActivateWhenLess(boolean activateWhenLess) { this.activateWhenLess = activateWhenLess; } + + public void setMaxAdjustedValue(double maxVal) { + maxAdjustedValue = maxVal; + if (maxAdjustedValue < minAdjustedValue) { + minAdjustedValue = maxAdjustedValue; + } + } + + public void setMinAdjustedValue(double minVal) { + minAdjustedValue = minVal; + if (minAdjustedValue > maxAdjustedValue) { + maxAdjustedValue = minAdjustedValue; + } + + } + + public double getMaxAdjustedValue() { + return maxAdjustedValue; + } + + public double getMinAdjustedValue() { + return minAdjustedValue; + } + } diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java index c63a5a38f9..0879fb25bc 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java +++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java @@ -95,6 +95,38 @@ public void add(ProcessEquipmentInterface operation) { } } + /** + *
+ * add. + *
+ * + */ + public void add(int position, ProcessEquipmentInterface operation) { + ArrayList
* add.
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
new file mode 100644
index 0000000000..daef85468a
--- /dev/null
+++ b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
@@ -0,0 +1,192 @@
+package neqsim.processSimulation.processEquipment.reservoir;
+
+import org.junit.jupiter.api.Test;
+import neqsim.processSimulation.processEquipment.compressor.Compressor;
+import neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills;
+import neqsim.processSimulation.processEquipment.stream.StreamInterface;
+import neqsim.processSimulation.processEquipment.util.Adjuster;
+import neqsim.processSimulation.processEquipment.valve.ThrottlingValve;
+import neqsim.processSimulation.processSystem.ProcessSystem;
+
+public class WellFlowTest {
+ @Test
+ void testRun() {
+
+ neqsim.thermo.system.SystemInterface fluid1 =
+ new neqsim.thermo.system.SystemPrEos(373.15, 100.0);
+ fluid1.addComponent("water", 3.599);
+ fluid1.addComponent("nitrogen", 0.599);
+ fluid1.addComponent("CO2", 0.51);
+ fluid1.addComponent("methane", 62.8);
+ fluid1.addComponent("n-heptane", 12.8);
+ fluid1.setMixingRule(2);
+ fluid1.setMultiPhaseCheck(true);
+
+ SimpleReservoir reservoirOps = new SimpleReservoir("Well 1 reservoir");
+ reservoirOps.setReservoirFluid(fluid1, 1e9, 10.0, 10.0e7);
+
+ StreamInterface producedGasStream = reservoirOps.addGasProducer("gasproducer_1");
+ producedGasStream.setFlowRate(1.0, "MSm3/day");
+
+ WellFlow wellflow = new WellFlow("well flow unit");
+ wellflow.setInletStream(producedGasStream);
+ wellflow.setWellProductionIndex(5.000100751427403E-4);
+
+ ProcessSystem process = new ProcessSystem();
+ process.add(reservoirOps);
+ process.add(wellflow);
+
+ process.run();
+ /*
+ * System.out.println("production index " + wellflow.getWellProductionIndex() +
+ * " MSm3/day/bar^2"); System.out.println("reservoir pressure " +
+ * producedGasStream.getPressure("bara")); System.out .println("pres bottomhole " +
+ * wellflow.getOutletStream().getPressure("bara") + " bara");
+ */
+ }
+
+ @Test
+ void testRunTransient() {
+ neqsim.thermo.system.SystemInterface fluid1 =
+ new neqsim.thermo.system.SystemPrEos(373.15, 100.0);
+ fluid1.addComponent("water", 3.599);
+ fluid1.addComponent("nitrogen", 0.599);
+ fluid1.addComponent("CO2", 0.51);
+ fluid1.addComponent("methane", 62.8);
+ fluid1.setMixingRule(2);
+ fluid1.setMultiPhaseCheck(true);
+
+ SimpleReservoir reservoirOps = new SimpleReservoir("Well 1 reservoir");
+ reservoirOps.setReservoirFluid(fluid1, 1e9, 1.0, 10.0e7);
+ reservoirOps.setLowPressureLimit(10.0, "bara");
+
+ StreamInterface producedGasStream = reservoirOps.addGasProducer("gasproducer_1");
+ producedGasStream.setFlowRate(9.0, "MSm3/day");
+
+ WellFlow wellflow = new WellFlow("well flow unit");
+ wellflow.setInletStream(producedGasStream);
+ wellflow.setWellProductionIndex(10.000100751427403E-3);
+
+ PipeBeggsAndBrills pipe = new PipeBeggsAndBrills(wellflow.getOutletStream());
+ pipe.setPipeWallRoughness(5e-6);
+ pipe.setLength(300.0);
+ pipe.setElevation(300);
+ pipe.setDiameter(0.625);
+
+ PipeBeggsAndBrills pipeline = new PipeBeggsAndBrills(wellflow.getOutletStream());
+ pipeline.setPipeWallRoughness(5e-6);
+ pipeline.setLength(60000.0);
+ pipeline.setElevation(200);
+ pipeline.setDiameter(0.725);
+
+ ThrottlingValve chokeValve = new ThrottlingValve("chocke");
+ chokeValve.setInletStream(pipeline.getOutletStream());
+ chokeValve.setOutletPressure(55.0, "bara");
+
+
+ Adjuster adjuster = new Adjuster("adjuster");
+ adjuster.setTargetVariable(pipeline.getOutletStream(), "pressure",
+ chokeValve.getOutletPressure(), "bara");
+ adjuster.setAdjustedVariable(producedGasStream, "flow", "MSm3/day");
+ adjuster.setMaxAdjustedValue(9.0);
+ adjuster.setMinAdjustedValue(1.0);
+
+ ProcessSystem process = new ProcessSystem();
+ process.add(reservoirOps);
+ process.add(wellflow);
+ process.add(pipe);
+ process.add(pipeline);
+ process.add(adjuster);
+ process.run();
+ /*
+ * System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
+ * System.out.println("production index " + wellflow.getWellProductionIndex() +
+ * " MSm3/day/bar^2"); System.out.println("reservoir pressure " +
+ * producedGasStream.getPressure("bara")); System.out .println("pres bottomhole " +
+ * wellflow.getOutletStream().getPressure("bara") + " bara");
+ * System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
+ * System.out .println("top side pressure " + pipeline.getOutletStream().getPressure("bara") +
+ * " bara");
+ */
+ // process.setTimeStep(60 * 60 * 24 * 365);
+
+ for (int i = 0; i < 10; i++) {
+ reservoirOps.runTransient(60 * 60 * 24 * 365);
+ process.run();
+ /*
+ * System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
+ * System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
+ * System.out .println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") +
+ * " bara");
+ *
+ * System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") +
+ * " bara"); System.out .println("top side pressure " +
+ * pipeline.getOutletStream().getPressure("bara") + " bara"); System.out
+ * .println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
+ * System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
+ */
+ }
+
+ Compressor compressor = new Compressor("subcomp");
+ compressor.setInletStream(pipe.getOutletStream());
+ compressor.setCompressionRatio(3.0);
+ pipeline.setInletStream(compressor.getOutletStream());
+
+ process.add(3, compressor);
+
+ for (int i = 0; i < 8; i++) {
+ reservoirOps.runTransient(60 * 60 * 24 * 365);
+ process.run();
+ /*
+ * System.out.println("Compressor in pressure " + compressor.getInletStream().getPressure() +
+ * " out pressure " + compressor.getOutletStream().getPressure() + " flow " +
+ * compressor.getInletStream().getFlowRate("m3/hr"));
+ * System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
+ * System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
+ * System.out .println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") +
+ * " bara");
+ *
+ * System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") +
+ * " bara"); System.out .println("top side pressure " +
+ * pipeline.getOutletStream().getPressure("bara") + " bara"); System.out
+ * .println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
+ * System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
+ */
+
+ }
+
+ adjuster.setMaxAdjustedValue(4.0);
+ adjuster.setTargetVariable(pipeline.getOutletStream(), "pressure", 22.0, "bara");
+ boolean reset = false;
+ for (int i = 0; i < 35; i++) {
+ if (wellflow.getOutletStream().getPressure("bara") > 15 || reset) {
+ reset = false;
+ reservoirOps.runTransient(60 * 60 * 24 * 365);
+ compressor.setOutletPressure(pipe.getOutletPressure() * 3.5);
+ process.run();
+ /*
+ * System.out.println("Compressor in pressure " + compressor.getInletStream().getPressure()
+ * + " out pressure " + compressor.getOutletStream().getPressure() + " flow " +
+ * compressor.getInletStream().getFlowRate("m3/hr"));
+ * System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
+ * System.out.println("reservoir pressure " +
+ * wellflow.getInletStream().getPressure("bara")); System.out .println("pres bottomhole " +
+ * wellflow.getOutletStream().getPressure("bara") + " bara");
+ *
+ * System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") +
+ * " bara"); System.out.println( "top side pressure " +
+ * pipeline.getOutletStream().getPressure("bara") + " bara"); System.out.println(
+ * "Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
+ * System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
+ */
+ } else {
+ reset = true;
+ adjuster.setMaxAdjustedValue(adjuster.getMaxAdjustedValue() / 2.0);
+ adjuster.setMinAdjustedValue(adjuster.getMinAdjustedValue() / 2.0);
+ }
+
+ }
+ }
+
+
+}
From ba1b3381eb015c04f9651bfb4df3768547b4c160 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Wed, 3 Jan 2024 00:24:28 +0100
Subject: [PATCH 071/317] update (#894)
---
.../reservoir/SimpleReservoir.java | 76 +++++++------------
.../reservoir/WellFlowTest.java | 26 +++++++
2 files changed, 52 insertions(+), 50 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java
index 622308a51b..e20295fe14 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java
@@ -325,66 +325,42 @@ public void setReservoirFluid(SystemInterface thermoSystem, double gasVolume, do
this.gasVolume = gasVolume;
this.waterVolume = waterVolume;
- if (gasVolume > 1e-10 && oilVolume > 1e-10) {
- ThermodynamicOperations ops = new ThermodynamicOperations(thermoSystem);
+ ThermodynamicOperations ops = new ThermodynamicOperations(thermoSystem);
+ ops.TPflash();
+
+ if (waterVolume > 1e-10 && !thermoSystem.hasPhaseType("aqueous")) {
+ thermoSystem.addComponent("water", thermoSystem.getTotalNumberOfMoles());
ops.TPflash();
- thermoSystem.initProperties();
- SystemInterface thermoSystem2 = thermoSystem.clone();
- thermoSystem.setEmptyFluid();
- for (int j = 0; j < thermoSystem.getNumberOfPhases(); j++) {
- double relFact = gasVolume / (thermoSystem2.getPhase(j).getVolume() * 1.0e-5);
- if (j >= 1) {
- if (j == 1) {
- relFact = oilVolume / (thermoSystem2.getPhase(j).getVolume() * 1.0e-5);
- // totalliquidVolume += oilVolume / thermoSystem2.getPhase(j).getMolarVolume();
- } else if (j == 2) {
- relFact = waterVolume / (thermoSystem2.getPhase(j).getVolume() * 1.0e-5);
- // totalliquidVolume += waterVolume /
- // thermoSystem2.getPhase(j).getMolarVolume();
- }
- }
- for (int i = 0; i < thermoSystem.getPhase(j).getNumberOfComponents(); i++) {
- thermoSystem.addComponent(thermoSystem.getPhase(j).getComponent(i).getComponentNumber(),
- relFact * thermoSystem2.getPhase(j).getComponent(i).getNumberOfMolesInPhase(), j);
- }
+ }
+
+ thermoSystem.initProperties();
+ SystemInterface thermoSystem2 = thermoSystem.clone();
+ thermoSystem.setEmptyFluid();
+ for (int j = 0; j < thermoSystem.getNumberOfPhases(); j++) {
+ String phaseType = thermoSystem.getPhase(j).getPhaseTypeName();
+ double relFact = gasVolume / (thermoSystem2.getPhase(j).getVolume() * 1.0e-5);
+ if (phaseType.equals("oil")) {
+ relFact = oilVolume / (thermoSystem2.getPhase(j).getVolume() * 1.0e-5);
+ // totalliquidVolume += oilVolume / thermoSystem2.getPhase(j).getMolarVolume();
+ } else if (phaseType.equals("aqueous")) {
+ relFact = waterVolume / (thermoSystem2.getPhase(j).getVolume() * 1.0e-5);
+ } else {
+ relFact = gasVolume / (thermoSystem2.getPhase(j).getVolume() * 1.0e-5);
}
- } else {
- ThermodynamicOperations ops = new ThermodynamicOperations(thermoSystem);
- ops.TPflash();
- thermoSystem.initProperties();
- SystemInterface thermoSystem2 = thermoSystem.clone();
- thermoSystem.setEmptyFluid();
- double relFact = (gasVolume + oilVolume) / (thermoSystem2.getPhase("oil").getVolume("m3"));
- for (int i = 0; i < thermoSystem.getNumberOfComponents(); i++) {
- thermoSystem.addComponent(thermoSystem.getComponent(i).getComponentNumber(),
- relFact * thermoSystem2.getComponent(i).getNumberOfMolesInPhase());
+ for (int i = 0; i < thermoSystem.getPhase(j).getNumberOfComponents(); i++) {
+ thermoSystem.addComponent(thermoSystem.getPhase(j).getComponent(i).getComponentNumber(),
+ relFact * thermoSystem2.getPhase(j).getComponent(i).getNumberOfMolesInPhase(), j);
}
- double relFactWater = (waterVolume) / (thermoSystem2.getPhase("aqueous").getVolume("m3"));
- thermoSystem.addComponent("water", relFactWater
- * thermoSystem2.getPhase("aqueous").getComponent("water").getNumberOfMolesInPhase());
}
- /*
- * if (thermoSystem.hasPhaseType("gas")) { thermoSystem.setBeta(gasVolume /
- * thermoSystem2.getPhase(0).getMolarVolume() / (gasVolume /
- * thermoSystem2.getPhase(0).getMolarVolume() + oilVolume /
- * thermoSystem2.getPhase(1).getMolarVolume())); }
- */
+
ThermodynamicOperations ops2 = new ThermodynamicOperations(thermoSystem);
ops2.TPflash();
thermoSystem.initProperties();
- // thermoSystem.display();
- // gasOutStream = new Stream();
- // gasOutStream.setFluid(thermoSystem.phaseToSystem("gas"));
reservoirVolume = gasVolume + oilVolume + waterVolume;
- OOIP =
-
- getOilInPlace("Sm3");
+ OOIP = getOilInPlace("Sm3");
OGIP = getGasInPlace("Sm3");
- // oilOutStream = new Stream();
- // oilOutStream.setFluid(thermoSystem.phaseToSystem("oil"));
-
lowPressureLimit = 50.0;
}
@@ -867,6 +843,6 @@ public void setLowPressureLimit(double value, String unit) {
public double getLowPressureLimit(String unit) {
PressureUnit conver = new PressureUnit(lowPressureLimit, "bara");
- return conver.getValue(unit);
+ return conver.getValue(unit);
}
}
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
index daef85468a..7467c8ddcb 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
@@ -188,5 +188,31 @@ void testRunTransient() {
}
}
+ @Test
+ void testCalcWellFlow() {
+ neqsim.thermo.system.SystemInterface fluid1 =
+ new neqsim.thermo.system.SystemPrEos(373.15, 100.0);
+ fluid1.addComponent("water", 3.599);
+ fluid1.addComponent("nitrogen", 0.599);
+ fluid1.addComponent("CO2", 0.51);
+ fluid1.addComponent("methane", 62.8);
+ fluid1.setMixingRule(2);
+ fluid1.setMultiPhaseCheck(true);
+
+ SimpleReservoir reservoirOps = new SimpleReservoir("Well 1 reservoir");
+ reservoirOps.setReservoirFluid(fluid1, 1e9, 1.0, 10.0e7);
+ reservoirOps.setLowPressureLimit(10.0, "bara");
+
+ StreamInterface producedGasStream = reservoirOps.addGasProducer("gasproducer_1");
+ producedGasStream.setFlowRate(9.0, "MSm3/day");
+
+ WellFlow wellflow = new WellFlow("well flow unit");
+ wellflow.setInletStream(producedGasStream);
+
+ double permeability = 50.0; // milli darcy
+ // wellflow.setDarcyLawParameters(permeability, );
+ // wellflow.setWellProductionIndex(10.000100751427403E-3);
+ }
+
}
From 56300fff96ac3cec73a3acf15e309f77f0e781a8 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Thu, 4 Jan 2024 08:44:56 +0100
Subject: [PATCH 072/317] version 2.5.15 (#895)
* Update pom.xml
* Update pomJava21.xml
* Update pomJava8.xml
---
pom.xml | 2 +-
pomJava21.xml | 2 +-
pomJava8.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2a24fe486d..8eb17538ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
@@ -53,8 +54,9 @@ public ThrottlingValve() {
* Constructor for ThrottlingValve.
*
@@ -398,10 +400,6 @@ public String calcFlowRegime() { supGasVel = system.getPhase(0).getFlowRate("ft3/sec") / area; supMixVel = supLiquidVel + supGasVel; - liquidSuperficialVelocityProfile.add(supLiquidVel / 3.2808399); // to meters - gasSuperficialVelocityProfile.add(supGasVel / 3.2808399); - mixtureSuperficialVelocityProfile.add(supMixVel / 3.2808399); - mixtureFroudeNumber = Math.pow(supMixVel, 2) / (32.174 * insideDiameter); inputVolumeFractionLiquid = supLiquidVel / supMixVel; } else { @@ -418,6 +416,10 @@ public String calcFlowRegime() { } } + liquidSuperficialVelocityProfile.add(supLiquidVel / 3.2808399); // to meters + gasSuperficialVelocityProfile.add(supGasVel / 3.2808399); + mixtureSuperficialVelocityProfile.add(supMixVel / 3.2808399); + double L1 = 316 * Math.pow(inputVolumeFractionLiquid, 0.302); double L2 = 0.0009252 * Math.pow(inputVolumeFractionLiquid, -2.4684); double L3 = 0.1 * Math.pow(inputVolumeFractionLiquid, -1.4516); @@ -584,11 +586,11 @@ public double calcFrictionPressureLoss() { if (system.getNumberOfPhases() != 1) { if (regime != "Single Phase") { double y = inputVolumeFractionLiquid / (Math.pow(El, 2)); - if(1 < y && y < 1.2){ - S = Math.log(2.2*y - 1.2); - } - else { - S = Math.log(y) / (-0.0523 + 3.18 * Math.log(y) - 0.872 * Math.pow(Math.log(y), 2.0) + 0.01853 * Math.pow(Math.log(y), 4)); + if (1 < y && y < 1.2) { + S = Math.log(2.2 * y - 1.2); + } else { + S = Math.log(y) / (-0.0523 + 3.18 * Math.log(y) - 0.872 * Math.pow(Math.log(y), 2.0) + + 0.01853 * Math.pow(Math.log(y), 4)); } if (system.getNumberOfPhases() == 3) { rhoNoSlip = mixtureLiquidDensity * inputVolumeFractionLiquid @@ -649,7 +651,7 @@ public double calcPressureDrop() { frictionPressureLoss = calcFrictionPressureLoss(); pressureDrop = (hydrostaticPressureDrop + frictionPressureLoss); convertSystemUnitToMetric(); - iteration = iteration + 1; + iteration = iteration + 1; return pressureDrop; } @@ -677,6 +679,7 @@ public void run(UUID id) { lengthProfile = new ArrayList<>(); elevationProfile = new ArrayList<>(); + incrementsProfile = new ArrayList<>(); calculateMissingValue(); double enthalpyInlet = Double.NaN; @@ -693,12 +696,16 @@ public void run(UUID id) { double pipeInletPressure = system.getPressure(); cumulativeLength = 0.0; cumulativeElevation = 0.0; + pressureProfile.add(system.getPressure()); // pressure at segment 0 + temperatureProfile.add(system.getTemperature()); // temperature at segment 0 + pressureDropProfile.add(0.0); // DP at segment 0 for (int i = 1; i <= numberOfIncrements; i++) { - cumulativeLength += length; - cumulativeElevation += elevation; - lengthProfile.add(cumulativeLength); elevationProfile.add(cumulativeElevation); + incrementsProfile.add(i-1); + + cumulativeLength += length; + cumulativeElevation += elevation; inletPressure = system.getPressure(); pressureDrop = calcPressureDrop(); @@ -706,7 +713,7 @@ public void run(UUID id) { pressureOut = inletPressure - pressureDrop; pressureProfile.add(pressureOut); if (pressureOut < 0) { - throw new RuntimeException(new neqsim.util.exception.InvalidInputException( + throw new RuntimeException(new neqsim.util.exception.InvalidOutputException( "PipeBeggsAndBrills", "run: calcOutletPressure", "pressure out", "- Outlet pressure is negative" + pressureOut)); } @@ -719,8 +726,15 @@ public void run(UUID id) { temperatureProfile.add(system.getTemperature()); } totalPressureDrop = pipeInletPressure - system.getPressure(); + calcPressureDrop(); // to initialize final parameters + lengthProfile.add(cumulativeLength); + elevationProfile.add(cumulativeElevation); + incrementsProfile.add(getNumberOfIncrements()); + + outStream.setThermoSystem(system); outStream.setCalculationIdentifier(id); + } /** @@ -746,18 +760,44 @@ public void displayResult() { /** *
- * getSuperficialVelocity. + * getInletSuperficialVelocity. *
* * @return a double */ - public double getSuperficialVelocity() { + public double getInletSuperficialVelocity() { return getInletStream().getThermoSystem().getFlowRate("kg/sec") / getInletStream().getThermoSystem().getDensity("kg/m3") / (Math.PI / 4.0 * Math.pow(insideDiameter, 2.0)); } + /** + *+ * getOutletSuperficialVelocity. + *
+ * + * @return a double + */ + public double getOutletSuperficialVelocity() { + return getSegmentMixtureSuperficialVelocity(numberOfIncrements); + } + + + /** + *+ * getNumberOfIncrements + *
+ * + * @return a double + */ + public int getNumberOfIncrements() { + return numberOfIncrements; + } + + + + /** * @return angle in degrees */ @@ -850,8 +890,8 @@ public List+ * InvalidOutputException class. + *
+ * + * @author Even Solbraa + * @version $Id: $Id + */ +public class InvalidOutputException extends neqsim.util.exception.ThermoException { + private static final long serialVersionUID = 1000; + + /** + * Constructs anInvalidOutputException
with the specified detail message.
+ *
+ * @param msg the detail message.
+ */
+ @Deprecated
+ public InvalidOutputException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an InvalidOutputException
with a default message.
+ *
+ * @param className Class that exception is raised from
+ * @param methodName Method that exception is raised from
+ * @param outputName Name of invalid output
+ */
+ public InvalidOutputException(String className, String methodName, String outputName) {
+ super(className, methodName, "output " + outputName + " was invalid.");
+ }
+
+ /**
+ * Constructs an InvalidOutputException
with the specified detail message.
+ *
+ * @param className Class that exception is raised from
+ * @param methodName Method that exception is raised from
+ * @param outputName Name of invalid output
+ * @param msg error message detailing output problem
+ */
+ public InvalidOutputException(String className, String methodName, String outputName, String msg) {
+ super(className, methodName, "output " + outputName + " " + msg);
+ }
+
+ /**
+ * Constructs an InvalidOutputException
with a default message.
+ *
+ * @param obj Object that exception is raised from
+ * @param methodName Method that exception is raised from
+ * @param outputName Name of invalid output
+ */
+ public InvalidOutputException(Object obj, String methodName, String outputName) {
+ this(obj.getClass().getSimpleName(), methodName, outputName);
+ }
+
+ /**
+ * Constructs an InvalidOutputException
with a default message.
+ *
+ * @param obj Object that exception is raised from
+ * @param methodName Method that exception is raised from
+ * @param outputName Name of invalid output
+ * @param msg error message detailing output problem
+ */
+ public InvalidOutputException(Object obj, String methodName, String outputName, String msg) {
+ this(obj.getClass().getSimpleName(), methodName, outputName, msg);
+ }
+}
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java
index 7c515a8ff1..65f5ed72d4 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java
@@ -90,6 +90,7 @@ public void testPipeLineBeggsAndBrills() {
Assertions.assertEquals(pressureOut, 27.5402, 1e-4);
Assertions.assertEquals(temperatureOut, 39.3374, 1e-4);
+ Assertions.assertEquals(pipe.getOutletSuperficialVelocity(), pipe.getSegmentMixtureSuperficialVelocity(pipe.getNumberOfIncrements()), 0.1);
}
@@ -139,6 +140,7 @@ public void testPipeLineBeggsAndBrills2() {
Assertions.assertEquals(pressureOut, 13.735508907175728, 1e-4);
Assertions.assertEquals(temperatureOut, 38.82331519652632, 1e-4);
+ Assertions.assertEquals(pipe.getOutletSuperficialVelocity(), pipe.getSegmentMixtureSuperficialVelocity(pipe.getNumberOfIncrements()), 0.1);
}
@@ -196,15 +198,17 @@ public void testPipeLineBeggsAndBrills3() {
Assertions.assertEquals(pipe.getSegmentPressureDrop(10), 1.5468048987983438, 1.0);
Assertions.assertEquals(pipe.getSegmentTemperature(10) - 273.15, 79.80343029302054, 1.0);
Assertions.assertEquals(pipe.getSegmentFlowRegime(10), "INTERMITTENT");
- Assertions.assertEquals(pipe.getSegmentMixtureDensity(10), 233.1155792052253, 1.0);
+ Assertions.assertEquals(pipe.getSegmentMixtureDensity(10), 224.31571593591167, 1.0);
Assertions.assertEquals(pipe.getSegmentLiquidSuperficialVelocity(10), 3.357338501138603, 1.0);
Assertions.assertEquals(pipe.getSegmentGasSuperficialVelocity(10), 7.109484383317198, 1.0);
Assertions.assertEquals(pipe.getSegmentMixtureSuperficialVelocity(10), 10.466822884455802, 1.0);
Assertions.assertEquals(pipe.getSegmentMixtureViscosity(10), 0.14329203901478244, 1.0);
Assertions.assertEquals(pipe.getSegmentLiquidHoldup(10), 0.42601098053163294, 1.0);
- Assertions.assertEquals(pipe.getSegmentMixtureReynoldsNumber(10), 2127138.3343691113, 1.0);
+ Assertions.assertEquals(pipe.getSegmentMixtureReynoldsNumber(10), 2196973.270922545, 1.0);
Assertions.assertEquals(pipe.getSegmentLength(10), 410.0, 1.0);
Assertions.assertEquals(pipe.getSegmentElevation(10), 300, 1.0);
+ Assertions.assertEquals(pipe.getOutletSuperficialVelocity(), pipe.getSegmentMixtureSuperficialVelocity(pipe.getNumberOfIncrements()), 0.1);
+
}
@@ -253,6 +257,25 @@ public void testPipeLineBeggsAndBrills4() {
Assertions.assertEquals(pressureOut, 124.04439, 1e-4);
+ Assertions.assertEquals(pipe.getPressureDrop(), 25.955604559293917, 1.0);
+ Assertions.assertEquals(pipe.getSegmentPressure(10), 124.04439544070608, 1.0);
+ Assertions.assertEquals(pipe.getSegmentPressure(0), 150, 1.0);
+ Assertions.assertEquals(pipe.getSegmentPressureDrop(10), 2.9204245897598162, 1.0);
+ Assertions.assertEquals(pipe.getSegmentTemperature(10) - 273.15, 75.07486781297496, 1.0);
+ Assertions.assertEquals(pipe.getSegmentFlowRegime(10), "Single Phase");
+ Assertions.assertEquals(pipe.getSegmentMixtureDensity(10), 73.54613545016805, 1.0);
+ Assertions.assertEquals(pipe.getSegmentLiquidSuperficialVelocity(10), 0.0, 1.0);
+ Assertions.assertEquals(pipe.getSegmentGasSuperficialVelocity(10), 33.85480591912372, 1.0);
+ Assertions.assertEquals(pipe.getSegmentMixtureSuperficialVelocity(10), 33.85480591912372, 1.0);
+ Assertions.assertEquals(pipe.getSegmentMixtureViscosity(10), 0.14329203901478244, 1.0);
+ Assertions.assertEquals(pipe.getSegmentLiquidHoldup(10), 0.0, 0.01);
+ Assertions.assertEquals(pipe.getSegmentMixtureReynoldsNumber(10), 2.014803001851525E7, 1.0);
+ Assertions.assertEquals(pipe.getSegmentLength(10), 1500.0, 1.0);
+ Assertions.assertEquals(pipe.getSegmentElevation(10), -1000, 1.0);
+ Assertions.assertEquals(pipe.getNumberOfIncrements(), 10, 0.1);
+ Assertions.assertEquals(pipe.getOutletSuperficialVelocity(), pipe.getSegmentMixtureSuperficialVelocity(pipe.getNumberOfIncrements()), 0.1);
+
+
neqsim.thermo.system.SystemInterface testSystem2 =
new neqsim.thermo.system.SystemSrkEos((273.15 + 45),
ThermodynamicConstantsInterface.referencePressure);
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
index 1f9fa0e3fc..18cf151f5d 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java
@@ -126,8 +126,7 @@ void testRunTransient() {
.println("top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");
System.out
.println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
- System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
-
+ System.out.println("gas velocity " + pipeline.getInletSuperficialVelocity());
}
}
From 528b3ca6d8bf3c4ec07c0c26f3fa9464b7318954 Mon Sep 17 00:00:00 2001
From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com>
Date: Sat, 13 Jan 2024 15:56:57 +0100
Subject: [PATCH 083/317] feat: module class add get meas device (#903)
---
.../processSystem/ProcessModule.java | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
index 705948fce4..b3c0348a25 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
@@ -224,6 +224,32 @@ public Object getUnit(String name) {
return null; // no unit found with the given name
}
+
+
+ /**
+ * Returns the unit with the given name from the list of added unit operations and list of added
+ * modules.
+ *
+ * @param name the name of the unit to retrieve
+ * @return the unit with the given name, or {@code null} if no such unit is found
+ */
+ public Object getMeasurumentDevice(String name) {
+ for (ProcessSystem processSystem : addedUnitOperations) {
+ Object unit = processSystem.getMeasurementDevice(name);
+ if (unit != null) {
+ return unit;
+ }
+ }
+
+ for (ProcessModule processModule : addedModules) {
+ Object unit = processModule.getMeasurumentDevice(name);
+ if (unit != null) {
+ return unit;
+ }
+ }
+ return null; // no unit found with the given name
+ }
+
/**
*
* Create deep copy.
From 277eb63917ae7f657526edd7c4ac1f8f6cd8c5a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Engelsen?=
@@ -424,7 +426,7 @@ public void setPressureMarginFactor(double pressureMarginFactor) {
* @return a double
*/
public double getOuterDiameter() {
- return 1.0; // processEquipment.getInternalDiameter();
+ return outerDiameter;
}
/**
@@ -1081,6 +1083,22 @@ public UnitCostEstimateBaseClass getCostEstimate() {
return costEstimate;
}
+ public void setDefaultLiquidDensity(double defaultLiqDens) {
+ this.defaultLiquidDensity = defaultLiqDens;
+ }
+
+ public double getDefaultLiquidDensity() {
+ return defaultLiquidDensity;
+ }
+
+ public void setDefaultLiquidViscosity(double defaultLiqVisc) {
+ this.defaultLiquidViscosity = defaultLiqVisc;
+ }
+
+ public double getDefaultLiquidViscosity() {
+ return defaultLiquidViscosity;
+ }
+
/** {@inheritDoc} */
@Override
public int hashCode() {
@@ -1170,4 +1188,6 @@ public boolean equals(Object obj) {
&& Double.doubleToLongBits(weigthVesselShell) == Double
.doubleToLongBits(other.weigthVesselShell);
}
+
+
}
diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/designStandards/PressureVesselDesignStandard.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/designStandards/PressureVesselDesignStandard.java
index f483d0d644..a55df29194 100644
--- a/src/main/java/neqsim/processSimulation/mechanicalDesign/designStandards/PressureVesselDesignStandard.java
+++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/designStandards/PressureVesselDesignStandard.java
@@ -64,7 +64,6 @@ public double calcWallThickness() {
- 0.2 * equipment.getMaxOperationPressure() / 10.0)
+ equipment.getCorrosionAllowanse();
}
-
return wallT / 1000.0; // return wall thickness in meter
}
}
diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/GasScrubberMechanicalDesign.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/GasScrubberMechanicalDesign.java
index c4cc485081..cf65eb86b8 100644
--- a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/GasScrubberMechanicalDesign.java
+++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/GasScrubberMechanicalDesign.java
@@ -1,6 +1,7 @@
package neqsim.processSimulation.mechanicalDesign.separator;
import neqsim.processSimulation.mechanicalDesign.designStandards.GasScrubberDesignStandard;
+import neqsim.processSimulation.mechanicalDesign.separator.sectionType.SepDesignSection;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
import neqsim.processSimulation.processEquipment.separator.Separator;
import neqsim.processSimulation.processEquipment.separator.SeparatorInterface;
@@ -72,7 +73,9 @@ public void calcDesign() {
.getPhysicalProperties().getDensity();
double liqDensity = ((SeparatorInterface) getProcessEquipment()).getThermoSystem().getPhase(1)
.getPhysicalProperties().getDensity();
-
+ if (((SeparatorInterface) getProcessEquipment()).getThermoSystem().getNumberOfPhases() == 1) {
+ liqDensity = getDefaultLiquidDensity();
+ }
maxDesignVolumeFlow = volumeSafetyFactor
* ((SeparatorInterface) getProcessEquipment()).getThermoSystem().getPhase(0).getVolume()
/ 1e5;
@@ -81,17 +84,21 @@ public void calcDesign() {
innerDiameter = Math.sqrt(4.0 * getMaxDesignVolumeFlow()
/ (neqsim.thermo.ThermodynamicConstantsInterface.pi * maxGasVelocity * Fg));
tantanLength = innerDiameter * 5.0;
- System.out.println("inner Diameter " + innerDiameter);
+ // System.out.println("inner Diameter " + innerDiameter);
// calculating from standard codes
// sepLength = innerDiameter * 2.0;
emptyVesselWeight = 0.032 * getWallThickness() * 1e3 * innerDiameter * 1e3 * tantanLength;
+
+ setOuterDiameter(innerDiameter + 2.0 * getWallThickness());
for (SeparatorSection sep : separator.getSeparatorSections()) {
- sep.getMechanicalDesign().calcDesign();
- internalsWeight += sep.getMechanicalDesign().getTotalWeight();
+ sep.setOuterDiameter(getOuterDiameter());
+ SepDesignSection sect = sep.getMechanicalDesign();
+ sect.calcDesign();
+ internalsWeight += sect.getTotalWeight();
}
- System.out.println("internal weight " + internalsWeight);
+ // System.out.println("internal weight " + internalsWeight);
externalNozzelsWeight = 0.0;
double Wv = emptyVesselWeight + internalsWeight + externalNozzelsWeight;
@@ -104,17 +111,14 @@ public void calcDesign() {
moduleLength = innerDiameter * 2.5;
moduleLength = tantanLength * 1.5;
moduleHeight = innerDiameter * 2;
- // }
-
- setOuterDiameter(innerDiameter + 2.0 * getWallThickness());
-
- System.out.println("wall thickness: " + separator.getName() + " " + getWallThickness() + " m");
- System.out.println("separator dry weigth: " + emptyVesselWeight + " kg");
- System.out.println("total skid weigth: " + totalSkidWeight + " kg");
- System.out.println("foot print: width:" + moduleWidth + " length " + moduleLength + " height "
- + moduleHeight + " meter.");
- System.out.println("mechanical price: " + materialsCost + " kNOK");
-
+ /*
+ * System.out.println("wall thickness: " + separator.getName() + " " + getWallThickness() +
+ * " m"); System.out.println("separator dry weigth: " + emptyVesselWeight + " kg");
+ * System.out.println("total skid weigth: " + totalSkidWeight + " kg");
+ * System.out.println("foot print: width:" + moduleWidth + " length " + moduleLength +
+ * " height " + moduleHeight + " meter."); System.out.println("mechanical price: " +
+ * materialsCost + " kNOK");
+ */
setWeigthVesselShell(emptyVesselWeight);
tantanLength = innerDiameter * 5;
diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/SeparatorMechanicalDesign.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/SeparatorMechanicalDesign.java
index ee3e75fd69..4491391a01 100644
--- a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/SeparatorMechanicalDesign.java
+++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/SeparatorMechanicalDesign.java
@@ -25,9 +25,6 @@
*/
public class SeparatorMechanicalDesign extends MechanicalDesign {
private static final long serialVersionUID = 1000;
-
- double wallThickness = 0.0;
- private double outerDiameter = 0.0;
double gasLoadFactor = 1.0;
double volumeSafetyFactor = 1.0;
double Fg = 1.0;
@@ -163,11 +160,15 @@ public void calcDesign() {
double materialsCost = 0.0;
double gasDensity = ((SeparatorInterface) getProcessEquipment()).getThermoSystem().getPhase(0)
.getPhysicalProperties().getDensity();
+
double liqDensity = ((SeparatorInterface) getProcessEquipment()).getThermoSystem().getPhase(1)
.getPhysicalProperties().getDensity();
double liqViscosity = ((SeparatorInterface) getProcessEquipment()).getThermoSystem().getPhase(1)
.getPhysicalProperties().getViscosity();
-
+ if (((SeparatorInterface) getProcessEquipment()).getThermoSystem().getNumberOfPhases() == 1) {
+ liqDensity = getDefaultLiquidDensity();
+ liqViscosity = getDefaultLiquidViscosity();
+ }
maxDesignVolumeFlow = volumeSafetyFactor
* ((SeparatorInterface) getProcessEquipment()).getThermoSystem().getPhase(0).getVolume()
/ 1e5;
@@ -187,12 +188,12 @@ public void calcDesign() {
double sepratorLength = tantanLength + innerDiameter;
if (sepratorLength / innerDiameter > 6 || sepratorLength / innerDiameter < 3) {
- System.out
- .println("Fg need to be modified ... L/D separator= " + sepratorLength / innerDiameter);
+ // System.out
+ // .println("Fg need to be modified ... L/D separator= " + sepratorLength / innerDiameter);
tantanLength = innerDiameter * 5.0;
sepratorLength = tantanLength + innerDiameter;
}
- System.out.println("inner Diameter " + innerDiameter);
+ // System.out.println("inner Diameter " + innerDiameter);
// alternative design
double bubbleDiameter = 250.0e-6;
@@ -211,12 +212,14 @@ public void calcDesign() {
// sepLength = innerDiameter * 2.0;
emptyVesselWeight = 0.032 * getWallThickness() * 1e3 * innerDiameter * 1e3 * tantanLength;
+ setOuterDiameter(innerDiameter + 2.0 * getWallThickness());
for (SeparatorSection sep : separator.getSeparatorSections()) {
+ sep.setOuterDiameter(getOuterDiameter());
sep.getMechanicalDesign().calcDesign();
internalsWeight += sep.getMechanicalDesign().getTotalWeight();
}
- System.out.println("internal weight " + internalsWeight);
+ // System.out.println("internal weight " + internalsWeight);
externalNozzelsWeight = 0.0; // need to be implemented
double Wv = emptyVesselWeight + internalsWeight + externalNozzelsWeight;
@@ -230,15 +233,14 @@ public void calcDesign() {
moduleHeight = innerDiameter * 2 + 1.0;
// }
- setOuterDiameter(innerDiameter + 2.0 * getWallThickness());
-
- System.out.println("wall thickness: " + separator.getName() + " " + getWallThickness() + " m");
- System.out.println("separator dry weigth: " + emptyVesselWeight + " kg");
- System.out.println("total skid weigth: " + totalSkidWeight + " kg");
- System.out.println("foot print: width:" + moduleWidth + " length " + moduleLength + " height "
- + moduleHeight + " meter.");
- System.out.println("mechanical price: " + materialsCost + " kNOK");
-
+ /*
+ * System.out.println("wall thickness: " + separator.getName() + " " + getWallThickness() +
+ * " m"); System.out.println("separator dry weigth: " + emptyVesselWeight + " kg");
+ * System.out.println("total skid weigth: " + totalSkidWeight + " kg");
+ * System.out.println("foot print: width:" + moduleWidth + " length " + moduleLength +
+ * " height " + moduleHeight + " meter."); System.out.println("mechanical price: " +
+ * materialsCost + " kNOK");
+ */
setWeigthVesselShell(emptyVesselWeight);
// tantanLength = innerDiameter * 5;
@@ -274,28 +276,4 @@ public void setDesign() {
((Separator) getProcessEquipment()).setSeparatorLength(tantanLength);
// this method will be implemented to set calculated design...
}
-
- /** {@inheritDoc} */
- @Override
- public double getOuterDiameter() {
- return outerDiameter;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getWallThickness() {
- return wallThickness;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setWallThickness(double wallThickness) {
- this.wallThickness = wallThickness;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setOuterDiameter(double outerDiameter) {
- this.outerDiameter = outerDiameter;
- }
}
diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/DistillationTraySection.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/DistillationTraySection.java
index dc9041c183..4cbedcc789 100644
--- a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/DistillationTraySection.java
+++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/DistillationTraySection.java
@@ -27,8 +27,7 @@ public DistillationTraySection(SeparatorSection separatorSection) {
/** {@inheritDoc} */
@Override
public void calcDesign() {
- double vesselDiameter =
- separatorSection.getSeparator().getMechanicalDesign().getOuterDiameter() * 1e3;
+ double vesselDiameter = separatorSection.getOuterDiameter() * 1e3;
if (vesselDiameter <= 616) {
totalWeight = 32.0;
} else if (vesselDiameter <= 770) {
diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MecMeshSection.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MecMeshSection.java
index e17b364348..8ea032ef9e 100644
--- a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MecMeshSection.java
+++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MecMeshSection.java
@@ -27,8 +27,7 @@ public MecMeshSection(SeparatorSection separatorSection) {
/** {@inheritDoc} */
@Override
public void calcDesign() {
- double vesselDiameter =
- separatorSection.getSeparator().getMechanicalDesign().getOuterDiameter() * 1e3;
+ double vesselDiameter = separatorSection.getOuterDiameter() * 1e3;
if (vesselDiameter <= 616) {
totalWeight = 5.0;
} else if (vesselDiameter <= 770) {
diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MechVaneSection.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MechVaneSection.java
index bced222fb6..f4620ee716 100644
--- a/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MechVaneSection.java
+++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/separator/sectionType/MechVaneSection.java
@@ -28,7 +28,7 @@ public MechVaneSection(SeparatorSection separatorSection) {
@Override
public void calcDesign() {
double vesselDiameter =
- separatorSection.getSeparator().getMechanicalDesign().getOuterDiameter() * 1e3;
+ separatorSection.getOuterDiameter() * 1e3;
if (vesselDiameter <= 616) {
totalWeight = 6.0;
} else if (vesselDiameter <= 770) {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java
index dccb4095b5..f97b416211 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java
@@ -6,13 +6,8 @@
package neqsim.processSimulation.processEquipment.separator;
-import java.util.ArrayList;
-import java.util.UUID;
import neqsim.processSimulation.mechanicalDesign.separator.GasScrubberMechanicalDesign;
-import neqsim.processSimulation.processEquipment.separator.sectionType.SeparatorSection;
-import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
-import neqsim.thermo.system.SystemInterface;
/**
*
@@ -25,18 +20,6 @@
public class GasScrubber extends Separator {
private static final long serialVersionUID = 1000;
- SystemInterface thermoSystem;
-
- SystemInterface gasSystem;
- SystemInterface waterSystem;
- SystemInterface liquidSystem;
- SystemInterface thermoSystemCloned;
-
- ArrayList
* Constructor for GasScrubber.
@@ -94,76 +77,4 @@ public GasScrubberMechanicalDesign getMechanicalDesign() {
return new GasScrubberMechanicalDesign(this);
}
- /**
- * {@inheritDoc}
- *
- *
- * Setter for the field
- * addScrubberSection.
- * inletStream
.
- *
stream
.
*
*
- * @param stream a
- * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
- * object
+ * @param stream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
*/
public void setStream(StreamInterface stream) {
this.stream = stream;
}
+ /** {@inheritDoc} */
+ @Override
+ public SystemInterface getFluid() {
+ if (stream != null) {
+ return stream.getFluid();
+ } else {
+ return thermoSystem;
+ }
+ }
+
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java b/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java
index a1e971a96d..7960f74268 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java
@@ -33,7 +33,9 @@ public class GORfitter extends TwoPortEquipment {
@Deprecated
/**
- * Constructor for GORfitter.
+ *+ * Constructor for GORfitter. + *
*/ public GORfitter() { super("GOR fitter"); @@ -64,7 +66,9 @@ public GORfitter(String name, StreamInterface stream) { } /** - *getGFV.
+ *+ * getGFV. + *
* * @return a double */ @@ -211,6 +215,7 @@ public void run(UUID id) { } catch (Exception ex) { logger.error(ex.getMessage(), ex); } + tempFluid.initProperties(); outStream.setThermoSystem(tempFluid); if (!tempFluid.hasPhaseType("gas")) { GVF = 0.0; @@ -262,7 +267,9 @@ public void setGVF(double gvf) { } /** - *Getter for the field referenceConditions
.
+ * Getter for the field referenceConditions
.
+ *
Setter for the field referenceConditions
.
+ * Setter for the field referenceConditions
.
+ *
isFitAsGVF.
+ *+ * isFitAsGVF. + *
* * @return the fitAsGVF */ @@ -289,7 +300,9 @@ public boolean isFitAsGVF() { } /** - *Setter for the field fitAsGVF
.
+ * Setter for the field fitAsGVF
.
+ *
avagadroNumber=6.023e23
. */
double avagadroNumber = 6.023e23;
- /** Constant MAX_NUMBER_OF_COMPONENTS=100
. */
- static final int MAX_NUMBER_OF_COMPONENTS = 100;
/** Constant referenceTemperature=273.15
[K]. */
double referenceTemperature = 273.15;
/** Constant referencePressure=1.01325
[bar]. */
diff --git a/src/main/java/neqsim/thermo/ThermodynamicModelSettings.java b/src/main/java/neqsim/thermo/ThermodynamicModelSettings.java
index 57a421da9e..8cbb0574d8 100644
--- a/src/main/java/neqsim/thermo/ThermodynamicModelSettings.java
+++ b/src/main/java/neqsim/thermo/ThermodynamicModelSettings.java
@@ -12,5 +12,5 @@ public interface ThermodynamicModelSettings extends java.io.Serializable {
/** Constant phaseFractionMinimumLimit=1e-12
. */
double phaseFractionMinimumLimit = 1e-12;
/** Constant MAX_NUMBER_OF_COMPONENTS=100
. */
- static final int MAX_NUMBER_OF_COMPONENTS = 100;
+ int MAX_NUMBER_OF_COMPONENTS = 100;
}
diff --git a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
index 4f0b777aa5..8587b6f348 100644
--- a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
+++ b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
@@ -5,6 +5,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.ThermodynamicConstantsInterface;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEUnifac;
import neqsim.thermo.phase.PhaseGEUnifac;
@@ -27,7 +28,7 @@ public class UNIFACgroup implements ThermodynamicConstantsInterface, Comparable<
double QComp = 0.0;
double QMix = 0.0;
public double[] QMixdN = null; // , xMixdN = null;
- double[] lnGammaMixdn = new double[MAX_NUMBER_OF_COMPONENTS];
+ double[] lnGammaMixdn = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
double lnGammaComp = 0.0;
double lnGammaMix = 0.0;
double lnGammaCompdT = 0.0;
diff --git a/src/main/java/neqsim/thermo/component/Component.java b/src/main/java/neqsim/thermo/component/Component.java
index ea6b0306e6..335862c407 100644
--- a/src/main/java/neqsim/thermo/component/Component.java
+++ b/src/main/java/neqsim/thermo/component/Component.java
@@ -9,6 +9,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.ThermodynamicConstantsInterface;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.atomElement.Element;
import neqsim.thermo.component.attractiveEosTerm.AttractiveTermInterface;
import neqsim.thermo.phase.PhaseInterface;
@@ -123,10 +124,17 @@ public abstract class Component implements ComponentInterface {
protected double paulingAnionicDiameter = 0;
private int orginalNumberOfAssociationSites = 0;
+
+ /* Derivative of fugacity wrt temperature */
protected double dfugdt = 0.1;
+ /* Derivative of fugacity wrt pressure */
protected double dfugdp = 0.1;
- protected double[] dfugdn = new double[MAX_NUMBER_OF_COMPONENTS];
- public double[] dfugdx = new double[MAX_NUMBER_OF_COMPONENTS];
+ /* Derivative of fugacity wrt mole fraction (of each ) */
+ protected double[] dfugdn = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
+ /* Derivative of fugacity wrt temperature */
+ public double[] dfugdx = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
+
+ // Parameters for Antoine equation
double AntoineA = 0;
double AntoineB = 0;
double AntoineC = 0;
@@ -141,14 +149,15 @@ public abstract class Component implements ComponentInterface {
private double[] CpSolid = new double[5];
private double[] CpLiquid = new double[5];
private double heatOfFusion = 0.0;
+
+
double triplePointDensity = 10.0;
double triplePointPressure = 0.0;
-
private double triplePointTemperature = 1000.0;
double meltingPointTemperature = 110.0;
+
private double idealGasEnthalpyOfFormation = 0.0;
double idealGasGibbsEnergyOfFormation = 0.0;
-
double idealGasAbsoluteEntropy = 0.0;
double Hsub = 0.0;
diff --git a/src/main/java/neqsim/thermo/component/ComponentEos.java b/src/main/java/neqsim/thermo/component/ComponentEos.java
index d1b0065b83..0b6ab019b3 100644
--- a/src/main/java/neqsim/thermo/component/ComponentEos.java
+++ b/src/main/java/neqsim/thermo/component/ComponentEos.java
@@ -8,6 +8,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.attractiveEosTerm.AtractiveTermMatCopPRUMRNew;
import neqsim.thermo.component.attractiveEosTerm.AttractiveTermCPAstatoil;
import neqsim.thermo.component.attractiveEosTerm.AttractiveTermGERG;
@@ -57,8 +58,8 @@ public abstract class ComponentEos extends Component implements ComponentEosInte
public double aDiffDiffT = 0;
- public double[] Aij = new double[MAX_NUMBER_OF_COMPONENTS];
- public double[] Bij = new double[MAX_NUMBER_OF_COMPONENTS];
+ public double[] Aij = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
+ public double[] Bij = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
protected double delta1 = 0;
protected double delta2 = 0;
@@ -75,8 +76,8 @@ public abstract class ComponentEos extends Component implements ComponentEosInte
protected double bDerTn = 0;
- protected double[] dAdndn = new double[MAX_NUMBER_OF_COMPONENTS];
- protected double[] dBdndn = new double[MAX_NUMBER_OF_COMPONENTS];
+ protected double[] dAdndn = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
+ protected double[] dBdndn = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
private AttractiveTermInterface attractiveParameter;
static Logger logger = LogManager.getLogger(ComponentEos.class);
@@ -340,7 +341,7 @@ public double fugcoef(PhaseInterface phase) {
double pressure = phase.getPressure();
double logFugacityCoefficient =
dFdN(phase, phase.getNumberOfComponents(), temperature, pressure)
- - Math.log(pressure * phase.getMolarVolume() / (R * temperature));
+ - Math.log(pressure * phase.getMolarVolume() / (R * temperature));
fugacityCoefficient = Math.exp(logFugacityCoefficient);
return fugacityCoefficient;
}
diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrate.java b/src/main/java/neqsim/thermo/component/ComponentHydrate.java
index edce0b0290..fc5020095a 100644
--- a/src/main/java/neqsim/thermo/component/ComponentHydrate.java
+++ b/src/main/java/neqsim/thermo/component/ComponentHydrate.java
@@ -33,8 +33,7 @@ public class ComponentHydrate extends Component {
// double[] dHfHydrate = {-292714.5, -292016.0};
double[] dGfHydrate = {-235557, -235614};
double[] dHfHydrate = {-291786, -292016};
- double[] reffug =
- new double[neqsim.thermo.ThermodynamicConstantsInterface.MAX_NUMBER_OF_COMPONENTS];
+ double[] reffug = new double[neqsim.thermo.ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
private double sphericalCoreRadiusHydrate = 0.0;
private double lennardJonesEnergyParameterHydrate = 0.0;
private double lennardJonesMolecularDiameterHydrate = 0.0;
@@ -225,8 +224,9 @@ public double getEmptyHydrateStructureVapourPressure(int type, double temperatur
if (type == -1) {
return getSolidVaporPressure(temperature);
} else {
- return Math.exp(getEmptyHydrateVapourPressureConstant(type, 0)
- + getEmptyHydrateVapourPressureConstant(type, 1) / temperature)
+ return Math
+ .exp(getEmptyHydrateVapourPressureConstant(type, 0)
+ + getEmptyHydrateVapourPressureConstant(type, 1) / temperature)
* ThermodynamicConstantsInterface.referencePressure;
}
}
diff --git a/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java b/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java
index df3135d20f..e73a04d32f 100644
--- a/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java
+++ b/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java
@@ -6,6 +6,7 @@
package neqsim.thermo.component;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.phase.PhaseInterface;
import neqsim.thermo.phase.PhasePrEosvolcor;
@@ -21,7 +22,7 @@ public class ComponentPRvolcor extends ComponentPR {
private static final long serialVersionUID = 1000;
private double c;
// private double calcc;
- public double[] Cij = new double[MAX_NUMBER_OF_COMPONENTS];
+ public double[] Cij = new double[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
public double Ci = 0;
/**
diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java
index 1b486e29b0..a65eedfad4 100644
--- a/src/main/java/neqsim/thermo/phase/Phase.java
+++ b/src/main/java/neqsim/thermo/phase/Phase.java
@@ -11,6 +11,7 @@
import org.apache.logging.log4j.Logger;
import neqsim.physicalProperties.PhysicalPropertyHandler;
import neqsim.thermo.ThermodynamicConstantsInterface;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.exception.InvalidInputException;
@@ -70,7 +71,7 @@ public abstract class Phase implements PhaseInterface {
*
*/
public Phase() {
- componentArray = new ComponentInterface[MAX_NUMBER_OF_COMPONENTS];
+ componentArray = new ComponentInterface[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java
index b78782bd87..dcd5c1254d 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java
@@ -8,6 +8,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentEosInterface;
import neqsim.thermo.mixingRule.EosMixingRules;
import neqsim.thermo.mixingRule.EosMixingRulesInterface;
@@ -57,7 +58,7 @@ public PhaseEos clone() {
public PhaseEos() {
super();
mixSelect = new EosMixingRules();
- componentArray = new ComponentEosInterface[MAX_NUMBER_OF_COMPONENTS];
+ componentArray = new ComponentEosInterface[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
mixRule = mixSelect.getMixingRule(1);
// solver = new newtonRhapson();
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java
index f22a0953b2..1afebf72ff 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGE.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java
@@ -9,6 +9,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.ThermodynamicConstantsInterface;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEInterface;
import neqsim.thermo.mixingRule.EosMixingRules;
import neqsim.thermo.mixingRule.EosMixingRulesInterface;
@@ -36,7 +37,7 @@ public class PhaseGE extends Phase implements PhaseGEInterface {
public PhaseGE() {
super();
setType(PhaseType.LIQUID);
- componentArray = new ComponentGEInterface[MAX_NUMBER_OF_COMPONENTS];
+ componentArray = new ComponentGEInterface[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
useVolumeCorrection = false;
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
index 6256d8d4c6..71979db600 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
@@ -4,6 +4,7 @@
import java.util.Arrays;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.atomElement.UNIFACgroup;
import neqsim.thermo.component.ComponentGEUnifac;
import neqsim.thermo.component.ComponentGEUniquac;
@@ -32,7 +33,7 @@ public class PhaseGEUnifac extends PhaseGEUniquac {
*/
public PhaseGEUnifac() {
super();
- componentArray = new ComponentGEUnifac[MAX_NUMBER_OF_COMPONENTS];
+ componentArray = new ComponentGEUnifac[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
}
/**
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
index 22ae671fa3..e1d35d3cfd 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEUnifac;
import neqsim.thermo.component.ComponentGEUnifacPSRK;
import neqsim.thermo.component.ComponentGEUniquac;
@@ -25,7 +26,7 @@ public class PhaseGEUnifacPSRK extends PhaseGEUnifac {
*/
public PhaseGEUnifacPSRK() {
super();
- componentArray = new ComponentGEUnifacPSRK[MAX_NUMBER_OF_COMPONENTS];
+ componentArray = new ComponentGEUnifacPSRK[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
}
/**
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
index f760d2279b..354612814b 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
@@ -2,6 +2,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEUnifac;
import neqsim.thermo.component.ComponentGEUnifacUMRPRU;
import neqsim.thermo.component.ComponentGEUniquac;
@@ -31,7 +32,8 @@ public class PhaseGEUnifacUMRPRU extends PhaseGEUnifac {
*/
public PhaseGEUnifacUMRPRU() {
super();
- componentArray = new ComponentGEUnifacUMRPRU[MAX_NUMBER_OF_COMPONENTS];
+ componentArray =
+ new ComponentGEUnifacUMRPRU[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
}
/**
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
index 899c18dc9f..14b31c614e 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
@@ -6,6 +6,7 @@
package neqsim.thermo.phase;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEInterface;
import neqsim.thermo.component.ComponentGEUniquac;
@@ -33,7 +34,7 @@ public class PhaseGEUniquac extends PhaseGE {
*/
public PhaseGEUniquac() {
super();
- componentArray = new ComponentGEInterface[MAX_NUMBER_OF_COMPONENTS];
+ componentArray = new ComponentGEInterface[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
}
/**
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
index 593584acda..5e1062036e 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
@@ -1,5 +1,6 @@
package neqsim.thermo.phase;
+import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEWilson;
/**
@@ -22,7 +23,7 @@ public class PhaseGEWilson extends PhaseGE {
*/
public PhaseGEWilson() {
super();
- componentArray = new ComponentGEWilson[MAX_NUMBER_OF_COMPONENTS];
+ componentArray = new ComponentGEWilson[ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS];
}
/**
From 5abf345b6891a360846a6c141dc427808b6c5450 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Wed, 21 Feb 2024 09:47:21 +0100
Subject: [PATCH 094/317] fix: rename class CalcIonicComposition
---
.../ThermodynamicOperations.java | 178 +++++++++---------
...osition.java => CalcIonicComposition.java} | 12 +-
2 files changed, 92 insertions(+), 98 deletions(-)
rename src/main/java/neqsim/thermodynamicOperations/flashOps/{calcIonicComposition.java => CalcIonicComposition.java} (91%)
diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
index bdd1c095f9..03dd936493 100644
--- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
+++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
@@ -12,6 +12,7 @@
import neqsim.thermo.component.ComponentHydrate;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemProperties;
+import neqsim.thermodynamicOperations.flashOps.CalcIonicComposition;
import neqsim.thermodynamicOperations.flashOps.CriticalPointFlash;
import neqsim.thermodynamicOperations.flashOps.PHflash;
import neqsim.thermodynamicOperations.flashOps.PHflashSingleComp;
@@ -27,7 +28,6 @@
import neqsim.thermodynamicOperations.flashOps.TVflash;
import neqsim.thermodynamicOperations.flashOps.VHflashQfunc;
import neqsim.thermodynamicOperations.flashOps.VUflashQfunc;
-import neqsim.thermodynamicOperations.flashOps.calcIonicComposition;
import neqsim.thermodynamicOperations.flashOps.dTPflash;
import neqsim.thermodynamicOperations.flashOps.saturationOps.ConstantDutyFlashInterface;
import neqsim.thermodynamicOperations.flashOps.saturationOps.HCdewPointPressureFlash;
@@ -86,8 +86,7 @@ public class ThermodynamicOperations implements java.io.Serializable, Cloneable
* Constructor for ThermodynamicOperations.
*
*/
- public ThermodynamicOperations() {
- }
+ public ThermodynamicOperations() {}
/**
* @@ -122,12 +121,11 @@ public void TPSolidflash() { } /** - * Method to perform a flash at given temperature, pressure and specified volume - * The number of + * Method to perform a flash at given temperature, pressure and specified volume The number of * moles in the system are changed to match the specified volume. * * @param volumeSpec is the specified volume - * @param unit Supported units are m3 + * @param unit Supported units are m3 */ public void TPVflash(double volumeSpec, String unit) { unit = "m3"; @@ -149,7 +147,8 @@ public void TPflash() { system.setTotalNumberOfMoles(1.0); system.init(1); } - operation = new neqsim.thermodynamicOperations.flashOps.TPflash(system, system.doSolidPhaseCheck()); + operation = + new neqsim.thermodynamicOperations.flashOps.TPflash(system, system.doSolidPhaseCheck()); if (!isRunAsThread()) { getOperation().run(); } else { @@ -170,8 +169,7 @@ public void TPflash() { * TPflash. *
* - * @param checkForSolids Set true to check for solid phase and do solid phase - * calculations. + * @param checkForSolids Set true to check for solid phase and do solid phase calculations. */ public void TPflash(boolean checkForSolids) { operation = new neqsim.thermodynamicOperations.flashOps.TPflash(system, checkForSolids); @@ -183,7 +181,7 @@ public void TPflash(boolean checkForSolids) { * TPgradientFlash. * * - * @param height a double + * @param height a double * @param temperature a double * @return a {@link neqsim.thermo.system.SystemInterface} object */ @@ -222,7 +220,8 @@ public void saturateWithWater() { */ public void chemicalEquilibrium() { if (system.isChemicalSystem()) { - operation = new neqsim.thermodynamicOperations.chemicalEquilibrium.ChemicalEquilibrium(system); + operation = + new neqsim.thermodynamicOperations.chemicalEquilibrium.ChemicalEquilibrium(system); getOperation().run(); } } @@ -233,7 +232,7 @@ public void chemicalEquilibrium() { * * * @param Hspec a double - * @param type a int + * @param type a int */ public void PHflash(double Hspec, int type) { if (system.getPhase(0).getNumberOfComponents() == 1) { @@ -247,7 +246,7 @@ public void PHflash(double Hspec, int type) { /** * Method to perform a PH flash calculation. * - * @param Hspec is the enthalpy in the specified unit + * @param Hspec is the enthalpy in the specified unit * @param enthalpyUnit Supported units are J, J/mol, J/kg and kJ/kg */ public void PHflash(double Hspec, String enthalpyUnit) { @@ -307,10 +306,10 @@ public void PUflash(double Uspec) { * PUflash. * * - * @param Pspec a double - * @param Uspec a double + * @param Pspec a double + * @param Uspec a double * @param unitPressure a {@link java.lang.String} object - * @param unitEnergy a {@link java.lang.String} object + * @param unitEnergy a {@link java.lang.String} object */ public void PUflash(double Pspec, double Uspec, String unitPressure, String unitEnergy) { system.setPressure(Pspec, unitPressure); @@ -322,7 +321,7 @@ public void PUflash(double Pspec, double Uspec, String unitPressure, String unit * PUflash. * * - * @param Uspec a double + * @param Uspec a double * @param unitEnergy a {@link java.lang.String} object */ public void PUflash(double Uspec, String unitEnergy) { @@ -338,7 +337,8 @@ public void PUflash(double Uspec, String unitEnergy) { conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kg": - conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = + 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -352,7 +352,7 @@ public void PUflash(double Uspec, String unitEnergy) { * * * @param Hspec a double - * @param type a int + * @param type a int */ public void PHflash2(double Hspec, int type) { operation = new PHflash(system, Hspec, type); @@ -398,11 +398,10 @@ public void PSflash(double Sspec) { } /** - * Method to perform a PS flash calculation for a specified entropy and - * pressure. + * Method to perform a PS flash calculation for a specified entropy and pressure. * * @param Sspec is the entropy in the specified unit - * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK + * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK */ public void PSflash(double Sspec, String unit) { double conversionFactor = 1.0; @@ -437,11 +436,10 @@ public void TSflash(double Sspec) { } /** - * Method to perform a TS flash calculation for a specified entropy and - * pressure. + * Method to perform a TS flash calculation for a specified entropy and pressure. * * @param Sspec is the entropy in the specified unit - * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK + * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK */ public void TSflash(double Sspec, String unit) { double conversionFactor = 1.0; @@ -494,9 +492,9 @@ public void PSflash2(double Sspec) { * VSflash. * * - * @param volume a double - * @param entropy a double - * @param unitVol a {@link java.lang.String} object + * @param volume a double + * @param entropy a double + * @param unitVol a {@link java.lang.String} object * @param unitEntropy a {@link java.lang.String} object */ public void VSflash(double volume, double entropy, String unitVol, String unitEntropy) { @@ -522,7 +520,8 @@ public void VSflash(double volume, double entropy, String unitVol, String unitEn conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kgK": - conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = + 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -535,7 +534,7 @@ public void VSflash(double volume, double entropy, String unitVol, String unitEn * VSflash. * * - * @param volume a double + * @param volume a double * @param entropy a double */ public void VSflash(double volume, double entropy) { @@ -549,7 +548,7 @@ public void VSflash(double volume, double entropy) { * * * @param Vspec a double - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object */ public void TVflash(double Vspec, String unit) { double conversionFactor = 1.0; @@ -580,7 +579,7 @@ public void TVflash(double Vspec) { * PVrefluxFlash. * * - * @param refluxspec a double + * @param refluxspec a double * @param refluxPhase a int */ public void PVrefluxFlash(double refluxspec, int refluxPhase) { @@ -606,9 +605,9 @@ public void VHflash(double Vspec, double Hspec) { * VHflash. * * - * @param volume a double - * @param enthalpy a double - * @param unitVol a {@link java.lang.String} object + * @param volume a double + * @param enthalpy a double + * @param unitVol a {@link java.lang.String} object * @param unitEnthalpy a {@link java.lang.String} object */ public void VHflash(double volume, double enthalpy, String unitVol, String unitEnthalpy) { @@ -634,7 +633,8 @@ public void VHflash(double volume, double enthalpy, String unitVol, String unitE conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kg": - conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = + 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -647,9 +647,9 @@ public void VHflash(double volume, double enthalpy, String unitVol, String unitE * VUflash. * * - * @param volume a double - * @param energy a double - * @param unitVol a {@link java.lang.String} object + * @param volume a double + * @param energy a double + * @param unitVol a {@link java.lang.String} object * @param unitEnergy a {@link java.lang.String} object */ public void VUflash(double volume, double energy, String unitVol, String unitEnergy) { @@ -675,7 +675,8 @@ public void VUflash(double volume, double energy, String unitVol, String unitEne conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass(); break; case "kJ/kg": - conversionFactorEntr = 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; + conversionFactorEntr = + 1.0 / system.getTotalNumberOfMoles() / system.getMolarMass() / 1000.0; break; default: break; @@ -857,8 +858,8 @@ public void checkScalePotential(int phaseNumber) throws Exception { * addIonToScaleSaturation. * * - * @param phaseNumber a int - * @param scaleSaltName a {@link java.lang.String} object + * @param phaseNumber a int + * @param scaleSaltName a {@link java.lang.String} object * @param nameOfIonToBeAdded a {@link java.lang.String} object * @throws java.lang.Exception if any. */ @@ -992,7 +993,7 @@ public void calcSolidComlexTemperature(String comp1, String comp2) throws Except * * * @param temperature an array of {@link double} objects - * @param pressure an array of {@link double} objects + * @param pressure an array of {@link double} objects * @return an array of {@link double} objects */ public double[] calcImobilePhaseHydrateTemperature(double[] temperature, double[] pressure) { @@ -1004,12 +1005,9 @@ public double[] calcImobilePhaseHydrateTemperature(double[] temperature, double[ for (int i = 0; i < temperature.length; i++) { /* * opsTemp = new ThermodynamicOperations(systemTemp); - * systemTemp.setTemperature(temperature[i]); - * systemTemp.setPressure(pressure[i]); - * systemTemp.init(0); systemTemp.display(); try { - * opsTemp.hydrateFormationTemperature(); } - * catch (Exception ex) { logger.error(ex.getMessage(),e); } - * systemTemp.display(); hydTemps[i] + * systemTemp.setTemperature(temperature[i]); systemTemp.setPressure(pressure[i]); + * systemTemp.init(0); systemTemp.display(); try { opsTemp.hydrateFormationTemperature(); } + * catch (Exception ex) { logger.error(ex.getMessage(),e); } systemTemp.display(); hydTemps[i] * = systemTemp.getTemperature(); * */ @@ -1062,7 +1060,7 @@ public double calcTOLHydrateFormationTemperature() { * hydrateInhibitorConcentration. * * - * @param inhibitorName a {@link java.lang.String} object + * @param inhibitorName a {@link java.lang.String} object * @param hydEqTemperature a double * @throws java.lang.Exception if any. */ @@ -1078,7 +1076,7 @@ public void hydrateInhibitorConcentration(String inhibitorName, double hydEqTemp * * * @param inhibitorName a {@link java.lang.String} object - * @param wtfrac a double + * @param wtfrac a double * @throws java.lang.Exception if any. */ public void hydrateInhibitorConcentrationSet(String inhibitorName, double wtfrac) @@ -1206,7 +1204,7 @@ public void hydrateEquilibriumLine(double minimumPressure, double maximumPressur * calcCricoP. * * - * @param cricondenBar an array of {@link double} objects + * @param cricondenBar an array of {@link double} objects * @param cricondenBarX an array of {@link double} objects * @param cricondenBarY an array of {@link double} objects */ @@ -1224,7 +1222,7 @@ public void calcCricoP(double[] cricondenBar, double[] cricondenBarX, double[] c * calcCricoT. * * - * @param cricondenTherm an array of {@link double} objects + * @param cricondenTherm an array of {@link double} objects * @param cricondenThermX an array of {@link double} objects * @param cricondenThermY an array of {@link double} objects */ @@ -1375,7 +1373,7 @@ public void constantPhaseFractionTemperatureFlash(double fraction) throws Except * * @param componentName a {@link java.lang.String} object * @param specification a {@link java.lang.String} object - * @param spec a double + * @param spec a double * @throws java.lang.Exception if any. */ public void dewPointMach(String componentName, String specification, double spec) @@ -1432,8 +1430,8 @@ public void dewPointMach(String componentName, String specification, double spec * @throws java.lang.Exception if any. */ public void dewPointTemperatureFlash() throws Exception { - ConstantDutyFlashInterface operation = new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash( - system); + ConstantDutyFlashInterface operation = + new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash(system); operation.run(); if (Double.isNaN(system.getTemperature()) || operation.isSuperCritical()) { throw new neqsim.util.exception.IsNaNException(this.getClass().getSimpleName(), @@ -1450,8 +1448,8 @@ public void dewPointTemperatureFlash() throws Exception { * @throws java.lang.Exception if any. */ public void dewPointTemperatureFlash(boolean derivatives) throws Exception { - ConstantDutyFlashInterface operation = new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash( - system); + ConstantDutyFlashInterface operation = + new neqsim.thermodynamicOperations.flashOps.saturationOps.dewPointTemperatureFlash(system); if (derivatives) { operation = new dewPointTemperatureFlashDer(system); } @@ -1534,7 +1532,7 @@ public void calcPTphaseEnvelope() { * * * @param bubfirst a boolean - * @param lowPres a double + * @param lowPres a double */ public void calcPTphaseEnvelope(boolean bubfirst, double lowPres) { double phasefraction = 1.0 - 1e-10; @@ -1590,7 +1588,7 @@ public void calcPTphaseEnvelope(boolean bubfirst) { * calcPTphaseEnvelope. * * - * @param lowPres a double + * @param lowPres a double * @param phasefraction a double */ public void calcPTphaseEnvelope(double lowPres, double phasefraction) { @@ -1617,14 +1615,14 @@ public void calcPTphaseEnvelopeNew() { * OLGApropTable. * * - * @param minTemp a double - * @param maxTemp a double + * @param minTemp a double + * @param maxTemp a double * @param temperatureSteps a int - * @param minPres a double - * @param maxPres a double - * @param pressureSteps a int - * @param filename a {@link java.lang.String} object - * @param TABtype a int + * @param minPres a double + * @param maxPres a double + * @param pressureSteps a int + * @param filename a {@link java.lang.String} object + * @param TABtype a int */ public void OLGApropTable(double minTemp, double maxTemp, int temperatureSteps, double minPres, double maxPres, int pressureSteps, String filename, int TABtype) { @@ -1642,14 +1640,14 @@ public void OLGApropTable(double minTemp, double maxTemp, int temperatureSteps, * OLGApropTablePH. * * - * @param minEnthalpy a double - * @param maxEnthalpy a double + * @param minEnthalpy a double + * @param maxEnthalpy a double * @param enthalpySteps a int - * @param minPres a double - * @param maxPres a double + * @param minPres a double + * @param maxPres a double * @param pressureSteps a int - * @param filename a {@link java.lang.String} object - * @param TABtype a int + * @param filename a {@link java.lang.String} object + * @param TABtype a int */ public void OLGApropTablePH(double minEnthalpy, double maxEnthalpy, int enthalpySteps, double minPres, double maxPres, int pressureSteps, String filename, int TABtype) { @@ -1719,7 +1717,8 @@ public double[][] getData() { * @return an array of {@link java.lang.String} objects */ public String[][] getDataPoints() { - String[][] str = new String[getOperation().getPoints(0).length][getOperation().getPoints(0)[0].length]; + String[][] str = + new String[getOperation().getPoints(0).length][getOperation().getPoints(0)[0].length]; for (int i = 0; i < getOperation().getPoints(0).length; i++) { for (int j = 0; j < getOperation().getPoints(0)[0].length; j++) { str[i][j] = Double.toString(getOperation().getPoints(0)[i][j]); @@ -1897,7 +1896,7 @@ public void addData(String name, double[][] data) { * @param phaseNumber a int */ public void calcIonComposition(int phaseNumber) { - operation = new calcIonicComposition(system, phaseNumber); + operation = new CalcIonicComposition(system, phaseNumber); getOperation().run(); resultTable = getOperation().getResultTable(); } @@ -1908,8 +1907,8 @@ public void calcIonComposition(int phaseNumber) { * * * @param flashType Type of flash. - * @param spec1 Value of spec1 - * @param spec2 Value of spec2 + * @param spec1 Value of spec1 + * @param spec2 Value of spec2 * @param unitSpec1 Unit of spec1 * @param unitSpec2 Unit of spec2 */ @@ -1944,19 +1943,16 @@ public void flash(FlashType flashType, double spec1, double spec2, String unitSp } /** - * Perform flashes and return System properties per set of Spec1 and Spec2. - * Possible to specify + * Perform flashes and return System properties per set of Spec1 and Spec2. Possible to specify * fractions for each value of Spec1. * - * @param Spec1 Flash pressure in bar absolute. - * @param Spec2 Flash specification. Depends on FlashMode. Temperature - * in Kelvin, entalphy in - * J/mol or entropy in J/molK. - * @param FlashMode 1 - PT 2 - PH 3 - PS - * @param components Not yet in use. - * @param onlineFractions Specify fractions per sample instance or null to use - * static composition - * specified in system. + * @param Spec1 Flash pressure in bar absolute. + * @param Spec2 Flash specification. Depends on FlashMode. Temperature in Kelvin, entalphy in + * J/mol or entropy in J/molK. + * @param FlashMode 1 - PT 2 - PH 3 - PS + * @param components Not yet in use. + * @param onlineFractions Specify fractions per sample instance or null to use static composition + * specified in system. * @return Object CalculationResult object */ public CalculationResult propertyFlash(List- * calcIonicComposition class. + * CalcIonicComposition class. *
* * @author even solbraa * @version $Id: $Id */ -public class calcIonicComposition extends Flash { +public class CalcIonicComposition extends Flash { private static final long serialVersionUID = 1000; - Logger logger = LogManager.getLogger(calcIonicComposition.class); + Logger logger = LogManager.getLogger(CalcIonicComposition.class); int phaseNumber; String[][] resultTable = null; /** *- * Constructor for calcIonicComposition. + * Constructor for CalcIonicComposition. *
* * @param system a {@link neqsim.thermo.system.SystemInterface} object * @param phase a int */ - public calcIonicComposition(SystemInterface system, int phase) { + public CalcIonicComposition(SystemInterface system, int phase) { this.system = system; phaseNumber = phase; } From 20d3327a103a436d31dc0582f506990e55c91b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:29:49 +0100 Subject: [PATCH 095/317] refact: remove deprecation, simplify init --- .../neqsim/thermo/system/SystemInterface.java | 27 ++++++------------- .../neqsim/thermo/system/SystemThermo.java | 17 +++--------- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index b5ce9ee19a..e5d8fe7e15 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -614,18 +614,6 @@ public default void removeMoles() { */ public double[] getMolarRate(); - /** - * Returns true if phase exists and is not null. - * - * @param i Phase number - * @return True if phase exists, false if not. - * @deprecated use {@link #isPhase(int i)} instead - */ - @Deprecated - public default boolean IsPhase(int i) { - return isPhase(i); - } - /** * Returns true if phase exists and is not null. * @@ -1109,28 +1097,29 @@ public default boolean hasSolidPhase() { public void addComponent(ComponentInterface inComponent); /** - * add a component to a fluid. If component already exists, the moles will be added to the - * existing component. + * add a component to a fluid with no moles. * * @param name Name of the component to add. See NeqSim database for component in the database. */ - public void addComponent(String name); + public default void addComponent(String name) { + addComponent(name, 0); + } /** * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param moles number of moles (per second) of the component to be added to the fluid * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid */ public void addComponent(String name, double moles); /** - * add a component to a fluid. If component already exists, the moles will be added to the + * add a component to a fluid. If component already exists, the amount will be added to the * existing component. * * @param name Name of the component to add. See NeqSim database for component in the database. - * @param value The amount + * @param value The amount. * @param unitName the unit of rate (sported units are kg/sec, mol/sec, Nlitre/min, kg/hr, * Sm^3/hr, Sm^3/day, MSm^3/day .. */ @@ -1811,7 +1800,7 @@ public double calcBeta() /** * method to return molar volume of the fluid: eventual volume correction included. - * + * * @param unit Supported units are m3/mol, litre/mol * * @return molar volume volume in unit diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 960a203470..0676fbaf5c 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -1121,12 +1121,6 @@ public void addComponent(ComponentInterface inComponent) { } } - /** {@inheritDoc} */ - @Override - public void addComponent(String name) { - addComponent(name, 0.0); - } - /** {@inheritDoc} */ @Override public void addComponent(String componentName, double moles) { @@ -1201,6 +1195,7 @@ public void addComponent(String componentName, double value, String unitName) { stddens = Double.parseDouble(dataSet.getString("stddens")); boilp = Double.parseDouble(dataSet.getString("normboil")); } catch (Exception ex) { + // todo: mole amount may be not set. should not be caught? logger.error("failed ", ex); } neqsim.util.unit.Unit unit = @@ -1799,7 +1794,7 @@ public void reset() { /** {@inheritDoc} */ @Override public void init(int type) { - if (!isInitialized) { + if (!this.isInitialized) { initBeta(); init_x_y(); } @@ -1808,6 +1803,7 @@ public void init(int type) { } else { initAnalytic(type); } + this.isInitialized = true; } /** {@inheritDoc} */ @@ -3415,10 +3411,6 @@ public void normalizeBeta() { /** {@inheritDoc} */ @Override public String[][] createTable(String name) { - - if (!isInitialized) { - init_x_y(); - } initProperties(); java.text.DecimalFormat nf = new java.text.DecimalFormat(); @@ -3622,8 +3614,8 @@ public String[][] createTable(String name) { table[getPhases()[0].getNumberOfComponents() + 25][i + 2] = name; table[getPhases()[0].getNumberOfComponents() + 25][6] = "-"; } - resultTable = table; + resultTable = table; return table; } @@ -3636,7 +3628,6 @@ public void display() { /** {@inheritDoc} */ @Override public void display(String name) { - javax.swing.JFrame dialog = new javax.swing.JFrame("System-Report"); java.awt.Dimension screenDimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); java.awt.Container dialogContentPane = dialog.getContentPane(); From 4c9be0b62b8ac39e99edf00866453066a2eaf3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:33:23 +0100 Subject: [PATCH 096/317] simplify default method --- src/main/java/neqsim/thermo/system/SystemInterface.java | 4 +++- src/main/java/neqsim/thermo/system/SystemThermo.java | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index e5d8fe7e15..6383dca822 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -1556,7 +1556,9 @@ public default void initThermoProperties() { * display. * */ - public void display(); + public default void display() { + display(this.getFluidName()); + } /** *
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index 0676fbaf5c..1d7bd50e07 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -3619,12 +3619,6 @@ public String[][] createTable(String name) {
return table;
}
- /** {@inheritDoc} */
- @Override
- public void display() {
- display(this.getFluidName());
- }
-
/** {@inheritDoc} */
@Override
public void display(String name) {
From 767c5838ec3016449104e3beddcc88c451e997d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= > createDummyRequest(double[] fractions, int len) {
List
> onlineFractions = new ArrayList
>();
From 081201fda4347738c84d20f0d454f222be5bf430 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 22 Feb 2024 00:13:34 +0100
Subject: [PATCH 098/317] fix
---
.../chemicalEquilibriaum/ChemEq.java | 6 ++----
.../viscosity/Viscosity.java | 3 +--
src/main/java/neqsim/standards/Standard.java | 12 +++++-------
src/main/java/neqsim/thermo/system/SystemThermo.java | 3 +++
.../standards/gasQuality/Standard_ISO6976Test.java | 5 +----
.../gasQuality/Standard_ISO6976_2016_Test.java | 5 +----
.../standards/salesContract/BaseContractTest.java | 3 ---
7 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java
index 03ca2be6d4..82d5186f0f 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java
@@ -243,9 +243,7 @@ public double step() {
double[] n_omega = new double[NSPEC];
double[] chem_pot_omega = new double[NSPEC];
double[] chem_pot = new double[NSPEC];
- double G_1;
- double G_0;
check = 0;
step = 1;
@@ -262,8 +260,8 @@ public double step() {
}
}
- G_1 = 0;
-
+ double G_0;
+ double G_1 = 0;
for (i = 0; i < NSPEC; i++) {
G_1 += chem_pot_omega[i] * d_n[i];
}
diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java
index 88d6ec48d4..bd538bd63a 100644
--- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java
+++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java
@@ -61,7 +61,6 @@ public Viscosity clone() {
public double calcViscosity() {
double tempVar = 0;
double tempVar2 = 0;
- double viscosity = 0;
this.calcPureComponentViscosity();
// method og Grunberg and Nissan [87]
@@ -85,7 +84,7 @@ public double calcViscosity() {
// liquidPhase.getPhase().getComponents()[i].getx()*liquidPhase.getPhase().getComponents()[j].getx()*liquidPhase.getMixingRule().getViscosityGij(i,j);
}
}
- viscosity = Math.exp(tempVar + tempVar2) / 1.0e3; // N-sek/m2
+ double viscosity = Math.exp(tempVar + tempVar2) / 1.0e3; // N-sek/m2
return viscosity;
}
diff --git a/src/main/java/neqsim/standards/Standard.java b/src/main/java/neqsim/standards/Standard.java
index 5ad10d405f..1896bb60ad 100644
--- a/src/main/java/neqsim/standards/Standard.java
+++ b/src/main/java/neqsim/standards/Standard.java
@@ -111,6 +111,10 @@ public void setStandardDescription(String standardDescription) {
/** {@inheritDoc} */
@Override
public String[][] createTable(String name) {
+ if (thermoSystem == null) {
+ String[][] table = new String[0][6];
+ return table;
+ }
thermoSystem.setNumberOfPhases(1);
thermoSystem.createTable(name);
@@ -118,13 +122,7 @@ public String[][] createTable(String name) {
nf.setMaximumFractionDigits(5);
nf.applyPattern("#.#####E0");
- int rows = 0;
- if (thermoSystem == null) {
- String[][] table = new String[0][6];
- return table;
- }
-
- rows = thermoSystem.getPhases()[0].getNumberOfComponents() + 30;
+ int rows = thermoSystem.getPhases()[0].getNumberOfComponents() + 30;
String[][] table = new String[rows][6];
// String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
table[0][0] = ""; // getPhases()[0].getType(); //"";
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index 1d7bd50e07..ad028075a7 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -3622,6 +3622,9 @@ public String[][] createTable(String name) {
/** {@inheritDoc} */
@Override
public void display(String name) {
+ if (this.getNumberOfComponents() == 0) {
+ return;
+ }
javax.swing.JFrame dialog = new javax.swing.JFrame("System-Report");
java.awt.Dimension screenDimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
java.awt.Container dialogContentPane = dialog.getContentPane();
diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java
index ab5a2fae6f..10d6e09315 100644
--- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java
+++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java
@@ -169,10 +169,7 @@ void testCalculate2() {
@Test
void testDisplay() {
- Standard_ISO6976 s = new Standard_ISO6976(null);
- s.display("test");
-
- s = new Standard_ISO6976(testSystem);
+ Standard_ISO6976 s = new Standard_ISO6976(testSystem);
s.display("test");
}
}
diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java
index 49c9f40765..d6c75257a3 100644
--- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java
+++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java
@@ -134,10 +134,7 @@ void testCalculate2() {
@Test
void testDisplay() {
- Standard_ISO6976_2016 s = new Standard_ISO6976_2016(null);
- s.display("test");
-
- s = new Standard_ISO6976_2016(testSystem);
+ Standard_ISO6976_2016 s = new Standard_ISO6976_2016(testSystem);
s.display("test");
}
}
diff --git a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java
index 4d23c9d4b3..5e4ccb34dd 100644
--- a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java
+++ b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java
@@ -57,8 +57,5 @@ void testDisplay() {
BaseContract bc = new BaseContract();
bc.display();
-
- bc = new BaseContract(null);
- bc.display();
}
}
From 0f8503b31b284babfffb0858be42323ba34779ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 22 Feb 2024 10:00:20 +0100
Subject: [PATCH 099/317] test: disable tests not working on github
---
.../twoPhasePipeFlowNode/StratifiedFlowNodeTest.java | 2 ++
.../processSimulation/processSystem/ProcessSystemTest.java | 3 ---
.../neqsim/standards/gasQuality/Standard_ISO15403Test.java | 2 ++
.../java/neqsim/standards/gasQuality/Standard_ISO6578Test.java | 2 ++
.../java/neqsim/standards/gasQuality/Standard_ISO6976Test.java | 2 ++
.../standards/gasQuality/Standard_ISO6976_2016_Test.java | 2 ++
.../java/neqsim/standards/salesContract/BaseContractTest.java | 2 ++
src/test/java/neqsim/thermo/system/SystemThermoTest.java | 2 ++
.../thermodynamicOperations/ThermodynamicOperationsTest.java | 1 +
9 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNodeTest.java b/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNodeTest.java
index 19eca8af05..13867a9b0c 100644
--- a/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNodeTest.java
+++ b/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNodeTest.java
@@ -1,5 +1,6 @@
package neqsim.fluidMechanics.flowNode.twoPhaseNode.twoPhasePipeFlowNode;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import neqsim.fluidMechanics.geometryDefinitions.pipe.PipeData;
import neqsim.thermo.phase.PhaseType;
@@ -252,6 +253,7 @@ void testInit3() {
}
@Test
+ @Disabled
void testDisplay() {
StratifiedFlowNode node = new StratifiedFlowNode();
node.display();
diff --git a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java
index ab51c88ca8..36d7d4a45a 100644
--- a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java
+++ b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java
@@ -170,9 +170,6 @@ void testCopy() {
Assertions.assertEquals(p, sys2);
}
- @Test
- void testDisplayResult() {}
-
@Test
void testGetAllUnitNames() {}
diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO15403Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO15403Test.java
index 9304a16d55..b465faaf06 100644
--- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO15403Test.java
+++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO15403Test.java
@@ -2,6 +2,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -57,6 +58,7 @@ void testIsOnSpec() {
}
@Test
+ @Disabled
void testDisplay() {
Standard_ISO15403 s = new Standard_ISO15403(null);
s.display("test");
diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6578Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6578Test.java
index 8cf1613e68..3f8b77a9c2 100644
--- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6578Test.java
+++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6578Test.java
@@ -2,6 +2,7 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -52,6 +53,7 @@ void testCalculate() {
}
@Test
+ @Disabled
void testDisplay() {
Standard_ISO6578 s = new Standard_ISO6578(null);
s.display("test");
diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java
index 10d6e09315..f0340b8529 100644
--- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java
+++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java
@@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -168,6 +169,7 @@ void testCalculate2() {
}
@Test
+ @Disabled
void testDisplay() {
Standard_ISO6976 s = new Standard_ISO6976(testSystem);
s.display("test");
diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java
index d6c75257a3..86e9b06e1a 100644
--- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java
+++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java
@@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -133,6 +134,7 @@ void testCalculate2() {
}
@Test
+ @Disabled
void testDisplay() {
Standard_ISO6976_2016 s = new Standard_ISO6976_2016(testSystem);
s.display("test");
diff --git a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java
index 5e4ccb34dd..9328d9db83 100644
--- a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java
+++ b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java
@@ -2,6 +2,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemGERGwaterEos;
import neqsim.thermo.system.SystemInterface;
@@ -52,6 +53,7 @@ void testUKGSMR19962() {
}
@Test
+ @Disabled
void testDisplay() {
standard.display();
diff --git a/src/test/java/neqsim/thermo/system/SystemThermoTest.java b/src/test/java/neqsim/thermo/system/SystemThermoTest.java
index 28f9f0bbe3..4f710bcfe4 100644
--- a/src/test/java/neqsim/thermo/system/SystemThermoTest.java
+++ b/src/test/java/neqsim/thermo/system/SystemThermoTest.java
@@ -2,6 +2,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import neqsim.thermo.ThermodynamicConstantsInterface;
@@ -92,6 +93,7 @@ public void testSetPressure() {
}
@Test
+ @Disabled
void testDisplay() {
testSystem.display();
diff --git a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
index ab1d24a61a..f59bf01c9b 100644
--- a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
@@ -331,6 +331,7 @@ void testpropertyFlashRegressions() throws IOException {
}
@Test
+ @Disabled
void testDisplay() {
ThermodynamicOperations ops = new ThermodynamicOperations();
ops.display();
From 5133ef1db6df7497ca21069f2a389e523254b31a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 22 Feb 2024 14:04:21 +0100
Subject: [PATCH 100/317] fix
---
.../thermodynamicOperations/ThermodynamicOperations.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
index 03dd936493..1be2bc115f 100644
--- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
+++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
@@ -1794,6 +1794,10 @@ public void setResultTable(String[][] resultTable) {
*
update.
+ *+ * update. + *
* * @param deltaTime a double */ @@ -424,6 +425,5 @@ public void update(double deltaTime) { getBulkSystem().initBeta(); getBulkSystem().init_x_y(); getBulkSystem().initProperties(); - } } diff --git a/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java b/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java index 78f8766259..e05e29633a 100644 --- a/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java +++ b/src/main/java/neqsim/processSimulation/controllerDevice/ControllerDeviceBaseClass.java @@ -55,7 +55,6 @@ public ControllerDeviceBaseClass() { this("controller"); } - /** {@inheritDoc} */ @Override public void setActive(boolean isActive) { diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java index 7db456a340..ef8ecc9a16 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java @@ -254,7 +254,6 @@ public double getMeasuredValue(String measurement, String unit) { double GOR_via_corrected_volume = tempFluid.getPhase("gas").getCorrectedVolume() / tempFluid.getPhase("oil").getCorrectedVolume(); - System.out.println("Stream 2 (results inside MPM) " + " GOR sm3/sm3 " + GOR_in_sm3_sm3 + " GOR Corrected by volume " + GOR_via_corrected_volume); diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java index 6ab3770606..f18c4629fe 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/WaterDewPointAnalyser.java @@ -31,7 +31,6 @@ public class WaterDewPointAnalyser extends StreamMeasurementDeviceBaseClass { */ public WaterDewPointAnalyser(StreamInterface stream) { this("WaterDewPointAnalyser", stream); - } /** diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java index 44d1dd3310..b797fb517b 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java @@ -175,5 +175,4 @@ public double getAngle(String unit) { public double getArea() { return pi * Math.pow(this.internalDiameter, 2) / 4; } - } diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java index 7e435f2751..2bad207261 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java @@ -458,7 +458,6 @@ public double stratifiedHoldUp(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnaly logger.debug("Could not find solution for stratified flow holdup"); } else { holdUp = (gamma - 0.5 * Math.sin(2 * gamma)) / (pi); - } return holdUp; } @@ -754,7 +753,6 @@ public static void main(String[] args) { // inputStream.setFlowRate(0.00001, "MSm^3/day"); // System.out.println(inputStream.getFlowRate("kg/sec")); // mySevereSlug4.getPredictedFlowRegime(); - } // To be implemented diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java index 7579c31012..1713d29cae 100644 --- a/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java +++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java @@ -1188,6 +1188,4 @@ public boolean equals(Object obj) { && Double.doubleToLongBits(weigthVesselShell) == Double .doubleToLongBits(other.weigthVesselShell); } - - } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java index fc1507259a..a6262aedf9 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java @@ -28,9 +28,7 @@ public interface ProcessEquipmentInterface extends SimulationInterface { * Get ainitMechanicalDesign
for the equipment.
*
**/
- default void initMechanicalDesign() {
-
- }
+ default void initMechanicalDesign() {}
/**
* diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java index 6aa50411b0..7645dff291 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartGenerator.java @@ -51,7 +51,6 @@ public CompressorChart generateCompressorChart(String generationOption) { compChart.setHeadUnit("kJ/kg"); compChart.setCurves(chartConditions, speed, flow, head, polyEff); - // Generating surge curve double minFlowSurgeFlow = 0.7 * refflow; double refSurgeFlow = 0.8 * refflow; diff --git a/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java b/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java index f945e8de79..b6dc5b6ce0 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java @@ -56,8 +56,8 @@ public class DistillationColumn extends ProcessEquipmentBaseClass implements Dis *
* * @param numberOfTraysLocal a int - * @param hasReboiler a boolean - * @param hasCondenser a boolean + * @param hasReboiler a boolean + * @param hasCondenser a boolean */ public DistillationColumn(int numberOfTraysLocal, boolean hasReboiler, boolean hasCondenser) { super("DistillationColumn"); @@ -86,9 +86,8 @@ public DistillationColumn(int numberOfTraysLocal, boolean hasReboiler, boolean h * addFeedStream. * * - * @param inputStream a - * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object * @param feedTrayNumber a int */ public void addFeedStream(StreamInterface inputStream, int feedTrayNumber) { @@ -158,15 +157,16 @@ public void init() { double feedTrayTemperature = getTray(getFeedTrayNumber()).getTemperature(); if (trays.get(numberOfTrays - 1).getNumberOfInputStreams() > 0) { - condenserTemperature = ((MixerInterface) trays.get(numberOfTrays - 1)).getThermoSystem().getTemperature(); + condenserTemperature = + ((MixerInterface) trays.get(numberOfTrays - 1)).getThermoSystem().getTemperature(); } else { condenserTemperature = feedTrayTemperature - 1.0; } reboilerTemperature = ((MixerInterface) trays.get(0)).getThermoSystem().getTemperature(); - double deltaTempCondenser = (feedTrayTemperature - condenserTemperature) - / (numberOfTrays * 1.0 - feedTrayNumber - 1); + double deltaTempCondenser = + (feedTrayTemperature - condenserTemperature) / (numberOfTrays * 1.0 - feedTrayNumber - 1); double deltaTempReboiler = (reboilerTemperature - feedTrayTemperature) / (feedTrayNumber * 1.0); double delta = 0; @@ -199,7 +199,6 @@ public void init() { ((Runnable) trays.get(0)).run(); // massBalanceCheck(); - } /** @@ -207,9 +206,7 @@ public void init() { * Getter for the fieldgasOutStream
.
*
*
- * @return a
- * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
- * object
+ * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
*/
public StreamInterface getGasOutStream() {
return gasOutStream;
@@ -220,9 +217,7 @@ public StreamInterface getGasOutStream() {
* Getter for the field liquidOutStream
.
*
*
- * @return a
- * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
- * object
+ * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
*/
public StreamInterface getLiquidOutStream() {
return liquidOutStream;
@@ -234,9 +229,7 @@ public StreamInterface getLiquidOutStream() {
*
*
* @param trayNumber a int
- * @return a
- * {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray}
- * object
+ * @return a {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray} object
*/
public SimpleTray getTray(int trayNumber) {
return trays.get(trayNumber);
@@ -431,7 +424,6 @@ public boolean componentMassBalanceCheck(String componentName) {
.getComponent(componentName).getFlowRate("kg/hr");
}
}
-
}
for (int i = 0; i < numberOfTrays; i++) {
@@ -456,7 +448,6 @@ public boolean componentMassBalanceCheck(String componentName) {
+ trays.get(i).getLiquidOutStream().getFluid().getComponent("water").getFlowRate("kg/hr")
+ " pressure " + trays.get(i).getGasOutStream().getPressure() + " temperature "
+ trays.get(i).getGasOutStream().getTemperature("C") + " feedtotray " + massFeedInput[i]);
-
}
double massError = 0.0;
@@ -503,15 +494,12 @@ public boolean massBalanceCheck() {
+ trays.get(i).getGasOutStream().getPressure() + " temperature "
+ trays.get(i).getGasOutStream().getTemperature("C"));
/*
- * System.out.println( "tray " + i + " number of input streams " +
- * numberOfInputStreams +
+ * System.out.println( "tray " + i + " number of input streams " + numberOfInputStreams +
* " water in gasout " +
* trays.get(i).getGasOutStream().getFluid().getPhase(0).getComponent("water")
* .getNumberOfmoles() + " water in liquidout " +
- * trays.get(i).getLiquidOutStream().getFluid().getPhase(0).getComponent(
- * "water")
- * .getNumberOfmoles() + " pressure " +
- * trays.get(i).getGasOutStream().getPressure() +
+ * trays.get(i).getLiquidOutStream().getFluid().getPhase(0).getComponent( "water")
+ * .getNumberOfmoles() + " pressure " + trays.get(i).getGasOutStream().getPressure() +
* " temperature " + trays.get(i).getGasOutStream().getTemperature("C"));
*/
}
@@ -562,7 +550,8 @@ public void energyBalanceCheck() {
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String[] args) {
- neqsim.thermo.system.SystemInterface testSystem = new neqsim.thermo.system.SystemSrkEos((273.15 - 0.0), 15.000);
+ neqsim.thermo.system.SystemInterface testSystem =
+ new neqsim.thermo.system.SystemSrkEos((273.15 - 0.0), 15.000);
// testSystem.addComponent("methane", 10.00);
testSystem.addComponent("ethane", 10.0);
testSystem.addComponent("CO2", 10.0);
@@ -586,7 +575,8 @@ public static void main(String[] args) {
// column.getCondenser().setHeatInput(-70000.0);
// ((Condenser) column.getCondenser()).setRefluxRatio(0.2);
- neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem();
+ neqsim.processSimulation.processSystem.ProcessSystem operations =
+ new neqsim.processSimulation.processSystem.ProcessSystem();
operations.add(stream_1);
operations.add(column);
operations.run();
@@ -601,9 +591,7 @@ public static void main(String[] args) {
* getReboiler.
*
*
- * @return a
- * {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray}
- * object
+ * @return a {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray} object
*/
public SimpleTray getReboiler() {
return trays.get(0);
@@ -614,9 +602,7 @@ public SimpleTray getReboiler() {
* getCondenser.
*
*
- * @return a
- * {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray}
- * object
+ * @return a {@link neqsim.processSimulation.processEquipment.distillation.SimpleTray} object
*/
public SimpleTray getCondenser() {
return trays.get(trays.size() - 1);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java
index 70d196ec35..29313d64b0 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java
@@ -154,7 +154,6 @@ public void setOutTP(double temperature, double pressure) {
public boolean needRecalculation() {
if (inStream == null) {
return true;
-
}
if (inStream.getFluid().getTemperature() == lastTemperature
&& inStream.getFluid().getPressure() == lastPressure
@@ -234,10 +233,8 @@ public void runTransient(double dt, UUID id) {
increaseTime(dt);
return;
}
-
}
-
/** {@inheritDoc} */
@Override
public void displayResult() {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java b/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java
index 5779920dc7..ab9c747e3e 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java
@@ -69,7 +69,6 @@ public StreamInterface getSplitStream(int i) {
return localsplitter.getSplitStream(i);
}
-
/**
*
* getMixedStream.
@@ -88,5 +87,4 @@ public void run(UUID id) {
localsplitter.setInletStream(localmixer.getOutletStream());
localsplitter.run();
}
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java
index b0767f6461..6f0b3aa78f 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java
@@ -115,7 +115,6 @@ public class PipeBeggsAndBrills extends Pipeline {
double length;
double elevation;
-
// Results initialization (for each segment)
private List
* Setter for the field
* Setter for the field
* Setter for the field
* calcHydrostaticPressureDifference
@@ -512,7 +502,6 @@ public double calcHydrostaticPressureDifference() {
SG = system.getPhase(1).getDensity("lb/ft3") / (1000 * 0.0624279606);
}
-
double APIgrav = (141.5 / (SG)) - 131.0;
double sigma68 = 39.0 - 0.2571 * APIgrav;
double sigma100 = 37.5 - 0.2571 * APIgrav;
@@ -737,10 +726,8 @@ public void run(UUID id) {
elevationProfile.add(cumulativeElevation);
incrementsProfile.add(getNumberOfIncrements());
-
outStream.setThermoSystem(system);
outStream.setCalculationIdentifier(id);
-
}
/**
@@ -755,7 +742,6 @@ public void runTransient(double dt, UUID id) {
run(id);
increaseTime(dt);
return;
-
}
/** {@inheritDoc} */
@@ -777,7 +763,6 @@ public double getInletSuperficialVelocity() {
/ (Math.PI / 4.0 * Math.pow(insideDiameter, 2.0));
}
-
/**
*
* getOutletSuperficialVelocity.
@@ -789,7 +774,6 @@ public double getOutletSuperficialVelocity() {
return getSegmentMixtureSuperficialVelocity(numberOfIncrements);
}
-
/**
*
* getNumberOfIncrements
@@ -801,8 +785,6 @@ public int getNumberOfIncrements() {
return numberOfIncrements;
}
-
-
/**
* @return angle in degrees
*/
@@ -810,7 +792,6 @@ public double getAngle() {
return angle;
}
-
/**
* @return total length of the pipe in m
*/
@@ -825,8 +806,6 @@ public double getElevation() {
return cumulativeElevation;
}
-
-
/**
*
* getDiameter.
@@ -849,7 +828,6 @@ public String getFlowRegime() {
return regime;
}
-
/**
*
* Getter for the field
* Getter for the field
* getSegmentPressure
@@ -902,7 +877,6 @@ public Double getSegmentPressure(int index) {
}
}
-
/**
*
* @return list of results
@@ -912,7 +886,6 @@ public List
* Constructor for WellFlow.
@@ -104,5 +103,4 @@ public void setWellProductionIndex(double wellProductionIndex) {
useWellProductionIndex = true;
this.wellProductionIndex = wellProductionIndex;
}
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java
index f97b416211..d515bb6d04 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubber.java
@@ -76,5 +76,4 @@ public GasScrubber(String name, StreamInterface inletStream) {
public GasScrubberMechanicalDesign getMechanicalDesign() {
return new GasScrubberMechanicalDesign(this);
}
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java
index e1765f7c64..22fbabe9ee 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java
@@ -60,8 +60,6 @@ public class Separator extends ProcessEquipmentBaseClass implements SeparatorInt
/** Inner diameter/height of separator volume. */
private double internalDiameter = 1.0;
-
-
/** LiquidLevel as volume fraction of liquidvolume/(liquid + gas volume). */
private double liquidLevel = 0.5;
double liquidVolume =
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java
index e03b25f49a..d8877c3096 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java
@@ -196,7 +196,6 @@ public Stream clone() {
clonedSystem.thermoSystem = thermoSystem.clone();
}
-
return clonedSystem;
}
@@ -607,5 +606,4 @@ public SystemInterface getFluid() {
return thermoSystem;
}
}
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java
index 29151b4d08..86706217aa 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java
@@ -235,5 +235,4 @@ public default double getFlowRate(String unit) {
/** {@inheritDoc} */
@Override
public int hashCode();
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/subsea/SimpleFlowLine.java b/src/main/java/neqsim/processSimulation/processEquipment/subsea/SimpleFlowLine.java
index 24bc57ba8f..0915c85f78 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/subsea/SimpleFlowLine.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/subsea/SimpleFlowLine.java
@@ -33,7 +33,6 @@ public class SimpleFlowLine extends TwoPortEquipment {
@Deprecated
public SimpleFlowLine(StreamInterface inStream) {
this("SimpleFlowLine", inStream);
-
}
/**
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java b/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java
index 1f8308141c..93ae48b902 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java
@@ -364,7 +364,6 @@ public void setMinAdjustedValue(double minVal) {
if (minAdjustedValue > maxAdjustedValue) {
maxAdjustedValue = minAdjustedValue;
}
-
}
public double getMaxAdjustedValue() {
@@ -374,5 +373,4 @@ public double getMaxAdjustedValue() {
public double getMinAdjustedValue() {
return minAdjustedValue;
}
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/Calculator.java b/src/main/java/neqsim/processSimulation/processEquipment/util/Calculator.java
index 02566e80f3..65049fde21 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/Calculator.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/Calculator.java
@@ -8,7 +8,6 @@
import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
-
/**
*
* Calculator class.
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java
index 4bf1169bda..a54a2a356a 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java
@@ -73,7 +73,6 @@ public FlowSetter(String name, StreamInterface stream) {
super(name, stream);
}
-
/**
* {@inheritDoc}
*
@@ -400,5 +399,4 @@ public void setSeparationPT(double[] pressure, String unitP, double[] temperatur
this.temperature = temperature;
this.unitT = unitT;
}
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/PressureDrop.java b/src/main/java/neqsim/processSimulation/processEquipment/util/PressureDrop.java
index 38dc472117..fc8e196091 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/PressureDrop.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/PressureDrop.java
@@ -73,5 +73,4 @@ public void run(UUID id) {
outStream.setFluid(thermoSystem);
}
-
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java b/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
index c9be581df5..69971625f5 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValve.java
@@ -54,9 +54,8 @@ public ThrottlingValve() {
* Constructor for ThrottlingValve.
* length
.
@@ -230,7 +228,6 @@ public void setDiameter(double diameter) {
insideDiameter = diameter;
}
-
/**
* angle
.
@@ -264,7 +261,6 @@ public void setNumberOfIncrements(int numberOfIncrements) {
this.numberOfIncrements = numberOfIncrements;
}
-
/**
* runIsothermal
.
@@ -276,7 +272,6 @@ public void setRunIsothermal(boolean runIsothermal) {
this.runIsothermal = runIsothermal;
}
-
/**
* Converts the input values from the system measurement units to imperial units. Needed because
* the main equations and coefficients are developed for imperial system
@@ -322,10 +317,8 @@ public void convertSystemUnitToMetric() {
length = length / 3.2808399;
pipeWallRoughness = pipeWallRoughness / 3.2808399;
pressureDrop = pressureDrop * 1.48727E-05;
-
}
-
public void calculateMissingValue() {
if (Double.isNaN(totalLength)) {
totalLength = calculateLength();
@@ -345,7 +338,6 @@ public void calculateMissingValue() {
new neqsim.util.exception.InvalidInputException("PipeBeggsAndBrills", "calcMissingValue",
"elevation or length or angle or inlet diameter", "cannot be null"));
}
-
}
/**
@@ -456,8 +448,6 @@ public String calcFlowRegime() {
return regime;
}
-
-
/**
* LastSegmentPressureDrop
.
@@ -872,7 +850,6 @@ public double getPressureDrop() {
return totalPressureDrop;
}
-
/**
* PressureProfile
.
@@ -884,8 +861,6 @@ public List
PhasePrEosvolcor class.
+ *+ * PhasePrEosvolcor class. + *
* * @author Even Solbraa * @version $Id: $Id @@ -37,11 +39,12 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); loc_C = calcC(this, temperature, pressure, numberOfComponents); CT = calcCT(this, temperature, pressure, numberOfComponents); - } /** - *getCT.
+ *+ * getCT. + *
* * @return a double */ @@ -50,7 +53,9 @@ public double getCT() { } /** - *getCTT.
+ *+ * getCTT. + *
* * @return a double */ @@ -77,14 +82,15 @@ public double calcf() { public double dFdV() { // return super.dFdV(); return -numberOfMolesInPhase * gV() - getA() / temperature * fv(); - } // note that in future the next thre lines should be modified to handle various mixing rules for // the translation /** - *getcij.
+ *+ * getcij. + *
* * @param compArray a {@link neqsim.thermo.component.ComponentEosInterface} object * @param compArray2 a {@link neqsim.thermo.component.ComponentEosInterface} object @@ -96,7 +102,9 @@ public double getcij(ComponentEosInterface compArray, ComponentEosInterface comp } /** - *getcijT.
+ *+ * getcijT. + *
* * @param compArray a {@link neqsim.thermo.component.ComponentEosInterface} object * @param compArray2 a {@link neqsim.thermo.component.ComponentEosInterface} object @@ -108,7 +116,9 @@ public double getcijT(ComponentEosInterface compArray, ComponentEosInterface com } /** - *getcijTT.
+ *+ * getcijTT. + *
* * @param compi a {@link neqsim.thermo.component.ComponentPRvolcor} object * @param compj a {@link neqsim.thermo.component.ComponentPRvolcor} object @@ -121,7 +131,9 @@ public double getcijTT(ComponentPRvolcor compi, ComponentPRvolcor compj) { // @Override /** - *calcCi.
+ *+ * calcCi. + *
* * @param compNumb a int * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object @@ -145,7 +157,9 @@ public double calcCi(int compNumb, PhaseInterface phase, double temperature, dou } /** - *calcCij.
+ *+ * calcCij. + *
* * @param compNumb a int * @param compNumbj a int @@ -166,7 +180,9 @@ public double calcCij(int compNumb, int compNumbj, PhaseInterface phase, double } /** - *calcCiT.
+ *+ * calcCiT. + *
* * @param compNumb a int * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object @@ -190,7 +206,9 @@ public double calcCiT(int compNumb, PhaseInterface phase, double temperature, do } /** - *calcCT.
+ *+ * calcCT. + *
* * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double @@ -203,7 +221,9 @@ public double calcCT(PhaseInterface phase, double temperature, double pressure, } /** - *calcC.
+ *+ * calcC. + *
* * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double @@ -231,7 +251,9 @@ private double loc_C() { } /** - *getc.
+ *+ * getc. + *
* * @return a double */ @@ -240,7 +262,9 @@ public double getc() { } /** - *getC.
+ *+ * getC. + *
* * @return a double */ @@ -273,7 +297,9 @@ public double gVV() { } /** - *gVVV.
+ *+ * gVVV. + *
* * @return a double */ @@ -306,7 +332,9 @@ public double fVV() { } /** - *fVVV.
+ *+ * fVVV. + *
* * @return a double */ @@ -336,7 +364,9 @@ public double gb() { // derivative of small g with regards to c /** - *gc.
+ *+ * gc. + *
* * @return a double */ @@ -347,7 +377,9 @@ public double gc() { // derivative of small f with regards to c-->equal to fv /** - *fc.
+ *+ * fc. + *
* * @return a double */ @@ -364,7 +396,9 @@ public double fb() { // second derivative of small f with regards to cc-->equal to fvv /** - *fcc.
+ *+ * fcc. + *
* * @return a double */ @@ -374,7 +408,9 @@ public double fcc() { // second derivative of small f with regards to bc-->equal to fvv /** - *fbc.
+ *+ * fbc. + *
* * @return a double */ @@ -384,7 +420,9 @@ public double fbc() { // second derivative of small f with regards to cv-->equal to fvv /** - *fcv.
+ *+ * fcv. + *
* * @return a double */ @@ -424,7 +462,9 @@ public double gBB() { // second derivative of small g with regards to bc--> /** - *gBC.
+ *+ * gBC. + *
* * @return a double */ @@ -435,7 +475,9 @@ public double gBC() { // second derivative of small g with regards to cv--> /** - *gCV.
+ *+ * gCV. + *
* * @return a double */ @@ -446,7 +488,9 @@ public double gCV() { // second derivative of small g with regards to cc--> /** - *gCC.
+ *+ * gCC. + *
* * @return a double */ @@ -466,7 +510,9 @@ public double F() { // derivative of big F with regards to C // @Override /** - *FC.
+ *+ * FC. + *
* * @return a double */ @@ -475,7 +521,9 @@ public double FC() { } /** - *FnC.
+ *+ * FnC. + *
* * @return a double */ @@ -484,7 +532,9 @@ public double FnC() { } /** - *FTC.
+ *+ * FTC. + *
* * @return a double */ @@ -493,7 +543,9 @@ public double FTC() { } /** - *FBC.
+ *+ * FBC. + *
* * @return a double */ @@ -502,7 +554,9 @@ public double FBC() { } /** - *FCV.
+ *+ * FCV. + *
* * @return a double */ @@ -511,7 +565,9 @@ public double FCV() { } /** - *FCC.
+ *+ * FCC. + *
* * @return a double */ @@ -520,7 +576,9 @@ public double FCC() { } /** - *FCD.
+ *+ * FCD. + *
* * @return a double */ diff --git a/src/main/java/neqsim/util/database/NeqSimContractDataBase.java b/src/main/java/neqsim/util/database/NeqSimContractDataBase.java index 6574a18456..cc29c7c443 100644 --- a/src/main/java/neqsim/util/database/NeqSimContractDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimContractDataBase.java @@ -55,7 +55,6 @@ public NeqSimContractDataBase() { } } - /** * Drops and re-creates table from contents in csv file. * @@ -65,7 +64,6 @@ public static void updateTable(String tableName) { updateTable(tableName, "commercial/" + tableName + ".csv"); } - public static void initH2DatabaseFromCSVfiles() { h2IsInitalizing = true; neqsim.util.database.NeqSimContractDataBase.connectionString = diff --git a/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java b/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java index fbec4591ef..ccfabfe8f7 100644 --- a/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java @@ -13,8 +13,7 @@ * @author Even Solbraa * @version June 2023 */ -public class NeqSimProcessDesignDataBase extends NeqSimDataBase -{ +public class NeqSimProcessDesignDataBase extends NeqSimDataBase { private static final long serialVersionUID = 1000; static Logger logger = LogManager.getLogger(NeqSimProcessDesignDataBase.class); @@ -62,7 +61,6 @@ public NeqSimProcessDesignDataBase() { } } - /** * Drops and re-creates table from contents in csv file. * @@ -72,7 +70,6 @@ public static void updateTable(String tableName) { updateTable(tableName, "designdata/" + tableName + ".csv"); } - public static void initH2DatabaseFromCSVfiles() { h2IsInitalizing = true; neqsim.util.database.NeqSimProcessDesignDataBase.connectionString = diff --git a/src/main/java/neqsim/util/unit/LengthUnit.java b/src/main/java/neqsim/util/unit/LengthUnit.java index 007b6b6edf..b8b1aad6d9 100644 --- a/src/main/java/neqsim/util/unit/LengthUnit.java +++ b/src/main/java/neqsim/util/unit/LengthUnit.java @@ -17,7 +17,6 @@ public class LengthUnit extends neqsim.util.unit.BaseUnit { private static final long serialVersionUID = 1000; - /** ** Constructor for LengthUnit. diff --git a/src/main/java/neqsim/util/unit/TimeUnit.java b/src/main/java/neqsim/util/unit/TimeUnit.java index 28c293b628..466f12a5d7 100644 --- a/src/main/java/neqsim/util/unit/TimeUnit.java +++ b/src/main/java/neqsim/util/unit/TimeUnit.java @@ -28,5 +28,4 @@ public class TimeUnit extends neqsim.util.unit.BaseUnit { public TimeUnit(double value, String name) { super(value, name); } - } diff --git a/src/test/java/neqsim/PVTsimulation/simulation/SaturationPressureTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SaturationPressureTest.java index abb20d024d..6f887368cc 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SaturationPressureTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SaturationPressureTest.java @@ -10,7 +10,6 @@ class SaturationPressureTest extends neqsim.NeqSimTest { @BeforeAll static void setUpBeforeClass() throws Exception {} - @Test void testCalcSaturationPressure() { SystemInterface tempSystem = new SystemSrkEos(273.15 + 20, 10.0); diff --git a/src/test/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGshipTest.java b/src/test/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGshipTest.java index 09e781873d..a1061431c9 100644 --- a/src/test/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGshipTest.java +++ b/src/test/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGshipTest.java @@ -1,59 +1,62 @@ package neqsim.fluidMechanics.flowSystem.twoPhaseFlowSystem.shipSystem; -import neqsim.thermo.system.SystemInterface; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.*; +import neqsim.thermo.system.SystemInterface; class LNGshipTest { - LNGship testShip; - SystemInterface testSystem; - @BeforeEach - void setUp() { - testSystem = new neqsim.thermo.system.SystemSrkEos(100, 1.0); - testSystem.addComponent("methane", 0.9); - testSystem.addComponent("nitrogen", 0.1); - testSystem.init(0); - - testShip = new LNGship(testSystem, 1_000_000, 0.01); - } - - @Test - void createSystem() { - assertEquals(0.7, testShip.getLiquidDensity()); - assertEquals(0.0, testShip.dailyBoilOffVolume); - assertEquals(0.0, testShip.initialNumberOffMoles); - testShip.createSystem(); - assertEquals(474.3293447569919, testShip.getLiquidDensity()); - assertEquals(10_000.0, testShip.dailyBoilOffVolume); - assertEquals(2.7513223265419292E10, testShip.initialNumberOffMoles); - - } - - @Test - public void testSolveSteadyState() { - assertEquals(-173.15, testShip.getThermoSystem().getTemperature("C"), 1e-2); - testShip.createSystem(); - testShip.solveSteadyState(1, null); - assertEquals(-176.43, testShip.getThermoSystem().getTemperature("C"), 1e-2); - assertEquals(testSystem.getPhase("oil").getComponent("nitrogen").getx(), testShip.getThermoSystem().getPhase("oil").getComponent("nitrogen").getx(), 1e-4); - assertEquals(testSystem.getPhase("oil").getComponent("methane").getx(), testShip.getThermoSystem().getPhase("oil").getComponent("methane").getx(), 1e-4); - } - - @Test - void solveTransient() { - assertNull(testShip.volume); - assertEquals(0.0, testShip.endVolume); - assertEquals(1_000_000, testShip.totalTankVolume); // Initial cargo volume - - testShip.createSystem(); - testShip.solveSteadyState(0, null); - testShip.solveTransient(0, null); - - - assertEquals(testShip.numberOffTimeSteps, testShip.tankTemperature.length); // Check that the results have correct length - assertEquals(600_000.0, testShip.endVolume); - } -} \ No newline at end of file + LNGship testShip; + SystemInterface testSystem; + + @BeforeEach + void setUp() { + testSystem = new neqsim.thermo.system.SystemSrkEos(100, 1.0); + testSystem.addComponent("methane", 0.9); + testSystem.addComponent("nitrogen", 0.1); + testSystem.init(0); + + testShip = new LNGship(testSystem, 1_000_000, 0.01); + } + + @Test + void createSystem() { + assertEquals(0.7, testShip.getLiquidDensity()); + assertEquals(0.0, testShip.dailyBoilOffVolume); + assertEquals(0.0, testShip.initialNumberOffMoles); + testShip.createSystem(); + assertEquals(474.3293447569919, testShip.getLiquidDensity()); + assertEquals(10_000.0, testShip.dailyBoilOffVolume); + assertEquals(2.7513223265419292E10, testShip.initialNumberOffMoles); + } + + @Test + public void testSolveSteadyState() { + assertEquals(-173.15, testShip.getThermoSystem().getTemperature("C"), 1e-2); + testShip.createSystem(); + testShip.solveSteadyState(1, null); + assertEquals(-176.43, testShip.getThermoSystem().getTemperature("C"), 1e-2); + assertEquals(testSystem.getPhase("oil").getComponent("nitrogen").getx(), + testShip.getThermoSystem().getPhase("oil").getComponent("nitrogen").getx(), 1e-4); + assertEquals(testSystem.getPhase("oil").getComponent("methane").getx(), + testShip.getThermoSystem().getPhase("oil").getComponent("methane").getx(), 1e-4); + } + + @Test + void solveTransient() { + assertNull(testShip.volume); + assertEquals(0.0, testShip.endVolume); + assertEquals(1_000_000, testShip.totalTankVolume); // Initial cargo volume + + testShip.createSystem(); + testShip.solveSteadyState(0, null); + testShip.solveTransient(0, null); + + assertEquals(testShip.numberOffTimeSteps, testShip.tankTemperature.length); // Check that the + // results have + // correct length + assertEquals(600_000.0, testShip.endVolume); + } +} diff --git a/src/test/java/neqsim/processSimulation/mechanicalDesign/SystemMechanicalDesignTest.java b/src/test/java/neqsim/processSimulation/mechanicalDesign/SystemMechanicalDesignTest.java index 0cda62fdec..1e5c7d317f 100644 --- a/src/test/java/neqsim/processSimulation/mechanicalDesign/SystemMechanicalDesignTest.java +++ b/src/test/java/neqsim/processSimulation/mechanicalDesign/SystemMechanicalDesignTest.java @@ -156,7 +156,6 @@ void testRunDesignCalculationforSeparator() { @Test void testRunDesignCalculationforGasScrubber() { - SystemInterface thermoSystem = new SystemSrkEos(298.0, 120.0); thermoSystem.addComponent("nitrogen", 1.0); thermoSystem.addComponent("methane", 99.0); @@ -171,7 +170,6 @@ void testRunDesignCalculationforGasScrubber() { GasScrubber sep1 = new GasScrubber(inlets); sep1.run(); - GasScrubberMechanicalDesign sepMechDesign = new GasScrubberMechanicalDesign(sep1); sepMechDesign.setMaxOperationPressure(180); sepMechDesign.calcDesign(); @@ -180,7 +178,6 @@ void testRunDesignCalculationforGasScrubber() { System.out.println("separator weight structual steel " + sepMechDesign.weightStructualSteel); sep1.addSeparatorSection("first mesh", "meshpad"); sepMechDesign.calcDesign(); - } @Test @@ -193,7 +190,6 @@ void testRunDesignCalculationforValve() { @Test void testRunDesignForPipeline() { - AdiabaticPipe pipe = new AdiabaticPipe("pipe1", ((neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator) operations .getUnit("1st stage separator")).getGasOutStream()); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java b/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java index f52bce181b..b54d6c71dd 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java @@ -224,7 +224,6 @@ public void testCompressorWithGERG2008_2() { double head2 = compressor1.getPolytropicHead("kJ/kg"); logger.info("gerg power " + compressor1.getPower() + " W"); assertEquals(compressor1.getPolytropicHead("kJ/kg"), 94.32923841459161, 0.01); - } /** diff --git a/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java b/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java index f7d1f555a0..98814ee444 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java @@ -101,7 +101,6 @@ public void DistillationColumnTest() throws Exception { * column.getLiquidOutStream().getFluid().getComponent("water").getMolarMass() * column.getLiquidOutStream().getFluid().getComponent("water").getz(); - double totalWaterIn = waterFlowRateInColumn2 + waterFlowRateInColumnGasToReb; double totalWaterOut = waterFlowRateOutColumn + waterFlowRateOutColumnLeanTEG; /* @@ -120,7 +119,6 @@ public void DistillationColumnTest() throws Exception { * ((Condenser) column.getCondenser()).getDuty()); */ assertEquals(totalWaterIn, totalWaterOut, 1.0); - } /** diff --git a/src/test/java/neqsim/processSimulation/processEquipment/manifold/ManifoldTest.java b/src/test/java/neqsim/processSimulation/processEquipment/manifold/ManifoldTest.java index 451ff3d914..7266b0b2f3 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/manifold/ManifoldTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/manifold/ManifoldTest.java @@ -9,7 +9,6 @@ public class ManifoldTest { @Test void testRun() { - SystemSrkEos testSystem = new SystemSrkEos(298.0, 10.0); testSystem.addComponent("methane", 100.0); testSystem.addComponent("ethane", 10.0); @@ -46,7 +45,6 @@ void testRun() { @Test void testRun2() { - SystemSrkEos testSystem = new SystemSrkEos(298.0, 10.0); testSystem.addComponent("methane", 100.0); testSystem.addComponent("ethane", 10.0); @@ -88,8 +86,5 @@ void testRun2() { assertEquals(stream1FromManifold.getFluid().getComponent(0).getx(), manifold1.getSplitStream(0).getFluid().getComponent(0).getx(), 1e-6); assertEquals(5.0, manifold1.getMixedStream().getFlowRate("MSm3/day"), 0.01); - - - } } diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java index 68d9e917fa..88609b6ee8 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java @@ -45,7 +45,6 @@ public void testFlowVolumeCorrection() { @Test public void testPipeLineBeggsAndBrills() { - double pressure = 50; // bara double temperature = 40; // C double massFlowRate = 1100000.000000000; @@ -90,13 +89,10 @@ public void testPipeLineBeggsAndBrills() { Assertions.assertEquals(temperatureOut, 39.3374, 1); Assertions.assertEquals(pipe.getOutletSuperficialVelocity(), pipe.getSegmentMixtureSuperficialVelocity(pipe.getNumberOfIncrements()), 0.1); - } - @Test public void testPipeLineBeggsAndBrills2() { - double pressure = 50; // bara double temperature = 40; // C double massFlowRate = 110000.000000000; @@ -141,12 +137,10 @@ public void testPipeLineBeggsAndBrills2() { Assertions.assertEquals(pipe.getFlowRegime(), "INTERMITTENT"); Assertions.assertEquals(pipe.getOutletSuperficialVelocity(), pipe.getSegmentMixtureSuperficialVelocity(pipe.getNumberOfIncrements()), 0.1); - } @Test public void testPipeLineBeggsAndBrills3() { - double pressure = 50; // bara double temperature = 80; // C double massFlowRate = 110000.000000000; @@ -214,8 +208,6 @@ public void testPipeLineBeggsAndBrills3() { Assertions.assertEquals(pipe.getOutletStream().getTemperature() - 273.15, 80, 1.0); } - - @Test public void testPipeLineBeggsAndBrills4() { // One phase @@ -259,7 +251,6 @@ public void testPipeLineBeggsAndBrills4() { Assertions.assertEquals(temperatureOut, 75.0748, 1); Assertions.assertEquals(pressureOut, 124.04439, 1); - Assertions.assertEquals(pipe.getPressureDrop(), 25.955604559293917, 1.0); Assertions.assertEquals(pipe.getSegmentPressure(10), 124.04439544070608, 1.0); Assertions.assertEquals(pipe.getSegmentPressure(0), 150, 1.0); @@ -279,7 +270,6 @@ public void testPipeLineBeggsAndBrills4() { Assertions.assertEquals(pipe.getOutletSuperficialVelocity(), pipe.getSegmentMixtureSuperficialVelocity(pipe.getNumberOfIncrements()), 0.1); - neqsim.thermo.system.SystemInterface testSystem2 = new neqsim.thermo.system.SystemSrkEos( (273.15 + 45), ThermodynamicConstantsInterface.referencePressure); @@ -311,11 +301,8 @@ public void testPipeLineBeggsAndBrills4() { double pressureOut2 = pipe2.getOutletPressure(); - Assertions.assertEquals(pressureOut2, 238.8205556280226, 1); - - neqsim.thermo.system.SystemInterface testSystem3 = new neqsim.thermo.system.SystemSrkEos( (273.15 + 45), ThermodynamicConstantsInterface.referencePressure); @@ -358,9 +345,5 @@ public void testPipeLineBeggsAndBrills4() { Assertions.assertEquals(temperatureOut3, -11.04463, 1); Assertions.assertEquals(pressureOut3, 18.3429, 1); - - } - - } diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/PipelineTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/PipelineTest.java index 2511ca02a7..00a4dfae0b 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/PipelineTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/PipelineTest.java @@ -8,7 +8,6 @@ public class PipelineTest { @Test public void testMain() { - double flow = 60.0; double temperature = 20.0; double pressure = 200.0; diff --git a/src/test/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbineTest.java b/src/test/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbineTest.java index d5fe5667a6..1fd56cbc56 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbineTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbineTest.java @@ -54,7 +54,6 @@ void testRun() { @Test void testIdealAiFuelRatio() { - testSystem = new SystemSrkEos(298.15, 1.0); testSystem.addComponent("nitrogen", 1.0); testSystem.addComponent("CO2", 2.0); @@ -76,6 +75,5 @@ void testIdealAiFuelRatio() { gasturb.setInletStream(gasStream); double AFR = gasturb.calcIdealAirFuelRatio(); assertEquals(15.8430086719654, AFR, 0.0001); - } } diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java index 24a8688a47..7a652fec80 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java @@ -70,7 +70,6 @@ void testRun() { @Test void testSimplePumpCurve() { - neqsim.thermo.system.SystemInterface feedDecane = new neqsim.thermo.system.SystemSrkEos(273.15 + 20.0, 10.00); feedDecane.addComponent("n-pentane", 0.5, "kg/sec"); @@ -99,8 +98,5 @@ void testSimplePumpCurve() { pump1.run(); Assertions.assertEquals(7.274237081101, pump1.getOutletPressure(), 1e-5); - } - - } diff --git a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java index b78d3e4c68..58ea795fa6 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java @@ -10,7 +10,6 @@ public class WellFlowTest { @Test void testRun() { - neqsim.thermo.system.SystemInterface fluid1 = new neqsim.thermo.system.SystemPrEos(373.15, 100.0); fluid1.addComponent("water", 3.599); @@ -82,7 +81,6 @@ void testRunTransient() { chokeValve.setInletStream(pipeline.getOutletStream()); chokeValve.setOutletPressure(5.0, "bara"); - Adjuster adjuster = new Adjuster("adjuster"); adjuster.setTargetVariable(pipeline.getOutletStream(), "pressure", chokeValve.getOutletPressure(), "bara"); @@ -128,10 +126,8 @@ void testRunTransient() { * System.out.println("gas velocity " + pipeline.getInletSuperficialVelocity()); */ } - } - @Test void testCalcWellFlow() { neqsim.thermo.system.SystemInterface fluid1 = @@ -157,6 +153,4 @@ void testCalcWellFlow() { // wellflow.setDarcyLawParameters(permeability, ); // wellflow.setWellProductionIndex(10.000100751427403E-3); } - - } diff --git a/src/test/java/neqsim/processSimulation/processEquipment/util/AdjusterTest.java b/src/test/java/neqsim/processSimulation/processEquipment/util/AdjusterTest.java index 9ca1412631..ea5983556d 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/util/AdjusterTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/util/AdjusterTest.java @@ -6,7 +6,6 @@ public class AdjusterTest { @Test void testRun() { - double wellheadpressure = 120.0; double bottomholepressure = 200.0; @@ -27,7 +26,6 @@ void testRun() { flowline1.setElevation(1200.0); flowline1.setNumberOfIncrements(20); - neqsim.processSimulation.processEquipment.util.Adjuster adjuster = new neqsim.processSimulation.processEquipment.util.Adjuster("adjuster"); adjuster.setTargetVariable(flowline1.getOutletStream(), "pressure", wellheadpressure, "bara"); @@ -47,11 +45,8 @@ void testRun() { assertEquals(flowline1.getOutletStream().getFlowRate("MSm3/day"), 4.0, 0.1); } - - @Test void testRun2() { - double wellheadpressure = 120.0; double bottomholepressure = 200.0; @@ -72,7 +67,6 @@ void testRun2() { flowline1.setElevation(1200.0); flowline1.setNumberOfIncrements(20); - neqsim.processSimulation.processEquipment.util.Adjuster adjuster = new neqsim.processSimulation.processEquipment.util.Adjuster("adjuster"); adjuster.setTargetVariable(flowline1.getOutletStream(), "pressure", wellheadpressure, "bara"); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java b/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java index e101f2e17b..51f5388b63 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/util/FlowSetterTest.java @@ -55,7 +55,6 @@ void testMain() { @Test void testProcessWithFlowSetter() { - double gasFlow = 10.0; // MSm3/day double oilFlow = 2000.0; // m3/hr double waterFLow = 1000.0; // m3/hr @@ -90,7 +89,6 @@ void testProcessWithFlowSetter() { StreamInterface gasFromSepStream = separator.getGasOutStream(); - neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem(); operations.add(stream_1); @@ -104,7 +102,6 @@ void testProcessWithFlowSetter() { @Test void testProcessWithFlowSetter2() { - double gasFlow = 10.0; // MSm3/day double oilFlow = 2000.0; // m3/hr double waterFlow = 1000.0; // m3/hr @@ -137,7 +134,6 @@ void testProcessWithFlowSetter2() { flowset.setWaterFlowRate(waterFlow, "m3/hr"); flowset.run(); - assertEquals(gasFlow, ((StreamInterface) flowset.getReferenceProcess().getUnit("gas")).getFlowRate("MSm3/day"), 0.01); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/util/StreamSaturatorUtilTest.java b/src/test/java/neqsim/processSimulation/processEquipment/util/StreamSaturatorUtilTest.java index 546cdd7194..0d8ec34ce3 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/util/StreamSaturatorUtilTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/util/StreamSaturatorUtilTest.java @@ -36,7 +36,6 @@ void testRun() { assertEquals(0.0012319218375683974, streamSaturator.getOutletStream().getFluid().getPhase(0).getComponent("water").getx(), 1e-16); - } @Test diff --git a/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java b/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java index 83fdd52863..bd98c77877 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java +++ b/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java @@ -56,7 +56,6 @@ public void testProcess() { 0.050908, 0.007751, 0.014665, 0.004249, 0.004878, 0.004541, 0.007189, 0.006904, 0.004355, 0.007658, 0.003861, 0.003301, 0.002624, 0.001857, 0.001320, 0.001426, 0.001164, 0.000916}); - Stream feedStream = new Stream("feed stream", thermoSystem); feedStream.setFlowRate(604094, "kg/hr"); feedStream.setTemperature(25.5, "C"); @@ -110,7 +109,6 @@ public void testProcess() { recycle2.addStream(recycleValve.getOutletStream()); recycle2.setOutletStream(gasResycleStream); - Recycle recycle1 = new Recycle("recycle 1"); recycle1.addStream(scrubber1.getLiquidOutStream()); recycle1.setOutletStream(resycleScrubberStream); diff --git a/src/test/java/neqsim/processSimulation/processSystem/GlycolModulesTest.java b/src/test/java/neqsim/processSimulation/processSystem/GlycolModulesTest.java index d9eae237bb..d5223d0bfd 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/GlycolModulesTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/GlycolModulesTest.java @@ -104,7 +104,6 @@ public void runProcessTEG() throws InterruptedException { double[] splitSmøbukk = {0.9999999999, 1e-10}; SmøbukkSplit.setSplitFactors(splitSmøbukk); - Stream dryFeedGasMidgard = new Stream("dry feed gas Midgard201", feedGas.clone()); dryFeedGasMidgard.setFlowRate(13.943929595435336, "MSm3/day"); dryFeedGasMidgard.setTemperature(8.617179027757128, "C"); @@ -124,7 +123,6 @@ public void runProcessTEG() throws InterruptedException { double[] splitMidgard = {0.11245704038738272, 0.8875429596126173}; MidgardSplit.setSplitFactors(splitMidgard); - StaticMixer TrainA = new StaticMixer("mixer TrainA"); TrainA.addStream(MidgardSplit.getSplitStream(0)); TrainA.addStream(SmøbukkSplit.getSplitStream(0)); @@ -231,7 +229,6 @@ public void runProcessTEG() throws InterruptedException { strippingGas.setTemperature(185.4402968739743, "C"); strippingGas.setPressure(1.1714901511485545, "bara"); - Stream gasToReboiler = (Stream) (strippingGas).clone(); gasToReboiler.setName("gas to reboiler"); @@ -264,11 +261,9 @@ public void runProcessTEG() throws InterruptedException { strippingFlareGasTPsetter.setOutPressure(1.1714901511485545, "bara"); strippingFlareGasTPsetter.setOutTemperature(185.4402968739743, "C"); - Stream liquidToTrreatment = new Stream(sepregenGas.getLiquidOutStream()); liquidToTrreatment.setName("water to treatment"); - WaterStripperColumn stripper = new WaterStripperColumn("TEG stripper"); stripper.addSolventInStream(column.getLiquidOutStream()); stripper.addGasInStream(strippingGas); @@ -287,7 +282,6 @@ public void runProcessTEG() throws InterruptedException { recycleFlareGas.setPriority(1000); // recycleFlareGas.setTolerance(0.1); - neqsim.thermo.system.SystemInterface pureTEG = (neqsim.thermo.system.SystemInterface) feedGas.clone(); pureTEG.setMolarComposition(new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, @@ -309,7 +303,6 @@ public void runProcessTEG() throws InterruptedException { makeupMixer.addStream(stripper.getLiquidOutStream()); makeupMixer.addStream(makeupTEG); - Pump hotLeanTEGPump = new Pump(makeupMixer.getOutStream()); hotLeanTEGPump.setName("lean TEG LP pump"); hotLeanTEGPump.setOutletPressure(39.67967207899729); @@ -330,7 +323,6 @@ public void runProcessTEG() throws InterruptedException { resycleLeanTEG.setPriority(200); resycleLeanTEG.setDownstreamProperty("flow rate"); - neqsim.processSimulation.processSystem.ProcessSystem operations1 = new neqsim.processSimulation.processSystem.ProcessSystem(); operations1.add(dryFeedGasSmøbukk); @@ -400,8 +392,6 @@ public void runProcessTEG() throws InterruptedException { operations5.add(waterDewPointAnalyser); operations5.add(waterDewPointAnalyser2); - - neqsim.processSimulation.processSystem.ProcessModule module1 = new neqsim.processSimulation.processSystem.ProcessModule("Start process"); module1.add(operations1); @@ -421,7 +411,6 @@ public void runProcessTEG() throws InterruptedException { new neqsim.processSimulation.processSystem.ProcessModule("Finish Process"); module4.add(operations5); - neqsim.processSimulation.processSystem.ProcessModule modules = new neqsim.processSimulation.processSystem.ProcessModule("Modules wrapper"); modules.add(module1); diff --git a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java index d95e1209b5..019931598b 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java +++ b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java @@ -342,7 +342,6 @@ public void runProcessTEG() throws InterruptedException { richGLycolHeaterCondenser.setEnergyStream(column.getCondenser().getEnergyStream()); - Thread runThr = p.runAsThread(); try { runThr.join(100000); diff --git a/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java b/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java index 4c11b6c944..d8cf896156 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java @@ -80,8 +80,6 @@ public void runProcess() throws InterruptedException { seprator3rdStage.addStream(valve2.getOutletStream()); seprator3rdStage.addStream(recircstream1); - - ThrottlingValve pipeloss1st = new ThrottlingValve("pipeloss1st", seprator3rdStage.getGasOutStream()); pipeloss1st.setOutletPressure(2.7 - 0.03); @@ -127,6 +125,5 @@ public void runProcess() throws InterruptedException { // System.out.println("recycle flow " + recycle1.getOutletStream().getFlowRate("kg/hr")); // valveLP1.getOutletStream().getFluid().prettyPrint(); - } } diff --git a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java index 255b9028cf..05453e0546 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java @@ -392,8 +392,6 @@ public void testDynamicCompressor22() { */ assertEquals(100.0, compressor1.getOutletStream().getPressure(), 0.01); - - // System.out.println("steady state with compressor curves....."); neqsim.processSimulation.processEquipment.compressor.CompressorChartGenerator compchartgenerator = new neqsim.processSimulation.processEquipment.compressor.CompressorChartGenerator( @@ -436,7 +434,6 @@ public void testDynamicCompressor22() { * " pres inn " + compressor1.getInletStream().getPressure() + " pres out " + * compressor1.getOutletStream().getPressure()); */ - } @Test @@ -483,7 +480,6 @@ public void testDynamicCompressorSpeedControl() { PressureTransmitter separatorPressureTransmitter = new PressureTransmitter(separator2.getGasOutStream()); - ControllerDeviceInterface speedController = new ControllerDeviceBaseClass(); speedController.setReverseActing(true); speedController.setTransmitter(separatorPressureTransmitter); @@ -499,8 +495,6 @@ public void testDynamicCompressorSpeedControl() { p.add(valve2); compressor1.setController(speedController); - - p.run(); /* * System.out.println(" speed " + compressor1.getSpeed() + "feed flow " + @@ -728,7 +722,6 @@ public void testAntiSurgeControl() { p.runTransient(); } - valve1.setPercentValveOpening(1.0); valve2.setPercentValveOpening(1.0); @@ -778,5 +771,4 @@ public void testAntiSurgeControl() { p.runTransient(); } } - } diff --git a/src/test/java/neqsim/thermo/characterization/CharacteriseTest.java b/src/test/java/neqsim/thermo/characterization/CharacteriseTest.java index db7e836147..a7c5f9bf0b 100644 --- a/src/test/java/neqsim/thermo/characterization/CharacteriseTest.java +++ b/src/test/java/neqsim/thermo/characterization/CharacteriseTest.java @@ -5,7 +5,7 @@ import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; -public class CharacteriseTest extends neqsim.NeqSimTest{ +public class CharacteriseTest extends neqsim.NeqSimTest { static SystemInterface thermoSystem = null; @Test @@ -18,7 +18,7 @@ void testCharacterisePlusFraction() { thermoSystem.addTBPfraction("C7", 1.0, 110.0 / 1000.0, 0.73); thermoSystem.addTBPfraction("C8", 1.0, 120.0 / 1000.0, 0.76); thermoSystem.addTBPfraction("C9", 1.0, 140.0 / 1000.0, 0.79); - thermoSystem.addPlusFraction("C10", 11.0, 290.0/1000.0, 0.82); + thermoSystem.addPlusFraction("C10", 11.0, 290.0 / 1000.0, 0.82); thermoSystem.getCharacterization().setLumpingModel("no lumping"); thermoSystem.getCharacterization().characterisePlusFraction(); // logger.info("number of components " + thermoSystem.getNumberOfComponents()); @@ -32,11 +32,10 @@ void testCharacterisePlusFraction() { thermoSystem.addTBPfraction("C7", 1.0, 110.0 / 1000.0, 0.73); thermoSystem.addTBPfraction("C8", 1.0, 120.0 / 1000.0, 0.76); thermoSystem.addTBPfraction("C9", 1.0, 140.0 / 1000.0, 0.79); - thermoSystem.addPlusFraction("C10", 11.0, 290.0/1000.0, 0.82); + thermoSystem.addPlusFraction("C10", 11.0, 290.0 / 1000.0, 0.82); thermoSystem.getCharacterization().getLumpingModel().setNumberOfPseudoComponents(12); thermoSystem.getCharacterization().setLumpingModel("PVTlumpingModel"); thermoSystem.getCharacterization().characterisePlusFraction(); assertEquals(15, thermoSystem.getNumberOfComponents()); - } } diff --git a/src/test/java/neqsim/thermo/system/SystemPrEosTest.java b/src/test/java/neqsim/thermo/system/SystemPrEosTest.java index bab6ad75fa..585b491570 100644 --- a/src/test/java/neqsim/thermo/system/SystemPrEosTest.java +++ b/src/test/java/neqsim/thermo/system/SystemPrEosTest.java @@ -54,8 +54,6 @@ public void testMolarVolume() { testSystem.getMolarMass("kg/mol") / testSystem.getDensity("kg/m3")); } - - /** *
* testTPflash2.
diff --git a/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java b/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java
index 96925abf07..d545100170 100644
--- a/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java
+++ b/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java
@@ -270,6 +270,5 @@ public void checkPhaseEnvelope2() throws Exception {
SaturationPressure satPresSim = new SaturationPressure(testSystem);
satPresSim.run();
assertEquals(satPresSim.getThermoSystem().getPressure(), 104.7532, 0.001);
-
}
}
diff --git a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java
index 8716c19e8c..f81e9baf61 100644
--- a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java
+++ b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java
@@ -66,8 +66,6 @@ void testReadAndAddFluids2() throws IOException {
// neqsim.thermo.util.readwrite.TablePrinter.printTable((((PhaseEos
// )testSystem.getPhase(0)).getMixingRule().getBinaryInteractionParameters()));
-
-
}
@Test
diff --git a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
index f59bf01c9b..d4dde8beb7 100644
--- a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
@@ -439,7 +439,6 @@ public CalculationResult getOutput() throws IOException {
for (int kProp = 0; kProp < calcresult.get(kSample).size(); kProp++) {
try {
calcResult[kSample][kProp] = calcresult.get(kSample).get(kProp);
-
} catch (Exception e) {
calcResult[kSample][kProp] = Double.NaN;
}
diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java
index e0d040f75f..a2d7521321 100644
--- a/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java
+++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java
@@ -87,19 +87,16 @@ void testRun() {
String[] componentNames = fluid1.getComponentNames();
for (int i = 0; i < intParameter.length; i++) {
-
int componentIndex = findComponentIndex(componentNames, componentNames[i + 1]);// except
// nitrogen 0
int waterIndex = findComponentIndex(componentNames, "water");
if (componentIndex != -1 && waterIndex != -1) {
-
((PhaseEosInterface) fluid1.getPhases()[0]).getMixingRule()
.setBinaryInteractionParameter(componentIndex, waterIndex, intParameter[i]);
((PhaseEosInterface) fluid1.getPhases()[1]).getMixingRule()
.setBinaryInteractionParameter(componentIndex, waterIndex, intParameter[i]);
-
} else {
}
}
@@ -161,25 +158,19 @@ void testRun() {
System.out.println("Gas out from degasser2 " + heater_TP_setter_test_stream2.getOutStream()
.getFluid().getPhase("gas").getFlowRate("kg/hr"));
-
}
private int findComponentIndex(String[] componentNames, String componentName) {
-
for (int i = 0; i < componentNames.length; i++) {
if (componentNames[i].equals(componentName)) {
-
return i;
-
}
}
return -1; // Component not found
-
}
-
/**
* Test method for
*/
diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java
index fcff3e2630..83590e1678 100644
--- a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java
@@ -168,6 +168,5 @@ void testTPflash1() {
testOps.TPflash();
assertEquals(2, testSystem.getNumberOfPhases());
// testSystem.prettyPrint();
-
}
}
diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/VUFlashTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/VUFlashTest.java
index 1cf0cd3216..6a09ad7d7e 100644
--- a/src/test/java/neqsim/thermodynamicOperations/flashOps/VUFlashTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/VUFlashTest.java
@@ -23,9 +23,7 @@ class VUFlashTest {
* @throws java.lang.Exception
*/
@BeforeEach
- void setUp() throws Exception {
-
- }
+ void setUp() throws Exception {}
@Test
void testVUflash() {
@@ -45,5 +43,4 @@ void testVUflash() {
assertEquals(21.387, testSystem.getPressure(), 0.01);
}
-
}
diff --git a/src/test/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/PTphaseEnvelopeTest.java b/src/test/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/PTphaseEnvelopeTest.java
index 190af0c597..34c40e0ab4 100644
--- a/src/test/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/PTphaseEnvelopeTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/PTphaseEnvelopeTest.java
@@ -1,70 +1,65 @@
package neqsim.thermodynamicOperations.phaseEnvelopeOps.multicomponentEnvelopeOps;
-import neqsim.thermodynamicOperations.ThermodynamicOperations;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import java.util.Arrays;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-
-import static org.junit.jupiter.api.Assertions.*;
+import neqsim.thermodynamicOperations.ThermodynamicOperations;
class PTPhaseEnvelopeTest {
- static neqsim.thermo.system.SystemInterface testSystem = null;
- static ThermodynamicOperations testOps = null;
-
- @BeforeEach
- void setUp() {
- testSystem = new neqsim.thermo.system.SystemSrkEos(298.0, 50.0);
- }
-
- /**
- * Test method for {@link neqsim.thermodynamicOperations.phaseEnvelopeOps.multicomponentEnvelopeOps.pTphaseEnvelope}.
- */
- @Test
- void testDewP() {
- testSystem.addComponent("nitrogen", 0.01);
- testSystem.addComponent("CO2", 0.01);
- testSystem.addComponent("methane", 0.98);
- testSystem.setMixingRule("classic");
-
- testOps = new ThermodynamicOperations(testSystem);
- testOps.TPflash();
- testSystem.initProperties();
- testOps.calcPTphaseEnvelope();
- double[] dewPointPressures = testOps.get("dewP");
- double[] expectedDewPointPressures =
- new double[]{
- 1.1051709180756477, 1.2214027581601699, 1.3498588075760032, 1.4918246976412703,
- 1.6652911949458864, 1.8794891289619104, 2.1418131227502055, 2.4690864123141987,
- 2.881197018974799, 3.404779997613969, 4.075230307874481, 4.938583914869986, 6.051801019586486,
- 7.477304695462727, 9.260793952051571, 11.364101185282063, 13.480106047577934, 14.53423776629387,
- 13.607498029406681, 11.181207439509638, 9.189487040488075, 9.612827246459474,
- 10.706126846063928, 12.501491987760147, 15.075672692089958, 18.51283799420178,
- 23.330378296334104, 29.71319711031059, 37.25532259549197, 43.660805656603934, 45.75836660678656,
- 46.42490219574348, 46.83203503669948, 46.869568345957006, 46.903557772489435
- };
- System.out.println(Arrays.toString(dewPointPressures));
- assertArrayEquals(expectedDewPointPressures, dewPointPressures, 10E-10);
-
- }
-
- @Test
- void testFailingCaseWithWater() {
- testSystem.addComponent("nitrogen", 0.04);
- testSystem.addComponent("CO2", 0.06);
- testSystem.addComponent("methane", 0.80);
- testSystem.addComponent("water", 0.00000000001);
-
- testSystem.setMixingRule("classic");
-
- testOps = new ThermodynamicOperations(testSystem);
- testOps.TPflash();
- testSystem.initProperties();
-
-
- Exception exception = assertThrows(ArrayIndexOutOfBoundsException.class, () -> testOps.calcPTphaseEnvelope());
-
- }
-
-
+ static neqsim.thermo.system.SystemInterface testSystem = null;
+ static ThermodynamicOperations testOps = null;
+
+ @BeforeEach
+ void setUp() {
+ testSystem = new neqsim.thermo.system.SystemSrkEos(298.0, 50.0);
+ }
+
+ /**
+ * Test method for
+ * {@link neqsim.thermodynamicOperations.phaseEnvelopeOps.multicomponentEnvelopeOps.pTphaseEnvelope}.
+ */
+ @Test
+ void testDewP() {
+ testSystem.addComponent("nitrogen", 0.01);
+ testSystem.addComponent("CO2", 0.01);
+ testSystem.addComponent("methane", 0.98);
+ testSystem.setMixingRule("classic");
+
+ testOps = new ThermodynamicOperations(testSystem);
+ testOps.TPflash();
+ testSystem.initProperties();
+ testOps.calcPTphaseEnvelope();
+ double[] dewPointPressures = testOps.get("dewP");
+ double[] expectedDewPointPressures =
+ new double[] {1.1051709180756477, 1.2214027581601699, 1.3498588075760032,
+ 1.4918246976412703, 1.6652911949458864, 1.8794891289619104, 2.1418131227502055,
+ 2.4690864123141987, 2.881197018974799, 3.404779997613969, 4.075230307874481,
+ 4.938583914869986, 6.051801019586486, 7.477304695462727, 9.260793952051571,
+ 11.364101185282063, 13.480106047577934, 14.53423776629387, 13.607498029406681,
+ 11.181207439509638, 9.189487040488075, 9.612827246459474, 10.706126846063928,
+ 12.501491987760147, 15.075672692089958, 18.51283799420178, 23.330378296334104,
+ 29.71319711031059, 37.25532259549197, 43.660805656603934, 45.75836660678656,
+ 46.42490219574348, 46.83203503669948, 46.869568345957006, 46.903557772489435};
+ System.out.println(Arrays.toString(dewPointPressures));
+ assertArrayEquals(expectedDewPointPressures, dewPointPressures, 10E-10);
+ }
+
+ @Test
+ void testFailingCaseWithWater() {
+ testSystem.addComponent("nitrogen", 0.04);
+ testSystem.addComponent("CO2", 0.06);
+ testSystem.addComponent("methane", 0.80);
+ testSystem.addComponent("water", 0.00000000001);
+
+ testSystem.setMixingRule("classic");
+
+ testOps = new ThermodynamicOperations(testSystem);
+ testOps.TPflash();
+ testSystem.initProperties();
+
+ Exception exception =
+ assertThrows(ArrayIndexOutOfBoundsException.class, () -> testOps.calcPTphaseEnvelope());
+ }
}
diff --git a/src/test/java/neqsim/util/database/NeqSimContractDataBaseTest.java b/src/test/java/neqsim/util/database/NeqSimContractDataBaseTest.java
index 19c98804ca..041ae78ba1 100644
--- a/src/test/java/neqsim/util/database/NeqSimContractDataBaseTest.java
+++ b/src/test/java/neqsim/util/database/NeqSimContractDataBaseTest.java
@@ -4,12 +4,8 @@
public class NeqSimContractDataBaseTest {
@Test
- void testInitH2DatabaseFromCSVfiles() {
-
- }
+ void testInitH2DatabaseFromCSVfiles() {}
@Test
- void testUpdateTable() {
-
- }
+ void testUpdateTable() {}
}
diff --git a/src/test/java/neqsim/util/generator/PropertyGeneratorTest.java b/src/test/java/neqsim/util/generator/PropertyGeneratorTest.java
index ecf4828481..94a1cd0f81 100644
--- a/src/test/java/neqsim/util/generator/PropertyGeneratorTest.java
+++ b/src/test/java/neqsim/util/generator/PropertyGeneratorTest.java
@@ -7,7 +7,6 @@
public class PropertyGeneratorTest {
@Test
void testCalculate() {
-
SystemInterface fluid = new SystemSrkEos(273.15 + 45.0, 22.0);
fluid.addComponent("water", 0.1);
fluid.addComponent("nitrogen", 0.02);
@@ -30,7 +29,5 @@ void testCalculate() {
double[] pres = new double[] {10.0, 20.0};
PropertyGenerator generator = new PropertyGenerator(fluid, temps, pres);
generator.calculate();
-
-
}
}
From 7314786b035105f23e853933a9328691c72c6733 Mon Sep 17 00:00:00 2001
From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com>
Date: Thu, 22 Feb 2024 16:13:13 +0100
Subject: [PATCH 102/317] release 2.5.18 (#925)
---
pom.xml | 2 +-
pomJava21.xml | 2 +-
pomJava8.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index f5533a2054..8169caa20c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
@@ -364,12 +362,12 @@ public void run() { // Checks if gas or oil is the most stable phase double gasgib = system.getPhase(0).getGibbsEnergy(); - system.setPhaseType(0, 0); + system.setPhaseType(0, PhaseType.byValue(0)); system.init(1, 0); double liqgib = system.getPhase(0).getGibbsEnergy(); if (gasgib * (1.0 - Math.signum(gasgib) * 1e-8) < liqgib) { - system.setPhaseType(0, 1); + system.setPhaseType(0, PhaseType.byValue(1)); } system.init(1); @@ -461,18 +459,18 @@ public void run() { // Checks if gas or oil is the most stable phase if (system.getPhase(0).getType() == PhaseType.GAS) { gasgib = system.getPhase(0).getGibbsEnergy(); - system.setPhaseType(0, 0); + system.setPhaseType(0, PhaseType.byValue(0)); system.init(1, 0); liqgib = system.getPhase(0).getGibbsEnergy(); } else { liqgib = system.getPhase(0).getGibbsEnergy(); - system.setPhaseType(0, 1); + system.setPhaseType(0, PhaseType.byValue(1)); system.init(1, 0); gasgib = system.getPhase(0).getGibbsEnergy(); } if (gasgib * (1.0 - Math.signum(gasgib) * 1e-8) < liqgib) { - system.setPhaseType(0, 1); + system.setPhaseType(0, PhaseType.byValue(1)); } system.init(1); diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FreezeOut.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FreezeOut.java index 32827b182f..dc0c4aea58 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FreezeOut.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FreezeOut.java @@ -6,6 +6,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.thermo.ThermodynamicConstantsInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkSchwartzentruberEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -83,7 +84,7 @@ public void run() { SystemInterface testSystem2 = new SystemSrkSchwartzentruberEos(216, 1); ThermodynamicOperations testOps2 = new ThermodynamicOperations(testSystem2); testSystem2.addComponent(testSystem.getPhase(0).getComponent(k).getComponentName(), 1); - testSystem2.setPhaseType(0, 1); + testSystem2.setPhaseType(0, PhaseType.byValue(1)); noFreezeliq = true; SolidFug = 0.0; FluidFug = 0.0; diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FugTestConstP.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FugTestConstP.java index 9bca127769..98676e2491 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FugTestConstP.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/FugTestConstP.java @@ -4,6 +4,7 @@ import org.apache.logging.log4j.Logger; import neqsim.dataPresentation.JFreeChart.graph2b; import neqsim.thermo.ThermodynamicConstantsInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkSchwartzentruberEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -69,7 +70,7 @@ public FugTestConstP(SystemInterface system, double pres) { public void initTestSystem2(int K) { this.testSystem2 = new SystemSrkSchwartzentruberEos(temp, pres); this.testSystem2.addComponent(compName, 1); - this.testSystem2.setPhaseType(0, 1); + this.testSystem2.setPhaseType(0, PhaseType.byValue(1)); this.testOps2 = new ThermodynamicOperations(testSystem2); } diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGenerator.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGenerator.java index 89bff51de1..c6cc760de7 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGenerator.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGenerator.java @@ -7,6 +7,7 @@ import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -161,8 +162,8 @@ public void run() { } if (!thermoSystem.hasPhaseType("gas")) { - // TODO: here is a bug, calling with input oil does nothing. - thermoSystem.setPhaseType("oil", 1); + thermoSystem.setPhaseType(thermoSystem.getPhaseNumberOfPhase(PhaseType.OIL), + PhaseType.byValue(1)); thermoSystem.init(3); thermoSystem.initPhysicalProperties(); @@ -171,8 +172,8 @@ public void run() { } if (!thermoSystem.hasPhaseType("oil")) { - // TODO: here is a bug, calling with input gas does nothing. - thermoSystem.setPhaseType("gas", 1); + thermoSystem.setPhaseType(thermoSystem.getPhaseNumberOfPhase(PhaseType.GAS), + PhaseType.byValue(1)); thermoSystem.init(3); thermoSystem.initPhysicalProperties(); @@ -181,7 +182,7 @@ public void run() { } if (!thermoSystem.hasPhaseType("aqueous")) { - thermoSystem.setPhaseType(1, 1); + thermoSystem.setPhaseType(1, PhaseType.byValue(1)); thermoSystem.init(3); thermoSystem.initPhysicalProperties(); diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java index 01591076ef..f93e59eec9 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java @@ -11,6 +11,7 @@ import org.apache.logging.log4j.Logger; import Jama.Matrix; import neqsim.thermo.ThermodynamicConstantsInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -573,7 +574,7 @@ public void run() { } while (k < 17); // names[k] = "GAS DENSITY"; // units[k] = "KG/M3"; } else { - oilSystem.setPhaseType(0, 0); + oilSystem.setPhaseType(0, PhaseType.byValue(0)); oilSystem.setTemperature(temperatures[j]); oilSystem.setPressure(pressures[i]); oilSystem.init(3); @@ -711,7 +712,7 @@ public void run() { } else { waterSystem.setTemperature(temperatures[j]); waterSystem.setPressure(pressures[i]); - waterSystem.setPhaseType(0, 0); + waterSystem.setPhaseType(0, PhaseType.byValue(0)); waterSystem.init(3); waterSystem.initPhysicalProperties(); diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java index 7286025174..d636e59476 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java @@ -9,6 +9,7 @@ import org.apache.logging.log4j.Logger; import Jama.Matrix; import neqsim.thermo.ThermodynamicConstantsInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -731,7 +732,7 @@ public void run() { } while (k < 17); // names[k] = "GAS DENSITY"; // units[k] = "KG/M3"; } else { - oilSystem.setPhaseType(0, 0); + oilSystem.setPhaseType(0, PhaseType.byValue(0)); oilSystem.setTemperature(temperatures[j]); oilSystem.setPressure(pressures[i]); oilSystem.init(3); @@ -931,7 +932,7 @@ public void run() { } else { waterSystem.setTemperature(temperatures[j]); waterSystem.setPressure(pressures[i]); - waterSystem.setPhaseType(0, 0); + waterSystem.setPhaseType(0, PhaseType.byValue(0)); waterSystem.init(3); waterSystem.initPhysicalProperties(); diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java index bffa4a432d..8d4bc0ee34 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java @@ -9,6 +9,7 @@ import org.apache.logging.log4j.Logger; import Jama.Matrix; import neqsim.thermo.ThermodynamicConstantsInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -730,7 +731,7 @@ public void run() { } while (k < 17); // names[k] = "GAS DENSITY"; // units[k] = "KG/M3"; } else { - oilSystem.setPhaseType(0, 0); + oilSystem.setPhaseType(0, PhaseType.byValue(0)); // oilSystem.setTemperature(enthalpies[j]); oilSystem.setPressure(pressures[i]); oilSystem.init(3); @@ -924,7 +925,7 @@ public void run() { } else { waterSystem.setTemperature(enthalpies[j]); waterSystem.setPressure(pressures[i]); - waterSystem.setPhaseType(0, 0); + waterSystem.setPhaseType(0, PhaseType.byValue(0)); waterSystem.init(3); waterSystem.initPhysicalProperties(); diff --git a/src/test/java/neqsim/thermo/util/example/TPMultiFlash.java b/src/test/java/neqsim/thermo/util/example/TPMultiFlash.java index bf1b40f010..f51bdfa325 100644 --- a/src/test/java/neqsim/thermo/util/example/TPMultiFlash.java +++ b/src/test/java/neqsim/thermo/util/example/TPMultiFlash.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -98,7 +99,7 @@ public static void main(String[] args) { phase = 1; } - testSystem.setPhaseType(0, phase); + testSystem.setPhaseType(0, PhaseType.byValue(phase)); testSystem.init(2, 0); testSystem.initPhysicalProperties(); } diff --git a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java index 70bd2bf68a..01447b327f 100644 --- a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java +++ b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java @@ -91,7 +91,7 @@ public static void main(String[] args) { * * testSystem.initPhysicalProperties(); testSystem.init(1); * - * System.out.println("start....."); testSystem.removeMoles(); + * System.out.println("start....."); testSystem.setEmptyFluid(); * testSystem.setMolarComposition(new double[]{1.0, 1e-20, 1e-20}); testSystem.init(0, 0); * testSystem.init(1); testSystem.display(); * From 909e7fc11268a5f0bd3c197effe3e461cd2b3ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:56:58 +0100 Subject: [PATCH 104/317] rm: setPhaseType(int phaseToChange, String phaseTypeName) --- .../neqsim/thermo/system/SystemThermo.java | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index e731521961..717405528f 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -26,7 +26,6 @@ import neqsim.thermo.phase.PhaseSolidComplex; import neqsim.thermo.phase.PhaseType; import neqsim.thermo.phase.PhaseWax; -import neqsim.thermo.phase.StateOfMatter; import neqsim.util.database.NeqSimDataBase; import neqsim.util.exception.InvalidInputException; @@ -2967,21 +2966,6 @@ public void setPhaseType(int phaseToChange, PhaseType pt) { } } - /** {@inheritDoc} */ - public void setPhaseType(int phaseToChange, String phaseTypeName) { - // System.out.println("new phase type: cha " + newPhaseType); - int newPhaseType = 0; - if (phaseTypeName.equals("gas")) { - newPhaseType = 1; - } else if (StateOfMatter.isLiquid(PhaseType.byDesc(phaseTypeName))) { - newPhaseType = 0; - } else { - newPhaseType = 0; - } - - setPhaseType(phaseToChange, PhaseType.byValue(newPhaseType)); - } - /** {@inheritDoc} */ @Override public void setAllPhaseType(PhaseType pt) { @@ -2995,6 +2979,14 @@ public void setAllPhaseType(PhaseType pt) { /** {@inheritDoc} */ @Override public void invertPhaseTypes() { + // Following code was from public void setPhaseType(int phaseToChange, String phaseTypeName) { + + /* + * int newPhaseType = 0; if (phaseTypeName.equals("gas")) { newPhaseType = 1; } else if + * (StateOfMatter.isLiquid(PhaseType.byDesc(phaseTypeName))) { newPhaseType = 0; } else { + * newPhaseType = 0; } + */ + for (int i = 0; i < getMaxNumberOfPhases(); i++) { if (phaseType[i] == PhaseType.byValue(0)) { phaseType[i] = PhaseType.byValue(1); From dcf8d1babcf5160ed627253958fd862b26319954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:57:20 +0100 Subject: [PATCH 105/317] refact: rm getPhaseType and setPhaseType(int phaseType) --- .../neqsim/thermo/phase/PhaseInterface.java | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index ba7afc9f67..5e5d290938 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -1921,32 +1921,6 @@ public void setParams(PhaseInterface phase, double[][] alpha, double[][] Dij, do */ public void setType(PhaseType pt); - /** - *
- * Getter for property phasetype as int. - *
- * - * @return a int - * @deprecated Replace with {@link getType} - */ - @Deprecated - public default int getPhaseType() { - return getType().getValue(); - } - - /** - *- * Setter for property phaseType. - *
- * - * @param phaseType Phasetype as int. - * @deprecated Replace with {@link setType} - */ - @Deprecated - public default void setPhaseType(int phaseType) { - setType(PhaseType.byValue(phaseType)); - } - /** ** Getter for property phaseTypeName. From 2689d9a85adcacc3ac359049dc8d5eb2cfbc5195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:33:05 +0100 Subject: [PATCH 106/317] refact: remove deprecated functions --- .../ChemicalReactionOperations.java | 13 ---- .../chemicalReaction/ChemicalReaction.java | 14 ----- .../solidAdsorption/AdsorptionInterface.java | 27 -------- .../measurementDevice/pHProbe.java | 26 -------- .../salesContract/ContractSpecification.java | 8 ++- .../characterization/PlusCharacterize.java | 15 +---- .../thermo/component/ComponentInterface.java | 28 +-------- src/main/java/neqsim/thermo/phase/Phase.java | 26 -------- .../neqsim/thermo/phase/PhaseGEInterface.java | 19 ------ .../neqsim/thermo/phase/PhaseInterface.java | 62 ------------------- .../neqsim/thermo/system/SystemInterface.java | 39 ------------ .../neqsim/thermo/system/SystemThermo.java | 38 +----------- .../thermo/util/example/TestUniSimsFlash.java | 4 +- 13 files changed, 12 insertions(+), 307 deletions(-) diff --git a/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java b/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java index ba4f589a80..f455b2b5d4 100644 --- a/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java +++ b/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java @@ -278,19 +278,6 @@ public String[] getAllElements() { return elementList; } - /** - *
- * hasRections. - *
- * - * @return a boolean - * @deprecated Replaced by hasReactions() - */ - @Deprecated - public boolean hasRections() { - return this.hasReactions(); - } - /** ** hasRections. diff --git a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java index b5f30f691d..48a94585ce 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java @@ -40,20 +40,6 @@ public class ChemicalReaction extends NamedBaseClass double lnK = 0; int numberOfReactants = 0; - /** - *
- * Constructor for ChemicalReaction. - *
- * - * @deprecated use - * {@link #ChemicalReaction(String, String[], double[], double[], double, double, double)} - * instead - */ - @Deprecated - public ChemicalReaction() { - super("ChemicalReaction"); - } - /** ** Constructor for ChemicalReaction. diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java index 1af1b9638a..ba9d15bdfa 100644 --- a/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java +++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java @@ -18,19 +18,6 @@ public interface AdsorptionInterface extends neqsim.thermo.ThermodynamicConstant */ public void calcAdsorption(int phase); - /** - *
- * calcAdsorption. - *
- * - * @param phase a int - * @deprecated Replaced by {@link calcAdsorption} - */ - @Deprecated - public default void calcAdorption(int phase) { - calcAdsorption(phase); - } - /** ** getSurfaceExcess. @@ -41,20 +28,6 @@ public default void calcAdorption(int phase) { */ public double getSurfaceExcess(int component); - /** - *
- * getSurfaceExess. - *
- * - * @param component a int - * @return a double - * @deprecated Replaced by {@link getSurfaceExcess} - */ - @Deprecated - public default double getSurfaceExess(int component) { - return getSurfaceExcess(component); - } - /** ** setSolidMaterial. diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java b/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java index a8ef3a9ec2..3c80505a58 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java @@ -114,19 +114,6 @@ public double getAlkalinity() { return alkalinity; } - /** - *
- * Getter for the field alkalinity
.
- *
* Setter for the field alkalinity
.
@@ -137,17 +124,4 @@ public double getAlkanility() {
public void setAlkalinity(double alkalinity) {
this.alkalinity = alkalinity;
}
-
- /**
- *
- * Setter for the field alkalinity
.
- *
* Constructor for ContractSpecification. *
*/ + @Deprecated public ContractSpecification() { super("ContractSpecification"); } diff --git a/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java b/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java index 1562d31c69..30456e94de 100644 --- a/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java +++ b/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java @@ -36,7 +36,9 @@ public class PlusCharacterize implements java.io.Serializable, CharacteriseInter SystemInterface system = null; /** - *Constructor for PlusCharacterize.
+ *+ * Constructor for PlusCharacterize. + *
*/ public PlusCharacterize() {} @@ -334,17 +336,6 @@ public int getStartPlus() { return firstPlusFractionNumber; } - /** - * Setter for property firstPlusFractionNumber. - * - * @param startPlus New value of property firstPlusFractionNumber. - * @deprecated use {@link #setFirstPlusFractionNumber(int firstPlusFractionNumber)} instead. - */ - @Deprecated - public void setStartPlus(int startPlus) { - setFirstPlusFractionNumber(startPlus); - } - /** {@inheritDoc} */ @Override public double getMPlus() { diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java index 52b31d65c6..1d4d939cb9 100644 --- a/src/main/java/neqsim/thermo/component/ComponentInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java @@ -605,19 +605,6 @@ public double fugcoefDiffTempNumeric(PhaseInterface phase, int numberOfComponent */ public double getTriplePointDensity(); - /** - *- * getTripplePointDensity. - *
- * - * @return a double - * @deprecated Replaced by {@link getTriplePointDensity} - */ - @Deprecated - public default double getTripplePointDensity() { - return getTriplePointDensity(); - } - /** ** getCriticalCompressibilityFactor. @@ -766,20 +753,7 @@ public default void addMolesChemReac(double dn) { /** *
- * getIdealGasGibsEnergyOfFormation. - *
- * - * @return a double - * @deprecated Replaced by {@link getIdealGasGibbsEnergyOfFormation} - */ - @Deprecated - public default double getIdealGasGibsEnergyOfFormation() { - return getIdealGasGibbsEnergyOfFormation(); - } - - /** - *- * getIdealGasGibsEnergyOfFormation. + * getIdealGasGibbsEnergyOfFormation. *
* * @return a double diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index a65eedfad4..3365ce2e39 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -1207,32 +1207,6 @@ public double getThermalConductivity(String unit) { return refConductivity * conversionFactor; } - /** {@inheritDoc} */ - @Override - @Deprecated - public double getConductivity() { - return getPhysicalProperties().getConductivity(); - } - - /** {@inheritDoc} */ - @Override - @Deprecated - public double getConductivity(String unit) { - double refConductivity = getConductivity(); // conductivity in W/m*K - double conversionFactor = 1.0; - switch (unit) { - case "W/mK": - conversionFactor = 1.0; - break; - case "W/cmK": - conversionFactor = 0.01; - break; - default: - throw new RuntimeException("unit not supported " + unit); - } - return refConductivity * conversionFactor; - } - /** {@inheritDoc} */ @Override public void initRefPhases(boolean onlyPure) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java index 9401b6da82..1973e130f4 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java @@ -15,25 +15,6 @@ * @version $Id: $Id */ public interface PhaseGEInterface { - /** - *- * getExessGibbsEnergy. - *
- * - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @param numberOfComponents a int - * @param temperature a double - * @param pressure a double - * @param phasetype a int - * @return a double - * @deprecated Replaced by {@link getExcessGibbsEnergy}. - */ - @Deprecated - public default double getExessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { - return getExcessGibbsEnergy(phase, numberOfComponents, temperature, pressure, phasetype); - } - /** ** getExcessGibbsEnergy. diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index 5e5d290938..ed8ef08a5f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -31,22 +31,6 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab */ public void addComponent(String name, double moles, double molesInPhase, int compNumber); - /** - *
- * addcomponent. - *
- * - * @param name Name of component. - * @param moles a double - * @param molesInPhase a double - * @param compNumber a int - * @deprecated Replaced by {@link addComponent} - */ - @Deprecated - public default void addcomponent(String name, double moles, double molesInPhase, int compNumber) { - this.addComponent(name, moles, molesInPhase, compNumber); - } - /** ** setMoleFractions. @@ -535,33 +519,6 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int */ public double getMixGibbsEnergy(); - /** - *
- * getExessGibbsEnergy. - *
- * - * @return a double - * @deprecated Replaced by {@link getExcessGibbsEnergy}. - */ - @Deprecated - public default double getExessGibbsEnergy() { - return getExcessGibbsEnergy(); - } - - /** - *- * getExessGibbsEnergySymetric. - *
- * - * - * @return a double - * @deprecated Replace by {@link getExcessGibbsEnergySymetric}. - */ - @Deprecated - public default double getExessGibbsEnergySymetric() { - return getExcessGibbsEnergySymetric(); - } - /** ** getExcessGibbsEnergy. @@ -1124,25 +1081,6 @@ public default void addMolesChemReac(int component, double dn) { */ public double getViscosity(String unit); - /** - * method to return conductivity of a phase. - * - * @return conductivity in unit W/m*K - * @deprecated use {@link #getThermalConductivity()} instead. - */ - @Deprecated - public double getConductivity(); - - /** - * method to return conductivity in a specified unit. - * - * @param unit Supported units are W/mK, W/cmK - * @return conductivity in specified unit - * @deprecated use {@link #getThermalConductivity(String unit)} instead. - */ - @Deprecated - public double getConductivity(String unit); - /** * method to return conductivity of a phase. * diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index 5cc3c9d1d8..75db75ed2f 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -461,16 +461,6 @@ public default double getGamma2() { */ public void setForcePhaseTypes(boolean forcePhaseTypes); - /** - * Set the flow rate of all components to zero. - * - * @deprecated use {@link #setEmptyFluid()} instead. - */ - @Deprecated - public default void removeMoles() { - setEmptyFluid(); - } - /** * Set the flow rate (moles) of all components to zero. */ @@ -1598,16 +1588,6 @@ public default void prettyPrint() { */ public SystemInterface addFluid(SystemInterface addSystem, int phase); - /** - *
- * Getter for property hydrateCheck. - *
- * - * @return a boolean - */ - @Deprecated - public boolean doHydrateCheck(); - /** ** Getter for property hydrateCheck. @@ -2164,25 +2144,6 @@ public default ComponentInterface getComponent(int i) { */ public double getViscosity(String unit); - /** - * method to return thermal conductivity. - * - * @return conductivity in unit W/mK - * @deprecated use {@link #getThermalConductivity()} instead. - */ - @Deprecated - public double getConductivity(); - - /** - * method to return thermal conductivity in a specified unit. - * - * @param unit Supported units are W/mK, W/cmK - * @return conductivity in specified unit - * @deprecated use {@link #getThermalConductivity(String unit)} instead. - */ - @Deprecated - public double getConductivity(String unit); - /** * method to return conductivity of a fluid. * diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 717405528f..d8fe26cbd6 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -2683,36 +2683,6 @@ public double getKinematicViscosity() { return getViscosity() / getDensity(); } - /** {@inheritDoc} */ - @Deprecated - @Override - public double getConductivity() { - double cond = 0; - for (int i = 0; i < numberOfPhases; i++) { - cond += beta[phaseIndex[i]] * getPhase(i).getPhysicalProperties().getConductivity(); - } - return cond; - } - - /** {@inheritDoc} */ - @Deprecated - @Override - public double getConductivity(String unit) { - double refConductivity = getConductivity(); // conductivity in W/m*K - double conversionFactor = 1.0; - switch (unit) { - case "W/mK": - conversionFactor = 1.0; - break; - case "W/cmK": - conversionFactor = 0.01; - break; - default: - throw new RuntimeException("unit not supported " + unit); - } - return refConductivity * conversionFactor; - } - /** {@inheritDoc} */ @Override public double getThermalConductivity() { @@ -2726,7 +2696,7 @@ public double getThermalConductivity() { /** {@inheritDoc} */ @Override public double getThermalConductivity(String unit) { - double refConductivity = getConductivity(); // conductivity in W/m*K + double refConductivity = getThermalConductivity(); // conductivity in W/m*K double conversionFactor = 1.0; switch (unit) { case "W/mK": @@ -3819,12 +3789,6 @@ public boolean checkStability() { return checkStability; } - /** {@inheritDoc} */ - @Override - public boolean doHydrateCheck() { - return hydrateCheck; - } - /** {@inheritDoc} */ @Override public boolean getHydrateCheck() { diff --git a/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java b/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java index 9d7638f6e0..9ed4964bd2 100644 --- a/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java +++ b/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java @@ -42,7 +42,7 @@ public static void main(String[] args) { testSystem.display(); double[] composition = new double[] {0.1, 0.0, 1.1, 1.0, 1.0}; - // testSystem.removeMoles(); + // testSystem.setEmptyFluid(); testSystem.setMolarComposition(composition); testSystem.init(0); // testSystem.setMultiPhaseCheck(true); @@ -53,7 +53,7 @@ public static void main(String[] args) { testSystem.display(); /* - * composition = new double[]{0.1, 0.0, 1.1, 1.0, 1.0}; testSystem.removeMoles(); + * composition = new double[]{0.1, 0.0, 1.1, 1.0, 1.0}; testSystem.setEmptyFluid(); * testSystem.setMolarComposition(composition); for (int i = 0; i < 1; i++) { testOps.TPflash(); * } testSystem.display(); */ From 6e6263cbf65dfdfb171e2c78ab35475b867314ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:07:12 +0100 Subject: [PATCH 107/317] refact: reorder code --- .../chemicalReaction/ChemicalReaction.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java index 48a94585ce..ca925ac220 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java @@ -131,24 +131,6 @@ public double getRateFactor(PhaseInterface phase) { return 2.576e9 * Math.exp(-6024.0 / phase.getTemperature()) / 1000.0; } - /** - *
- * getK. - *
- * - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return a double - */ - public double getK(PhaseInterface phase) { - double temperature = phase.getTemperature(); - lnK = K[0] + K[1] / (temperature) + K[2] * Math.log(temperature) + K[3] * temperature; - if (shiftSignK) { - lnK = -lnK; - } - // System.out.println("K " + Math.exp(lnK)); - return Math.exp(lnK); - } - /** *
* Getter for the field stocCoefs
.
@@ -468,6 +450,24 @@ public double[] getK() {
return this.K;
}
+ /**
+ *
+ * getK. + *
+ * + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @return a double + */ + public double getK(PhaseInterface phase) { + double temperature = phase.getTemperature(); + lnK = K[0] + K[1] / (temperature) + K[2] * Math.log(temperature) + K[3] * temperature; + if (shiftSignK) { + lnK = -lnK; + } + // System.out.println("K " + Math.exp(lnK)); + return Math.exp(lnK); + } + /** * Setter for property k. * From 75bab697783ed93e0e14523fdb5796374c78ad1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:51:25 +0100 Subject: [PATCH 108/317] refact: replace use of phasetype as int --- .../thermo/component/ComponentHydrate.java | 3 ++- .../component/ComponentHydrateBallard.java | 3 ++- .../thermo/component/ComponentHydrateGF.java | 3 ++- .../component/ComponentHydratePVTsim.java | 5 +++-- .../thermo/component/ComponentSolid.java | 7 ++++--- .../neqsim/thermo/component/ComponentWax.java | 3 ++- .../thermo/component/ComponentWaxWilson.java | 3 ++- .../thermo/component/ComponentWonWax.java | 3 ++- .../thermo/mixingRule/EosMixingRules.java | 13 ++++++------ .../thermo/phase/PhaseDesmukhMather.java | 4 ++-- .../neqsim/thermo/phase/PhaseDuanSun.java | 7 ++++--- .../java/neqsim/thermo/phase/PhaseGE.java | 20 +++++++++---------- .../neqsim/thermo/phase/PhaseGEInterface.java | 4 ++-- .../java/neqsim/thermo/phase/PhaseGENRTL.java | 4 ++-- .../thermo/phase/PhaseGENRTLmodifiedHV.java | 6 +++--- .../thermo/phase/PhaseGENRTLmodifiedWS.java | 6 +++--- .../neqsim/thermo/phase/PhaseGEUnifac.java | 6 +++--- .../thermo/phase/PhaseGEUnifacPSRK.java | 4 ++-- .../thermo/phase/PhaseGEUnifacUMRPRU.java | 6 +++--- .../neqsim/thermo/phase/PhaseGEUniquac.java | 4 ++-- .../phase/PhaseGEUniquacmodifiedHV.java | 2 +- .../neqsim/thermo/phase/PhaseGEWilson.java | 2 +- .../neqsim/thermo/phase/PhaseInterface.java | 18 ----------------- .../java/neqsim/thermo/phase/PhaseSrkCPA.java | 8 ++++---- 24 files changed, 67 insertions(+), 77 deletions(-) diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrate.java b/src/main/java/neqsim/thermo/component/ComponentHydrate.java index fc5020095a..54a81126a8 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrate.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrate.java @@ -4,6 +4,7 @@ import org.apache.logging.log4j.Logger; import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.util.database.NeqSimDataBase; /** @@ -659,7 +660,7 @@ public void setSolidRefFluidPhase(PhaseInterface phase) { refPhase.setTemperature(273.0); refPhase.setPressure(1.0); refPhase.addComponent("water", 10.0, 10.0, 0); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 0, 1, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 0, PhaseType.byValue(1), 1.0); } catch (Exception ex) { logger.error("error occured", ex); } diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java b/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java index d8df593216..a8ab115853 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java @@ -3,6 +3,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *@@ -61,7 +62,7 @@ public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, doub if (componentName.equals("water")) { refPhase.setTemperature(temp); refPhase.setPressure(pres); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, PhaseType.byValue(0), 1.0); double refWaterFugacity = refPhase.getComponent("water").fugcoef(refPhase) * pres; double alphaWater = reffug[getComponentNumber()]; double wateralphaRef = Math.log(refWaterFugacity / alphaWater); diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java b/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java index 652522e8da..8d0c559919 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java @@ -3,6 +3,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -94,7 +95,7 @@ public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, doub refPhase.setTemperature(temp); refPhase.setPressure(pres); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, PhaseType.byValue(0), 1.0); double refWaterFugacityCoef = Math.log(refPhase.getComponent("water").fugcoef(refPhase)); double dhf = 6010.0; diff --git a/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java b/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java index c5f4a5a4ea..a400ea64e6 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java @@ -3,6 +3,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.util.database.NeqSimDataBase; /** @@ -95,7 +96,7 @@ public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, doub stableStructure = -1; refPhase.setTemperature(temp); refPhase.setPressure(pres); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, PhaseType.byValue(0), 1.0); double refWaterFugacityCoef = Math.log(refPhase.getComponent("water").fugcoef(refPhase)); @@ -125,7 +126,7 @@ public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, doub if (componentName.equals("water")) { refPhase.setTemperature(temp); refPhase.setPressure(pres); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 3, PhaseType.byValue(0), 1.0); double refWaterFugacity = refPhase.getComponent("water").fugcoef(refPhase) * pres; diff --git a/src/main/java/neqsim/thermo/component/ComponentSolid.java b/src/main/java/neqsim/thermo/component/ComponentSolid.java index 16c10f2e91..b8d27c4a4e 100644 --- a/src/main/java/neqsim/thermo/component/ComponentSolid.java +++ b/src/main/java/neqsim/thermo/component/ComponentSolid.java @@ -7,6 +7,7 @@ package neqsim.thermo.component; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -108,7 +109,7 @@ public double fugcoef(double temp, double pres) { refPhase.setTemperature(temp); refPhase.setPressure(PvapSolid); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, 1, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, PhaseType.byValue(1), 1.0); refPhase.getComponent(0).fugcoef(refPhase); // System.out.println("ref co2 fugcoef " + @@ -138,7 +139,7 @@ public double fugcoef(double temp, double pres) { public double fugcoef2(PhaseInterface phase1) { refPhase.setTemperature(phase1.getTemperature()); refPhase.setPressure(phase1.getPressure()); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, PhaseType.byValue(0), 1.0); refPhase.getComponent(0).fugcoef(refPhase); double liquidPhaseFugacity = @@ -243,7 +244,7 @@ public void setSolidRefFluidPhase(PhaseInterface phase) { } refPhase.getComponent(componentName) .setAttractiveTerm(phase.getComponent(componentName).getAttractiveTermNumber()); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 0, 1, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 0, PhaseType.byValue(1), 1.0); } } catch (Exception ex) { logger.error("error occured", ex); diff --git a/src/main/java/neqsim/thermo/component/ComponentWax.java b/src/main/java/neqsim/thermo/component/ComponentWax.java index c30d2dff22..a6f7308d5e 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWax.java +++ b/src/main/java/neqsim/thermo/component/ComponentWax.java @@ -7,6 +7,7 @@ package neqsim.thermo.component; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -54,7 +55,7 @@ public double fugcoef2(PhaseInterface phase1) { logger.error(ex.getMessage(), ex); } refPhase.setPressure(phase1.getPressure()); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, PhaseType.byValue(0), 1.0); refPhase.getComponent(0).fugcoef(refPhase); double liquidPhaseFugacity = diff --git a/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java b/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java index 5a7948be9d..fc8daf3448 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java +++ b/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java @@ -2,6 +2,7 @@ import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -45,7 +46,7 @@ public double fugcoef(PhaseInterface phase1) { public double fugcoef2(PhaseInterface phase1) { refPhase.setTemperature(phase1.getTemperature()); refPhase.setPressure(phase1.getPressure()); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, PhaseType.byValue(0), 1.0); refPhase.getComponent(0).fugcoef(refPhase); double liquidPhaseFugacity = diff --git a/src/main/java/neqsim/thermo/component/ComponentWonWax.java b/src/main/java/neqsim/thermo/component/ComponentWonWax.java index 74bfcaa1f5..7f5a8509da 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWonWax.java +++ b/src/main/java/neqsim/thermo/component/ComponentWonWax.java @@ -3,6 +3,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -45,7 +46,7 @@ public double fugcoef(PhaseInterface phase1) { public double fugcoef2(PhaseInterface phase1) { refPhase.setTemperature(phase1.getTemperature()); refPhase.setPressure(phase1.getPressure()); - refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, 0, 1.0); + refPhase.init(refPhase.getNumberOfMolesInPhase(), 1, 1, PhaseType.byValue(0), 1.0); refPhase.getComponent(0).fugcoef(refPhase); double liquidPhaseFugacity = diff --git a/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java b/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java index adabe1e3ea..2bb1ff7a40 100644 --- a/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java +++ b/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java @@ -22,6 +22,7 @@ import neqsim.thermo.phase.PhaseGEUnifacPSRK; import neqsim.thermo.phase.PhaseGEUnifacUMRPRU; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; import neqsim.util.database.NeqSimDataBase; /** @@ -1011,7 +1012,7 @@ public SRKHuronVidal(PhaseInterface phase, double[][] HValpha, double[][] HVDij, / (1.0 + compArray[0].getDeltaEosParameters()[0])); gePhase = new PhaseGENRTLmodifiedHV(orgPhase, HValpha, HVDij, mixRule, intparam); gePhase.getExcessGibbsEnergy(phase, phase.getNumberOfComponents(), phase.getTemperature(), - phase.getPressure(), 1); + phase.getPressure(), PhaseType.byValue(1)); gePhase.setProperties(phase); } @@ -1025,7 +1026,7 @@ public SRKHuronVidal(PhaseInterface phase, double[][] HValpha, double[][] HVDij, / (1.0 + compArray[0].getDeltaEosParameters()[0])); gePhase = new PhaseGENRTLmodifiedHV(orgPhase, HValpha, HVDij, HVDijT, mixRule, intparam); gePhase.getExcessGibbsEnergy(phase, phase.getNumberOfComponents(), phase.getTemperature(), - phase.getPressure(), 1); + phase.getPressure(), PhaseType.byValue(1)); gePhase.setProperties(phase); } @@ -1090,7 +1091,7 @@ public double calcA(PhaseInterface phase, double temperature, double pressure, i } A = calcB(phase, temperature, pressure, numbcomp) * (A - phase.getNumberOfMolesInPhase() * gePhase.getExcessGibbsEnergy(phase, phase.getNumberOfComponents(), - phase.getTemperature(), phase.getPressure(), 0) + phase.getTemperature(), phase.getPressure(), PhaseType.byValue(0)) / gePhase.getNumberOfMolesInPhase() / hwfc); Atot = A; return A; @@ -1308,8 +1309,7 @@ public void init(PhaseInterface phase, double temperature, double pressure, int gePhase.setParams(phase, HValpha, HVDij, HVDijT, classicOrHV, intparam); if (mixingRuleGEModel.equals("NRTL")) { - gePhase.getExcessGibbsEnergy(phase, numbcomp, temperature, pressure, - phase.getType().getValue()); + gePhase.getExcessGibbsEnergy(phase, numbcomp, temperature, pressure, phase.getType()); } else { gePhase.init((phase.getNumberOfMolesInPhase() / phase.getBeta()), phase.getNumberOfComponents(), phase.getInitType(), phase.getType(), phase.getBeta()); @@ -1616,8 +1616,7 @@ public void init(PhaseInterface phase, double temperature, double pressure, int gePhase.setProperties(phase); if (mixingRuleGEModel.equals("NRTL")) { - gePhase.getExcessGibbsEnergy(phase, numbcomp, temperature, pressure, - phase.getType().getValue()); + gePhase.getExcessGibbsEnergy(phase, numbcomp, temperature, pressure, phase.getType()); } else { gePhase.init(phase.getNumberOfMolesInPhase(), phase.getNumberOfComponents(), 3, phase.getType(), phase.getBeta()); diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java index 911d0c8c7c..9eebc6aa42 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java @@ -178,11 +178,11 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentDesmukhMather) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phasetype)); + .getGamma(phase, numberOfComponents, temperature, pressure, phasetype.getValue())); } // System.out.println("ge " + GE); return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java index 00af4cc77f..cb1a65a2e0 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java @@ -70,7 +70,7 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { GE = 0; double salinity = 0.0; // double k=0.0; @@ -99,8 +99,9 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, // GE += phase.getComponents()[i].getx()*Math.log(((ComponentGeDuanSun) // componentArray[i]).getGammaNRTL(phase, numberOfComponents, temperature, pressure, // phasetype, alpha, Dij)); - GE += phase.getComponents()[i].getx() * Math.log(((ComponentGeDuanSun) componentArray[i]) - .getGammaPitzer(phase, numberOfComponents, temperature, pressure, phasetype, salinity)); + GE += phase.getComponents()[i].getx() + * Math.log(((ComponentGeDuanSun) componentArray[i]).getGammaPitzer(phase, + numberOfComponents, temperature, pressure, phasetype.getValue(), salinity)); } return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index 1afebf72ff..ddb59ee4d6 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -51,17 +51,17 @@ public PhaseGE() { * @param totalNumberOfMoles a double * @param beta a double * @param numberOfComponents a int - * @param type a int + * @param PhaseType a int * @param phase a int */ public void init(double temperature, double pressure, double totalNumberOfMoles, double beta, - int numberOfComponents, int type, int phase) { + int numberOfComponents, PhaseType type, int phase) { if (totalNumberOfMoles <= 0) { new neqsim.util.exception.InvalidInputException(this, "init", "totalNumberOfMoles", "must be larger than zero."); } for (int i = 0; i < numberOfComponents; i++) { - componentArray[i].init(temperature, pressure, totalNumberOfMoles, beta, type); + componentArray[i].init(temperature, pressure, totalNumberOfMoles, beta, type.getValue()); } this.getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, type); @@ -85,11 +85,11 @@ public void init(double temperature, double pressure, double totalNumberOfMoles, /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType phase, - double beta) { - super.init(totalNumberOfMoles, numberOfComponents, initType, phase, beta); + public void init(double totalNumberOfMoles, int numberOfComponents, int initType, + PhaseType phaseType, double beta) { + super.init(totalNumberOfMoles, numberOfComponents, initType, phaseType, beta); if (initType != 0) { - getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, phase.getValue()); + getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, phaseType); } double sumHydrocarbons = 0.0; @@ -190,7 +190,7 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { logger.error("this getExcessGibbsEnergy should never be used......."); return 0; } @@ -239,7 +239,7 @@ public double getActivityCoefficientInfDilWater(int k, int p) { refPhase[k].setPressure(pressure); refPhase[k].init(refPhase[k].getNumberOfMolesInPhase(), 2, 1, this.getType(), 1.0); ((PhaseGEInterface) refPhase[k]).getExcessGibbsEnergy(refPhase[k], 2, - refPhase[k].getTemperature(), refPhase[k].getPressure(), refPhase[k].getType().getValue()); + refPhase[k].getTemperature(), refPhase[k].getPressure(), refPhase[k].getType()); return ((ComponentGEInterface) refPhase[k].getComponent(0)).getGamma(); } @@ -258,7 +258,7 @@ public double getActivityCoefficientInfDil(int k) { dilphase.init(dilphase.getNumberOfMolesInPhase(), dilphase.getNumberOfComponents(), 1, dilphase.getType(), 1.0); ((PhaseGEInterface) dilphase).getExcessGibbsEnergy(dilphase, 2, dilphase.getTemperature(), - dilphase.getPressure(), dilphase.getType().getValue()); + dilphase.getPressure(), dilphase.getType()); return ((ComponentGEInterface) dilphase.getComponent(0)).getGamma(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java index 1973e130f4..6b09f66d4b 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java @@ -24,9 +24,9 @@ public interface PhaseGEInterface { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phasetype a PhaseType enum object * @return a double */ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype); + double temperature, double pressure, PhaseType phasetype); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java index 6d2b38b84b..76fea9a155 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java @@ -108,12 +108,12 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype, alpha, Dij, intparam, mixRule)); + temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); } return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java index 7bdcce29c4..160fd9ac85 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java @@ -125,17 +125,17 @@ public void setDijT(double[][] DijT) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { if (type == 0) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype, alpha, Dij, intparam, mixRule)); + temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); } else if (type == 1) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGENRTLmodifiedHV) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype, alpha, Dij, DijT, intparam, mixRule)); + temperature, pressure, phasetype.getValue(), alpha, Dij, DijT, intparam, mixRule)); } } return (R * phase.getTemperature() * GE) * phase.getNumberOfMolesInPhase(); diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java index 6d00c6b526..12bb3af2d8 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java @@ -92,18 +92,18 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { double GE = 0; for (int i = 0; i < numberOfComponents; i++) { if (type == 0) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype, alpha, Dij, intparam, mixRule)); + temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); } if (type == 1) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGENRTLmodifiedWS) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype, alpha, Dij, DijT, intparam, mixRule)); + temperature, pressure, phasetype.getValue(), alpha, Dij, DijT, intparam, mixRule)); } } return R * temperature * GE * numberOfMolesInPhase; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java index 71979db600..c535388b38 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java @@ -181,17 +181,17 @@ public void checkGroups() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy() { - return getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, pt.getValue()); + return getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, pt); } /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { double GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phasetype)); + .getGamma(phase, numberOfComponents, temperature, pressure, phasetype.getValue())); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java index e1d35d3cfd..7b440f0e35 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java @@ -74,11 +74,11 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { double GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phasetype)); + .getGamma(phase, numberOfComponents, temperature, pressure, phasetype.getValue())); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); // phase.getNumberOfMolesInPhase()* } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java index 354612814b..526f96d16a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java @@ -111,9 +111,9 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phaseType) { double GE = 0.0; - calcCommontemp(phase, numberOfComponents, temperature, pressure, phasetype); + calcCommontemp(phase, numberOfComponents, temperature, pressure, phaseType.getValue()); // ((ComponentGEUnifacUMRPRU) phase.getComponents()[0]).commonInit(phase, numberOfComponents, // temperature, pressure, phasetype); @@ -123,7 +123,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, } for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phasetype)); + .getGamma(phase, numberOfComponents, temperature, pressure, phaseType.getValue())); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java index 14b31c614e..095f43dbb5 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java @@ -89,12 +89,12 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype, alpha, Dij, intparam, mixRule)); + temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); } return R * temperature * numberOfMolesInPhase * GE; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java index 89a8834938..3cf72d9d91 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java @@ -38,7 +38,7 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { double GE = 0; /* diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java index 5e1062036e..642e8b872d 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java @@ -80,7 +80,7 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phasetype) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index ed8ef08a5f..0d137feb5a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -245,24 +245,6 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta); - /** - *
- * init. - *
- * - * @param totalNumberOfMoles Total number of moles in system. - * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param ptNumber Phase type index. - * @param beta Mole fraction of this phase in system. - * @deprecated Replace with init-function using PhaseType input. - */ - @Deprecated - public default void init(double totalNumberOfMoles, int numberOfComponents, int type, - int ptNumber, double beta) { - init(totalNumberOfMoles, numberOfComponents, type, PhaseType.byValue(ptNumber), beta); - } - /** ** initPhysicalProperties. diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java index 694187913f..5bf676152f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java @@ -1450,10 +1450,10 @@ public void setTotalNumberOfAccociationSites(int totalNumberOfAccociationSites) * @param totalNumberOfMoles a double * @param numberOfComponents a int * @param type a int - * @param phase a int + * @param phaseType a int * @param beta a double */ - public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, int phase, + public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, int phaseType, double beta) { // type = 0 start init, type = 1 gi nye betingelser if (type == 0) { @@ -1531,11 +1531,11 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, PhaseType.byValue(phaseType), beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, PhaseType.byValue(phaseType), beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); From 032c89c1edc8223bbb84f8e8e81ff3352a299437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:26:15 +0100 Subject: [PATCH 109/317] doc: javadoc fix --- src/main/java/neqsim/thermo/phase/PhaseGE.java | 2 +- src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index ddb59ee4d6..73e6068ac6 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -51,7 +51,7 @@ public PhaseGE() { * @param totalNumberOfMoles a double * @param beta a double * @param numberOfComponents a int - * @param PhaseType a int + * @param type a PhaseType enum * @param phase a int */ public void init(double temperature, double pressure, double totalNumberOfMoles, double beta, diff --git a/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java b/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java index 9c7f0f0b45..7934716b32 100644 --- a/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java +++ b/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java @@ -99,6 +99,7 @@ public static void printTable(double[][] table) { * Returns a 2D string table in a formatted and visually appealing way. * * @param doubleArray The 2D double table to be printed. + * @return 2d string table */ public static String[][] convertDoubleToString(double[][] doubleArray) { // Initialize the 2D String array with the same dimensions as the double array From 5059ffbcebb75b973f509520ea3ba9f4408dd10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:01:49 +0100 Subject: [PATCH 110/317] refact: replace integer references to phasetype --- .../nonLinearSolver/NumericalDerivative.java | 5 +- .../FirozabadiRamleyInterfaceTension.java | 2 +- .../viscosity/PFCTViscosityMethod.java | 5 +- .../PFCTViscosityMethodHeavyOil.java | 6 + .../viscosity/PFCTViscosityMethodMod86.java | 4 + .../distillation/DistillationColumn.java | 2 +- .../processEquipment/manifold/Manifold.java | 2 +- .../component/ComponentDesmukhMather.java | 12 +- .../neqsim/thermo/component/ComponentGE.java | 2 + .../component/ComponentGEInterface.java | 7 +- .../component/ComponentGENRTLmodifiedHV.java | 11 +- .../component/ComponentGENRTLmodifiedWS.java | 13 ++- .../thermo/component/ComponentGEUnifac.java | 35 +++--- .../component/ComponentGEUnifacPSRK.java | 3 +- .../component/ComponentGEUnifacUMRPRU.java | 11 +- .../thermo/component/ComponentGEUniquac.java | 47 ++++---- .../ComponentGEUniquacmodifiedHV.java | 5 +- .../thermo/component/ComponentGEWilson.java | 15 +-- .../thermo/component/ComponentGeDuanSun.java | 33 +++--- .../thermo/component/ComponentGeNRTL.java | 19 ++-- src/main/java/neqsim/thermo/phase/Phase.java | 6 +- .../neqsim/thermo/phase/PhaseBWRSEos.java | 31 +++--- .../neqsim/thermo/phase/PhaseCSPsrkEos.java | 21 ++-- .../neqsim/thermo/phase/PhaseDefault.java | 4 +- .../thermo/phase/PhaseDesmukhMather.java | 12 +- .../neqsim/thermo/phase/PhaseDuanSun.java | 9 +- .../thermo/phase/PhaseElectrolyteCPA.java | 98 +++++++++------- .../thermo/phase/PhaseElectrolyteCPAOld.java | 43 ++++--- .../java/neqsim/thermo/phase/PhaseEos.java | 42 +++---- .../java/neqsim/thermo/phase/PhaseGE.java | 14 ++- .../neqsim/thermo/phase/PhaseGEInterface.java | 4 +- .../java/neqsim/thermo/phase/PhaseGENRTL.java | 4 +- .../thermo/phase/PhaseGENRTLmodifiedHV.java | 8 +- .../thermo/phase/PhaseGENRTLmodifiedWS.java | 8 +- .../neqsim/thermo/phase/PhaseGERG2004Eos.java | 16 +-- .../neqsim/thermo/phase/PhaseGEUnifac.java | 12 +- .../thermo/phase/PhaseGEUnifacPSRK.java | 4 +- .../thermo/phase/PhaseGEUnifacUMRPRU.java | 10 +- .../neqsim/thermo/phase/PhaseGEUniquac.java | 4 +- .../phase/PhaseGEUniquacmodifiedHV.java | 4 +- .../neqsim/thermo/phase/PhaseGEWilson.java | 2 +- .../neqsim/thermo/phase/PhaseHydrate.java | 8 +- .../neqsim/thermo/phase/PhaseInterface.java | 4 +- .../PhaseModifiedFurstElectrolyteEos.java | 15 +-- ...aseModifiedFurstElectrolyteEosMod2004.java | 15 +-- .../java/neqsim/thermo/phase/PhasePCSAFT.java | 13 ++- .../thermo/phase/PhasePCSAFTRahmat.java | 13 ++- .../neqsim/thermo/phase/PhasePCSAFTa.java | 13 ++- .../java/neqsim/thermo/phase/PhasePrCPA.java | 6 +- .../neqsim/thermo/phase/PhasePrEosvolcor.java | 4 +- .../thermo/phase/PhasePureComponentSolid.java | 4 +- .../java/neqsim/thermo/phase/PhaseSolid.java | 4 +- .../thermo/phase/PhaseSolidComplex.java | 4 +- .../java/neqsim/thermo/phase/PhaseSrkCPA.java | 105 ++++++++++-------- .../phase/PhaseSrkCPA_proceduralMatrices.java | 73 ++++++------ .../thermo/phase/PhaseSrkCPAojAlgo.java | 73 ++++++------ .../java/neqsim/thermo/phase/PhaseType.java | 4 +- .../java/neqsim/thermo/phase/PhaseUMRCPA.java | 105 ++++++++++-------- .../java/neqsim/thermo/phase/PhaseWax.java | 4 +- .../neqsim/thermo/system/SystemThermo.java | 10 +- 60 files changed, 581 insertions(+), 491 deletions(-) diff --git a/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java b/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java index 3cf5aa60e5..d34a147c1f 100644 --- a/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java +++ b/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java @@ -8,6 +8,7 @@ import neqsim.thermo.component.ComponentInterface; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -96,11 +97,11 @@ public static double fugcoefDiffPres(ComponentInterface component, PhaseInterfac * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return a double */ public static double fugcoefDiffTemp(ComponentInterface component, PhaseInterface phase, - int numberOfComponents, double temperature, double pressure, int phasetype) { + int numberOfComponents, double temperature, double pressure, PhaseType phaseType) { double ans = 0.000001; // double errt, fac, hh, err = 0.00000000000001; // double h = temperature / 50; diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java index 7b7efa198c..a9a5a73883 100644 --- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java +++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java @@ -68,7 +68,7 @@ public double calcSurfaceTension(int interface1, int interface2) { - system.getPhase(interface1).getPhysicalProperties().getDensity()); double Tr = system.getPhase(interface1).getTemperature() / system.getPhase(interface1).getPseudoCriticalTemperature(); - // System.out.println("deltaDens " + deltaDens + " Tr " + Tr + " phasetype " + + // System.out.println("deltaDens " + deltaDens + " Tr " + Tr + " phaseType " + // system.getPhase(interface1).getType()); double a1 = 0.0; double b1 = 0.0; diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java index cbf0c6fbe9..021f95211b 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java @@ -21,6 +21,7 @@ public class PFCTViscosityMethod extends Viscosity { private static final long serialVersionUID = 1000; + // todo: is this parameter required? int phaseTypeNumb = 1; SystemInterface referenceSystem = new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure); @@ -65,7 +66,7 @@ public PFCTViscosityMethod( /** {@inheritDoc} */ @Override public double calcViscosity() { - int phaseTypeNumb = 0; + // int phaseTypeNumb = 0; // if(phase.getPhase().getPhaseType()==0) phaseTypeNumb=1; double Pc0 = referenceSystem.getPhase(0).getComponent(0).getPC(); @@ -116,6 +117,8 @@ public double calcViscosity() { referenceSystem.setPressure(phase.getPhase().getPressure() * referenceSystem.getPhase(0).getComponent(0).getPC() / PCmix); referenceSystem.init(1); + + // todo: mixing phasetype and phase index? double molDens = 1.0 / referenceSystem.getPhase(phaseTypeNumb).getMolarVolume() * 100.0; double critMolDens = 10.15; // 1.0/referenceSystem.getPhase(0).getComponent(0).getCriticalVolume(); double redDens = molDens / critMolDens; diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java index 5dac41cf77..3dd5860b87 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java @@ -19,6 +19,8 @@ public class PFCTViscosityMethodHeavyOil extends Viscosity { // ThermodynamicConstantsInterface.referencePressure); SystemInterface referenceSystem = new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure); + + // todo: is this parameter required? int phaseTypeNumb = 1; double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3, -9.627993e1, 4.274152, -8.141531e-2}; @@ -118,6 +120,8 @@ public double calcViscosity() { referenceSystem.setPressure(phase.getPhase().getPressure() * referenceSystem.getPhase(0).getComponent(0).getPC() / PCmix); referenceSystem.init(1); + + // todo: mixing phasetype and phase index? // double molDens = 1.0 / // referenceSystem.getPhase(phaseTypeNumb).getMolarVolume() * 100.0; double molDens = 1.0 / referenceSystem.getLowestGibbsEnergyPhase().getMolarVolume() * 100.0; @@ -187,6 +191,8 @@ public double getRefComponentViscosity(double temp, double pres) { // System.out.println("ref pres " + pres); referenceSystem.init(1); // referenceSystem.display(); + + // todo: mixing phasetype and phase index? // double molDens = 1.0 / // referenceSystem.getPhase(phaseTypeNumb).getMolarVolume() * 100.0; double molDens = 1.0 / referenceSystem.getLowestGibbsEnergyPhase().getMolarVolume() * 100.0; // mol/dm^3 diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java index c467c76c2f..aac367862d 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java @@ -19,6 +19,8 @@ public class PFCTViscosityMethodMod86 extends Viscosity { // ThermodynamicConstantsInterface.referencePressure); SystemInterface referenceSystem = new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure); + + // todo: is this parameter required? int phaseTypeNumb = 1; double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3, -9.627993e1, 4.274152, -8.141531e-2}; @@ -116,6 +118,7 @@ public double calcViscosity() { referenceSystem.setPressure(phase.getPhase().getPressure() * referenceSystem.getPhase(0).getComponent(0).getPC() / PCmix); referenceSystem.init(1); + // todo: mixing phasetype and phase index? // double molDens = 1.0 / // referenceSystem.getPhase(phaseTypeNumb).getMolarVolume() * 100.0; double molDens = 1.0 / referenceSystem.getLowestGibbsEnergyPhase().getMolarVolume() * 100.0; @@ -157,6 +160,7 @@ public double getRefComponentViscosity(double temp, double pres) { // System.out.println("ref pres " + pres); referenceSystem.init(1); // referenceSystem.display(); + // todo: mixing phasetype and phase index? // double molDens = 1.0 / // referenceSystem.getPhase(phaseTypeNumb).getMolarVolume() * 100.0; double molDens = 1.0 / referenceSystem.getLowestGibbsEnergyPhase().getMolarVolume() * 100.0; // mol/dm^3 diff --git a/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java b/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java index b6dc5b6ce0..820cc016fb 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java @@ -403,7 +403,7 @@ public void displayResult() { *
* component componentMassBalanceCheck. *
- * + * * @param componentName component name to heck mass balance for * @return a boolean */ diff --git a/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java b/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java index ab9c747e3e..ec0a850a97 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java @@ -40,7 +40,7 @@ public Manifold() { ** Constructor for Splitter with name as input. *
- * + * * @param name name of manifold */ public Manifold(String name) { diff --git a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java index dbd3fe8a64..0bdda0c6fd 100644 --- a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java +++ b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java @@ -4,6 +4,8 @@ import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseDesmukhMather; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; + /** *@@ -58,9 +60,9 @@ public ComponentDesmukhMather(String component_name, double moles, double molesI /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] intparam, - String[][] mixRule) { - return getGamma(phase, numberOfComponents, temperature, pressure, phasetype); + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, + double[][] intparam, String[][] mixRule) { + return getGamma(phase, numberOfComponents, temperature, pressure, phaseType); } /** @@ -72,11 +74,11 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { double A = 1.174; double B = 3.32384e9; diff --git a/src/main/java/neqsim/thermo/component/ComponentGE.java b/src/main/java/neqsim/thermo/component/ComponentGE.java index 1290137ef0..9fa1bc9d0c 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGE.java +++ b/src/main/java/neqsim/thermo/component/ComponentGE.java @@ -10,6 +10,8 @@ import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseGE; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; + /** * diff --git a/src/main/java/neqsim/thermo/component/ComponentGEInterface.java b/src/main/java/neqsim/thermo/component/ComponentGEInterface.java index 109ce50c06..eaddd7019b 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEInterface.java @@ -7,6 +7,7 @@ package neqsim.thermo.component; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -26,7 +27,7 @@ public interface ComponentGEInterface extends ComponentInterface { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @param intparam an array of {@link double} objects @@ -34,8 +35,8 @@ public interface ComponentGEInterface extends ComponentInterface { * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] intparam, - String[][] mixRule); + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, + double[][] intparam, String[][] mixRule); /** *
diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java index 96fae40724..a59d95d261 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java @@ -7,6 +7,7 @@ package neqsim.thermo.component; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -37,10 +38,10 @@ public ComponentGENRTLmodifiedHV(String component_name, double moles, double mol /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] intparam, - String[][] mixRule) { + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, + double[][] intparam, String[][] mixRule) { double[][] HVgijT = new double[numberOfComponents][numberOfComponents]; - return getGamma(phase, numberOfComponents, temperature, pressure, phasetype, HValpha, HVgij, + return getGamma(phase, numberOfComponents, temperature, pressure, phaseType, HValpha, HVgij, HVgijT, intparam, mixRule); } @@ -53,7 +54,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @param HVgijT an array of {@link double} objects @@ -62,7 +63,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] HVgijT, + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, double[][] HVgijT, double[][] intparam, String[][] mixRule) { int type = phase.getInitType(); double A = 0; diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java index 2c3bbc2989..3d385cef01 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java @@ -1,6 +1,7 @@ package neqsim.thermo.component; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -43,10 +44,10 @@ public double getlnGammadn(int k) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] WSalpha, double[][] WSgij, double[][] intparam, - String[][] mixRule) { + double pressure, PhaseType phaseType, double[][] WSalpha, double[][] WSgij, + double[][] intparam, String[][] mixRule) { double[][] WSgijT = new double[numberOfComponents][numberOfComponents]; - return getGamma(phase, numberOfComponents, temperature, pressure, phasetype, WSalpha, WSgij, + return getGamma(phase, numberOfComponents, temperature, pressure, phaseType, WSalpha, WSgij, WSgijT, intparam, mixRule); } @@ -59,7 +60,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @param WSalpha an array of {@link double} objects * @param WSgij an array of {@link double} objects * @param WSgijT an array of {@link double} objects @@ -69,7 +70,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp */ @SuppressWarnings("unused") public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] WSalpha, double[][] WSgij, double[][] WSgijT, + double pressure, PhaseType phaseType, double[][] WSalpha, double[][] WSgij, double[][] WSgijT, double[][] intparam, String[][] mixRule) { double type = phase.getInitType(); double A = 0; @@ -244,7 +245,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp // dlngammadt = (lngammaold-lngamma)/0.002; // phaseny.getExcessGibbsEnergy(numberOfComponents, temperature, pressure, - // phasetype) + // phaseType) gamma = Math.exp(lngamma); // if derivates.... diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java index fbdc462e3f..e6a54334ea 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java @@ -12,6 +12,7 @@ import neqsim.thermo.atomElement.UNIFACgroup; import neqsim.thermo.phase.PhaseGEUnifac; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -133,9 +134,9 @@ public double getR() { /** {@inheritDoc} */ @Override public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { fugacityCoefficient = - (this.getGamma(phase, numberOfComponents, temperature, pressure, phasetype) + (this.getGamma(phase, numberOfComponents, temperature, pressure, phaseType) * this.getAntoineVaporPressure(temperature) / pressure); return fugacityCoefficient; } @@ -189,7 +190,7 @@ public void calclnGammak(int k, PhaseInterface phase) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { double lngammaCombinational = 0.0; double lngammaResidual = 0.0; dlngammadn = new double[numberOfComponents]; @@ -243,9 +244,9 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp /** {@inheritDoc} */ @Override public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { - dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, phasetype)) - - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, phasetype))) + double pressure, PhaseType phaseType) { + dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, phaseType)) + - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, phaseType))) / 0.02; return dfugdp; } @@ -253,27 +254,27 @@ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, doub /** {@inheritDoc} */ @Override public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { - dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, phasetype)) - - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, phasetype))) + double pressure, PhaseType phaseType) { + dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, phaseType)) + - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, phaseType))) / 0.02; return dfugdt; } /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ // NumericalDerivative deriv = new NumericalDerivative(); // - * System.out.println("dfugdP : " + NumericalDerivative.fugcoefDiffPres(this, phase, - * numberOfComponents, temperature, pressure, phasetype)); return + * double pressure, PhaseType phaseType){ // NumericalDerivative deriv = new + * NumericalDerivative(); // System.out.println("dfugdP : " + * NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, temperature, pressure, - * phasetype); } + * phaseType)); return NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, + * temperature, pressure, phaseType); } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ NumericalDerivative deriv = new NumericalDerivative(); // - * System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, - * numberOfComponents, temperature, pressure, phasetype)); return + * double pressure, PhaseType phaseType){ NumericalDerivative deriv = new NumericalDerivative(); + * // System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, + * numberOfComponents, temperature, pressure, phaseType)); return * NumericalDerivative.fugcoefDiffTemp(this, phase, numberOfComponents, temperature, pressure, - * phasetype); + * phaseType); * * } */ diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java index 37ee6b072b..24de0c5b6f 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java @@ -2,6 +2,7 @@ import neqsim.thermo.phase.PhaseGEUnifac; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -142,7 +143,7 @@ public void calclnGammakdT(int k, PhaseInterface phase) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { int initType = phase.getInitType(); double lngammaCombinational = 0.0; double lngammaResidual = 0.0; diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java index 9e453f1659..95242d37af 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java @@ -6,6 +6,7 @@ import neqsim.thermo.phase.PhaseGEUnifac; import neqsim.thermo.phase.PhaseGEUnifacUMRPRU; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -353,7 +354,7 @@ public void calclnGammakdTdT(int k, PhaseInterface phase) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { int initType = phase.getInitType(); double lngammaCombinational; double lngammaResidual; @@ -519,22 +520,22 @@ public void calcUnifacGroupParamsdT(PhaseInterface phase) { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int */ public void calcGammaNumericalDerivatives(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { + double temperature, double pressure, PhaseType phaseType) { phase.setInitType(1); for (int i = 0; i < phase.getNumberOfComponents(); i++) { double dn = getNumberOfMolesInPhase() / 1e6; phase.addMoles(getComponentNumber(), dn); x = getNumberOfmoles() / getNumberOfMolesInPhase(); - getGamma(phase, numberOfComponents, temperature, pressure, phasetype); + getGamma(phase, numberOfComponents, temperature, pressure, phaseType); double oldGamma = lngamma; phase.addMoles(getComponentNumber(), dn); x = getNumberOfmoles() / getNumberOfMolesInPhase(); - getGamma(phase, numberOfComponents, temperature, pressure, phasetype); + getGamma(phase, numberOfComponents, temperature, pressure, phaseType); double dlnGammadn = (oldGamma - lngamma) / dn; // System.out.println("dlnGammadn " + dlnGammadn); diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java index 6b4a242f38..d8c6e8d9dc 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java @@ -9,6 +9,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -78,13 +79,13 @@ public ComponentGEUniquac(String component_name, double moles, double molesInPha * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return Fugacity coefficient */ public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { fugacityCoefficient = - (this.getGamma(phase, numberOfComponents, temperature, pressure, phasetype) + (this.getGamma(phase, numberOfComponents, temperature, pressure, phaseType) * this.getAntoineVaporPressure(temperature) / pressure); return fugacityCoefficient; } @@ -92,8 +93,8 @@ public double fugcoef(PhaseInterface phase, int numberOfComponents, double tempe /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] intparam, - String[][] mixRule) { + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, + double[][] intparam, String[][] mixRule) { return 0.0; } @@ -106,11 +107,11 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { /* * double V = 0, F = 0, a, gammaC = 0, gammaR = 0, temp1 = 0, temp2 = 0, temp3=0, temp4 = 0, * temp5=0, gamma; int j, k; @@ -170,13 +171,13 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return a double */ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { - dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, phasetype)) - - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, phasetype))) + double pressure, PhaseType phaseType) { + dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, phaseType)) + - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, phaseType))) / 0.02; return dfugdp; } @@ -190,30 +191,30 @@ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, doub * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return a double */ public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { - dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, phasetype)) - - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, phasetype))) + double pressure, PhaseType phaseType) { + dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, phaseType)) + - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, phaseType))) / 0.02; return dfugdt; } /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ // NumericalDerivative deriv = new NumericalDerivative(); // - * System.out.println("dfugdP : " + NumericalDerivative.fugcoefDiffPres(this, phase, - * numberOfComponents, temperature, pressure, phasetype)); return + * double pressure, PhaseType phaseType){ // NumericalDerivative deriv = new + * NumericalDerivative(); // System.out.println("dfugdP : " + * NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, temperature, pressure, - * phasetype); } + * phaseType)); return NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, + * temperature, pressure, phaseType); } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ NumericalDerivative deriv = new NumericalDerivative(); // - * System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, - * numberOfComponents, temperature, pressure, phasetype)); return + * double pressure, PhaseType phaseType){ NumericalDerivative deriv = new NumericalDerivative(); + * // System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, + * numberOfComponents, temperature, pressure, phaseType)); return * NumericalDerivative.fugcoefDiffTemp(this, phase, numberOfComponents, temperature, pressure, - * phasetype); + * phaseType); * * } */ diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java index 76d23e50f8..364edb98a8 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java @@ -7,6 +7,7 @@ package neqsim.thermo.component; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** * @@ -33,10 +34,10 @@ public ComponentGEUniquacmodifiedHV(String component_name, double moles, double /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { // PhaseGEInterface phaseny = (PhaseGEInterface) phase.getPhase(); // PhaseGEInterface GEPhase = phaseny.getGEphase(); - return 1; // super.getGamma(GEPhase, numberOfComponents, temperature, pressure, phasetype); + return 1; // super.getGamma(GEPhase, numberOfComponents, temperature, pressure, phaseType); } } diff --git a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java index 30763b2bb9..0b3c46fc19 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java @@ -2,6 +2,7 @@ import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -39,13 +40,13 @@ public ComponentGEWilson(String component_name, double moles, double molesInPhas * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return Fugacity coefficient */ public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { fugacityCoefficient = - (this.getGamma(phase, numberOfComponents, temperature, pressure, phasetype) + (this.getGamma(phase, numberOfComponents, temperature, pressure, phaseType) * this.getAntoineVaporPressure(temperature) / pressure); return fugacityCoefficient; } @@ -59,19 +60,19 @@ public double fugcoef(PhaseInterface phase, int numberOfComponents, double tempe * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { return getWilsonActivityCoefficient(phase); } /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] intparam, - String[][] mixRule) { + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, + double[][] intparam, String[][] mixRule) { return 0.0; } diff --git a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java index b38611d6ce..e94bc45928 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java +++ b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java @@ -2,6 +2,7 @@ import neqsim.thermo.phase.PhaseGE; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -36,9 +37,9 @@ public ComponentGeDuanSun(String component_name, double moles, double molesInPha /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] intparam, - String[][] mixRule) { - return getGamma(phase, numberOfComponents, temperature, pressure, phasetype, HValpha, HVgij); + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, + double[][] intparam, String[][] mixRule) { + return getGamma(phase, numberOfComponents, temperature, pressure, phaseType, HValpha, HVgij); } /** @@ -50,13 +51,13 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @return a double */ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij) { + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij) { double type = phase.getInitType(); // double ny = 0, Djj = 0, Dii = 0, gij = 0, gjj = 0, gji = 0, gii = 0, F2T = 0, tot2 = 0; double A = 0; @@ -208,7 +209,7 @@ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double // dlngammadt = (lngammaold-lngamma)/0.002; // phaseny.getExcessGibbsEnergy(numberOfComponents, temperature, pressure, - // phasetype) + // phaseType) gamma = Math.exp(lngamma); // System.out.println("gamma " +gamma); // if derivates.... @@ -271,13 +272,13 @@ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij) { + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij) { if (componentName.equals("CO2")) { return 0.9; } else if (componentName.equals("water")) { @@ -458,12 +459,12 @@ public double fugcoef(PhaseInterface phase) { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int * @param salinity a double * @return a double */ public double getGammaPitzer(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double salinity) { + double pressure, PhaseType phaseType, double salinity) { double P = pressure; double T = temperature; double S = salinity; @@ -518,14 +519,14 @@ public double getGammaPitzer(PhaseInterface phase, int numberOfComponents, doubl ///////////////////////////////////////////////////// /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure+0.01, phasetype))-Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure-0.01, phasetype)))/0.02; return dfugdp; } + * double pressure, PhaseType phaseType){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, + * temperature, pressure+0.01, phaseType))-Math.log(fugcoef(phase, numberOfComponents, + * temperature, pressure-0.01, phaseType)))/0.02; return dfugdp; } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, - * temperature+0.01, pressure, phasetype))-Math.log(fugcoef(phase, numberOfComponents, - * temperature-0.01, pressure, phasetype)))/0.02; return dfugdt; } + * double pressure, PhaseType phaseType){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, + * temperature+0.01, pressure, phaseType))-Math.log(fugcoef(phase, numberOfComponents, + * temperature-0.01, pressure, phaseType)))/0.02; return dfugdt; } */ /** diff --git a/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java b/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java index 5bff0116b8..76a033f824 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java +++ b/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java @@ -1,6 +1,7 @@ package neqsim.thermo.component; import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.phase.PhaseType; /** *
@@ -35,8 +36,8 @@ public ComponentGeNRTL(String component_name, double moles, double molesInPhase, @Override @SuppressWarnings("unused") public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype, double[][] HValpha, double[][] HVgij, double[][] intparam, - String[][] mixRule) { + double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, + double[][] intparam, String[][] mixRule) { double type = phase.getInitType(); double A = 0; double B = 0; @@ -200,7 +201,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp // dlngammadt = (lngammaold-lngamma)/0.002; // phaseny.getExcessGibbsEnergy(numberOfComponents, temperature, pressure, - // phasetype) + // phaseType) gamma = Math.exp(lngamma); // System.out.println("gamma " +gamma); // if derivates.... @@ -256,14 +257,14 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure+0.01, phasetype))-Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure-0.01, phasetype)))/0.02; return dfugdp; } + * double pressure, PhaseType phaseType){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, + * temperature, pressure+0.01, phaseType))-Math.log(fugcoef(phase, numberOfComponents, + * temperature, pressure-0.01, phaseType)))/0.02; return dfugdp; } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, int phasetype){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, - * temperature+0.01, pressure, phasetype))-Math.log(fugcoef(phase, numberOfComponents, - * temperature-0.01, pressure, phasetype)))/0.02; return dfugdt; } + * double pressure, PhaseType phaseType){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, + * temperature+0.01, pressure, phaseType))-Math.log(fugcoef(phase, numberOfComponents, + * temperature-0.01, pressure, phaseType)))/0.02; return dfugdt; } */ /** diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index 3365ce2e39..2ea215d8d8 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -403,7 +403,7 @@ public void init() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { if (totalNumberOfMoles <= 0) { throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this, "init", @@ -412,8 +412,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph this.beta = beta; numberOfMolesInPhase = beta * totalNumberOfMoles; - if (this.pt != phase) { - setType(phase); + if (this.pt != phaseType) { + setType(phaseType); // setPhysicalProperties(physicalPropertyType); } this.setInitType(type); diff --git a/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java b/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java index a6a7060c4c..b70a41120a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java @@ -51,17 +51,17 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { double oldMolDens = 0; if (type == 0) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); - super.init(totalNumberOfMoles, numberOfComponents, 3, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 3, phaseType, beta); return; } do { oldMolDens = getMolarDensity(); - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } while (Math.abs((getMolarDensity() - oldMolDens) / oldMolDens) > 1e-10); getF(); // calcPVT(); @@ -413,7 +413,7 @@ public void calcPVT() { @Override public double getF() { // System.out.println("F " + getFpol()*1e3+ " "+ getFexp()*1e3 + " super " + - // super.getF() + " phasetype " +getType()); + // super.getF() + " phaseType " +getType()); return (getFpol() + getFexp()) * 1e3; } @@ -439,7 +439,7 @@ public double getdFdN() { getComponent(0).addMoles(dn); init(numberOfMolesInPhase, numberOfComponents, 3, 1.0); // System.out.println("F " + getFpol()*1e3+ " "+ getFexp()*1e3 + " super " + - // super.getF() + " phasetype " +getType()); + // super.getF() + " phaseType " +getType()); return (fold - fnew) / (2 * dn); } @@ -456,11 +456,11 @@ public double dFdT() { // temperature = temperature + dv; // init(numberOfMolesInPhase, numberOfComponents, 3, pt.getValue(), 1.0); // System.out.println("dFdT " + ((fold-fnew)/(2*dv)) + " super " + - // (getFpoldT()+getFexpdT())*1e3+ " phasetype " +getType()); + // (getFpoldT()+getFexpdT())*1e3+ " phaseType " +getType()); return (getFpoldT() + getFexpdT()) * 1e3; // (fold-fnew)/(2*dv); // // System.out.println("FT " + getFpoldT()*1e3+ " "+ getFexpdT()*1e3 + " super - // " + super.dFdT() + " phasetype " +getType()); + // " + super.dFdT() + " phaseType " +getType()); // return (getFpoldT()+getFexpdT())*1e3; } @@ -505,10 +505,10 @@ public double dFdV() { // molarVolume = molarVolume + dv; // System.out.println("dFdV " + ((fold-fnew)/(2*dv)) + " super " + super.dFdV()+ - // " phasetype " +getType()); + // " phaseType " +getType()); // // return (fold-fnew)/(2*dv); // System.out.println("dFdV " + ((getFpoldV()+getFexpdV()))*1e3*1e-5 + " super " - // + super.dFdV()+ " phasetype " +getType()); + // + super.dFdV()+ " phaseType " +getType()); // System.out.println("dFdV " + getFpoldV()+getFexpdV()*1e3*1e-5); return (getFpoldV() + getFexpdV()) * 1e3 * 1e-5; } @@ -525,7 +525,7 @@ public double dFdVdV() { setMolarVolume(getMolarVolume() + dv); // System.out.println("dFdV " + ((fold-fnew)/(2*dv)) + " super " + super.dFdV()+ - // " phasetype " +getType()); + // " phaseType " +getType()); return (fold - fnew) / (2 * dv); // return (getFpoldVdV()+getFexpdVdV())*1e3*1e-10; } @@ -536,11 +536,12 @@ public double dFdVdV() { /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phase == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); double Btemp = getB(); setMolarVolume(1.0 / BonV * Btemp); // numberOfMolesInPhase; int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java index a437a19f3e..9d9fc71e55 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java @@ -65,17 +65,17 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { double oldtemp = temperature; if (type == 0) { - refBWRSPhase.init(1.0, 1, 0, phase, 1.0); - refBWRSPhase.init(1.0, 1, 3, phase, 1.0); + refBWRSPhase.init(1.0, 1, 0, phaseType, 1.0); + refBWRSPhase.init(1.0, 1, 3, phaseType, 1.0); } else { - refBWRSPhase.init(1.0, 1, 3, phase, 1.0); + refBWRSPhase.init(1.0, 1, 3, phaseType, 1.0); } do { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); oldtemp = refBWRSPhase.getTemperature(); h_scale_mix = getNumberOfMolesInPhase() * getb() / brefBWRSPhase; double term1 = getA() / ((ComponentEosInterface) refBWRSPhase.getComponent(0)).getaT(); @@ -84,7 +84,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph refBWRSPhase.setMolarVolume(getTotalVolume() / h_scale_mix); // refBWRSPhase.setPressure(refBWRSPhase.calcPressure()); refBWRSPhase.setPressure(pressure * h_scale_mix / f_scale_mix); - refBWRSPhase.init(1.0, 1, type, phase, 1.0); + refBWRSPhase.init(1.0, 1, type, phaseType, 1.0); } while (Math.abs((oldtemp - refBWRSPhase.getTemperature()) / oldtemp) > 1e-8); } @@ -211,11 +211,12 @@ public void setRefBWRSPhase(neqsim.thermo.phase.PhaseBWRSEos refBWRSPhase) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phase == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 0.0; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseDefault.java b/src/main/java/neqsim/thermo/phase/PhaseDefault.java index 063884d170..20f47f6e8a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDefault.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDefault.java @@ -59,8 +59,8 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { return 1.0; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java index 9eebc6aa42..e2c6920ac2 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java @@ -39,11 +39,11 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType phase, - double beta) { - super.init(totalNumberOfMoles, numberOfComponents, initType, phase, beta); + public void init(double totalNumberOfMoles, int numberOfComponents, int initType, + PhaseType phaseType, double beta) { + super.init(totalNumberOfMoles, numberOfComponents, initType, phaseType, beta); if (initType != 0) { - setType(phase); + setType(phaseType); // phaseTypeName = phase == 0 ? "liquid" : "gas"; } setMolarVolume(0.980e-3 * getMolarMass() * 1e5); @@ -178,11 +178,11 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentDesmukhMather) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phasetype.getValue())); + .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); } // System.out.println("ge " + GE); return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java index cb1a65a2e0..ed79991fe4 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java @@ -70,7 +70,7 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { GE = 0; double salinity = 0.0; // double k=0.0; @@ -98,10 +98,9 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, for (int i = 0; i < numberOfComponents; i++) { // GE += phase.getComponents()[i].getx()*Math.log(((ComponentGeDuanSun) // componentArray[i]).getGammaNRTL(phase, numberOfComponents, temperature, pressure, - // phasetype, alpha, Dij)); - GE += phase.getComponents()[i].getx() - * Math.log(((ComponentGeDuanSun) componentArray[i]).getGammaPitzer(phase, - numberOfComponents, temperature, pressure, phasetype.getValue(), salinity)); + // phaseType, alpha, Dij)); + GE += phase.getComponents()[i].getx() * Math.log(((ComponentGeDuanSun) componentArray[i]) + .getGammaPitzer(phase, numberOfComponents, temperature, pressure, phaseType, salinity)); } return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java index 080cde69b7..a555fcf80b 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java @@ -10,6 +10,9 @@ import neqsim.thermo.component.ComponentElectrolyteCPA; import neqsim.thermo.mixingRule.CPAMixing; import neqsim.thermo.mixingRule.CPAMixingInterface; +import neqsim.thermo.phase.PhaseType; +import neqsim.thermo.phase.PhaseType; + /** *
@@ -104,7 +107,7 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -182,12 +185,12 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type > 0 && isConstantPhaseVolume()) { volInit(); calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -203,9 +206,9 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph volInit(); initCPAMatrix(type); // hcpatotdT = calc_hCPAdT(); - // super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + // super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } /** @@ -827,10 +830,10 @@ public double getGcpa() { * calcRootVolFinder. *
* - * @param phase a int + * @param phaseType a int * @return a double */ - public double calcRootVolFinder(int phase) { + public double calcRootVolFinder(PhaseType phaseType) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; @@ -868,12 +871,12 @@ public double calcRootVolFinder(int phase) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phase == 1) { + if (phaseType.getValue() == 1) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phase == 0) { + if (phaseType.getValue() == 0) { break; } } @@ -891,7 +894,7 @@ public double calcRootVolFinder(int phase) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phase == 1) { + if (phaseType.getValue() == 1) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -900,11 +903,12 @@ public double calcRootVolFinder(int phase) { /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-8; } @@ -967,8 +971,9 @@ public double molarVolume2(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -981,8 +986,9 @@ public double molarVolume2(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -990,8 +996,9 @@ public double molarVolume2(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1025,16 +1032,17 @@ public double molarVolume2(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phasetype); + // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV <= 0) { @@ -1097,8 +1105,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1111,9 +1120,9 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // BonV = 0.9999; - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1121,8 +1130,8 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1135,7 +1144,7 @@ public double molarVolume(double pressure, double temperature, double A, double if (Math.abs(h) > 1e-9) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1167,18 +1176,18 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - int phasetype) throws neqsim.util.exception.IsNaNException, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - // double BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // double BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); - double BonV = calcRootVolFinder(phasetype); + double BonV = calcRootVolFinder(phaseType); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1240,8 +1249,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1254,8 +1264,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1263,8 +1274,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1276,7 +1288,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phasetype == 0) { molarVolume(pressure, temperature, A, B, 1); + * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java index 557ff36021..3675fa1c7d 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java @@ -7,6 +7,9 @@ import neqsim.thermo.component.ComponentEosInterface; import neqsim.thermo.mixingRule.CPAMixing; import neqsim.thermo.mixingRule.CPAMixingInterface; +import neqsim.thermo.phase.PhaseType; +import neqsim.thermo.phase.PhaseType; + /** *@@ -67,7 +70,7 @@ public PhaseElectrolyteCPAOld clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { if (type == 0) { selfAccociationScheme = new int[numberOfComponents][0][0]; @@ -80,7 +83,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph } } do { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } while (!solveX()); // System.out.println("test1 " + dFCPAdT()); @@ -536,16 +539,17 @@ public double getGcpa() { * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ - public double molarVolume3(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume3(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-8; @@ -599,8 +603,9 @@ public double molarVolume3(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -634,11 +639,12 @@ public double molarVolume3(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-8; @@ -701,8 +707,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -738,10 +745,10 @@ public double molarVolume(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phase == 0 ? 1.0 : 1.0e-5; + Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java index dcd5c1254d..1429bd8af0 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java @@ -77,16 +77,16 @@ public void displayInteractionCoefficients(String intType) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - if (phase.getValue() > 1) { - phase = PhaseType.LIQUID; + if (phaseType.getValue() > 1) { + phaseType = PhaseType.LIQUID; } if (!mixingRuleDefined) { setMixingRule(1); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type != 0) { loc_B = calcB(this, temperature, pressure, numberOfComponents); @@ -103,7 +103,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph if (calcMolarVolume) { molarVolume = molarVolume(pressure, temperature, getA() / numberOfMolesInPhase / numberOfMolesInPhase, getB() / numberOfMolesInPhase, - phase.getValue()); + phaseType); } } catch (Exception ex) { logger.error("Failed to solve for molarVolume within the iteration limit."); @@ -193,16 +193,17 @@ public void resetMixingRule(int type) { * @param temperature a double * @param A a double * @param B a double - * @param phase a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ - public double molarVolume2(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phase == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 0.0; } @@ -282,11 +283,12 @@ public double molarVolume2(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phase == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-4; @@ -335,8 +337,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phase == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += d1 * (0.1); @@ -358,8 +361,9 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations > 150 && error > errorOld && !changeFase) { changeFase = true; BonVold = 10.0; - BonV = phase == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase); @@ -777,7 +781,7 @@ public double fv() { } // NYE metoder fredag 25.08.public double dFdN(PhaseInterface phase, int - // numberOfComponents, double temperature, double pressure, int phasetype){ + // numberOfComponents, double temperature, double pressure, PhaseType phaseType){ /** {@inheritDoc} */ @Override public double FnV() { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index 73e6068ac6..eb0acea45a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -51,19 +51,20 @@ public PhaseGE() { * @param totalNumberOfMoles a double * @param beta a double * @param numberOfComponents a int - * @param type a PhaseType enum + * @param phaseType a PhaseType enum * @param phase a int */ public void init(double temperature, double pressure, double totalNumberOfMoles, double beta, - int numberOfComponents, PhaseType type, int phase) { + int numberOfComponents, PhaseType phaseType, int phase) { if (totalNumberOfMoles <= 0) { new neqsim.util.exception.InvalidInputException(this, "init", "totalNumberOfMoles", "must be larger than zero."); } for (int i = 0; i < numberOfComponents; i++) { - componentArray[i].init(temperature, pressure, totalNumberOfMoles, beta, type.getValue()); + // todo: Conflating init type and phase type? + componentArray[i].init(temperature, pressure, totalNumberOfMoles, beta, phaseType.getValue()); } - this.getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, type); + this.getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, phaseType); double sumHydrocarbons = 0.0; double sumAqueous = 0.0; @@ -134,7 +135,8 @@ public void resetMixingRule(int type) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) { + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) { return 1; } @@ -190,7 +192,7 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { logger.error("this getExcessGibbsEnergy should never be used......."); return 0; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java index 6b09f66d4b..c440c00718 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java @@ -24,9 +24,9 @@ public interface PhaseGEInterface { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a PhaseType enum object + * @param phaseType a PhaseType enum object * @return a double */ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype); + double temperature, double pressure, PhaseType phaseType); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java index 76fea9a155..841c8e6aea 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java @@ -108,12 +108,12 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); + temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); } return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java index 160fd9ac85..2d194789d4 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java @@ -8,6 +8,8 @@ import neqsim.thermo.component.ComponentGEInterface; import neqsim.thermo.component.ComponentGENRTLmodifiedHV; +import neqsim.thermo.phase.PhaseType; + /** *
@@ -125,17 +127,17 @@ public void setDijT(double[][] DijT) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { if (type == 0) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); + temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); } else if (type == 1) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGENRTLmodifiedHV) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype.getValue(), alpha, Dij, DijT, intparam, mixRule)); + temperature, pressure, phaseType, alpha, Dij, DijT, intparam, mixRule)); } } return (R * phase.getTemperature() * GE) * phase.getNumberOfMolesInPhase(); diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java index 12bb3af2d8..c512ef7487 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java @@ -2,6 +2,8 @@ import neqsim.thermo.component.ComponentGEInterface; import neqsim.thermo.component.ComponentGENRTLmodifiedWS; +import neqsim.thermo.phase.PhaseType; + /** *
@@ -92,18 +94,18 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { double GE = 0; for (int i = 0; i < numberOfComponents; i++) { if (type == 0) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); + temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); } if (type == 1) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGENRTLmodifiedWS) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype.getValue(), alpha, Dij, DijT, intparam, mixRule)); + temperature, pressure, phaseType, alpha, Dij, DijT, intparam, mixRule)); } } return R * temperature * GE * numberOfMolesInPhase; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java index eed3fb75b2..2ee0a91275 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java @@ -81,15 +81,15 @@ public void setxFracGERG() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - IPHASE = phase.getValue() == 0 ? -1 : -2; - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + IPHASE = phaseType.getValue() == 0 ? -1 : -2; + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); setxFracGERG(); if (!okVolume) { - IPHASE = phase.getValue() == 0 ? -2 : -1; - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + IPHASE = phaseType.getValue() == 0 ? -2 : -1; + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } if (type >= 1) { double[] temp = new double[18]; @@ -137,7 +137,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph // xFracGERG[0],xFracGERG[1],xFracGERG[2],xFracGERG[3],xFracGERG[4],xFracGERG[5],xFracGERG[6],xFracGERG[7],xFracGERG[8],xFracGERG[9],xFracGERG[10],xFracGERG[11],xFracGERG[12],xFracGERG[13],xFracGERG[14],xFracGERG[15],xFracGERG[16],xFracGERG[17],IPHASE); CvGERG = alloTPX[5]; // gergEOS.CPOTPX(temperature,pressure/10.0, // xFracGERG[0],xFracGERG[1],xFracGERG[2],xFracGERG[3],xFracGERG[4],xFracGERG[5],xFracGERG[6],xFracGERG[7],xFracGERG[8],xFracGERG[9],xFracGERG[10],xFracGERG[11],xFracGERG[12],xFracGERG[13],xFracGERG[14],xFracGERG[15],xFracGERG[16],xFracGERG[17],IPHASE); - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } } @@ -185,8 +185,8 @@ public double getCv() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double temp = GERG2004EOS.ZOTPX(temperature, pressure / 10.0, xFracGERG[0], xFracGERG[1], xFracGERG[2], xFracGERG[3], xFracGERG[4], xFracGERG[5], xFracGERG[6], xFracGERG[7], diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java index c535388b38..02c88fea79 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java @@ -8,6 +8,8 @@ import neqsim.thermo.atomElement.UNIFACgroup; import neqsim.thermo.component.ComponentGEUnifac; import neqsim.thermo.component.ComponentGEUniquac; +import neqsim.thermo.phase.PhaseType; + /** *
@@ -79,12 +81,12 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { // if(type==0) calcaij(); - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type == 0) { - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); } } @@ -187,11 +189,11 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { double GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phasetype.getValue())); + .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java index 7b440f0e35..11499a8a5a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java @@ -74,11 +74,11 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { double GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phasetype.getValue())); + .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); // phase.getNumberOfMolesInPhase()* } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java index 526f96d16a..c4b258fb62 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java @@ -68,10 +68,10 @@ public PhaseGEUnifacUMRPRU(PhaseInterface phase, double[][] alpha, double[][] Di * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phasetype a int + * @param phaseType a int */ public void calcCommontemp(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, int phasetype) { + double pressure, PhaseType phaseType) { FCommontemp = 0; VCommontemp = 0; ComponentGEUnifac[] compArray = (ComponentGEUnifac[]) phase.getcomponentArray(); @@ -113,9 +113,9 @@ public void setMixingRule(int type) { public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType phaseType) { double GE = 0.0; - calcCommontemp(phase, numberOfComponents, temperature, pressure, phaseType.getValue()); + calcCommontemp(phase, numberOfComponents, temperature, pressure, phaseType); // ((ComponentGEUnifacUMRPRU) phase.getComponents()[0]).commonInit(phase, numberOfComponents, - // temperature, pressure, phasetype); + // temperature, pressure, phaseType); initQmix(); if (getInitType() > 2) { @@ -123,7 +123,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, } for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phaseType.getValue())); + .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java index 095f43dbb5..9397f6df51 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java @@ -89,12 +89,12 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phasetype.getValue(), alpha, Dij, intparam, mixRule)); + temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); } return R * temperature * numberOfMolesInPhase * GE; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java index 3cf72d9d91..1b4f6bf207 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java @@ -38,7 +38,7 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { double GE = 0; /* @@ -46,7 +46,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, * * for (int i = 0; i < numberOfComponents; i++) { GE = GE + comp_Array[i].getx() * * Math.log(comp_Array[i].getGamma(phase, numberOfComponents, temperature, pressure, - * phasetype)); } + * phaseType)); } */ return R * temperature * GE * numberOfMolesInPhase; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java index 642e8b872d..5e5b24206e 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java @@ -80,7 +80,7 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phasetype) { + double temperature, double pressure, PhaseType phaseType) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() diff --git a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java index 240639a53a..377b542fbb 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java +++ b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java @@ -64,8 +64,8 @@ public PhaseHydrate clone() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double sum = 1.0; int hydrateStructure = ((ComponentHydrate) getComponent(0)).getHydrateStructure(); @@ -102,9 +102,9 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); setType(PhaseType.HYDRATE); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index 0d137feb5a..ee730b0a10 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -836,12 +836,12 @@ public default void addMolesChemReac(int component, double dn) { * @param temperature a double * @param A a double * @param B a double - * @param phase a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ - double molarVolume(double pressure, double temperature, double A, double B, int phase) + double molarVolume(double pressure, double temperature, double A, double B, PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException; /** diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java index d4b0f09030..d6255cd443 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java @@ -92,9 +92,9 @@ public void reInitFurstParam() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type == 0) { electrolyteMixingRule = mixSelect.getElectrolyteMixingRule(this); } @@ -497,12 +497,12 @@ public double calcShieldingParameter() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { // double BonV = phase== 0 ? // 2.0/(2.0+temperature/getPseudoCriticalTemperature()):0.1*pressure*getB()/(numberOfMolesInPhase*temperature*R); - double BonV = phase == 0 ? 0.99 : 1e-5; + double BonV = phaseType.getValue() == 0 ? 0.99 : 1e-5; if (BonV < 0) { BonV = 1.0e-6; @@ -547,8 +547,9 @@ public double molarVolume(double pressure, double temperature, double A, double double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { logger.info("volume correction needed...."); - BonV = phase == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java index c612b3ba24..eab7f81ecb 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java +++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java @@ -108,9 +108,9 @@ public PhaseModifiedFurstElectrolyteEosMod2004 clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type == 0) { electrolyteMixingRule = mixSelect.getElectrolyteMixingRule(this); } @@ -503,12 +503,12 @@ public double calcShieldingParameter() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { // double BonV = phase== 0 ? // 2.0/(2.0+temperature/getPseudoCriticalTemperature()):0.1*pressure*getB()/(numberOfMolesInPhase*temperature*R); - double BonV = phase == 0 ? 0.99 : 1e-5; + double BonV = phaseType.getValue() == 0 ? 0.99 : 1e-5; if (BonV < 0) { BonV = 1.0e-6; @@ -553,8 +553,9 @@ public double molarVolume(double pressure, double temperature, double A, double double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { logger.info("volume correction needed...."); - BonV = phase == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java index cacc66cb4c..7021a89658 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java @@ -109,7 +109,7 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { if (type > 0) { for (int i = 0; i < numberOfComponents; i++) { @@ -117,7 +117,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph numberOfComponents, type); } } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } /** @@ -1155,11 +1155,12 @@ public double molarVolume22(double pressure, double temperature, double A, doubl /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phase == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; if (BonV < 0) { BonV = 1.0e-6; diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java index 7333e46b5e..f5d3c4f99c 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java @@ -169,13 +169,13 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { for (int i = 0; i < numberOfComponents; i++) { componentArray[i].Finit(this, temperature, pressure, totalNumberOfMoles, beta, numberOfComponents, type); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } /** {@inheritDoc} */ @@ -1385,11 +1385,12 @@ public double getF2dispZHCdm() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phase == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; if (BonV < 0) { diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java index 82362a6b7e..017547a697 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java @@ -81,7 +81,7 @@ public void volInit() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { if (type == 0) { selfAccociationScheme = new int[numberOfComponents][0][0]; @@ -94,7 +94,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph } } do { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } while (!solveX()); } @@ -373,11 +373,12 @@ public double calc_lngni(int comp) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phase == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; if (BonV < 0) { diff --git a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java index 113f687cb9..08599b05b7 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java @@ -57,12 +57,12 @@ public PhasePrCPA clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { boolean Xsolved = true; int totiter = 0; do { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); // if(getPhaseType()==1) cpaon=0; totiter++; if (cpaon == 1) { @@ -404,7 +404,7 @@ public boolean solveX() { double err = .0; int iter = 0; try { - molarVolume(pressure, temperature, getA(), getB(), pt.getValue()); + molarVolume(pressure, temperature, getA(), getB(), pt); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } diff --git a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java index bff46e0bea..034102c2aa 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java +++ b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java @@ -34,9 +34,9 @@ public PhasePrEosvolcor() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); loc_C = calcC(this, temperature, pressure, numberOfComponents); CT = calcCT(this, temperature, pressure, numberOfComponents); } diff --git a/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java b/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java index 493f6dc85e..ad044fda2b 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java +++ b/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java @@ -42,9 +42,9 @@ public PhasePureComponentSolid clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); setType(PhaseType.SOLID); } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSolid.java b/src/main/java/neqsim/thermo/phase/PhaseSolid.java index fceeba8b86..20a3fdb315 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSolid.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSolid.java @@ -43,9 +43,9 @@ public PhaseSolid clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); setType(PhaseType.SOLID); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java b/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java index 77f865ca18..c03b855a2a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java @@ -36,9 +36,9 @@ public PhaseSolidComplex clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); setType(PhaseType.SOLIDCOMPLEX); } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java index 5bf676152f..a0a1147dc8 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java @@ -119,7 +119,7 @@ public PhaseSrkCPA clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { boolean changedAssosiationStatus = false; @@ -230,11 +230,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph calcDelta(); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type > 0 && isConstantPhaseVolume()) { solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); gcpa = calc_g(); gcpav = calc_lngV(); gcpavv = calc_lngVV(); @@ -247,7 +247,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph if (type > 1) { initCPAMatrix(type); - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } } @@ -679,11 +679,12 @@ public double dFCPAdTdV() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-8; @@ -744,11 +745,11 @@ public double molarVolume(double pressure, double temperature, double A, double } else if (d1 / d2 < -1) { BonV += 0.5 * d1; } else if (d1 > d2) { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // BonV += d2; // double hnew = h + d2 * dh; // if (Math.abs(hnew) > Math.abs(h)) { - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); // } @@ -763,7 +764,7 @@ public double molarVolume(double pressure, double temperature, double A, double // System.out.println(iterations + " BonV " + BonV); BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } } @@ -771,19 +772,19 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } } /* * if (BonV > 0.9999) { if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { // BonV - * = calcRootVolFinder(phasetype); // BonV = molarVolumeChangePhase(pressure, temperature, A, - * B, phasetype); // BonV = 0.9999; // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + * = calcRootVolFinder(phaseType); // BonV = molarVolumeChangePhase(pressure, temperature, A, + * B, phaseType); // BonV = 0.9999; // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * * R); } * * } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0; } else - * { // BonV = calcRootVolFinder(phasetype); // return molarVolumeChangePhase(pressure, - * temperature, A, B, phasetype); // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + * { // BonV = calcRootVolFinder(phaseType); // return molarVolumeChangePhase(pressure, + * temperature, A, B, phaseType); // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * * R); } } */ @@ -797,8 +798,8 @@ public double molarVolume(double pressure, double temperature, double A, double // if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + h + " Z" + Z + " iterations " + iterations + // " BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1221,17 +1222,18 @@ public double calcRootVolFinder(int phase) { * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - int phasetype) throws neqsim.util.exception.IsNaNException, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); - // double BonV = calcRootVolFinder(phasetype); + double BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); + // double BonV = calcRootVolFinder(phaseType); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1293,8 +1295,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1307,8 +1310,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1316,8 +1320,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1329,7 +1334,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phasetype == 0) { molarVolume(pressure, temperature, A, B, 1); + * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); @@ -1453,8 +1458,8 @@ public void setTotalNumberOfAccociationSites(int totalNumberOfAccociationSites) * @param phaseType a int * @param beta a double */ - public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, int phaseType, - double beta) { + public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, + PhaseType phaseType, double beta) { // type = 0 start init, type = 1 gi nye betingelser if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -1531,11 +1536,11 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, PhaseType.byValue(phaseType), beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, PhaseType.byValue(phaseType), beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -1556,10 +1561,10 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phase == 0 ? 1.0 : 1.0e-5; + Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; @@ -2006,21 +2011,22 @@ public boolean solveX2Old(int maxIter) { * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeOld(double pressure, double temperature, double A, double B, - int phasetype) throws neqsim.util.exception.IsNaNException, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phasetype); + // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -2084,8 +2090,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -2098,9 +2105,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // BonV = 0.9999; - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2108,8 +2115,8 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2122,7 +2129,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java index c35709b315..02b45b7093 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java @@ -146,7 +146,7 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -223,11 +223,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -1031,10 +1031,10 @@ public double getGcpa() { * calcRootVolFinder. *
* - * @param phase a int + * @param phaseType a int * @return a double */ - public double calcRootVolFinder(int phase) { + public double calcRootVolFinder(PhaseType phaseType) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; @@ -1074,12 +1074,12 @@ public double calcRootVolFinder(int phase) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phase == 1) { + if (phaseType.getValue() == 1) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phase == 0) { + if (phaseType.getValue() == 0) { break; } } @@ -1097,7 +1097,7 @@ public double calcRootVolFinder(int phase) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phase == 1) { + if (phaseType.getValue() == 1) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1106,16 +1106,17 @@ public double calcRootVolFinder(int phase) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phasetype); + // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -1176,8 +1177,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1190,9 +1192,9 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // BonV = 0.9999; - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1200,8 +1202,8 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1214,7 +1216,7 @@ public double molarVolume(double pressure, double temperature, double A, double if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1246,18 +1248,18 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - int phasetype) throws neqsim.util.exception.IsNaNException, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - // double BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // double BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); - double BonV = calcRootVolFinder(phasetype); + double BonV = calcRootVolFinder(phaseType); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1319,8 +1321,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1333,8 +1336,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1342,8 +1346,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1355,7 +1360,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phasetype == 0) { molarVolume(pressure, temperature, A, B, 1); + * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); @@ -1382,10 +1387,10 @@ public double molarVolumeChangePhase(double pressure, double temperature, double /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phase == 0 ? 1.0 : 1.0e-5; + Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java index 3cbe825ea3..f3fa833591 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java @@ -122,7 +122,7 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -199,11 +199,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -928,10 +928,10 @@ public double getGcpa() { * calcRootVolFinder. * * - * @param phase a int + * @param phaseType a int * @return a double */ - public double calcRootVolFinder(int phase) { + public double calcRootVolFinder(PhaseType phaseType) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; @@ -970,12 +970,12 @@ public double calcRootVolFinder(int phase) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phase == 1) { + if (phaseType.getValue() == 1) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phase == 0) { + if (phaseType.getValue() == 0) { break; } } @@ -993,7 +993,7 @@ public double calcRootVolFinder(int phase) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phase == 1) { + if (phaseType.getValue() == 1) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1002,16 +1002,17 @@ public double calcRootVolFinder(int phase) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phasetype); + // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -1075,8 +1076,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1089,9 +1091,9 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // BonV = 0.9999; - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1099,8 +1101,8 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1113,7 +1115,7 @@ public double molarVolume(double pressure, double temperature, double A, double if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1145,18 +1147,18 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - int phasetype) throws neqsim.util.exception.IsNaNException, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - // double BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // double BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); - double BonV = calcRootVolFinder(phasetype); + double BonV = calcRootVolFinder(phaseType); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1218,8 +1220,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1232,8 +1235,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1241,8 +1245,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1254,7 +1259,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phasetype == 0) { molarVolume(pressure, temperature, A, B, 1); + * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); @@ -1281,10 +1286,10 @@ public double molarVolumeChangePhase(double pressure, double temperature, double /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phase == 0 ? 1.0 : 1.0e-5; + Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseType.java b/src/main/java/neqsim/thermo/phase/PhaseType.java index 359d497d27..2a8895465f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseType.java +++ b/src/main/java/neqsim/thermo/phase/PhaseType.java @@ -6,11 +6,11 @@ /** * Types of phases. */ -public enum PhaseType implements Serializable{ +public enum PhaseType implements Serializable { LIQUID("liquid", 0), GAS("gas", 1), OIL("oil", 2), AQUEOUS("aqueous", 3), HYDRATE("hydrate", 4), WAX("wax", 5), SOLID("solid", 6), SOLIDCOMPLEX("solidComplex", 7); - /** Holder for old style integer phasetype. */ + /** Holder for old style integer phaseType. */ private final int value; /** Holder for old style string phasetypename. */ private final String desc; diff --git a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java index 62537b2d51..91186e195b 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java @@ -119,7 +119,7 @@ public PhaseUMRCPA clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { boolean changedAssosiationStatus = false; @@ -230,11 +230,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph calcDelta(); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type > 0 && isConstantPhaseVolume()) { solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); gcpa = calc_g(); gcpav = calc_lngV(); gcpavv = calc_lngVV(); @@ -247,7 +247,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph if (type > 1) { initCPAMatrix(type); - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } } @@ -679,11 +679,12 @@ public double dFCPAdTdV() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, int phasetype) - throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-8; @@ -744,11 +745,11 @@ public double molarVolume(double pressure, double temperature, double A, double } else if (d1 / d2 < -1) { BonV += 0.5 * d1; } else if (d1 > d2) { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // BonV += d2; // double hnew = h + d2 * dh; // if (Math.abs(hnew) > Math.abs(h)) { - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); // } @@ -763,7 +764,7 @@ public double molarVolume(double pressure, double temperature, double A, double // System.out.println(iterations + " BonV " + BonV); BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } } @@ -771,19 +772,19 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } } /* * if (BonV > 0.9999) { if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { // BonV - * = calcRootVolFinder(phasetype); // BonV = molarVolumeChangePhase(pressure, temperature, A, - * B, phasetype); // BonV = 0.9999; // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + * = calcRootVolFinder(phaseType); // BonV = molarVolumeChangePhase(pressure, temperature, A, + * B, phaseType); // BonV = 0.9999; // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * * R); } * * } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0; } else - * { // BonV = calcRootVolFinder(phasetype); // return molarVolumeChangePhase(pressure, - * temperature, A, B, phasetype); // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + * { // BonV = calcRootVolFinder(phaseType); // return molarVolumeChangePhase(pressure, + * temperature, A, B, phaseType); // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * * R); } } */ @@ -797,8 +798,8 @@ public double molarVolume(double pressure, double temperature, double A, double // if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + h + " Z" + Z + " iterations " + iterations + // " BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1221,17 +1222,18 @@ public double calcRootVolFinder(int phase) { * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - int phasetype) throws neqsim.util.exception.IsNaNException, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); - // double BonV = calcRootVolFinder(phasetype); + double BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); + // double BonV = calcRootVolFinder(phaseType); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1293,8 +1295,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1307,8 +1310,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1316,8 +1320,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1329,7 +1334,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phasetype == 0) { molarVolume(pressure, temperature, A, B, 1); + * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); @@ -1453,8 +1458,8 @@ public void setTotalNumberOfAccociationSites(int totalNumberOfAccociationSites) * @param phase a int * @param beta a double */ - public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, - double beta) { + public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, + PhaseType phaseType, double beta) { // type = 0 start init, type = 1 gi ny betingelser if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -1531,11 +1536,11 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -1556,10 +1561,10 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, int phase) - throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phase == 0 ? 1.0 : 1.0e-5; + Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; @@ -2006,21 +2011,22 @@ public boolean solveX2Old(int maxIter) { * @param temperature a double * @param A a double * @param B a double - * @param phasetype a int + * @param phaseType a int * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeOld(double pressure, double temperature, double A, double B, - int phasetype) throws neqsim.util.exception.IsNaNException, + PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = phasetype == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + double BonV = + phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phasetype); + // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -2084,8 +2090,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = + phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -2098,9 +2105,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); // BonV = 0.9999; - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2108,8 +2115,8 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); - // BonV = phasetype == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2122,7 +2129,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phasetype); + // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); diff --git a/src/main/java/neqsim/thermo/phase/PhaseWax.java b/src/main/java/neqsim/thermo/phase/PhaseWax.java index 16f0ef8ed5..afa9d381c0 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseWax.java +++ b/src/main/java/neqsim/thermo/phase/PhaseWax.java @@ -38,9 +38,9 @@ public PhaseWax clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phase, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phase, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); setType(PhaseType.WAX); } diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index d8fe26cbd6..b67bea0097 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -2270,17 +2270,17 @@ public ChemicalReactionOperations getChemicalReactionOperations() { * @param pt PhaseType to look for. * @return True if system contains a phase of requested type. */ - public boolean hasPhaseType(PhaseType pt) { + public boolean hasPhaseType(PhaseType phaseType) { for (int i = 0; i < numberOfPhases; i++) { if (getPhase(i) == null) { continue; } - if (getPhase(i).getType() == pt) { + if (getPhase(i).getType() == phaseType) { return true; } - if (getPhase(i).getPhaseTypeName().equals(pt.getDesc())) { + if (getPhase(i).getPhaseTypeName().equals(phaseType.getDesc())) { logger.error( - "Bug in setting phasetype somewhere. Phasetype and phasetypename should be the same."); + "Bug in setting phaseType somewhere. Phasetype and phasetypename should be the same."); return true; } } @@ -2987,7 +2987,7 @@ public void reInitPhaseType() { } /** - * Re-initialize phasetype, beta and phaseindex arrays, same initialization which is used in + * Re-initialize phaseType, beta and phaseindex arrays, same initialization which is used in * constructor. */ public void reInitPhaseInformation() { From ec861593e05e450d1fd98ec2dc165798db431d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:07:41 +0100 Subject: [PATCH 111/317] refact: phaseType.getValue-> compare with enum type docfix revert --- .../nonLinearSolver/NumericalDerivative.java | 2 +- .../CorrespondingStatesDiffusivity.java | 4 +- .../mixer/StaticPhaseMixer.java | 11 ++-- .../component/ComponentDesmukhMather.java | 2 +- .../neqsim/thermo/component/ComponentGE.java | 2 - .../component/ComponentGEInterface.java | 2 +- .../component/ComponentGENRTLmodifiedHV.java | 2 +- .../component/ComponentGENRTLmodifiedWS.java | 2 +- .../component/ComponentGEUnifacUMRPRU.java | 2 +- .../thermo/component/ComponentGEUniquac.java | 8 +-- .../thermo/component/ComponentGEWilson.java | 4 +- .../thermo/component/ComponentGeDuanSun.java | 6 +- .../neqsim/thermo/phase/PhaseBWRSEos.java | 2 +- .../neqsim/thermo/phase/PhaseCSPsrkEos.java | 2 +- .../thermo/phase/PhaseElectrolyteCPA.java | 56 +++++++++---------- .../thermo/phase/PhaseElectrolyteCPAOld.java | 20 +++---- .../java/neqsim/thermo/phase/PhaseEos.java | 16 +++--- .../java/neqsim/thermo/phase/PhaseGE.java | 2 +- .../neqsim/thermo/phase/PhaseGEInterface.java | 2 +- .../neqsim/thermo/phase/PhaseGERG2004Eos.java | 4 +- .../thermo/phase/PhaseGEUnifacUMRPRU.java | 2 +- .../neqsim/thermo/phase/PhaseInterface.java | 2 +- .../PhaseModifiedFurstElectrolyteEos.java | 10 ++-- ...aseModifiedFurstElectrolyteEosMod2004.java | 10 ++-- .../java/neqsim/thermo/phase/PhasePCSAFT.java | 2 +- .../thermo/phase/PhasePCSAFTRahmat.java | 2 +- .../neqsim/thermo/phase/PhasePCSAFTa.java | 2 +- .../java/neqsim/thermo/phase/PhaseSrkCPA.java | 38 ++++++------- .../phase/PhaseSrkCPA_proceduralMatrices.java | 38 ++++++------- .../thermo/phase/PhaseSrkCPAojAlgo.java | 38 ++++++------- .../java/neqsim/thermo/phase/PhaseType.java | 1 + .../java/neqsim/thermo/phase/PhaseUMRCPA.java | 36 ++++++------ .../neqsim/thermo/phase/PhaseTypeTest.java | 1 + 33 files changed, 169 insertions(+), 164 deletions(-) diff --git a/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java b/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java index d34a147c1f..8697afc9b9 100644 --- a/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java +++ b/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java @@ -97,7 +97,7 @@ public static double fugcoefDiffPres(ComponentInterface component, PhaseInterfac * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public static double fugcoefDiffTemp(ComponentInterface component, PhaseInterface phase, diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/diffusivity/CorrespondingStatesDiffusivity.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/diffusivity/CorrespondingStatesDiffusivity.java index 76289ca209..1dd87eaedc 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/diffusivity/CorrespondingStatesDiffusivity.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/diffusivity/CorrespondingStatesDiffusivity.java @@ -1,5 +1,7 @@ package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.diffusivity; +import neqsim.thermo.phase.PhaseType; + /** ** CorrespondingStatesDiffusivity class. @@ -39,7 +41,7 @@ public CorrespondingStatesDiffusivity( /** {@inheritDoc} */ @Override public double calcBinaryDiffusionCoefficient(int i, int j, int method) { - if (phase.getPhase().getType().getValue() == 0) { + if (phase.getPhase().getType() == PhaseType.LIQUID) { binaryDiffusionCoefficients[i][j] = 1.0e-4 * 9.89e-8 * Math.pow(phase.getViscosity() * 1e3, -0.907) * Math.pow(1.0 / phase.getPhase().getComponents()[i].getNormalLiquidDensity() diff --git a/src/main/java/neqsim/processSimulation/processEquipment/mixer/StaticPhaseMixer.java b/src/main/java/neqsim/processSimulation/processEquipment/mixer/StaticPhaseMixer.java index 78755497c3..af63452eeb 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/mixer/StaticPhaseMixer.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/mixer/StaticPhaseMixer.java @@ -1,6 +1,7 @@ package neqsim.processSimulation.processEquipment.mixer; import java.util.UUID; +import neqsim.thermo.phase.PhaseType; /** *
@@ -47,17 +48,17 @@ public void mixStream() { System.out.println("adding: " + componentName); int numberOfPhases = streams.get(k).getThermoSystem().getNumberOfPhases(); double[] moles = new double[numberOfPhases]; - int[] phaseType = new int[numberOfPhases]; + PhaseType[] phaseType = new PhaseType[numberOfPhases]; // her maa man egentlig sjekke at phase typen er den samme !!! antar at begge er // to fase elle gass - tofase for (int p = 0; p < numberOfPhases; p++) { moles[p] = streams.get(k).getThermoSystem().getPhase(p).getComponents()[i] .getNumberOfMolesInPhase(); - phaseType[p] = streams.get(k).getThermoSystem().getPhase(p).getType().getValue(); + phaseType[p] = streams.get(k).getThermoSystem().getPhase(p).getType(); } if (k == 1) { - phaseType[0] = 0; + phaseType[0] = PhaseType.LIQUID; mixedStream.getThermoSystem().getPhase(1) .setTemperature(streams.get(k).getThermoSystem().getTemperature()); } @@ -77,10 +78,10 @@ public void mixStream() { if (gotComponent) { System.out.println("adding moles starting...."); for (int p = 0; p < numberOfPhases; p++) { - if (phaseType[p] == 0) { + if (phaseType[p] == PhaseType.LIQUID) { System.out.println("adding liq"); mixedStream.getThermoSystem().addComponent(index, moles[p], 1); - } else if (phaseType[p] == 1) { + } else if (phaseType[p] == PhaseType.GAS) { System.out.println("adding gas"); mixedStream.getThermoSystem().addComponent(index, moles[p], 0); } else { diff --git a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java index 0bdda0c6fd..b296609924 100644 --- a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java +++ b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java @@ -74,7 +74,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, diff --git a/src/main/java/neqsim/thermo/component/ComponentGE.java b/src/main/java/neqsim/thermo/component/ComponentGE.java index 9fa1bc9d0c..1290137ef0 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGE.java +++ b/src/main/java/neqsim/thermo/component/ComponentGE.java @@ -10,8 +10,6 @@ import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseGE; import neqsim.thermo.phase.PhaseInterface; -import neqsim.thermo.phase.PhaseType; - /** * diff --git a/src/main/java/neqsim/thermo/component/ComponentGEInterface.java b/src/main/java/neqsim/thermo/component/ComponentGEInterface.java index eaddd7019b..17fd8de3b2 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEInterface.java @@ -27,7 +27,7 @@ public interface ComponentGEInterface extends ComponentInterface { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @param intparam an array of {@link double} objects diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java index a59d95d261..5bf0defcde 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java @@ -54,7 +54,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @param HVgijT an array of {@link double} objects diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java index 3d385cef01..ccd58f2153 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java @@ -60,7 +60,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @param WSalpha an array of {@link double} objects * @param WSgij an array of {@link double} objects * @param WSgijT an array of {@link double} objects diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java index 95242d37af..bfb054703c 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java @@ -520,7 +520,7 @@ public void calcUnifacGroupParamsdT(PhaseInterface phase) { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. */ public void calcGammaNumericalDerivatives(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType phaseType) { diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java index d8c6e8d9dc..ac1fc20d34 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java @@ -79,7 +79,7 @@ public ComponentGEUniquac(String component_name, double moles, double molesInPha * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return Fugacity coefficient */ public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, @@ -107,7 +107,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, @@ -171,7 +171,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, @@ -191,7 +191,7 @@ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, doub * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, diff --git a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java index 0b3c46fc19..ef8b3ea632 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java @@ -40,7 +40,7 @@ public ComponentGEWilson(String component_name, double moles, double molesInPhas * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return Fugacity coefficient */ public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, @@ -60,7 +60,7 @@ public double fugcoef(PhaseInterface phase, int numberOfComponents, double tempe * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, diff --git a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java index e94bc45928..6f8e76817d 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java +++ b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java @@ -51,7 +51,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @return a double @@ -272,7 +272,7 @@ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @return a double @@ -459,7 +459,7 @@ public double fugcoef(PhaseInterface phase) { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @param salinity a double * @return a double */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java b/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java index b70a41120a..cd077e4c16 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java @@ -540,7 +540,7 @@ public double molarVolume2(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); double Btemp = getB(); setMolarVolume(1.0 / BonV * Btemp); // numberOfMolesInPhase; diff --git a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java index 9d9fc71e55..34ae5b2576 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java @@ -215,7 +215,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 0.0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java index a555fcf80b..27a9f61364 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java @@ -830,7 +830,7 @@ public double getGcpa() { * calcRootVolFinder. *
* - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double calcRootVolFinder(PhaseType phaseType) { @@ -871,12 +871,12 @@ public double calcRootVolFinder(PhaseType phaseType) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phaseType.getValue() == 1) { + if (phaseType == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phaseType.getValue() == 0) { + if (phaseType == PhaseType.LIQUID) { break; } } @@ -894,7 +894,7 @@ public double calcRootVolFinder(PhaseType phaseType) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phaseType.getValue() == 1) { + if (phaseType == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -907,7 +907,7 @@ public double molarVolume2(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-8; @@ -971,9 +971,9 @@ public double molarVolume2(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -986,9 +986,9 @@ public double molarVolume2(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -996,9 +996,9 @@ public double molarVolume2(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1036,7 +1036,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; @@ -1105,9 +1105,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1176,7 +1176,7 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -1249,9 +1249,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1264,9 +1264,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1274,9 +1274,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java index 3675fa1c7d..cad11dbce9 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java @@ -539,7 +539,7 @@ public double getGcpa() { * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -548,7 +548,7 @@ public double molarVolume3(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -603,9 +603,9 @@ public double molarVolume3(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -643,7 +643,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -707,9 +707,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -748,7 +748,7 @@ public double molarVolume(double pressure, double temperature, double A, double public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; + Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java index 1429bd8af0..8792f3a032 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java @@ -79,6 +79,8 @@ public void displayInteractionCoefficients(String intType) { @Override public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { + + // Replace with phaseType != PhaseType.GAS? if (phaseType.getValue() > 1) { phaseType = PhaseType.LIQUID; } @@ -193,7 +195,7 @@ public void resetMixingRule(int type) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -202,7 +204,7 @@ public double molarVolume2(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 0.0; @@ -287,7 +289,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -337,9 +339,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += d1 * (0.1); @@ -362,7 +364,7 @@ public double molarVolume(double pressure, double temperature, double A, double changeFase = true; BonVold = 10.0; BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index eb0acea45a..1617e61f45 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -51,7 +51,7 @@ public PhaseGE() { * @param totalNumberOfMoles a double * @param beta a double * @param numberOfComponents a int - * @param phaseType a PhaseType enum + * @param phaseType the PhaseType of the phase. * @param phase a int */ public void init(double temperature, double pressure, double totalNumberOfMoles, double beta, diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java index c440c00718..513cb07ae7 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java @@ -24,7 +24,7 @@ public interface PhaseGEInterface { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a PhaseType enum object + * @param phaseType the PhaseType of the phase. * @return a double */ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, diff --git a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java index 2ee0a91275..56621b9b85 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java @@ -83,12 +83,12 @@ public void setxFracGERG() { @Override public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, double beta) { - IPHASE = phaseType.getValue() == 0 ? -1 : -2; + IPHASE = phaseType == PhaseType.LIQUID ? -1 : -2; super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); setxFracGERG(); if (!okVolume) { - IPHASE = phaseType.getValue() == 0 ? -2 : -1; + IPHASE = phaseType == PhaseType.LIQUID ? -2 : -1; super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); } if (type >= 1) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java index c4b258fb62..41cd4d3a3c 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java @@ -68,7 +68,7 @@ public PhaseGEUnifacUMRPRU(PhaseInterface phase, double[][] alpha, double[][] Di * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. */ public void calcCommontemp(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType phaseType) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index ee730b0a10..72a16bc9ff 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -836,7 +836,7 @@ public default void addMolesChemReac(int component, double dn) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java index d6255cd443..1fa87f3b00 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java @@ -410,7 +410,7 @@ public double calcXLR() { * @return a double */ public double calcGammaLRdV() { - if (pt.getValue() == 1) { + if (pt == PhaseType.GAS) { return 0.0; } // return 0.0; // problem ved ren komponent @@ -502,7 +502,7 @@ public double molarVolume(double pressure, double temperature, double A, double neqsim.util.exception.TooManyIterationsException { // double BonV = phase== 0 ? // 2.0/(2.0+temperature/getPseudoCriticalTemperature()):0.1*pressure*getB()/(numberOfMolesInPhase*temperature*R); - double BonV = phaseType.getValue() == 0 ? 0.99 : 1e-5; + double BonV = phaseType == PhaseType.LIQUID ? 0.99 : 1e-5; if (BonV < 0) { BonV = 1.0e-6; @@ -547,9 +547,9 @@ public double molarVolume(double pressure, double temperature, double A, double double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { logger.info("volume correction needed...."); - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java index eab7f81ecb..f5ab59bd26 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java +++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java @@ -411,7 +411,7 @@ public double calcXLR() { * @return a double */ public double calcGammaLRdV() { - if (pt.getValue() == 1) { + if (pt == PhaseType.GAS) { return 0.0; } // return 0.0; // problem ved ren komponent @@ -508,7 +508,7 @@ public double molarVolume(double pressure, double temperature, double A, double neqsim.util.exception.TooManyIterationsException { // double BonV = phase== 0 ? // 2.0/(2.0+temperature/getPseudoCriticalTemperature()):0.1*pressure*getB()/(numberOfMolesInPhase*temperature*R); - double BonV = phaseType.getValue() == 0 ? 0.99 : 1e-5; + double BonV = phaseType == PhaseType.LIQUID ? 0.99 : 1e-5; if (BonV < 0) { BonV = 1.0e-6; @@ -553,9 +553,9 @@ public double molarVolume(double pressure, double temperature, double A, double double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { logger.info("volume correction needed...."); - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java index 7021a89658..508d42c0a0 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java @@ -1159,7 +1159,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; if (BonV < 0) { diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java index f5d3c4f99c..432c5e400d 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java @@ -1389,7 +1389,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java index 017547a697..599b4858dc 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java @@ -377,7 +377,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java index a0a1147dc8..16472fc8ed 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java @@ -683,7 +683,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -1222,7 +1222,7 @@ public double calcRootVolFinder(int phase) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -1231,7 +1231,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = calcRootVolFinder(phaseType); // double BonVInit = BonV; @@ -1295,9 +1295,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1310,9 +1310,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1320,9 +1320,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1455,7 +1455,7 @@ public void setTotalNumberOfAccociationSites(int totalNumberOfAccociationSites) * @param totalNumberOfMoles a double * @param numberOfComponents a int * @param type a int - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @param beta a double */ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, @@ -1564,7 +1564,7 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; + Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; @@ -2011,7 +2011,7 @@ public boolean solveX2Old(int maxIter) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -2020,7 +2020,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; @@ -2090,9 +2090,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java index 02b45b7093..aa18aea03e 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java @@ -1031,7 +1031,7 @@ public double getGcpa() { * calcRootVolFinder. * * - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double calcRootVolFinder(PhaseType phaseType) { @@ -1074,12 +1074,12 @@ public double calcRootVolFinder(PhaseType phaseType) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phaseType.getValue() == 1) { + if (phaseType == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phaseType.getValue() == 0) { + if (phaseType == PhaseType.LIQUID) { break; } } @@ -1097,7 +1097,7 @@ public double calcRootVolFinder(PhaseType phaseType) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phaseType.getValue() == 1) { + if (phaseType == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1110,7 +1110,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; @@ -1177,9 +1177,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1248,7 +1248,7 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -1321,9 +1321,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1336,9 +1336,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1346,9 +1346,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1390,7 +1390,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; + Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java index f3fa833591..0a4d8bb232 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java @@ -928,7 +928,7 @@ public double getGcpa() { * calcRootVolFinder. * * - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double */ public double calcRootVolFinder(PhaseType phaseType) { @@ -970,12 +970,12 @@ public double calcRootVolFinder(PhaseType phaseType) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phaseType.getValue() == 1) { + if (phaseType == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phaseType.getValue() == 0) { + if (phaseType == PhaseType.LIQUID) { break; } } @@ -993,7 +993,7 @@ public double calcRootVolFinder(PhaseType phaseType) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phaseType.getValue() == 1) { + if (phaseType == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1006,7 +1006,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; @@ -1076,9 +1076,9 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1147,7 +1147,7 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -1220,9 +1220,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1235,9 +1235,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1245,9 +1245,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1289,7 +1289,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; + Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseType.java b/src/main/java/neqsim/thermo/phase/PhaseType.java index 2a8895465f..3b4d09ce17 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseType.java +++ b/src/main/java/neqsim/thermo/phase/PhaseType.java @@ -35,6 +35,7 @@ private PhaseType(String desc, int value) { * * @return Numeric index of phase type */ + @Deprecated public int getValue() { return this.value; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java index 91186e195b..fd6e34d9b5 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java @@ -683,7 +683,7 @@ public double molarVolume(double pressure, double temperature, double A, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -1222,7 +1222,7 @@ public double calcRootVolFinder(int phase) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -1231,7 +1231,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = calcRootVolFinder(phaseType); // double BonVInit = BonV; @@ -1295,9 +1295,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; @@ -1310,9 +1310,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1320,9 +1320,9 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1564,7 +1564,7 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType.getValue() == 0 ? 1.0 : 1.0e-5; + Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; @@ -2011,7 +2011,7 @@ public boolean solveX2Old(int maxIter) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType a int + * @param phaseType the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. @@ -2020,7 +2020,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub PhaseType phaseType) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType.getValue() == 0 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; @@ -2090,9 +2090,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = - phaseType.getValue() == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = phaseType == PhaseType.GAS + ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { BonV += 0.5 * d1; diff --git a/src/test/java/neqsim/thermo/phase/PhaseTypeTest.java b/src/test/java/neqsim/thermo/phase/PhaseTypeTest.java index 857621513e..6261c84b74 100644 --- a/src/test/java/neqsim/thermo/phase/PhaseTypeTest.java +++ b/src/test/java/neqsim/thermo/phase/PhaseTypeTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test; public class PhaseTypeTest { + @SuppressWarnings("deprecation") @Test void testValues() { for (PhaseType pt : PhaseType.values()) { From d3fa756b44952a785833b352f293eed0911ac95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:32:55 +0100 Subject: [PATCH 112/317] refact: rename variables --- .../nonLinearSolver/NumericalDerivative.java | 4 +- .../FirozabadiRamleyInterfaceTension.java | 2 +- .../processEquipment/util/Adjuster.java | 1 + .../processSystem/ProcessSystem.java | 3 + .../component/ComponentDesmukhMather.java | 10 +- .../component/ComponentGEInterface.java | 6 +- .../component/ComponentGENRTLmodifiedHV.java | 12 +- .../component/ComponentGENRTLmodifiedWS.java | 14 +-- .../thermo/component/ComponentGEUnifac.java | 39 +++---- .../component/ComponentGEUnifacPSRK.java | 2 +- .../component/ComponentGEUnifacUMRPRU.java | 10 +- .../thermo/component/ComponentGEUniquac.java | 51 ++++---- .../ComponentGEUniquacmodifiedHV.java | 4 +- .../thermo/component/ComponentGEWilson.java | 17 ++- .../thermo/component/ComponentGeDuanSun.java | 32 ++--- .../thermo/component/ComponentGeNRTL.java | 18 +-- src/main/java/neqsim/thermo/phase/Phase.java | 6 +- .../neqsim/thermo/phase/PhaseBWRSEos.java | 28 ++--- .../neqsim/thermo/phase/PhaseCSPsrkEos.java | 18 +-- .../neqsim/thermo/phase/PhaseDefault.java | 4 +- .../thermo/phase/PhaseDesmukhMather.java | 15 ++- .../neqsim/thermo/phase/PhaseDuanSun.java | 8 +- .../thermo/phase/PhaseElectrolyteCPA.java | 81 ++++++------- .../thermo/phase/PhaseElectrolyteCPAOld.java | 32 +++-- .../java/neqsim/thermo/phase/PhaseEos.java | 36 +++--- .../java/neqsim/thermo/phase/PhaseGE.java | 21 ++-- .../neqsim/thermo/phase/PhaseGEInterface.java | 4 +- .../java/neqsim/thermo/phase/PhaseGENRTL.java | 6 +- .../thermo/phase/PhaseGENRTLmodifiedHV.java | 11 +- .../thermo/phase/PhaseGENRTLmodifiedWS.java | 10 +- .../neqsim/thermo/phase/PhaseGERG2004Eos.java | 14 +-- .../neqsim/thermo/phase/PhaseGEUnifac.java | 10 +- .../thermo/phase/PhaseGEUnifacPSRK.java | 4 +- .../thermo/phase/PhaseGEUnifacUMRPRU.java | 12 +- .../neqsim/thermo/phase/PhaseGEUniquac.java | 6 +- .../phase/PhaseGEUniquacmodifiedHV.java | 5 +- .../neqsim/thermo/phase/PhaseGEWilson.java | 4 +- .../neqsim/thermo/phase/PhaseHydrate.java | 8 +- .../neqsim/thermo/phase/PhaseInterface.java | 4 +- .../PhaseModifiedFurstElectrolyteEos.java | 23 ++-- ...aseModifiedFurstElectrolyteEosMod2004.java | 23 ++-- .../java/neqsim/thermo/phase/PhasePCSAFT.java | 14 +-- .../thermo/phase/PhasePCSAFTRahmat.java | 16 +-- .../neqsim/thermo/phase/PhasePCSAFTa.java | 14 +-- .../java/neqsim/thermo/phase/PhasePrCPA.java | 4 +- .../neqsim/thermo/phase/PhasePrEosvolcor.java | 4 +- .../thermo/phase/PhasePureComponentSolid.java | 4 +- .../java/neqsim/thermo/phase/PhaseSolid.java | 4 +- .../thermo/phase/PhaseSolidComplex.java | 4 +- .../java/neqsim/thermo/phase/PhaseSrkCPA.java | 110 +++++++++--------- .../phase/PhaseSrkCPA_proceduralMatrices.java | 66 +++++------ .../thermo/phase/PhaseSrkCPAojAlgo.java | 66 +++++------ .../java/neqsim/thermo/phase/PhaseType.java | 2 +- .../java/neqsim/thermo/phase/PhaseUMRCPA.java | 110 +++++++++--------- .../java/neqsim/thermo/phase/PhaseWax.java | 4 +- .../neqsim/thermo/system/SystemThermo.java | 10 +- 56 files changed, 503 insertions(+), 547 deletions(-) diff --git a/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java b/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java index 8697afc9b9..606e1eb542 100644 --- a/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java +++ b/src/main/java/neqsim/MathLib/nonLinearSolver/NumericalDerivative.java @@ -97,11 +97,11 @@ public static double fugcoefDiffPres(ComponentInterface component, PhaseInterfac * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ public static double fugcoefDiffTemp(ComponentInterface component, PhaseInterface phase, - int numberOfComponents, double temperature, double pressure, PhaseType phaseType) { + int numberOfComponents, double temperature, double pressure, PhaseType pt) { double ans = 0.000001; // double errt, fac, hh, err = 0.00000000000001; // double h = temperature / 50; diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java index a9a5a73883..e3d90b8883 100644 --- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java +++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/FirozabadiRamleyInterfaceTension.java @@ -68,7 +68,7 @@ public double calcSurfaceTension(int interface1, int interface2) { - system.getPhase(interface1).getPhysicalProperties().getDensity()); double Tr = system.getPhase(interface1).getTemperature() / system.getPhase(interface1).getPseudoCriticalTemperature(); - // System.out.println("deltaDens " + deltaDens + " Tr " + Tr + " phaseType " + + // System.out.println("deltaDens " + deltaDens + " Tr " + Tr + " pt " + // system.getPhase(interface1).getType()); double a1 = 0.0; double b1 = 0.0; diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java b/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java index 93ae48b902..69ce057a1a 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/util/Adjuster.java @@ -70,6 +70,7 @@ public Adjuster(String name) { * @param adjustedEquipment a * {@link neqsim.processSimulation.processEquipment.ProcessEquipmentInterface} object * @param adjstedVariable a {@link java.lang.String} object + * @param unit a string */ public void setAdjustedVariable(ProcessEquipmentInterface adjustedEquipment, String adjstedVariable, String unit) { diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java index 0879fb25bc..00c7679bf8 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java +++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java @@ -100,6 +100,9 @@ public void add(ProcessEquipmentInterface operation) { * add. * * + * @param position a int + * @param operation a {@link neqsim.processSimulation.processEquipment.ProcessEquipmentInterface} + * object */ public void add(int position, ProcessEquipmentInterface operation) { ArrayListdiff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java index 5bf0defcde..2b23b96ffa 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java @@ -38,11 +38,11 @@ public ComponentGENRTLmodifiedHV(String component_name, double moles, double mol /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, - double[][] intparam, String[][] mixRule) { + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij, double[][] intparam, + String[][] mixRule) { double[][] HVgijT = new double[numberOfComponents][numberOfComponents]; - return getGamma(phase, numberOfComponents, temperature, pressure, phaseType, HValpha, HVgij, - HVgijT, intparam, mixRule); + return getGamma(phase, numberOfComponents, temperature, pressure, pt, HValpha, HVgij, HVgijT, + intparam, mixRule); } /** @@ -54,7 +54,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @param HVgijT an array of {@link double} objects @@ -63,7 +63,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, double[][] HVgijT, + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij, double[][] HVgijT, double[][] intparam, String[][] mixRule) { int type = phase.getInitType(); double A = 0; diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java index ccd58f2153..05b57b8ea1 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java @@ -44,11 +44,11 @@ public double getlnGammadn(int k) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] WSalpha, double[][] WSgij, - double[][] intparam, String[][] mixRule) { + double pressure, PhaseType pt, double[][] WSalpha, double[][] WSgij, double[][] intparam, + String[][] mixRule) { double[][] WSgijT = new double[numberOfComponents][numberOfComponents]; - return getGamma(phase, numberOfComponents, temperature, pressure, phaseType, WSalpha, WSgij, - WSgijT, intparam, mixRule); + return getGamma(phase, numberOfComponents, temperature, pressure, pt, WSalpha, WSgij, WSgijT, + intparam, mixRule); } /** @@ -60,7 +60,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @param WSalpha an array of {@link double} objects * @param WSgij an array of {@link double} objects * @param WSgijT an array of {@link double} objects @@ -70,7 +70,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp */ @SuppressWarnings("unused") public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] WSalpha, double[][] WSgij, double[][] WSgijT, + double pressure, PhaseType pt, double[][] WSalpha, double[][] WSgij, double[][] WSgijT, double[][] intparam, String[][] mixRule) { double type = phase.getInitType(); double A = 0; @@ -245,7 +245,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp // dlngammadt = (lngammaold-lngamma)/0.002; // phaseny.getExcessGibbsEnergy(numberOfComponents, temperature, pressure, - // phaseType) + // pt) gamma = Math.exp(lngamma); // if derivates.... diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java index e6a54334ea..370e218fd6 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java @@ -134,10 +134,9 @@ public double getR() { /** {@inheritDoc} */ @Override public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { - fugacityCoefficient = - (this.getGamma(phase, numberOfComponents, temperature, pressure, phaseType) - * this.getAntoineVaporPressure(temperature) / pressure); + double pressure, PhaseType pt) { + fugacityCoefficient = (this.getGamma(phase, numberOfComponents, temperature, pressure, pt) + * this.getAntoineVaporPressure(temperature) / pressure); return fugacityCoefficient; } @@ -190,7 +189,7 @@ public void calclnGammak(int k, PhaseInterface phase) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { + double pressure, PhaseType pt) { double lngammaCombinational = 0.0; double lngammaResidual = 0.0; dlngammadn = new double[numberOfComponents]; @@ -244,37 +243,35 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp /** {@inheritDoc} */ @Override public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { - dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, phaseType)) - - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, phaseType))) - / 0.02; + double pressure, PhaseType pt) { + dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, pt)) + - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, pt))) / 0.02; return dfugdp; } /** {@inheritDoc} */ @Override public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { - dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, phaseType)) - - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, phaseType))) - / 0.02; + double pressure, PhaseType pt) { + dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, pt)) + - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, pt))) / 0.02; return dfugdt; } /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ // NumericalDerivative deriv = new - * NumericalDerivative(); // System.out.println("dfugdP : " + + * double pressure, PhaseType pt){ // NumericalDerivative deriv = new NumericalDerivative(); // + * System.out.println("dfugdP : " + NumericalDerivative.fugcoefDiffPres(this, phase, + * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, temperature, pressure, - * phaseType)); return NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, - * temperature, pressure, phaseType); } + * pt); } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ NumericalDerivative deriv = new NumericalDerivative(); - * // System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, - * numberOfComponents, temperature, pressure, phaseType)); return + * double pressure, PhaseType pt){ NumericalDerivative deriv = new NumericalDerivative(); // + * System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, + * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffTemp(this, phase, numberOfComponents, temperature, pressure, - * phaseType); + * pt); * * } */ diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java index 24de0c5b6f..9feb395127 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifacPSRK.java @@ -143,7 +143,7 @@ public void calclnGammakdT(int k, PhaseInterface phase) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { + double pressure, PhaseType pt) { int initType = phase.getInitType(); double lngammaCombinational = 0.0; double lngammaResidual = 0.0; diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java index bfb054703c..ebe3a6002e 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java @@ -354,7 +354,7 @@ public void calclnGammakdTdT(int k, PhaseInterface phase) { /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { + double pressure, PhaseType pt) { int initType = phase.getInitType(); double lngammaCombinational; double lngammaResidual; @@ -520,22 +520,22 @@ public void calcUnifacGroupParamsdT(PhaseInterface phase) { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. */ public void calcGammaNumericalDerivatives(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { phase.setInitType(1); for (int i = 0; i < phase.getNumberOfComponents(); i++) { double dn = getNumberOfMolesInPhase() / 1e6; phase.addMoles(getComponentNumber(), dn); x = getNumberOfmoles() / getNumberOfMolesInPhase(); - getGamma(phase, numberOfComponents, temperature, pressure, phaseType); + getGamma(phase, numberOfComponents, temperature, pressure, pt); double oldGamma = lngamma; phase.addMoles(getComponentNumber(), dn); x = getNumberOfmoles() / getNumberOfMolesInPhase(); - getGamma(phase, numberOfComponents, temperature, pressure, phaseType); + getGamma(phase, numberOfComponents, temperature, pressure, pt); double dlnGammadn = (oldGamma - lngamma) / dn; // System.out.println("dlnGammadn " + dlnGammadn); diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java index ac1fc20d34..fd4d6b764c 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java @@ -79,22 +79,21 @@ public ComponentGEUniquac(String component_name, double moles, double molesInPha * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return Fugacity coefficient */ public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { - fugacityCoefficient = - (this.getGamma(phase, numberOfComponents, temperature, pressure, phaseType) - * this.getAntoineVaporPressure(temperature) / pressure); + double pressure, PhaseType pt) { + fugacityCoefficient = (this.getGamma(phase, numberOfComponents, temperature, pressure, pt) + * this.getAntoineVaporPressure(temperature) / pressure); return fugacityCoefficient; } /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, - double[][] intparam, String[][] mixRule) { + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij, double[][] intparam, + String[][] mixRule) { return 0.0; } @@ -107,11 +106,11 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { + double pressure, PhaseType pt) { /* * double V = 0, F = 0, a, gammaC = 0, gammaR = 0, temp1 = 0, temp2 = 0, temp3=0, temp4 = 0, * temp5=0, gamma; int j, k; @@ -171,14 +170,13 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { - dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, phaseType)) - - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, phaseType))) - / 0.02; + double pressure, PhaseType pt) { + dfugdp = (Math.log(fugcoef(phase, numberOfComponents, temperature, pressure + 0.01, pt)) + - Math.log(fugcoef(phase, numberOfComponents, temperature, pressure - 0.01, pt))) / 0.02; return dfugdp; } @@ -191,30 +189,29 @@ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, doub * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { - dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, phaseType)) - - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, phaseType))) - / 0.02; + double pressure, PhaseType pt) { + dfugdt = (Math.log(fugcoef(phase, numberOfComponents, temperature + 0.01, pressure, pt)) + - Math.log(fugcoef(phase, numberOfComponents, temperature - 0.01, pressure, pt))) / 0.02; return dfugdt; } /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ // NumericalDerivative deriv = new - * NumericalDerivative(); // System.out.println("dfugdP : " + + * double pressure, PhaseType pt){ // NumericalDerivative deriv = new NumericalDerivative(); // + * System.out.println("dfugdP : " + NumericalDerivative.fugcoefDiffPres(this, phase, + * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, temperature, pressure, - * phaseType)); return NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, - * temperature, pressure, phaseType); } + * pt); } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ NumericalDerivative deriv = new NumericalDerivative(); - * // System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, - * numberOfComponents, temperature, pressure, phaseType)); return + * double pressure, PhaseType pt){ NumericalDerivative deriv = new NumericalDerivative(); // + * System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, + * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffTemp(this, phase, numberOfComponents, temperature, pressure, - * phaseType); + * pt); * * } */ diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java index 364edb98a8..3db257d1c9 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java @@ -34,10 +34,10 @@ public ComponentGEUniquacmodifiedHV(String component_name, double moles, double /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { + double pressure, PhaseType pt) { // PhaseGEInterface phaseny = (PhaseGEInterface) phase.getPhase(); // PhaseGEInterface GEPhase = phaseny.getGEphase(); - return 1; // super.getGamma(GEPhase, numberOfComponents, temperature, pressure, phaseType); + return 1; // super.getGamma(GEPhase, numberOfComponents, temperature, pressure, pt); } } diff --git a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java index ef8b3ea632..bfdf9f6249 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java @@ -40,14 +40,13 @@ public ComponentGEWilson(String component_name, double moles, double molesInPhas * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return Fugacity coefficient */ public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { - fugacityCoefficient = - (this.getGamma(phase, numberOfComponents, temperature, pressure, phaseType) - * this.getAntoineVaporPressure(temperature) / pressure); + double pressure, PhaseType pt) { + fugacityCoefficient = (this.getGamma(phase, numberOfComponents, temperature, pressure, pt) + * this.getAntoineVaporPressure(temperature) / pressure); return fugacityCoefficient; } @@ -60,19 +59,19 @@ public double fugcoef(PhaseInterface phase, int numberOfComponents, double tempe * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { + double pressure, PhaseType pt) { return getWilsonActivityCoefficient(phase); } /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, - double[][] intparam, String[][] mixRule) { + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij, double[][] intparam, + String[][] mixRule) { return 0.0; } diff --git a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java index 6f8e76817d..b8ca99ad39 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java +++ b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java @@ -37,9 +37,9 @@ public ComponentGeDuanSun(String component_name, double moles, double molesInPha /** {@inheritDoc} */ @Override public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, - double[][] intparam, String[][] mixRule) { - return getGamma(phase, numberOfComponents, temperature, pressure, phaseType, HValpha, HVgij); + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij, double[][] intparam, + String[][] mixRule) { + return getGamma(phase, numberOfComponents, temperature, pressure, pt, HValpha, HVgij); } /** @@ -51,13 +51,13 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @return a double */ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij) { + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij) { double type = phase.getInitType(); // double ny = 0, Djj = 0, Dii = 0, gij = 0, gjj = 0, gji = 0, gii = 0, F2T = 0, tot2 = 0; double A = 0; @@ -209,7 +209,7 @@ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double // dlngammadt = (lngammaold-lngamma)/0.002; // phaseny.getExcessGibbsEnergy(numberOfComponents, temperature, pressure, - // phaseType) + // pt) gamma = Math.exp(lngamma); // System.out.println("gamma " +gamma); // if derivates.... @@ -272,13 +272,13 @@ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @param HValpha an array of {@link double} objects * @param HVgij an array of {@link double} objects * @return a double */ public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij) { + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij) { if (componentName.equals("CO2")) { return 0.9; } else if (componentName.equals("water")) { @@ -459,12 +459,12 @@ public double fugcoef(PhaseInterface phase) { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @param salinity a double * @return a double */ public double getGammaPitzer(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double salinity) { + double pressure, PhaseType pt, double salinity) { double P = pressure; double T = temperature; double S = salinity; @@ -519,14 +519,14 @@ public double getGammaPitzer(PhaseInterface phase, int numberOfComponents, doubl ///////////////////////////////////////////////////// /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure+0.01, phaseType))-Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure-0.01, phaseType)))/0.02; return dfugdp; } + * double pressure, PhaseType pt){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, + * temperature, pressure+0.01, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature, + * pressure-0.01, pt)))/0.02; return dfugdp; } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, - * temperature+0.01, pressure, phaseType))-Math.log(fugcoef(phase, numberOfComponents, - * temperature-0.01, pressure, phaseType)))/0.02; return dfugdt; } + * double pressure, PhaseType pt){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, + * temperature+0.01, pressure, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature-0.01, + * pressure, pt)))/0.02; return dfugdt; } */ /** diff --git a/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java b/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java index 76a033f824..e152219511 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java +++ b/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java @@ -36,8 +36,8 @@ public ComponentGeNRTL(String component_name, double moles, double molesInPhase, @Override @SuppressWarnings("unused") public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType, double[][] HValpha, double[][] HVgij, - double[][] intparam, String[][] mixRule) { + double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij, double[][] intparam, + String[][] mixRule) { double type = phase.getInitType(); double A = 0; double B = 0; @@ -201,7 +201,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp // dlngammadt = (lngammaold-lngamma)/0.002; // phaseny.getExcessGibbsEnergy(numberOfComponents, temperature, pressure, - // phaseType) + // pt) gamma = Math.exp(lngamma); // System.out.println("gamma " +gamma); // if derivates.... @@ -257,14 +257,14 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp /* * public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure+0.01, phaseType))-Math.log(fugcoef(phase, numberOfComponents, - * temperature, pressure-0.01, phaseType)))/0.02; return dfugdp; } + * double pressure, PhaseType pt){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, + * temperature, pressure+0.01, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature, + * pressure-0.01, pt)))/0.02; return dfugdp; } * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, - * double pressure, PhaseType phaseType){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, - * temperature+0.01, pressure, phaseType))-Math.log(fugcoef(phase, numberOfComponents, - * temperature-0.01, pressure, phaseType)))/0.02; return dfugdt; } + * double pressure, PhaseType pt){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, + * temperature+0.01, pressure, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature-0.01, + * pressure, pt)))/0.02; return dfugdt; } */ /** diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index 2ea215d8d8..37240454e0 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -403,7 +403,7 @@ public void init() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { if (totalNumberOfMoles <= 0) { throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this, "init", @@ -412,8 +412,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph this.beta = beta; numberOfMolesInPhase = beta * totalNumberOfMoles; - if (this.pt != phaseType) { - setType(phaseType); + if (this.pt != pt) { + setType(pt); // setPhysicalProperties(physicalPropertyType); } this.setInitType(type); diff --git a/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java b/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java index cd077e4c16..c4394f8791 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseBWRSEos.java @@ -51,17 +51,17 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { double oldMolDens = 0; if (type == 0) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); - super.init(totalNumberOfMoles, numberOfComponents, 3, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); + super.init(totalNumberOfMoles, numberOfComponents, 3, pt, beta); return; } do { oldMolDens = getMolarDensity(); - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } while (Math.abs((getMolarDensity() - oldMolDens) / oldMolDens) > 1e-10); getF(); // calcPVT(); @@ -413,7 +413,7 @@ public void calcPVT() { @Override public double getF() { // System.out.println("F " + getFpol()*1e3+ " "+ getFexp()*1e3 + " super " + - // super.getF() + " phaseType " +getType()); + // super.getF() + " pt " +getType()); return (getFpol() + getFexp()) * 1e3; } @@ -439,7 +439,7 @@ public double getdFdN() { getComponent(0).addMoles(dn); init(numberOfMolesInPhase, numberOfComponents, 3, 1.0); // System.out.println("F " + getFpol()*1e3+ " "+ getFexp()*1e3 + " super " + - // super.getF() + " phaseType " +getType()); + // super.getF() + " pt " +getType()); return (fold - fnew) / (2 * dn); } @@ -456,11 +456,11 @@ public double dFdT() { // temperature = temperature + dv; // init(numberOfMolesInPhase, numberOfComponents, 3, pt.getValue(), 1.0); // System.out.println("dFdT " + ((fold-fnew)/(2*dv)) + " super " + - // (getFpoldT()+getFexpdT())*1e3+ " phaseType " +getType()); + // (getFpoldT()+getFexpdT())*1e3+ " pt " +getType()); return (getFpoldT() + getFexpdT()) * 1e3; // (fold-fnew)/(2*dv); // // System.out.println("FT " + getFpoldT()*1e3+ " "+ getFexpdT()*1e3 + " super - // " + super.dFdT() + " phaseType " +getType()); + // " + super.dFdT() + " pt " +getType()); // return (getFpoldT()+getFexpdT())*1e3; } @@ -505,10 +505,10 @@ public double dFdV() { // molarVolume = molarVolume + dv; // System.out.println("dFdV " + ((fold-fnew)/(2*dv)) + " super " + super.dFdV()+ - // " phaseType " +getType()); + // " pt " +getType()); // // return (fold-fnew)/(2*dv); // System.out.println("dFdV " + ((getFpoldV()+getFexpdV()))*1e3*1e-5 + " super " - // + super.dFdV()+ " phaseType " +getType()); + // + super.dFdV()+ " pt " +getType()); // System.out.println("dFdV " + getFpoldV()+getFexpdV()*1e3*1e-5); return (getFpoldV() + getFexpdV()) * 1e3 * 1e-5; } @@ -525,7 +525,7 @@ public double dFdVdV() { setMolarVolume(getMolarVolume() + dv); // System.out.println("dFdV " + ((fold-fnew)/(2*dv)) + " super " + super.dFdV()+ - // " phaseType " +getType()); + // " pt " +getType()); return (fold - fnew) / (2 * dv); // return (getFpoldVdV()+getFexpdVdV())*1e3*1e-10; } @@ -536,11 +536,11 @@ public double dFdVdV() { /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); double Btemp = getB(); setMolarVolume(1.0 / BonV * Btemp); // numberOfMolesInPhase; diff --git a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java index 34ae5b2576..8c025078c5 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java @@ -65,17 +65,17 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { double oldtemp = temperature; if (type == 0) { - refBWRSPhase.init(1.0, 1, 0, phaseType, 1.0); - refBWRSPhase.init(1.0, 1, 3, phaseType, 1.0); + refBWRSPhase.init(1.0, 1, 0, pt, 1.0); + refBWRSPhase.init(1.0, 1, 3, pt, 1.0); } else { - refBWRSPhase.init(1.0, 1, 3, phaseType, 1.0); + refBWRSPhase.init(1.0, 1, 3, pt, 1.0); } do { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); oldtemp = refBWRSPhase.getTemperature(); h_scale_mix = getNumberOfMolesInPhase() * getb() / brefBWRSPhase; double term1 = getA() / ((ComponentEosInterface) refBWRSPhase.getComponent(0)).getaT(); @@ -84,7 +84,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph refBWRSPhase.setMolarVolume(getTotalVolume() / h_scale_mix); // refBWRSPhase.setPressure(refBWRSPhase.calcPressure()); refBWRSPhase.setPressure(pressure * h_scale_mix / f_scale_mix); - refBWRSPhase.init(1.0, 1, type, phaseType, 1.0); + refBWRSPhase.init(1.0, 1, type, pt, 1.0); } while (Math.abs((oldtemp - refBWRSPhase.getTemperature()) / oldtemp) > 1e-8); } @@ -211,11 +211,11 @@ public void setRefBWRSPhase(neqsim.thermo.phase.PhaseBWRSEos refBWRSPhase) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 0.0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseDefault.java b/src/main/java/neqsim/thermo/phase/PhaseDefault.java index 20f47f6e8a..8de7d91c5a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDefault.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDefault.java @@ -59,8 +59,8 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { return 1.0; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java index e2c6920ac2..cda993906d 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java @@ -39,12 +39,11 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int initType, - PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, initType, phaseType, beta); + public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt, + double beta) { + super.init(totalNumberOfMoles, numberOfComponents, initType, pt, beta); if (initType != 0) { - setType(phaseType); - // phaseTypeName = phase == 0 ? "liquid" : "gas"; + setType(pt); } setMolarVolume(0.980e-3 * getMolarMass() * 1e5); Z = pressure * getMolarVolume() / (R * temperature); @@ -171,18 +170,18 @@ public double getGibbsEnergy() { @Override public double getExcessGibbsEnergy() { // double GE = getExcessGibbsEnergy(this, numberOfComponents, temperature, - // pressure, phaseType); + // pressure, pt); return GE; } /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentDesmukhMather) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); + .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } // System.out.println("ge " + GE); return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java index ed79991fe4..2978c7f7be 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java @@ -63,14 +63,14 @@ public void setDij(double[][] Dij) { @Override public double getExcessGibbsEnergy() { // double GE = getExcessGibbsEnergy(this, numberOfComponents, temperature, - // pressure, phaseType); + // pressure, pt); return GE; } /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { GE = 0; double salinity = 0.0; // double k=0.0; @@ -98,9 +98,9 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, for (int i = 0; i < numberOfComponents; i++) { // GE += phase.getComponents()[i].getx()*Math.log(((ComponentGeDuanSun) // componentArray[i]).getGammaNRTL(phase, numberOfComponents, temperature, pressure, - // phaseType, alpha, Dij)); + // pt, alpha, Dij)); GE += phase.getComponents()[i].getx() * Math.log(((ComponentGeDuanSun) componentArray[i]) - .getGammaPitzer(phase, numberOfComponents, temperature, pressure, phaseType, salinity)); + .getGammaPitzer(phase, numberOfComponents, temperature, pressure, pt, salinity)); } return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java index 27a9f61364..2b3ef0d00a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java @@ -10,8 +10,6 @@ import neqsim.thermo.component.ComponentElectrolyteCPA; import neqsim.thermo.mixingRule.CPAMixing; import neqsim.thermo.mixingRule.CPAMixingInterface; -import neqsim.thermo.phase.PhaseType; -import neqsim.thermo.phase.PhaseType; /** @@ -107,7 +105,7 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -185,12 +183,12 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type > 0 && isConstantPhaseVolume()) { volInit(); calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -206,9 +204,9 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph volInit(); initCPAMatrix(type); // hcpatotdT = calc_hCPAdT(); - // super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + // super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } /** @@ -830,17 +828,17 @@ public double getGcpa() { * calcRootVolFinder. *
* - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ - public double calcRootVolFinder(PhaseType phaseType) { + public double calcRootVolFinder(PhaseType pt) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; // double[][] matrix = new double[2][2000]; double BonV = 1.0 - 1e-10; try { - // molarVolume(pressure, temperature, A, B, phaseType); + // molarVolume(pressure, temperature, A, B, pt); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } @@ -871,12 +869,12 @@ public double calcRootVolFinder(PhaseType phaseType) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phaseType == PhaseType.GAS) { + if (pt == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phaseType == PhaseType.LIQUID) { + if (pt == PhaseType.LIQUID) { break; } } @@ -894,7 +892,7 @@ public double calcRootVolFinder(PhaseType phaseType) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phaseType == PhaseType.GAS) { + if (pt == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -903,11 +901,11 @@ public double calcRootVolFinder(PhaseType phaseType) { /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 1.0e-8; @@ -971,8 +969,7 @@ public double molarVolume2(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -986,8 +983,7 @@ public double molarVolume2(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -996,8 +992,7 @@ public double molarVolume2(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1032,17 +1027,17 @@ public double molarVolume2(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); + // double calcRooBonVtVolFinder = calcRootVolFinder(pt); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV <= 0) { @@ -1105,8 +1100,7 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1120,9 +1114,9 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); // BonV = 0.9999; - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1130,8 +1124,8 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + return molarVolumeChangePhase(pressure, temperature, A, B, pt); + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1144,7 +1138,7 @@ public double molarVolume(double pressure, double temperature, double A, double if (Math.abs(h) > 1e-9) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1176,18 +1170,18 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - // double BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // double BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); - double BonV = calcRootVolFinder(phaseType); + double BonV = calcRootVolFinder(pt); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1249,8 +1243,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1264,8 +1257,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1274,8 +1266,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1288,8 +1279,8 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); - * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } + * if (Math.abs(h) > 1e-8) { if (pt == 0) { molarVolume(pressure, temperature, A, B, 1); } else + * { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java index cad11dbce9..dfe125e076 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java @@ -7,8 +7,6 @@ import neqsim.thermo.component.ComponentEosInterface; import neqsim.thermo.mixingRule.CPAMixing; import neqsim.thermo.mixingRule.CPAMixingInterface; -import neqsim.thermo.phase.PhaseType; -import neqsim.thermo.phase.PhaseType; /** @@ -70,7 +68,7 @@ public PhaseElectrolyteCPAOld clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { if (type == 0) { selfAccociationScheme = new int[numberOfComponents][0][0]; @@ -83,7 +81,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph } } do { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } while (!solveX()); // System.out.println("test1 " + dFCPAdT()); @@ -539,16 +537,16 @@ public double getGcpa() { * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ - public double molarVolume3(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume3(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -603,8 +601,7 @@ public double molarVolume3(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -639,11 +636,11 @@ public double molarVolume3(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -707,8 +704,7 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -745,10 +741,10 @@ public double molarVolume(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; + Z = pt == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java index 8792f3a032..f468d0f47a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java @@ -77,18 +77,18 @@ public void displayInteractionCoefficients(String intType) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - // Replace with phaseType != PhaseType.GAS? - if (phaseType.getValue() > 1) { - phaseType = PhaseType.LIQUID; + // Replace with pt != PhaseType.GAS? + if (pt.getValue() > 1) { + pt = PhaseType.LIQUID; } if (!mixingRuleDefined) { setMixingRule(1); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type != 0) { loc_B = calcB(this, temperature, pressure, numberOfComponents); @@ -105,7 +105,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph if (calcMolarVolume) { molarVolume = molarVolume(pressure, temperature, getA() / numberOfMolesInPhase / numberOfMolesInPhase, getB() / numberOfMolesInPhase, - phaseType); + pt); } } catch (Exception ex) { logger.error("Failed to solve for molarVolume within the iteration limit."); @@ -195,16 +195,16 @@ public void resetMixingRule(int type) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { BonV = 0.0; @@ -285,11 +285,11 @@ public double molarVolume2(double pressure, double temperature, double A, double /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -339,8 +339,7 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -363,9 +362,8 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations > 150 && error > errorOld && !changeFase) { changeFase = true; BonVold = 10.0; - BonV = - phaseType == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); } setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase); @@ -783,7 +781,7 @@ public double fv() { } // NYE metoder fredag 25.08.public double dFdN(PhaseInterface phase, int - // numberOfComponents, double temperature, double pressure, PhaseType phaseType){ + // numberOfComponents, double temperature, double pressure, PhaseType pt){ /** {@inheritDoc} */ @Override public double FnV() { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index 1617e61f45..1e48be4610 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -51,20 +51,20 @@ public PhaseGE() { * @param totalNumberOfMoles a double * @param beta a double * @param numberOfComponents a int - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @param phase a int */ public void init(double temperature, double pressure, double totalNumberOfMoles, double beta, - int numberOfComponents, PhaseType phaseType, int phase) { + int numberOfComponents, PhaseType pt, int phase) { if (totalNumberOfMoles <= 0) { new neqsim.util.exception.InvalidInputException(this, "init", "totalNumberOfMoles", "must be larger than zero."); } for (int i = 0; i < numberOfComponents; i++) { // todo: Conflating init type and phase type? - componentArray[i].init(temperature, pressure, totalNumberOfMoles, beta, phaseType.getValue()); + componentArray[i].init(temperature, pressure, totalNumberOfMoles, beta, pt.getValue()); } - this.getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, phaseType); + this.getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, pt); double sumHydrocarbons = 0.0; double sumAqueous = 0.0; @@ -86,11 +86,11 @@ public void init(double temperature, double pressure, double totalNumberOfMoles, /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int initType, - PhaseType phaseType, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, initType, phaseType, beta); + public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt, + double beta) { + super.init(totalNumberOfMoles, numberOfComponents, initType, pt, beta); if (initType != 0) { - getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, phaseType); + getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, pt); } double sumHydrocarbons = 0.0; @@ -135,8 +135,7 @@ public void resetMixingRule(int type) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) { + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) { return 1; } @@ -192,7 +191,7 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { logger.error("this getExcessGibbsEnergy should never be used......."); return 0; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java index 513cb07ae7..7e19dad57f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java @@ -24,9 +24,9 @@ public interface PhaseGEInterface { * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType); + double temperature, double pressure, PhaseType pt); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java index 841c8e6aea..e10e4adb17 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java @@ -101,19 +101,19 @@ public void setDij(double[][] Dij) { @Override public double getExcessGibbsEnergy() { // double GE = getExcessGibbsEnergy(this, numberOfComponents, temperature, - // pressure, phaseType); + // pressure, pt); return GE; } /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); + temperature, pressure, pt, alpha, Dij, intparam, mixRule)); } return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java index 2d194789d4..e8bdf976e8 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java @@ -8,7 +8,6 @@ import neqsim.thermo.component.ComponentGEInterface; import neqsim.thermo.component.ComponentGENRTLmodifiedHV; -import neqsim.thermo.phase.PhaseType; /** @@ -127,17 +126,17 @@ public void setDijT(double[][] DijT) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { if (type == 0) { - GE += phase.getComponents()[i].getx() * Math - .log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); + GE += phase.getComponents()[i].getx() + * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, + numberOfComponents, temperature, pressure, pt, alpha, Dij, intparam, mixRule)); } else if (type == 1) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGENRTLmodifiedHV) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phaseType, alpha, Dij, DijT, intparam, mixRule)); + temperature, pressure, pt, alpha, Dij, DijT, intparam, mixRule)); } } return (R * phase.getTemperature() * GE) * phase.getNumberOfMolesInPhase(); diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java index c512ef7487..05d95f1f26 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java @@ -94,18 +94,18 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { double GE = 0; for (int i = 0; i < numberOfComponents; i++) { if (type == 0) { - GE += phase.getComponents()[i].getx() * Math - .log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); + GE += phase.getComponents()[i].getx() + * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, + numberOfComponents, temperature, pressure, pt, alpha, Dij, intparam, mixRule)); } if (type == 1) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGENRTLmodifiedWS) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phaseType, alpha, Dij, DijT, intparam, mixRule)); + temperature, pressure, pt, alpha, Dij, DijT, intparam, mixRule)); } } return R * temperature * GE * numberOfMolesInPhase; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java index 56621b9b85..4fe70e383f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java @@ -81,15 +81,15 @@ public void setxFracGERG() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - IPHASE = phaseType == PhaseType.LIQUID ? -1 : -2; - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + IPHASE = pt == PhaseType.LIQUID ? -1 : -2; + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); setxFracGERG(); if (!okVolume) { - IPHASE = phaseType == PhaseType.LIQUID ? -2 : -1; - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + IPHASE = pt == PhaseType.LIQUID ? -2 : -1; + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } if (type >= 1) { double[] temp = new double[18]; @@ -137,7 +137,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph // xFracGERG[0],xFracGERG[1],xFracGERG[2],xFracGERG[3],xFracGERG[4],xFracGERG[5],xFracGERG[6],xFracGERG[7],xFracGERG[8],xFracGERG[9],xFracGERG[10],xFracGERG[11],xFracGERG[12],xFracGERG[13],xFracGERG[14],xFracGERG[15],xFracGERG[16],xFracGERG[17],IPHASE); CvGERG = alloTPX[5]; // gergEOS.CPOTPX(temperature,pressure/10.0, // xFracGERG[0],xFracGERG[1],xFracGERG[2],xFracGERG[3],xFracGERG[4],xFracGERG[5],xFracGERG[6],xFracGERG[7],xFracGERG[8],xFracGERG[9],xFracGERG[10],xFracGERG[11],xFracGERG[12],xFracGERG[13],xFracGERG[14],xFracGERG[15],xFracGERG[16],xFracGERG[17],IPHASE); - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } } @@ -186,7 +186,7 @@ public double getCv() { /** {@inheritDoc} */ @Override public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double temp = GERG2004EOS.ZOTPX(temperature, pressure / 10.0, xFracGERG[0], xFracGERG[1], xFracGERG[2], xFracGERG[3], xFracGERG[4], xFracGERG[5], xFracGERG[6], xFracGERG[7], diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java index 02c88fea79..cb64d76d52 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java @@ -81,12 +81,12 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { // if(type==0) calcaij(); - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type == 0) { - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); } } @@ -189,11 +189,11 @@ public double getExcessGibbsEnergy() { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { double GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); + .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java index 11499a8a5a..3171221a5a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java @@ -74,11 +74,11 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { double GE = 0.0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); + .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); // phase.getNumberOfMolesInPhase()* } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java index 41cd4d3a3c..6cb88f6f38 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java @@ -68,10 +68,10 @@ public PhaseGEUnifacUMRPRU(PhaseInterface phase, double[][] alpha, double[][] Di * @param numberOfComponents a int * @param temperature a double * @param pressure a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. */ public void calcCommontemp(PhaseInterface phase, int numberOfComponents, double temperature, - double pressure, PhaseType phaseType) { + double pressure, PhaseType pt) { FCommontemp = 0; VCommontemp = 0; ComponentGEUnifac[] compArray = (ComponentGEUnifac[]) phase.getcomponentArray(); @@ -111,11 +111,11 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { double GE = 0.0; - calcCommontemp(phase, numberOfComponents, temperature, pressure, phaseType); + calcCommontemp(phase, numberOfComponents, temperature, pressure, pt); // ((ComponentGEUnifacUMRPRU) phase.getComponents()[0]).commonInit(phase, numberOfComponents, - // temperature, pressure, phaseType); + // temperature, pressure, pt); initQmix(); if (getInitType() > 2) { @@ -123,7 +123,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, } for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) - .getGamma(phase, numberOfComponents, temperature, pressure, phaseType)); + .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java index 9397f6df51..1538d546be 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java @@ -82,19 +82,19 @@ public double getGibbsEnergy() { @Override public double getExcessGibbsEnergy() { // GE = getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, - // phaseType); + // pt); return GE; } /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, - temperature, pressure, phaseType, alpha, Dij, intparam, mixRule)); + temperature, pressure, pt, alpha, Dij, intparam, mixRule)); } return R * temperature * numberOfMolesInPhase * GE; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java index 1b4f6bf207..5d76fca720 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java @@ -38,15 +38,14 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { double GE = 0; /* * ComponentGEInterface[] comp_Array = (ComponentGEInterface[]) this.getcomponentArray(); * * for (int i = 0; i < numberOfComponents; i++) { GE = GE + comp_Array[i].getx() * - * Math.log(comp_Array[i].getGamma(phase, numberOfComponents, temperature, pressure, - * phaseType)); } + * Math.log(comp_Array[i].getGamma(phase, numberOfComponents, temperature, pressure, pt)); } */ return R * temperature * GE * numberOfMolesInPhase; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java index 5e5b24206e..0d2bc6704d 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java @@ -73,14 +73,14 @@ public double getGibbsEnergy() { @Override public double getExcessGibbsEnergy() { // GE = getExcessGibbsEnergy(this, numberOfComponents, temperature, pressure, - // phaseType); + // pt); return GE; } /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType phaseType) { + double temperature, double pressure, PhaseType pt) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { GE += phase.getComponents()[i].getx() diff --git a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java index 377b542fbb..7bf0ae9999 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java +++ b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java @@ -64,8 +64,8 @@ public PhaseHydrate clone() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double sum = 1.0; int hydrateStructure = ((ComponentHydrate) getComponent(0)).getHydrateStructure(); @@ -102,9 +102,9 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); setType(PhaseType.HYDRATE); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index 72a16bc9ff..a83b8fa040 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -836,12 +836,12 @@ public default void addMolesChemReac(int component, double dn) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ - double molarVolume(double pressure, double temperature, double A, double B, PhaseType phaseType) + double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException; /** diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java index 1fa87f3b00..c52a2b729c 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java @@ -92,9 +92,9 @@ public void reInitFurstParam() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type == 0) { electrolyteMixingRule = mixSelect.getElectrolyteMixingRule(this); } @@ -432,7 +432,7 @@ public double calcGammaLRdV() { * @return a double */ public double calcShieldingParameter() { - // if(phaseType==1) return 0.0; + // if(pt==1) return 0.0; double df = 0; double f = 0; int ions = 0; @@ -467,7 +467,7 @@ public double calcShieldingParameter() { } // public double calcShieldingParameter2(){ - // if(phaseType==1) return 0.0; + // if(pt==1) return 0.0; // double df=0, f=0; // int ions=0; @@ -497,12 +497,12 @@ public double calcShieldingParameter() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { // double BonV = phase== 0 ? // 2.0/(2.0+temperature/getPseudoCriticalTemperature()):0.1*pressure*getB()/(numberOfMolesInPhase*temperature*R); - double BonV = phaseType == PhaseType.LIQUID ? 0.99 : 1e-5; + double BonV = pt == PhaseType.LIQUID ? 0.99 : 1e-5; if (BonV < 0) { BonV = 1.0e-6; @@ -547,8 +547,7 @@ public double molarVolume(double pressure, double temperature, double A, double double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { logger.info("volume correction needed...."); - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -574,8 +573,8 @@ public double molarVolume(double pressure, double temperature, double A, double throw new neqsim.util.exception.IsNaNException(this, "molarVolume", "Molar volume"); } - // if(phaseType==0) System.out.println("density " + getDensity()); //"BonV: " + - // BonV + " "+" itert: " + iterations +" " + " phase " + phaseType+ " " + h + " + // if(pt==0) System.out.println("density " + getDensity()); //"BonV: " + + // BonV + " "+" itert: " + iterations +" " + " phase " + pt+ " " + h + " // " +dh + " B " + Btemp + " D " + Dtemp + " gv" + gV() + " fv " + fv() + " fvv" // + fVV()); @@ -948,7 +947,7 @@ public double XLRdndn(int i, int j) { * @return a double */ public double XLRdGammaLR() { - // if(phaseType==1) return 0.0; + // if(pt==1) return 0.0; double ans = 0.0; double ans2 = 0.0; for (int i = 0; i < numberOfComponents; i++) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java index f5ab59bd26..df924483f9 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java +++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java @@ -108,9 +108,9 @@ public PhaseModifiedFurstElectrolyteEosMod2004 clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type == 0) { electrolyteMixingRule = mixSelect.getElectrolyteMixingRule(this); } @@ -433,7 +433,7 @@ public double calcGammaLRdV() { * @return a double */ public double calcShieldingParameter() { - // if(phaseType==1) return 0.0; + // if(pt==1) return 0.0; double df = 0; double f = 0; int ions = 0; @@ -468,7 +468,7 @@ public double calcShieldingParameter() { } // public double calcShieldingParameter2(){ - // if(phaseType==1) return 0.0; + // if(pt==1) return 0.0; // double df=0, f=0; // int ions=0; @@ -503,12 +503,12 @@ public double calcShieldingParameter() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { // double BonV = phase== 0 ? // 2.0/(2.0+temperature/getPseudoCriticalTemperature()):0.1*pressure*getB()/(numberOfMolesInPhase*temperature*R); - double BonV = phaseType == PhaseType.LIQUID ? 0.99 : 1e-5; + double BonV = pt == PhaseType.LIQUID ? 0.99 : 1e-5; if (BonV < 0) { BonV = 1.0e-6; @@ -553,8 +553,7 @@ public double molarVolume(double pressure, double temperature, double A, double double hnew = h + d2 * -h / d1; if (Math.abs(hnew) > Math.abs(h)) { logger.info("volume correction needed...."); - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -580,8 +579,8 @@ public double molarVolume(double pressure, double temperature, double A, double throw new neqsim.util.exception.IsNaNException(this, "molarVolume", "Molar volume"); } - // if(phaseType==0) System.out.println("density " + getDensity()); //"BonV: " + - // BonV + " "+" itert: " + iterations +" " + " phase " + phaseType+ " " + h + " + // if(pt==0) System.out.println("density " + getDensity()); //"BonV: " + + // BonV + " "+" itert: " + iterations +" " + " phase " + pt+ " " + h + " // " +dh + " B " + Btemp + " D " + Dtemp + " gv" + gV() + " fv " + fv() + " fvv" // + fVV()); @@ -952,7 +951,7 @@ public double XLRdndn(int i, int j) { * @return a double */ public double XLRdGammaLR() { - // if(phaseType==1) return 0.0; + // if(pt==1) return 0.0; double ans = 0.0; double ans2 = 0.0; for (int i = 0; i < numberOfComponents; i++) { diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java index 508d42c0a0..9da938c60c 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java @@ -109,7 +109,7 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { if (type > 0) { for (int i = 0; i < numberOfComponents; i++) { @@ -117,7 +117,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph numberOfComponents, type); } } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } /** @@ -1155,11 +1155,11 @@ public double molarVolume22(double pressure, double temperature, double A, doubl /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; if (BonV < 0) { @@ -1217,8 +1217,8 @@ public double molarVolume(double pressure, double temperature, double A, double throw new neqsim.util.exception.IsNaNException(this, "molarVolume", "Molar volume"); } - // if(phaseType==0) System.out.println("density " + getDensity()); //"BonV: " + - // BonV + " "+" itert: " + iterations +" " + " phase " + phaseType+ " " + h + " + // if(pt==0) System.out.println("density " + getDensity()); //"BonV: " + + // BonV + " "+" itert: " + iterations +" " + " phase " + pt+ " " + h + " // " +dh + " B " + Btemp + " D " + Dtemp + " gv" + gV() + " fv " + fv() + " fvv" // + fVV()); diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java index 432c5e400d..0d2fcc2c20 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java @@ -169,13 +169,13 @@ public void addComponent(String name, double moles, double molesInPhase, int com /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { for (int i = 0; i < numberOfComponents; i++) { componentArray[i].Finit(this, temperature, pressure, totalNumberOfMoles, beta, numberOfComponents, type); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } /** {@inheritDoc} */ @@ -1385,11 +1385,11 @@ public double getF2dispZHCdm() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; @@ -1470,9 +1470,9 @@ public double molarVolume(double pressure, double temperature, double A, double * } if(iterations>=6000) throw new util.exception.TooManyIterationsException(); * if(Double.isNaN(getMolarVolume())) throw new util.exception.IsNaNException(); * - * // if(phaseType==0) System.out.println("density " + getDensity()); //"BonV: " + BonV + - * " "+" itert: " + iterations +" " + " phase " + phaseType+ " " + h + " " +dh + " B " + - * Btemp + " D " + Dtemp + " gv" + gV() + " fv " + fv() + " fvv" + fVV()); + * // if(pt==0) System.out.println("density " + getDensity()); //"BonV: " + BonV + + * " "+" itert: " + iterations +" " + " phase " + pt+ " " + h + " " +dh + " B " + Btemp + + * " D " + Dtemp + " gv" + gV() + " fv " + fv() + " fvv" + fVV()); */ return getMolarVolume(); } diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java index 599b4858dc..24d730723a 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java @@ -81,7 +81,7 @@ public void volInit() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { if (type == 0) { selfAccociationScheme = new int[numberOfComponents][0][0]; @@ -94,7 +94,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph } } do { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } while (!solveX()); } @@ -373,11 +373,11 @@ public double calc_lngni(int comp) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // double BonV = phase== 0 ? 0.99:1e-5; @@ -454,12 +454,12 @@ public double molarVolume(double pressure, double temperature, double A, double } if (Double.isNaN(getMolarVolume())) { throw new neqsim.util.exception.IsNaNException(this, "molarVolume", "Molar volume"); - // if(phaseType==0) + // if(pt==0) // System.out.println("density " + // getDensity()); //"BonV: " + BonV + " // "+" itert: " + // iterations +" " + " phase " + - // phaseType+ " " + h + + // pt+ " " + h + // " +dh + " B " + Btemp + " D " + // Dtemp + " gv" + gV() // + " fv " + fv() + " fvv" + fVV()); diff --git a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java index 08599b05b7..fef40b79c3 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java @@ -57,12 +57,12 @@ public PhasePrCPA clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { boolean Xsolved = true; int totiter = 0; do { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); // if(getPhaseType()==1) cpaon=0; totiter++; if (cpaon == 1) { diff --git a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java index 034102c2aa..8e32d4a058 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java +++ b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java @@ -34,9 +34,9 @@ public PhasePrEosvolcor() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); loc_C = calcC(this, temperature, pressure, numberOfComponents); CT = calcCT(this, temperature, pressure, numberOfComponents); } diff --git a/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java b/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java index ad044fda2b..54ffd2026c 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java +++ b/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java @@ -42,9 +42,9 @@ public PhasePureComponentSolid clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); setType(PhaseType.SOLID); } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSolid.java b/src/main/java/neqsim/thermo/phase/PhaseSolid.java index 20a3fdb315..cefbd59691 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSolid.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSolid.java @@ -43,9 +43,9 @@ public PhaseSolid clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); setType(PhaseType.SOLID); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java b/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java index c03b855a2a..5e20e9b775 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSolidComplex.java @@ -36,9 +36,9 @@ public PhaseSolidComplex clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); setType(PhaseType.SOLIDCOMPLEX); } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java index 16472fc8ed..53c1c72454 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java @@ -119,7 +119,7 @@ public PhaseSrkCPA clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { boolean changedAssosiationStatus = false; @@ -230,11 +230,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph calcDelta(); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type > 0 && isConstantPhaseVolume()) { solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); gcpa = calc_g(); gcpav = calc_lngV(); gcpavv = calc_lngVV(); @@ -247,7 +247,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph if (type > 1) { initCPAMatrix(type); - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } } @@ -679,11 +679,11 @@ public double dFCPAdTdV() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -745,11 +745,11 @@ public double molarVolume(double pressure, double temperature, double A, double } else if (d1 / d2 < -1) { BonV += 0.5 * d1; } else if (d1 > d2) { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); // BonV += d2; // double hnew = h + d2 * dh; // if (Math.abs(hnew) > Math.abs(h)) { - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); // } @@ -764,7 +764,7 @@ public double molarVolume(double pressure, double temperature, double A, double // System.out.println(iterations + " BonV " + BonV); BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); } } @@ -772,21 +772,20 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); } } /* * if (BonV > 0.9999) { if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { // BonV - * = calcRootVolFinder(phaseType); // BonV = molarVolumeChangePhase(pressure, temperature, A, - * B, phaseType); // BonV = 0.9999; // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + * = calcRootVolFinder(pt); // BonV = molarVolumeChangePhase(pressure, temperature, A, B, pt); + * // BonV = 0.9999; // BonV = pt == 1 ? 2.0 / (2.0 + temperature / * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * * R); } * * } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0; } else - * { // BonV = calcRootVolFinder(phaseType); // return molarVolumeChangePhase(pressure, - * temperature, A, B, phaseType); // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / - * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * - * R); } } + * { // BonV = calcRootVolFinder(pt); // return molarVolumeChangePhase(pressure, temperature, + * A, B, pt); // BonV = pt == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : + * pressure * getB() / (numberOfMolesInPhase * temperature * R); } } */ setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase); Z = pressure * getMolarVolume() / (R * temperature); @@ -798,8 +797,8 @@ public double molarVolume(double pressure, double temperature, double A, double // if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + h + " Z" + Z + " iterations " + iterations + // " BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); // } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1140,17 +1139,17 @@ public double getGcpa() { * calcRootVolFinder. * * - * @param phase a int + * @param pt the PhaseType of the phase. * @return a double */ - public double calcRootVolFinder(int phase) { + public double calcRootVolFinder(PhaseType pt) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; // double[][] matrix = new double[2][2000]; double BonV = 1.0 - 1e-10; try { - // molarVolume(pressure, temperature, A, B, phaseType); + // molarVolume(pressure, temperature, A, B, pt); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } @@ -1183,12 +1182,12 @@ public double calcRootVolFinder(int phase) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phase == 1) { + if (pt == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phase == 0) { + if (pt == PhaseType.LIQUID) { break; } } @@ -1206,7 +1205,7 @@ public double calcRootVolFinder(int phase) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phase == 1) { + if (pt == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1222,18 +1221,17 @@ public double calcRootVolFinder(int phase) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = - phaseType == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); - // double BonV = calcRootVolFinder(phaseType); + double BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); + // double BonV = calcRootVolFinder(pt); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1295,8 +1293,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1310,8 +1307,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1320,8 +1316,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1334,8 +1329,8 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); - * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } + * if (Math.abs(h) > 1e-8) { if (pt == 0) { molarVolume(pressure, temperature, A, B, 1); } else + * { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1455,11 +1450,11 @@ public void setTotalNumberOfAccociationSites(int totalNumberOfAccociationSites) * @param totalNumberOfMoles a double * @param numberOfComponents a int * @param type a int - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @param beta a double */ - public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, - PhaseType phaseType, double beta) { + public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, + double beta) { // type = 0 start init, type = 1 gi nye betingelser if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -1536,11 +1531,11 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -1561,10 +1556,10 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; + Z = pt == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; @@ -2011,22 +2006,22 @@ public boolean solveX2Old(int maxIter) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeOld(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); + // double calcRooBonVtVolFinder = calcRootVolFinder(pt); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -2090,8 +2085,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -2105,9 +2099,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); // BonV = 0.9999; - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2115,8 +2109,8 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2129,7 +2123,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java index aa18aea03e..2d21fbd274 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java @@ -146,7 +146,7 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -223,11 +223,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -1031,17 +1031,17 @@ public double getGcpa() { * calcRootVolFinder. * * - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ - public double calcRootVolFinder(PhaseType phaseType) { + public double calcRootVolFinder(PhaseType pt) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; // double[][] matrix = new double[2][2000]; double BonV = 1.0 - 1e-10; try { - // molarVolume(pressure, temperature, A, B, phaseType); + // molarVolume(pressure, temperature, A, B, pt); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } @@ -1074,12 +1074,12 @@ public double calcRootVolFinder(PhaseType phaseType) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phaseType == PhaseType.GAS) { + if (pt == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phaseType == PhaseType.LIQUID) { + if (pt == PhaseType.LIQUID) { break; } } @@ -1097,7 +1097,7 @@ public double calcRootVolFinder(PhaseType phaseType) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phaseType == PhaseType.GAS) { + if (pt == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1106,17 +1106,17 @@ public double calcRootVolFinder(PhaseType phaseType) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); + // double calcRooBonVtVolFinder = calcRootVolFinder(pt); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -1177,8 +1177,7 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1192,9 +1191,9 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); // BonV = 0.9999; - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1202,8 +1201,8 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1216,7 +1215,7 @@ public double molarVolume(double pressure, double temperature, double A, double if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1248,18 +1247,18 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - // double BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // double BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); - double BonV = calcRootVolFinder(phaseType); + double BonV = calcRootVolFinder(pt); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1321,8 +1320,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1336,8 +1334,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1346,8 +1343,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1360,8 +1356,8 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); - * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } + * if (Math.abs(h) > 1e-8) { if (pt == 0) { molarVolume(pressure, temperature, A, B, 1); } else + * { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1387,10 +1383,10 @@ public double molarVolumeChangePhase(double pressure, double temperature, double /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; + Z = pt == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java index 0a4d8bb232..05f7cdeb55 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPAojAlgo.java @@ -122,7 +122,7 @@ public void setMixingRule(int type) { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -199,11 +199,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -928,17 +928,17 @@ public double getGcpa() { * calcRootVolFinder. * * - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double */ - public double calcRootVolFinder(PhaseType phaseType) { + public double calcRootVolFinder(PhaseType pt) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; // double[][] matrix = new double[2][2000]; double BonV = 1.0 - 1e-10; try { - // molarVolume(pressure, temperature, A, B, phaseType); + // molarVolume(pressure, temperature, A, B, pt); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } @@ -970,12 +970,12 @@ public double calcRootVolFinder(PhaseType phaseType) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phaseType == PhaseType.GAS) { + if (pt == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phaseType == PhaseType.LIQUID) { + if (pt == PhaseType.LIQUID) { break; } } @@ -993,7 +993,7 @@ public double calcRootVolFinder(PhaseType phaseType) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phaseType == PhaseType.GAS) { + if (pt == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1002,17 +1002,17 @@ public double calcRootVolFinder(PhaseType phaseType) { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); + // double calcRooBonVtVolFinder = calcRootVolFinder(pt); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -1076,8 +1076,7 @@ public double molarVolume(double pressure, double temperature, double A, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1091,9 +1090,9 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); // BonV = 0.9999; - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1101,8 +1100,8 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -1115,7 +1114,7 @@ public double molarVolume(double pressure, double temperature, double A, double if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1147,18 +1146,18 @@ public double molarVolume(double pressure, double temperature, double A, double * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - // double BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // double BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); - double BonV = calcRootVolFinder(phaseType); + double BonV = calcRootVolFinder(pt); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1220,8 +1219,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1235,8 +1233,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1245,8 +1242,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1259,8 +1255,8 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); - * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } + * if (Math.abs(h) > 1e-8) { if (pt == 0) { molarVolume(pressure, temperature, A, B, 1); } else + * { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1286,10 +1282,10 @@ public double molarVolumeChangePhase(double pressure, double temperature, double /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; + Z = pt == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; diff --git a/src/main/java/neqsim/thermo/phase/PhaseType.java b/src/main/java/neqsim/thermo/phase/PhaseType.java index 3b4d09ce17..e00b3781fa 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseType.java +++ b/src/main/java/neqsim/thermo/phase/PhaseType.java @@ -10,7 +10,7 @@ public enum PhaseType implements Serializable { LIQUID("liquid", 0), GAS("gas", 1), OIL("oil", 2), AQUEOUS("aqueous", 3), HYDRATE("hydrate", 4), WAX("wax", 5), SOLID("solid", 6), SOLIDCOMPLEX("solidComplex", 7); - /** Holder for old style integer phaseType. */ + /** Holder for old style integer pt. */ private final int value; /** Holder for old style string phasetypename. */ private final String desc; diff --git a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java index fd6e34d9b5..8e644817cd 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java @@ -119,7 +119,7 @@ public PhaseUMRCPA clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { boolean changedAssosiationStatus = false; @@ -230,11 +230,11 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph calcDelta(); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type > 0 && isConstantPhaseVolume()) { solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); gcpa = calc_g(); gcpav = calc_lngV(); gcpavv = calc_lngVV(); @@ -247,7 +247,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph if (type > 1) { initCPAMatrix(type); - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); } } @@ -679,11 +679,11 @@ public double dFCPAdTdV() { /** {@inheritDoc} */ @Override - public double molarVolume(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); if (BonV < 0) { @@ -745,11 +745,11 @@ public double molarVolume(double pressure, double temperature, double A, double } else if (d1 / d2 < -1) { BonV += 0.5 * d1; } else if (d1 > d2) { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); // BonV += d2; // double hnew = h + d2 * dh; // if (Math.abs(hnew) > Math.abs(h)) { - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); // } @@ -764,7 +764,7 @@ public double molarVolume(double pressure, double temperature, double A, double // System.out.println(iterations + " BonV " + BonV); BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); } } @@ -772,21 +772,20 @@ public double molarVolume(double pressure, double temperature, double A, double if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { - return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + return molarVolumeChangePhase(pressure, temperature, A, B, pt); } } /* * if (BonV > 0.9999) { if (iterations < 10) { BonV = (BonVold + BonV) / 2.0; } else { // BonV - * = calcRootVolFinder(phaseType); // BonV = molarVolumeChangePhase(pressure, temperature, A, - * B, phaseType); // BonV = 0.9999; // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + * = calcRootVolFinder(pt); // BonV = molarVolumeChangePhase(pressure, temperature, A, B, pt); + * // BonV = 0.9999; // BonV = pt == 1 ? 2.0 / (2.0 + temperature / * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * * R); } * * } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0; } else - * { // BonV = calcRootVolFinder(phaseType); // return molarVolumeChangePhase(pressure, - * temperature, A, B, phaseType); // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / - * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * - * R); } } + * { // BonV = calcRootVolFinder(pt); // return molarVolumeChangePhase(pressure, temperature, + * A, B, pt); // BonV = pt == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : + * pressure * getB() / (numberOfMolesInPhase * temperature * R); } } */ setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase); Z = pressure * getMolarVolume() / (R * temperature); @@ -798,8 +797,8 @@ public double molarVolume(double pressure, double temperature, double A, double // if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + h + " Z" + Z + " iterations " + iterations + // " BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); // } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1140,17 +1139,17 @@ public double getGcpa() { * calcRootVolFinder. * * - * @param phase a int + * @param pt the PhaseType of the phase. * @return a double */ - public double calcRootVolFinder(int phase) { + public double calcRootVolFinder(PhaseType pt) { double solvedBonVHigh = 0.0; double solvedBonVlow = 1.0; double oldh = 1; // double[][] matrix = new double[2][2000]; double BonV = 1.0 - 1e-10; try { - // molarVolume(pressure, temperature, A, B, phaseType); + // molarVolume(pressure, temperature, A, B, pt); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } @@ -1183,12 +1182,12 @@ public double calcRootVolFinder(int phase) { if (Math.signum(h) * Math.signum(oldh) < 0 && i > 2) { if (solvedBonVlow < 1e-3) { solvedBonVlow = (BonV + BonVold) / 2.0; - if (phase == 1) { + if (pt == PhaseType.GAS) { break; } } else { solvedBonVHigh = (BonV + BonVold) / 2.0; - if (phase == 0) { + if (pt == PhaseType.LIQUID) { break; } } @@ -1206,7 +1205,7 @@ public double calcRootVolFinder(int phase) { // file.setValues(matrix); // file.setOutputFileName("D:/temp/temp2.txt"); // file.createFile(); - if (phase == 1) { + if (pt == PhaseType.GAS) { return solvedBonVlow; } else { return solvedBonVHigh; @@ -1222,18 +1221,17 @@ public double calcRootVolFinder(int phase) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double BonV = - phaseType == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) - : pressure * getB() / (numberOfMolesInPhase * temperature * R); - // double BonV = calcRootVolFinder(phaseType); + double BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + : pressure * getB() / (numberOfMolesInPhase * temperature * R); + // double BonV = calcRootVolFinder(pt); // double BonVInit = BonV; if (BonV < 0) { BonV = 1.0e-8; @@ -1295,8 +1293,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -1310,8 +1307,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1320,8 +1316,7 @@ public double molarVolumeChangePhase(double pressure, double temperature, double if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } @@ -1334,8 +1329,8 @@ public double molarVolumeChangePhase(double pressure, double temperature, double } while ((Math.abs((BonV - BonVold) / BonV) > 1.0e-10) && iterations < 100); /* - * if (Math.abs(h) > 1e-8) { if (phaseType == 0) { molarVolume(pressure, temperature, A, B, 1); - * } else { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } + * if (Math.abs(h) > 1e-8) { if (pt == 0) { molarVolume(pressure, temperature, A, B, 1); } else + * { molarVolume(pressure, temperature, A, B, 0); } return getMolarVolume(); } */ // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); @@ -1455,11 +1450,11 @@ public void setTotalNumberOfAccociationSites(int totalNumberOfAccociationSites) * @param totalNumberOfMoles a double * @param numberOfComponents a int * @param type a int - * @param phase a int + * @param pt a int * @param beta a double */ - public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, - PhaseType phaseType, double beta) { + public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, + double beta) { // type = 0 start init, type = 1 gi ny betingelser if (type == 0) { setTotalNumberOfAccociationSites(0); @@ -1536,11 +1531,11 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type cpamix = cpaSelect.getMixingRule(1, this); } - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); if (type > 0 && isConstantPhaseVolume()) { calcDelta(); solveX(); - super.init(totalNumberOfMoles, numberOfComponents, 1, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, 1, pt, beta); gcpa = calc_g(); // lngcpa = Math.log(gcpa); setGcpav(calc_lngV()); @@ -1561,10 +1556,10 @@ public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type /** {@inheritDoc} */ @Override - public double molarVolume2(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - Z = phaseType == PhaseType.LIQUID ? 1.0 : 1.0e-5; + Z = pt == PhaseType.LIQUID ? 1.0 : 1.0e-5; setMolarVolume(Z * R * temperature / pressure); // super.molarVolume(pressure,temperature, A, B, phase); int iterations = 0; @@ -2011,22 +2006,22 @@ public boolean solveX2Old(int maxIter) { * @param temperature a double * @param A a double * @param B a double - * @param phaseType the PhaseType of the phase. + * @param pt the PhaseType of the phase. * @return a double * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double molarVolumeOld(double pressure, double temperature, double A, double B, - PhaseType phaseType) throws neqsim.util.exception.IsNaNException, + PhaseType pt) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double BonV = - phaseType == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); // if (pressure > 1000) { // BonV = 0.9999; // } - // double calcRooBonVtVolFinder = calcRootVolFinder(phaseType); + // double calcRooBonVtVolFinder = calcRootVolFinder(pt); // BonV = calcRooBonVtVolFinder; // double BonVInit = BonV; if (BonV < 0) { @@ -2090,8 +2085,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub BonV += d2; double hnew = h + d2 * dh; if (Math.abs(hnew) > Math.abs(h)) { - BonV = phaseType == PhaseType.GAS - ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) + BonV = pt == PhaseType.GAS ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature * R); } } else { @@ -2105,9 +2099,9 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = (BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); // BonV = 0.9999; - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2115,8 +2109,8 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (iterations < 3) { BonV = Math.abs(BonVold + BonV) / 2.0; } else { - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); - // BonV = phaseType == 1 ? 2.0 / (2.0 + temperature / + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); + // BonV = pt == 1 ? 2.0 / (2.0 + temperature / // getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * // temperature * R); } @@ -2129,7 +2123,7 @@ public double molarVolumeOld(double pressure, double temperature, double A, doub if (Math.abs(h) > 1e-12) { // System.out.println("h failed " + "Z" + Z + " iterations " + iterations + " // BonV " + BonV); - // return molarVolumeChangePhase(pressure, temperature, A, B, phaseType); + // return molarVolumeChangePhase(pressure, temperature, A, B, pt); } // System.out.println("Z" + Z + " iterations " + iterations + " BonV " + BonV); // System.out.println("pressure " + Z*R*temperature/getMolarVolume()); diff --git a/src/main/java/neqsim/thermo/phase/PhaseWax.java b/src/main/java/neqsim/thermo/phase/PhaseWax.java index afa9d381c0..8f80263a91 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseWax.java +++ b/src/main/java/neqsim/thermo/phase/PhaseWax.java @@ -38,9 +38,9 @@ public PhaseWax clone() { /** {@inheritDoc} */ @Override - public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType phaseType, + public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta) { - super.init(totalNumberOfMoles, numberOfComponents, type, phaseType, beta); + super.init(totalNumberOfMoles, numberOfComponents, type, pt, beta); setType(PhaseType.WAX); } diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index b67bea0097..d8fe26cbd6 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -2270,17 +2270,17 @@ public ChemicalReactionOperations getChemicalReactionOperations() { * @param pt PhaseType to look for. * @return True if system contains a phase of requested type. */ - public boolean hasPhaseType(PhaseType phaseType) { + public boolean hasPhaseType(PhaseType pt) { for (int i = 0; i < numberOfPhases; i++) { if (getPhase(i) == null) { continue; } - if (getPhase(i).getType() == phaseType) { + if (getPhase(i).getType() == pt) { return true; } - if (getPhase(i).getPhaseTypeName().equals(phaseType.getDesc())) { + if (getPhase(i).getPhaseTypeName().equals(pt.getDesc())) { logger.error( - "Bug in setting phaseType somewhere. Phasetype and phasetypename should be the same."); + "Bug in setting phasetype somewhere. Phasetype and phasetypename should be the same."); return true; } } @@ -2987,7 +2987,7 @@ public void reInitPhaseType() { } /** - * Re-initialize phaseType, beta and phaseindex arrays, same initialization which is used in + * Re-initialize phasetype, beta and phaseindex arrays, same initialization which is used in * constructor. */ public void reInitPhaseInformation() { From f3a2a7cd9c943816e8c216c17549b9ee104101b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:12:06 +0100 Subject: [PATCH 113/317] style --- .../java/neqsim/thermo/component/ComponentDesmukhMather.java | 1 - src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java | 1 - src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java | 1 - src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java | 1 - src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java | 2 -- src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java | 2 -- 6 files changed, 8 deletions(-) diff --git a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java index c69bd6ad22..c815ad8c6f 100644 --- a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java +++ b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java @@ -6,7 +6,6 @@ import neqsim.thermo.phase.PhaseInterface; import neqsim.thermo.phase.PhaseType; - /** ** ComponentDesmukhMather class. diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java index 2b3ef0d00a..c811b064fe 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java @@ -11,7 +11,6 @@ import neqsim.thermo.mixingRule.CPAMixing; import neqsim.thermo.mixingRule.CPAMixingInterface; - /** *
* PhaseElectrolyteCPA class. diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java index dfe125e076..7187a6278b 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java @@ -8,7 +8,6 @@ import neqsim.thermo.mixingRule.CPAMixing; import neqsim.thermo.mixingRule.CPAMixingInterface; - /** *
* PhaseElectrolyteCPAOld class. diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java index e8bdf976e8..80b299d004 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java @@ -9,7 +9,6 @@ import neqsim.thermo.component.ComponentGEInterface; import neqsim.thermo.component.ComponentGENRTLmodifiedHV; - /** *
* PhaseGENRTLmodifiedHV class. diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java index 05d95f1f26..6044e0ea8a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java @@ -2,8 +2,6 @@ import neqsim.thermo.component.ComponentGEInterface; import neqsim.thermo.component.ComponentGENRTLmodifiedWS; -import neqsim.thermo.phase.PhaseType; - /** *
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java index cb64d76d52..c2876278e7 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java @@ -8,8 +8,6 @@ import neqsim.thermo.atomElement.UNIFACgroup; import neqsim.thermo.component.ComponentGEUnifac; import neqsim.thermo.component.ComponentGEUniquac; -import neqsim.thermo.phase.PhaseType; - /** *
From 476549194ef60596b62adaae09ed75a722465a0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Mon, 26 Feb 2024 21:29:35 +0100
Subject: [PATCH 114/317] fix: upgrade org.ojalgo:ojalgo from 53.2.0 to 53.3.0
(#931)
Snyk has created this PR to upgrade org.ojalgo:ojalgo from 53.2.0 to 53.3.0.
See this package in Maven Repository:
https://mvnrepository.com/artifact/org.ojalgo/ojalgo/
See this project in Snyk:
https://app.snyk.io/org/neqsim/project/86e71bb0-950f-445f-94e7-32e73d92cca3?utm_source=github&utm_medium=referral&page=upgrade-pr
Co-authored-by: snyk-bot Constructor for SimulationBaseClass.
+ * Constructor for SimulationBaseClass.
+ *
@@ -95,6 +97,25 @@ && getComponents()[k].getComponentName().equals("MDEA")) {
}
}
+ /** {@inheritDoc} */
+ @Override
+ public void setAlpha(double[][] alpha) {
+ throw new UnsupportedOperationException("Unimplemented method 'setAlpha'");
+ }
+
+ /**
+ *
+ * Getter for the field
* Setter for the field
* getBetaDesMatij.
@@ -134,19 +167,6 @@ public double getBetaDesMatij(int i, int j) {
return aij[i][j] + bij[i][j] * temperature;
}
- /**
- *
- * Getter for the field
* Getter for the field
@@ -59,6 +61,12 @@ public void setDij(double[][] Dij) {
}
}
+ /** {@inheritDoc} */
+ @Override
+ public void setDijT(double[][] DijT) {
+ throw new UnsupportedOperationException("Unimplemented method 'setDijT'");
+ }
+
/** {@inheritDoc} */
@Override
public double getExcessGibbsEnergy() {
@@ -111,4 +119,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
public double getGibbsEnergy() {
return R * temperature * numberOfMolesInPhase * (GE + Math.log(pressure));
}
+
+ @Override
+ public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
+ throws IsNaNException, TooManyIterationsException {
+ throw new UnsupportedOperationException("Unimplemented method 'molarVolume'");
+ }
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java
index 1e48be4610..df8797e8a0 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGE.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java
@@ -22,7 +22,7 @@
* @author Even Solbraa
* @version $Id: $Id
*/
-public class PhaseGE extends Phase implements PhaseGEInterface {
+public abstract class PhaseGE extends Phase implements PhaseGEInterface {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(PhaseGE.class);
@@ -133,29 +133,6 @@ public void resetMixingRule(int type) {
mixRuleEos = mixSelect.resetMixingRule(2, this);
}
- /** {@inheritDoc} */
- @Override
- public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) {
- return 1;
- }
-
- /**
- *
- * molarVolumeAnalytic.
- *
- * setAlpha.
- *
- * setDij.
- *
- * setDijT.
- *
+ * setAlpha.
+ *
+ * setDij.
+ *
+ * setDijT.
+ *
@@ -97,6 +99,12 @@ public void setDij(double[][] Dij) {
}
}
+ /** {@inheritDoc} */
+ @Override
+ public void setDijT(double[][] DijT) {
+ throw new UnsupportedOperationException("Unimplemented method 'setDijT'");
+ }
+
/** {@inheritDoc} */
@Override
public double getExcessGibbsEnergy() {
@@ -124,4 +132,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
public double getGibbsEnergy() {
return R * temperature * numberOfMolesInPhase * (GE + Math.log(pressure));
}
+
+ @Override
+ public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
+ throws IsNaNException, TooManyIterationsException {
+ throw new UnsupportedOperationException("Unimplemented method 'molarVolume'");
+ }
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
index 1538d546be..fad0aaa1e2 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
@@ -9,6 +9,8 @@
import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEInterface;
import neqsim.thermo.component.ComponentGEUniquac;
+import neqsim.util.exception.IsNaNException;
+import neqsim.util.exception.TooManyIterationsException;
/**
*
@@ -65,6 +67,24 @@ public PhaseGEUniquac(PhaseInterface phase, double[][] alpha, double[][] Dij, St
}
}
+ /** {@inheritDoc} */
+ @Override
+ public void setAlpha(double[][] alpha) {
+ throw new UnsupportedOperationException("Unimplemented method 'setAlpha'");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setDij(double[][] Dij) {
+ throw new UnsupportedOperationException("Unimplemented method 'setDij'");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setDijT(double[][] DijT) {
+ throw new UnsupportedOperationException("Unimplemented method 'setDijT'");
+ }
+
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
@@ -99,4 +119,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
return R * temperature * numberOfMolesInPhase * GE;
}
+
+ @Override
+ public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
+ throws IsNaNException, TooManyIterationsException {
+ throw new UnsupportedOperationException("Unimplemented method 'molarVolume'");
+ }
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
index 0d2bc6704d..19580771f4 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
@@ -2,6 +2,8 @@
import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.component.ComponentGEWilson;
+import neqsim.util.exception.IsNaNException;
+import neqsim.util.exception.TooManyIterationsException;
/**
*
@@ -50,6 +52,24 @@ public PhaseGEWilson(PhaseInterface phase, double[][] alpha, double[][] Dij, Str
}
}
+ /** {@inheritDoc} */
+ @Override
+ public void setAlpha(double[][] alpha) {
+ throw new UnsupportedOperationException("Unimplemented method 'setAlpha'");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setDij(double[][] Dij) {
+ throw new UnsupportedOperationException("Unimplemented method 'setDij'");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setDijT(double[][] DijT) {
+ throw new UnsupportedOperationException("Unimplemented method 'setDijT'");
+ }
+
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
@@ -89,4 +109,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
return R * temperature * numberOfMolesInPhase * GE;
}
+
+ @Override
+ public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
+ throws IsNaNException, TooManyIterationsException {
+ throw new UnsupportedOperationException("Unimplemented method 'molarVolume'");
+ }
}
diff --git a/src/main/java/neqsim/util/exception/NotImplementedException.java b/src/main/java/neqsim/util/exception/NotImplementedException.java
new file mode 100644
index 0000000000..8b6856e9d0
--- /dev/null
+++ b/src/main/java/neqsim/util/exception/NotImplementedException.java
@@ -0,0 +1,32 @@
+package neqsim.util.exception;
+
+/**
+ *
+ * NotImplementedException class.
+ *
- * main.
- *
@@ -832,10 +833,10 @@ public void init(double temperature, double pressure, double totalNumberOfMoles,
* @param totalNumberOfMoles a double
* @param beta a double
* @param numberOfComponents a int
- * @param type a int
+ * @param initType a int
*/
public void Finit(PhaseInterface phase, double temperature, double pressure,
- double totalNumberOfMoles, double beta, int numberOfComponents, int type);
+ double totalNumberOfMoles, double beta, int numberOfComponents, int initType);
/**
*
diff --git a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java
index a540514c71..0030192074 100644
--- a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java
+++ b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java
@@ -81,8 +81,9 @@ public ComponentModifiedFurstElectrolyteEos(String component_name, double moles,
if (ionicCharge != 0) {
setIsIon(true);
}
- b = ionicCharge != 0 ? (neqsim.thermo.util.constants.FurstElectrolyteConstants.furstParams[0]
- * Math.pow(getIonicDiameter(), 3.0)
+ b = ionicCharge != 0
+ ? (neqsim.thermo.util.constants.FurstElectrolyteConstants.furstParams[0]
+ * Math.pow(getIonicDiameter(), 3.0)
+ neqsim.thermo.util.constants.FurstElectrolyteConstants.furstParams[1]) * 1e5
: b;
a = ionicCharge != 0 ? 1.0e-35 : a;
@@ -118,8 +119,9 @@ public ComponentModifiedFurstElectrolyteEos(int number, double TC, double PC, do
* aij
.
+ * aij
.
@@ -113,14 +134,26 @@ public void setAij(double[][] alpha) {
* Setter for the field bij
.
* aij
.
- * bij
.
@@ -262,4 +282,10 @@ public double getSolventMolarMass() {
}
return molesMass / moles;
}
+
+ @Override
+ public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
+ throws IsNaNException, TooManyIterationsException {
+ throw new UnsupportedOperationException("Unimplemented method 'molarVolume'");
+ }
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
index 2978c7f7be..9dbfe21803 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
@@ -1,6 +1,8 @@
package neqsim.thermo.phase;
import neqsim.thermo.component.ComponentGeDuanSun;
+import neqsim.util.exception.IsNaNException;
+import neqsim.util.exception.TooManyIterationsException;
/**
* NotImplementedException
with a standard error message.
+ *
+ * @param className Class that exception is raised from
+ * @param methodName Method that exception is raised from
+ */
+ public NotImplementedException(String className, String methodName) {
+ super(className, methodName, "Function not implemented");
+ }
+
+ /**
+ * Constructs a NotImplementedException
with a standard error message.
+ *
+ * @param obj object that exception is raised from
+ * @param methodName method that exception is raised from
+ */
+ public NotImplementedException(Object obj, String methodName) {
+ this(obj.getClass().getSimpleName(), methodName);
+ }
+}
diff --git a/src/main/java/neqsim/util/exception/ThermoException.java b/src/main/java/neqsim/util/exception/ThermoException.java
index c574e49b0d..11a59874fc 100644
--- a/src/main/java/neqsim/util/exception/ThermoException.java
+++ b/src/main/java/neqsim/util/exception/ThermoException.java
@@ -14,7 +14,7 @@
* @author Even Solbraa
* @version $Id: $Id
*/
-public class ThermoException extends java.lang.Exception {
+public abstract class ThermoException extends java.lang.Exception {
private static final long serialVersionUID = 1000;
/**
From 7e241000464a69861401a801334d2b5805460f69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Tue, 27 Feb 2024 14:44:41 +0100
Subject: [PATCH 116/317] chore: move main function to test
---
.../HydrateInhibitorwtFlash.java | 72 +++++--------------
.../HydrateInhibitorwtFlashTest.java | 48 +++++++++++++
2 files changed, 64 insertions(+), 56 deletions(-)
create mode 100644 src/test/java/neqsim/thermodynamicOperations/flashOps/saturationOps/HydrateInhibitorwtFlashTest.java
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/HydrateInhibitorwtFlash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/HydrateInhibitorwtFlash.java
index 9c1d517a08..8dec603b87 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/HydrateInhibitorwtFlash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/HydrateInhibitorwtFlash.java
@@ -2,8 +2,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import neqsim.thermo.phase.PhaseType;
import neqsim.thermo.system.SystemInterface;
-import neqsim.thermo.system.SystemSrkCPAstatoil;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
/**
@@ -75,22 +75,24 @@ public void run() {
system.init(1);
ops.TPflash();
double wtp = 0.0;
- if (system.hasPhaseType("aqueous")) {
- wtp = system.getPhase("aqueous").getComponent(inhibitor).getx()
- * system.getPhase("aqueous").getComponent(inhibitor).getMolarMass()
- / (system.getPhase("aqueous").getComponent(inhibitor).getx()
- * system.getPhase("aqueous").getComponent(inhibitor).getMolarMass()
- + system.getPhase("aqueous").getComponent("water").getx()
- * system.getPhase("aqueous").getComponent("water").getMolarMass());
+ if (system.hasPhaseType(PhaseType.AQUEOUS)) {
+ // TODO: is this correct? seems to multplying and factoring with the same numbers twice
+ wtp = system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getx()
+ * system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getMolarMass()
+ / (system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getx()
+ * system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getMolarMass()
+ + system.getPhase(PhaseType.AQUEOUS).getComponent("water").getx()
+ * system.getPhase(PhaseType.AQUEOUS).getComponent("water").getMolarMass());
} else {
system.addComponent(inhibitor, system.getTotalNumberOfMoles());
ops.TPflash();
- wtp = system.getPhase("aqueous").getComponent(inhibitor).getx()
- * system.getPhase("aqueous").getComponent(inhibitor).getMolarMass()
- / (system.getPhase("aqueous").getComponent(inhibitor).getx()
- * system.getPhase("aqueous").getComponent(inhibitor).getMolarMass()
- + system.getPhase("aqueous").getComponent("water").getx()
- * system.getPhase("aqueous").getComponent("water").getMolarMass());
+ // TODO: is this correct? seems to multplying and factoring with the same numbers twice
+ wtp = system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getx()
+ * system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getMolarMass()
+ / (system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getx()
+ * system.getPhase(PhaseType.AQUEOUS).getComponent(inhibitor).getMolarMass()
+ + system.getPhase(PhaseType.AQUEOUS).getComponent("water").getx()
+ * system.getPhase(PhaseType.AQUEOUS).getComponent("water").getMolarMass());
}
error = -(wtp - wtfrac);
@@ -99,51 +101,9 @@ public void run() {
logger.error(ex.getMessage(), ex);
}
} while ((Math.abs(error) > 1e-5 && iter < 100) || iter < 3);
- // system.display();
}
/** {@inheritDoc} */
@Override
public void printToFile(String name) {}
-
- /**
- * K
.
* @param totalNumberOfMoles Total number of moles of component.
* @param beta Beta value, i.e.,
- * @param type Init type. Calculate K
, z
, x
if type == 0.
+ * @param initType Init type. Calculate K
, z
, x
if type ==
+ * 0.
*/
public void init(double temperature, double pressure, double totalNumberOfMoles, double beta,
- int type);
+ int initType);
/**
*
diff --git a/src/main/java/neqsim/thermo/component/ComponentKentEisenberg.java b/src/main/java/neqsim/thermo/component/ComponentKentEisenberg.java index 627c598109..a80f5c84a0 100644 --- a/src/main/java/neqsim/thermo/component/ComponentKentEisenberg.java +++ b/src/main/java/neqsim/thermo/component/ComponentKentEisenberg.java @@ -18,14 +18,13 @@ public class ComponentKentEisenberg extends ComponentGeNRTL { * Constructor for ComponentKentEisenberg. *
* - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentKentEisenberg(String component_name, double moles, double molesInPhase, - int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentKentEisenberg(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java index 50cf5dc268..c78ab76363 100644 --- a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java +++ b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java @@ -69,14 +69,14 @@ public class ComponentModifiedFurstElectrolyteEos extends ComponentSrk { * Constructor for ComponentModifiedFurstElectrolyteEos. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentModifiedFurstElectrolyteEos(String component_name, double moles, - double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentModifiedFurstElectrolyteEos(String name, double moles, double molesInPhase, + int compIndex) { + super(name, moles, molesInPhase, compIndex); ionicCoVolume = this.getIonicDiameter(); if (ionicCharge != 0) { setIsIon(true); diff --git a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java index a81ed05b28..077727cad0 100644 --- a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java +++ b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java @@ -69,14 +69,14 @@ public class ComponentModifiedFurstElectrolyteEosMod2004 extends ComponentSrk { * Constructor for ComponentModifiedFurstElectrolyteEosMod2004. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentModifiedFurstElectrolyteEosMod2004(String component_name, double moles, - double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentModifiedFurstElectrolyteEosMod2004(String name, double moles, double molesInPhase, + int compIndex) { + super(name, moles, molesInPhase, compIndex); ionicCoVolume = this.getIonicDiameter(); if (ionicCharge != 0) { setIsIon(true); diff --git a/src/main/java/neqsim/thermo/component/ComponentPCSAFT.java b/src/main/java/neqsim/thermo/component/ComponentPCSAFT.java index 1e70de9022..17fb6c4dc1 100644 --- a/src/main/java/neqsim/thermo/component/ComponentPCSAFT.java +++ b/src/main/java/neqsim/thermo/component/ComponentPCSAFT.java @@ -38,13 +38,13 @@ public class ComponentPCSAFT extends ComponentSrk { * Constructor for ComponentPCSAFT. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentPCSAFT(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentPCSAFT(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); } /** diff --git a/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java b/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java index d8a3a905e4..0b1d6a5164 100644 --- a/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java +++ b/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java @@ -26,14 +26,13 @@ public class ComponentPCSAFTa extends ComponentPCSAFT implements ComponentCPAInt * Constructor for ComponentPCSAFTa. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentPCSAFTa(String component_name, double moles, double molesInPhase, - int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentPCSAFTa(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); xsite = new double[numberOfAssociationSites]; xsitedV = new double[numberOfAssociationSites]; xsiteOld = new double[numberOfAssociationSites]; diff --git a/src/main/java/neqsim/thermo/component/ComponentPR.java b/src/main/java/neqsim/thermo/component/ComponentPR.java index 68e72490c7..239f4d2b2a 100644 --- a/src/main/java/neqsim/thermo/component/ComponentPR.java +++ b/src/main/java/neqsim/thermo/component/ComponentPR.java @@ -18,13 +18,13 @@ public class ComponentPR extends ComponentEos { * Constructor for ComponentPR. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentPR(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentPR(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); a = .45724333333 * R * R * criticalTemperature * criticalTemperature / criticalPressure; b = .077803333 * R * criticalTemperature / criticalPressure; diff --git a/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java b/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java index 7bd36b3cde..204f91649d 100644 --- a/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java +++ b/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java @@ -84,14 +84,13 @@ public double calccTT() { * Constructor for ComponentPRvolcor. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentPRvolcor(String component_name, double moles, double molesInPhase, - int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentPRvolcor(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); c = (0.1154 - 0.4406 * (0.29056 - 0.08775 * getAcentricFactor())) * R * criticalTemperature / criticalPressure; } diff --git a/src/main/java/neqsim/thermo/component/ComponentPrCPA.java b/src/main/java/neqsim/thermo/component/ComponentPrCPA.java index 7fb12c0674..02a8471204 100644 --- a/src/main/java/neqsim/thermo/component/ComponentPrCPA.java +++ b/src/main/java/neqsim/thermo/component/ComponentPrCPA.java @@ -18,13 +18,13 @@ abstract class ComponentPrCPA extends ComponentPR implements ComponentCPAInterfa * Constructor for ComponentPrCPA. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentPrCPA(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentPrCPA(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); xsite = new double[numberOfAssociationSites]; if ((numberOfAssociationSites != 0 || Math.abs(aCPA) > 1e-6) && cpaon == 1) { // System.out.println("ass sites: " + numberOfAssociationSites); diff --git a/src/main/java/neqsim/thermo/component/ComponentRK.java b/src/main/java/neqsim/thermo/component/ComponentRK.java index d9f740ebd1..c6a1f46ac0 100644 --- a/src/main/java/neqsim/thermo/component/ComponentRK.java +++ b/src/main/java/neqsim/thermo/component/ComponentRK.java @@ -18,13 +18,13 @@ public class ComponentRK extends ComponentEos { * Constructor for ComponentRK. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentRK(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentRK(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); a = 1.0 / (9.0 * (Math.pow(2.0, 1.0 / 3.0) - 1.0)) * R * R * criticalTemperature * criticalTemperature / criticalPressure; diff --git a/src/main/java/neqsim/thermo/component/ComponentSolid.java b/src/main/java/neqsim/thermo/component/ComponentSolid.java index e32b817ff7..f1ae85adc5 100644 --- a/src/main/java/neqsim/thermo/component/ComponentSolid.java +++ b/src/main/java/neqsim/thermo/component/ComponentSolid.java @@ -36,13 +36,13 @@ public class ComponentSolid extends ComponentSrk { * Constructor for ComponentSolid. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentSolid(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentSolid(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); } /** diff --git a/src/main/java/neqsim/thermo/component/ComponentSrk.java b/src/main/java/neqsim/thermo/component/ComponentSrk.java index e22bc710a0..691123b0a6 100644 --- a/src/main/java/neqsim/thermo/component/ComponentSrk.java +++ b/src/main/java/neqsim/thermo/component/ComponentSrk.java @@ -21,13 +21,13 @@ public class ComponentSrk extends ComponentEos { * Constructor for ComponentSrk. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentSrk(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentSrk(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); a = 1.0 / (9.0 * (Math.pow(2.0, 1.0 / 3.0) - 1.0)) * R * R * criticalTemperature * criticalTemperature / criticalPressure; diff --git a/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java b/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java index 62b9fc642f..ded33bdb03 100644 --- a/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java +++ b/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java @@ -28,13 +28,13 @@ public class ComponentSrkCPA extends ComponentSrk implements ComponentCPAInterfa * Constructor for ComponentSrkCPA. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentSrkCPA(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentSrkCPA(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); xsite = new double[numberOfAssociationSites]; xsitedni = new double[numberOfAssociationSites][100]; xsitedV = new double[numberOfAssociationSites]; @@ -602,7 +602,7 @@ public double[][] getXsitedni() { * * * @param xNumb a int - * @param compNumbi a int + * @param compIndexi a int * @return a double */ public double getXsitedni(int xNumb, int compNumbi) { diff --git a/src/main/java/neqsim/thermo/component/ComponentSrkCPAs.java b/src/main/java/neqsim/thermo/component/ComponentSrkCPAs.java index 7b42205523..7c4f380d00 100644 --- a/src/main/java/neqsim/thermo/component/ComponentSrkCPAs.java +++ b/src/main/java/neqsim/thermo/component/ComponentSrkCPAs.java @@ -18,14 +18,13 @@ public class ComponentSrkCPAs extends ComponentSrkCPA { * Constructor for ComponentSrkCPAs. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentSrkCPAs(String component_name, double moles, double molesInPhase, - int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentSrkCPAs(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); } /** diff --git a/src/main/java/neqsim/thermo/component/ComponentSrkPeneloux.java b/src/main/java/neqsim/thermo/component/ComponentSrkPeneloux.java index 53af0d495f..7fb974526f 100644 --- a/src/main/java/neqsim/thermo/component/ComponentSrkPeneloux.java +++ b/src/main/java/neqsim/thermo/component/ComponentSrkPeneloux.java @@ -20,14 +20,13 @@ public class ComponentSrkPeneloux extends ComponentSrk { * Constructor for ComponentSrkPeneloux. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentSrkPeneloux(String component_name, double moles, double molesInPhase, - int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentSrkPeneloux(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); a = 1.0 / (9.0 * (Math.pow(2.0, 1.0 / 3.0) - 1.0)) * R * R * criticalTemperature * criticalTemperature / criticalPressure; diff --git a/src/main/java/neqsim/thermo/component/ComponentTST.java b/src/main/java/neqsim/thermo/component/ComponentTST.java index e6e91fc5de..769b5abc34 100644 --- a/src/main/java/neqsim/thermo/component/ComponentTST.java +++ b/src/main/java/neqsim/thermo/component/ComponentTST.java @@ -18,13 +18,13 @@ public class ComponentTST extends ComponentEos { * Constructor for ComponentTST. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentTST(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentTST(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); a = 0.427481 * R * R * criticalTemperature * criticalTemperature / criticalPressure; b = .086641 * R * criticalTemperature / criticalPressure; diff --git a/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java b/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java index f1d656d8a1..dac26096ea 100644 --- a/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java +++ b/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java @@ -28,13 +28,13 @@ public class ComponentUMRCPA extends ComponentPR implements ComponentCPAInterfac * Constructor for ComponentSrkCPA. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentUMRCPA(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentUMRCPA(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); xsite = new double[numberOfAssociationSites]; xsitedni = new double[numberOfAssociationSites][100]; xsitedV = new double[numberOfAssociationSites]; @@ -102,9 +102,8 @@ public ComponentUMRCPA(int number, double TC, double PC, double M, double a, dou /** {@inheritDoc} */ @Override - public void createComponent(String component_name, double moles, double molesInPhase, - int compnumber) { - super.createComponent(component_name, moles, molesInPhase, compnumber); + public void createComponent(String name, double moles, double molesInPhase, int compIndex) { + super.createComponent(name, moles, molesInPhase, compIndex); // criticalTemperature = 305.4; // criticalPressure = 135.62; // acentricFactor = 0.1609; @@ -605,7 +604,7 @@ public double[][] getXsitedni() { * * * @param xNumb a int - * @param compNumbi a int + * @param compIndexi a int * @return a double */ public double getXsitedni(int xNumb, int compNumbi) { diff --git a/src/main/java/neqsim/thermo/component/ComponentWax.java b/src/main/java/neqsim/thermo/component/ComponentWax.java index 856cea95b8..406ce68bdb 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWax.java +++ b/src/main/java/neqsim/thermo/component/ComponentWax.java @@ -25,13 +25,13 @@ public class ComponentWax extends ComponentSolid { * Constructor for ComponentWax. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentWax(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentWax(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java b/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java index e197c37f4a..1d93c5d906 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java +++ b/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java @@ -20,14 +20,13 @@ public class ComponentWaxWilson extends ComponentSolid { * Constructor for ComponentWaxWilson. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentWaxWilson(String component_name, double moles, double molesInPhase, - int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentWaxWilson(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); } /** * {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/component/ComponentWonWax.java b/src/main/java/neqsim/thermo/component/ComponentWonWax.java index adcea3df33..f2dc2ce665 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWonWax.java +++ b/src/main/java/neqsim/thermo/component/ComponentWonWax.java @@ -22,13 +22,13 @@ public class ComponentWonWax extends ComponentSolid { * Constructor for ComponentWonWax. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public ComponentWonWax(String component_name, double moles, double molesInPhase, int compnumber) { - super(component_name, moles, molesInPhase, compnumber); + public ComponentWonWax(String name, double moles, double molesInPhase, int compIndex) { + super(name, moles, molesInPhase, compIndex); } /** {@inheritDoc} */ diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java index 6da9c2e5bc..9341977b5b 100644 --- a/src/test/java/neqsim/thermo/component/NewComponentTest.java +++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java @@ -25,7 +25,7 @@ public void createComponentTest() { p.addComponent("", 0, 0, 0); }); Assertions.assertEquals( - "neqsim.util.exception.InvalidInputException: ComponentSrk:createComponent - Input component_name can not be empty", + "neqsim.util.exception.InvalidInputException: ComponentSrk:createComponent - Input name can not be empty", thrown.getMessage()); RuntimeException thrown_2 = Assertions.assertThrows(RuntimeException.class, () -> { From baa2e7a4e5ae5e70f53c5947d769edb3dc14b913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:22:08 +0100 Subject: [PATCH 126/317] docfix: revert --- .../thermo/component/ComponentElectrolyteCPA.java | 2 +- .../java/neqsim/thermo/component/ComponentEos.java | 10 ++++++++-- .../java/neqsim/thermo/component/ComponentHydrate.java | 2 +- .../neqsim/thermo/component/ComponentHydrateKluda.java | 2 +- .../java/neqsim/thermo/component/ComponentSrkCPA.java | 2 +- .../java/neqsim/thermo/component/ComponentUMRCPA.java | 2 +- src/main/java/neqsim/thermo/phase/PhaseInterface.java | 10 +++++----- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java b/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java index 16b4e62e50..7c2ded05f7 100644 --- a/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java +++ b/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java @@ -600,7 +600,7 @@ public double[][] getXsitedni() { * * * @param xNumb a int - * @param compIndexi a int + * @param compNumbi a int * @return a double */ public double getXsitedni(int xNumb, int compNumbi) { diff --git a/src/main/java/neqsim/thermo/component/ComponentEos.java b/src/main/java/neqsim/thermo/component/ComponentEos.java index 68a3bbc6bb..0ef2e50011 100644 --- a/src/main/java/neqsim/thermo/component/ComponentEos.java +++ b/src/main/java/neqsim/thermo/component/ComponentEos.java @@ -226,6 +226,8 @@ public AttractiveTermInterface getAttractiveTerm() { } /** + * Get reduced temperature. + * * @param temperature temperature of fluid * @return double reduced temperature T/TC */ @@ -234,6 +236,10 @@ public AttractiveTermInterface getAttractiveTerm() { } /** + *+ * Get reduced pressure. + *
+ * * @param pressure pressure in unit bara * @return double */ @@ -732,8 +738,8 @@ public double getdUdVdnS(PhaseInterface phase) { * * * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @param compIndex1 a int - * @param compIndex2 a int + * @param compNumb1 a int + * @param compNumb2 a int * @return a double */ public double getdUdndnSV(PhaseInterface phase, int compNumb1, int compNumb2) { diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrate.java b/src/main/java/neqsim/thermo/component/ComponentHydrate.java index d17f05473d..10da952f7d 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrate.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrate.java @@ -375,7 +375,7 @@ public double calcCKI(int stucture, int cavityType, PhaseInterface phase) { * setRefFug. * * - * @param compIndexm a int + * @param compNumbm a int * @param val a double */ public void setRefFug(int compNumbm, double val) { diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java b/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java index cb8a4b152f..81804aef16 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java @@ -257,7 +257,7 @@ public double calcCKI(int stucture, int cavityType, PhaseInterface phase) { * setRefFug. * * - * @param compIndexm a int + * @param compNumbm a int * @param val a double */ public void setRefFug(int compNumbm, double val) { diff --git a/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java b/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java index ded33bdb03..42d75980c9 100644 --- a/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java +++ b/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java @@ -602,7 +602,7 @@ public double[][] getXsitedni() { * * * @param xNumb a int - * @param compIndexi a int + * @param compNumbi a int * @return a double */ public double getXsitedni(int xNumb, int compNumbi) { diff --git a/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java b/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java index dac26096ea..4b34d043bf 100644 --- a/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java +++ b/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java @@ -604,7 +604,7 @@ public double[][] getXsitedni() { * * * @param xNumb a int - * @param compIndexi a int + * @param compNumbi a int * @return a double */ public double getXsitedni(int xNumb, int compNumbi) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index 28ba1132b5..42e1505986 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -24,12 +24,12 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab * addcomponent. * * - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compIndex Index number of component in phase object component array. */ - public void addComponent(String name, double moles, double molesInPhase, int compNumber); + public void addComponent(String name, double moles, double molesInPhase, int compIndex); /** *@@ -421,10 +421,10 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * removeComponent. *
* - * @param component_name Name of component. + * @param name Name of component. * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. - * @param compnumber Index number of component in phase object component array. + * @param compNumber Index number of component in phase object component array. */ public void removeComponent(String name, double moles, double molesInPhase, int compNumber); From ba8b46e19ffdcc0e5f656fa9b18a653e33b09bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:44:17 +0100 Subject: [PATCH 127/317] refact: remove redundant code --- .../neqsim/thermo/component/ComponentHydrateBallard.java | 7 ------- .../java/neqsim/thermo/component/ComponentHydrateGF.java | 9 +-------- .../neqsim/thermo/component/ComponentHydrateKluda.java | 9 +-------- .../neqsim/thermo/component/ComponentHydratePVTsim.java | 7 ------- .../neqsim/thermo/component/ComponentHydrateStatoil.java | 7 ------- src/main/java/neqsim/thermo/component/ComponentWax.java | 9 +++------ .../java/neqsim/thermo/component/ComponentWaxWilson.java | 5 ++++- .../java/neqsim/thermo/component/ComponentWonWax.java | 3 ++- 8 files changed, 11 insertions(+), 45 deletions(-) diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java b/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java index 90dc51e012..ccf6890e5d 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateBallard.java @@ -48,13 +48,6 @@ public ComponentHydrateBallard(String name, double moles, double molesInPhase, i cavprwat[1][1] = 1.0 / 17.0; } - /** {@inheritDoc} */ - @Override - public double fugcoef(PhaseInterface phase) { - return fugcoef(phase, phase.getNumberOfComponents(), phase.getTemperature(), - phase.getPressure()); - } - /** {@inheritDoc} */ @Override public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, double pres) { diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java b/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java index f253b885ab..dd3f1c106f 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java @@ -15,10 +15,10 @@ */ public class ComponentHydrateGF extends ComponentHydrate { private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(ComponentHydrateGF.class); double[][] Ak = new double[2][2]; // [structure][cavitytype] double[][] Bk = new double[2][2]; // [structure][cavitytype] - static Logger logger = LogManager.getLogger(ComponentHydrateGF.class); /** *@@ -70,13 +70,6 @@ public ComponentHydrateGF(String name, double moles, double molesInPhase, int co } } - /** {@inheritDoc} */ - @Override - public double fugcoef(PhaseInterface phase) { - return fugcoef(phase, phase.getNumberOfComponents(), phase.getTemperature(), - phase.getPressure()); - } - /** {@inheritDoc} */ @Override public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, double pres) { diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java b/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java index 81804aef16..be9c652bd1 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java @@ -15,6 +15,7 @@ */ public class ComponentHydrateKluda extends Component { private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(ComponentHydrateKluda.class); double par1_struc1 = 17.44; double par2_struc1 = -6003.9; @@ -26,7 +27,6 @@ public class ComponentHydrateKluda extends Component { double[][] cavNumb = new double[2][2]; // [structure][cavitytype] double[][] cavprwat = new double[2][2]; // [structure][cavitytype] double[] reffug = new double[20]; - static Logger logger = LogManager.getLogger(ComponentHydrateKluda.class); /** *
@@ -67,13 +67,6 @@ public ComponentHydrateKluda(String name, double moles, double molesInPhase, int cavprwat[1][1] = 1.0 / 17.0; } - /** {@inheritDoc} */ - @Override - public double fugcoef(PhaseInterface phase) { - return fugcoef(phase, phase.getNumberOfComponents(), phase.getTemperature(), - phase.getPressure()); - } - /** *
* Calculate, set and return fugacity coefficient. diff --git a/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java b/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java index dbe41f5723..df26d9e1f8 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydratePVTsim.java @@ -74,13 +74,6 @@ public ComponentHydratePVTsim(String name, double moles, double molesInPhase, in } } - /** {@inheritDoc} */ - @Override - public double fugcoef(PhaseInterface phase) { - return fugcoef(phase, phase.getNumberOfComponents(), phase.getTemperature(), - phase.getPressure()); - } - /** {@inheritDoc} */ @Override public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, double pres) { diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateStatoil.java b/src/main/java/neqsim/thermo/component/ComponentHydrateStatoil.java index a3b77c4384..3715194981 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateStatoil.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateStatoil.java @@ -52,13 +52,6 @@ public ComponentHydrateStatoil(String name, double moles, double molesInPhase, i cavprwat[1][1] = 1.0 / 17.0; } - /** {@inheritDoc} */ - @Override - public double fugcoef(PhaseInterface phase) { - return fugcoef(phase, phase.getNumberOfComponents(), phase.getTemperature(), - phase.getPressure()); - } - /** {@inheritDoc} */ @Override public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, double pres) { diff --git a/src/main/java/neqsim/thermo/component/ComponentWax.java b/src/main/java/neqsim/thermo/component/ComponentWax.java index 406ce68bdb..7f37d81e8b 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWax.java +++ b/src/main/java/neqsim/thermo/component/ComponentWax.java @@ -1,11 +1,7 @@ -/* - * SolidComponent.java - * - * Created on 18. august 2001, 12:45 - */ - package neqsim.thermo.component; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import neqsim.thermo.phase.PhaseInterface; import neqsim.thermo.phase.PhaseType; @@ -19,6 +15,7 @@ */ public class ComponentWax extends ComponentSolid { private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(ComponentWax.class); /** *
diff --git a/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java b/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java index 1d93c5d906..a1b79e5702 100644 --- a/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java +++ b/src/main/java/neqsim/thermo/component/ComponentWaxWilson.java @@ -1,5 +1,7 @@ package neqsim.thermo.component; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseInterface; import neqsim.thermo.phase.PhaseType; @@ -14,6 +16,7 @@ */ public class ComponentWaxWilson extends ComponentSolid { private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(ComponentWaxWilson.class); /** *
@@ -29,7 +32,7 @@ public ComponentWaxWilson(String name, double moles, double molesInPhase, int co
super(name, moles, molesInPhase, compIndex);
}
- /** * {@inheritDoc} */
+ /** {@inheritDoc} */
@Override
public double fugcoef(PhaseInterface phase1) {
if (!isWaxFormer()) {
diff --git a/src/main/java/neqsim/thermo/component/ComponentWonWax.java b/src/main/java/neqsim/thermo/component/ComponentWonWax.java
index f2dc2ce665..0b46ae5c61 100644
--- a/src/main/java/neqsim/thermo/component/ComponentWonWax.java
+++ b/src/main/java/neqsim/thermo/component/ComponentWonWax.java
@@ -35,7 +35,8 @@ public ComponentWonWax(String name, double moles, double molesInPhase, int compI
@Override
public double fugcoef(PhaseInterface phase1) {
if (!isWaxFormer()) {
- return 1.0e30;
+ fugacityCoefficient = 1.0e30;
+ return fugacityCoefficient;
}
return fugcoef2(phase1);
From e7a90fb6de358fe5eed7549737c06d53ab2bbc0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
+ * getGamma.
+ *
- * getGamma.
- *
- * Setter for the field
- * Getter for the field
- * removeComponent.
+ * Remove component from Phase.
*
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index bfb549636c..1bd0a3fa2f 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -1360,12 +1360,10 @@ public void removeComponent(String name) {
getTotalNumberOfMoles() - phaseArray[0].getComponent(name).getNumberOfmoles());
for (int i = 0; i < getMaxNumberOfPhases(); i++) {
getPhase(i).removeComponent(name, getTotalNumberOfMoles(),
- phaseArray[phaseIndex[i]].getComponent(name).getNumberOfMolesInPhase(),
- phaseArray[phaseIndex[i]].getComponent(name).getComponentNumber());
+ getPhase(i).getComponent(name).getNumberOfMolesInPhase());
}
componentNames.remove(name);
- // System.out.println("removing " + componentNames.toString());
numberOfComponents--;
}
From d71c203bd6950cb0052647d72c7190c4e8fc29d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 7 Mar 2024 19:44:09 +0100
Subject: [PATCH 130/317] refact: Phase classes clean up (#941)
---
src/main/java/neqsim/thermo/phase/Phase.java | 3 +-
.../thermo/phase/PhaseDesmukhMather.java | 3 +-
.../neqsim/thermo/phase/PhaseDuanSun.java | 2 +-
.../java/neqsim/thermo/phase/PhaseGENRTL.java | 2 +-
.../thermo/phase/PhaseGENRTLmodifiedHV.java | 4 +-
.../thermo/phase/PhaseGENRTLmodifiedWS.java | 6 +--
.../neqsim/thermo/phase/PhaseGEUnifac.java | 4 +-
.../thermo/phase/PhaseGEUnifacPSRK.java | 2 +-
.../thermo/phase/PhaseGEUnifacUMRPRU.java | 2 +-
.../java/neqsim/thermo/phase/PhasePCSAFT.java | 2 -
.../thermo/phase/PhasePCSAFTRahmat.java | 47 ++-----------------
11 files changed, 18 insertions(+), 59 deletions(-)
diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java
index 0e1ff98418..1a969e8d31 100644
--- a/src/main/java/neqsim/thermo/phase/Phase.java
+++ b/src/main/java/neqsim/thermo/phase/Phase.java
@@ -337,7 +337,8 @@ public double getMixGibbsEnergy() {
for (int i = 0; i < numberOfComponents; i++) {
gmix += getComponent(i).getx() * Math.log(getComponent(i).getx());
}
- return getExcessGibbsEnergy() + R * temperature * gmix * numberOfMolesInPhase;
+ // todo: is this correct?
+ return R * temperature * numberOfMolesInPhase * getExcessGibbsEnergy() * gmix;
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
index 1ff452536a..468d30288b 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
@@ -203,8 +203,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
GE += phase.getComponents()[i].getx() * Math.log(((ComponentDesmukhMather) componentArray[i])
.getGamma(phase, numberOfComponents, temperature, pressure, pt));
}
- // System.out.println("ge " + GE);
- return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()*
+ return R * temperature * numberOfMolesInPhase * GE;
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
index 9dbfe21803..c315624a1b 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
@@ -111,7 +111,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
.getGammaPitzer(phase, numberOfComponents, temperature, pressure, pt, salinity));
}
- return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()*
+ return R * temperature * numberOfMolesInPhase * GE;
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
index 6f273839e7..5465c74324 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
@@ -124,7 +124,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
temperature, pressure, pt, alpha, Dij, intparam, mixRule));
}
- return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()*
+ return R * temperature * numberOfMolesInPhase * GE;
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
index 80b299d004..6dffa94249 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
@@ -138,7 +138,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
temperature, pressure, pt, alpha, Dij, DijT, intparam, mixRule));
}
}
- return (R * phase.getTemperature() * GE) * phase.getNumberOfMolesInPhase();
+ return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE;
}
/** {@inheritDoc} */
@@ -149,7 +149,7 @@ public double getGibbsEnergy() {
val +=
getComponent(i).getNumberOfMolesInPhase() * (getComponent(i).getLogFugacityCoefficient()); // +Math.log(getComponent(i).getx()*getComponent(i).getAntoineVaporPressure(temperature)));
}
- return R * temperature * ((val) + Math.log(pressure) * numberOfMolesInPhase);
+ return R * temperature * numberOfMolesInPhase * (val + Math.log(pressure));
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
index 6044e0ea8a..bae95b38d0 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
@@ -93,19 +93,19 @@ public void addComponent(String name, double moles, double molesInPhase, int com
@Override
public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
double temperature, double pressure, PhaseType pt) {
+ // TODO: why is GE a local variable?
double GE = 0;
for (int i = 0; i < numberOfComponents; i++) {
if (type == 0) {
GE += phase.getComponents()[i].getx()
* Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase,
numberOfComponents, temperature, pressure, pt, alpha, Dij, intparam, mixRule));
- }
- if (type == 1) {
+ } else if (type == 1) {
GE += phase.getComponents()[i].getx() * Math
.log(((ComponentGENRTLmodifiedWS) componentArray[i]).getGamma(phase, numberOfComponents,
temperature, pressure, pt, alpha, Dij, DijT, intparam, mixRule));
}
}
- return R * temperature * GE * numberOfMolesInPhase;
+ return R * temperature * numberOfMolesInPhase * GE;
}
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
index ae4971dcb9..b1060211f1 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
@@ -193,7 +193,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i])
.getGamma(phase, numberOfComponents, temperature, pressure, pt));
}
- return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase();
+ return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE;
}
/** {@inheritDoc} */
@@ -204,7 +204,7 @@ public double getGibbsEnergy() {
val +=
getComponent(i).getNumberOfMolesInPhase() * (getComponent(i).getLogFugacityCoefficient());
}
- return R * temperature * ((val) + Math.log(pressure) * numberOfMolesInPhase);
+ return R * temperature * numberOfMolesInPhase * (val + Math.log(pressure));
}
/**
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
index 3171221a5a..d462c70752 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
@@ -80,7 +80,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i])
.getGamma(phase, numberOfComponents, temperature, pressure, pt));
}
- return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); // phase.getNumberOfMolesInPhase()*
+ return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE;
}
/**
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
index 6cb88f6f38..7b62645a8f 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
@@ -125,7 +125,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i])
.getGamma(phase, numberOfComponents, temperature, pressure, pt));
}
- return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase();
+ return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE;
}
/**
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
index 500295f408..a612249540 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
@@ -334,7 +334,6 @@ public double calcmSAFT() {
*/
public double calcF1dispSumTerm() {
double temp1 = 0.0;
-
for (int i = 0; i < numberOfComponents; i++) {
for (int j = 0; j < numberOfComponents; j++) {
temp1 +=
@@ -358,7 +357,6 @@ public double calcF1dispSumTerm() {
*/
public double calcF2dispSumTerm() {
double temp1 = 0.0;
-
for (int i = 0; i < numberOfComponents; i++) {
for (int j = 0; j < numberOfComponents; j++) {
temp1 += getComponent(i).getNumberOfMolesInPhase()
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
index 383174b619..c33887385c 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
@@ -15,12 +15,11 @@
*/
public class PhasePCSAFTRahmat extends PhasePCSAFT {
private static final long serialVersionUID = 1000;
+ static Logger logger = LogManager.getLogger(PhasePCSAFTRahmat.class);
double nSAFT = 1.0;
double dnSAFTdV = 1.0;
-
double dnSAFTdVdV = 1.0;
-
double dnSAFTdVdVdV = 1.0;
double dmeanSAFT = 0.0;
@@ -34,33 +33,22 @@ public class PhasePCSAFTRahmat extends PhasePCSAFT {
double volumeSAFT = 1.0;
double daHCSAFTdN = 1.0;
double daHSSAFTdN = 1.0;
-
double dgHSSAFTdN = 1.0;
-
double daHSSAFTdNdN = 1.0;
-
double dgHSSAFTdNdN = 1.0;
-
double daHSSAFTdNdNdN = 1.0;
-
double dgHSSAFTdNdNdN = 1.0;
// by Rahmat
double dNSAFTdT = 1.0;
double dF1dispVolTermdT = 0.0;
double dF1dispI1dT = 1.0;
-
double dF2dispI2dT = 1.0;
-
double dF2dispZHCdT = 1.0;
double dF1dispSumTermdT = 1.0;
-
double dF2dispSumTermdT = 1.0;
-
int useHS = 1;
-
int useDISP1 = 1;
-
int useDISP2 = 1;
private double[][] aConstSAFT = {
@@ -78,65 +66,35 @@ public class PhasePCSAFTRahmat extends PhasePCSAFT {
{0.0976883116, -0.2557574982, -9.1558561530, 20.642075974, -38.804430052, 93.626774077,
-29.666905585}};
private double F1dispVolTerm = 1.0;
-
private double F1dispSumTerm = 1.0;
-
private double F1dispI1 = 1.0;
-
private double F2dispI2 = 1.0;
-
private double F2dispZHC = 1.0;
-
private double F2dispZHCdN = 1.0;
-
private double F2dispZHCdm = 1.0;
-
private double F2dispZHCdV = 1.0;
-
private double F2dispI2dVdV;
-
private double F2dispI2dVdVdV = 0.0;
-
private double F2dispZHCdVdV = 1.0;
-
private double F2dispZHCdVdVdV = 1.0;
-
private double F1dispI1dNdN = 1.0;
-
private double F1dispI1dNdNdN = 1.0;
-
private double F1dispVolTermdV = 1.0;
-
private double F1dispVolTermdVdV = 1.0;
-
private double F1dispI1dN = 1.0;
-
private double F1dispI1dm = 1.0;
-
private double F1dispI1dV = 1.0;
-
private double F2dispI2dV = 1.0;
-
private double F2dispI2dN = 1.0;
-
private double F2dispI2dm = 1.0;
-
private double F2dispSumTerm = 0.0;
-
private double F2dispZHCdNdN = 1.0;
-
private double F2dispZHCdNdNdN = 1.0;
-
private double F2dispI2dNdN = 1.0;
-
private double F2dispI2dNdNdN = 1.0;
-
private double F1dispI1dVdV = 1.0;
-
private double F1dispI1dVdVdV = 1.0;
-
private double F1dispVolTermdVdVdV = 1.0;
- static Logger logger = LogManager.getLogger(PhasePCSAFTRahmat.class);
/**
*
@@ -171,10 +129,13 @@ public void addComponent(String name, double moles, double molesInPhase, int com
@Override
public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt,
double beta) {
+ // missing?
+ // if (initType > 0) {
for (int i = 0; i < numberOfComponents; i++) {
componentArray[i].Finit(this, temperature, pressure, totalNumberOfMoles, beta,
numberOfComponents, initType);
}
+ // }
super.init(totalNumberOfMoles, numberOfComponents, initType, pt, beta);
}
From f2f309a6e5ee61e274348c0960813a0171f0a007 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Fri, 8 Mar 2024 14:15:26 +0100
Subject: [PATCH 131/317] refact: remove redundant variable definitions (#943)
---
.../java/neqsim/thermo/phase/PhasePCSAFT.java | 50 ++++----
.../thermo/phase/PhasePCSAFTRahmat.java | 117 ++----------------
2 files changed, 35 insertions(+), 132 deletions(-)
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
index a612249540..9de1c0bb06 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
@@ -40,43 +40,43 @@ public class PhasePCSAFT extends PhaseSrkEos {
int useDISP1 = 1;
int useDISP2 = 1;
- private double[][] aConstSAFT = {
+ protected double[][] aConstSAFT = {
{0.9105631445, 0.6361281449, 2.6861347891, -26.547362491, 97.759208784, -159.59154087,
91.297774084},
{-0.3084016918, 0.1860531159, -2.5030047259, 21.419793629, -65.255885330, 83.318680481,
-33.746922930},
{-0.0906148351, 0.4527842806, 0.5962700728, -1.7241829131, -4.1302112531, 13.776631870,
-8.6728470368}};
- private double[][] bConstSAFT = {
+ protected double[][] bConstSAFT = {
{0.7240946941, 2.2382791861, -4.0025849485, -21.003576815, 26.855641363, 206.55133841,
-355.60235612},
{-0.5755498075, 0.6995095521, 3.8925673390, -17.215471648, 192.67226447, -161.82646165,
-165.20769346},
{0.0976883116, -0.2557574982, -9.1558561530, 20.642075974, -38.804430052, 93.626774077,
-29.666905585}};
- private double F1dispVolTerm = 1.0;
- private double F1dispSumTerm = 1.0;
- private double F1dispI1 = 1.0;
- private double F2dispI2 = 1.0;
- private double F2dispZHC = 1.0;
- private double F2dispZHCdN = 1.0;
- private double F2dispZHCdm = 1.0;
- private double F2dispZHCdV = 1.0;
- private double F2dispI2dVdV = 0.0;
- private double F2dispZHCdVdV = 0.0;
- private double F1dispI1dNdN = 1.0;
- private double F1dispVolTermdV = 1.0;
- private double F1dispVolTermdVdV = 1.0;
- private double F1dispI1dN = 1.0;
- private double F1dispI1dm = 1.0;
- private double F1dispI1dV = 1.0;
- private double F2dispI2dV = 1.0;
- private double F2dispI2dN = 1.0;
- private double F2dispI2dm = 1.0;
- private double F2dispSumTerm = 0.0;
- private double F2dispZHCdNdN = 1.0;
- private double F2dispI2dNdN = 1.0;
- private double F1dispI1dVdV = 0.0;
+ protected double F1dispVolTerm = 1.0;
+ protected double F1dispSumTerm = 1.0;
+ protected double F1dispI1 = 1.0;
+ protected double F2dispI2 = 1.0;
+ protected double F2dispZHC = 1.0;
+ protected double F2dispZHCdN = 1.0;
+ protected double F2dispZHCdm = 1.0;
+ protected double F2dispZHCdV = 1.0;
+ protected double F2dispI2dVdV = 0.0;
+ protected double F2dispZHCdVdV = 0.0;
+ protected double F1dispI1dNdN = 1.0;
+ protected double F1dispVolTermdV = 1.0;
+ protected double F1dispVolTermdVdV = 1.0;
+ protected double F1dispI1dN = 1.0;
+ protected double F1dispI1dm = 1.0;
+ protected double F1dispI1dV = 1.0;
+ protected double F2dispI2dV = 1.0;
+ protected double F2dispI2dN = 1.0;
+ protected double F2dispI2dm = 1.0;
+ protected double F2dispSumTerm = 0.0;
+ protected double F2dispZHCdNdN = 1.0;
+ protected double F2dispI2dNdN = 1.0;
+ protected double F1dispI1dVdV = 0.0;
/**
*
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
index c33887385c..4e81d15fc9 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
@@ -17,25 +17,8 @@ public class PhasePCSAFTRahmat extends PhasePCSAFT {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(PhasePCSAFTRahmat.class);
- double nSAFT = 1.0;
- double dnSAFTdV = 1.0;
- double dnSAFTdVdV = 1.0;
double dnSAFTdVdVdV = 1.0;
- double dmeanSAFT = 0.0;
- double dSAFT = 1.0;
- double mSAFT = 1.0;
- double mdSAFT = 1.0;
- double nmSAFT = 1.0;
- double mmin1SAFT = 1.0;
- double ghsSAFT = 1.0;
- double aHSSAFT = 1.0;
- double volumeSAFT = 1.0;
- double daHCSAFTdN = 1.0;
- double daHSSAFTdN = 1.0;
- double dgHSSAFTdN = 1.0;
- double daHSSAFTdNdN = 1.0;
- double dgHSSAFTdNdN = 1.0;
double daHSSAFTdNdNdN = 1.0;
double dgHSSAFTdNdNdN = 1.0;
@@ -47,54 +30,16 @@ public class PhasePCSAFTRahmat extends PhasePCSAFT {
double dF2dispZHCdT = 1.0;
double dF1dispSumTermdT = 1.0;
double dF2dispSumTermdT = 1.0;
- int useHS = 1;
- int useDISP1 = 1;
- int useDISP2 = 1;
-
- private double[][] aConstSAFT = {
- {0.9105631445, 0.6361281449, 2.6861347891, -26.547362491, 97.759208784, -159.59154087,
- 91.297774084},
- {-0.3084016918, 0.1860531159, -2.5030047259, 21.419793629, -65.255885330, 83.318680481,
- -33.746922930},
- {-0.0906148351, 0.4527842806, 0.5962700728, -1.7241829131, -4.1302112531, 13.776631870,
- -8.6728470368}};
- private double[][] bConstSAFT = {
- {0.7240946941, 2.2382791861, -4.0025849485, -21.003576815, 26.855641363, 206.55133841,
- -355.60235612},
- {-0.5755498075, 0.6995095521, 3.8925673390, -17.215471648, 192.67226447, -161.82646165,
- -165.20769346},
- {0.0976883116, -0.2557574982, -9.1558561530, 20.642075974, -38.804430052, 93.626774077,
- -29.666905585}};
- private double F1dispVolTerm = 1.0;
- private double F1dispSumTerm = 1.0;
- private double F1dispI1 = 1.0;
- private double F2dispI2 = 1.0;
- private double F2dispZHC = 1.0;
- private double F2dispZHCdN = 1.0;
- private double F2dispZHCdm = 1.0;
- private double F2dispZHCdV = 1.0;
- private double F2dispI2dVdV;
- private double F2dispI2dVdVdV = 0.0;
- private double F2dispZHCdVdV = 1.0;
- private double F2dispZHCdVdVdV = 1.0;
- private double F1dispI1dNdN = 1.0;
- private double F1dispI1dNdNdN = 1.0;
- private double F1dispVolTermdV = 1.0;
- private double F1dispVolTermdVdV = 1.0;
- private double F1dispI1dN = 1.0;
- private double F1dispI1dm = 1.0;
- private double F1dispI1dV = 1.0;
- private double F2dispI2dV = 1.0;
- private double F2dispI2dN = 1.0;
- private double F2dispI2dm = 1.0;
- private double F2dispSumTerm = 0.0;
- private double F2dispZHCdNdN = 1.0;
- private double F2dispZHCdNdNdN = 1.0;
- private double F2dispI2dNdN = 1.0;
- private double F2dispI2dNdNdN = 1.0;
- private double F1dispI1dVdV = 1.0;
- private double F1dispI1dVdVdV = 1.0;
- private double F1dispVolTermdVdVdV = 1.0;
+ protected double F2dispI2dVdV;
+ protected double F2dispI2dVdVdV = 0.0;
+ protected double F2dispZHCdVdV = 1.0;
+ protected double F2dispZHCdVdVdV = 1.0;
+ protected double F1dispI1dNdNdN = 1.0;
+ protected double F2dispZHCdNdNdN = 1.0;
+ protected double F2dispI2dNdNdN = 1.0;
+ protected double F1dispI1dVdV = 1.0;
+ protected double F1dispI1dVdVdV = 1.0;
+ protected double F1dispVolTermdVdVdV = 1.0;
/**
*
@@ -1437,46 +1382,4 @@ public double molarVolume(double pressure, double temperature, double A, double
*/
return getMolarVolume();
}
-
- /** {@inheritDoc} */
- @Override
- public double getDmeanSAFT() {
- return dmeanSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setDmeanSAFT(double dmeanSAFT) {
- this.dmeanSAFT = dmeanSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getNmSAFT() {
- return nmSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setNmSAFT(double nmSAFT) {
- this.nmSAFT = nmSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF2dispSumTerm() {
- return F2dispSumTerm;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setF2dispSumTerm(double F2dispSumTerm) {
- this.F2dispSumTerm = F2dispSumTerm;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setF2dispZHCdm(double F2dispZHCdm) {
- this.F2dispZHCdm = F2dispZHCdm;
- }
}
From 14e035c5fb685c48c1538235426b5283b8d3ed7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Sat, 9 Mar 2024 16:12:17 +0100
Subject: [PATCH 132/317] Ref rahmat 2 (#945)
* refact: remove duplicate setters/getters
---
.../thermo/phase/PhasePCSAFTRahmat.java | 144 ------------------
1 file changed, 144 deletions(-)
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
index 4e81d15fc9..fb51d46667 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
@@ -1123,84 +1123,6 @@ public double dFdVdVdV() {
+ useDISP2 * dF_DISP2_SAFTdVdVdV()) * 1.0e-20;
}
- /** {@inheritDoc} */
- @Override
- public double getmdSAFT() {
- return mdSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setmdSAFT(double mdSAFT) {
- this.mdSAFT = mdSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getmSAFT() {
- return mSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setmSAFT(double mSAFT) {
- this.mSAFT = mSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getAHSSAFT() {
- return aHSSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setAHSSAFT(double aHSSAFT) {
- this.aHSSAFT = aHSSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getMmin1SAFT() {
- return mmin1SAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setMmin1SAFT(double mmin1SAFT) {
- this.mmin1SAFT = mmin1SAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getVolumeSAFT() {
- return volumeSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setVolumeSAFT(double volumeSAFT) {
- this.volumeSAFT = volumeSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getDgHSSAFTdN() {
- return dgHSSAFTdN;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setDgHSSAFTdN(double dgHSSAFTdN) {
- this.dgHSSAFTdN = dgHSSAFTdN;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getDnSAFTdV() {
- return dnSAFTdV;
- }
-
// added by rahmat
/**
*
@@ -1223,72 +1145,6 @@ public double getdDSAFTdT() {
return temp;
}
- /** {@inheritDoc} */
- @Override
- public void setDnSAFTdV(double dnSAFTdV) {
- this.dnSAFTdV = dnSAFTdV;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF1dispVolTerm() {
- return F1dispVolTerm;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setF1dispVolTerm(double F1dispVolTerm) {
- this.F1dispVolTerm = F1dispVolTerm;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF1dispSumTerm() {
- return F1dispSumTerm;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF1dispI1() {
- return F1dispI1;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF2dispI2() {
- return F2dispI2;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setF2dispI2(double F2dispI2) {
- this.F2dispI2 = F2dispI2;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF2dispZHC() {
- return F2dispZHC;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setF2dispZHC(double F2dispZHC) {
- this.F2dispZHC = F2dispZHC;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF2dispZHCdN() {
- return F2dispZHCdN;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getF2dispZHCdm() {
- return F2dispZHCdm;
- }
-
/** {@inheritDoc} */
@Override
public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
From b24178f37039349547c3b2522289663df8a392aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Sat, 9 Mar 2024 16:22:38 +0100
Subject: [PATCH 133/317] refact: remove redundant getter/setters (#946)
---
.../thermo/phase/PhasePCSAFTRahmat.java | 38 -------------------
1 file changed, 38 deletions(-)
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
index fb51d46667..bfb9af91f4 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
@@ -764,42 +764,6 @@ public double calcdSAFT() {
return temp1 / getNumberOfMolesInPhase();
}
- /** {@inheritDoc} */
- @Override
- public double getNSAFT() {
- return nSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setNSAFT(double nSAFT) {
- this.nSAFT = nSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getDSAFT() {
- return dSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setDSAFT(double dSAFT) {
- this.dSAFT = dSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getGhsSAFT() {
- return ghsSAFT;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setGhsSAFT(double ghsSAFT) {
- this.ghsSAFT = ghsSAFT;
- }
-
/** {@inheritDoc} */
@Override
public double F_HC_SAFT() {
@@ -1154,7 +1118,6 @@ public double molarVolume(double pressure, double temperature, double A, double
pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature())
: pressure * getB() / (numberOfMolesInPhase * temperature * R);
// double BonV = phase== 0 ? 0.99:1e-5;
-
if (BonV < 0) {
BonV = 1.0e-6;
}
@@ -1217,7 +1180,6 @@ public double molarVolume(double pressure, double temperature, double A, double
*/
// setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase);
Z = pressure * getMolarVolume() / (R * temperature);
- // System.out.println("BonV " + BonV);
} while (Math.abs((oldMolarVolume - getMolarVolume()) / oldMolarVolume) > 1.0e-10
&& iterations < 100);
// while(Math.abs((BonV-BonVold)/BonV)>1.0e-10 && iterations<500);
From 27f865f0cc52558cf3339fc1fe19264116766201 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Sun, 10 Mar 2024 22:39:36 +0100
Subject: [PATCH 134/317] fix: upgrade org.apache.logging.log4j:log4j-core from
2.22.1 to 2.23.0 (#948)
Snyk has created this PR to upgrade org.apache.logging.log4j:log4j-core from 2.22.1 to 2.23.0.
See this package in Maven Repository:
https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core/
See this project in Snyk:
https://app.snyk.io/org/neqsim/project/86e71bb0-950f-445f-94e7-32e73d92cca3?utm_source=github&utm_medium=referral&page=upgrade-pr
Co-authored-by: snyk-bot
- * init.
+ * Init using current phase properties.
*
@@ -715,7 +718,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType
* not change the total number of moles of component in system.
*
* NB! Phase fraction dHfHydrate
.
+ * Getter for the field dHfHydrate
.
* dHfHydrate
.
+ * Setter for the field dHfHydrate
.
* beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of of total number of moles in system.
+ * keep consistency between phase and component calculation of total number of moles in system.
* beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of of total number of moles in system.
+ * keep consistency between phase and component calculation of total number of moles in system.
* numberOfMoles
with separate amounts.
*
* NB! Phase fraction beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of of total number of moles in system.
+ * keep consistency between phase and component calculation of total number of moles in system.
*
Getter for the field saturationTemperature
.
+ * Getter for the field saturationTemperature
.
+ *
- * Constructor for DensityFunction. - *
- */ - public DensityFunction() { - params = new double[1]; - } + /** + *+ * Constructor for DensityFunction. + *
+ */ + public DensityFunction() { + params = new double[1]; + } - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - system.setTemperature(dependentValues[0]); - thermoOps.TPflash(); - system.initPhysicalProperties(); + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + system.setTemperature(dependentValues[0]); + thermoOps.TPflash(); + system.initPhysicalProperties(); - // system.display(); - return system.getPhase(0).getPhysicalProperties().getDensity(); - } + // system.display(); + return system.getPhase(0).getPhysicalProperties().getDensity(); + } - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; - } + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; + } } diff --git a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/FunctionJohanSverderup.java b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/FunctionJohanSverderup.java index 432e327c08..7e0d5fff52 100644 --- a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/FunctionJohanSverderup.java +++ b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/FunctionJohanSverderup.java @@ -12,35 +12,34 @@ * @version $Id: $Id */ public class FunctionJohanSverderup extends LevenbergMarquardtFunction { - double molarMass = 0.0; + double molarMass = 0.0; - /** - *- * Constructor for FunctionJohanSverderup. - *
- */ - public FunctionJohanSverderup() { - params = new double[1]; - } + /** + *+ * Constructor for FunctionJohanSverderup. + *
+ */ + public FunctionJohanSverderup() { + params = new double[1]; + } - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - system.addComponent("methane", - -system.getPhase(0).getComponent("methane").getNumberOfmoles()); - system.addComponent("methane", params[0]); - system.init_x_y(); - system.init(1); - system.setPressure(system.getPressure() - 25.0); - SaturationPressure satCalc = new SaturationPressure(system); - double satPres = satCalc.calcSaturationPressure(); + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + system.addComponent("methane", -system.getPhase(0).getComponent("methane").getNumberOfmoles()); + system.addComponent("methane", params[0]); + system.init_x_y(); + system.init(1); + system.setPressure(system.getPressure() - 25.0); + SaturationPressure satCalc = new SaturationPressure(system); + double satPres = satCalc.calcSaturationPressure(); - return satPres; - } + return satPres; + } - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; - } + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; + } } diff --git a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/SaturationPressureFunction.java b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/SaturationPressureFunction.java index 9ca7717173..b12d9daadd 100644 --- a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/SaturationPressureFunction.java +++ b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/SaturationPressureFunction.java @@ -13,51 +13,51 @@ * @version $Id: $Id */ public class SaturationPressureFunction extends LevenbergMarquardtFunction { - double molarMass = 0.0; + double molarMass = 0.0; - /** - *- * Constructor for SaturationPressureFunction. - *
- */ - public SaturationPressureFunction() { - params = new double[1]; - } - - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - int plusNumber = 0; - molarMass = params[0]; - for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - if (system.getPhase(0).getComponent(i).isIsPlusFraction()) { - plusNumber = i; - } - } - SystemInterface tempSystem = system.clone(); - tempSystem.resetCharacterisation(); - tempSystem.createDatabase(true); - tempSystem.setMixingRule(system.getMixingRule()); + /** + *+ * Constructor for SaturationPressureFunction. + *
+ */ + public SaturationPressureFunction() { + params = new double[1]; + } - tempSystem.getPhase(0).getComponent(plusNumber).setMolarMass(molarMass); - tempSystem.getPhase(1).getComponent(plusNumber).setMolarMass(molarMass); - tempSystem.setTemperature(dependentValues[0]); - tempSystem.setPressure(50.0); - tempSystem.getCharacterization().characterisePlusFraction(); - tempSystem.createDatabase(true); - tempSystem.setMixingRule(system.getMixingRule()); - tempSystem.init(0); - tempSystem.init(1); - // \\tempSystem.display(); - SaturationPressure satCalc = new SaturationPressure(tempSystem); - double satPres = satCalc.calcSaturationPressure(); - // tempSystem.display(); - return satPres; + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + int plusNumber = 0; + molarMass = params[0]; + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + if (system.getPhase(0).getComponent(i).isIsPlusFraction()) { + plusNumber = i; + } } + SystemInterface tempSystem = system.clone(); + tempSystem.resetCharacterisation(); + tempSystem.createDatabase(true); + tempSystem.setMixingRule(system.getMixingRule()); - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; - } + tempSystem.getPhase(0).getComponent(plusNumber).setMolarMass(molarMass); + tempSystem.getPhase(1).getComponent(plusNumber).setMolarMass(molarMass); + tempSystem.setTemperature(dependentValues[0]); + tempSystem.setPressure(50.0); + tempSystem.getCharacterization().characterisePlusFraction(); + tempSystem.createDatabase(true); + tempSystem.setMixingRule(system.getMixingRule()); + tempSystem.init(0); + tempSystem.init(1); + // \\tempSystem.display(); + SaturationPressure satCalc = new SaturationPressure(tempSystem); + double satPres = satCalc.calcSaturationPressure(); + // tempSystem.display(); + return satPres; + } + + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; + } } diff --git a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/ViscosityFunction.java b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/ViscosityFunction.java index ae7659896d..03dabd1b7a 100644 --- a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/ViscosityFunction.java +++ b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/ViscosityFunction.java @@ -12,51 +12,51 @@ * @version $Id: $Id */ public class ViscosityFunction extends LevenbergMarquardtFunction { - double molarMass = 0.0; - boolean includeWaxEmulsionViscosity = true; + double molarMass = 0.0; + boolean includeWaxEmulsionViscosity = true; - /** - *- * Constructor for ViscosityFunction. - *
- */ - public ViscosityFunction() { - params = new double[1]; - } + /** + *+ * Constructor for ViscosityFunction. + *
+ */ + public ViscosityFunction() { + params = new double[1]; + } - /** - *- * Constructor for ViscosityFunction. - *
- * - * @param includeWax a boolean - */ - public ViscosityFunction(boolean includeWax) { - params = new double[1]; - includeWaxEmulsionViscosity = includeWax; - } + /** + *+ * Constructor for ViscosityFunction. + *
+ * + * @param includeWax a boolean + */ + public ViscosityFunction(boolean includeWax) { + params = new double[1]; + includeWaxEmulsionViscosity = includeWax; + } - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - thermoOps.TPflash(); - system.initPhysicalProperties(); - double waxFraction = 0.0; - if (system.hasPhaseType("wax") && includeWaxEmulsionViscosity) { - waxFraction = system.getWtFraction(system.getPhaseNumberOfPhase("wax")); - return system.getPhase(0).getPhysicalProperties().getViscosityOfWaxyOil(waxFraction, - dependentValues[0]); // %wax - } - // system.display(); - return system.getPhase(0).getPhysicalProperties().getViscosity(); // %wax + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + thermoOps.TPflash(); + system.initPhysicalProperties(); + double waxFraction = 0.0; + if (system.hasPhaseType("wax") && includeWaxEmulsionViscosity) { + waxFraction = system.getWtFraction(system.getPhaseNumberOfPhase("wax")); + return system.getPhase(0).getPhysicalProperties().getViscosityOfWaxyOil(waxFraction, + dependentValues[0]); // %wax } + // system.display(); + return system.getPhase(0).getPhysicalProperties().getViscosity(); // %wax + } - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; - ((FrictionTheoryViscosityMethod) system.getPhase(0).getPhysicalProperties() - .getViscosityModel()).setTBPviscosityCorrection(value); - } + ((FrictionTheoryViscosityMethod) system.getPhase(0).getPhysicalProperties().getViscosityModel()) + .setTBPviscosityCorrection(value); + } } diff --git a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/WaxFunction.java b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/WaxFunction.java index 3f92961289..63b494975e 100644 --- a/src/main/java/neqsim/PVTsimulation/util/parameterfitting/WaxFunction.java +++ b/src/main/java/neqsim/PVTsimulation/util/parameterfitting/WaxFunction.java @@ -11,42 +11,42 @@ * @version $Id: $Id */ public class WaxFunction extends LevenbergMarquardtFunction { - double molarMass = 0.0; + double molarMass = 0.0; - /** - *- * Constructor for WaxFunction. - *
- */ - public WaxFunction() { - params = new double[3]; - } + /** + *+ * Constructor for WaxFunction. + *
+ */ + public WaxFunction() { + params = new double[3]; + } - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - system.setTemperature(dependentValues[0]); - thermoOps.TPflash(); - double waxFraction = 0.0; - if (system.hasPhaseType("wax")) { - waxFraction = system.getWtFraction(system.getPhaseNumberOfPhase("wax")); - } - // system.display(); - return waxFraction * 100.0; // %wax + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + system.setTemperature(dependentValues[0]); + thermoOps.TPflash(); + double waxFraction = 0.0; + if (system.hasPhaseType("wax")) { + waxFraction = system.getWtFraction(system.getPhaseNumberOfPhase("wax")); } + // system.display(); + return waxFraction * 100.0; // %wax + } - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; - if (i < 3) { - system.getWaxModel().setWaxParameter(i, params[i]); - } else if (i == 3) { - system.getWaxModel().setParameterWaxHeatOfFusion(i - 3, value); - } else { - system.getWaxModel().setParameterWaxTriplePointTemperature(i - 4, value); - } - system.getWaxModel().removeWax(); - system.getWaxModel().addTBPWax(); + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; + if (i < 3) { + system.getWaxModel().setWaxParameter(i, params[i]); + } else if (i == 3) { + system.getWaxModel().setParameterWaxHeatOfFusion(i - 3, value); + } else { + system.getWaxModel().setParameterWaxTriplePointTemperature(i - 4, value); } + system.getWaxModel().removeWax(); + system.getWaxModel().addTBPWax(); + } } diff --git a/src/main/java/neqsim/api/ioc/CalculationResult.java b/src/main/java/neqsim/api/ioc/CalculationResult.java index 09f6550db6..e81fcee28c 100644 --- a/src/main/java/neqsim/api/ioc/CalculationResult.java +++ b/src/main/java/neqsim/api/ioc/CalculationResult.java @@ -3,7 +3,9 @@ import java.util.Arrays; /** - *CalculationResult class.
+ *+ * CalculationResult class. + *
* * @author jo.lyshoel * @version $Id: $Id @@ -13,7 +15,9 @@ public class CalculationResult { public String[] calculationError; /** - *Constructor for CalculationResult.
+ *+ * Constructor for CalculationResult. + *
* * @param fluidProperties an array of {@link java.lang.Double} objects * @param calculationError an array of {@link java.lang.String} objects diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowNodeVisualization/twoPhaseFlowNodeVisualization/TwoPhaseFlowNodeVisualization.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowNodeVisualization/twoPhaseFlowNodeVisualization/TwoPhaseFlowNodeVisualization.java index 57d1b8a80d..127c4ebe7c 100644 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowNodeVisualization/twoPhaseFlowNodeVisualization/TwoPhaseFlowNodeVisualization.java +++ b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowNodeVisualization/twoPhaseFlowNodeVisualization/TwoPhaseFlowNodeVisualization.java @@ -12,54 +12,51 @@ * @version $Id: $Id */ public class TwoPhaseFlowNodeVisualization extends FlowNodeVisualization { - /** - *- * Constructor for TwoPhaseFlowNodeVisualization. - *
- */ - public TwoPhaseFlowNodeVisualization() {} + /** + *+ * Constructor for TwoPhaseFlowNodeVisualization. + *
+ */ + public TwoPhaseFlowNodeVisualization() {} - /** {@inheritDoc} */ - @Override - public void setData(FlowNodeInterface node) { - super.setData(node); - bulkComposition = - new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - effectiveMassTransferCoefficient = - new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - effectiveSchmidtNumber = - new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - interfaceComposition = - new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - molarFlux = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + /** {@inheritDoc} */ + @Override + public void setData(FlowNodeInterface node) { + super.setData(node); + bulkComposition = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + effectiveMassTransferCoefficient = + new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + effectiveSchmidtNumber = + new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + interfaceComposition = + new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + molarFlux = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - for (int i = 0; i < node.getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponents()[i].getx(); - bulkComposition[1][i] = node.getBulkSystem().getPhases()[1].getComponents()[i].getx(); - effectiveMassTransferCoefficient[1][i] = - node.getFluidBoundary().getEffectiveMassTransferCoefficient(1, i); - effectiveMassTransferCoefficient[0][i] = - node.getFluidBoundary().getEffectiveMassTransferCoefficient(0, i); - effectiveSchmidtNumber[0][i] = node.getEffectiveSchmidtNumber(0, i); - effectiveSchmidtNumber[1][i] = node.getEffectiveSchmidtNumber(1, i); - // System.out.println("sc " + effectiveSchmidtNumber[1][i]); - interfaceComposition[0][i] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[0].getComponents()[i] - .getx(); - interfaceComposition[1][i] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getComponents()[i] - .getx(); - molarFlux[0][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); - molarFlux[1][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); - } - - reynoldsNumber[0] = node.getReynoldsNumber(0); - reynoldsNumber[1] = node.getReynoldsNumber(1); - phaseFraction[0] = node.getPhaseFraction(0); - phaseFraction[1] = node.getPhaseFraction(1); - interfaceTemperature[0] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[0].getTemperature(); - interfaceTemperature[1] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getTemperature(); + for (int i = 0; i < node.getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponents()[i].getx(); + bulkComposition[1][i] = node.getBulkSystem().getPhases()[1].getComponents()[i].getx(); + effectiveMassTransferCoefficient[1][i] = + node.getFluidBoundary().getEffectiveMassTransferCoefficient(1, i); + effectiveMassTransferCoefficient[0][i] = + node.getFluidBoundary().getEffectiveMassTransferCoefficient(0, i); + effectiveSchmidtNumber[0][i] = node.getEffectiveSchmidtNumber(0, i); + effectiveSchmidtNumber[1][i] = node.getEffectiveSchmidtNumber(1, i); + // System.out.println("sc " + effectiveSchmidtNumber[1][i]); + interfaceComposition[0][i] = + node.getFluidBoundary().getInterphaseSystem().getPhases()[0].getComponents()[i].getx(); + interfaceComposition[1][i] = + node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getComponents()[i].getx(); + molarFlux[0][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); + molarFlux[1][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); } + + reynoldsNumber[0] = node.getReynoldsNumber(0); + reynoldsNumber[1] = node.getReynoldsNumber(1); + phaseFraction[0] = node.getPhaseFraction(0); + phaseFraction[1] = node.getPhaseFraction(1); + interfaceTemperature[0] = + node.getFluidBoundary().getInterphaseSystem().getPhases()[0].getTemperature(); + interfaceTemperature[1] = + node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getTemperature(); + } } diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/TwoPhaseFlowVisualization.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/TwoPhaseFlowVisualization.java index df0a87e5eb..123244bbb3 100644 --- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/TwoPhaseFlowVisualization.java +++ b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/TwoPhaseFlowVisualization.java @@ -9,23 +9,23 @@ * @version $Id: $Id */ public class TwoPhaseFlowVisualization extends - neqsim.fluidMechanics.util.fluidMechanicsVisualization.flowSystemVisualization.FlowSystemVisualization { - /** - *- * Constructor for TwoPhaseFlowVisualization. - *
- */ - public TwoPhaseFlowVisualization() {} + neqsim.fluidMechanics.util.fluidMechanicsVisualization.flowSystemVisualization.FlowSystemVisualization { + /** + *+ * Constructor for TwoPhaseFlowVisualization. + *
+ */ + public TwoPhaseFlowVisualization() {} - /** - *- * Constructor for TwoPhaseFlowVisualization. - *
- * - * @param nodes a int - * @param timeSteps a int - */ - public TwoPhaseFlowVisualization(int nodes, int timeSteps) { - super(nodes, timeSteps); - } + /** + *+ * Constructor for TwoPhaseFlowVisualization. + *
+ * + * @param nodes a int + * @param timeSteps a int + */ + public TwoPhaseFlowVisualization(int nodes, int timeSteps) { + super(nodes, timeSteps); + } } diff --git a/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/chungMethod/ChungFunction.java b/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/chungMethod/ChungFunction.java index 8595e451b4..a13f208be3 100644 --- a/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/chungMethod/ChungFunction.java +++ b/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/chungMethod/ChungFunction.java @@ -11,29 +11,29 @@ * @version $Id: $Id */ public class ChungFunction extends LevenbergMarquardtFunction { - /** - *- * Constructor for ChungFunction. - *
- */ - public ChungFunction() { - params = new double[1]; - } + /** + *+ * Constructor for ChungFunction. + *
+ */ + public ChungFunction() { + params = new double[1]; + } - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - system.setTemperature(dependentValues[0]); - system.init(1); - system.initPhysicalProperties(); - return system.getPhases()[1].getPhysicalProperties().getViscosity(); - } + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + system.setTemperature(dependentValues[0]); + system.init(1); + system.initPhysicalProperties(); + return system.getPhases()[1].getPhysicalProperties().getViscosity(); + } - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; - system.getPhases()[0].getComponents()[i].setViscosityAssociationFactor(value); - system.getPhases()[1].getComponents()[i].setViscosityAssociationFactor(value); - } + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; + system.getPhases()[0].getComponents()[i].setViscosityAssociationFactor(value); + system.getPhases()[1].getComponents()[i].setViscosityAssociationFactor(value); + } } diff --git a/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/linearLiquidModel/ViscosityFunction.java b/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/linearLiquidModel/ViscosityFunction.java index 612b3bf1e8..1400d0d81a 100644 --- a/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/linearLiquidModel/ViscosityFunction.java +++ b/src/main/java/neqsim/physicalProperties/util/parameterFitting/pureComponentParameterFitting/pureCompViscosity/linearLiquidModel/ViscosityFunction.java @@ -17,26 +17,26 @@ * @version $Id: $Id */ public class ViscosityFunction extends LevenbergMarquardtFunction { - /** - *- * Constructor for ViscosityFunction. - *
- */ - public ViscosityFunction() {} + /** + *+ * Constructor for ViscosityFunction. + *
+ */ + public ViscosityFunction() {} - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - system.init(1); - system.initPhysicalProperties(); - return system.getPhases()[1].getPhysicalProperties().getViscosity() * 1e3; - } + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + system.init(1); + system.initPhysicalProperties(); + return system.getPhases()[1].getPhysicalProperties().getViscosity() * 1e3; + } - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; - system.getPhases()[0].getComponents()[0].setLiquidViscosityParameter(value, i); - system.getPhases()[1].getComponents()[0].setLiquidViscosityParameter(value, i); - } + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; + system.getPhases()[0].getComponents()[0].setLiquidViscosityParameter(value, i); + system.getPhases()[1].getComponents()[0].setLiquidViscosityParameter(value, i); + } } diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/StreamMeasurementDeviceBaseClass.java b/src/main/java/neqsim/processSimulation/measurementDevice/StreamMeasurementDeviceBaseClass.java index b31ceb0abb..ae74b3f5b9 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/StreamMeasurementDeviceBaseClass.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/StreamMeasurementDeviceBaseClass.java @@ -45,4 +45,3 @@ public void setStream(StreamInterface stream) { this.stream = stream; } } - diff --git a/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java index e1baa98547..3998b017f2 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/HXResponse.java @@ -11,43 +11,42 @@ * @version $Id: $Id */ public class HXResponse { - public String name = "test"; + public String name = "test"; - public Double feedTemperature1; - public Double dischargeTemperature1; - public Double HXthermalEfectiveness; + public Double feedTemperature1; + public Double dischargeTemperature1; + public Double HXthermalEfectiveness; - public Double feedTemperature2; - public Double dischargeTemperature2; + public Double feedTemperature2; + public Double dischargeTemperature2; - public Double dutyBalance; + public Double dutyBalance; - /** - *- * Constructor for HXResponse. - *
- */ - public HXResponse() {} + /** + *+ * Constructor for HXResponse. + *
+ */ + public HXResponse() {} - /** - *- * Constructor for HXResponse. - *
- * - * @param inputHeatExchenger a - * {@link neqsim.processSimulation.processEquipment.heatExchanger.HeatExchanger} object - */ - public HXResponse(HeatExchanger inputHeatExchenger) { - name = inputHeatExchenger.getName(); + /** + *+ * Constructor for HXResponse. + *
+ * + * @param inputHeatExchenger a {@link neqsim.processSimulation.processEquipment.heatExchanger.HeatExchanger} object + */ + public HXResponse(HeatExchanger inputHeatExchenger) { + name = inputHeatExchenger.getName(); - feedTemperature1 = inputHeatExchenger.getInStream(0).getTemperature("C"); - dischargeTemperature1 = inputHeatExchenger.getOutStream(0).getTemperature("C"); + feedTemperature1 = inputHeatExchenger.getInStream(0).getTemperature("C"); + dischargeTemperature1 = inputHeatExchenger.getOutStream(0).getTemperature("C"); - feedTemperature2 = inputHeatExchenger.getInStream(1).getTemperature("C"); - dischargeTemperature2 = inputHeatExchenger.getOutStream(1).getTemperature("C"); + feedTemperature2 = inputHeatExchenger.getInStream(1).getTemperature("C"); + dischargeTemperature2 = inputHeatExchenger.getOutStream(1).getTemperature("C"); - HXthermalEfectiveness = inputHeatExchenger.getThermalEffectiveness(); + HXthermalEfectiveness = inputHeatExchenger.getThermalEffectiveness(); - dutyBalance = inputHeatExchenger.getHotColdDutyBalance(); - } + dutyBalance = inputHeatExchenger.getHotColdDutyBalance(); + } } diff --git a/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java index 283ba84cb2..d5c44ffacd 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/HeaterResponse.java @@ -11,26 +11,25 @@ * @version $Id: $Id */ public class HeaterResponse { - public String name = "test"; + public String name = "test"; - public Double feedTemperature; - public Double dischargeTemperature; - public Double duty; + public Double feedTemperature; + public Double dischargeTemperature; + public Double duty; - /** - *- * Constructor for HeaterResponse. - *
- * - * @param inputHeater a {@link neqsim.processSimulation.processEquipment.heatExchanger.Heater} - * object - */ - public HeaterResponse(Heater inputHeater) { - name = inputHeater.getName(); + /** + *+ * Constructor for HeaterResponse. + *
+ * + * @param inputHeater a {@link neqsim.processSimulation.processEquipment.heatExchanger.Heater} object + */ + public HeaterResponse(Heater inputHeater) { + name = inputHeater.getName(); - feedTemperature = inputHeater.getInletStream().getTemperature("C"); - dischargeTemperature = inputHeater.getOutletStream().getTemperature("C"); + feedTemperature = inputHeater.getInletStream().getTemperature("C"); + dischargeTemperature = inputHeater.getOutletStream().getTemperature("C"); - duty = inputHeater.getDuty(); - } + duty = inputHeater.getDuty(); + } } diff --git a/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java index 727eca9f28..4c50c5a5e0 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/MPMResponse.java @@ -11,23 +11,23 @@ * @version $Id: $Id */ public class MPMResponse { - public String name; - public Double massFLow, GOR, GOR_std, gasDensity, oilDensity, waterDensity; + public String name; + public Double massFLow, GOR, GOR_std, gasDensity, oilDensity, waterDensity; - /** - *- * Constructor for MPMResponse. - *
- * - * @param inputMPM a {@link neqsim.processSimulation.measurementDevice.MultiPhaseMeter} object - */ - public MPMResponse(MultiPhaseMeter inputMPM) { - name = inputMPM.getName(); - massFLow = inputMPM.getMeasuredValue(); - GOR = inputMPM.getMeasuredValue("GOR", ""); - GOR_std = inputMPM.getMeasuredValue("GOR_std", ""); - gasDensity = inputMPM.getMeasuredValue("gasDensity", ""); - oilDensity = inputMPM.getMeasuredValue("oilDensity", ""); - waterDensity = inputMPM.getMeasuredValue("waterDensity", ""); - } + /** + *+ * Constructor for MPMResponse. + *
+ * + * @param inputMPM a {@link neqsim.processSimulation.measurementDevice.MultiPhaseMeter} object + */ + public MPMResponse(MultiPhaseMeter inputMPM) { + name = inputMPM.getName(); + massFLow = inputMPM.getMeasuredValue(); + GOR = inputMPM.getMeasuredValue("GOR", ""); + GOR_std = inputMPM.getMeasuredValue("GOR_std", ""); + gasDensity = inputMPM.getMeasuredValue("gasDensity", ""); + oilDensity = inputMPM.getMeasuredValue("oilDensity", ""); + waterDensity = inputMPM.getMeasuredValue("waterDensity", ""); + } } diff --git a/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java index b33c98f311..d0221796b8 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/PumpResponse.java @@ -11,51 +11,51 @@ * @version $Id: $Id */ public class PumpResponse { - public String name = "test"; + public String name = "test"; - public Double suctionTemperature; - public Double dischargeTemperature; - public Double suctionPressure; - public Double dischargePressure; - // public Double polytropicHead; - // public Double polytropicEfficiency; - public Double power; - public Double suctionVolumeFlow; - public Double internalVolumeFlow; - public Double dischargeVolumeFlow; - public Double molarMass; - public Double suctionMassDensity; - public Double dischargeMassDensity; - public Double massflow; - public Integer speed; + public Double suctionTemperature; + public Double dischargeTemperature; + public Double suctionPressure; + public Double dischargePressure; + // public Double polytropicHead; + // public Double polytropicEfficiency; + public Double power; + public Double suctionVolumeFlow; + public Double internalVolumeFlow; + public Double dischargeVolumeFlow; + public Double molarMass; + public Double suctionMassDensity; + public Double dischargeMassDensity; + public Double massflow; + public Integer speed; - /** - *- * Constructor for PumpResponse. - *
- * - * @param inputPump a {@link neqsim.processSimulation.processEquipment.pump.Pump} object - */ - public PumpResponse(Pump inputPump) { - name = inputPump.getName(); - molarMass = inputPump.getInletStream().getFluid().getMolarMass(); - suctionMassDensity = inputPump.getInletStream().getFluid().getDensity("kg/m3"); - dischargeMassDensity = inputPump.getOutletStream().getFluid().getDensity("kg/m3"); - massflow = inputPump.getInletStream().getFluid().getFlowRate("kg/hr"); - suctionVolumeFlow = inputPump.getInletStream().getFluid().getFlowRate("m3/hr"); - dischargeVolumeFlow = inputPump.getOutletStream().getFluid().getFlowRate("m3/hr"); - suctionPressure = inputPump.getInletStream().getPressure("bara"); - suctionTemperature = inputPump.getInletStream().getTemperature("C"); - dischargeTemperature = inputPump.getOutletStream().getTemperature("C"); - dischargePressure = inputPump.getOutletStream().getPressure("bara"); + /** + *+ * Constructor for PumpResponse. + *
+ * + * @param inputPump a {@link neqsim.processSimulation.processEquipment.pump.Pump} object + */ + public PumpResponse(Pump inputPump) { + name = inputPump.getName(); + molarMass = inputPump.getInletStream().getFluid().getMolarMass(); + suctionMassDensity = inputPump.getInletStream().getFluid().getDensity("kg/m3"); + dischargeMassDensity = inputPump.getOutletStream().getFluid().getDensity("kg/m3"); + massflow = inputPump.getInletStream().getFluid().getFlowRate("kg/hr"); + suctionVolumeFlow = inputPump.getInletStream().getFluid().getFlowRate("m3/hr"); + dischargeVolumeFlow = inputPump.getOutletStream().getFluid().getFlowRate("m3/hr"); + suctionPressure = inputPump.getInletStream().getPressure("bara"); + suctionTemperature = inputPump.getInletStream().getTemperature("C"); + dischargeTemperature = inputPump.getOutletStream().getTemperature("C"); + dischargePressure = inputPump.getOutletStream().getPressure("bara"); - // polytropicHead = inputCompressor.getPolytropicFluidHead(); - // polytropicEfficiency =inputCompressor.getPolytropicEfficiency(); - power = inputPump.getPower("W"); // "kW"); - // speed = inputPump.getSpeed(); - // if(inputCompressor.getAntiSurge().isActive()){ - // internalVolumeFlow = - // inputCompressor.getCompressorChart().getSurgeCurve().getSurgeFlow(polytropicHead); - // } - } + // polytropicHead = inputCompressor.getPolytropicFluidHead(); + // polytropicEfficiency =inputCompressor.getPolytropicEfficiency(); + power = inputPump.getPower("W"); // "kW"); + // speed = inputPump.getSpeed(); + // if(inputCompressor.getAntiSurge().isActive()){ + // internalVolumeFlow = + // inputCompressor.getCompressorChart().getSurgeCurve().getSurgeFlow(polytropicHead); + // } + } } diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java index fea4ade7d4..9b8c623b5a 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java @@ -3,59 +3,64 @@ import neqsim.processSimulation.processEquipment.stream.StreamInterface; /** - *StreamResponse class.
+ *+ * StreamResponse class. + *
* * @author asmund * @version $Id: $Id */ public class StreamResponse { - public String name; - public Fluid fluid; - public Double temperature; - public Double pressure; - public Double volumeFlow; - public Double molarMass; - public Double massDensity; - public Double massflow; - public Double massflowGas; - public Double massflowOil; - public Double massflowAqueous; + public String name; + public Fluid fluid; + public Double temperature; + public Double pressure; + public Double volumeFlow; + public Double molarMass; + public Double massDensity; + public Double massflow; + public Double massflowGas; + public Double massflowOil; + public Double massflowAqueous; - /** - *Constructor for StreamResponse.
- * - * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object - */ - public StreamResponse(StreamInterface inputStream){ - name = inputStream.getName(); - fluid = new Fluid(inputStream.getFluid()); - temperature = inputStream.getTemperature("C"); - pressure = inputStream.getPressure("bara"); - molarMass = inputStream.getFluid().getMolarMass(); - massDensity = inputStream.getFluid().getDensity("kg/m3"); - massflow = inputStream.getFluid().getFlowRate("kg/hr"); - volumeFlow = inputStream.getFluid().getFlowRate("m3/hr"); + /** + *+ * Constructor for StreamResponse. + *
+ * + * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object + */ + public StreamResponse(StreamInterface inputStream) { + name = inputStream.getName(); + fluid = new Fluid(inputStream.getFluid()); + temperature = inputStream.getTemperature("C"); + pressure = inputStream.getPressure("bara"); + molarMass = inputStream.getFluid().getMolarMass(); + massDensity = inputStream.getFluid().getDensity("kg/m3"); + massflow = inputStream.getFluid().getFlowRate("kg/hr"); + volumeFlow = inputStream.getFluid().getFlowRate("m3/hr"); - if (inputStream.getFluid().hasPhaseType("gas")) { - massflowGas = inputStream.getFluid().getPhase("gas").getFlowRate("kg/hr"); - } else { - massflowGas = 0.0; - } - if (inputStream.getFluid().hasPhaseType("aqueous")) { - massflowAqueous = inputStream.getFluid().getPhase("aqueous").getFlowRate("kg/hr"); - } else { - massflowAqueous = 0.0; - } - if (inputStream.getFluid().hasPhaseType("oil")) { - massflowOil = inputStream.getFluid().getPhase("oil").getFlowRate("kg/hr"); - } else { - massflowOil = 0.0; - } + if (inputStream.getFluid().hasPhaseType("gas")) { + massflowGas = inputStream.getFluid().getPhase("gas").getFlowRate("kg/hr"); + } else { + massflowGas = 0.0; } - - /** - *print.
- */ - public void print(){ + if (inputStream.getFluid().hasPhaseType("aqueous")) { + massflowAqueous = inputStream.getFluid().getPhase("aqueous").getFlowRate("kg/hr"); + } else { + massflowAqueous = 0.0; + } + if (inputStream.getFluid().hasPhaseType("oil")) { + massflowOil = inputStream.getFluid().getPhase("oil").getFlowRate("kg/hr"); + } else { + massflowOil = 0.0; } + } + + /** + *+ * print. + *
+ */ + public void print() {} } diff --git a/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java index 16fc9e8f58..1214014a73 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/ThreePhaseSeparatorResponse.java @@ -12,40 +12,38 @@ * @version $Id: $Id */ public class ThreePhaseSeparatorResponse { - public String name; - public Double gasLoadFactor; - public Double massflow; - public Fluid gasFluid, oilFluid; + public String name; + public Double gasLoadFactor; + public Double massflow; + public Fluid gasFluid, oilFluid; - /** - *- * Constructor for ThreePhaseSeparatorResponse. - *
- * - * @param inputSeparator a - * {@link neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator} object - */ - public ThreePhaseSeparatorResponse(ThreePhaseSeparator inputSeparator) { - name = inputSeparator.getName(); - massflow = inputSeparator.getFluid().getFlowRate("kg/hr"); - gasLoadFactor = inputSeparator.getGasLoadFactor(); - oilFluid = new Fluid(inputSeparator.getOilOutStream().getFluid()); - gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid()); - } + /** + *+ * Constructor for ThreePhaseSeparatorResponse. + *
+ * + * @param inputSeparator a {@link neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator} object + */ + public ThreePhaseSeparatorResponse(ThreePhaseSeparator inputSeparator) { + name = inputSeparator.getName(); + massflow = inputSeparator.getFluid().getFlowRate("kg/hr"); + gasLoadFactor = inputSeparator.getGasLoadFactor(); + oilFluid = new Fluid(inputSeparator.getOilOutStream().getFluid()); + gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid()); + } - /** - *- * Constructor for ThreePhaseSeparatorResponse. - *
- * - * @param inputSeparator a {@link neqsim.processSimulation.processEquipment.separator.Separator} - * object - */ - public ThreePhaseSeparatorResponse(Separator inputSeparator) { - name = inputSeparator.getName(); - massflow = inputSeparator.getFluid().getFlowRate("kg/hr"); - gasLoadFactor = inputSeparator.getGasLoadFactor(); - oilFluid = new Fluid(inputSeparator.getLiquidOutStream().getFluid()); - gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid()); - } + /** + *+ * Constructor for ThreePhaseSeparatorResponse. + *
+ * + * @param inputSeparator a {@link neqsim.processSimulation.processEquipment.separator.Separator} object + */ + public ThreePhaseSeparatorResponse(Separator inputSeparator) { + name = inputSeparator.getName(); + massflow = inputSeparator.getFluid().getFlowRate("kg/hr"); + gasLoadFactor = inputSeparator.getGasLoadFactor(); + oilFluid = new Fluid(inputSeparator.getLiquidOutStream().getFluid()); + gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid()); + } } diff --git a/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java index 30a1bbe6be..e3abbcf165 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java @@ -11,20 +11,20 @@ * @version $Id: $Id */ public class WellAllocatorResponse { - public String name; - public Double gasExportRate, oilExportRate, totalExportRate; + public String name; + public Double gasExportRate, oilExportRate, totalExportRate; - /** - *- * Constructor for WellAllocatorResponse. - *
- * - * @param inputAllocator a {@link neqsim.processSimulation.measurementDevice.WellAllocator} object - */ - public WellAllocatorResponse(WellAllocator inputAllocator) { - name = inputAllocator.getName(); - gasExportRate = inputAllocator.getMeasuredValue("gas export rate", "kg/hr"); - oilExportRate = inputAllocator.getMeasuredValue("oil export rate", "kg/hr"); - totalExportRate = inputAllocator.getMeasuredValue("total export rate", "kg/hr"); - } + /** + *+ * Constructor for WellAllocatorResponse. + *
+ * + * @param inputAllocator a {@link neqsim.processSimulation.measurementDevice.WellAllocator} object + */ + public WellAllocatorResponse(WellAllocator inputAllocator) { + name = inputAllocator.getName(); + gasExportRate = inputAllocator.getMeasuredValue("gas export rate", "kg/hr"); + oilExportRate = inputAllocator.getMeasuredValue("oil export rate", "kg/hr"); + totalExportRate = inputAllocator.getMeasuredValue("total export rate", "kg/hr"); + } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java b/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java index c45dde1adb..0ee9048b34 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java @@ -54,4 +54,3 @@ public void addComponent(String name, double moles, double molesInPhase, int com componentArray[compNumber] = new ComponentSrk(name, moles, molesInPhase, compNumber); } } - diff --git a/src/main/java/neqsim/util/NamedInterface.java b/src/main/java/neqsim/util/NamedInterface.java index 8b9f26845a..6a0d7d6fa2 100644 --- a/src/main/java/neqsim/util/NamedInterface.java +++ b/src/main/java/neqsim/util/NamedInterface.java @@ -1,23 +1,25 @@ package neqsim.util; /** - *NamedInterface interface.
+ *+ * NamedInterface interface. + *
* * @author ASMF * @version $Id: $Id */ public interface NamedInterface { - /** - * Getter for property Name. - * - * @return a {@link java.lang.String} object - */ - public String getName(); + /** + * Getter for property Name. + * + * @return a {@link java.lang.String} object + */ + public String getName(); - /** - * Setter for property Name. - * - * @param name a {@link java.lang.String} object - */ - public void setName(String name); + /** + * Setter for property Name. + * + * @param name a {@link java.lang.String} object + */ + public void setName(String name); } diff --git a/src/main/java/neqsim/util/exception/TooManyIterationsException.java b/src/main/java/neqsim/util/exception/TooManyIterationsException.java index a7e7d41de4..1452843f8f 100644 --- a/src/main/java/neqsim/util/exception/TooManyIterationsException.java +++ b/src/main/java/neqsim/util/exception/TooManyIterationsException.java @@ -9,27 +9,27 @@ * @version $Id: $Id */ public class TooManyIterationsException extends neqsim.util.exception.ThermoException { - private static final long serialVersionUID = 1000; + private static final long serialVersionUID = 1000; - /** - * Constructs aTooManyIterationsException
with a standard error message.
- *
- * @param className Class that exception is raised from
- * @param methodName Method that exception is raised from
- * @param maxIterations the maximum number of iterations
- */
- public TooManyIterationsException(String className, String methodName, long maxIterations) {
- super(className, methodName, "Exceeded maximum iterations " + maxIterations);
- }
+ /**
+ * Constructs a TooManyIterationsException
with a standard error message.
+ *
+ * @param className Class that exception is raised from
+ * @param methodName Method that exception is raised from
+ * @param maxIterations the maximum number of iterations
+ */
+ public TooManyIterationsException(String className, String methodName, long maxIterations) {
+ super(className, methodName, "Exceeded maximum iterations " + maxIterations);
+ }
- /**
- * Constructs a TooManyIterationsException
with a standard error message.
- *
- * @param obj object that exception is raised from
- * @param methodName method that exception is raised from
- * @param maxIterations the maximum number of iterations
- */
- public TooManyIterationsException(Object obj, String methodName, long maxIterations) {
- this(obj.getClass().getSimpleName(), methodName, maxIterations);
- }
+ /**
+ * Constructs a TooManyIterationsException
with a standard error message.
+ *
+ * @param obj object that exception is raised from
+ * @param methodName method that exception is raised from
+ * @param maxIterations the maximum number of iterations
+ */
+ public TooManyIterationsException(Object obj, String methodName, long maxIterations) {
+ this(obj.getClass().getSimpleName(), methodName, maxIterations);
+ }
}
diff --git a/src/main/java/neqsim/util/unit/NeqSimUnitSet.java b/src/main/java/neqsim/util/unit/NeqSimUnitSet.java
index dd0531045a..f7b5b8a41d 100644
--- a/src/main/java/neqsim/util/unit/NeqSimUnitSet.java
+++ b/src/main/java/neqsim/util/unit/NeqSimUnitSet.java
@@ -9,96 +9,96 @@
* @version $Id: $Id
*/
public class NeqSimUnitSet {
- /**
- *
- * Getter for the field componentConcentrationUnit
.
- *
+ * Getter for the field componentConcentrationUnit
.
+ *
- * Setter for the field componentConcentrationUnit
.
- *
+ * Setter for the field componentConcentrationUnit
.
+ *
- * Getter for the field flowRateUnit
.
- *
+ * Getter for the field flowRateUnit
.
+ *
- * Setter for the field flowRateUnit
.
- *
+ * Setter for the field flowRateUnit
.
+ *
- * Getter for the field pressureUnit
.
- *
+ * Getter for the field pressureUnit
.
+ *
- * Setter for the field pressureUnit
.
- *
+ * Setter for the field pressureUnit
.
+ *
- * Getter for the field temperatureUnit
.
- *
+ * Getter for the field temperatureUnit
.
+ *
- * Setter for the field temperatureUnit
.
- *
+ * Setter for the field temperatureUnit
.
+ *
- * Constructor for TemperatureUnit. - *
- * - * @param value a double - * @param name a {@link java.lang.String} object - */ - public TemperatureUnit(double value, String name) { - super(value, name); - } + /** + *+ * Constructor for TemperatureUnit. + *
+ * + * @param value a double + * @param name a {@link java.lang.String} object + */ + public TemperatureUnit(double value, String name) { + super(value, name); + } - /** {@inheritDoc} */ - @Override - public double getValue(double val, String fromunit, String tounit) { - invalue = val; - return getConversionFactor(fromunit) / getConversionFactor(tounit) * invalue; - } + /** {@inheritDoc} */ + @Override + public double getValue(double val, String fromunit, String tounit) { + invalue = val; + return getConversionFactor(fromunit) / getConversionFactor(tounit) * invalue; + } - /** {@inheritDoc} */ - @Override - public double getValue(String tounit) { - if (tounit.equals("C")) { - return getConversionFactor(inunit) / getConversionFactor("K") * invalue - 273.15; - } - return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue; + /** {@inheritDoc} */ + @Override + public double getValue(String tounit) { + if (tounit.equals("C")) { + return getConversionFactor(inunit) / getConversionFactor("K") * invalue - 273.15; } + return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue; + } - /** - *- * getConversionFactor. - *
- * - * @param name a {@link java.lang.String} object - * @return a double - */ - public double getConversionFactor(String name) { - double conversionFactor = 1.0; - switch (name) { - case "K": - conversionFactor = 1.0; - break; - case "R": - conversionFactor = 5.0 / 9.0; - break; - } - return conversionFactor; + /** + *+ * getConversionFactor. + *
+ * + * @param name a {@link java.lang.String} object + * @return a double + */ + public double getConversionFactor(String name) { + double conversionFactor = 1.0; + switch (name) { + case "K": + conversionFactor = 1.0; + break; + case "R": + conversionFactor = 5.0 / 9.0; + break; } + return conversionFactor; + } } From b46223fa771095efe1326bb95061f816f454ecba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 15 Mar 2024 09:34:54 +0100 Subject: [PATCH 140/317] refact: simplify EOS subclass constructor --- .../java/neqsim/thermo/component/ComponentInterface.java | 2 +- src/main/java/neqsim/thermo/system/SystemBWRSEos.java | 8 +------- .../java/neqsim/thermo/system/SystemDesmukhMather.java | 3 +-- src/main/java/neqsim/thermo/system/SystemDuanSun.java | 3 +-- .../java/neqsim/thermo/system/SystemElectrolyteCPA.java | 4 ---- .../thermo/system/SystemElectrolyteCPAstatoil.java | 4 ---- src/main/java/neqsim/thermo/system/SystemEos.java | 9 +++------ .../neqsim/thermo/system/SystemFurstElectrolyteEos.java | 6 ------ .../thermo/system/SystemFurstElectrolyteEosMod2004.java | 6 ------ .../java/neqsim/thermo/system/SystemGERG2004Eos.java | 3 +-- src/main/java/neqsim/thermo/system/SystemGEWilson.java | 7 +------ .../java/neqsim/thermo/system/SystemKentEisenberg.java | 7 +------ src/main/java/neqsim/thermo/system/SystemNRTL.java | 7 +------ src/main/java/neqsim/thermo/system/SystemPrEos.java | 7 +------ src/main/java/neqsim/thermo/system/SystemPrEos1978.java | 8 +------- src/main/java/neqsim/thermo/system/SystemRKEos.java | 3 +-- src/main/java/neqsim/thermo/system/SystemSrkEos.java | 7 +------ src/main/java/neqsim/thermo/system/SystemTSTEos.java | 8 +------- src/main/java/neqsim/thermo/system/SystemThermo.java | 6 +++++- src/main/java/neqsim/thermo/system/SystemUNIFAC.java | 7 +------ src/main/java/neqsim/thermo/system/SystemUNIFACpsrk.java | 7 +------ .../thermodynamicOperations/ThermodynamicOperations.java | 2 +- .../neqsim/thermodynamicOperations/flashOps/Flash.java | 2 +- .../thermodynamicOperations/flashOps/SolidFlash.java | 2 +- .../neqsim/thermodynamicOperations/flashOps/TPflash.java | 2 +- .../thermodynamicOperations/flashOps/TPmultiflash.java | 2 +- .../flashOps/TPmultiflashWAX.java | 2 +- .../thermodynamicOperations/flashOps/TPmultiflash_1.java | 2 +- 28 files changed, 30 insertions(+), 106 deletions(-) diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java index 44429d1e59..013eed2551 100644 --- a/src/main/java/neqsim/thermo/component/ComponentInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java @@ -1835,7 +1835,7 @@ public default double getLogFugacityCoefficient() { * Setter for fieldsolidCheck
.
*
*
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public void setSolidCheck(boolean checkForSolids);
diff --git a/src/main/java/neqsim/thermo/system/SystemBWRSEos.java b/src/main/java/neqsim/thermo/system/SystemBWRSEos.java
index cd6d3f7020..49ab6bb1de 100644
--- a/src/main/java/neqsim/thermo/system/SystemBWRSEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemBWRSEos.java
@@ -46,8 +46,7 @@ public SystemBWRSEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemBWRSEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "BWRS-EOS";
attractiveTermNumber = 0;
@@ -83,11 +82,6 @@ public SystemBWRSEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemDesmukhMather.java b/src/main/java/neqsim/thermo/system/SystemDesmukhMather.java
index 9f35793817..492ac3ba15 100644
--- a/src/main/java/neqsim/thermo/system/SystemDesmukhMather.java
+++ b/src/main/java/neqsim/thermo/system/SystemDesmukhMather.java
@@ -44,8 +44,7 @@ public SystemDesmukhMather(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemDesmukhMather(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 0;
modelName = "Desmukh-Mather-model";
diff --git a/src/main/java/neqsim/thermo/system/SystemDuanSun.java b/src/main/java/neqsim/thermo/system/SystemDuanSun.java
index 710f908841..e5ece8c653 100644
--- a/src/main/java/neqsim/thermo/system/SystemDuanSun.java
+++ b/src/main/java/neqsim/thermo/system/SystemDuanSun.java
@@ -48,8 +48,7 @@ public SystemDuanSun(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemDuanSun(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 0;
modelName = "Duan-Sun-model";
diff --git a/src/main/java/neqsim/thermo/system/SystemElectrolyteCPA.java b/src/main/java/neqsim/thermo/system/SystemElectrolyteCPA.java
index 5cfc63c2e5..04512328a9 100644
--- a/src/main/java/neqsim/thermo/system/SystemElectrolyteCPA.java
+++ b/src/main/java/neqsim/thermo/system/SystemElectrolyteCPA.java
@@ -52,10 +52,6 @@ public SystemElectrolyteCPA clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] =(PhaseElectrolyteCPA) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemElectrolyteCPAstatoil.java b/src/main/java/neqsim/thermo/system/SystemElectrolyteCPAstatoil.java
index 43b369d2e7..28e77b58e4 100644
--- a/src/main/java/neqsim/thermo/system/SystemElectrolyteCPAstatoil.java
+++ b/src/main/java/neqsim/thermo/system/SystemElectrolyteCPAstatoil.java
@@ -52,10 +52,6 @@ public SystemElectrolyteCPAstatoil clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] =(PhaseElectrolyteCPA) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemEos.java b/src/main/java/neqsim/thermo/system/SystemEos.java
index 1c2d07eca4..8eca58b132 100644
--- a/src/main/java/neqsim/thermo/system/SystemEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemEos.java
@@ -1,6 +1,7 @@
package neqsim.thermo.system;
/**
+ * Base class for system with EOS.
*
* @author Even Solbraa
*/
@@ -23,13 +24,9 @@ public SystemEos() {
*
* @param T The temperature in unit Kelvin
* @param P The pressure in unit bara (absolute pressure)
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
- public SystemEos(double T, double P) {
- this(T, P, false);
- }
-
public SystemEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;
+ super(T, P, checkForSolids);
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java
index 536cf9b538..14c42e70b0 100644
--- a/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java
@@ -50,12 +50,6 @@ public SystemFurstElectrolyteEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseModifiedFurstElectrolyteEos)
- // phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEosMod2004.java b/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEosMod2004.java
index aaa74e07e9..dd452464d3 100644
--- a/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEosMod2004.java
+++ b/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEosMod2004.java
@@ -50,12 +50,6 @@ public SystemFurstElectrolyteEosMod2004 clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseModifiedFurstElectrolyteEos)
- // phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemGERG2004Eos.java b/src/main/java/neqsim/thermo/system/SystemGERG2004Eos.java
index 3141e6db26..e803e4e095 100644
--- a/src/main/java/neqsim/thermo/system/SystemGERG2004Eos.java
+++ b/src/main/java/neqsim/thermo/system/SystemGERG2004Eos.java
@@ -44,8 +44,7 @@ public SystemGERG2004Eos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemGERG2004Eos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "GERG2004-EOS";
for (int i = 0; i < numberOfPhases; i++) {
diff --git a/src/main/java/neqsim/thermo/system/SystemGEWilson.java b/src/main/java/neqsim/thermo/system/SystemGEWilson.java
index 56a3d18f32..0ed121ac99 100644
--- a/src/main/java/neqsim/thermo/system/SystemGEWilson.java
+++ b/src/main/java/neqsim/thermo/system/SystemGEWilson.java
@@ -44,8 +44,7 @@ public SystemGEWilson(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemGEWilson(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 0;
modelName = "UNIFAC-GE-model";
@@ -77,10 +76,6 @@ public SystemGEWilson clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemKentEisenberg.java b/src/main/java/neqsim/thermo/system/SystemKentEisenberg.java
index 110e0b1372..220cba6746 100644
--- a/src/main/java/neqsim/thermo/system/SystemKentEisenberg.java
+++ b/src/main/java/neqsim/thermo/system/SystemKentEisenberg.java
@@ -44,8 +44,7 @@ public SystemKentEisenberg(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemKentEisenberg(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 0;
modelName = "Kent Eisenberg-model";
@@ -77,10 +76,6 @@ public SystemKentEisenberg clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemNRTL.java b/src/main/java/neqsim/thermo/system/SystemNRTL.java
index 9cb9bb31ba..fa201b69dc 100644
--- a/src/main/java/neqsim/thermo/system/SystemNRTL.java
+++ b/src/main/java/neqsim/thermo/system/SystemNRTL.java
@@ -44,8 +44,7 @@ public SystemNRTL(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemNRTL(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 0;
modelName = "NRTL-GE-model";
@@ -77,10 +76,6 @@ public SystemNRTL clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPrEos.java b/src/main/java/neqsim/thermo/system/SystemPrEos.java
index fe5a946047..ff5827532a 100644
--- a/src/main/java/neqsim/thermo/system/SystemPrEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemPrEos.java
@@ -38,8 +38,7 @@ public SystemPrEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 1;
modelName = "PR-EOS";
getCharacterization().setTBPModel("PedersenPR");
@@ -76,10 +75,6 @@ public SystemPrEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPrEos1978.java b/src/main/java/neqsim/thermo/system/SystemPrEos1978.java
index 02824f42f4..aefbe5a600 100644
--- a/src/main/java/neqsim/thermo/system/SystemPrEos1978.java
+++ b/src/main/java/neqsim/thermo/system/SystemPrEos1978.java
@@ -44,8 +44,7 @@ public SystemPrEos1978(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrEos1978(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 13;
modelName = "PR1978-EOS";
@@ -81,11 +80,6 @@ public SystemPrEos1978 clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemRKEos.java b/src/main/java/neqsim/thermo/system/SystemRKEos.java
index 17cc579a9b..148b755387 100644
--- a/src/main/java/neqsim/thermo/system/SystemRKEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemRKEos.java
@@ -43,8 +43,7 @@ public SystemRKEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemRKEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 5;
modelName = "RK-EOS";
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkEos.java b/src/main/java/neqsim/thermo/system/SystemSrkEos.java
index 3f9e9e0aca..aed2de75d6 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkEos.java
@@ -38,8 +38,7 @@ public SystemSrkEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "SRK-EOS";
getCharacterization().setTBPModel("PedersenSRK");
attractiveTermNumber = 0;
@@ -76,10 +75,6 @@ public SystemSrkEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemTSTEos.java b/src/main/java/neqsim/thermo/system/SystemTSTEos.java
index b10a86714a..2def778082 100644
--- a/src/main/java/neqsim/thermo/system/SystemTSTEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemTSTEos.java
@@ -46,8 +46,7 @@ public SystemTSTEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemTSTEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 14;
modelName = "TST-EOS";
@@ -83,11 +82,6 @@ public SystemTSTEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index 1bd0a3fa2f..d1039b8360 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -150,8 +150,9 @@ public SystemThermo() {
*
* @param T The temperature in unit Kelvin
* @param P The pressure in unit bara (absolute pressure)
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
- public SystemThermo(double T, double P) {
+ public SystemThermo(double T, double P, boolean checkForSolids) {
this();
if (T < 0.0) {
neqsim.util.exception.InvalidInputException ex =
@@ -166,6 +167,8 @@ public SystemThermo(double T, double P) {
"SystemThermo", "P", "is negative");
throw new RuntimeException(ex);
}
+
+ this.solidPhaseCheck = checkForSolids;
}
/** {@inheritDoc} */
@@ -547,6 +550,7 @@ public SystemThermo clone() {
for (int i = 0; i < getMaxNumberOfPhases(); i++) {
clonedSystem.phaseArray[i] = phaseArray[i].clone();
}
+
return clonedSystem;
}
diff --git a/src/main/java/neqsim/thermo/system/SystemUNIFAC.java b/src/main/java/neqsim/thermo/system/SystemUNIFAC.java
index 1f0bdb3ebe..e728b386b0 100644
--- a/src/main/java/neqsim/thermo/system/SystemUNIFAC.java
+++ b/src/main/java/neqsim/thermo/system/SystemUNIFAC.java
@@ -45,8 +45,7 @@ public SystemUNIFAC(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemUNIFAC(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 0;
modelName = "UNIFAC-GE-model";
solidPhaseCheck = checkForSolids;
@@ -79,10 +78,6 @@ public SystemUNIFAC clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemUNIFACpsrk.java b/src/main/java/neqsim/thermo/system/SystemUNIFACpsrk.java
index 8b0b244c18..c742b8cd66 100644
--- a/src/main/java/neqsim/thermo/system/SystemUNIFACpsrk.java
+++ b/src/main/java/neqsim/thermo/system/SystemUNIFACpsrk.java
@@ -44,8 +44,7 @@ public SystemUNIFACpsrk(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemUNIFACpsrk(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 0;
modelName = "UNIFAC-GE-model";
solidPhaseCheck = checkForSolids;
@@ -78,10 +77,6 @@ public SystemUNIFACpsrk clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
index f08546c2b5..70eb9d7add 100644
--- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
+++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
@@ -169,7 +169,7 @@ public void TPflash() {
* TPflash.
*
*
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public void TPflash(boolean checkForSolids) {
operation = new neqsim.thermodynamicOperations.flashOps.TPflash(system, checkForSolids);
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/Flash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/Flash.java
index e257068605..5a78671c35 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/Flash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/Flash.java
@@ -47,7 +47,7 @@ public abstract class Flash extends BaseOperation {
double[] tm;
int lowestGibbsEnergyPhase = 0;
sysNewtonRhapsonTPflash secondOrderSolver;
- /** Set true to check for solid phase and do solid phase calculations. */
+ /** Set true to do solid phase check and calculations */
protected boolean solidCheck = false;
protected boolean stabilityCheck = false;
protected boolean findLowestGibbsPhaseIsChecked = false;
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/SolidFlash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/SolidFlash.java
index 21c7f703ae..ceac27e312 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/SolidFlash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/SolidFlash.java
@@ -56,7 +56,7 @@ public void setSolidComponent(int i) {
*
*
* @param system a {@link neqsim.thermo.system.SystemInterface} object
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public SolidFlash(SystemInterface system, boolean checkForSolids) {
super(system, checkForSolids);
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
index c51c7cf648..78a856f410 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
@@ -55,7 +55,7 @@ public TPflash(SystemInterface system) {
*
*
* @param system a {@link neqsim.thermo.system.SystemInterface} object
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public TPflash(SystemInterface system, boolean checkForSolids) {
this(system);
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java
index fcdc729b9a..1c2f7240c6 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash.java
@@ -59,7 +59,7 @@ public TPmultiflash(SystemInterface system) {
*
*
* @param system a {@link neqsim.thermo.system.SystemInterface} object
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public TPmultiflash(SystemInterface system, boolean checkForSolids) {
super(system, checkForSolids);
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflashWAX.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflashWAX.java
index 8b6716c3df..eed4f4d726 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflashWAX.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflashWAX.java
@@ -44,7 +44,7 @@ public TPmultiflashWAX(SystemInterface system) {
*
*
* @param system a {@link neqsim.thermo.system.SystemInterface} object
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public TPmultiflashWAX(SystemInterface system, boolean checkForSolids) {
super(system, checkForSolids);
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash_1.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash_1.java
index 70a895bb93..c034293c6f 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash_1.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPmultiflash_1.java
@@ -48,7 +48,7 @@ public TPmultiflash_1(SystemInterface system) {
*
*
* @param system a {@link neqsim.thermo.system.SystemInterface} object
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public TPmultiflash_1(SystemInterface system, boolean checkForSolids) {
super(system, checkForSolids);
From 6d92a4a175da181153661ec050531bb9b797738a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Fri, 15 Mar 2024 11:56:51 +0100
Subject: [PATCH 141/317] refact: simplify super ctor calls
---
.../thermo/system/SystemFurstElectrolyteEos.java | 1 -
.../neqsim/thermo/system/SystemPrMathiasCopeman.java | 7 +------
src/main/java/neqsim/thermo/system/SystemPsrkEos.java | 7 +------
.../neqsim/thermo/system/SystemSrkMathiasCopeman.java | 7 +------
.../thermo/system/SystemSrkSchwartzentruberEos.java | 7 +------
.../java/neqsim/thermo/system/SystemSrkTwuCoonEos.java | 7 +------
.../neqsim/thermo/system/SystemSrkTwuCoonParamEos.java | 7 +------
.../thermo/system/SystemSrkTwuCoonStatoilEos.java | 7 +------
.../java/neqsim/thermo/system/SystemUMRPRUEos.java | 3 +--
.../java/neqsim/thermo/system/SystemUMRPRUMCEos.java | 10 +---------
10 files changed, 9 insertions(+), 54 deletions(-)
diff --git a/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java
index 14c42e70b0..49d898963c 100644
--- a/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java
@@ -3,7 +3,6 @@
import neqsim.thermo.phase.PhaseModifiedFurstElectrolyteEos;
/**
- *
* This class defines a thermodynamic system using the electrolyte the Furst Electrolyte Eos.
*
* @author Even Solbraa
diff --git a/src/main/java/neqsim/thermo/system/SystemPrMathiasCopeman.java b/src/main/java/neqsim/thermo/system/SystemPrMathiasCopeman.java
index 2b047e3ecd..19ba254b87 100644
--- a/src/main/java/neqsim/thermo/system/SystemPrMathiasCopeman.java
+++ b/src/main/java/neqsim/thermo/system/SystemPrMathiasCopeman.java
@@ -40,8 +40,7 @@ public SystemPrMathiasCopeman(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrMathiasCopeman(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 13;
modelName = "Mathias-Copeman-PR-EOS";
}
@@ -56,10 +55,6 @@ public SystemPrMathiasCopeman clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPsrkEos.java b/src/main/java/neqsim/thermo/system/SystemPsrkEos.java
index 4933619c61..9716498992 100644
--- a/src/main/java/neqsim/thermo/system/SystemPsrkEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemPsrkEos.java
@@ -40,8 +40,7 @@ public SystemPsrkEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPsrkEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 4;
modelName = "Predictive-SRK-EOS";
}
@@ -56,10 +55,6 @@ public SystemPsrkEos clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkMathiasCopeman.java b/src/main/java/neqsim/thermo/system/SystemSrkMathiasCopeman.java
index 6b631ec4e3..a2ee47539b 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkMathiasCopeman.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkMathiasCopeman.java
@@ -40,8 +40,7 @@ public SystemSrkMathiasCopeman(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkMathiasCopeman(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
attractiveTermNumber = 4;
modelName = "Mathias-Copeman-SRK-EOS";
}
@@ -56,10 +55,6 @@ public SystemSrkMathiasCopeman clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkSchwartzentruberEos.java b/src/main/java/neqsim/thermo/system/SystemSrkSchwartzentruberEos.java
index 92d7b58394..8372590e29 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkSchwartzentruberEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkSchwartzentruberEos.java
@@ -40,8 +40,7 @@ public SystemSrkSchwartzentruberEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkSchwartzentruberEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "ScRK-EOS";
attractiveTermNumber = 2;
}
@@ -56,10 +55,6 @@ public SystemSrkSchwartzentruberEos clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonEos.java b/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonEos.java
index 44a70c39d7..12d851c3a5 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonEos.java
@@ -40,8 +40,7 @@ public SystemSrkTwuCoonEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkTwuCoonEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "TwuCoonRK-EOS";
attractiveTermNumber = 11;
}
@@ -56,10 +55,6 @@ public SystemSrkTwuCoonEos clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonParamEos.java b/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonParamEos.java
index e7310fc8c9..8b3cfd4aa2 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonParamEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonParamEos.java
@@ -40,8 +40,7 @@ public SystemSrkTwuCoonParamEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkTwuCoonParamEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "TwuCoonRKparam-EOS";
attractiveTermNumber = 12;
}
@@ -56,10 +55,6 @@ public SystemSrkTwuCoonParamEos clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonStatoilEos.java b/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonStatoilEos.java
index f0c2d5479b..92c7283735 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonStatoilEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkTwuCoonStatoilEos.java
@@ -41,8 +41,7 @@ public SystemSrkTwuCoonStatoilEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkTwuCoonStatoilEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "TwuCoonStatoil-EOS";
attractiveTermNumber = 18;
}
@@ -57,10 +56,6 @@ public SystemSrkTwuCoonStatoilEos clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemUMRPRUEos.java b/src/main/java/neqsim/thermo/system/SystemUMRPRUEos.java
index 6f336ae796..27d9a1973e 100644
--- a/src/main/java/neqsim/thermo/system/SystemUMRPRUEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemUMRPRUEos.java
@@ -40,8 +40,7 @@ public SystemUMRPRUEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemUMRPRUEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
setBmixType(1);
modelName = "UMR-PRU-EoS";
attractiveTermNumber = 1;
diff --git a/src/main/java/neqsim/thermo/system/SystemUMRPRUMCEos.java b/src/main/java/neqsim/thermo/system/SystemUMRPRUMCEos.java
index c8e67c3eaa..0a5f2bd4d2 100644
--- a/src/main/java/neqsim/thermo/system/SystemUMRPRUMCEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemUMRPRUMCEos.java
@@ -40,17 +40,9 @@ public SystemUMRPRUMCEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemUMRPRUMCEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
- setBmixType(1);
+ super(T, P, checkForSolids);
modelName = "UMR-PRU-MC-EoS";
attractiveTermNumber = 13;
- CapeOpenProperties11 = new String[] {"speedOfSound", "jouleThomsonCoefficient",
- "internalEnergy", "internalEnergy.Dtemperature", "gibbsEnergy", "helmholtzEnergy",
- "fugacityCoefficient", "logFugacityCoefficient", "logFugacityCoefficient.Dtemperature",
- "logFugacityCoefficient.Dpressure", "logFugacityCoefficient.Dmoles", "enthalpy",
- "enthalpy.Dtemperature", "entropy", "heatCapacityCp", "heatCapacityCv", "density",
- "volume"};
}
/** {@inheritDoc} */
From f3cedc5aa0508144ca1fbbdc02900d360bab3610 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Fri, 15 Mar 2024 12:07:06 +0100
Subject: [PATCH 142/317] refact: simplify srkeos subclass constructors
---
.../java/neqsim/thermo/system/SystemCSPsrkEos.java | 4 ++--
src/main/java/neqsim/thermo/system/SystemPCSAFT.java | 9 ++-------
src/main/java/neqsim/thermo/system/SystemPCSAFTa.java | 9 ++-------
src/main/java/neqsim/thermo/system/SystemSrkCPA.java | 11 ++++-------
.../neqsim/thermo/system/SystemSrkPenelouxEos.java | 8 ++------
5 files changed, 12 insertions(+), 29 deletions(-)
diff --git a/src/main/java/neqsim/thermo/system/SystemCSPsrkEos.java b/src/main/java/neqsim/thermo/system/SystemCSPsrkEos.java
index 7311950752..446deb6ad3 100644
--- a/src/main/java/neqsim/thermo/system/SystemCSPsrkEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemCSPsrkEos.java
@@ -44,11 +44,11 @@ public SystemCSPsrkEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemCSPsrkEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "CSPsrk-EOS";
attractiveTermNumber = 0;
+ // Recreates phases created in super constructor SystemSrkEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhaseCSPsrkEos();
phaseArray[i].setTemperature(T);
diff --git a/src/main/java/neqsim/thermo/system/SystemPCSAFT.java b/src/main/java/neqsim/thermo/system/SystemPCSAFT.java
index 907b13dd5b..32bdc2f5a7 100644
--- a/src/main/java/neqsim/thermo/system/SystemPCSAFT.java
+++ b/src/main/java/neqsim/thermo/system/SystemPCSAFT.java
@@ -47,11 +47,11 @@ public SystemPCSAFT(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPCSAFT(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "PCSAFT-EOS";
attractiveTermNumber = 0;
+ // Recreates phases created in super constructor SystemSrkEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePCSAFTRahmat();
phaseArray[i].setTemperature(T);
@@ -86,11 +86,6 @@ public SystemPCSAFT clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPCSAFTa.java b/src/main/java/neqsim/thermo/system/SystemPCSAFTa.java
index b152f88740..ef03b2f1e0 100644
--- a/src/main/java/neqsim/thermo/system/SystemPCSAFTa.java
+++ b/src/main/java/neqsim/thermo/system/SystemPCSAFTa.java
@@ -44,11 +44,11 @@ public SystemPCSAFTa(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPCSAFTa(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "PCSAFTa-EOS";
attractiveTermNumber = 0;
+ // Recreates phases created in super constructor SystemSrkEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePCSAFTa();
phaseArray[i].setTemperature(T);
@@ -82,11 +82,6 @@ public SystemPCSAFTa clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkCPA.java b/src/main/java/neqsim/thermo/system/SystemSrkCPA.java
index 92928067ed..2c52580066 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkCPA.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkCPA.java
@@ -41,11 +41,12 @@ public SystemSrkCPA(double T, double P) {
*
* @param T The temperature in unit Kelvin
* @param P The pressure in unit bara (absolute pressure)
- * @param checkForSolids Set true to check for solid phase and do solid phase calculations.
+ * @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkCPA(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
+
+ // Recreates phases created in super constructor SystemSrkEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhaseSrkCPA();
phaseArray[i].setTemperature(T);
@@ -79,10 +80,6 @@ public SystemSrkCPA clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkPenelouxEos.java b/src/main/java/neqsim/thermo/system/SystemSrkPenelouxEos.java
index cb2cbd9c1e..701f961890 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkPenelouxEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkPenelouxEos.java
@@ -38,12 +38,12 @@ public SystemSrkPenelouxEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkPenelouxEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "SRK-Peneloux-EOS";
getCharacterization().setTBPModel("PedersenSRK");
attractiveTermNumber = 0;
+ // Recreates phases created in super constructor SystemSrkEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhaseSrkPenelouxEos();
phaseArray[i].setTemperature(T);
@@ -76,10 +76,6 @@ public SystemSrkPenelouxEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
return clonedSystem;
}
}
From 8775862c1cc3063a8b5a52810efdfa6b90b2fb63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Fri, 15 Mar 2024 12:08:56 +0100
Subject: [PATCH 143/317] refact: simplify preos subclass constructors
---
.../java/neqsim/thermo/system/SystemGERGwaterEos.java | 9 ++-------
src/main/java/neqsim/thermo/system/SystemPrCPA.java | 8 ++------
src/main/java/neqsim/thermo/system/SystemPrDanesh.java | 9 ++-------
.../java/neqsim/thermo/system/SystemPrEosDelft1998.java | 9 ++-------
.../java/neqsim/thermo/system/SystemPrGassemEos.java | 9 ++-------
5 files changed, 10 insertions(+), 34 deletions(-)
diff --git a/src/main/java/neqsim/thermo/system/SystemGERGwaterEos.java b/src/main/java/neqsim/thermo/system/SystemGERGwaterEos.java
index 9ca02ff647..e648660800 100644
--- a/src/main/java/neqsim/thermo/system/SystemGERGwaterEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemGERGwaterEos.java
@@ -44,11 +44,11 @@ public SystemGERGwaterEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemGERGwaterEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "GERG-water-EOS";
attractiveTermNumber = 10;
+ // Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
@@ -81,11 +81,6 @@ public SystemGERGwaterEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPrCPA.java b/src/main/java/neqsim/thermo/system/SystemPrCPA.java
index d2a6442e43..1d2d2ab100 100644
--- a/src/main/java/neqsim/thermo/system/SystemPrCPA.java
+++ b/src/main/java/neqsim/thermo/system/SystemPrCPA.java
@@ -44,10 +44,10 @@ public SystemPrCPA(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrCPA(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "CPA-PR-EOS";
+ // Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrCPA();
phaseArray[i].setTemperature(T);
@@ -80,10 +80,6 @@ public SystemPrCPA clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPrDanesh.java b/src/main/java/neqsim/thermo/system/SystemPrDanesh.java
index 11685c3b60..c42a3d7419 100644
--- a/src/main/java/neqsim/thermo/system/SystemPrDanesh.java
+++ b/src/main/java/neqsim/thermo/system/SystemPrDanesh.java
@@ -44,11 +44,11 @@ public SystemPrDanesh(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrDanesh(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "PR-Danesh-EOS";
attractiveTermNumber = 9;
+ // Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
@@ -81,11 +81,6 @@ public SystemPrDanesh clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPrEosDelft1998.java b/src/main/java/neqsim/thermo/system/SystemPrEosDelft1998.java
index 2bbc21c333..f33eee0feb 100644
--- a/src/main/java/neqsim/thermo/system/SystemPrEosDelft1998.java
+++ b/src/main/java/neqsim/thermo/system/SystemPrEosDelft1998.java
@@ -45,11 +45,11 @@ public SystemPrEosDelft1998(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrEosDelft1998(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "PR Delft1998 EOS";
attractiveTermNumber = 7;
+ // Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
@@ -81,11 +81,6 @@ public SystemPrEosDelft1998 clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemPrGassemEos.java b/src/main/java/neqsim/thermo/system/SystemPrGassemEos.java
index 10df84ce53..1f83e2167d 100644
--- a/src/main/java/neqsim/thermo/system/SystemPrGassemEos.java
+++ b/src/main/java/neqsim/thermo/system/SystemPrGassemEos.java
@@ -44,11 +44,11 @@ public SystemPrGassemEos(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemPrGassemEos(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "PR-Gassem-EOS";
attractiveTermNumber = 8;
+ // Recreates phases created in super constructor SystemPrEos
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
@@ -81,11 +81,6 @@ public SystemPrGassemEos clone() {
logger.error("Cloning failed.", ex);
}
- // clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
From e38f402a4e7cadf3be3a7315bffc86c377d8dea3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Fri, 15 Mar 2024 12:14:29 +0100
Subject: [PATCH 144/317] refact: simplify SystemSrkCPA subclass constructors
---
src/main/java/neqsim/thermo/system/SystemSrkCPAs.java | 8 ++------
.../java/neqsim/thermo/system/SystemSrkCPAstatoil.java | 9 +++------
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkCPAs.java b/src/main/java/neqsim/thermo/system/SystemSrkCPAs.java
index f13d7816df..6f86bc584d 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkCPAs.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkCPAs.java
@@ -44,10 +44,10 @@ public SystemSrkCPAs(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkCPAs(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "CPAs-SRK-EOS";
+ // Recreates phases created in super constructor SystemSrkCPA
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhaseSrkCPAsOld();
phaseArray[i].setTemperature(T);
@@ -80,10 +80,6 @@ public SystemSrkCPAs clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
diff --git a/src/main/java/neqsim/thermo/system/SystemSrkCPAstatoil.java b/src/main/java/neqsim/thermo/system/SystemSrkCPAstatoil.java
index 310fb1f4e2..61b653fcb8 100644
--- a/src/main/java/neqsim/thermo/system/SystemSrkCPAstatoil.java
+++ b/src/main/java/neqsim/thermo/system/SystemSrkCPAstatoil.java
@@ -38,10 +38,11 @@ public SystemSrkCPAstatoil(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkCPAstatoil(double T, double P, boolean checkForSolids) {
- super(T, P);
- this.solidPhaseCheck = checkForSolids;;
+ super(T, P, checkForSolids);
modelName = "CPAs-SRK-EOS-statoil";
attractiveTermNumber = 15;
+
+ // Recreates phases created in super constructor SystemSrkCPAs
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhaseSrkCPAs();
phaseArray[i].setTemperature(T);
@@ -74,10 +75,6 @@ public SystemSrkCPAstatoil clone() {
logger.error("Cloning failed.", ex);
}
- // for(int i = 0; i < numberOfPhases; i++) {
- // clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
- // }
-
return clonedSystem;
}
}
From 099a0d9700fd88aae99598cada3c1a307299b4b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Fri, 15 Mar 2024 12:56:14 +0100
Subject: [PATCH 145/317] Whitespace style (#955)
* style: whitespace and comment fixes
---
.../simulation/SaturationPressure.java | 2 +-
.../simulation/SaturationTemperature.java | 2 +-
.../ChemicalEquilibrium.java | 12 +-
.../LinearProgrammingChemicalEquilibrium.java | 66 +-
.../chemicalReaction/ChemicalReaction.java | 1 -
.../waxNode/WaxDepositionFlowNode.java | 9 +-
.../TwoPhaseTrayTowerFlowNode.java | 2 +-
.../TwoPhaseFixedStaggeredGridSolver.java | 4 +-
.../PipeFlowVisualization.java | 4 +-
.../TwoPhasePipeFlowVisualization.java | 2 +-
.../surfaceTension/GTSurfaceTension.java | 3 -
.../PFCTConductivityMethodMod86.java | 2 +-
.../viscosity/Viscosity.java | 1 +
.../conductivity/Conductivity.java | 1 +
.../viscosity/Viscosity.java | 3 +-
.../pipeline/PipelineMechanicalDesign.java | 2 +-
.../ProcessEquipmentInterface.java | 1 -
.../CompressorChartAlternativeMapLookup.java | 2 +-
.../processEquipment/expander/Expander.java | 7 +-
.../heatExchanger/HeatExchanger.java | 13 +-
.../processEquipment/manifold/Manifold.java | 2 +-
.../pipeline/AdiabaticTwoPhasePipe.java | 1 +
.../pipeline/PipeBeggsAndBrills.java | 15 +-
.../reservoir/SimpleReservoir.java | 4 +-
.../processEquipment/separator/Separator.java | 2 +-
.../subsea/SimpleFlowLine.java | 14 +-
.../processEquipment/subsea/SubseaWell.java | 12 +-
.../processEquipment/util/FlowSetter.java | 15 +-
.../processEquipment/util/PressureDrop.java | 4 +-
.../processEquipment/util/Recycle.java | 4 +-
.../processSystem/ProcessModule.java | 2 -
.../processSystem/ProcessSystem.java | 12 +-
.../processModules/DPCUModule.java | 31 +-
.../GlycolDehydrationlModule.java | 7 +-
.../gasQuality/GasChromotograpyhBase.java | 1 -
.../salesContract/ContractInterface.java | 1 -
.../LevenbergMarquardt.java | 4 +-
.../neqsim/thermo/ThermodynamicModelTest.java | 1 +
.../thermo/atomElement/UNIFACgroup.java | 4 +-
.../thermo/characterization/Characterise.java | 8 +-
.../neqsim/thermo/component/ComponentEos.java | 3 +-
.../neqsim/thermo/component/ComponentGE.java | 1 +
.../component/ComponentGENRTLmodifiedWS.java | 2 +-
.../thermo/component/ComponentGEUnifac.java | 6 +-
.../thermo/component/ComponentGEUniquac.java | 41 +-
.../ComponentGEUniquacmodifiedHV.java | 3 +-
.../thermo/component/ComponentGeDuanSun.java | 8 +-
.../thermo/component/ComponentGeNRTL.java | 4 +-
.../thermo/component/ComponentHydrateGF.java | 1 -
.../thermo/component/ComponentPrCPA.java | 3 +-
.../java/neqsim/thermo/phase/PhaseEos.java | 1 +
.../phase/PhaseGEUniquacmodifiedHV.java | 2 +-
.../neqsim/thermo/phase/PhaseInterface.java | 6 +-
.../thermo/phase/PhasePCSAFTRahmat.java | 20 +-
.../java/neqsim/thermo/phase/PhaseSrkCPA.java | 11 +-
.../java/neqsim/thermo/phase/PhaseUMRCPA.java | 11 +-
.../neqsim/thermo/system/SystemInterface.java | 3 +-
.../java/neqsim/thermo/util/GERG/DETAIL.java | 3018 ++++++++---------
.../neqsim/thermo/util/GERG/GERG2008.java | 6 +-
.../ThermodynamicOperations.java | 11 +-
.../flashOps/PHflashSingleComp.java | 4 +-
.../flashOps/TPmultiflash.java | 8 +-
.../waterDewPointTemperatureFlash.java | 2 +-
.../CricondenBarFlash.java | 10 +-
.../CricondenThermFlash.java | 11 +-
.../pTphaseEnvelope.java | 8 +-
.../pTphaseEnvelope1.java | 2 +-
.../pTphaseEnvelopeMay.java | 2 +-
.../pTphaseEnvelopeNew.java | 2 +-
.../OLGApropertyTableGeneratorWaterEven.java | 4 +-
...GApropertyTableGeneratorWaterStudents.java | 4 +-
...propertyTableGeneratorWaterStudentsPH.java | 4 +-
.../util/database/NeqSimContractDataBase.java | 2 +-
.../neqsim/util/database/NeqSimDataBase.java | 6 +-
.../database/NeqSimProcessDesignDataBase.java | 2 +-
.../java/neqsim/util/unit/LengthUnit.java | 2 +-
src/main/java/neqsim/util/unit/TimeUnit.java | 2 +-
.../simulation/SaturationTemperatureTest.java | 3 +-
.../measurementDevice/WellAllocatorTest.java | 1 -
.../absorber/SimpleAbsorberTest.java | 4 +-
.../adsorber/SimpleAdsorberTest.java | 6 +-
.../compressor/CompressorChartTest.java | 2 +-
.../distillation/DistillationColumnTest.java | 6 +-
.../processEquipment/mixer/MixerTest.java | 1 -
.../reservoir/WellFlowTest.java | 2 +-
.../separator/SeparatorTest.java | 1 -
.../processEquipment/stream/StreamTest.java | 1 -
.../processSystem/GlycolRigTest.java | 34 +-
.../processSystem/waterDegasserTest.java | 12 +-
.../util/example/OffshoreProcess3.java | 18 +-
...TEGdehydrationProcessDistillationAaHa.java | 35 +-
.../TEGdehydrationProcessDistillationGFA.java | 25 +-
.../util/example/TestNeqsim.java | 25 +-
.../util/example/TestTransientFlow.java | 4 +-
.../util/example/destillation1.java | 102 +-
.../util/example/shtokman.java | 4 +-
.../gasQuality/Standard_ISO6976Test.java | 8 +-
.../Standard_ISO6976_2016_Test.java | 3 +-
.../salesContract/BaseContractTest.java | 1 -
.../component/ComponentHydrateGFTest.java | 1 -
.../thermo/system/SystemUMRCPAEoStest.java | 2 +-
.../system/SystemUMRPRUMCEosNewTest.java | 4 +-
.../thermo/util/example/BubbleFlashCPA.java | 6 +-
.../thermo/util/example/DewPointCurve.java | 1 -
.../thermo/util/example/HydrateFlash.java | 6 +-
.../neqsim/thermo/util/example/LNGFlash.java | 2 -
.../thermo/util/example/PS_PH_flash.java | 7 +-
.../thermo/util/example/PhaseEnvelope.java | 4 +-
.../thermo/util/example/ReadFluidData2.java | 2 +-
.../neqsim/thermo/util/example/TPflash.java | 2 +-
.../thermo/util/example/TPflashDehyd.java | 34 +-
.../example/TPflashMethanolWaterPropane.java | 2 +-
.../TestCharacterizationCondensate.java | 2 +-
.../readwrite/EclipseFluidReadWriteTest.java | 3 +-
.../flashOps/Degasser.java | 3 +-
.../flashOps/PHFlashGERG2008Test.java | 1 -
.../flashOps/PHFlashTest.java | 1 -
.../flashOps/PSFlashGERG2008Test.java | 1 -
.../flashOps/TPFlashTest.java | 1 -
.../flashOps/TPFlashTestHighTemp.java | 1 -
.../flashOps/TPFlashTestWellFluid.java | 1 -
.../flashOps/WaxFlashTest.java | 1 -
.../util/example/PhaseEnvelope.java | 6 +-
123 files changed, 1901 insertions(+), 2010 deletions(-)
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java b/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java
index b82cbcf3d3..2b22f83c9f 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java
@@ -117,7 +117,7 @@ public static void main(String[] args) {
// satPresSim.getThermoSystem().display();
/*
* double saturationPressure = 350.0; double saturationTemperature = 273.15 + 80;
- *
+ *
* TuningInterface tuning = new TuneToSaturation(satPresSim);
* tuning.setSaturationConditions(saturationTemperature, saturationPressure); tuning.run();
* tuning.getSimulation().getThermoSystem().display();
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SaturationTemperature.java b/src/main/java/neqsim/PVTsimulation/simulation/SaturationTemperature.java
index 7cd1761062..ab17808195 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/SaturationTemperature.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/SaturationTemperature.java
@@ -108,7 +108,7 @@ public static void main(String[] args) {
// satPresSim.getThermoSystem().display();
/*
* double saturationPressure = 350.0; double saturationTemperature = 273.15 + 80;
- *
+ *
* TuningInterface tuning = new TuneToSaturation(satPresSim);
* tuning.setSaturationConditions(saturationTemperature, saturationPressure); tuning.run();
* tuning.getSimulation().getThermoSystem().display();
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
index ab3115c7ce..2db46cae9f 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
@@ -517,9 +517,9 @@ public double innerStep(int i, double[] n_omega, int check, double step, boolean
* public double step(){ double step=1.0; int i, check=0; double[] F = new double[NSPEC]; double[]
* F_omega = new double[NSPEC]; double[] chem_pot = new double[NSPEC]; double[] n_omega = new
* double[NSPEC];
- *
+ *
* Matrix F_matrix, F_omega_matrix, fs_matrix, f_matrix, f_omega_matrix; double fs,f,f_omega;
- *
+ *
* for(i = 0;iGetter for the field flowArrangement
.
+ * Getter for the field flowArrangement
.
+ *
Setter for the field flowArrangement
.
+ * Setter for the field flowArrangement
.
+ *
* getMixedStream. *
- * + * * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} **/ public StreamInterface getMixedStream() { diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/AdiabaticTwoPhasePipe.java b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/AdiabaticTwoPhasePipe.java index 4a74e3eb3e..987a1d909b 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/AdiabaticTwoPhasePipe.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/AdiabaticTwoPhasePipe.java @@ -284,6 +284,7 @@ public void run(UUID id) { system.setTotalFlowRate(flowLimit, maxflowunit); system.init(1); } + // SetTotalFlowRate resets beta factors, but they are fixed in run below inStream.getThermoSystem().setTotalFlowRate(system.getFlowRate(maxflowunit), maxflowunit); inStream.run(id); } else { diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java index 6f0b3aa78f..a4b82cb141 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java @@ -342,7 +342,7 @@ public void calculateMissingValue() { /** * Calculates the length based on the elevation and angle. - * + * * @return the calculated length. */ private double calculateLength() { @@ -350,9 +350,8 @@ private double calculateLength() { } /** - * * Calculates the elevation based on the length and angle. - * + * * @return the calculated elevation. */ private double calculateElevation() { @@ -360,9 +359,8 @@ private double calculateElevation() { } /** - * * Calculates the angle based on the length and elevation. - * + * * @return the calculated angle. */ private double calculateAngle() { @@ -370,7 +368,6 @@ private double calculateAngle() { } /** - * * /** *
* calcFlowRegime.
@@ -878,9 +875,9 @@ public Double getSegmentPressure(int index) {
}
/**
- *
- * @return list of results
- *
+ * Get Pressure
+ *
+ * @return ArrayList of pressure drop profile
*/
public List
* Get setGasFlowRate
*
* Get getGasFlowRate
*
* Get setOilFlowRate
*
* Get getOilFlowRate
*
* Get setWaterFlowRate
*
* Get getWaterFlowRate
*
* Constructor for PressureDrop. *
- * + * * @param name the name of the pressure drop unit */ public PressureDrop(String name) { diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java b/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java index 38a007c079..d1a2ade68a 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java @@ -294,9 +294,7 @@ public void setDownstreamProperties() { public void run(UUID id) { iterations++; /* - * if(firstTime || iterations>maxIterations) { firstTime=false; return; - * - * } + * if(firstTime || iterations>maxIterations) { firstTime=false; return; } */ double enthalpy = 0.0; diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java index fcb410d63e..ed528a1d22 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java +++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java @@ -16,9 +16,7 @@ * then run only once. * * @author [seros] - * * @version 1.0 - * */ public class ProcessModule extends SimulationBaseClass { private static final long serialVersionUID = 1000; diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java index 00c7679bf8..d0a2a555cd 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java +++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java @@ -473,16 +473,14 @@ public void run(UUID id) { /* * signalDB = new String[1000][1 + 3 * measurementDevices.size()]; - * + * * signalDB[timeStepNumber] = new String[1 + 3 * measurementDevices.size()]; for (int i = 0; i * < measurementDevices.size(); i++) { signalDB[timeStepNumber][0] = Double.toString(time); * signalDB[timeStepNumber][3 * i + 1] = ((MeasurementDeviceInterface) * measurementDevices.get(i)) .getName(); signalDB[timeStepNumber][3 * i + 2] = Double * .toString(((MeasurementDeviceInterface) measurementDevices.get(i)).getMeasuredValue()); * signalDB[timeStepNumber][3 * i + 3] = ((MeasurementDeviceInterface) - * measurementDevices.get(i)) .getUnit(); - * - * } + * measurementDevices.get(i)) .getUnit(); } */ } while ((!isConverged || (iter < 2 && hasResycle)) && iter < 100); @@ -948,12 +946,12 @@ public boolean equals(Object obj) { /* * @XmlRootElement private class Report extends Object{ public Double name; public * ArrayListConstructor for DPCUModule.
+ *+ * Constructor for DPCUModule. + *
* * @param name a {@link java.lang.String} object */ @@ -150,55 +152,54 @@ public void initializeModule() { /* * Cooler inletCooler = new Cooler("inlet well stream cooler", feedStream); * inletCooler.setOutTemperature(inletSepTemperature + 273.15); - * + * * inletSeparator = new Separator("Inlet separator", inletCooler.getOutStream()); - * + * * Cooler gasCooler = new Cooler("separator gas cooler", inletSeparator.getGasOutStream()); * gasCooler.setOutTemperature(gasScrubberTemperature + 273.15); - * + * * oilPump = new Pump("liquid pump", inletSeparator.getLiquidOutStream()); * oilPump.setOutletPressure(liquidPumpPressure); - * + * * Separator gasScrubber = new Separator("HC dew point control scrubber", * gasCooler.getOutStream()); - * + * * Recycle HPliquidRecycle = new Recycle("Resycle"); double tolerance = 1e-2; * HPliquidRecycle.setTolerance(tolerance); * HPliquidRecycle.addStream(gasScrubber.getLiquidOutStream()); * inletSeparator.addStream(HPliquidRecycle.getOutStream()); - * + * * Compressor firstStageCompressor = new Compressor("1st stage compressor", * gasScrubber.getGasOutStream()); * firstStageCompressor.setOutletPressure(firstStageOutPressure); - * + * * glycolFeedStream.getThermoSystem().setPressure(firstStageOutPressure); - * + * * Mixer glycolMixer = new Mixer("glycol injection mixer"); * glycolMixer.addStream(firstStageCompressor.getOutStream()); * glycolMixer.addStream(glycolFeedStream); - * + * * Cooler mixerAfterCooler = new Cooler("glycol mixer after cooler", * glycolMixer.getOutStream()); mixerAfterCooler.setOutTemperature(glycolScrubberTemperature + * 273.15); - * + * * glycolScrubber = new Separator("Water dew point control scrubber", * mixerAfterCooler.getOutStream()); - * + * * secondStageCompressor = new Compressor("2nd stage compressor", * glycolScrubber.getGasOutStream()); * secondStageCompressor.setOutletPressure(secondStageOutPressure); - * + * * secondStageAfterCooler = new Cooler("second stage after cooler", * secondStageCompressor.getOutStream()); * secondStageAfterCooler.setOutTemperature(exportGasTemperature + 273.15); - * + * * getOperations().add(inletCooler); getOperations().add(inletSeparator); * getOperations().add(gasCooler); getOperations().add(oilPump); * getOperations().add(gasScrubber); getOperations().add(HPliquidRecycle); * getOperations().add(firstStageCompressor); getOperations().add(glycolMixer); * getOperations().add(mixerAfterCooler); getOperations().add(glycolScrubber); * getOperations().add(secondStageCompressor); getOperations().add(secondStageAfterCooler); - * */ } diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/GlycolDehydrationlModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/GlycolDehydrationlModule.java index cb369fd0bb..7d630d93d5 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/processModules/GlycolDehydrationlModule.java +++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/GlycolDehydrationlModule.java @@ -1,10 +1,8 @@ package neqsim.processSimulation.processSystem.processModules; import java.util.UUID; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass; import neqsim.processSimulation.processEquipment.absorber.SimpleTEGAbsorber; import neqsim.processSimulation.processEquipment.heatExchanger.Cooler; @@ -63,7 +61,9 @@ public class GlycolDehydrationlModule extends ProcessModuleBaseClass { double regenerationPressure = 1.4; /** - *Constructor for GlycolDehydrationlModule.
+ *+ * Constructor for GlycolDehydrationlModule. + *
* * @param name a {@link java.lang.String} object */ @@ -203,7 +203,6 @@ public void initializeModule() { * stripperColumn.addFeedStream(valveMP.getOutStream(), 3); * stripperColumn.setCondenserTemperature(273.15 + 80.0); ((Reboiler) * stripperColumn.getReboiler()).setRefluxRatio(11.7); - * */ Heater reboiler = new Heater("reboiler", valveMP.getOutletStream()); diff --git a/src/main/java/neqsim/standards/gasQuality/GasChromotograpyhBase.java b/src/main/java/neqsim/standards/gasQuality/GasChromotograpyhBase.java index f0238c9e29..4d68315ab3 100644 --- a/src/main/java/neqsim/standards/gasQuality/GasChromotograpyhBase.java +++ b/src/main/java/neqsim/standards/gasQuality/GasChromotograpyhBase.java @@ -20,7 +20,6 @@ public class GasChromotograpyhBase extends neqsim.standards.Standard { * * * @param thermoSystem a {@link neqsim.thermo.system.SystemInterface} object - * */ public GasChromotograpyhBase(SystemInterface thermoSystem) { super("gas chromotography", "Gas composition", thermoSystem); diff --git a/src/main/java/neqsim/standards/salesContract/ContractInterface.java b/src/main/java/neqsim/standards/salesContract/ContractInterface.java index e40361a6fe..fb4bbcb159 100644 --- a/src/main/java/neqsim/standards/salesContract/ContractInterface.java +++ b/src/main/java/neqsim/standards/salesContract/ContractInterface.java @@ -130,7 +130,6 @@ public interface ContractInterface { /** * Prints the contract. - * */ public default void prettyPrint() { neqsim.thermo.util.readwrite.TablePrinter.printTable(getResultTable()); diff --git a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java index ab0682cd47..64dc6d3ca6 100644 --- a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java +++ b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java @@ -124,12 +124,12 @@ public static void main(String[] args) { /* * LevenbergMarquardt optim = new LevenbergMarquardt(); TestFunction testFunction = new * TestFunction(); // optim.setFunction(testFunction); - * + * * SampleValue[] sample = new SampleValue[3]; double sample1[] = { 6 }; sample[0] = new * SampleValue(8.5,0.1,sample1); double sample2[] = { 4 }; sample[1] = new * SampleValue(5.5,0.1,sample2); double sample3[] = { 4 }; sample[2] = new * SampleValue(5.51,0.1,sample3); - * + * * SampleSet sampleSet = new SampleSet(sample); sampleSet = * sampleSet.createNewNormalDistributedSet(); optim.setSampleSet(sampleSet); optim.solve(); * optim.runMonteCarloSimulation(); diff --git a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java index 9edbd34cb0..668ef92a07 100644 --- a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java +++ b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java @@ -422,6 +422,7 @@ public boolean checkNumerically() { } /** + * Setter for property maxError. * * @param maxErr before test will report failed Set maximum allowed error in model check */ diff --git a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java index 8587b6f348..df47c24957 100644 --- a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java +++ b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java @@ -284,7 +284,7 @@ public double calcXComp(ComponentGEUnifac component) { } /* * public double calcXMix(PhaseGEUnifac phase) { double temp = 0.0, temp2 = 0.0, tempVal = 0.0; - * + * * for (int j = 0; j < phase.getNumberOfComponents(); j++) { for (int i = 0; i < * ((ComponentGEUnifac) phase.getComponent(j)).getNumberOfUNIFACgroups(); i++) { tempVal = * phase.getComponent(j).getNumberOfMolesInPhase() * ((ComponentGEUnifac) @@ -409,7 +409,7 @@ public double getQMixdN(int comp) { } /* * public double getXMixdN(int comp) { return xMixdN[comp]; } - * + * * public void setXMixdN(double[] xMixdN) { this.xMixdN = xMixdN; } */ diff --git a/src/main/java/neqsim/thermo/characterization/Characterise.java b/src/main/java/neqsim/thermo/characterization/Characterise.java index 56c8dfb76b..34cd86f10a 100644 --- a/src/main/java/neqsim/thermo/characterization/Characterise.java +++ b/src/main/java/neqsim/thermo/characterization/Characterise.java @@ -27,7 +27,9 @@ public class Characterise implements java.io.Serializable, Cloneable { protected TBPfractionModel TBPfractionModelSelector; /** - *Constructor for Characterise.
+ *+ * Constructor for Characterise. + *
*/ public Characterise() {} @@ -163,17 +165,13 @@ public void characterisePlusFraction() { } /* - * * public boolean addPlusFraction(int start, int end) { plusFractionModel = new * PlusCharacterize(system); if (TBPCharacterise.hasPlusFraction()) { * TBPCharacterise.groupTBPfractions(); TBPCharacterise.generateTBPFractions(); return true; } * else { System.out.println("not able to generate pluss fraction"); return false; } } * - * * public boolean characterize2() { if (TBPCharacterise.groupTBPfractions()) { * TBPCharacterise.solve(); return true; } else { System.out.println("not able to generate pluss * fraction"); return false; } } - * - * */ } diff --git a/src/main/java/neqsim/thermo/component/ComponentEos.java b/src/main/java/neqsim/thermo/component/ComponentEos.java index 0ef2e50011..935d52ae0c 100644 --- a/src/main/java/neqsim/thermo/component/ComponentEos.java +++ b/src/main/java/neqsim/thermo/component/ComponentEos.java @@ -106,7 +106,6 @@ public ComponentEos(String name, double moles, double molesInPhase, int compInde * @param M Molar mass * @param a Acentric factor * @param moles Number of moles - * */ public ComponentEos(int number, double TC, double PC, double M, double a, double moles) { super(number, TC, PC, M, a, moles); @@ -227,7 +226,7 @@ public AttractiveTermInterface getAttractiveTerm() { /** * Get reduced temperature. - * + * * @param temperature temperature of fluid * @return double reduced temperature T/TC */ diff --git a/src/main/java/neqsim/thermo/component/ComponentGE.java b/src/main/java/neqsim/thermo/component/ComponentGE.java index de8ced038f..0260c74beb 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGE.java +++ b/src/main/java/neqsim/thermo/component/ComponentGE.java @@ -12,6 +12,7 @@ import neqsim.thermo.phase.PhaseInterface; /** + * Abstract class ComponentGE. * * @author Even Solbraa */ diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java index 145fa1fc26..65b12537ff 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java @@ -233,7 +233,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp - dA6dTetter); /* * if(w==0){ dlngammadtold = dlngammadt; temperature +=0.0001; } - * + * * if(w==1){ lngammaold = lngamma; temperature -=0.0002; } } */ // System.out.println("deriv: " + lngammaold + " " + lngamma + " " + diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java index 96d42b9c34..642d9f6cce 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifac.java @@ -262,15 +262,13 @@ public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, doub * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, temperature, pressure, * pt); } - * + * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, * double pressure, PhaseType pt){ NumericalDerivative deriv = new NumericalDerivative(); // * System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffTemp(this, phase, numberOfComponents, temperature, pressure, - * pt); - * - * } + * pt); } */ /** diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java index c564397515..2178437dae 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java @@ -111,47 +111,42 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp /* * double V = 0, F = 0, a, gammaC = 0, gammaR = 0, temp1 = 0, temp2 = 0, temp3=0, temp4 = 0, * temp5=0, gamma; int j, k; - * - * + * * ComponentGEInterface[] compArray = (ComponentGEInterface[]) phase.getcomponentArray(); - * - * + * * for (j=0;j< numberOfComponents;j++){ - * + * * temp1 = temp1 + compArray[j].getx()*((ComponentGEUniquac) compArray[j]).getr(); temp2 = temp2 * + (((ComponentGEUniquac) compArray[j]).getq() * compArray[j].getx()); } - * - * + * * V = V + this.getr() / temp1; //System.out.println("V: " + V); F = F + this.getq() / temp2; * //System.out.println("F: " + F); - * + * * gammaC = 1 - V + Math.log(V) - 5 * this.getq() * (1 - V/F + Math.log(V/F)); - * + * * // System.out.println("gammaC: " + gammaC); - * + * * temp1 = 0; temp2 = 0; temp3 = 0; - * + * * for (k=0;k< numberOfComponents;k++){ temp4 = 0; temp4 = * (intparam[compArray[k].getIndex()][this.getIndex()]/temperature); temp1 = temp1 + * compArray[k].getq() * compArray[k].getx() * * Math.exp(-intparam[compArray[k].getIndex()][this.getIndex()]/temperature); temp2 = temp2 + * compArray[k].getq() * compArray[k].getx(); } - * + * * for (k=0;k< numberOfComponents;k++){ temp5 = 0; for (j=0;j< numberOfComponents;j++){ temp5 = * temp5 + compArray[j].getq() * compArray[j].getx() * - * Math.exp(-intparam[compArray[j].getIndex()][compArray[k].getIndex()]/ temperature); - * - * } - * + * Math.exp(-intparam[compArray[j].getIndex()][compArray[k].getIndex()]/ temperature); } + * * temp3 = temp3 + (compArray[k].getq() * compArray[k].getx() * Math.exp(- * intparam[this.getIndex()][compArray[k].getIndex()]/temperature)) / temp5; } - * + * * gammaR = this.getq() * (1 - Math.log(temp1/temp2) - temp3); - * + * * //System.out.println("gammaR: " + gammaR); - * + * * gamma = Math.exp(gammaR + gammaC); - * + * * //System.out.println("comp: " + this.getIndex() + " gamma NRTL : " +gamma); * //System.out.println("gamma: " + gamma); */ @@ -202,15 +197,13 @@ public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, doub * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffPres(this, phase, numberOfComponents, temperature, pressure, * pt); } - * + * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, * double pressure, PhaseType pt){ NumericalDerivative deriv = new NumericalDerivative(); // * System.out.println("dfugdT : " + NumericalDerivative.fugcoefDiffTemp(this, phase, * numberOfComponents, temperature, pressure, pt)); return * NumericalDerivative.fugcoefDiffTemp(this, phase, numberOfComponents, temperature, pressure, - * pt); - * - * } + * pt); } */ /** diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java index 6ade2c3b15..a0c16c996d 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java @@ -10,7 +10,8 @@ import neqsim.thermo.phase.PhaseType; /** - * + * Abstract class ComponentGEUniquacmodifiedHV + * * @author Even Solbraa */ abstract class ComponentGEUniquacmodifiedHV extends ComponentGEUniquac { diff --git a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java index eff4dd2b7b..041723bfc5 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java +++ b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java @@ -223,7 +223,7 @@ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double - dA6dTetter); /* * if(w==0){ dlngammadtold = dlngammadt; temperature +=0.0001; } - * + * * if(w==1){ lngammaold = lngamma; temperature -=0.0002; } } */ // System.out.println("deriv: " + lngammaold + " " + lngamma + " " + @@ -292,9 +292,7 @@ public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double * public double getHenryCoef(double temperature) { // System.out.println("henry " + // * Math.exp(henryCoefParameter[0]+henryCoefParameter[1]/temperature+ * henryCoefParameter[2]*Math.log(temperature)+henryCoefParameter[3]*temperature )*100*0.01802); - * if (componentName.equals("CO2")) { // return } return super.getHenryCoef(temperature); - * - * } + * if (componentName.equals("CO2")) { // return } return super.getHenryCoef(temperature); } */ /** {@inheritDoc} */ @@ -522,7 +520,7 @@ public double getGammaPitzer(PhaseInterface phase, int numberOfComponents, doubl * double pressure, PhaseType pt){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, * temperature, pressure+0.01, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature, * pressure-0.01, pt)))/0.02; return dfugdp; } - * + * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, * double pressure, PhaseType pt){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, * temperature+0.01, pressure, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature-0.01, diff --git a/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java b/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java index 0d060cce33..0e64f3926d 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java +++ b/src/main/java/neqsim/thermo/component/ComponentGeNRTL.java @@ -190,7 +190,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp - dA6dTetter); /* * if(w==0){ dlngammadtold = dlngammadt; temperature +=0.0001; } - * + * * if(w==1){ lngammaold = lngamma; temperature -=0.0002; } } */ // System.out.println("deriv: " + lngammaold + " " + lngamma + " " + @@ -260,7 +260,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp * double pressure, PhaseType pt){ dfugdp = (Math.log(fugcoef(phase, numberOfComponents, * temperature, pressure+0.01, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature, * pressure-0.01, pt)))/0.02; return dfugdp; } - * + * * public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature, * double pressure, PhaseType pt){ dfugdt = (Math.log(fugcoef(phase, numberOfComponents, * temperature+0.01, pressure, pt))-Math.log(fugcoef(phase, numberOfComponents, temperature-0.01, diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java b/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java index dd3f1c106f..51732ea42b 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateGF.java @@ -134,7 +134,6 @@ public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, doub * (getEmptyHydrateStructureVapourPressure(hydrateStructure, temp) * Math.exp(solvol / (R * * temp) * (pres - getEmptyHydrateStructureVapourPressure(hydrateStructure, temp)) * * 1e5))); - * */ // System.out.println("pointing " // +(Math.exp(solvol/(R*temp)*((pres-getEmptyHydrateStructureVapourPressure(hydrateStruct,temp))*1e5)))); diff --git a/src/main/java/neqsim/thermo/component/ComponentPrCPA.java b/src/main/java/neqsim/thermo/component/ComponentPrCPA.java index 02a8471204..854c8d9156 100644 --- a/src/main/java/neqsim/thermo/component/ComponentPrCPA.java +++ b/src/main/java/neqsim/thermo/component/ComponentPrCPA.java @@ -4,7 +4,8 @@ import neqsim.thermo.phase.PhaseInterface; /** - * + * Abstract class ComponentPrCPA. + * * @author Even Solbraa */ abstract class ComponentPrCPA extends ComponentPR implements ComponentCPAInterface { diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java index d86008fd5b..162b88bdff 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java @@ -14,6 +14,7 @@ import neqsim.thermo.mixingRule.EosMixingRulesInterface; /** + * Abstract class PhaseEos. * * @author Even Solbraa */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java index 5d76fca720..6e69f0aa53 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java @@ -43,7 +43,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, /* * ComponentGEInterface[] comp_Array = (ComponentGEInterface[]) this.getcomponentArray(); - * + * * for (int i = 0; i < numberOfComponents; i++) { GE = GE + comp_Array[i].getx() * * Math.log(comp_Array[i].getGamma(phase, numberOfComponents, temperature, pressure, pt)); } */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index b40def85e9..f6d015a6a7 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -716,7 +716,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType *
* Change the number of moles of component of phase,i.e., numberOfMolesInPhase
but do
* not change the total number of moles of component in system.
- *
+ *
* NB! Phase fraction beta
is not updated by this method. Must be done separately to
* keep consistency between phase and component calculation of total number of moles in system.
*
numberOfMolesInPhase
, and
* total number of moles of component in system, i.e., numberOfMoles
with the same
* amount.
- *
+ *
* NB! Phase fraction beta
is not updated by this method. Must be done separately to
* keep consistency between phase and component calculation of total number of moles in system.
*
@@ -751,7 +751,7 @@ public default void addMolesChemReac(int component, double dn) {
* Component
properties for the number of moles of component of phase, i.e.,
* numberOfMolesInPhase
, and total number of moles of component in system, i.e.,
* numberOfMoles
with separate amounts.
- *
+ *
* NB! Phase fraction beta
is not updated by this method. Must be done separately to
* keep consistency between phase and component calculation of total number of moles in system.
*
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
index bfb9af91f4..8b9c39d214 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
@@ -1159,23 +1159,22 @@ public double molarVolume(double pressure, double temperature, double A, double
* = 1.0 + Btemp/Math.pow(BonVold,2.0)*(Btemp/numberOfMolesInPhase*dFdVdV()); //dhh =
* -2.0*Btemp/Math.pow(BonV,3.0)*(Btemp/numberOfMolesInPhase*dFdVdV())-Math.pow(
* Btemp,2.0)/Math.pow(BonV,4.0)*(Btemp/numberOfMolesInPhase*dFdVdVdV());
- *
+ *
* //made by Rahmat
- *
+ *
* BonV = BonVold - 0.5* (2* h * dh / ((2* Math.pow(dh,2) - h * dhh)));
- *
+ *
* double dBonV = BonV - BonVold; dhh = (dh - dhOld)/ dBonV; dhOld = dh;
- *
+ *
* hOld = h;
- *
- *
+ *
* //d1 = - h/dh; //d2 = - dh/dhh; //BonV += d1; //*(1.0+0.5*-1.0); /*
* if(Math.abs(d1/d2)<=1.0){ BonV += d1*(1.0+0.5*d1/d2); } else if(d1/d2<-1){ BonV +=
* d1*(1.0+0.5*-1.0); } else if(d1/d2>1){ BonV += d2; double hnew = h +d2*-h/d1;
* if(Math.abs(hnew)>Math.abs(h)){ System.out.println("volume correction needed...."); BonV =
* phase== 1 ? 2.0/(2.0+temperature/getPseudoCriticalTemperature()):pressure*getB()/(
* numberOfMolesInPhase*temperature*R); } }
- *
+ *
* if(BonV>1){ BonV=1.0-1.0e-6; BonVold=10; } if (BonV < 0) { BonV = 1.0e-16; BonVold = 10; }
*/
// setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase);
@@ -1189,11 +1188,10 @@ public double molarVolume(double pressure, double temperature, double A, double
// System.out.println("iterations " + iterations);
/*
* if(BonV<0){ BonV = pressure*getB()/(numberOfMolesInPhase*temperature*R); setMolarVolume(1.0 /
- * BonV * Btemp / numberOfMolesInPhase); Z = pressure*getMolarVolume()/(R*temperature);
- *
- * } if(iterations>=6000) throw new util.exception.TooManyIterationsException();
+ * BonV * Btemp / numberOfMolesInPhase); Z = pressure*getMolarVolume()/(R*temperature); }
+ * if(iterations>=6000) throw new util.exception.TooManyIterationsException();
* if(Double.isNaN(getMolarVolume())) throw new util.exception.IsNaNException();
- *
+ *
* // if(pt==0) System.out.println("density " + getDensity()); //"BonV: " + BonV +
* " "+" itert: " + iterations +" " + " phase " + pt+ " " + h + " " +dh + " B " + Btemp +
* " D " + Dtemp + " gv" + gV() + " fv " + fv() + " fvv" + fVV());
diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java
index d05d5d4eec..3ad5f08fdc 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java
@@ -780,12 +780,11 @@ public double molarVolume(double pressure, double temperature, double A, double
* = calcRootVolFinder(pt); // BonV = molarVolumeChangePhase(pressure, temperature, A, B, pt);
* // BonV = 0.9999; // BonV = pt == 1 ? 2.0 / (2.0 + temperature /
* getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature *
- * R); }
- *
- * } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0; } else
- * { // BonV = calcRootVolFinder(pt); // return molarVolumeChangePhase(pressure, temperature,
- * A, B, pt); // BonV = pt == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) :
- * pressure * getB() / (numberOfMolesInPhase * temperature * R); } }
+ * R); } } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0;
+ * } else { // BonV = calcRootVolFinder(pt); // return molarVolumeChangePhase(pressure,
+ * temperature, A, B, pt); // BonV = pt == 1 ? 2.0 / (2.0 + temperature /
+ * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature *
+ * R); } }
*/
setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase);
Z = pressure * getMolarVolume() / (R * temperature);
diff --git a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java
index 42014b2969..9aebd2f09c 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java
@@ -780,12 +780,11 @@ public double molarVolume(double pressure, double temperature, double A, double
* = calcRootVolFinder(pt); // BonV = molarVolumeChangePhase(pressure, temperature, A, B, pt);
* // BonV = 0.9999; // BonV = pt == 1 ? 2.0 / (2.0 + temperature /
* getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature *
- * R); }
- *
- * } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0; } else
- * { // BonV = calcRootVolFinder(pt); // return molarVolumeChangePhase(pressure, temperature,
- * A, B, pt); // BonV = pt == 1 ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature()) :
- * pressure * getB() / (numberOfMolesInPhase * temperature * R); } }
+ * R); } } else if (BonV < 0) { if (iterations < 10) { BonV = Math.abs(BonVold + BonV) / 2.0;
+ * } else { // BonV = calcRootVolFinder(pt); // return molarVolumeChangePhase(pressure,
+ * temperature, A, B, pt); // BonV = pt == 1 ? 2.0 / (2.0 + temperature /
+ * getPseudoCriticalTemperature()) : pressure * getB() / (numberOfMolesInPhase * temperature *
+ * R); } }
*/
setMolarVolume(1.0 / BonV * Btemp / numberOfMolesInPhase);
Z = pressure * getMolarVolume() / (R * temperature);
diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java
index 75db75ed2f..784d749c82 100644
--- a/src/main/java/neqsim/thermo/system/SystemInterface.java
+++ b/src/main/java/neqsim/thermo/system/SystemInterface.java
@@ -1181,7 +1181,7 @@ public default void addComponent(String name) {
/**
*
* Getter for property beta
.
- *
+ *
* Gets value for heaviest phase.
*
- * sq. - *
- * - * @param x a double - * @return a double - */ - public double sq(double x) { - return x * x; + // The compositions in the x() array use the following order and must be sent as + // mole fractions: + // 0 - PLACEHOLDER + // 1 - Methane + // 2 - Nitrogen + // 3 - Carbon dioxide + // 4 - Ethane + // 5 - Propane + // 6 - Isobutane + // 7 - n-Butane + // 8 - Isopentane + // 9 - n-Pentane + // 10 - n-Hexane + // 11 - n-Heptane + // 12 - n-Octane + // 13 - n-Nonane + // 14 - n-Decane + // 15 - Hydrogen + // 16 - Oxygen + // 17 - Carbon monoxide + // 18 - Water + // 19 - Hydrogen sulfide + // 20 - Helium + // 21 - Argon + // + // For example, a mixture (in moles) of 94% methane, 5% CO2, and 1% helium would + // be (in mole fractions): + // x(1)=0.94, x(3)=0.05, x(20)=0.01 + + // Variables containing the common parameters in the DETAIL equations + double RDetail; + int NcDetail = 21, MaxFlds = 21, NTerms = 58; + double epsilon = 1e-15; + int[] fn = new int[NTerms + 1]; + int[] gn = new int[NTerms + 1]; + int[] qn = new int[NTerms + 1]; + double[] an = new double[NTerms + 1]; + double[] un = new double[NTerms + 1]; + int[] bn = new int[NTerms + 1]; + int[] kn = new int[NTerms + 1]; + + double[][][] Bsnij2 = new double[MaxFlds + 1][MaxFlds + 1][18 + 1]; + double[] Bs = new double[18 + 1]; + double[] Csn = new double[NTerms + 1]; + + double[] Fi = new double[MaxFlds + 1]; + double[] Gi = new double[MaxFlds + 1]; + double[] Qi = new double[MaxFlds + 1]; + + double[] Ki25 = new double[MaxFlds + 1]; + double[] Ei25 = new double[MaxFlds + 1]; + + double[][] Kij5 = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] Uij5 = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] Gij5 = new double[MaxFlds + 1][MaxFlds + 1]; + + double[] Tun = new double[NTerms + 1]; + double Told; + double[][] n0i = new double[MaxFlds + 1][7 + 1]; + double[][] th0i = new double[MaxFlds + 1][7 + 1]; + + double[] MMiDetail = new double[MaxFlds + 1]; + double[] xold = new double[MaxFlds + 1]; + double K3; + double dPdDsave; + + /** + *+ * sq. + *
+ * + * @param x a double + * @return a double + */ + public double sq(double x) { + return x * x; + } + + /** + *+ * MolarMassDetail. + *
+ * + * @param x an array of {@link double} objects + * @param Mm a {@link org.netlib.util.doubleW} object + */ + public void MolarMassDetail(double[] x, doubleW Mm) { + // Calculate molar mass of the mixture with the compositions contained in the + // x() input array + + // Inputs: + // x() - Composition (mole fraction) + // Do not send mole percents or mass fractions in the x() array, otherwise the + // output will be incorrect. + // The sum of the compositions in the x() array must be equal to one. + // The order of the fluids in this array is given at the top of this code. + + // Outputs: + // Mm - Molar mass (g/mol) + + Mm.val = 0; + for (int i = 1; i <= NcDetail; ++i) { + Mm.val += x[i] * MMiDetail[i]; } - - /** - *- * MolarMassDetail. - *
- * - * @param x an array of {@link double} objects - * @param Mm a {@link org.netlib.util.doubleW} object - */ - public void MolarMassDetail(double[] x, doubleW Mm) { - // Calculate molar mass of the mixture with the compositions contained in the - // x() input array - - // Inputs: - // x() - Composition (mole fraction) - // Do not send mole percents or mass fractions in the x() array, otherwise the - // output will be incorrect. - // The sum of the compositions in the x() array must be equal to one. - // The order of the fluids in this array is given at the top of this code. - - // Outputs: - // Mm - Molar mass (g/mol) - - Mm.val = 0; - for (int i = 1; i <= NcDetail; ++i) { - Mm.val += x[i] * MMiDetail[i]; - } + } + + /** + *+ * PressureDetail. + *
+ * + * @param T a double + * @param D a double + * @param x an array of {@link double} objects + * @param P a {@link org.netlib.util.doubleW} object + * @param Z a {@link org.netlib.util.doubleW} object + */ + public void PressureDetail(double T, double D, double[] x, doubleW P, doubleW Z) { + // Sub Pressure(T, D, x, P, Z) + + // Calculate pressure as a function of temperature and density. The derivative + // d(P)/d(D) is also calculated + // for use in the iterative DensityDetail subroutine (and is only returned as a + // common variable). + + // Inputs: + // T - Temperature (K) + // D - Density (mol/l) + // x() - Composition (mole fraction) + // Do not send mole percents or mass fractions in the x() array, otherwise the + // output will be incorrect. + // The sum of the compositions in the x() array must be equal to one. + + // Outputs: + // P - Pressure (kPa) + // Z - Compressibility factor + // dPdDsave - d(P)/d(D) [kPa/(mol/l)] (at constant temperature) + // - This variable is cached in the common variables for use in the iterative + // density solver, but not returned as an argument. + + doubleW[][] ar = new doubleW[3 + 1][3 + 1]; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + ar[i][j] = new doubleW(0.0d); + } } - - /** - *- * PressureDetail. - *
- * - * @param T a double - * @param D a double - * @param x an array of {@link double} objects - * @param P a {@link org.netlib.util.doubleW} object - * @param Z a {@link org.netlib.util.doubleW} object - */ - public void PressureDetail(double T, double D, double[] x, doubleW P, doubleW Z) { - // Sub Pressure(T, D, x, P, Z) - - // Calculate pressure as a function of temperature and density. The derivative - // d(P)/d(D) is also calculated - // for use in the iterative DensityDetail subroutine (and is only returned as a - // common variable). - - // Inputs: - // T - Temperature (K) - // D - Density (mol/l) - // x() - Composition (mole fraction) - // Do not send mole percents or mass fractions in the x() array, otherwise the - // output will be incorrect. - // The sum of the compositions in the x() array must be equal to one. - - // Outputs: - // P - Pressure (kPa) - // Z - Compressibility factor - // dPdDsave - d(P)/d(D) [kPa/(mol/l)] (at constant temperature) - // - This variable is cached in the common variables for use in the iterative - // density solver, but not returned as an argument. - - doubleW[][] ar = new doubleW[3 + 1][3 + 1]; - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - ar[i][j] = new doubleW(0.0d); - } - } - xTermsDetail(x); - AlpharDetail(0, 2, T, D, ar); - Z.val = 1 + ar[0][1].val / RDetail / T; // ar(0,1) is the first derivative of alpha(r) with - // respect to density - P.val = D * RDetail * T * Z.val; - dPdDsave = RDetail * T + 2 * ar[0][1].val + ar[0][2].val; // d(P)/d(D) for use in density - // iteration + xTermsDetail(x); + AlpharDetail(0, 2, T, D, ar); + Z.val = 1 + ar[0][1].val / RDetail / T; // ar(0,1) is the first derivative of alpha(r) with + // respect to density + P.val = D * RDetail * T * Z.val; + dPdDsave = RDetail * T + 2 * ar[0][1].val + ar[0][2].val; // d(P)/d(D) for use in density + // iteration + } + + /** + *+ * DensityDetail. + *
+ * + * @param T a double + * @param P a double + * @param x an array of {@link double} objects + * @param D a {@link org.netlib.util.doubleW} object + * @param ierr a {@link org.netlib.util.intW} object + * @param herr a {@link org.netlib.util.StringW} object + */ + public void DensityDetail(double T, double P, double[] x, doubleW D, intW ierr, StringW herr) { + // Sub DensityDetail(T, P, x, D, ierr, herr) + + // Calculate density as a function of temperature and pressure. This is an + // iterative routine that calls PressureDetail + // to find the correct state point. Generally only 6 iterations at most are + // required. + // If the iteration fails to converge, the ideal gas density and an error + // message are returned. + // No checks are made to determine the phase boundary, which would have + // guaranteed that the output is in the gas phase. + // It is up to the user to locate the phase boundary, and thus identify the + // phase of the T and P inputs. + // If the state point is 2-phase, the output density will represent a metastable + // state. + + // Inputs: + // T - Temperature (K) + // P - Pressure (kPa) + // x() - Composition (mole fraction) + + // Outputs: + // D - Density (mol/l) (make D negative and send as an input to use as an + // initial guess) + // ierr - Error number (0 indicates no error) + // herr - Error message if ierr is not equal to zero + + double plog, vlog, dpdlv, vdiff, tolr; + doubleW P2 = new doubleW(0.0d); + doubleW Z = new doubleW(0.0d); + ierr.val = 0; + herr.val = ""; + if (Math.abs(P) < epsilon) { + D.val = 0.0; + return; } - - /** - *- * DensityDetail. - *
- * - * @param T a double - * @param P a double - * @param x an array of {@link double} objects - * @param D a {@link org.netlib.util.doubleW} object - * @param ierr a {@link org.netlib.util.intW} object - * @param herr a {@link org.netlib.util.StringW} object - */ - public void DensityDetail(double T, double P, double[] x, doubleW D, intW ierr, - StringW herr) { - // Sub DensityDetail(T, P, x, D, ierr, herr) - - // Calculate density as a function of temperature and pressure. This is an - // iterative routine that calls PressureDetail - // to find the correct state point. Generally only 6 iterations at most are - // required. - // If the iteration fails to converge, the ideal gas density and an error - // message are returned. - // No checks are made to determine the phase boundary, which would have - // guaranteed that the output is in the gas phase. - // It is up to the user to locate the phase boundary, and thus identify the - // phase of the T and P inputs. - // If the state point is 2-phase, the output density will represent a metastable - // state. - - // Inputs: - // T - Temperature (K) - // P - Pressure (kPa) - // x() - Composition (mole fraction) - - // Outputs: - // D - Density (mol/l) (make D negative and send as an input to use as an - // initial guess) - // ierr - Error number (0 indicates no error) - // herr - Error message if ierr is not equal to zero - - double plog, vlog, dpdlv, vdiff, tolr; - doubleW P2 = new doubleW(0.0d); - doubleW Z = new doubleW(0.0d); - ierr.val = 0; - herr.val = ""; - if (Math.abs(P) < epsilon) { - D.val = 0.0; - return; - } - tolr = 0.0000001; - if (D.val > -epsilon) { - D.val = P / RDetail / T; // Ideal gas estimate - } else { - D.val = Math.abs(D.val); // If D<0, then use as initial estimate - } - plog = Math.log(P); - vlog = -Math.log(D.val); - for (int it = 1; it <= 20; ++it) { - if (vlog < -7 || vlog > 100) { - ierr.val = 1; - herr.val = - "Calculation failed to converge in DETAIL method, ideal gas density returned."; - D.val = P / RDetail / T; - return; - } - D.val = Math.exp(-vlog); - PressureDetail(T, D.val, x, P2, Z); - if (dPdDsave < epsilon || P2.val < epsilon) { - vlog += 0.1; - } else { - // Find the next density with a first order Newton's type iterative scheme, with - // log(P) as the known variable and log(v) as the unknown property. - // See AGA 8 publication for further information. - dpdlv = -D.val * dPdDsave; // d(p)/d[log(v)] - vdiff = (Math.log(P2.val) - plog) * P2.val / dpdlv; - vlog = vlog - vdiff; - if (Math.abs(vdiff) < tolr) { - D.val = Math.exp(-vlog); - return; // Iteration converged - } - } - } + tolr = 0.0000001; + if (D.val > -epsilon) { + D.val = P / RDetail / T; // Ideal gas estimate + } else { + D.val = Math.abs(D.val); // If D<0, then use as initial estimate + } + plog = Math.log(P); + vlog = -Math.log(D.val); + for (int it = 1; it <= 20; ++it) { + if (vlog < -7 || vlog > 100) { ierr.val = 1; herr.val = "Calculation failed to converge in DETAIL method, ideal gas density returned."; D.val = P / RDetail / T; return; - } - - /** - *- * PropertiesDetail. - *
- * - * @param T a double - * @param D a double - * @param x an array of {@link double} objects - * @param P a {@link org.netlib.util.doubleW} object - * @param Z a {@link org.netlib.util.doubleW} object - * @param dPdD a {@link org.netlib.util.doubleW} object - * @param d2PdD2 a {@link org.netlib.util.doubleW} object - * @param d2PdTD a {@link org.netlib.util.doubleW} object - * @param dPdT a {@link org.netlib.util.doubleW} object - * @param U a {@link org.netlib.util.doubleW} object - * @param H a {@link org.netlib.util.doubleW} object - * @param S a {@link org.netlib.util.doubleW} object - * @param Cv a {@link org.netlib.util.doubleW} object - * @param Cp a {@link org.netlib.util.doubleW} object - * @param W a {@link org.netlib.util.doubleW} object - * @param G a {@link org.netlib.util.doubleW} object - * @param JT a {@link org.netlib.util.doubleW} object - * @param Kappa a {@link org.netlib.util.doubleW} object - */ - public void PropertiesDetail(double T, double D, double[] x, doubleW P, doubleW Z, - doubleW dPdD, doubleW d2PdD2, doubleW d2PdTD, doubleW dPdT, doubleW U, doubleW H, - doubleW S, doubleW Cv, doubleW Cp, doubleW W, doubleW G, doubleW JT, doubleW Kappa) { - // Sub Properties(T, D, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, - // G, JT, Kappa) - - // Calculate thermodynamic properties as a function of temperature and density. - // Calls are made to the subroutines - // Molarmass, Alpha0Detail, and AlpharDetail. If the density is not known, call - // subroutine DensityDetail first - // with the known values of pressure and temperature. - - // Inputs: - // T - Temperature (K) - // D - Density (mol/l) - // x() - Composition (mole fraction) - - // Outputs: - // P - Pressure (kPa) - // Z - Compressibility factor - // dPdD - First derivative of pressure with respect to density at constant - // temperature [kPa/(mol/l)] - // d2PdD2 - Second derivative of pressure with respect to density at constant - // temperature [kPa/(mol/l)^2] - // d2PdTD - Second derivative of pressure with respect to temperature and - // density [kPa/(mol/l)/K] (currently not calculated) - // dPdT - First derivative of pressure with respect to temperature at constant - // density (kPa/K) - // U - Internal energy (J/mol) - // H - Enthalpy (J/mol) - // S - Entropy [J/(mol-K)] - // Cv - Isochoric heat capacity [J/(mol-K)] - // Cp - Isobaric heat capacity [J/(mol-K)] - // W - Speed of sound (m/s) - // G - Gibbs energy (J/mol) - // JT - Joule-Thomson coefficient (K/kPa) - // Kappa - Isentropic Exponent - doubleW A = new doubleW(0.0d); - doubleW[] a0 = new doubleW[2 + 1]; - for (int i = 0; i < 3; i++) { - a0[i] = new doubleW(0.0d); + } + D.val = Math.exp(-vlog); + PressureDetail(T, D.val, x, P2, Z); + if (dPdDsave < epsilon || P2.val < epsilon) { + vlog += 0.1; + } else { + // Find the next density with a first order Newton's type iterative scheme, with + // log(P) as the known variable and log(v) as the unknown property. + // See AGA 8 publication for further information. + dpdlv = -D.val * dPdDsave; // d(p)/d[log(v)] + vdiff = (Math.log(P2.val) - plog) * P2.val / dpdlv; + vlog = vlog - vdiff; + if (Math.abs(vdiff) < tolr) { + D.val = Math.exp(-vlog); + return; // Iteration converged } - doubleW[][] ar = new doubleW[3 + 1][3 + 1]; + } + } + ierr.val = 1; + herr.val = "Calculation failed to converge in DETAIL method, ideal gas density returned."; + D.val = P / RDetail / T; + return; + } + + /** + *+ * PropertiesDetail. + *
+ * + * @param T a double + * @param D a double + * @param x an array of {@link double} objects + * @param P a {@link org.netlib.util.doubleW} object + * @param Z a {@link org.netlib.util.doubleW} object + * @param dPdD a {@link org.netlib.util.doubleW} object + * @param d2PdD2 a {@link org.netlib.util.doubleW} object + * @param d2PdTD a {@link org.netlib.util.doubleW} object + * @param dPdT a {@link org.netlib.util.doubleW} object + * @param U a {@link org.netlib.util.doubleW} object + * @param H a {@link org.netlib.util.doubleW} object + * @param S a {@link org.netlib.util.doubleW} object + * @param Cv a {@link org.netlib.util.doubleW} object + * @param Cp a {@link org.netlib.util.doubleW} object + * @param W a {@link org.netlib.util.doubleW} object + * @param G a {@link org.netlib.util.doubleW} object + * @param JT a {@link org.netlib.util.doubleW} object + * @param Kappa a {@link org.netlib.util.doubleW} object + */ + public void PropertiesDetail(double T, double D, double[] x, doubleW P, doubleW Z, doubleW dPdD, + doubleW d2PdD2, doubleW d2PdTD, doubleW dPdT, doubleW U, doubleW H, doubleW S, doubleW Cv, + doubleW Cp, doubleW W, doubleW G, doubleW JT, doubleW Kappa) { + // Sub Properties(T, D, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, + // G, JT, Kappa) + + // Calculate thermodynamic properties as a function of temperature and density. + // Calls are made to the subroutines + // Molarmass, Alpha0Detail, and AlpharDetail. If the density is not known, call + // subroutine DensityDetail first + // with the known values of pressure and temperature. + + // Inputs: + // T - Temperature (K) + // D - Density (mol/l) + // x() - Composition (mole fraction) + + // Outputs: + // P - Pressure (kPa) + // Z - Compressibility factor + // dPdD - First derivative of pressure with respect to density at constant + // temperature [kPa/(mol/l)] + // d2PdD2 - Second derivative of pressure with respect to density at constant + // temperature [kPa/(mol/l)^2] + // d2PdTD - Second derivative of pressure with respect to temperature and + // density [kPa/(mol/l)/K] (currently not calculated) + // dPdT - First derivative of pressure with respect to temperature at constant + // density (kPa/K) + // U - Internal energy (J/mol) + // H - Enthalpy (J/mol) + // S - Entropy [J/(mol-K)] + // Cv - Isochoric heat capacity [J/(mol-K)] + // Cp - Isobaric heat capacity [J/(mol-K)] + // W - Speed of sound (m/s) + // G - Gibbs energy (J/mol) + // JT - Joule-Thomson coefficient (K/kPa) + // Kappa - Isentropic Exponent + doubleW A = new doubleW(0.0d); + doubleW[] a0 = new doubleW[2 + 1]; + for (int i = 0; i < 3; i++) { + a0[i] = new doubleW(0.0d); + } + doubleW[][] ar = new doubleW[3 + 1][3 + 1]; - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - ar[i][j] = new doubleW(0.0d); - } - } - doubleW Mm = new doubleW(0.0d); - MolarMassDetail(x, Mm); - xTermsDetail(x); - - // Calculate the ideal gas Helmholtz energy, and its first and second - // derivatives with respect to temperature. - Alpha0Detail(T, D, x, a0); - - // Calculate the real gas Helmholtz energy, and its derivatives with respect to - // temperature and/or density. - AlpharDetail(2, 3, T, D, ar); - - double R = RDetail; - double RT = R * T; - Z.val = 1 + ar[0][1].val / RT; - P.val = D * RT * Z.val; - dPdD.val = RT + 2 * ar[0][1].val + ar[0][2].val; - dPdT.val = D * R + D * ar[1][1].val; - A.val = a0[0].val + ar[0][0].val; - S.val = -a0[1].val - ar[1][0].val; - U.val = A.val + T * S.val; - Cv.val = -(a0[2].val + ar[2][0].val); - if (D > epsilon) { - H.val = U.val + P.val / D; - G.val = A.val + P.val / D; - Cp.val = Cv.val + T * sq(dPdT.val / D) / dPdD.val; - d2PdD2.val = (2 * ar[0][1].val + 4 * ar[0][2].val + ar[0][3].val) / D; - JT.val = (T / D * dPdT.val / dPdD.val - 1) / Cp.val / D; - } else { - H.val = U.val + RT; - G.val = A.val + RT; - Cp.val = Cv.val + R; - d2PdD2.val = 0; - JT.val = 1E+20; // =(dB/dT*T-B)/Cp for an ideal gas, but dB/dT is not calculated here - } - W.val = 1000 * Cp.val / Cv.val * dPdD.val / Mm.val; - if (W.val < 0) { - W.val = 0; - } - W.val = Math.sqrt(W.val); - Kappa.val = W.val * W.val * Mm.val / (RT * 1000 * Z.val); - d2PdTD.val = 0; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + ar[i][j] = new doubleW(0.0d); + } + } + doubleW Mm = new doubleW(0.0d); + MolarMassDetail(x, Mm); + xTermsDetail(x); + + // Calculate the ideal gas Helmholtz energy, and its first and second + // derivatives with respect to temperature. + Alpha0Detail(T, D, x, a0); + + // Calculate the real gas Helmholtz energy, and its derivatives with respect to + // temperature and/or density. + AlpharDetail(2, 3, T, D, ar); + + double R = RDetail; + double RT = R * T; + Z.val = 1 + ar[0][1].val / RT; + P.val = D * RT * Z.val; + dPdD.val = RT + 2 * ar[0][1].val + ar[0][2].val; + dPdT.val = D * R + D * ar[1][1].val; + A.val = a0[0].val + ar[0][0].val; + S.val = -a0[1].val - ar[1][0].val; + U.val = A.val + T * S.val; + Cv.val = -(a0[2].val + ar[2][0].val); + if (D > epsilon) { + H.val = U.val + P.val / D; + G.val = A.val + P.val / D; + Cp.val = Cv.val + T * sq(dPdT.val / D) / dPdD.val; + d2PdD2.val = (2 * ar[0][1].val + 4 * ar[0][2].val + ar[0][3].val) / D; + JT.val = (T / D * dPdT.val / dPdD.val - 1) / Cp.val / D; + } else { + H.val = U.val + RT; + G.val = A.val + RT; + Cp.val = Cv.val + R; + d2PdD2.val = 0; + JT.val = 1E+20; // =(dB/dT*T-B)/Cp for an ideal gas, but dB/dT is not calculated here + } + W.val = 1000 * Cp.val / Cv.val * dPdD.val / Mm.val; + if (W.val < 0) { + W.val = 0; + } + W.val = Math.sqrt(W.val); + Kappa.val = W.val * W.val * Mm.val / (RT * 1000 * Z.val); + d2PdTD.val = 0; + } + + /** + * // Calculate terms dependent only on composition + * + * @param x Composition (mole fraction) + */ + // The following routines are low-level routines that should not be called outside of this code. + void xTermsDetail(double[] x) { + double G, Q, F, U, Q2, xij, xi2; + int icheck; + + // Check to see if a component fraction has changed. If x is the same as the + // previous call, then exit. + icheck = 0; + for (int i = 1; i <= NcDetail; ++i) { + if (Math.abs(x[i] - xold[i]) > 0.0000001) { + icheck = 1; + } + xold[i] = x[i]; + } + if (icheck == 0) { + return; } - /** - * // Calculate terms dependent only on composition - * - * @param x Composition (mole fraction) - */ - // The following routines are low-level routines that should not be called outside of this code. - void xTermsDetail(double[] x) { - double G, Q, F, U, Q2, xij, xi2; - int icheck; - - // Check to see if a component fraction has changed. If x is the same as the - // previous call, then exit. - icheck = 0; - for (int i = 1; i <= NcDetail; ++i) { - if (Math.abs(x[i] - xold[i]) > 0.0000001) { - icheck = 1; - } - xold[i] = x[i]; - } - if (icheck == 0) { - return; - } + K3 = 0; + U = 0; + G = 0; + Q = 0; + F = 0; + for (int n = 1; n <= 18; ++n) { + Bs[n] = 0; + } - K3 = 0; - U = 0; - G = 0; - Q = 0; - F = 0; + // Calculate pure fluid contributions + for (int i = 1; i <= NcDetail; ++i) { + if (x[i] > 0) { + xi2 = sq(x[i]); + K3 += x[i] * Ki25[i]; // K, U, and G are the sums of a pure fluid contribution and a + U += x[i] * Ei25[i]; // binary pair contribution + G += x[i] * Gi[i]; + Q += x[i] * Qi[i]; // Q and F depend only on the pure fluid parts + F += xi2 * Fi[i]; for (int n = 1; n <= 18; ++n) { - Bs[n] = 0; - } - - // Calculate pure fluid contributions - for (int i = 1; i <= NcDetail; ++i) { - if (x[i] > 0) { - xi2 = sq(x[i]); - K3 += x[i] * Ki25[i]; // K, U, and G are the sums of a pure fluid contribution and a - U += x[i] * Ei25[i]; // binary pair contribution - G += x[i] * Gi[i]; - Q += x[i] * Qi[i]; // Q and F depend only on the pure fluid parts - F += xi2 * Fi[i]; - for (int n = 1; n <= 18; ++n) { - Bs[n] = Bs[n] + xi2 * Bsnij2[i][i][n]; // Pure fluid contributions to second - // virial coefficient - } - } - } - K3 = sq(K3); - U = sq(U); - - // Binary pair contributions - for (int i = 1; i <= NcDetail - 1; ++i) { - if (x[i] > 0) { - for (int j = i + 1; j <= NcDetail; ++j) { - if (x[j] > 0) { - xij = 2 * x[i] * x[j]; - K3 = K3 + xij * Kij5[i][j]; - U = U + xij * Uij5[i][j]; - G = G + xij * Gij5[i][j]; - for (int n = 1; n <= 18; ++n) { - Bs[n] = Bs[n] + xij * Bsnij2[i][j][n]; // Second virial coefficients of - // mixture - } - } - } - } - } - K3 = Math.pow(K3, 0.6); - U = Math.pow(U, 0.2); - - // Third virial and higher coefficients - Q2 = sq(Q); - for (int n = 13; n <= 58; ++n) { - Csn[n] = an[n] * Math.pow(U, un[n]); - if (gn[n] == 1) { - Csn[n] = Csn[n] * G; - } - if (qn[n] == 1) { - Csn[n] = Csn[n] * Q2; - } - if (fn[n] == 1) { - Csn[n] = Csn[n] * F; - } + Bs[n] = Bs[n] + xi2 * Bsnij2[i][i][n]; // Pure fluid contributions to second + // virial coefficient } + } } - - /** - * @param T ... - * @param D ... - * @param x ... - * @param a0 ... - */ - void Alpha0Detail(double T, double D, double[] x, doubleW[] a0) { - // Private Sub Alpha0Detail(T, D, x, a0) - - // Calculate the ideal gas Helmholtz energy and its derivatives with respect to - // T and D. - // This routine is not needed when only P (or Z) is calculated. - - // Inputs: - // T - Temperature (K) - // D - Density (mol/l) - // x() - Composition (mole fraction) - - // Outputs: - // a0(0) - Ideal gas Helmholtz energy (J/mol) - // a0(1) - partial (a0)/partial(T) [J/(mol-K)] - // a0(2) - T*partial^2(a0)/partial(T)^2 [J/(mol-K)] - - double LogT, LogD, LogHyp, th0T, LogxD; - double SumHyp0, SumHyp1, SumHyp2; - double em, ep, hcn, hsn; - - a0[0].val = 0; - a0[1].val = 0; - a0[2].val = 0; - - if (D > epsilon) { - LogD = Math.log(D); - } else { - LogD = Math.log(epsilon); - } - LogT = Math.log(T); - for (int i = 1; i <= NcDetail; ++i) { - if (x[i] > 0) { - LogxD = LogD + Math.log(x[i]); - SumHyp0 = 0; - SumHyp1 = 0; - SumHyp2 = 0; - for (int j = 4; j <= 7; ++j) { - if (th0i[i][j] > 0) { - th0T = th0i[i][j] / T; - ep = Math.exp(th0T); - em = 1 / ep; - hsn = (ep - em) / 2; - hcn = (ep + em) / 2; - if (j == 4 || j == 6) { - LogHyp = Math.log(Math.abs(hsn)); - SumHyp0 += n0i[i][j] * LogHyp; - SumHyp1 += n0i[i][j] * (LogHyp - th0T * hcn / hsn); - SumHyp2 += n0i[i][j] * sq(th0T / hsn); - } else { - LogHyp = Math.log(Math.abs(hcn)); - SumHyp0 += -n0i[i][j] * LogHyp; - SumHyp1 += -n0i[i][j] * (LogHyp - th0T * hsn / hcn); - SumHyp2 += +n0i[i][j] * sq(th0T / hcn); - } - } - } - a0[0].val += - x[i] * (LogxD + n0i[i][1] + n0i[i][2] / T - n0i[i][3] * LogT + SumHyp0); - a0[1].val += x[i] * (LogxD + n0i[i][1] - n0i[i][3] * (1 + LogT) + SumHyp1); - a0[2].val += -x[i] * (n0i[i][3] + SumHyp2); + K3 = sq(K3); + U = sq(U); + + // Binary pair contributions + for (int i = 1; i <= NcDetail - 1; ++i) { + if (x[i] > 0) { + for (int j = i + 1; j <= NcDetail; ++j) { + if (x[j] > 0) { + xij = 2 * x[i] * x[j]; + K3 = K3 + xij * Kij5[i][j]; + U = U + xij * Uij5[i][j]; + G = G + xij * Gij5[i][j]; + for (int n = 1; n <= 18; ++n) { + Bs[n] = Bs[n] + xij * Bsnij2[i][j][n]; // Second virial coefficients of + // mixture } + } } - a0[0].val = a0[0].val * RDetail * T; - a0[1].val = a0[1].val * RDetail; - a0[2].val = a0[2].val * RDetail; + } } - - /** - * @param itau .... - * @param idel ... - * @param T ... - * @param D ... - * @param ar ... - */ - void AlpharDetail(int itau, int idel, double T, double D, doubleW[][] ar) { - // Private Sub AlpharDetail(itau, idel, T, D, ar) - - // Calculate the derivatives of the residual Helmholtz energy (ar) with respect - // to T and D. - // itau and idel are inputs that contain the highest derivatives needed. - // Outputs are returned in the array ar. - // Subroutine xTerms must be called before this routine if x has changed - - // Inputs: - // itau - Set this to 1 to calculate "ar" derivatives with respect to T [i.e., - // ar(1,0), ar(1,1), and ar(2,0)], otherwise set it to 0. - // idel - Currently not used, but kept as an input for future use in specifing - // the highest density derivative needed. - // T - Temperature (K) - // D - Density (mol/l) - - // Outputs: - // ar(0,0) - Residual Helmholtz energy (J/mol) - // ar(0,1) - D*partial (ar)/partial(D) (J/mol) - // ar(0,2) - D^2*partial^2(ar)/partial(D)^2 (J/mol) - // ar(0,3) - D^3*partial^3(ar)/partial(D)^3 (J/mol) - // ar(1,0) - partial (ar)/partial(T) [J/(mol-K)] - // ar(1,1) - D*partial^2(ar)/partial(D)/partial(T) [J/(mol-K)] - // ar(2,0) - T*partial^2(ar)/partial(T)^2 [J/(mol-K)] - - double ckd, bkd, Dred; - double Sum, s0, s1, s2, s3, RT; - double[] Sum0 = new double[NTerms + 1]; - double[] SumB = new double[NTerms + 1]; - double[] Dknn = new double[9 + 1]; - double[] Expn = new double[4 + 1]; - - double[] CoefD1 = new double[NTerms + 1]; - double[] CoefD2 = new double[NTerms + 1]; - double[] CoefD3 = new double[NTerms + 1]; - - double[] CoefT1 = new double[NTerms + 1]; - double[] CoefT2 = new double[NTerms + 1]; - - for (int i = 0; i < 3; ++i) { - for (int j = 0; j < 3; ++j) { - ar[i][j].val = 0; - } - } - if (Math.abs(T - Told) > 0.0000001) { - for (int n = 1; n <= 58; ++n) { - Tun[n] = Math.pow(T, -un[n]); - } - } - Told = T; - - // Precalculation of common powers and exponents of density - Dred = K3 * D; - Dknn[0] = 1; - for (int n = 1; n <= 9; ++n) { - Dknn[n] = Dred * Dknn[n - 1]; - } - Expn[0] = 1; - for (int n = 1; n <= 4; ++n) { - Expn[n] = Math.exp(-Dknn[n]); - } - RT = RDetail * T; - - for (int n = 1; n <= 58; ++n) { - // Contributions to the Helmholtz energy and its derivatives with respect to - // temperature - CoefT1[n] = RDetail * (un[n] - 1); - CoefT2[n] = CoefT1[n] * un[n]; - // Contributions to the virial coefficients - SumB[n] = 0; - Sum0[n] = 0; - if (n <= 18) { - Sum = Bs[n] * D; - if (n >= 13) { - Sum += -Csn[n] * Dred; - } - SumB[n] = Sum * Tun[n]; - } - if (n >= 13) { - // Contributions to the residual part of the Helmholtz energy - Sum0[n] = Csn[n] * Dknn[bn[n]] * Tun[n] * Expn[kn[n]]; - // Contributions to the derivatives of the Helmholtz energy with respect to - // density - bkd = bn[n] - kn[n] * Dknn[kn[n]]; - ckd = kn[n] * kn[n] * Dknn[kn[n]]; - CoefD1[n] = bkd; - CoefD2[n] = bkd * (bkd - 1) - ckd; - CoefD3[n] = (bkd - 2) * CoefD2[n] + ckd * (1 - kn[n] - 2 * bkd); + K3 = Math.pow(K3, 0.6); + U = Math.pow(U, 0.2); + + // Third virial and higher coefficients + Q2 = sq(Q); + for (int n = 13; n <= 58; ++n) { + Csn[n] = an[n] * Math.pow(U, un[n]); + if (gn[n] == 1) { + Csn[n] = Csn[n] * G; + } + if (qn[n] == 1) { + Csn[n] = Csn[n] * Q2; + } + if (fn[n] == 1) { + Csn[n] = Csn[n] * F; + } + } + } + + /** + * @param T ... + * @param D ... + * @param x ... + * @param a0 ... + */ + void Alpha0Detail(double T, double D, double[] x, doubleW[] a0) { + // Private Sub Alpha0Detail(T, D, x, a0) + + // Calculate the ideal gas Helmholtz energy and its derivatives with respect to + // T and D. + // This routine is not needed when only P (or Z) is calculated. + + // Inputs: + // T - Temperature (K) + // D - Density (mol/l) + // x() - Composition (mole fraction) + + // Outputs: + // a0(0) - Ideal gas Helmholtz energy (J/mol) + // a0(1) - partial (a0)/partial(T) [J/(mol-K)] + // a0(2) - T*partial^2(a0)/partial(T)^2 [J/(mol-K)] + + double LogT, LogD, LogHyp, th0T, LogxD; + double SumHyp0, SumHyp1, SumHyp2; + double em, ep, hcn, hsn; + + a0[0].val = 0; + a0[1].val = 0; + a0[2].val = 0; + + if (D > epsilon) { + LogD = Math.log(D); + } else { + LogD = Math.log(epsilon); + } + LogT = Math.log(T); + for (int i = 1; i <= NcDetail; ++i) { + if (x[i] > 0) { + LogxD = LogD + Math.log(x[i]); + SumHyp0 = 0; + SumHyp1 = 0; + SumHyp2 = 0; + for (int j = 4; j <= 7; ++j) { + if (th0i[i][j] > 0) { + th0T = th0i[i][j] / T; + ep = Math.exp(th0T); + em = 1 / ep; + hsn = (ep - em) / 2; + hcn = (ep + em) / 2; + if (j == 4 || j == 6) { + LogHyp = Math.log(Math.abs(hsn)); + SumHyp0 += n0i[i][j] * LogHyp; + SumHyp1 += n0i[i][j] * (LogHyp - th0T * hcn / hsn); + SumHyp2 += n0i[i][j] * sq(th0T / hsn); } else { - CoefD1[n] = 0; - CoefD2[n] = 0; - CoefD3[n] = 0; + LogHyp = Math.log(Math.abs(hcn)); + SumHyp0 += -n0i[i][j] * LogHyp; + SumHyp1 += -n0i[i][j] * (LogHyp - th0T * hsn / hcn); + SumHyp2 += +n0i[i][j] * sq(th0T / hcn); } + } } + a0[0].val += x[i] * (LogxD + n0i[i][1] + n0i[i][2] / T - n0i[i][3] * LogT + SumHyp0); + a0[1].val += x[i] * (LogxD + n0i[i][1] - n0i[i][3] * (1 + LogT) + SumHyp1); + a0[2].val += -x[i] * (n0i[i][3] + SumHyp2); + } + } + a0[0].val = a0[0].val * RDetail * T; + a0[1].val = a0[1].val * RDetail; + a0[2].val = a0[2].val * RDetail; + } + + /** + * @param itau .... + * @param idel ... + * @param T ... + * @param D ... + * @param ar ... + */ + void AlpharDetail(int itau, int idel, double T, double D, doubleW[][] ar) { + // Private Sub AlpharDetail(itau, idel, T, D, ar) + + // Calculate the derivatives of the residual Helmholtz energy (ar) with respect + // to T and D. + // itau and idel are inputs that contain the highest derivatives needed. + // Outputs are returned in the array ar. + // Subroutine xTerms must be called before this routine if x has changed + + // Inputs: + // itau - Set this to 1 to calculate "ar" derivatives with respect to T [i.e., + // ar(1,0), ar(1,1), and ar(2,0)], otherwise set it to 0. + // idel - Currently not used, but kept as an input for future use in specifing + // the highest density derivative needed. + // T - Temperature (K) + // D - Density (mol/l) + + // Outputs: + // ar(0,0) - Residual Helmholtz energy (J/mol) + // ar(0,1) - D*partial (ar)/partial(D) (J/mol) + // ar(0,2) - D^2*partial^2(ar)/partial(D)^2 (J/mol) + // ar(0,3) - D^3*partial^3(ar)/partial(D)^3 (J/mol) + // ar(1,0) - partial (ar)/partial(T) [J/(mol-K)] + // ar(1,1) - D*partial^2(ar)/partial(D)/partial(T) [J/(mol-K)] + // ar(2,0) - T*partial^2(ar)/partial(T)^2 [J/(mol-K)] + + double ckd, bkd, Dred; + double Sum, s0, s1, s2, s3, RT; + double[] Sum0 = new double[NTerms + 1]; + double[] SumB = new double[NTerms + 1]; + double[] Dknn = new double[9 + 1]; + double[] Expn = new double[4 + 1]; + + double[] CoefD1 = new double[NTerms + 1]; + double[] CoefD2 = new double[NTerms + 1]; + double[] CoefD3 = new double[NTerms + 1]; + + double[] CoefT1 = new double[NTerms + 1]; + double[] CoefT2 = new double[NTerms + 1]; + + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + ar[i][j].val = 0; + } + } + if (Math.abs(T - Told) > 0.0000001) { + for (int n = 1; n <= 58; ++n) { + Tun[n] = Math.pow(T, -un[n]); + } + } + Told = T; - for (int n = 1; n <= 58; ++n) { - // Density derivatives - s0 = Sum0[n] + SumB[n]; - s1 = Sum0[n] * CoefD1[n] + SumB[n]; - s2 = Sum0[n] * CoefD2[n]; - s3 = Sum0[n] * CoefD3[n]; - ar[0][0].val = ar[0][0].val + RT * s0; - ar[0][1].val = ar[0][1].val + RT * s1; - ar[0][2].val = ar[0][2].val + RT * s2; - ar[0][3].val = ar[0][3].val + RT * s3; - // Temperature derivatives - if (itau > 0) { - ar[1][0].val = ar[1][0].val - CoefT1[n] * s0; - ar[1][1].val = ar[1][1].val - CoefT1[n] * s1; - ar[2][0].val = ar[2][0].val + CoefT2[n] * s0; - // The following are not used, but fully functional - // ar(1, 2) = ar(1, 2) - CoefT1(n) * s2; - // ar(1, 3) = ar(1, 3) - CoefT1(n) * s3; - // ar(2, 1) = ar(2, 1) + CoefT2(n) * s1; - // ar(2, 2) = ar(2, 2) + CoefT2(n) * s2; - // ar(2, 3) = ar(2, 3) + CoefT2(n) * s3; - } + // Precalculation of common powers and exponents of density + Dred = K3 * D; + Dknn[0] = 1; + for (int n = 1; n <= 9; ++n) { + Dknn[n] = Dred * Dknn[n - 1]; + } + Expn[0] = 1; + for (int n = 1; n <= 4; ++n) { + Expn[n] = Math.exp(-Dknn[n]); + } + RT = RDetail * T; + + for (int n = 1; n <= 58; ++n) { + // Contributions to the Helmholtz energy and its derivatives with respect to + // temperature + CoefT1[n] = RDetail * (un[n] - 1); + CoefT2[n] = CoefT1[n] * un[n]; + // Contributions to the virial coefficients + SumB[n] = 0; + Sum0[n] = 0; + if (n <= 18) { + Sum = Bs[n] * D; + if (n >= 13) { + Sum += -Csn[n] * Dred; } + SumB[n] = Sum * Tun[n]; + } + if (n >= 13) { + // Contributions to the residual part of the Helmholtz energy + Sum0[n] = Csn[n] * Dknn[bn[n]] * Tun[n] * Expn[kn[n]]; + // Contributions to the derivatives of the Helmholtz energy with respect to + // density + bkd = bn[n] - kn[n] * Dknn[kn[n]]; + ckd = kn[n] * kn[n] * Dknn[kn[n]]; + CoefD1[n] = bkd; + CoefD2[n] = bkd * (bkd - 1) - ckd; + CoefD3[n] = (bkd - 2) * CoefD2[n] + ckd * (1 - kn[n] - 2 * bkd); + } else { + CoefD1[n] = 0; + CoefD2[n] = 0; + CoefD3[n] = 0; + } } - // The following routine must be called once before any other routine. - /** - *- * SetupDetail. - *
- */ - public void SetupDetail() { - // Initialize all the constants and parameters in the DETAIL model. - // Some values are modified for calculations that do not depend on T, D, and x - // in order to speed up the program. - - int[] sn = new int[NTerms + 1]; - int[] wn = new int[NTerms + 1]; - - double[] Ei = new double[MaxFlds + 1]; - double[] Ki = new double[MaxFlds + 1]; - double[] Si = new double[MaxFlds + 1]; - double[] Wi = new double[MaxFlds + 1]; - double Bsnij; - double[][] Kij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] Gij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] Eij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] Uij = new double[MaxFlds + 1][MaxFlds + 1]; - - double d0; - - RDetail = 8.31451; - - // Molar masses (g/mol) - MMiDetail[1] = 16.043; // Methane - MMiDetail[2] = 28.0135; // Nitrogen - MMiDetail[3] = 44.01; // Carbon dioxide - MMiDetail[4] = 30.07; // Ethane - MMiDetail[5] = 44.097; // Propane - MMiDetail[6] = 58.123; // Isobutane - MMiDetail[7] = 58.123; // n-Butane - MMiDetail[8] = 72.15; // Isopentane - MMiDetail[9] = 72.15; // n-Pentane - MMiDetail[10] = 86.177; // Hexane - MMiDetail[11] = 100.204; // Heptane - MMiDetail[12] = 114.231; // Octane - MMiDetail[13] = 128.258; // Nonane - MMiDetail[14] = 142.285; // Decane - MMiDetail[15] = 2.0159; // Hydrogen - MMiDetail[16] = 31.9988; // Oxygen - MMiDetail[17] = 28.01; // Carbon monoxide - MMiDetail[18] = 18.0153; // Water - MMiDetail[19] = 34.082; // Hydrogen sulfide - MMiDetail[20] = 4.0026; // Helium - MMiDetail[21] = 39.948; // Argon - - // Initialize constants - Told = 0; - for (int i = 1; i <= NTerms; ++i) { - an[i] = 0; - bn[i] = 0; - gn[i] = 0; - fn[i] = 0; - kn[i] = 0; - qn[i] = 0; - sn[i] = 0; - un[i] = 0; - wn[i] = 0; - } + for (int n = 1; n <= 58; ++n) { + // Density derivatives + s0 = Sum0[n] + SumB[n]; + s1 = Sum0[n] * CoefD1[n] + SumB[n]; + s2 = Sum0[n] * CoefD2[n]; + s3 = Sum0[n] * CoefD3[n]; + ar[0][0].val = ar[0][0].val + RT * s0; + ar[0][1].val = ar[0][1].val + RT * s1; + ar[0][2].val = ar[0][2].val + RT * s2; + ar[0][3].val = ar[0][3].val + RT * s3; + // Temperature derivatives + if (itau > 0) { + ar[1][0].val = ar[1][0].val - CoefT1[n] * s0; + ar[1][1].val = ar[1][1].val - CoefT1[n] * s1; + ar[2][0].val = ar[2][0].val + CoefT2[n] * s0; + // The following are not used, but fully functional + // ar(1, 2) = ar(1, 2) - CoefT1(n) * s2; + // ar(1, 3) = ar(1, 3) - CoefT1(n) * s3; + // ar(2, 1) = ar(2, 1) + CoefT2(n) * s1; + // ar(2, 2) = ar(2, 2) + CoefT2(n) * s2; + // ar(2, 3) = ar(2, 3) + CoefT2(n) * s3; + } + } + } + + // The following routine must be called once before any other routine. + /** + *+ * SetupDetail. + *
+ */ + public void SetupDetail() { + // Initialize all the constants and parameters in the DETAIL model. + // Some values are modified for calculations that do not depend on T, D, and x + // in order to speed up the program. + + int[] sn = new int[NTerms + 1]; + int[] wn = new int[NTerms + 1]; + + double[] Ei = new double[MaxFlds + 1]; + double[] Ki = new double[MaxFlds + 1]; + double[] Si = new double[MaxFlds + 1]; + double[] Wi = new double[MaxFlds + 1]; + double Bsnij; + double[][] Kij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] Gij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] Eij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] Uij = new double[MaxFlds + 1][MaxFlds + 1]; + + double d0; + + RDetail = 8.31451; + + // Molar masses (g/mol) + MMiDetail[1] = 16.043; // Methane + MMiDetail[2] = 28.0135; // Nitrogen + MMiDetail[3] = 44.01; // Carbon dioxide + MMiDetail[4] = 30.07; // Ethane + MMiDetail[5] = 44.097; // Propane + MMiDetail[6] = 58.123; // Isobutane + MMiDetail[7] = 58.123; // n-Butane + MMiDetail[8] = 72.15; // Isopentane + MMiDetail[9] = 72.15; // n-Pentane + MMiDetail[10] = 86.177; // Hexane + MMiDetail[11] = 100.204; // Heptane + MMiDetail[12] = 114.231; // Octane + MMiDetail[13] = 128.258; // Nonane + MMiDetail[14] = 142.285; // Decane + MMiDetail[15] = 2.0159; // Hydrogen + MMiDetail[16] = 31.9988; // Oxygen + MMiDetail[17] = 28.01; // Carbon monoxide + MMiDetail[18] = 18.0153; // Water + MMiDetail[19] = 34.082; // Hydrogen sulfide + MMiDetail[20] = 4.0026; // Helium + MMiDetail[21] = 39.948; // Argon + + // Initialize constants + Told = 0; + for (int i = 1; i <= NTerms; ++i) { + an[i] = 0; + bn[i] = 0; + gn[i] = 0; + fn[i] = 0; + kn[i] = 0; + qn[i] = 0; + sn[i] = 0; + un[i] = 0; + wn[i] = 0; + } - for (int i = 1; i <= MaxFlds; ++i) { - Ei[i] = 0; - Fi[i] = 0; - Gi[i] = 0; - Ki[i] = 0; - Qi[i] = 0; - Si[i] = 0; - Wi[i] = 0; - xold[i] = 0; - for (int j = 1; j <= MaxFlds; ++j) { - Eij[i][j] = 1; - Gij[i][j] = 1; - Kij[i][j] = 1; - Uij[i][j] = 1; - } - } + for (int i = 1; i <= MaxFlds; ++i) { + Ei[i] = 0; + Fi[i] = 0; + Gi[i] = 0; + Ki[i] = 0; + Qi[i] = 0; + Si[i] = 0; + Wi[i] = 0; + xold[i] = 0; + for (int j = 1; j <= MaxFlds; ++j) { + Eij[i][j] = 1; + Gij[i][j] = 1; + Kij[i][j] = 1; + Uij[i][j] = 1; + } + } - // Coefficients of the equation of state - an[1] = 0.1538326; - an[2] = 1.341953; - an[3] = -2.998583; - an[4] = -0.04831228; - an[5] = 0.3757965; - an[6] = -1.589575; - an[7] = -0.05358847; - an[8] = 0.88659463; - an[9] = -0.71023704; - an[10] = -1.471722; - an[11] = 1.32185035; - an[12] = -0.78665925; - an[13] = 0.00000000229129; - an[14] = 0.1576724; - an[15] = -0.4363864; - an[16] = -0.04408159; - an[17] = -0.003433888; - an[18] = 0.03205905; - an[19] = 0.02487355; - an[20] = 0.07332279; - an[21] = -0.001600573; - an[22] = 0.6424706; - an[23] = -0.4162601; - an[24] = -0.06689957; - an[25] = 0.2791795; - an[26] = -0.6966051; - an[27] = -0.002860589; - an[28] = -0.008098836; - an[29] = 3.150547; - an[30] = 0.007224479; - an[31] = -0.7057529; - an[32] = 0.5349792; - an[33] = -0.07931491; - an[34] = -1.418465; - an[35] = -5.99905E-17; - an[36] = 0.1058402; - an[37] = 0.03431729; - an[38] = -0.007022847; - an[39] = 0.02495587; - an[40] = 0.04296818; - an[41] = 0.7465453; - an[42] = -0.2919613; - an[43] = 7.294616; - an[44] = -9.936757; - an[45] = -0.005399808; - an[46] = -0.2432567; - an[47] = 0.04987016; - an[48] = 0.003733797; - an[49] = 1.874951; - an[50] = 0.002168144; - an[51] = -0.6587164; - an[52] = 0.000205518; - an[53] = 0.009776195; - an[54] = -0.02048708; - an[55] = 0.01557322; - an[56] = 0.006862415; - an[57] = -0.001226752; - an[58] = 0.002850908; - - // Density exponents - bn[1] = 1; - bn[2] = 1; - bn[3] = 1; - bn[4] = 1; - bn[5] = 1; - bn[6] = 1; - bn[7] = 1; - bn[8] = 1; - bn[9] = 1; - bn[10] = 1; - bn[11] = 1; - bn[12] = 1; - bn[13] = 1; - bn[14] = 1; - bn[15] = 1; - bn[16] = 1; - bn[17] = 1; - bn[18] = 1; - bn[19] = 2; - bn[20] = 2; - bn[21] = 2; - bn[22] = 2; - bn[23] = 2; - bn[24] = 2; - bn[25] = 2; - bn[26] = 2; - bn[27] = 2; - bn[28] = 3; - bn[29] = 3; - bn[30] = 3; - bn[31] = 3; - bn[32] = 3; - bn[33] = 3; - bn[34] = 3; - bn[35] = 3; - bn[36] = 3; - bn[37] = 3; - bn[38] = 4; - bn[39] = 4; - bn[40] = 4; - bn[41] = 4; - bn[42] = 4; - bn[43] = 4; - bn[44] = 4; - bn[45] = 5; - bn[46] = 5; - bn[47] = 5; - bn[48] = 5; - bn[49] = 5; - bn[50] = 6; - bn[51] = 6; - bn[52] = 7; - bn[53] = 7; - bn[54] = 8; - bn[55] = 8; - bn[56] = 8; - bn[57] = 9; - bn[58] = 9; - - // Exponents on density in EXP[-cn*D^kn] part - // The cn part in this term is not included in this program since it is 1 when - // kn<>0][and 0 otherwise - kn[13] = 3; - kn[14] = 2; - kn[15] = 2; - kn[16] = 2; - kn[17] = 4; - kn[18] = 4; - kn[21] = 2; - kn[22] = 2; - kn[23] = 2; - kn[24] = 4; - kn[25] = 4; - kn[26] = 4; - kn[27] = 4; - kn[29] = 1; - kn[30] = 1; - kn[31] = 2; - kn[32] = 2; - kn[33] = 3; - kn[34] = 3; - kn[35] = 4; - kn[36] = 4; - kn[37] = 4; - kn[40] = 2; - kn[41] = 2; - kn[42] = 2; - kn[43] = 4; - kn[44] = 4; - kn[46] = 2; - kn[47] = 2; - kn[48] = 4; - kn[49] = 4; - kn[51] = 2; - kn[53] = 2; - kn[54] = 1; - kn[55] = 2; - kn[56] = 2; - kn[57] = 2; - kn[58] = 2; - - // Temperature exponents - un[1] = 0; - un[2] = 0.5; - un[3] = 1; - un[4] = 3.5; - un[5] = -0.5; - un[6] = 4.5; - un[7] = 0.5; - un[8] = 7.5; - un[9] = 9.5; - un[10] = 6; - un[11] = 12; - un[12] = 12.5; - un[13] = -6; - un[14] = 2; - un[15] = 3; - un[16] = 2; - un[17] = 2; - un[18] = 11; - un[19] = -0.5; - un[20] = 0.5; - un[21] = 0; - un[22] = 4; - un[23] = 6; - un[24] = 21; - un[25] = 23; - un[26] = 22; - un[27] = -1; - un[28] = -0.5; - un[29] = 7; - un[30] = -1; - un[31] = 6; - un[32] = 4; - un[33] = 1; - un[34] = 9; - un[35] = -13; - un[36] = 21; - un[37] = 8; - un[38] = -0.5; - un[39] = 0; - un[40] = 2; - un[41] = 7; - un[42] = 9; - un[43] = 22; - un[44] = 23; - un[45] = 1; - un[46] = 9; - un[47] = 3; - un[48] = 8; - un[49] = 23; - un[50] = 1.5; - un[51] = 5; - un[52] = -0.5; - un[53] = 4; - un[54] = 7; - un[55] = 3; - un[56] = 0; - un[57] = 1; - un[58] = 0; - - // Flags - fn[13] = 1; - fn[27] = 1; - fn[30] = 1; - fn[35] = 1; - gn[5] = 1; - gn[6] = 1; - gn[25] = 1; - gn[29] = 1; - gn[32] = 1; - gn[33] = 1; - gn[34] = 1; - gn[51] = 1; - gn[54] = 1; - gn[56] = 1; - qn[7] = 1; - qn[16] = 1; - qn[26] = 1; - qn[28] = 1; - qn[37] = 1; - qn[42] = 1; - qn[47] = 1; - qn[49] = 1; - qn[52] = 1; - qn[58] = 1; - sn[8] = 1; - sn[9] = 1; - wn[10] = 1; - wn[11] = 1; - wn[12] = 1; - - // Energy parameters - Ei[1] = 151.3183; - Ei[2] = 99.73778; - Ei[3] = 241.9606; - Ei[4] = 244.1667; - Ei[5] = 298.1183; - Ei[6] = 324.0689; - Ei[7] = 337.6389; - Ei[8] = 365.5999; - Ei[9] = 370.6823; - Ei[10] = 402.636293; - Ei[11] = 427.72263; - Ei[12] = 450.325022; - Ei[13] = 470.840891; - Ei[14] = 489.558373; - Ei[15] = 26.95794; - Ei[16] = 122.7667; - Ei[17] = 105.5348; - Ei[18] = 514.0156; - Ei[19] = 296.355; - Ei[20] = 2.610111; - Ei[21] = 119.6299; - - // Size parameters - Ki[1] = 0.4619255; - Ki[2] = 0.4479153; - Ki[3] = 0.4557489; - Ki[4] = 0.5279209; - Ki[5] = 0.583749; - Ki[6] = 0.6406937; - Ki[7] = 0.6341423; - Ki[8] = 0.6738577; - Ki[9] = 0.6798307; - Ki[10] = 0.7175118; - Ki[11] = 0.7525189; - Ki[12] = 0.784955; - Ki[13] = 0.8152731; - Ki[14] = 0.8437826; - Ki[15] = 0.3514916; - Ki[16] = 0.4186954; - Ki[17] = 0.4533894; - Ki[18] = 0.3825868; - Ki[19] = 0.4618263; - Ki[20] = 0.3589888; - Ki[21] = 0.4216551; - - // Orientation parameters - Gi[2] = 0.027815; - Gi[3] = 0.189065; - Gi[4] = 0.0793; - Gi[5] = 0.141239; - Gi[6] = 0.256692; - Gi[7] = 0.281835; - Gi[8] = 0.332267; - Gi[9] = 0.366911; - Gi[10] = 0.289731; - Gi[11] = 0.337542; - Gi[12] = 0.383381; - Gi[13] = 0.427354; - Gi[14] = 0.469659; - Gi[15] = 0.034369; - Gi[16] = 0.021; - Gi[17] = 0.038953; - Gi[18] = 0.3325; - Gi[19] = 0.0885; - - // Quadrupole parameters - Qi[3] = 0.69; - Qi[18] = 1.06775; - Qi[19] = 0.633276; - Fi[15] = 1; // High temperature parameter - Si[18] = 1.5822; // Dipole parameter - Si[19] = 0.39; // Dipole parameter - Wi[18] = 1; // Association parameter - - // Energy parameters - Eij[1][2] = 0.97164; - Eij[1][3] = 0.960644; - Eij[1][5] = 0.994635; - Eij[1][6] = 1.01953; - Eij[1][7] = 0.989844; - Eij[1][8] = 1.00235; - Eij[1][9] = 0.999268; - Eij[1][10] = 1.107274; - Eij[1][11] = 0.88088; - Eij[1][12] = 0.880973; - Eij[1][13] = 0.881067; - Eij[1][14] = 0.881161; - Eij[1][15] = 1.17052; - Eij[1][17] = 0.990126; - Eij[1][18] = 0.708218; - Eij[1][19] = 0.931484; - Eij[2][3] = 1.02274; - Eij[2][4] = 0.97012; - Eij[2][5] = 0.945939; - Eij[2][6] = 0.946914; - Eij[2][7] = 0.973384; - Eij[2][8] = 0.95934; - Eij[2][9] = 0.94552; - Eij[2][15] = 1.08632; - Eij[2][16] = 1.021; - Eij[2][17] = 1.00571; - Eij[2][18] = 0.746954; - Eij[2][19] = 0.902271; - Eij[3][4] = 0.925053; - Eij[3][5] = 0.960237; - Eij[3][6] = 0.906849; - Eij[3][7] = 0.897362; - Eij[3][8] = 0.726255; - Eij[3][9] = 0.859764; - Eij[3][10] = 0.855134; - Eij[3][11] = 0.831229; - Eij[3][12] = 0.80831; - Eij[3][13] = 0.786323; - Eij[3][14] = 0.765171; - Eij[3][15] = 1.28179; - Eij[3][17] = 1.5; - Eij[3][18] = 0.849408; - Eij[3][19] = 0.955052; - Eij[4][5] = 1.02256; - Eij[4][7] = 1.01306; - Eij[4][9] = 1.00532; - Eij[4][15] = 1.16446; - Eij[4][18] = 0.693168; - Eij[4][19] = 0.946871; - Eij[5][7] = 1.0049; - Eij[5][15] = 1.034787; - Eij[6][15] = 1.3; - Eij[7][15] = 1.3; - Eij[10][19] = 1.008692; - Eij[11][19] = 1.010126; - Eij[12][19] = 1.011501; - Eij[13][19] = 1.012821; - Eij[14][19] = 1.014089; - Eij[15][17] = 1.1; - - // Conformal energy parameters - Uij[1][2] = 0.886106; - Uij[1][3] = 0.963827; - Uij[1][5] = 0.990877; - Uij[1][7] = 0.992291; - Uij[1][9] = 1.00367; - Uij[1][10] = 1.302576; - Uij[1][11] = 1.191904; - Uij[1][12] = 1.205769; - Uij[1][13] = 1.219634; - Uij[1][14] = 1.233498; - Uij[1][15] = 1.15639; - Uij[1][19] = 0.736833; - Uij[2][3] = 0.835058; - Uij[2][4] = 0.816431; - Uij[2][5] = 0.915502; - Uij[2][7] = 0.993556; - Uij[2][15] = 0.408838; - Uij[2][19] = 0.993476; - Uij[3][4] = 0.96987; - Uij[3][10] = 1.066638; - Uij[3][11] = 1.077634; - Uij[3][12] = 1.088178; - Uij[3][13] = 1.098291; - Uij[3][14] = 1.108021; - Uij[3][17] = 0.9; - Uij[3][19] = 1.04529; - Uij[4][5] = 1.065173; - Uij[4][6] = 1.25; - Uij[4][7] = 1.25; - Uij[4][8] = 1.25; - Uij[4][9] = 1.25; - Uij[4][15] = 1.61666; - Uij[4][19] = 0.971926; - Uij[10][19] = 1.028973; - Uij[11][19] = 1.033754; - Uij[12][19] = 1.038338; - Uij[13][19] = 1.042735; - Uij[14][19] = 1.046966; - - // Size parameters - Kij[1][2] = 1.00363; - Kij[1][3] = 0.995933; - Kij[1][5] = 1.007619; - Kij[1][7] = 0.997596; - Kij[1][9] = 1.002529; - Kij[1][10] = 0.982962; - Kij[1][11] = 0.983565; - Kij[1][12] = 0.982707; - Kij[1][13] = 0.981849; - Kij[1][14] = 0.980991; - Kij[1][15] = 1.02326; - Kij[1][19] = 1.00008; - Kij[2][3] = 0.982361; - Kij[2][4] = 1.00796; - Kij[2][15] = 1.03227; - Kij[2][19] = 0.942596; - Kij[3][4] = 1.00851; - Kij[3][10] = 0.910183; - Kij[3][11] = 0.895362; - Kij[3][12] = 0.881152; - Kij[3][13] = 0.86752; - Kij[3][14] = 0.854406; - Kij[3][19] = 1.00779; - Kij[4][5] = 0.986893; - Kij[4][15] = 1.02034; - Kij[4][19] = 0.999969; - Kij[10][19] = 0.96813; - Kij[11][19] = 0.96287; - Kij[12][19] = 0.957828; - Kij[13][19] = 0.952441; - Kij[14][19] = 0.948338; - - // Orientation parameters - Gij[1][3] = 0.807653; - Gij[1][15] = 1.95731; - Gij[2][3] = 0.982746; - Gij[3][4] = 0.370296; - Gij[3][18] = 1.67309; - - // Ideal gas parameters - n0i[1][3] = 4.00088; - n0i[1][4] = 0.76315; - n0i[1][5] = 0.0046; - n0i[1][6] = 8.74432; - n0i[1][7] = -4.46921; - n0i[1][1] = 29.83843397; - n0i[1][2] = -15999.69151; - n0i[2][3] = 3.50031; - n0i[2][4] = 0.13732; - n0i[2][5] = -0.1466; - n0i[2][6] = 0.90066; - n0i[2][7] = 0; - n0i[2][1] = 17.56770785; - n0i[2][2] = -2801.729072; - n0i[3][3] = 3.50002; - n0i[3][4] = 2.04452; - n0i[3][5] = -1.06044; - n0i[3][6] = 2.03366; - n0i[3][7] = 0.01393; - n0i[3][1] = 20.65844696; - n0i[3][2] = -4902.171516; - n0i[4][3] = 4.00263; - n0i[4][4] = 4.33939; - n0i[4][5] = 1.23722; - n0i[4][6] = 13.1974; - n0i[4][7] = -6.01989; - n0i[4][1] = 36.73005938; - n0i[4][2] = -23639.65301; - n0i[5][3] = 4.02939; - n0i[5][4] = 6.60569; - n0i[5][5] = 3.197; - n0i[5][6] = 19.1921; - n0i[5][7] = -8.37267; - n0i[5][1] = 44.70909619; - n0i[5][2] = -31236.63551; - n0i[6][3] = 4.06714; - n0i[6][4] = 8.97575; - n0i[6][5] = 5.25156; - n0i[6][6] = 25.1423; - n0i[6][7] = 16.1388; - n0i[6][1] = 34.30180349; - n0i[6][2] = -38525.50276; - n0i[7][3] = 4.33944; - n0i[7][4] = 9.44893; - n0i[7][5] = 6.89406; - n0i[7][6] = 24.4618; - n0i[7][7] = 14.7824; - n0i[7][1] = 36.53237783; - n0i[7][2] = -38957.80933; - n0i[8][3] = 4; - n0i[8][4] = 11.7618; - n0i[8][5] = 20.1101; - n0i[8][6] = 33.1688; - n0i[8][7] = 0; - n0i[8][1] = 43.17218626; - n0i[8][2] = -51198.30946; - n0i[9][3] = 4; - n0i[9][4] = 8.95043; - n0i[9][5] = 21.836; - n0i[9][6] = 33.4032; - n0i[9][7] = 0; - n0i[9][1] = 42.67837089; - n0i[9][2] = -45215.83; - n0i[10][3] = 4; - n0i[10][4] = 11.6977; - n0i[10][5] = 26.8142; - n0i[10][6] = 38.6164; - n0i[10][7] = 0; - n0i[10][1] = 46.99717188; - n0i[10][2] = -52746.83318; - n0i[11][3] = 4; - n0i[11][4] = 13.7266; - n0i[11][5] = 30.4707; - n0i[11][6] = 43.5561; - n0i[11][7] = 0; - n0i[11][1] = 52.07631631; - n0i[11][2] = -57104.81056; - n0i[12][3] = 4; - n0i[12][4] = 15.6865; - n0i[12][5] = 33.8029; - n0i[12][6] = 48.1731; - n0i[12][7] = 0; - n0i[12][1] = 57.25830934; - n0i[12][2] = -60546.76385; - n0i[13][3] = 4; - n0i[13][4] = 18.0241; - n0i[13][5] = 38.1235; - n0i[13][6] = 53.3415; - n0i[13][7] = 0; - n0i[13][1] = 62.09646901; - n0i[13][2] = -66600.12837; - n0i[14][3] = 4; - n0i[14][4] = 21.0069; - n0i[14][5] = 43.4931; - n0i[14][6] = 58.3657; - n0i[14][7] = 0; - n0i[14][1] = 65.93909154; - n0i[14][2] = -74131.45483; - n0i[15][3] = 2.47906; - n0i[15][4] = 0.95806; - n0i[15][5] = 0.45444; - n0i[15][6] = 1.56039; - n0i[15][7] = -1.3756; - n0i[15][1] = 13.07520288; - n0i[15][2] = -5836.943696; - n0i[16][3] = 3.50146; - n0i[16][4] = 1.07558; - n0i[16][5] = 1.01334; - n0i[16][6] = 0; - n0i[16][7] = 0; - n0i[16][1] = 16.8017173; - n0i[16][2] = -2318.32269; - n0i[17][3] = 3.50055; - n0i[17][4] = 1.02865; - n0i[17][5] = 0.00493; - n0i[17][6] = 0; - n0i[17][7] = 0; - n0i[17][1] = 17.45786899; - n0i[17][2] = -2635.244116; - n0i[18][3] = 4.00392; - n0i[18][4] = 0.01059; - n0i[18][5] = 0.98763; - n0i[18][6] = 3.06904; - n0i[18][7] = 0; - n0i[18][1] = 21.57882705; - n0i[18][2] = -7766.733078; - n0i[19][3] = 4; - n0i[19][4] = 3.11942; - n0i[19][5] = 1.00243; - n0i[19][6] = 0; - n0i[19][7] = 0; - n0i[19][1] = 21.5830944; - n0i[19][2] = -6069.035869; - n0i[20][3] = 2.5; - n0i[20][4] = 0; - n0i[20][5] = 0; - n0i[20][6] = 0; - n0i[20][7] = 0; - n0i[20][1] = 10.04639507; - n0i[20][2] = -745.375; - n0i[21][3] = 2.5; - n0i[21][4] = 0; - n0i[21][5] = 0; - n0i[21][6] = 0; - n0i[21][7] = 0; - n0i[21][1] = 10.04639507; - n0i[21][2] = -745.375; - th0i[1][4] = 820.659; - th0i[1][5] = 178.41; - th0i[1][6] = 1062.82; - th0i[1][7] = 1090.53; - th0i[2][4] = 662.738; - th0i[2][5] = 680.562; - th0i[2][6] = 1740.06; - th0i[2][7] = 0; - th0i[3][4] = 919.306; - th0i[3][5] = 865.07; - th0i[3][6] = 483.553; - th0i[3][7] = 341.109; - th0i[4][4] = 559.314; - th0i[4][5] = 223.284; - th0i[4][6] = 1031.38; - th0i[4][7] = 1071.29; - th0i[5][4] = 479.856; - th0i[5][5] = 200.893; - th0i[5][6] = 955.312; - th0i[5][7] = 1027.29; - th0i[6][4] = 438.27; - th0i[6][5] = 198.018; - th0i[6][6] = 1905.02; - th0i[6][7] = 893.765; - th0i[7][4] = 468.27; - th0i[7][5] = 183.636; - th0i[7][6] = 1914.1; - th0i[7][7] = 903.185; - th0i[8][4] = 292.503; - th0i[8][5] = 910.237; - th0i[8][6] = 1919.37; - th0i[8][7] = 0; - th0i[9][4] = 178.67; - th0i[9][5] = 840.538; - th0i[9][6] = 1774.25; - th0i[9][7] = 0; - th0i[10][4] = 182.326; - th0i[10][5] = 859.207; - th0i[10][6] = 1826.59; - th0i[10][7] = 0; - th0i[11][4] = 169.789; - th0i[11][5] = 836.195; - th0i[11][6] = 1760.46; - th0i[11][7] = 0; - th0i[12][4] = 158.922; - th0i[12][5] = 815.064; - th0i[12][6] = 1693.07; - th0i[12][7] = 0; - th0i[13][4] = 156.854; - th0i[13][5] = 814.882; - th0i[13][6] = 1693.79; - th0i[13][7] = 0; - th0i[14][4] = 164.947; - th0i[14][5] = 836.264; - th0i[14][6] = 1750.24; - th0i[14][7] = 0; - th0i[15][4] = 228.734; - th0i[15][5] = 326.843; - th0i[15][6] = 1651.71; - th0i[15][7] = 1671.69; - th0i[16][4] = 2235.71; - th0i[16][5] = 1116.69; - th0i[16][6] = 0; - th0i[16][7] = 0; - th0i[17][4] = 1550.45; - th0i[17][5] = 704.525; - th0i[17][6] = 0; - th0i[17][7] = 0; - th0i[18][4] = 268.795; - th0i[18][5] = 1141.41; - th0i[18][6] = 2507.37; - th0i[18][7] = 0; - th0i[19][4] = 1833.63; - th0i[19][5] = 847.181; - th0i[19][6] = 0; - th0i[19][7] = 0; - th0i[20][4] = 0; - th0i[20][5] = 0; - th0i[20][6] = 0; - th0i[20][7] = 0; - th0i[21][4] = 0; - th0i[21][5] = 0; - th0i[21][6] = 0; - th0i[21][7] = 0; - - // Precalculations of constants - for (int i = 1; i <= MaxFlds; ++i) { - Ki25[i] = Math.pow(Ki[i], 2.5); - Ei25[i] = Math.pow(Ei[i], 2.5); - } - for (int i = 1; i <= MaxFlds; ++i) { - for (int j = i; j <= MaxFlds; ++j) { - for (int n = 1; n <= 18; ++n) { - Bsnij = 1; - if (gn[n] == 1) { - Bsnij = Gij[i][j] * (Gi[i] + Gi[j]) / 2; - } - if (qn[n] == 1) { - Bsnij = Bsnij * Qi[i] * Qi[j]; - } - if (fn[n] == 1) { - Bsnij = Bsnij * Fi[i] * Fi[j]; - } - if (sn[n] == 1) { - Bsnij = Bsnij * Si[i] * Si[j]; - } - if (wn[n] == 1) { - Bsnij = Bsnij * Wi[i] * Wi[j]; - } - Bsnij2[i][j][n] = an[n] * Math.pow(Eij[i][j] * Math.sqrt(Ei[i] * Ei[j]), un[n]) - * Math.pow(Ki[i] * Ki[j], 1.5) * Bsnij; - } - Kij5[i][j] = (Math.pow(Kij[i][j], 5) - 1) * Ki25[i] * Ki25[j]; - Uij5[i][j] = (Math.pow(Uij[i][j], 5) - 1) * Ei25[i] * Ei25[j]; - Gij5[i][j] = (Gij[i][j] - 1) * (Gi[i] + Gi[j]) / 2; - } - } - // Ideal gas terms - d0 = 101.325 / RDetail / 298.15; - for (int i = 1; i <= MaxFlds; ++i) { - n0i[i][3] = n0i[i][3] - 1; - n0i[i][1] = n0i[i][1] - Math.log(d0); + // Coefficients of the equation of state + an[1] = 0.1538326; + an[2] = 1.341953; + an[3] = -2.998583; + an[4] = -0.04831228; + an[5] = 0.3757965; + an[6] = -1.589575; + an[7] = -0.05358847; + an[8] = 0.88659463; + an[9] = -0.71023704; + an[10] = -1.471722; + an[11] = 1.32185035; + an[12] = -0.78665925; + an[13] = 0.00000000229129; + an[14] = 0.1576724; + an[15] = -0.4363864; + an[16] = -0.04408159; + an[17] = -0.003433888; + an[18] = 0.03205905; + an[19] = 0.02487355; + an[20] = 0.07332279; + an[21] = -0.001600573; + an[22] = 0.6424706; + an[23] = -0.4162601; + an[24] = -0.06689957; + an[25] = 0.2791795; + an[26] = -0.6966051; + an[27] = -0.002860589; + an[28] = -0.008098836; + an[29] = 3.150547; + an[30] = 0.007224479; + an[31] = -0.7057529; + an[32] = 0.5349792; + an[33] = -0.07931491; + an[34] = -1.418465; + an[35] = -5.99905E-17; + an[36] = 0.1058402; + an[37] = 0.03431729; + an[38] = -0.007022847; + an[39] = 0.02495587; + an[40] = 0.04296818; + an[41] = 0.7465453; + an[42] = -0.2919613; + an[43] = 7.294616; + an[44] = -9.936757; + an[45] = -0.005399808; + an[46] = -0.2432567; + an[47] = 0.04987016; + an[48] = 0.003733797; + an[49] = 1.874951; + an[50] = 0.002168144; + an[51] = -0.6587164; + an[52] = 0.000205518; + an[53] = 0.009776195; + an[54] = -0.02048708; + an[55] = 0.01557322; + an[56] = 0.006862415; + an[57] = -0.001226752; + an[58] = 0.002850908; + + // Density exponents + bn[1] = 1; + bn[2] = 1; + bn[3] = 1; + bn[4] = 1; + bn[5] = 1; + bn[6] = 1; + bn[7] = 1; + bn[8] = 1; + bn[9] = 1; + bn[10] = 1; + bn[11] = 1; + bn[12] = 1; + bn[13] = 1; + bn[14] = 1; + bn[15] = 1; + bn[16] = 1; + bn[17] = 1; + bn[18] = 1; + bn[19] = 2; + bn[20] = 2; + bn[21] = 2; + bn[22] = 2; + bn[23] = 2; + bn[24] = 2; + bn[25] = 2; + bn[26] = 2; + bn[27] = 2; + bn[28] = 3; + bn[29] = 3; + bn[30] = 3; + bn[31] = 3; + bn[32] = 3; + bn[33] = 3; + bn[34] = 3; + bn[35] = 3; + bn[36] = 3; + bn[37] = 3; + bn[38] = 4; + bn[39] = 4; + bn[40] = 4; + bn[41] = 4; + bn[42] = 4; + bn[43] = 4; + bn[44] = 4; + bn[45] = 5; + bn[46] = 5; + bn[47] = 5; + bn[48] = 5; + bn[49] = 5; + bn[50] = 6; + bn[51] = 6; + bn[52] = 7; + bn[53] = 7; + bn[54] = 8; + bn[55] = 8; + bn[56] = 8; + bn[57] = 9; + bn[58] = 9; + + // Exponents on density in EXP[-cn*D^kn] part + // The cn part in this term is not included in this program since it is 1 when + // kn<>0][and 0 otherwise + kn[13] = 3; + kn[14] = 2; + kn[15] = 2; + kn[16] = 2; + kn[17] = 4; + kn[18] = 4; + kn[21] = 2; + kn[22] = 2; + kn[23] = 2; + kn[24] = 4; + kn[25] = 4; + kn[26] = 4; + kn[27] = 4; + kn[29] = 1; + kn[30] = 1; + kn[31] = 2; + kn[32] = 2; + kn[33] = 3; + kn[34] = 3; + kn[35] = 4; + kn[36] = 4; + kn[37] = 4; + kn[40] = 2; + kn[41] = 2; + kn[42] = 2; + kn[43] = 4; + kn[44] = 4; + kn[46] = 2; + kn[47] = 2; + kn[48] = 4; + kn[49] = 4; + kn[51] = 2; + kn[53] = 2; + kn[54] = 1; + kn[55] = 2; + kn[56] = 2; + kn[57] = 2; + kn[58] = 2; + + // Temperature exponents + un[1] = 0; + un[2] = 0.5; + un[3] = 1; + un[4] = 3.5; + un[5] = -0.5; + un[6] = 4.5; + un[7] = 0.5; + un[8] = 7.5; + un[9] = 9.5; + un[10] = 6; + un[11] = 12; + un[12] = 12.5; + un[13] = -6; + un[14] = 2; + un[15] = 3; + un[16] = 2; + un[17] = 2; + un[18] = 11; + un[19] = -0.5; + un[20] = 0.5; + un[21] = 0; + un[22] = 4; + un[23] = 6; + un[24] = 21; + un[25] = 23; + un[26] = 22; + un[27] = -1; + un[28] = -0.5; + un[29] = 7; + un[30] = -1; + un[31] = 6; + un[32] = 4; + un[33] = 1; + un[34] = 9; + un[35] = -13; + un[36] = 21; + un[37] = 8; + un[38] = -0.5; + un[39] = 0; + un[40] = 2; + un[41] = 7; + un[42] = 9; + un[43] = 22; + un[44] = 23; + un[45] = 1; + un[46] = 9; + un[47] = 3; + un[48] = 8; + un[49] = 23; + un[50] = 1.5; + un[51] = 5; + un[52] = -0.5; + un[53] = 4; + un[54] = 7; + un[55] = 3; + un[56] = 0; + un[57] = 1; + un[58] = 0; + + // Flags + fn[13] = 1; + fn[27] = 1; + fn[30] = 1; + fn[35] = 1; + gn[5] = 1; + gn[6] = 1; + gn[25] = 1; + gn[29] = 1; + gn[32] = 1; + gn[33] = 1; + gn[34] = 1; + gn[51] = 1; + gn[54] = 1; + gn[56] = 1; + qn[7] = 1; + qn[16] = 1; + qn[26] = 1; + qn[28] = 1; + qn[37] = 1; + qn[42] = 1; + qn[47] = 1; + qn[49] = 1; + qn[52] = 1; + qn[58] = 1; + sn[8] = 1; + sn[9] = 1; + wn[10] = 1; + wn[11] = 1; + wn[12] = 1; + + // Energy parameters + Ei[1] = 151.3183; + Ei[2] = 99.73778; + Ei[3] = 241.9606; + Ei[4] = 244.1667; + Ei[5] = 298.1183; + Ei[6] = 324.0689; + Ei[7] = 337.6389; + Ei[8] = 365.5999; + Ei[9] = 370.6823; + Ei[10] = 402.636293; + Ei[11] = 427.72263; + Ei[12] = 450.325022; + Ei[13] = 470.840891; + Ei[14] = 489.558373; + Ei[15] = 26.95794; + Ei[16] = 122.7667; + Ei[17] = 105.5348; + Ei[18] = 514.0156; + Ei[19] = 296.355; + Ei[20] = 2.610111; + Ei[21] = 119.6299; + + // Size parameters + Ki[1] = 0.4619255; + Ki[2] = 0.4479153; + Ki[3] = 0.4557489; + Ki[4] = 0.5279209; + Ki[5] = 0.583749; + Ki[6] = 0.6406937; + Ki[7] = 0.6341423; + Ki[8] = 0.6738577; + Ki[9] = 0.6798307; + Ki[10] = 0.7175118; + Ki[11] = 0.7525189; + Ki[12] = 0.784955; + Ki[13] = 0.8152731; + Ki[14] = 0.8437826; + Ki[15] = 0.3514916; + Ki[16] = 0.4186954; + Ki[17] = 0.4533894; + Ki[18] = 0.3825868; + Ki[19] = 0.4618263; + Ki[20] = 0.3589888; + Ki[21] = 0.4216551; + + // Orientation parameters + Gi[2] = 0.027815; + Gi[3] = 0.189065; + Gi[4] = 0.0793; + Gi[5] = 0.141239; + Gi[6] = 0.256692; + Gi[7] = 0.281835; + Gi[8] = 0.332267; + Gi[9] = 0.366911; + Gi[10] = 0.289731; + Gi[11] = 0.337542; + Gi[12] = 0.383381; + Gi[13] = 0.427354; + Gi[14] = 0.469659; + Gi[15] = 0.034369; + Gi[16] = 0.021; + Gi[17] = 0.038953; + Gi[18] = 0.3325; + Gi[19] = 0.0885; + + // Quadrupole parameters + Qi[3] = 0.69; + Qi[18] = 1.06775; + Qi[19] = 0.633276; + Fi[15] = 1; // High temperature parameter + Si[18] = 1.5822; // Dipole parameter + Si[19] = 0.39; // Dipole parameter + Wi[18] = 1; // Association parameter + + // Energy parameters + Eij[1][2] = 0.97164; + Eij[1][3] = 0.960644; + Eij[1][5] = 0.994635; + Eij[1][6] = 1.01953; + Eij[1][7] = 0.989844; + Eij[1][8] = 1.00235; + Eij[1][9] = 0.999268; + Eij[1][10] = 1.107274; + Eij[1][11] = 0.88088; + Eij[1][12] = 0.880973; + Eij[1][13] = 0.881067; + Eij[1][14] = 0.881161; + Eij[1][15] = 1.17052; + Eij[1][17] = 0.990126; + Eij[1][18] = 0.708218; + Eij[1][19] = 0.931484; + Eij[2][3] = 1.02274; + Eij[2][4] = 0.97012; + Eij[2][5] = 0.945939; + Eij[2][6] = 0.946914; + Eij[2][7] = 0.973384; + Eij[2][8] = 0.95934; + Eij[2][9] = 0.94552; + Eij[2][15] = 1.08632; + Eij[2][16] = 1.021; + Eij[2][17] = 1.00571; + Eij[2][18] = 0.746954; + Eij[2][19] = 0.902271; + Eij[3][4] = 0.925053; + Eij[3][5] = 0.960237; + Eij[3][6] = 0.906849; + Eij[3][7] = 0.897362; + Eij[3][8] = 0.726255; + Eij[3][9] = 0.859764; + Eij[3][10] = 0.855134; + Eij[3][11] = 0.831229; + Eij[3][12] = 0.80831; + Eij[3][13] = 0.786323; + Eij[3][14] = 0.765171; + Eij[3][15] = 1.28179; + Eij[3][17] = 1.5; + Eij[3][18] = 0.849408; + Eij[3][19] = 0.955052; + Eij[4][5] = 1.02256; + Eij[4][7] = 1.01306; + Eij[4][9] = 1.00532; + Eij[4][15] = 1.16446; + Eij[4][18] = 0.693168; + Eij[4][19] = 0.946871; + Eij[5][7] = 1.0049; + Eij[5][15] = 1.034787; + Eij[6][15] = 1.3; + Eij[7][15] = 1.3; + Eij[10][19] = 1.008692; + Eij[11][19] = 1.010126; + Eij[12][19] = 1.011501; + Eij[13][19] = 1.012821; + Eij[14][19] = 1.014089; + Eij[15][17] = 1.1; + + // Conformal energy parameters + Uij[1][2] = 0.886106; + Uij[1][3] = 0.963827; + Uij[1][5] = 0.990877; + Uij[1][7] = 0.992291; + Uij[1][9] = 1.00367; + Uij[1][10] = 1.302576; + Uij[1][11] = 1.191904; + Uij[1][12] = 1.205769; + Uij[1][13] = 1.219634; + Uij[1][14] = 1.233498; + Uij[1][15] = 1.15639; + Uij[1][19] = 0.736833; + Uij[2][3] = 0.835058; + Uij[2][4] = 0.816431; + Uij[2][5] = 0.915502; + Uij[2][7] = 0.993556; + Uij[2][15] = 0.408838; + Uij[2][19] = 0.993476; + Uij[3][4] = 0.96987; + Uij[3][10] = 1.066638; + Uij[3][11] = 1.077634; + Uij[3][12] = 1.088178; + Uij[3][13] = 1.098291; + Uij[3][14] = 1.108021; + Uij[3][17] = 0.9; + Uij[3][19] = 1.04529; + Uij[4][5] = 1.065173; + Uij[4][6] = 1.25; + Uij[4][7] = 1.25; + Uij[4][8] = 1.25; + Uij[4][9] = 1.25; + Uij[4][15] = 1.61666; + Uij[4][19] = 0.971926; + Uij[10][19] = 1.028973; + Uij[11][19] = 1.033754; + Uij[12][19] = 1.038338; + Uij[13][19] = 1.042735; + Uij[14][19] = 1.046966; + + // Size parameters + Kij[1][2] = 1.00363; + Kij[1][3] = 0.995933; + Kij[1][5] = 1.007619; + Kij[1][7] = 0.997596; + Kij[1][9] = 1.002529; + Kij[1][10] = 0.982962; + Kij[1][11] = 0.983565; + Kij[1][12] = 0.982707; + Kij[1][13] = 0.981849; + Kij[1][14] = 0.980991; + Kij[1][15] = 1.02326; + Kij[1][19] = 1.00008; + Kij[2][3] = 0.982361; + Kij[2][4] = 1.00796; + Kij[2][15] = 1.03227; + Kij[2][19] = 0.942596; + Kij[3][4] = 1.00851; + Kij[3][10] = 0.910183; + Kij[3][11] = 0.895362; + Kij[3][12] = 0.881152; + Kij[3][13] = 0.86752; + Kij[3][14] = 0.854406; + Kij[3][19] = 1.00779; + Kij[4][5] = 0.986893; + Kij[4][15] = 1.02034; + Kij[4][19] = 0.999969; + Kij[10][19] = 0.96813; + Kij[11][19] = 0.96287; + Kij[12][19] = 0.957828; + Kij[13][19] = 0.952441; + Kij[14][19] = 0.948338; + + // Orientation parameters + Gij[1][3] = 0.807653; + Gij[1][15] = 1.95731; + Gij[2][3] = 0.982746; + Gij[3][4] = 0.370296; + Gij[3][18] = 1.67309; + + // Ideal gas parameters + n0i[1][3] = 4.00088; + n0i[1][4] = 0.76315; + n0i[1][5] = 0.0046; + n0i[1][6] = 8.74432; + n0i[1][7] = -4.46921; + n0i[1][1] = 29.83843397; + n0i[1][2] = -15999.69151; + n0i[2][3] = 3.50031; + n0i[2][4] = 0.13732; + n0i[2][5] = -0.1466; + n0i[2][6] = 0.90066; + n0i[2][7] = 0; + n0i[2][1] = 17.56770785; + n0i[2][2] = -2801.729072; + n0i[3][3] = 3.50002; + n0i[3][4] = 2.04452; + n0i[3][5] = -1.06044; + n0i[3][6] = 2.03366; + n0i[3][7] = 0.01393; + n0i[3][1] = 20.65844696; + n0i[3][2] = -4902.171516; + n0i[4][3] = 4.00263; + n0i[4][4] = 4.33939; + n0i[4][5] = 1.23722; + n0i[4][6] = 13.1974; + n0i[4][7] = -6.01989; + n0i[4][1] = 36.73005938; + n0i[4][2] = -23639.65301; + n0i[5][3] = 4.02939; + n0i[5][4] = 6.60569; + n0i[5][5] = 3.197; + n0i[5][6] = 19.1921; + n0i[5][7] = -8.37267; + n0i[5][1] = 44.70909619; + n0i[5][2] = -31236.63551; + n0i[6][3] = 4.06714; + n0i[6][4] = 8.97575; + n0i[6][5] = 5.25156; + n0i[6][6] = 25.1423; + n0i[6][7] = 16.1388; + n0i[6][1] = 34.30180349; + n0i[6][2] = -38525.50276; + n0i[7][3] = 4.33944; + n0i[7][4] = 9.44893; + n0i[7][5] = 6.89406; + n0i[7][6] = 24.4618; + n0i[7][7] = 14.7824; + n0i[7][1] = 36.53237783; + n0i[7][2] = -38957.80933; + n0i[8][3] = 4; + n0i[8][4] = 11.7618; + n0i[8][5] = 20.1101; + n0i[8][6] = 33.1688; + n0i[8][7] = 0; + n0i[8][1] = 43.17218626; + n0i[8][2] = -51198.30946; + n0i[9][3] = 4; + n0i[9][4] = 8.95043; + n0i[9][5] = 21.836; + n0i[9][6] = 33.4032; + n0i[9][7] = 0; + n0i[9][1] = 42.67837089; + n0i[9][2] = -45215.83; + n0i[10][3] = 4; + n0i[10][4] = 11.6977; + n0i[10][5] = 26.8142; + n0i[10][6] = 38.6164; + n0i[10][7] = 0; + n0i[10][1] = 46.99717188; + n0i[10][2] = -52746.83318; + n0i[11][3] = 4; + n0i[11][4] = 13.7266; + n0i[11][5] = 30.4707; + n0i[11][6] = 43.5561; + n0i[11][7] = 0; + n0i[11][1] = 52.07631631; + n0i[11][2] = -57104.81056; + n0i[12][3] = 4; + n0i[12][4] = 15.6865; + n0i[12][5] = 33.8029; + n0i[12][6] = 48.1731; + n0i[12][7] = 0; + n0i[12][1] = 57.25830934; + n0i[12][2] = -60546.76385; + n0i[13][3] = 4; + n0i[13][4] = 18.0241; + n0i[13][5] = 38.1235; + n0i[13][6] = 53.3415; + n0i[13][7] = 0; + n0i[13][1] = 62.09646901; + n0i[13][2] = -66600.12837; + n0i[14][3] = 4; + n0i[14][4] = 21.0069; + n0i[14][5] = 43.4931; + n0i[14][6] = 58.3657; + n0i[14][7] = 0; + n0i[14][1] = 65.93909154; + n0i[14][2] = -74131.45483; + n0i[15][3] = 2.47906; + n0i[15][4] = 0.95806; + n0i[15][5] = 0.45444; + n0i[15][6] = 1.56039; + n0i[15][7] = -1.3756; + n0i[15][1] = 13.07520288; + n0i[15][2] = -5836.943696; + n0i[16][3] = 3.50146; + n0i[16][4] = 1.07558; + n0i[16][5] = 1.01334; + n0i[16][6] = 0; + n0i[16][7] = 0; + n0i[16][1] = 16.8017173; + n0i[16][2] = -2318.32269; + n0i[17][3] = 3.50055; + n0i[17][4] = 1.02865; + n0i[17][5] = 0.00493; + n0i[17][6] = 0; + n0i[17][7] = 0; + n0i[17][1] = 17.45786899; + n0i[17][2] = -2635.244116; + n0i[18][3] = 4.00392; + n0i[18][4] = 0.01059; + n0i[18][5] = 0.98763; + n0i[18][6] = 3.06904; + n0i[18][7] = 0; + n0i[18][1] = 21.57882705; + n0i[18][2] = -7766.733078; + n0i[19][3] = 4; + n0i[19][4] = 3.11942; + n0i[19][5] = 1.00243; + n0i[19][6] = 0; + n0i[19][7] = 0; + n0i[19][1] = 21.5830944; + n0i[19][2] = -6069.035869; + n0i[20][3] = 2.5; + n0i[20][4] = 0; + n0i[20][5] = 0; + n0i[20][6] = 0; + n0i[20][7] = 0; + n0i[20][1] = 10.04639507; + n0i[20][2] = -745.375; + n0i[21][3] = 2.5; + n0i[21][4] = 0; + n0i[21][5] = 0; + n0i[21][6] = 0; + n0i[21][7] = 0; + n0i[21][1] = 10.04639507; + n0i[21][2] = -745.375; + th0i[1][4] = 820.659; + th0i[1][5] = 178.41; + th0i[1][6] = 1062.82; + th0i[1][7] = 1090.53; + th0i[2][4] = 662.738; + th0i[2][5] = 680.562; + th0i[2][6] = 1740.06; + th0i[2][7] = 0; + th0i[3][4] = 919.306; + th0i[3][5] = 865.07; + th0i[3][6] = 483.553; + th0i[3][7] = 341.109; + th0i[4][4] = 559.314; + th0i[4][5] = 223.284; + th0i[4][6] = 1031.38; + th0i[4][7] = 1071.29; + th0i[5][4] = 479.856; + th0i[5][5] = 200.893; + th0i[5][6] = 955.312; + th0i[5][7] = 1027.29; + th0i[6][4] = 438.27; + th0i[6][5] = 198.018; + th0i[6][6] = 1905.02; + th0i[6][7] = 893.765; + th0i[7][4] = 468.27; + th0i[7][5] = 183.636; + th0i[7][6] = 1914.1; + th0i[7][7] = 903.185; + th0i[8][4] = 292.503; + th0i[8][5] = 910.237; + th0i[8][6] = 1919.37; + th0i[8][7] = 0; + th0i[9][4] = 178.67; + th0i[9][5] = 840.538; + th0i[9][6] = 1774.25; + th0i[9][7] = 0; + th0i[10][4] = 182.326; + th0i[10][5] = 859.207; + th0i[10][6] = 1826.59; + th0i[10][7] = 0; + th0i[11][4] = 169.789; + th0i[11][5] = 836.195; + th0i[11][6] = 1760.46; + th0i[11][7] = 0; + th0i[12][4] = 158.922; + th0i[12][5] = 815.064; + th0i[12][6] = 1693.07; + th0i[12][7] = 0; + th0i[13][4] = 156.854; + th0i[13][5] = 814.882; + th0i[13][6] = 1693.79; + th0i[13][7] = 0; + th0i[14][4] = 164.947; + th0i[14][5] = 836.264; + th0i[14][6] = 1750.24; + th0i[14][7] = 0; + th0i[15][4] = 228.734; + th0i[15][5] = 326.843; + th0i[15][6] = 1651.71; + th0i[15][7] = 1671.69; + th0i[16][4] = 2235.71; + th0i[16][5] = 1116.69; + th0i[16][6] = 0; + th0i[16][7] = 0; + th0i[17][4] = 1550.45; + th0i[17][5] = 704.525; + th0i[17][6] = 0; + th0i[17][7] = 0; + th0i[18][4] = 268.795; + th0i[18][5] = 1141.41; + th0i[18][6] = 2507.37; + th0i[18][7] = 0; + th0i[19][4] = 1833.63; + th0i[19][5] = 847.181; + th0i[19][6] = 0; + th0i[19][7] = 0; + th0i[20][4] = 0; + th0i[20][5] = 0; + th0i[20][6] = 0; + th0i[20][7] = 0; + th0i[21][4] = 0; + th0i[21][5] = 0; + th0i[21][6] = 0; + th0i[21][7] = 0; + + // Precalculations of constants + for (int i = 1; i <= MaxFlds; ++i) { + Ki25[i] = Math.pow(Ki[i], 2.5); + Ei25[i] = Math.pow(Ei[i], 2.5); + } + for (int i = 1; i <= MaxFlds; ++i) { + for (int j = i; j <= MaxFlds; ++j) { + for (int n = 1; n <= 18; ++n) { + Bsnij = 1; + if (gn[n] == 1) { + Bsnij = Gij[i][j] * (Gi[i] + Gi[j]) / 2; + } + if (qn[n] == 1) { + Bsnij = Bsnij * Qi[i] * Qi[j]; + } + if (fn[n] == 1) { + Bsnij = Bsnij * Fi[i] * Fi[j]; + } + if (sn[n] == 1) { + Bsnij = Bsnij * Si[i] * Si[j]; + } + if (wn[n] == 1) { + Bsnij = Bsnij * Wi[i] * Wi[j]; + } + Bsnij2[i][j][n] = an[n] * Math.pow(Eij[i][j] * Math.sqrt(Ei[i] * Ei[j]), un[n]) + * Math.pow(Ki[i] * Ki[j], 1.5) * Bsnij; } - return; - - // Code to produce nearly exact values for n0[1] and n0[2] - // This is not called in the current code, but included below to show how the - // values were calculated. The return above can be removed to call this code. - // T0 = 298.15; - // d0 = 101.325 / RDetail / T0; - // for (int i=1; i <= MaxFlds; ++i){ - // n1 = 0; n2 = 0; - // if (th0i[i][4] > 0) {n2 = n2 - n0i[i][4] * th0i[i][4] / tanh(th0i[i][4] / - // T0); n1 = n1 - n0i[i][4] * log(sinh(th0i[i][4] / T0));} - // if (th0i[i][5] > 0) {n2 = n2 + n0i[i][5] * th0i[i][5] * tanh(th0i[i][5] / - // T0); n1 = n1 + n0i[i][5] * log(cosh(th0i[i][5] / T0));} - // if (th0i[i][6] > 0) {n2 = n2 - n0i[i][6] * th0i[i][6] / tanh(th0i[i][6] / - // T0); n1 = n1 - n0i[i][6] * log(sinh(th0i[i][6] / T0));} - // if (th0i[i][7] > 0) {n2 = n2 + n0i[i][7] * th0i[i][7] * tanh(th0i[i][7] / - // T0); n1 = n1 + n0i[i][7] * log(cosh(th0i[i][7] / T0));} - // n0i[i][2] = n2 - n0i[i][3] * T0; - // n0i[i][3] = n0i[i][3] - 1; - // n0i[i][1] = n1 - n2 / T0 + n0i[i][3] * (1 + log(T0)) - log(d0); - // } + Kij5[i][j] = (Math.pow(Kij[i][j], 5) - 1) * Ki25[i] * Ki25[j]; + Uij5[i][j] = (Math.pow(Uij[i][j], 5) - 1) * Ei25[i] * Ei25[j]; + Gij5[i][j] = (Gij[i][j] - 1) * (Gi[i] + Gi[j]) / 2; + } } - - /** - *- * main. - *
- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - public static void main(String[] args) { - DETAIL test = new DETAIL(); - test.SetupDetail(); - - double T = 400; - doubleW D = new doubleW(0.0); - doubleW P = new doubleW(50000.0d); - intW ierr = new intW(0); - doubleW Mm = new doubleW(0.0d); - doubleW Z = new doubleW(0.0d); - int iFlag = 0; - StringW herr = new StringW(""); - - double x[] = {0.0, 0.77824, 0.02, 0.06, 0.08, 0.03, 0.0015, 0.003, 0.0005, 0.00165, 0.00215, - 0.00088, 0.00024, 0.00015, 0.00009, 0.004, 0.005, 0.002, 0.0001, 0.0025, 0.007, - 0.001}; - - test.MolarMassDetail(x, Mm); - - System.out.println("mol mass " + Mm.val); - - test.DensityDetail(T, P.val, x, D, ierr, herr); - System.out.println("density " + D.val); - test.PressureDetail(T, D.val, x, P, Z); - System.out.println("pressure " + P.val); - System.out.println("Z " + Z.val); - - doubleW dPdD = new doubleW(0.0d), d2PdD2 = new doubleW(0.0d), d2PdTD = new doubleW(0.0d), - dPdT = new doubleW(0.0d), U = new doubleW(0.0d), H = new doubleW(0.0d), - S = new doubleW(0.0d), A = new doubleW(0.0d), P2 = new doubleW(0.0d); - doubleW Cv = new doubleW(0.0d), Cp = new doubleW(0.0d), W = new doubleW(0.0d), - G = new doubleW(0.0d), JT = new doubleW(0.0d), Kappa = new doubleW(0.0d), - PP = new doubleW(0.0d); - - test.PropertiesDetail(T, D.val, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, - G, JT, Kappa); - - System.out.println("JT " + JT.val); - System.out.println("Kappa " + Kappa.val); + // Ideal gas terms + d0 = 101.325 / RDetail / 298.15; + for (int i = 1; i <= MaxFlds; ++i) { + n0i[i][3] = n0i[i][3] - 1; + n0i[i][1] = n0i[i][1] - Math.log(d0); } + return; + + // Code to produce nearly exact values for n0[1] and n0[2] + // This is not called in the current code, but included below to show how the + // values were calculated. The return above can be removed to call this code. + // T0 = 298.15; + // d0 = 101.325 / RDetail / T0; + // for (int i=1; i <= MaxFlds; ++i){ + // n1 = 0; n2 = 0; + // if (th0i[i][4] > 0) {n2 = n2 - n0i[i][4] * th0i[i][4] / tanh(th0i[i][4] / + // T0); n1 = n1 - n0i[i][4] * log(sinh(th0i[i][4] / T0));} + // if (th0i[i][5] > 0) {n2 = n2 + n0i[i][5] * th0i[i][5] * tanh(th0i[i][5] / + // T0); n1 = n1 + n0i[i][5] * log(cosh(th0i[i][5] / T0));} + // if (th0i[i][6] > 0) {n2 = n2 - n0i[i][6] * th0i[i][6] / tanh(th0i[i][6] / + // T0); n1 = n1 - n0i[i][6] * log(sinh(th0i[i][6] / T0));} + // if (th0i[i][7] > 0) {n2 = n2 + n0i[i][7] * th0i[i][7] * tanh(th0i[i][7] / + // T0); n1 = n1 + n0i[i][7] * log(cosh(th0i[i][7] / T0));} + // n0i[i][2] = n2 - n0i[i][3] * T0; + // n0i[i][3] = n0i[i][3] - 1; + // n0i[i][1] = n1 - n2 / T0 + n0i[i][3] * (1 + log(T0)) - log(d0); + // } + } + + /** + *+ * main. + *
+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + public static void main(String[] args) { + DETAIL test = new DETAIL(); + test.SetupDetail(); + + double T = 400; + doubleW D = new doubleW(0.0); + doubleW P = new doubleW(50000.0d); + intW ierr = new intW(0); + doubleW Mm = new doubleW(0.0d); + doubleW Z = new doubleW(0.0d); + int iFlag = 0; + StringW herr = new StringW(""); + + double x[] = {0.0, 0.77824, 0.02, 0.06, 0.08, 0.03, 0.0015, 0.003, 0.0005, 0.00165, 0.00215, + 0.00088, 0.00024, 0.00015, 0.00009, 0.004, 0.005, 0.002, 0.0001, 0.0025, 0.007, 0.001}; + + test.MolarMassDetail(x, Mm); + + System.out.println("mol mass " + Mm.val); + + test.DensityDetail(T, P.val, x, D, ierr, herr); + System.out.println("density " + D.val); + test.PressureDetail(T, D.val, x, P, Z); + System.out.println("pressure " + P.val); + System.out.println("Z " + Z.val); + + doubleW dPdD = new doubleW(0.0d), d2PdD2 = new doubleW(0.0d), d2PdTD = new doubleW(0.0d), + dPdT = new doubleW(0.0d), U = new doubleW(0.0d), H = new doubleW(0.0d), + S = new doubleW(0.0d), A = new doubleW(0.0d), P2 = new doubleW(0.0d); + doubleW Cv = new doubleW(0.0d), Cp = new doubleW(0.0d), W = new doubleW(0.0d), + G = new doubleW(0.0d), JT = new doubleW(0.0d), Kappa = new doubleW(0.0d), + PP = new doubleW(0.0d); + + test.PropertiesDetail(T, D.val, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, G, JT, + Kappa); + + System.out.println("JT " + JT.val); + System.out.println("Kappa " + Kappa.val); + } } diff --git a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java index d1fb9b2ae1..70659aada2 100644 --- a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java +++ b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java @@ -3283,14 +3283,14 @@ public static void main(String[] args) { /* * // test.PressureGERG(400, 12.798286, x); String herr = ""; test.DensityGERG(0, T, P, x, ierr, * herr); double pres = test.P; double molarmass = test.Mm; - * + * * // double dPdD=0.0, dPdD2=0.0, d2PdTD=0.0, dPdT=0.0, U=0.0, H=0.0, S=0.0, // Cv=0.0, Cp=0.0, * W=0.0, G=0.0, JT=0.0, Kappa=0.0, A=0.0; - * + * * // void DensityGERG(const int iFlag, const double T, const double P, const // * std::vector@@ -514,7 +510,7 @@ public void run() { * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file1.setOutputFileName(name1); file1.setXvalues(points2[2], "temp", "sec"); * file1.setYvalues(points2[3], "pres", "meter"); file1.createFile(); - * + * * String name2 = new String(); name2 = fileName + "Bub.nc"; file2 = new * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file2.setOutputFileName(name2); file2.setXvalues(points2[0], "temp", "sec"); diff --git a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelope1.java b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelope1.java index fed3e2a99f..72e6bbe0b2 100644 --- a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelope1.java +++ b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelope1.java @@ -315,7 +315,7 @@ public void run() { * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file1.setOutputFileName(name1); file1.setXvalues(points2[2], "temp", "sec"); * file1.setYvalues(points2[3], "pres", "meter"); file1.createFile(); - * + * * String name2 = new String(); name2 = fileName + "Bub.nc"; file2 = new * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file2.setOutputFileName(name2); file2.setXvalues(points2[0], "temp", "sec"); diff --git a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeMay.java b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeMay.java index 7aa341c63b..1876e16029 100644 --- a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeMay.java +++ b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeMay.java @@ -466,7 +466,7 @@ public void run() { * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file1.setOutputFileName(name1); file1.setXvalues(points2[2], "temp", "sec"); * file1.setYvalues(points2[3], "pres", "meter"); file1.createFile(); - * + * * String name2 = new String(); name2 = fileName + "Bub.nc"; file2 = new * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file2.setOutputFileName(name2); file2.setXvalues(points2[0], "temp", "sec"); diff --git a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeNew.java b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeNew.java index 56af56dd9f..208a35ecf6 100644 --- a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeNew.java +++ b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/pTphaseEnvelopeNew.java @@ -252,7 +252,7 @@ public void run() { * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file1.setOutputFileName(name1); file1.setXvalues(points2[2], "temp", "sec"); * file1.setYvalues(points2[3], "pres", "meter"); file1.createFile(); - * + * * String name2 = new String(); name2 = fileName + "Bub.nc"; file2 = new * neqsim.dataPresentation.fileHandeling.createNetCDF.netCDF2D.NetCdf2D(); * file2.setOutputFileName(name2); file2.setXvalues(points2[0], "temp", "sec"); diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java index 9640ce97bb..c592069a3a 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java @@ -415,9 +415,9 @@ public void run() { * { aMatrix.set(ii, 0, 1.0); aMatrix.set(ii, 1, pressures[i - ii]); aMatrix.set(ii, 2, * pressures[i - ii] * pressures[i - ii]); aMatrix.set(ii, 3, pressures[i - ii] * * pressures[i - ii] * pressures[i - ii]); } - * + * * for (int jj = 0; jj < 9; jj++) { Matrix xg = XMatrixgas.getMatrix(jj, jj, 0, 3); - * + * * try { xcoef[jj] = aMatrix.solve(xg.transpose()); } catch (Exception ex) { * logger.error(ex.getMessage(),e); } // logger.info("xcoef " + j); // xcoef.print(10, 10); * //logger.info("dss: " +ds * dxds.get(speceq, 0)); // specVal = xcoef.get(0, 0) + sny * diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java index d636e59476..47ec15230a 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java @@ -1202,7 +1202,7 @@ public void run() { * (temperatures[j] - temperatures[j - 1]))); if * (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] < 10.0e-3) { * props[k][i][j] = 25.0e-3; LWS=1; } - * + * * if (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] > 120.0e-3) { * props[k][i][j] = 80.0e-3; LWS=1; } } */ @@ -1237,7 +1237,7 @@ public void run() { * / (pressures[i - 1] - pressures[i - 3]) * (pressures[i] - pressures[i - 1]))); if * (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] < 10.0e-3) { * props[k][i][j] = 25.0e-3; LWS=1; } - * + * * if (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] > 120.0e-3) { * props[k][i][j] = 80.0e-3; LWS=1; } } */ diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java index 8d4bc0ee34..53832fc2d6 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java @@ -1187,7 +1187,7 @@ public void run() { * 3]) / (enthalpies[j - 1] - enthalpies[j - 3]) * (enthalpies[j] - enthalpies[j - * 1]))); if (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] < * 10.0e-3) { props[k][i][j] = 25.0e-3; LWS=1; } - * + * * if (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] > 120.0e-3) { * props[k][i][j] = 80.0e-3; LWS=1; } } */ @@ -1222,7 +1222,7 @@ public void run() { * / (pressures[i - 1] - pressures[i - 3]) * (pressures[i] - pressures[i - 1]))); if * (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] < 10.0e-3) { * props[k][i][j] = 25.0e-3; LWS=1; } - * + * * if (names[k].equals("LIQUID-WATER SURFACE TENSION") && props[k][i][j] > 120.0e-3) { * props[k][i][j] = 80.0e-3; LWS=1; } } */ diff --git a/src/main/java/neqsim/util/database/NeqSimContractDataBase.java b/src/main/java/neqsim/util/database/NeqSimContractDataBase.java index cc29c7c443..1da880fb4d 100644 --- a/src/main/java/neqsim/util/database/NeqSimContractDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimContractDataBase.java @@ -57,7 +57,7 @@ public NeqSimContractDataBase() { /** * Drops and re-creates table from contents in csv file. - * + * * @param tableName Name of table to replace */ public static void updateTable(String tableName) { diff --git a/src/main/java/neqsim/util/database/NeqSimDataBase.java b/src/main/java/neqsim/util/database/NeqSimDataBase.java index ba3860c5f6..9495d05e84 100644 --- a/src/main/java/neqsim/util/database/NeqSimDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimDataBase.java @@ -419,7 +419,7 @@ public static boolean hasComponent(String compName) { /** * Drops and re-creates table from contents in csv file. - * + * * @param tableName Name of table to replace */ public static void updateTable(String tableName) { @@ -428,7 +428,7 @@ public static void updateTable(String tableName) { /** * Drops and re-creates table from contents in csv file. - * + * * @param tableName Name of table to replace * @param path Path to csv file to */ @@ -449,7 +449,7 @@ public static void updateTable(String tableName, String path) { /** * Drops and re-creates table from contents in csv file. - * + * * @param tableName Name of table to replace * @param path Path to csv file to */ diff --git a/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java b/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java index ccfabfe8f7..2f1df9965d 100644 --- a/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimProcessDesignDataBase.java @@ -63,7 +63,7 @@ public NeqSimProcessDesignDataBase() { /** * Drops and re-creates table from contents in csv file. - * + * * @param tableName Name of table to replace */ public static void updateTable(String tableName) { diff --git a/src/main/java/neqsim/util/unit/LengthUnit.java b/src/main/java/neqsim/util/unit/LengthUnit.java index b8b1aad6d9..867650ab9b 100644 --- a/src/main/java/neqsim/util/unit/LengthUnit.java +++ b/src/main/java/neqsim/util/unit/LengthUnit.java @@ -21,7 +21,7 @@ public class LengthUnit extends neqsim.util.unit.BaseUnit { *
* Constructor for LengthUnit. *
- * + * * @param value Numeric value * @param name Name of unit */ diff --git a/src/main/java/neqsim/util/unit/TimeUnit.java b/src/main/java/neqsim/util/unit/TimeUnit.java index 466f12a5d7..bb5aff3a7c 100644 --- a/src/main/java/neqsim/util/unit/TimeUnit.java +++ b/src/main/java/neqsim/util/unit/TimeUnit.java @@ -21,7 +21,7 @@ public class TimeUnit extends neqsim.util.unit.BaseUnit { ** Constructor for TimeUnit. *
- * + * * @param value Numeric value * @param name Name of unit */ diff --git a/src/test/java/neqsim/PVTsimulation/simulation/SaturationTemperatureTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SaturationTemperatureTest.java index b43432f72d..df9361acf2 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SaturationTemperatureTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SaturationTemperatureTest.java @@ -12,7 +12,6 @@ /** * @author ESOL - * */ class SaturationTemperatureTest extends neqsim.NeqSimTest { /** @@ -57,7 +56,7 @@ void testCalcSaturationTemperature() { ** checkSaturationTemperatureToPhaseEnvelope. *
- * + * * @throws Exception */ @Test diff --git a/src/test/java/neqsim/processSimulation/measurementDevice/WellAllocatorTest.java b/src/test/java/neqsim/processSimulation/measurementDevice/WellAllocatorTest.java index 89b3ca0969..f8c775ad66 100644 --- a/src/test/java/neqsim/processSimulation/measurementDevice/WellAllocatorTest.java +++ b/src/test/java/neqsim/processSimulation/measurementDevice/WellAllocatorTest.java @@ -12,7 +12,6 @@ /** * @author ESOL - * */ class WellAllocatorTest extends neqsim.NeqSimTest { static Logger logger = LogManager.getLogger(WellAllocatorTest.class); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/absorber/SimpleAbsorberTest.java b/src/test/java/neqsim/processSimulation/processEquipment/absorber/SimpleAbsorberTest.java index 154a7b4f0f..4bb8f6725f 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/absorber/SimpleAbsorberTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/absorber/SimpleAbsorberTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; import neqsim.processSimulation.processEquipment.stream.Stream; -public class SimpleAbsorberTest extends neqsim.NeqSimTest{ +public class SimpleAbsorberTest extends neqsim.NeqSimTest { neqsim.thermo.system.SystemFurstElectrolyteEos testSystem; @BeforeEach @@ -31,7 +31,7 @@ void testRun() { * neqsim.processSimulation.processSystem.ProcessSystem operations = new * neqsim.processSimulation.processSystem.ProcessSystem(); operations.add(stream_Hot); * operations.add(absorber1); - * + * * operations.run(); */ // operations.displayResult(); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorberTest.java b/src/test/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorberTest.java index 5225d9c6aa..e77f00adb6 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorberTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorberTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; import neqsim.processSimulation.processEquipment.stream.Stream; -public class SimpleAdsorberTest extends neqsim.NeqSimTest{ +public class SimpleAdsorberTest extends neqsim.NeqSimTest { neqsim.thermo.system.SystemFurstElectrolyteEos testSystem; @BeforeEach @@ -16,7 +16,7 @@ void setUp() { testSystem.createDatabase(true); testSystem.setMixingRule(4); } - + @Disabled("Disabled until neqsim.processSimulation.processEquipment.adsorber.SimpleAdsorber is fixed") @Test void testRun() { @@ -31,7 +31,7 @@ void testRun() { * neqsim.processSimulation.processSystem.ProcessSystem operations = new * neqsim.processSimulation.processSystem.ProcessSystem(); operations.add(stream_Hot); * operations.add(adsorber1); - * + * * operations.run(); */ // operations.displayResult(); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartTest.java b/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartTest.java index 8e5d162d59..923d2268ec 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartTest.java @@ -132,7 +132,7 @@ public void test_Run() { * comp1.getPolytropicHead()); logger.info("Polytropic eff from curve:" + * comp1.getPolytropicEfficiency() * 100.0); logger.info("flow " + * stream_1.getThermoSystem().getFlowRate("m3/hr")); - * + * * logger.info("speed " + comp1.getCompressorChart().getSpeed( * stream_1.getThermoSystem().getFlowRate("m3/hr") + 10.0, comp1.getPolytropicHead())); * logger.info("pressure out " + comp1.getOutletPressure()); logger.info("temperature out " + diff --git a/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java b/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java index 98814ee444..43f5c7870a 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumnTest.java @@ -107,13 +107,11 @@ public void DistillationColumnTest() throws Exception { * System.out.println("Column in is " + totalWaterIn + " kg/hr"); * System.out.println("Column out is " + totalWaterOut + " kg/hr"); * System.out.println("Column is solved " + column.solved()); - * - * - * + * * System.out.println("Calc Water Flow rate via fluid component " + waterFlowRateInColumn); * System.out.println("Calc Water Flow rate via molar mass and flow rate total " + * waterFlowRateInColumn2 + " kg/hr"); - * + * * System.out .println("condenser temperature " + * column.getCondenser().getFluid().getTemperature("C")); System.out.println("condenser duty " + * ((Condenser) column.getCondenser()).getDuty()); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/mixer/MixerTest.java b/src/test/java/neqsim/processSimulation/processEquipment/mixer/MixerTest.java index 9aa6257e64..4e156d1e81 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/mixer/MixerTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/mixer/MixerTest.java @@ -11,7 +11,6 @@ /** * @author ESOL - * */ class MixerTest { static neqsim.thermo.system.SystemInterface testSystem; diff --git a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java index 58ea795fa6..039dfcab84 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/WellFlowTest.java @@ -118,7 +118,7 @@ void testRunTransient() { * System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara")); * System.out .println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + * " bara"); - * + * * System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + * " bara"); System.out .println("top side pressure " + * pipeline.getOutletStream().getPressure("bara") + " bara"); System.out diff --git a/src/test/java/neqsim/processSimulation/processEquipment/separator/SeparatorTest.java b/src/test/java/neqsim/processSimulation/processEquipment/separator/SeparatorTest.java index 1cde491703..7f7664f6c7 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/separator/SeparatorTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/separator/SeparatorTest.java @@ -11,7 +11,6 @@ /** * @author ESOL - * */ class SeparatorTest extends neqsim.NeqSimTest { static neqsim.thermo.system.SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/processSimulation/processEquipment/stream/StreamTest.java b/src/test/java/neqsim/processSimulation/processEquipment/stream/StreamTest.java index f5fffc2264..2ee7739da9 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/stream/StreamTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/stream/StreamTest.java @@ -11,7 +11,6 @@ /** * @author ESOL - * */ class StreamTest extends neqsim.NeqSimTest { static neqsim.thermo.system.SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java b/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java index 537d765c4f..ad79656910 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java @@ -212,20 +212,19 @@ public void runDistillationProcessTest() { /* * logger.info("wt n-hexane from column " + * column.getLiquidOutStream().getFluid().getPhase("oil").getWtFrac("n-hexane") * 100.0); - * + * * logger.info("wt methane from column " + * column.getLiquidOutStream().getFluid().getPhase("oil").getWtFrac("methane") * 100.0); - * + * * logger.info("wt propane from column " + * column.getLiquidOutStream().getFluid().getPhase("oil").getWtFrac("propane") * 100.0); - * - * + * * logger.info("wt n-hexane from gas column " + * column.getGasOutStream().getFluid().getPhase("gas").getWtFrac("n-hexane") * 100.0); - * + * * logger.info("wt methane from gas column " + * column.getGasOutStream().getFluid().getPhase("gas").getWtFrac("methane") * 100.0); - * + * * logger.info("wt propane from gas column " + * column.getGasOutStream().getFluid().getPhase("gas").getWtFrac("propane") * 100.0); */ @@ -262,14 +261,13 @@ public void runDistillationProcessTest2() { /* * logger.info("wt n-hexane from column " + * column.getLiquidOutStream().getFluid().getPhase("oil").getWtFrac("n-hexane") * 100.0); - * + * * logger.info("wt propane from column " + * column.getLiquidOutStream().getFluid().getPhase("oil").getWtFrac("propane") * 100.0); - * - * + * * logger.info("wt n-hexane from gas column " + * column.getGasOutStream().getFluid().getPhase("gas").getWtFrac("n-hexane") * 100.0); - * + * * logger.info("wt propane from gas column " + * column.getGasOutStream().getFluid().getPhase("gas").getWtFrac("propane") * 100.0); */ @@ -320,29 +318,27 @@ public void runDistillationProcessTest3() { /* * logger.info("wt n-hexane from column " + * column.getLiquidOutStream().getFluid().getPhase("oil").getWtFrac("n-hexane") * 100.0); - * + * * logger.info("wt ethane from column " + * column.getLiquidOutStream().getFluid().getPhase("oil").getWtFrac("ethane") * 100.0); - * - * + * * logger.info("wt n-hexane from gas column " + * column.getGasOutStream().getFluid().getPhase("gas").getWtFrac("n-hexane") * 100.0); - * + * * logger.info("wt ethane from gas column " + * column.getGasOutStream().getFluid().getPhase("gas").getWtFrac("ethane") * 100.0); - * + * * logger.info("flow rate gas " + * column.getGasOutStream().getFluid().getPhase("gas").getFlowRate("kg/hr") + " kg/hr"); - * + * * logger.info("flow rate oil " + * column.getLiquidOutStream().getFluid().getPhase("oil").getFlowRate("kg/hr") + " kg/hr"); - * + * * System.out .println("flow rate oil " + feedToRegenerator.getFluid().getFlowRate("kg/hr") + * " kg/hr"); - * + * * System.out .println("flow rate gas " + feedToRegenerator2.getFluid().getFlowRate("kg/hr") + * " kg/hr"); column.massBalanceCheck(); - * */ } } diff --git a/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java b/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java index 1cf8e7374b..4cef57cca4 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java @@ -175,7 +175,7 @@ public void runProcess2() throws InterruptedException { * heater_TP_setter_main_stream.setOutTemperature(77.92657470703125, "C"); * heater_TP_setter_main_stream.run(); * System.out.println(heater_TP_setter_main_stream.getOutStream().getFlowRate( "kg/hr")); - * + * * neqsim.thermo.system.SystemSrkCPAstatoil fluid_test_separator = new * neqsim.thermo.system.SystemSrkCPAstatoil(273.15 + 42.0, 10.00); * fluid_test_separator.addComponent("water", 0.15); @@ -215,32 +215,32 @@ public void runProcess2() throws InterruptedException { * 036010742188/1000,608 .036010742188/(1000*0.642772477456171)); * fluid_test_separator.setMixingRule(10); fluid_test_separator.setMultiPhaseCheck(true); * fluid_test_separator.init(0); - * + * * neqsim.processSimulation.processEquipment.stream.Stream inlet_stream_test_sep = new * neqsim.processSimulation.processEquipment.stream.Stream( * "TEST_SEPARATOR_INLET,fluid_test_separator", fluid_test_separator); * inlet_stream_test_sep.setTemperature(39.92721557617188, "C"); * inlet_stream_test_sep.setPressure(1.4343990154266357, "bara"); * inlet_stream_test_sep.setFlowRate(472.5621656362427, "kg/hr"); inlet_stream_test_sep.run(); - * + * * neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator test_separator = new * neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator( * inlet_stream_test_sep); test_separator.setName("TEST_SEPARATOR"); test_separator.run(); - * + * * neqsim.processSimulation.processEquipment.heatExchanger.Heater heater_TP_setter_test_stream = * new neqsim.processSimulation.processEquipment.heatExchanger.Heater( * "TP_SETTER_FOR_THE_DEGASSER_TEST_SEP_STREAM", test_separator.getWaterOutStream()); * heater_TP_setter_test_stream.setOutPressure(6.22176469039917, "bara"); * heater_TP_setter_test_stream.setOutTemperature(77.92657470703125, "C"); * heater_TP_setter_test_stream.run(); - * + * * neqsim.processSimulation.processEquipment.mixer.StaticMixer mixing_degasser = new * neqsim.processSimulation.processEquipment.mixer.StaticMixer(); * mixing_degasser.setName("MIXING_BEFORE_THE_DEGASSER"); * mixing_degasser.addStream(heater_TP_setter_main_stream.getOutStream()); * mixing_degasser.addStream(heater_TP_setter_test_stream.getOutStream()); * mixing_degasser.run(); - * + * * System.out.println(mixing_degasser.getOutStream().getFlowRate("kg/hr")); // Should be arount * 33946.08070091751 */ diff --git a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java index 2a483e700e..58fd9b2c76 100644 --- a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java +++ b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java @@ -128,11 +128,10 @@ public static void main(String[] args) { * Stream coolingWater = new Stream("cooling water", coolingWaterSYstm); * coolingWater.setFlowRate(500900.2, "kg/hr"); coolingWater.setTemperature(10.0, "C"); * coolingWater.setPressure(10.0, "bara"); - * + * * HeatExchanger heatEx = new HeatExchanger(lpcompressor.getOutStream()); * heatEx.setName("LP heat Exchanger"); heatEx.setGuessOutTemperature(273.15+40.0); * heatEx.setUAvalue(45000.0); heatEx.setFeedStream(1, coolingWater); - * */ Cooler lpHeatExchanger = @@ -281,28 +280,27 @@ public static void main(String[] args) { /* * // System.out.println("second stage comp power " + ((Compressor) // * operations.getUnit("2nd stage recompressor")).getPower()/1.0e3 + " kW"); - * + * * // System.out.println("first stage comp power " + ((Compressor) * operations.getUnit("1st stage recompressor")).getPower()/1.0e3 + " kW"); - * + * * System.out.println("gas from inlet separator " + ((Separator) * operations.getUnit("1st stage separator")) * .getGasOutStream().getFluid().getFlowRate("MSm3/day")); - * + * * System.out .println("pressure of export oil " + ((Stream) * operations.getUnit("stable oil")).getPressure("bara")); - * + * * System.out.println( "temperature of export oil " + ((Stream) * operations.getUnit("stable oil")).getTemperature("C")); - * + * * System.out.println("TVP of export oil (30.0 C) " + ((Stream) * operations.getUnit("stable oil")).TVP(30.0, "C")); - * + * * // System.out.println("entropy production " + // operations.getEntropyProduction("J/K") + * " J/K"); // System.out.println("mass balance separator " + ((Separator) * operations.getUnit("scrubber of mix gas HP")).getMassBalance("kg/sec") + " kg/sec"); - * - * + * * // liqFromlpscrubber.displayResult(); // richGas.phaseEnvelope(); // richGas.displayResult(); * operations.save("c:/temp/offshorePro.neqsim"); * inletSeparator.getLiquidOutStream().getFluid().display(); diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java index 957f8841dc..c5693ce806 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java @@ -316,7 +316,7 @@ public static void main(String[] args) { * System.out.println("wt lean TEG " + ((WaterStripperColumn) * operations.getUnit("TEG stripper")) * .getSolventOutStream().getFluid().getPhase("aqueous").getWtFrac("TEG") * 100.0); - * + * * double waterInWetGasppm = * waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 *ThermodynamicConstantsInterface.atm / @@ -337,22 +337,22 @@ public static void main(String[] args) { * System.out.println("flow rate from pump2 " + * hotLeanTEGPump2.getOutStream().getFluid().getFlowRate("kg/hr")); * System.out.println("makeup TEG " + makeupTEG.getFluid().getFlowRate("kg/hr")); - * + * * TEGFeed.getFluid().display(); absorber.run(); - * + * * System.out.println("pump power " + hotLeanTEGPump.getDuty()); * System.out.println("pump2 power " + hotLeanTEGPump2.getDuty()); * System.out.println("wt lean TEG after reboiler " + * column.getLiquidOutStream().getFluid().getPhase("aqueous").getWtFrac("TEG")); * System.out.println("temperature from pump " + * (hotLeanTEGPump2.getOutStream().getTemperature() - 273.15)); - * + * * System.out.println("flow rate from reboiler " + ((Reboiler) * column.getReboiler()).getLiquidOutStream().getFlowRate("kg/hr")); * System.out.println("flow rate from pump2 " + * hotLeanTEGPump2.getOutStream().getFluid().getFlowRate("kg/hr")); * System.out.println("flow rate to flare " + gasToFlare.getFluid().getFlowRate("kg/hr")); - * + * * System.out.println("condenser duty " + ((Condenser) ((DistillationColumn) * operations.getUnit("TEG regeneration column")).getCondenser()) .getDuty() / 1.0e3); * System.out.println( "richGLycolHeaterCondenser duty " + @@ -360,17 +360,16 @@ public static void main(String[] args) { * System.out.println("richGLycolHeaterCondenser temperature out " + * richGLycolHeaterCondenser.getOutStream().getTemperature("C")); * richGLycolHeaterCondenser.run(); - * + * * hotLeanTEGPump.getOutStream().displayResult(); flashLiquid.displayResult(); - * + * * System.out.println("Temperature rich TEG out of reflux condenser " + * richGLycolHeaterCondenser.getOutStream().getTemperature("C")); heatEx.displayResult(); * System.out.println("glycol out temperature " + * glycol_flash_valve2.getOutStream().getFluid().getTemperature("C")); * System.out.println("glycol out temperature2 " +heatEx2.getOutStream(0).getTemperature("C")); * System.out.println("glycol out temperature2 " +heatEx2.getOutStream(1).getTemperature("C")); - * - * + * * System.out.println("out water rate LP valve" + * glycol_flash_valve2.getOutStream().getFluid().getPhase(0).getComponent( * "water").getNumberOfmoles()); System.out.println("glycol out water rate reboil " + @@ -380,29 +379,26 @@ public static void main(String[] args) { * getNumberOfmoles()); System.out.println("recycle out water rate " * +recycleGasFromStripper.getOutletStream().getFluid().getComponent("water"). * getNumberOfmoles()); - * + * * System.out.println("water dew point of dry gas " + * waterDewPointAnalyser.getMeasuredValue("C")); - * - * + * * System.out.println("hydrocarbons in lean TEG " + (1.0- * stripper.getLiquidOutStream().getFluid().getPhase(0).getWtFrac("TEG")- * stripper.getLiquidOutStream().getFluid().getPhase(0).getWtFrac("water"))*1e6 + " mg/kg"); * System.out.println("hydrocarbons in rich TEG " + (1.0- * flashLiquid.getFluid().getPhase(0).getWtFrac("TEG")-flashLiquid.getFluid(). * getPhase(0).getWtFrac("water"))*1e6 + " mg/kg"); - * + * * //double dewT = ((WaterDewPointAnalyser)operations. * getMeasurementDevice("water dew point analyser")).getMeasuredValue("C"); * //waterDewPointAnalyser.setOnlineValue(measured, unit) * //waterDewPointAnalyser.setOnlineSignal(isOnlineSignal, plantName, transmitterame); - * - * - * + * * //Heat echanger test - * + * * //Sabe and Open copy of model - * + * * ProcessSystem locoperations = operations.copy(); * //((HeatExchanger)locoperations.getUnit("rich TEG heat exchanger 2")). * getInStream(0).setTemperature(298.15, "C"); @@ -417,8 +413,7 @@ public static void main(String[] args) { * eff = ((HeatExchanger)locoperations.getUnit("rich TEG heat exchanger 2")). * getThermalEffectiveness(); System.out.println("eff " + eff); //store fouling factor in * dataframe - * - * + * * dehydratedGas.getFluid().display(); */ diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java index 76c44ce6b6..a38b44c6c9 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java @@ -499,22 +499,22 @@ public static void main(String[] args) { * System.out.println("flow rate from pump2 " + * hotLeanTEGPump2.getOutStream().getFluid().getFlowRate("kg/hr")); * System.out.println("makeup TEG " + makeupTEG.getFluid().getFlowRate("kg/hr")); - * + * * TEGFeed.getFluid().display(); absorber.run(); - * + * * System.out.println("pump power " + hotLeanTEGPump.getDuty()); * System.out.println("pump2 power " + hotLeanTEGPump2.getDuty()); * System.out.println("wt lean TEG after reboiler " + * column.getLiquidOutStream().getFluid().getPhase("aqueous").getWtFrac("TEG")); * System.out.println("temperature from pump " + * (hotLeanTEGPump2.getOutStream().getTemperature() - 273.15)); - * + * * System.out.println("flow rate from reboiler " + ((Reboiler) * column.getReboiler()).getLiquidOutStream().getFlowRate("kg/hr")); * System.out.println("flow rate from pump2 " + * hotLeanTEGPump2.getOutStream().getFluid().getFlowRate("kg/hr")); * System.out.println("flow rate to flare " + gasToFlare.getFluid().getFlowRate("kg/hr")); - * + * * System.out.println("condenser duty " + ((Condenser) ((DistillationColumn) * operations.getUnit("TEG regeneration column")).getCondenser()) .getDuty() / 1.0e3); * System.out.println( "richGLycolHeaterCondenser duty " + @@ -522,17 +522,16 @@ public static void main(String[] args) { * System.out.println("richGLycolHeaterCondenser temperature out " + * richGLycolHeaterCondenser.getOutStream().getTemperature("C")); * richGLycolHeaterCondenser.run(); - * + * * hotLeanTEGPump.getOutStream().displayResult(); flashLiquid.displayResult(); - * + * * System.out.println("Temperature rich TEG out of reflux condenser " + * richGLycolHeaterCondenser.getOutStream().getTemperature("C")); heatEx.displayResult(); * System.out.println("glycol out temperature " + * glycol_flash_valve2.getOutStream().getFluid().getTemperature("C")); * System.out.println("glycol out temperature2 " +heatEx2.getOutStream(0).getTemperature("C")); * System.out.println("glycol out temperature2 " +heatEx2.getOutStream(1).getTemperature("C")); - * - * + * * System.out.println("out water rate LP valve" + * glycol_flash_valve2.getOutStream().getFluid().getPhase(0).getComponent("water"). * getNumberOfmoles()); System.out.println("glycol out water rate reboil " + ((Reboiler) @@ -542,19 +541,17 @@ public static void main(String[] args) { * getNumberOfmoles()); System.out.println("recycle out water rate " * +recycleGasFromStripper.getOutletStream().getFluid().getComponent("water"). * getNumberOfmoles()); - * + * * System.out.println("water dew point of dry gas " + * waterDewPointAnalyser.getMeasuredValue("C")); - * + * * //double dewT = * ((WaterDewPointAnalyser)operations.getMeasurementDevice("water dew point analyser")). * getMeasuredValue("C"); //waterDewPointAnalyser.setOnlineValue(measured, unit) * //waterDewPointAnalyser.setOnlineSignal(isOnlineSignal, plantName, transmitterame); - * - * - * + * * //Heat exchanger test - * + * * //Sabe and Open copy of model */ // ProcessSystem locoperations = operations.copy(); diff --git a/src/test/java/neqsim/processSimulation/util/example/TestNeqsim.java b/src/test/java/neqsim/processSimulation/util/example/TestNeqsim.java index 689464d53c..76dbeb30fe 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TestNeqsim.java +++ b/src/test/java/neqsim/processSimulation/util/example/TestNeqsim.java @@ -118,12 +118,12 @@ public static void main(String[] args) { /* * temperature[i] = compressor1.getOutStream().getTemperature(); work [i] = * compressor1.getTotalWork(); - * + * * Cp_Vapour [i] = compressor1.getOutStream().getThermoSystem().getPhase(0).getCp(); Cp_liquid * [i] = compressor1.getOutStream().getThermoSystem().getPhase(1).getCp(); Cp [i] = * compressor1.getOutStream().getThermoSystem().getPhase(0).getBeta() * Cp_Vapour [i] + * compressor1.getOutStream().getThermoSystem().getPhase(1).getBeta()* Cp_liquid [i]; - * + * * Density_Vapour [i] = compressor1.getOutStream().getThermoSystem().getPhase(0).getDensity(); * Density_liquid [i] = compressor1.getOutStream().getThermoSystem().getPhase(1).getDensity(); * Density [i] = compressor1.getOutStream().getThermoSystem().getWtFraction(0) * Density_Vapour @@ -140,21 +140,14 @@ public static void main(String[] args) { } // catch(Exception ex){ /* - * System.out.println( "P_out" ); for (int i=0;i<10;i++ ) { System.out.println(20 + 5*i); - * - * } - * + * System.out.println( "P_out" ); for (int i=0;i<10;i++ ) { System.out.println(20 + 5*i); } + * * System.out.println( "Temperature" ); for (int i=0;i<10;i++ ) { System.out.println( - * temperature[i] ); - * - * } - * - * System.out.println( "Work" ); for (int i=0;i<10;i++ ) { System.out.println( work [i] ); - * - * } System.out.println( "Cp" ); for (int i=0;i<10;i++ ) { System.out.println( Cp [i] ); - * - * } - * + * temperature[i] ); } + * + * System.out.println( "Work" ); for (int i=0;i<10;i++ ) { System.out.println( work [i] ); } + * System.out.println( "Cp" ); for (int i=0;i<10;i++ ) { System.out.println( Cp [i] ); } + * * System.out.println( "Density" ); for (int i=0;i<10;i++ ) { System.out.println( Density [i] ); */ } diff --git a/src/test/java/neqsim/processSimulation/util/example/TestTransientFlow.java b/src/test/java/neqsim/processSimulation/util/example/TestTransientFlow.java index d6ef3fd9e7..c047e2ec8d 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TestTransientFlow.java +++ b/src/test/java/neqsim/processSimulation/util/example/TestTransientFlow.java @@ -122,11 +122,11 @@ public static void main(String args[]) { * // transient behaviour operations.setTimeStep(1.1); for(int i=0;i<50;i++){ * operations.runTransient(); System.out.println("liquid level " + separator_1.getLiquidLevel()+ * " PRESSURE " + separator_1.getGasOutStream().getPressure()); } - * + * * operations.setTimeStep(30.0); for(int i=0;i<2000;i++){ operations.runTransient(); * System.out.println("liquid level " + separator_1.getLiquidLevel()+ " PRESSURE " + * separator_1.getGasOutStream().getPressure()); } operations.displayResult(); - * + * * operations.displayResult(); */ } diff --git a/src/test/java/neqsim/processSimulation/util/example/destillation1.java b/src/test/java/neqsim/processSimulation/util/example/destillation1.java index ae1770fa08..6edfddf53e 100644 --- a/src/test/java/neqsim/processSimulation/util/example/destillation1.java +++ b/src/test/java/neqsim/processSimulation/util/example/destillation1.java @@ -7,64 +7,66 @@ import neqsim.thermodynamicOperations.ThermodynamicOperations; /** - *destillation1 class.
+ *+ * destillation1 class. + *
* * @author asmund * @version $Id: $Id * @since 2.2.3 */ public class destillation1 { - /** - * This method is just meant to test the thermo package. - * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String args[]) { - neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 63.0), 16.00); - // testSystem.addComponent("methane", 1.00); - testSystem.addComponent("ethane", 0.002); - // testSystem.addComponent("CO2", 10.00); - testSystem.addComponent("propane", 0.605900); - testSystem.addComponent("i-butane", 0.1473); - testSystem.addComponent("n-butane", 0.2414); - testSystem.addComponent("i-pentane", 0.00322); - testSystem.addComponent("n-pentane", 0.0002); - testSystem.addComponent("methanol", 0.00005); - // testSystem.addComponent("n-heptane", 100.0); - testSystem.createDatabase(true); - testSystem.setMixingRule(2); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - testOps.TPflash(); - testSystem.display(); + /** + * This method is just meant to test the thermo package. + * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String args[]) { + neqsim.thermo.system.SystemInterface testSystem = + new neqsim.thermo.system.SystemSrkEos((273.15 + 63.0), 16.00); + // testSystem.addComponent("methane", 1.00); + testSystem.addComponent("ethane", 0.002); + // testSystem.addComponent("CO2", 10.00); + testSystem.addComponent("propane", 0.605900); + testSystem.addComponent("i-butane", 0.1473); + testSystem.addComponent("n-butane", 0.2414); + testSystem.addComponent("i-pentane", 0.00322); + testSystem.addComponent("n-pentane", 0.0002); + testSystem.addComponent("methanol", 0.00005); + // testSystem.addComponent("n-heptane", 100.0); + testSystem.createDatabase(true); + testSystem.setMixingRule(2); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testOps.TPflash(); + testSystem.display(); - Stream stream_1 = new Stream("Stream1", testSystem); + Stream stream_1 = new Stream("Stream1", testSystem); - DistillationColumn column = new DistillationColumn(9, true, true); - column.addFeedStream(stream_1, 4); - ((Reboiler) column.getReboiler()).setRefluxRatio(3.7); - ((Condenser) column.getCondenser()).setRefluxRatio(10.7); - // column.setReboilerTemperature(360); - // column.setReboilerTemperature(300); - /* - * Heater heater = new Heater((Stream) column.getGasOutStream()); heater.setdT(-15.0); - * - * DistillationColumn column2 = new DistillationColumn(4, true, true); - * column2.addFeedStream(heater.getOutStream(), 2); ((Reboiler) - * column2.getReboiler()).setRefluxRatio(0.01); ((Condenser) - * column2.getCondenser()).setRefluxRatio(0.01); - */ + DistillationColumn column = new DistillationColumn(9, true, true); + column.addFeedStream(stream_1, 4); + ((Reboiler) column.getReboiler()).setRefluxRatio(3.7); + ((Condenser) column.getCondenser()).setRefluxRatio(10.7); + // column.setReboilerTemperature(360); + // column.setReboilerTemperature(300); + /* + * Heater heater = new Heater((Stream) column.getGasOutStream()); heater.setdT(-15.0); + * + * DistillationColumn column2 = new DistillationColumn(4, true, true); + * column2.addFeedStream(heater.getOutStream(), 2); ((Reboiler) + * column2.getReboiler()).setRefluxRatio(0.01); ((Condenser) + * column2.getCondenser()).setRefluxRatio(0.01); + */ - neqsim.processSimulation.processSystem.ProcessSystem operations = - new neqsim.processSimulation.processSystem.ProcessSystem(); - operations.add(stream_1); - operations.add(column); - // operations.add(heater); - // operations.add(column2); + neqsim.processSimulation.processSystem.ProcessSystem operations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + operations.add(stream_1); + operations.add(column); + // operations.add(heater); + // operations.add(column2); - operations.run(); - // column.getReboiler().displayResult(); - // column.getCondenser().displayResult(); - // operations.displayResult(); - } + operations.run(); + // column.getReboiler().displayResult(); + // column.getCondenser().displayResult(); + // operations.displayResult(); + } } diff --git a/src/test/java/neqsim/processSimulation/util/example/shtokman.java b/src/test/java/neqsim/processSimulation/util/example/shtokman.java index 746751e2d9..4a6e1e0ad1 100644 --- a/src/test/java/neqsim/processSimulation/util/example/shtokman.java +++ b/src/test/java/neqsim/processSimulation/util/example/shtokman.java @@ -63,7 +63,7 @@ public static void main(String args[]) { // ThermodynamicOperations ops = new ThermodynamicOperations(stream_2.getThermoSystem()); /* * try { // ops.TPflash(); - * + * * ops.waterPrecipitationTemperature(); stream_2.getThermoSystem().display(); * stream_2.getThermoSystem().init(0); ops.hydrateFormationTemperature(2); * stream_2.getThermoSystem().display(); // stream_2.getThermoSystem().display(); // @@ -73,7 +73,7 @@ public static void main(String args[]) { * getThermoSystem().getPhase(1).getComponent("MEG").getMolarMass(); double wtwater = * stream_2.getThermoSystem().getPhase(1).getComponent("water").getx()*stream_2. * getThermoSystem().getPhase(1).getComponent("water").getMolarMass(); - * + * * System.out.println("wt% MEG " + wtMEG/(wtMEG+wtwater)*100); // operations.displayResult(); */ } diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java index f0340b8529..076cb9ae3a 100644 --- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java +++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java @@ -11,7 +11,6 @@ /** * @author ESOL - * */ class Standard_ISO6976Test extends neqsim.NeqSimTest { static SystemInterface testSystem = null; @@ -112,16 +111,13 @@ void testCalculate2() { * testSystem.addComponent("22-dim-C3", 0.001015); testSystem.addComponent("n-hexane", * 0.002865); testSystem.addComponent("nitrogen", 0.01023); testSystem.addComponent("CO2", * 0.015236); - * */ /* - * * testSystem.addComponent("methane", 0.9247); testSystem.addComponent("ethane", 0.035); * testSystem.addComponent("propane", 0.0098); testSystem.addComponent("n-butane", 0.0022); * testSystem.addComponent("i-butane", 0.0034); testSystem.addComponent("n-pentane", 0.0006); * testSystem.addComponent("nitrogen", 0.0175); testSystem.addComponent("CO2", 0.0068); - * */ // testSystem.addComponent("water", 0.016837); @@ -130,7 +126,7 @@ void testCalculate2() { * testSystem.addComponent("n-hexane", 0.0); testSystem.addComponent("n-heptane", 0.0); * testSystem.addComponent("n-octane", 0.0); testSystem.addComponent("n-nonane", 0.0); * testSystem.addComponent("nC10", 0.0); - * + * * testSystem.addComponent("CO2", 0.68); testSystem.addComponent("H2S", 0.0); * testSystem.addComponent("water", 0.0); testSystem.addComponent("oxygen", 0.0); * testSystem.addComponent("carbonmonoxide", 0.0); testSystem.addComponent("nitrogen", 1.75); @@ -161,7 +157,7 @@ void testCalculate2() { * StandardInterface standardUK = new UKspecifications_ICF_SI(testSystem); * standardUK.calculate(); logger.info("ICF " + * standardUK.getValue("IncompleteCombustionFactor", "")); - * + * * logger.info("HID " + testSystem.getPhase(0).getComponent("methane").getHID(273.15 - 150.0)); * logger.info("Hres " + testSystem.getPhase(0).getComponent("methane").getHresTP(273.15 - * 150.0)); diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java index 86e9b06e1a..645ff2638e 100644 --- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java +++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java @@ -11,7 +11,6 @@ /** * @author ESOL - * */ class Standard_ISO6976_2016_Test extends neqsim.NeqSimTest { static SystemInterface testSystem = null; @@ -126,7 +125,7 @@ void testCalculate2() { * StandardInterface standardUK = new UKspecifications_ICF_SI(testSystem); * standardUK.calculate(); logger.info("ICF " + * standardUK.getValue("IncompleteCombustionFactor", "")); - * + * * logger.info("HID " + testSystem.getPhase(0).getComponent("methane").getHID(273.15 - 150.0)); * logger.info("Hres " + testSystem.getPhase(0).getComponent("methane").getHresTP(273.15 - * 150.0)); diff --git a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java index 9328d9db83..5b4cec7959 100644 --- a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java +++ b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java @@ -9,7 +9,6 @@ /** * @author ESOL - * */ class BaseContractTest extends neqsim.NeqSimTest { static SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/thermo/component/ComponentHydrateGFTest.java b/src/test/java/neqsim/thermo/component/ComponentHydrateGFTest.java index 1e0e256f34..97c69fefdb 100644 --- a/src/test/java/neqsim/thermo/component/ComponentHydrateGFTest.java +++ b/src/test/java/neqsim/thermo/component/ComponentHydrateGFTest.java @@ -12,7 +12,6 @@ /** * @author ESOL - * */ class ComponentHydrateGFTest extends neqsim.NeqSimTest { static Logger logger = LogManager.getLogger(ComponentHydrateGFTest.class); diff --git a/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java b/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java index 87122f1eb6..fd0d106f26 100644 --- a/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java +++ b/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java @@ -204,7 +204,7 @@ public void checkFugacityCoefficientsDn2() { ** checkPhaseEnvelope. *
- * + * * @throws Exception */ // @Test diff --git a/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java b/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java index d545100170..14af4075e1 100644 --- a/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java +++ b/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java @@ -189,7 +189,7 @@ public void checkFugacityCoefficientsDn2() { ** checkPhaseEnvelope. *
- * + * * @throws Exception */ @Test @@ -220,7 +220,7 @@ public void checkPhaseEnvelope() throws Exception { ** checkPhaseEnvelope2. *
- * + * * @throws Exception */ @Test diff --git a/src/test/java/neqsim/thermo/util/example/BubbleFlashCPA.java b/src/test/java/neqsim/thermo/util/example/BubbleFlashCPA.java index d0f6c99655..33f06f01ef 100644 --- a/src/test/java/neqsim/thermo/util/example/BubbleFlashCPA.java +++ b/src/test/java/neqsim/thermo/util/example/BubbleFlashCPA.java @@ -47,13 +47,13 @@ public static void main(String args[]) { testSystem.addComponent("TEG", 100.0); /* * testSystem.addComponent("methane", 69.243); - * + * * testSystem.addComponent("CO2", 4.113); testSystem.addComponent("ethane", 8.732); * testSystem.addComponent("propane", 4.27); testSystem.addComponent("n-pentane", 1.641); * testSystem.addComponent("i-pentane", 0.877); - * + * * testSystem.addComponent("benzene", 1.27); - * + * * testSystem.addTBPfraction("C6", 1.49985, 86.178 / 1000.0, 0.664); * testSystem.addTBPfraction("C7", 1.359864, 96.0 / 1000.0, 0.738); * testSystem.addTBPfraction("C8", 0.939906, 107.0 / 1000.0, 0.765); diff --git a/src/test/java/neqsim/thermo/util/example/DewPointCurve.java b/src/test/java/neqsim/thermo/util/example/DewPointCurve.java index d131330c59..81d6eb1416 100644 --- a/src/test/java/neqsim/thermo/util/example/DewPointCurve.java +++ b/src/test/java/neqsim/thermo/util/example/DewPointCurve.java @@ -92,7 +92,6 @@ public static void main(String args[]) { * testSystem.getPhase(1).getActivityCoefficientSymetric(i)); } * System.out.println("activity coeff " + testSystem.getPhase(1).getComponent(1).getName() + " " * + testSystem.getPhase(1).getActivityCoefficient(1, 0)); - * */ } } diff --git a/src/test/java/neqsim/thermo/util/example/HydrateFlash.java b/src/test/java/neqsim/thermo/util/example/HydrateFlash.java index 29579bbd76..a7c4d5639b 100644 --- a/src/test/java/neqsim/thermo/util/example/HydrateFlash.java +++ b/src/test/java/neqsim/thermo/util/example/HydrateFlash.java @@ -167,10 +167,8 @@ public static void main(String args[]) { * * testSystem2.setMixingRule(7); testSystem2.init(0); testSystem2.init(1); * ThermodynamicOperations testOps2 = new ThermodynamicOperations(testSystem2); try { - * testOps2.waterDewPointTemperatureFlash(); - * - * } catch (Exception ex) { logger.error(ex.getMessage()) } testSystem2.display(); - * + * testOps2.waterDewPointTemperatureFlash(); } catch (Exception ex) { + * logger.error(ex.getMessage()) } testSystem2.display(); */ } } diff --git a/src/test/java/neqsim/thermo/util/example/LNGFlash.java b/src/test/java/neqsim/thermo/util/example/LNGFlash.java index 9c6afda1b4..ea57a444f5 100644 --- a/src/test/java/neqsim/thermo/util/example/LNGFlash.java +++ b/src/test/java/neqsim/thermo/util/example/LNGFlash.java @@ -66,8 +66,6 @@ public static void main(String args[]) { * ThermodynamicOperations(testSystem); try { testOps.TPflash(); // testSystem.display(); // * testOps.freezingPointTemperatureFlash(); // testOps.calcWAT(); testSystem.display(); } catch * (Exception ex) { logger.error(ex.getMessage(),e); } } - * - * */ } } diff --git a/src/test/java/neqsim/thermo/util/example/PS_PH_flash.java b/src/test/java/neqsim/thermo/util/example/PS_PH_flash.java index 0e1c685257..c31fd705d7 100644 --- a/src/test/java/neqsim/thermo/util/example/PS_PH_flash.java +++ b/src/test/java/neqsim/thermo/util/example/PS_PH_flash.java @@ -74,11 +74,10 @@ public static void main(String args[]) { double entropy = testSystem.getEntropy(); /* * testSystem.setTemperature(273.15 + 0.0); testSystem.setPressure(100.0); try { - * testOps.TPflash(); // testOps.bubblePointTemperatureFlash(); } catch (Exception ex) { - * - * } testSystem.init(2); testSystem.setPressure(100.0); // System.out.println("entropy spec" + + * testOps.TPflash(); // testOps.bubblePointTemperatureFlash(); } catch (Exception ex) { } + * testSystem.init(2); testSystem.setPressure(100.0); // System.out.println("entropy spec" + * entropy); - * + * * // testSystem.setPressure(20.894745); */ testSystem.setPressure(10.0); diff --git a/src/test/java/neqsim/thermo/util/example/PhaseEnvelope.java b/src/test/java/neqsim/thermo/util/example/PhaseEnvelope.java index b724bdb320..fb958e0187 100644 --- a/src/test/java/neqsim/thermo/util/example/PhaseEnvelope.java +++ b/src/test/java/neqsim/thermo/util/example/PhaseEnvelope.java @@ -109,10 +109,10 @@ public static void main(String args[]) { * testOps.setRunAsThread(true); testOps.waterDewPointLine(10, 200); boolean isFinished = * testOps.waitAndCheckForFinishedCalculation(50000); double[][] waterData = * testOps.getData(); - * + * * testOps.hydrateEquilibriumLine(10, 200); isFinished = * testOps.waitAndCheckForFinishedCalculation(50000); double[][] hydData = testOps.getData(); - * + * * testSystem.addComponent("water", * -testSystem.getPhase(0).getComponent("water").getNumberOfmoles()); */ diff --git a/src/test/java/neqsim/thermo/util/example/ReadFluidData2.java b/src/test/java/neqsim/thermo/util/example/ReadFluidData2.java index 6d9024070d..64cfb4d9dc 100644 --- a/src/test/java/neqsim/thermo/util/example/ReadFluidData2.java +++ b/src/test/java/neqsim/thermo/util/example/ReadFluidData2.java @@ -53,7 +53,7 @@ public static void main(String args[]) { * // // ""); // testSystem.addComponent("water", 1.0); testSystem.setMixingRule(2); // * testSystem.setMultiPhaseCheck(true); //testSystem.setMultiPhaseCheck(false); * ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - * + * * try { testOps.TPflash(); testSystem.display(); testOps.PSflash(-123.108602625942); * testSystem.display(); testSystem.setPressure(100.0); testOps.PSflash(-119.003271056256); * testSystem.display(); System.out.println("entropy " + testSystem.getEntropy()); diff --git a/src/test/java/neqsim/thermo/util/example/TPflash.java b/src/test/java/neqsim/thermo/util/example/TPflash.java index 93a5159a9a..ae044a6929 100644 --- a/src/test/java/neqsim/thermo/util/example/TPflash.java +++ b/src/test/java/neqsim/thermo/util/example/TPflash.java @@ -48,7 +48,7 @@ public static void main(String[] args) { * testSystem.addTBPfraction("C10", 1.0, 225.5046 / 1000.0, 841.1014 / 1000.0); * testSystem.setMolarComposition(new double[] { 0.829, 0, 0.0007, 0.002, 0.0707, 0.0072, * 0.0051, 0.0019, 0.0062, 0.0048, 0.006, 0.0074, 0.0109, 0.0109, 0.0062, 0.031 }); - * + * * testSystem.setHeavyTBPfractionAsPlusFraction(); * testSystem.getCharacterization().characterisePlusFraction(); */ diff --git a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java index 01447b327f..ed8f2e83a3 100644 --- a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java +++ b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java @@ -75,30 +75,30 @@ public static void main(String[] args) { // testSystem.init(1); /* * testSystem.init(2); - * + * * // testSystem.init(1); // testSystem.init(2); // testSystem.init(3); // * System.out.println("heat cap " + (testSystem.getPhase(1).getCp())); // * testOps.calcPTphaseEnvelope(); testSystem.display(); // testSystem.getPhase(0).getCp(); } * catch (Exception ex) { System.out.println(ex.toString()); } - * + * * /* System.out.println("gas density " + (testSystem.getPhase(0).getDensity())); * System.out.println("gas density " + (1.0 / (testSystem.getPhase(0).getDensity() / * testSystem.getPhase(0).getMolarMass()))); - * + * * System.out.println("liq density " + (testSystem.getPhase(1).getDensity())); * System.out.println("liq density " + (1.0 / (testSystem.getPhase(1).getDensity() / * testSystem.getPhase(1).getMolarMass()))); - * + * * testSystem.initPhysicalProperties(); testSystem.init(1); - * + * * System.out.println("start....."); testSystem.setEmptyFluid(); * testSystem.setMolarComposition(new double[]{1.0, 1e-20, 1e-20}); testSystem.init(0, 0); * testSystem.init(1); testSystem.display(); - * + * * System.out.println("end....."); testSystem.setMolarComposition(new double[]{0.000001, * 0.00001, 1e-20}); // testSystem.init(1); testSystem.init(0, 0); testSystem.init(1); // * testSystem.display(); - * + * * /* testSystem.initPhysicalProperties(); double rho1 = * testSystem.getPhase(0).getPhysicalProperties().getDensity(); System.out.println("drhodP " + * testSystem.getPhase(0).getdrhodP()); System.out.println("drhodT " + @@ -106,10 +106,10 @@ public static void main(String[] args) { * testSystem.setPressure(testSystem.getPressure() + 0.001); testSystem.init(1); // * testSystem.display(); // testSystem.initPhysicalProperties(); double rho2 = * testSystem.getPhase(0).getPhysicalProperties().getDensity(); - * + * * //System.out.println("drhodPnum " + (rho2 - rho1) / 0.01); System.out.println("drhodTnum " + * (rho2 - rho1) / 0.001); - * + * * testSystem.saveFluid(2327); testSystem.saveFluid(2301); // testSystem.setNumberOfPhases(1); * // testSystem.setTemperature(299.0); // testSystem.init(1); // * testSystem.getPhase(0).getEntropy(); // System.out.println("enthalpy " + @@ -119,8 +119,7 @@ public static void main(String[] args) { * testSystem.getPhase(0).getCp()); System.out.println("enthalpy " + * testSystem.getPhase(0).getEnthalpy()); System.out.println("entropy " + * testSystem.getPhase(0).getEntropy()); - * - * + * * testSystem.init(2); System.out.println("Cp " + testSystem.getPhase(0).getCp()); * System.out.println("enthalpy " + testSystem.getPhase(0).getEnthalpy()); * System.out.println("entropy " + testSystem.getPhase(0).getEntropy()); testSystem.init(3); @@ -132,7 +131,7 @@ public static void main(String[] args) { * ThermodynamicOperations(testSystem); try { // testOps.freezingPointTemperatureFlash(); * testOps.TPflash(); // testOps.calcPTphaseEnvelope(); // testOps.display(); // * testSystem.display(); } catch (Exception ex) { System.out.println(ex.toString()); } - * + * * /* double h1 = testSystem.getPhase(0).getEntropy(); System.out.println("H " + * testSystem.getPhase(0).getEntropy()); System.out.println("H dP " + * testSystem.getPhase(0).getEntropydT()); testSystem.setTemperature(testSystem.getTemperature() @@ -147,7 +146,7 @@ public static void main(String[] args) { * (testSystem.getPhase(1).getComponent("methane").getx() / * testSystem.getPhase(0).getComponent("methane").getx()); * System.out.println("selectivity CO2/methane " + seletivity); - * + * * double seletivity2 = testSystem.getPhase(1).getComponent("CO2").getx() / * testSystem.getPhase(0).getComponent("CO2").getx() / * (testSystem.getPhase(1).getComponent("ethane").getx() / @@ -162,24 +161,23 @@ public static void main(String[] args) { * testSystem.getPhase(2).getWtFraction(testSystem) + * testSystem.getPhase(1).getWtFraction(testSystem) + * testSystem.getPhase(0).getWtFraction(testSystem)); - * + * * double a = testSystem.getPhase(0).getBeta() * testSystem.getPhase(0).getMolarMass() / * testSystem.getMolarMass(); double seletivity = * testSystem.getPhase(1).getComponent("CO2").getx() / * testSystem.getPhase(0).getComponent("CO2").getx() / * (testSystem.getPhase(1).getComponent("methane").getx() / * testSystem.getPhase(0).getComponent("methane").getx()); - * - * + * * double solubility = testSystem.getPhase(1).getComponent("CO2").getx() * * ThermodynamicConstantsInterface.R * 298.15 /ThermodynamicConstantsInterface.atm / * (testSystem.getPhase(1).getMolarMass()) * 1000; - * + * * System.out.println("selectivity " + seletivity); System.out.println("CO2 solubility " + * solubility); System.out.println("Z " + testSystem.getPhase(0).getZ()); // * testSystem.getPhase(0).getComponentWithIndex(1); // testSystem.saveObject(300); // * System.out.println("ethanol activity " + testSystem.getPhase(0).getActivityCoefficient(0)); - * + * * //testSystem. // System.out.println("water activity " + * testSystem.getPhase(1).getActivityCoefficient(1)); // System.out.println("TEG activity " + * testSystem.getPhase(1).getActivityCoefficient(0)); // testSystem.display(); diff --git a/src/test/java/neqsim/thermo/util/example/TPflashMethanolWaterPropane.java b/src/test/java/neqsim/thermo/util/example/TPflashMethanolWaterPropane.java index fd83bee68d..04da438fc9 100644 --- a/src/test/java/neqsim/thermo/util/example/TPflashMethanolWaterPropane.java +++ b/src/test/java/neqsim/thermo/util/example/TPflashMethanolWaterPropane.java @@ -32,7 +32,7 @@ public static void main(String args[]) { /* * testSystem.addComponent("methane", 150.0e-2); testSystem.addComponent("propane", 150.0e-3); * testSystem.addComponent("methanol", 0.5); testSystem.addComponent("water", 0.5); - * + * * testSystem.createDatabase(true); testSystem.setMixingRule(10); * testSystem.setMultiPhaseCheck(true); */ diff --git a/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate.java b/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate.java index b3adc4d207..654c1104f8 100644 --- a/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate.java +++ b/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate.java @@ -112,7 +112,7 @@ public static void main(String args[]) { /* * System.out.println("molar mass " * +testSystem.getPhase(0).getComponent("PC4_PC").getMolarMass() ); - * + * * testSystem.setMolarCompositionOfPlusFluid(new double[]{0.02, 0.005, 0.4, 0.01, 0.01, 0.02, * 0.02, 0.01 ,0.01, 0.01, 0.01 ,0.01, 0.01, 0.2 }); try { testOps.TPflash(); // * testOps.hydrateFormationTemperature(); // testOps.dewPointTemperatureFlash(); } catch diff --git a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java index f81e9baf61..68c145c7d6 100644 --- a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java +++ b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java @@ -8,7 +8,6 @@ /** * @author ESOL - * */ class EclipseFluidReadWriteTest extends neqsim.NeqSimTest { static neqsim.thermo.system.SystemInterface testSystem = null; @@ -28,7 +27,7 @@ static void setUpBeforeClass() throws Exception {} /** * Test method for * {@link neqsim.thermo.util.readwrite.EclipseFluidReadWrite#read(java.lang.String)}. - * + * * @throws IOException */ @Test diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java index a2d7521321..566a6d4e83 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java @@ -9,7 +9,6 @@ /** * @author ESOL - * */ class Degasser { static neqsim.thermo.system.SystemInterface testSystem = null; @@ -181,7 +180,7 @@ void testRun2() { * "/workspaces/neqsim/src/test/java/neqsim/thermodynamicOperations/flashOps/my_process.xml"); * String xmlContents = ""; try { //xmlContents = Files.readString(filePath); } catch * (IOException e) { e.printStackTrace(); } - * + * * // Deserialize from xml neqsim.processSimulation.processSystem.ProcessSystem operationsCopy = * (neqsim.processSimulation.processSystem.ProcessSystem) xstream.fromXML(xmlContents); * operationsCopy.run(); neqsim.processSimulation.processEquipment.separator.Separator diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashGERG2008Test.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashGERG2008Test.java index ee0a6020ad..731e7d5f63 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashGERG2008Test.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashGERG2008Test.java @@ -7,7 +7,6 @@ /** * @author ESOL - * */ class PHFlashGERG2008Test { static neqsim.thermo.system.SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashTest.java index 406dc3ddef..f2239b838a 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/PHFlashTest.java @@ -7,7 +7,6 @@ /** * @author ESOL - * */ class PHFlashTest { static neqsim.thermo.system.SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/PSFlashGERG2008Test.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/PSFlashGERG2008Test.java index 88f027f499..d7345039c1 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/PSFlashGERG2008Test.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/PSFlashGERG2008Test.java @@ -7,7 +7,6 @@ /** * @author ESOL - * */ class PSFlashGERG2008Test { static neqsim.thermo.system.SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java index 83590e1678..a700beed41 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java @@ -7,7 +7,6 @@ /** * @author ESOL - * */ class TPFlashTest { static neqsim.thermo.system.SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestHighTemp.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestHighTemp.java index bf81197f26..4dac61a32a 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestHighTemp.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestHighTemp.java @@ -7,7 +7,6 @@ /** * @author ESOL - * */ class TPFlashTestHighTemp { static neqsim.thermo.system.SystemInterface testSystem = null; diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java index d95732acf9..1ba453a913 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java @@ -7,7 +7,6 @@ /** * @author ESOL - * */ class TPFlashTestWellFluid { static neqsim.thermo.system.SystemInterface wellFluid = null; diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java index 98d7283308..a59583debd 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java @@ -11,7 +11,6 @@ /** * @author ESOL - * */ class WaxFlashTest { static Logger logger = LogManager.getLogger(WaxFlashTest.class); diff --git a/src/test/java/neqsim/thermodynamicOperations/util/example/PhaseEnvelope.java b/src/test/java/neqsim/thermodynamicOperations/util/example/PhaseEnvelope.java index e5e15d1140..5cc91bae76 100644 --- a/src/test/java/neqsim/thermodynamicOperations/util/example/PhaseEnvelope.java +++ b/src/test/java/neqsim/thermodynamicOperations/util/example/PhaseEnvelope.java @@ -9,11 +9,11 @@ /* *PhaseEnvelope class. Created on 27. september 2001, 10:21 Updated on May 2019 by Nefeli
- * + * * @author esol - * + * * @version $Id: $Id - * + * * @since 2.2.3 */ public class PhaseEnvelope { From 7d30d6fbf71ed5a626d83f3c494b238eb894c334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:59:26 +0100 Subject: [PATCH 146/317] fix: javadoc typo (#956) --- src/main/java/neqsim/thermo/ThermodynamicModelTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java index 668ef92a07..44b43a1e83 100644 --- a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java +++ b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java @@ -422,7 +422,7 @@ public boolean checkNumerically() { } /** - * Setter for property maxError. + * Setter for propertymaxError
.
*
* @param maxErr before test will report failed Set maximum allowed error in model check
*/
From 2f3e165dcf5a32fc88af652b18fa0e5bdb43a8d4 Mon Sep 17 00:00:00 2001
From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com>
Date: Mon, 18 Mar 2024 10:05:11 +0100
Subject: [PATCH 147/317] release 2.5.19 (#958)
---
pom.xml | 2 +-
pomJava21.xml | 2 +-
pomJava8.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7c2ff9372d..9d44f05f92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
inletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inStream = inletStream;
try {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java
index 621dc21c1a..150d712f46 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java
@@ -829,6 +829,7 @@ public double getOGIP(String unit) {
*
* @return a double
*/
+ @Override
public double getTime() {
return time;
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubberSimple.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubberSimple.java
index efd0ff4b2e..a22e965d8a 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubberSimple.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/GasScrubberSimple.java
@@ -97,6 +97,7 @@ public GasScrubberMechanicalDesign getMechanicalDesign() {
* Setter for the field inletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inletStream = inletStream;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/NeqGasScrubber.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/NeqGasScrubber.java
index 75b8e212f8..5380e79c17 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/separator/NeqGasScrubber.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/NeqGasScrubber.java
@@ -98,6 +98,7 @@ public GasScrubberMechanicalDesign getMechanicalDesign() {
* Setter for the field inletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inletStream = inletStream;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java
index 7dac7af75b..5ff92fd37d 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java
@@ -314,7 +314,6 @@ public void runTransient(double dt, UUID id) {
run(id);
increaseTime(dt);
setCalculationIdentifier(id);
- return;
} else {
inletStreamMixer.run(id);
thermoSystem.init(3);
@@ -380,7 +379,6 @@ public void runTransient(double dt, UUID id) {
* getInternalDiameter() * getSeparatorLength();
// System.out.println("gas volume " + gasVolume + " liq volime " + liquidVolume);
setCalculationIdentifier(id);
- return;
}
}
@@ -479,6 +477,7 @@ public void setGasCarryunderFraction(double gasCarryunderFraction) {
*
*
**/
+ @Override
public void setLiquidLevel(double liquidlev) {
liquidLevel = liquidlev;
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
index 765833c95c..1e22ac0478 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
@@ -248,9 +248,7 @@ public void runTransient(double dt, UUID id) {
if (getCalculateSteadyState()) {
run(id);
increaseTime(dt);
- return;
} else {
-
Mixer mixer = new Mixer();
for (int i = 0; i < splitStream.length; i++) {
splitStream[i].setPressure(inletStream.getPressure());
@@ -263,7 +261,6 @@ public void runTransient(double dt, UUID id) {
inletStream.setThermoSystem(mixer.getThermoSystem());
inletStream.run();
setCalculationIdentifier(id);
- return;
}
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java
index d8877c3096..9ac23af967 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java
@@ -190,7 +190,7 @@ public Stream clone() {
ex.printStackTrace();
}
if (stream != null) {
- clonedSystem.setStream((Stream) stream.clone());
+ clonedSystem.setStream(stream.clone());
}
if (thermoSystem != null) {
clonedSystem.thermoSystem = thermoSystem.clone();
@@ -434,6 +434,7 @@ public void displayResult() {
*
* @return an array of {@link java.lang.String} objects
*/
+ @Override
public String[][] getResultTable() {
return getFluid().getResultTable();
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java
index 86706217aa..534e197481 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java
@@ -48,6 +48,7 @@ public interface StreamInterface extends ProcessEquipmentInterface {
* getPressure.
*
*/
+ @Override
public double getPressure(String unit);
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/tank/Tank.java b/src/main/java/neqsim/processSimulation/processEquipment/tank/Tank.java
index c28f10c6b9..c4f1f52c91 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/tank/Tank.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/tank/Tank.java
@@ -122,7 +122,7 @@ public void setInletStream(StreamInterface inletStream) {
*/
public void addStream(StreamInterface newStream) {
if (numberOfInputStreams == 0) {
- setInletStream((Stream) newStream);
+ setInletStream(newStream);
} else {
inletStreamMixer.addStream(newStream);
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java
index 4ac6f6920e..def931f7a2 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowSetter.java
@@ -80,6 +80,7 @@ public FlowSetter(String name, StreamInterface stream) {
* Setter for the field inletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inStream = inletStream;
try {
@@ -320,7 +321,6 @@ public void run(UUID id) {
}
public ProcessSystem createReferenceProcess(StreamInterface feedStream) {
-
ProcessSystem referenceProcess = new ProcessSystem();
StreamInterface feedStream1 = new Stream("feed stream", feedStream.getFluid());
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java b/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java
index 7960f74268..53ef05eaf1 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java
@@ -83,6 +83,7 @@ public double getGFV() {
* Setter for the field inletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inStream = inletStream;
try {
@@ -99,6 +100,7 @@ public void setInletStream(StreamInterface inletStream) {
*
* @return a double
*/
+ @Override
public double getPressure() {
return pressure;
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/MoleFractionControllerUtil.java b/src/main/java/neqsim/processSimulation/processEquipment/util/MoleFractionControllerUtil.java
index 6d93ba46ce..901c261eeb 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/MoleFractionControllerUtil.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/MoleFractionControllerUtil.java
@@ -46,6 +46,7 @@ public MoleFractionControllerUtil(StreamInterface inletStream) {
* Setter for the field inletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inStream = inletStream;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/NeqSimUnit.java b/src/main/java/neqsim/processSimulation/processEquipment/util/NeqSimUnit.java
index 87af343110..9ee7a3f63e 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/NeqSimUnit.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/NeqSimUnit.java
@@ -54,6 +54,7 @@ public NeqSimUnit(StreamInterface inletStream, String equipment, String flowPatt
* Setter for the field inletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inStream = inletStream;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java b/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java
index d1a2ade68a..95a5f45ddb 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/Recycle.java
@@ -257,6 +257,7 @@ public double calcMixStreamEnthalpy() {
*
* @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
*/
+ @Override
@Deprecated
public StreamInterface getOutStream() {
return mixedStream;
@@ -334,7 +335,7 @@ public void run(UUID id) {
setErrorFlow(massBalanceCheck2());
logger.debug("comp recycle error: " + getError());
logger.debug("flow recycle error: " + getErrorFlow());
- lastIterationStream = (Stream) mixedStream.clone();
+ lastIterationStream = mixedStream.clone();
outletStream.setThermoSystem(mixedStream.getThermoSystem());
outletStream.setCalculationIdentifier(id);
logger.info(
@@ -549,6 +550,7 @@ public ArrayListinletStream
.
*
*/
+ @Override
public void setInletStream(StreamInterface inletStream) {
this.inStream = inletStream;
diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
index ed528a1d22..1ea56eea15 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
@@ -152,7 +152,7 @@ public void checkModulesRecycles() {
for (ProcessSystem operation : addedUnitOperations) {
for (ProcessEquipmentInterface unitOperation : operation.getUnitOperations()) {
if (unitOperation instanceof Recycle) {
- recycleModules.add((Recycle) unitOperation);
+ recycleModules.add(unitOperation);
}
}
}
diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java
index d88a67e5a4..5b07668b52 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java
@@ -227,6 +227,7 @@ public String getConditionAnalysisMessage() {
*
* @return an array of {@link java.lang.String} objects
*/
+ @Override
public String[][] getResultTable() {
return null;
}
@@ -238,6 +239,7 @@ public String[][] getResultTable() {
* getPressure.
*
*/
+ @Override
public double getPressure(String unit) {
return 1.0;
}
diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java
index d0a2a555cd..6f33680ec6 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessSystem.java
@@ -432,8 +432,8 @@ public void run(UUID id) {
if (!unitOperations.get(i).getClass().getSimpleName().equals("Recycle")) {
try {
if (iter == 1
- || ((ProcessEquipmentInterface) unitOperations.get(i)).needRecalculation()) {
- ((ProcessEquipmentInterface) unitOperations.get(i)).run(id);
+ || unitOperations.get(i).needRecalculation()) {
+ unitOperations.get(i).run(id);
}
} catch (Exception ex) {
// String error = ex.getMessage();
@@ -443,7 +443,7 @@ public void run(UUID id) {
if (unitOperations.get(i).getClass().getSimpleName().equals("Recycle")
&& recycleController.doSolveRecycle((Recycle) unitOperations.get(i))) {
try {
- ((ProcessEquipmentInterface) unitOperations.get(i)).run(id);
+ unitOperations.get(i).run(id);
} catch (Exception ex) {
// String error = ex.getMessage();
logger.error(ex.getMessage(), ex);
@@ -485,7 +485,7 @@ public void run(UUID id) {
} while ((!isConverged || (iter < 2 && hasResycle)) && iter < 100);
for (int i = 0; i < unitOperations.size(); i++) {
- ((ProcessEquipmentInterface) unitOperations.get(i)).setCalculationIdentifier(id);
+ unitOperations.get(i).setCalculationIdentifier(id);
}
setCalculationIdentifier(id);
@@ -541,6 +541,7 @@ public boolean solved() {
*
* @return a double
*/
+ @Override
public double getTime() {
return time;
}
@@ -730,6 +731,7 @@ public void setTimeStep(double timeStep) {
*
* @return the name
*/
+ @Override
public String getName() {
return name;
}
@@ -741,6 +743,7 @@ public String getName() {
* Setter for the field name
.
*
*/
+ @Override
public void setName(String name) {
this.name = name;
}
diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java
index dc0518bfbe..2710bd0ce3 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java
@@ -108,7 +108,7 @@ public void initializeStreams() {
for (int i = 0; i < numberOfAdsorptionBeds; i++) {
adsorber[i] = new SimpleAdsorber("SimpleAdsorber_" + i + 1, gasStreamToAdsorber);
}
- this.gasStreamFromAdsorber = (Stream) this.gasStreamToAdsorber.clone();
+ this.gasStreamFromAdsorber = this.gasStreamToAdsorber.clone();
this.gasStreamFromAdsorber.setName("Stream from Adsorber");
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/CO2RemovalModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/CO2RemovalModule.java
index 9352b7e63c..be73f092d0 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/processModules/CO2RemovalModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/CO2RemovalModule.java
@@ -63,7 +63,7 @@ public void run(UUID id) {
}
getOperations().run(id);
- streamFromAbsorber = (Stream) inletSeparator.getGasOutStream().clone();
+ streamFromAbsorber = inletSeparator.getGasOutStream().clone();
streamFromAbsorber.getThermoSystem().addComponent("CO2", -streamFromAbsorber.getThermoSystem()
.getPhase(0).getComponent("CO2").getNumberOfMolesInPhase() * 0.99);
streamFromAbsorber.getThermoSystem().addComponent("MEG", -streamFromAbsorber.getThermoSystem()
@@ -77,10 +77,10 @@ public void run(UUID id) {
public void initializeStreams() {
isInitializedStreams = true;
try {
- this.streamFromAbsorber = (Stream) this.streamToAbsorber.clone();
+ this.streamFromAbsorber = this.streamToAbsorber.clone();
this.streamFromAbsorber.setName("Stream from ABsorber");
- this.gasFromCO2Stripper = (Stream) this.streamToAbsorber.clone();
+ this.gasFromCO2Stripper = this.streamToAbsorber.clone();
this.gasFromCO2Stripper.setName("Gas stream from Stripper");
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/MEGReclaimerModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/MEGReclaimerModule.java
index 0eb12202bf..6160a1a464 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/processModules/MEGReclaimerModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/MEGReclaimerModule.java
@@ -73,13 +73,13 @@ public StreamInterface getOutputStream(String streamName) {
public void initializeStreams() {
isInitializedStreams = true;
try {
- this.streamToWaterRemoval = (Stream) this.streamToReclaimer.clone();
+ this.streamToWaterRemoval = this.streamToReclaimer.clone();
this.streamToWaterRemoval.setName("Desalted MEG stream");
- this.streamFromBoosterCompressor = (Stream) this.streamToReclaimer.clone();
+ this.streamFromBoosterCompressor = this.streamToReclaimer.clone();
this.streamFromBoosterCompressor.setName("Stream from Booster Compressor");
- this.streamWithWaste = (Stream) this.streamToReclaimer.clone();
+ this.streamWithWaste = this.streamToReclaimer.clone();
this.streamWithWaste.setName("Reclaimer Waste Stream");
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/PropaneCoolingModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/PropaneCoolingModule.java
index c3883e1cfa..1c049eec28 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/processModules/PropaneCoolingModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/PropaneCoolingModule.java
@@ -111,7 +111,7 @@ public void initializeModule() {
Heater condenser = new Heater("propane condenser", compressor1.getOutletStream());
condenser.setPressureDrop(0.07);
condenser.setSpecification("out stream");
- condenser.setOutletStream((Stream) refrigerantStream);
+ condenser.setOutletStream(refrigerantStream);
System.out.println("adding operations....");
getOperations().add(refrigerantStream);
diff --git a/src/main/java/neqsim/standards/gasQuality/Standard_ISO15403.java b/src/main/java/neqsim/standards/gasQuality/Standard_ISO15403.java
index 3c3077c72b..acd10f97fc 100644
--- a/src/main/java/neqsim/standards/gasQuality/Standard_ISO15403.java
+++ b/src/main/java/neqsim/standards/gasQuality/Standard_ISO15403.java
@@ -42,7 +42,6 @@ public void calculate() {
/** {@inheritDoc} */
@Override
public double getValue(String returnParameter) {
-
if (returnParameter.equals("MON")) {
return MON;
} else if (returnParameter.equals("NM")) {
diff --git a/src/main/java/neqsim/thermo/Fluid.java b/src/main/java/neqsim/thermo/Fluid.java
index a490b4a219..555a346d49 100644
--- a/src/main/java/neqsim/thermo/Fluid.java
+++ b/src/main/java/neqsim/thermo/Fluid.java
@@ -39,7 +39,7 @@ public neqsim.thermo.system.SystemInterface getFluid() {
}
/**
- *
+ *
*/
private void setThermoModel() {
if (thermoModel.equals("srk")) {
@@ -83,7 +83,7 @@ public neqsim.thermo.system.SystemInterface create2(String[] componentNames, dou
String unit) {
setThermoModel();
createFluid(componentNames, flowrate, unit);
- if (isHasWater() == true) {
+ if (isHasWater()) {
fluid.addComponent("water", 0.1);
}
fluid.createDatabase(true);
@@ -208,7 +208,7 @@ public neqsim.thermo.system.SystemInterface create(String fluidType) {
return null;
}
- if (isHasWater() == true) {
+ if (isHasWater()) {
fluid.addComponent("water", 0.1);
}
fluid.createDatabase(true);
diff --git a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java
index 44b43a1e83..e9853dc03a 100644
--- a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java
+++ b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java
@@ -423,7 +423,7 @@ public boolean checkNumerically() {
/**
* Setter for property maxError
.
- *
+ *
* @param maxErr before test will report failed Set maximum allowed error in model check
*/
public void setMaxError(double maxErr) {
diff --git a/src/main/java/neqsim/thermo/atomElement/Element.java b/src/main/java/neqsim/thermo/atomElement/Element.java
index 014b3767cc..dd9b308078 100644
--- a/src/main/java/neqsim/thermo/atomElement/Element.java
+++ b/src/main/java/neqsim/thermo/atomElement/Element.java
@@ -43,7 +43,6 @@ public Element(String name) {
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase();
java.sql.ResultSet dataSet =
database.getResultSet(("SELECT * FROM element WHERE componentname='" + name + "'"))) {
-
if (!dataSet.next()) {
return;
}
diff --git a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
index df47c24957..3beaa2da26 100644
--- a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
+++ b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
@@ -237,6 +237,7 @@ public int hashCode() {
/** {@inheritDoc} */
// @Override
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/src/main/java/neqsim/thermo/component/Component.java b/src/main/java/neqsim/thermo/component/Component.java
index 254ee3ea26..0f445b7f87 100644
--- a/src/main/java/neqsim/thermo/component/Component.java
+++ b/src/main/java/neqsim/thermo/component/Component.java
@@ -2188,6 +2188,7 @@ public double getVolumeCorrectionT() {
*
* @return a double
*/
+ @Override
public double getVolumeCorrection() {
return 0.0;
}
diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java
index a0c16c996d..86d78508fa 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquacmodifiedHV.java
@@ -11,7 +11,7 @@
/**
* Abstract class ComponentGEUniquacmodifiedHV
- *
+ *
* @author Even Solbraa
*/
abstract class ComponentGEUniquacmodifiedHV extends ComponentGEUniquac {
diff --git a/src/main/java/neqsim/thermo/component/ComponentPrCPA.java b/src/main/java/neqsim/thermo/component/ComponentPrCPA.java
index 854c8d9156..2f42683da4 100644
--- a/src/main/java/neqsim/thermo/component/ComponentPrCPA.java
+++ b/src/main/java/neqsim/thermo/component/ComponentPrCPA.java
@@ -5,7 +5,7 @@
/**
* Abstract class ComponentPrCPA.
- *
+ *
* @author Even Solbraa
*/
abstract class ComponentPrCPA extends ComponentPR implements ComponentCPAInterface {
diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java
index f25374a0ae..975edf491f 100644
--- a/src/main/java/neqsim/thermo/phase/Phase.java
+++ b/src/main/java/neqsim/thermo/phase/Phase.java
@@ -1315,7 +1315,7 @@ public double getLogInfiniteDiluteFugacity(int k, int p) {
/** {@inheritDoc} */
@Override
public double getLogInfiniteDiluteFugacity(int k) {
- PhaseInterface dilphase = (PhaseInterface) this.clone();
+ PhaseInterface dilphase = this.clone();
dilphase.addMoles(k, -(1.0 - 1e-10) * dilphase.getComponent(k).getNumberOfMolesInPhase());
dilphase.getComponent(k).setx(1e-10);
dilphase.init(dilphase.getNumberOfMolesInPhase(), dilphase.getNumberOfComponents(), 1,
diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java
index 162b88bdff..9bac2f1fb6 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java
@@ -80,7 +80,6 @@ public void displayInteractionCoefficients(String intType) {
@Override
public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt,
double beta) {
-
// Replace with pt != PhaseType.GAS?
if (pt.getValue() > 1) {
pt = PhaseType.LIQUID;
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java
index df8797e8a0..08f0560018 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGE.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java
@@ -182,7 +182,7 @@ public double getActivityCoefficientInfDilWater(int k, int p) {
* @return a double
*/
public double getActivityCoefficientInfDil(int k) {
- PhaseInterface dilphase = (PhaseInterface) this.clone();
+ PhaseInterface dilphase = this.clone();
dilphase.addMoles(k, -(1.0 - 1e-10) * dilphase.getComponent(k).getNumberOfMolesInPhase());
dilphase.getComponent(k).setx(1e-10);
dilphase.init(dilphase.getNumberOfMolesInPhase(), dilphase.getNumberOfComponents(), 1,
diff --git a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java
index a2e528c2ca..8a1bd7e72a 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java
@@ -75,7 +75,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType
gcpavv = calc_lngVV();
gcpavvv = calc_lngVVV();
}
- } while (Xsolved != true && totiter < 5);
+ } while (!Xsolved && totiter < 5);
if (initType > 1) {
hcpatotdT = calc_hCPAdT();
diff --git a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java
index e57b580ef2..5b9e4e370f 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java
@@ -303,6 +303,7 @@ public double gVV() {
*
* @return a double
*/
+ @Override
public double gVVV() {
double val1 = numberOfMolesInPhase * getMolarVolume();
double val2 = val1 + getC() - getB();
@@ -338,6 +339,7 @@ public double fVV() {
*
* @return a double
*/
+ @Override
public double fVVV() {
double val1 = numberOfMolesInPhase * molarVolume + getB() * delta1 + getC();
double val2 = numberOfMolesInPhase * molarVolume + getB() * delta2 + getC();
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index d1039b8360..df38a4f0e9 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -2245,6 +2245,7 @@ public ChemicalReactionOperations getChemicalReactionOperations() {
* @param pt PhaseType to look for.
* @return True if system contains a phase of requested type.
*/
+ @Override
public boolean hasPhaseType(PhaseType pt) {
for (int i = 0; i < numberOfPhases; i++) {
if (getPhase(i) == null) {
@@ -2925,7 +2926,6 @@ public void setAllPhaseType(PhaseType pt) {
@Override
public void invertPhaseTypes() {
// Following code was from public void setPhaseType(int phaseToChange, String phaseTypeName) {
-
/*
* int newPhaseType = 0; if (phaseTypeName.equals("gas")) { newPhaseType = 1; } else if
* (StateOfMatter.isLiquid(PhaseType.byDesc(phaseTypeName))) { newPhaseType = 0; } else {
@@ -3857,9 +3857,8 @@ public void saveObject(int ID, String text) {
* if (!text.isEmpty()) { ps = con.prepareStatement(
* "REPLACE INTO fluidinfo (ID, TEXT) VALUES (?,?)"); ps.setInt(1, ID); ps.setString(2, text);
* }
- *
+ *
* ps.executeUpdate();
- *
*/
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
@@ -5131,6 +5130,7 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[]
}
/** {@inheritDoc} */
+ @Override
public double getIdealLiquidDensity(String unit) {
double normalLiquidDensity = 0.0;
double molarMass = getMolarMass();
diff --git a/src/main/java/neqsim/thermo/util/GERG/DETAIL.java b/src/main/java/neqsim/thermo/util/GERG/DETAIL.java
index 6371beb565..701c7cf55f 100644
--- a/src/main/java/neqsim/thermo/util/GERG/DETAIL.java
+++ b/src/main/java/neqsim/thermo/util/GERG/DETAIL.java
@@ -251,7 +251,6 @@ public void DensityDetail(double T, double P, double[] x, doubleW D, intW ierr,
ierr.val = 1;
herr.val = "Calculation failed to converge in DETAIL method, ideal gas density returned.";
D.val = P / RDetail / T;
- return;
}
/**
@@ -1480,7 +1479,6 @@ public void SetupDetail() {
n0i[i][3] = n0i[i][3] - 1;
n0i[i][1] = n0i[i][1] - Math.log(d0);
}
- return;
// Code to produce nearly exact values for n0[1] and n0[2]
// This is not called in the current code, but included below to show how the
diff --git a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java
index 70659aada2..f73ea75f1c 100644
--- a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java
+++ b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java
@@ -3196,7 +3196,6 @@ public void SetupGERG() {
n0i[i][2] = n0i[i][2] - T0;
n0i[i][1] = n0i[i][1] - Math.log(d0);
}
- return;
// Code to produce nearly exact values for n0(1) and n0(2)
// This is not called in the current code, but included below to show how the values were
diff --git a/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java b/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java
index fb8f4d2223..eac675645f 100644
--- a/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java
+++ b/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java
@@ -302,7 +302,7 @@ public void setPhase(PhaseInterface phase) {
if (molarMass > 121.0 / 1000.0)
notNormalizedGERGComposition[14] += phase.getComponent(i).getx();
break;
- };
+ }
}
normalizeComposition();
}
diff --git a/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java b/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java
index dbd3fffb19..051a75c3ce 100644
--- a/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java
+++ b/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java
@@ -310,7 +310,7 @@ public void setPhase(PhaseInterface phase) {
notNormalizedGERGComposition[14] += phase.getComponent(i).getx();
}
break;
- };
+ }
}
normalizeComposition();
}
diff --git a/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java b/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java
index 7934716b32..00bf36b8a0 100644
--- a/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java
+++ b/src/main/java/neqsim/thermo/util/readwrite/TablePrinter.java
@@ -6,6 +6,7 @@
* A utility class for pretty printing a 2D string table.
*/
public class TablePrinter implements Serializable {
+ private static final long serialVersionUID = 1L;
/**
* Prints a 2D string table in a formatted and visually appealing way.
diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
index 07007a3d47..91931d4885 100644
--- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
+++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
@@ -1299,7 +1299,7 @@ public void bubblePointPressureFlash() throws Exception {
*/
public void bubblePointPressureFlash(boolean derivatives) throws Exception {
ConstantDutyFlashInterface operation = null;
- if (derivatives == true) {
+ if (derivatives) {
operation = new bubblePointPressureFlashDer(system);
} else {
operation = new bubblePointPressureFlash(system);
@@ -1977,7 +1977,7 @@ public CalculationResult propertyFlash(List
* testSetPressure
From a2bcfbbdae0cd0a54f66d7d4d2896b4e28381e99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Tue, 19 Mar 2024 11:22:21 +0100
Subject: [PATCH 149/317] chore: align pom files (#960)
* chore: align pom files
update maven references for java8
---
pom.xml | 12 +-
pomJava21.xml | 2 +-
pomJava8.xml | 484 +++++++++++++++++++++++++-------------------------
3 files changed, 249 insertions(+), 249 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9d44f05f92..20d0ef18c6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- * main. - *
- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - SystemInterface fluid1 = new SystemSrkCPA(298.15, 10.0); - - fluid1.addComponent("CO2", 1.0); - fluid1.addComponent("nitrogen", 1.0); - fluid1.addComponent("water", 1.0); - fluid1.addComponent("NaCl", 1.0); - fluid1.setMixingRule(2); - - try { - ThermodynamicOperations testOps = new ThermodynamicOperations(fluid1); - testOps.TPflash(); - } catch (Exception ex) { - logger.error(ex.getMessage(), ex); - } - fluid1.display(); - } } diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index 784d749c82..1ffcde5d91 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -18,77 +18,130 @@ */ public interface SystemInterface extends Cloneable, java.io.Serializable { /** - *- * saveFluid. - *
+ * return two fluid added as a new fluid. * - * @param id a int + * @param addFluid1 first fluid to add + * @param addFluid2 second fluid o add + * @return new fluid */ - public void saveFluid(int id); + public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterface addFluid2) { + SystemInterface newFluid = addFluid1.clone(); + newFluid.addFluid(addFluid2); + return newFluid; + } /** *- * saveFluid. + * addCapeOpenProperty. *
* - * @param id a int - * @param text a {@link java.lang.String} object + * @param propertyName a {@link java.lang.String} object */ - public void saveFluid(int id, String text); + public void addCapeOpenProperty(String propertyName); /** *- * getComponentNameTag. + * addCharacterized. *
* - * @return a {@link java.lang.String} object + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects */ - public String getComponentNameTag(); + public void addCharacterized(String[] charNames, double[] charFlowrate, double[] molarMass, + double[] relativedensity); /** - *- * setComponentNameTag. - *
+ * add a component to a fluid. If component already exists, the moles will be added to the + * existing component. * - * @param nameTag a {@link java.lang.String} object + * @param inComponent Component object to add. */ - public void setComponentNameTag(String nameTag); + public void addComponent(ComponentInterface inComponent); /** *- * setComponentNameTagOnNormalComponents. + * addComponent. *
* - * @param nameTag a {@link java.lang.String} object + * @param index Component number to add + * @param moles number of moles (per second) of the component to be added to the fluid */ - public void setComponentNameTagOnNormalComponents(String nameTag); + public void addComponent(int index, double moles); /** *- * addPhaseFractionToPhase. + * addComponent. *
* - * @param fraction a double - * @param specification a {@link java.lang.String} object - * @param fromPhaseName a {@link java.lang.String} object - * @param toPhaseName a {@link java.lang.String} object + * @param index Component number to add + * @param moles number of moles (per second) of the component to be added to the fluid + * @param phaseNumber Number of the phase to add the component to */ - public void addPhaseFractionToPhase(double fraction, String specification, String fromPhaseName, - String toPhaseName); + public void addComponent(int index, double moles, int phaseNumber); + + /** + * add a component to a fluid with no moles. + * + * @param name Name of the component to add. See NeqSim database for component in the database. + */ + public default void addComponent(String name) { + addComponent(name, 0); + } + + /** + * add a component to a fluid. If component already exists, the moles will be added to the + * existing component. + * + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid + */ + public void addComponent(String name, double moles); /** *- * addPhaseFractionToPhase. + * addComponent. *
* - * @param fraction a double - * @param specification a {@link java.lang.String} object - * @param specifiedStream a {@link java.lang.String} object - * @param fromPhaseName a {@link java.lang.String} object - * @param toPhaseName a {@link java.lang.String} object + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid + * @param TC Critical temperature + * @param PC Critical pressure + * @param acs a double */ - public void addPhaseFractionToPhase(double fraction, String specification, String specifiedStream, - String fromPhaseName, String toPhaseName); + public void addComponent(String name, double moles, double TC, double PC, double acs); + + /** + * add a component to a fluid. If component already exists, the moles will be added to the + * existing component. + * + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid + * @param phaseNumber Number of the phase to add the component to + */ + public void addComponent(String name, double moles, int phaseNumber); + + /** + * add a component to a fluid. If component already exists, the amount will be added to the + * existing component. + * + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param value The amount. + * @param unitName the unit of rate (sported units are kg/sec, mol/sec, Nlitre/min, kg/hr, + * Sm^3/hr, Sm^3/day, MSm^3/day .. + */ + public void addComponent(String name, double value, String unitName); + + /** + * add a component to a fluid. I component already exists, it will be added to the component + * + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param value rate of the component to add to the fluid + * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) + * @param phaseNumber Number of the phase to add the component to + */ + public void addComponent(String name, double value, String unitName, int phaseNumber); /** * Add named components to a System. Does nothing if components already exist in System. @@ -118,936 +171,915 @@ public default void addComponents(String[] names, double[] moles) { /** *- * renameComponent. + * addFluid. *
* - * @param oldName a {@link java.lang.String} object - * @param newName a {@link java.lang.String} object + * @param addSystem a {@link neqsim.thermo.system.SystemInterface} object + * @return SystemInterface */ - public void renameComponent(String oldName, String newName); + public SystemInterface addFluid(SystemInterface addSystem); /** *- * calcResultTable. + * addFluid. *
* - * @return an array of {@link java.lang.String} objects + * @param addSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param phase phase number of phase to add fluid to + * @return SystemInterface */ - public default String[][] calcResultTable() { - return createTable(""); - } + public SystemInterface addFluid(SystemInterface addSystem, int phase); /** *- * getKinematicViscosity. + * addGasToLiquid. *
* - * @return a double + * @param fraction a double */ - public double getKinematicViscosity(); + public void addGasToLiquid(double fraction); /** - * method to return kinematic viscosity in a specified unit. + *+ * addLiquidToGas. + *
* - * @param unit Supported units are m2/sec - * @return kinematic viscosity in specified unit + * @param fraction a double */ - public double getKinematicViscosity(String unit); + public void addLiquidToGas(double fraction); /** *- * Get number of components added to System. + * addCharacterized. *
* - * @return the number of components in System. + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects + * @param lastIsPlusFraction True if last fraction is a Plus fraction */ - public int getNumberOfComponents(); + public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, + double[] relativedensity, boolean lastIsPlusFraction); /** - * This method is used to set the total molar composition of a plus fluid. The total flow rate - * will be kept constant. The input mole fractions will be normalized. + *+ * addCharacterized. + *
* - * @param molefractions is a double array taking the molar fraction of the components in the - * fluid. THe last molfraction is the mole fraction of the plus component + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects + * @param lastIsPlusFraction True if last fraction is a Plus fraction + * @param lumpComponents True if component should be lumped + * @param numberOfPseudoComponents number of pseudo components */ - public void setMolarCompositionPlus(double[] molefractions); + public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, + double[] relativedensity, boolean lastIsPlusFraction, boolean lumpComponents, + int numberOfPseudoComponents); /** - * This method is used to set the total molar composition of a characterized fluid. The total flow - * rate will be kept constant. The input mole fractions will be normalized. - * - * @param molefractions is a double array taking the molar fraction of the components in the - * fluid. THe last fraction in the array is the total molefraction of the characterized - * components. + * Add phase to SystemInterface object. */ - public void setMolarCompositionOfPlusFluid(double[] molefractions); + public void addPhase(); /** - * method to return exergy defined as (h1-T0*s1) in a unit Joule. + *+ * addPhaseFractionToPhase. + *
* - * @param temperatureOfSurroundings in Kelvin - * @return a double + * @param fraction a double + * @param specification a {@link java.lang.String} object + * @param fromPhaseName a {@link java.lang.String} object + * @param toPhaseName a {@link java.lang.String} object */ - public double getExergy(double temperatureOfSurroundings); + public void addPhaseFractionToPhase(double fraction, String specification, String fromPhaseName, + String toPhaseName); /** - * method to return exergy in a specified unit. + *+ * addPhaseFractionToPhase. + *
* - * @param temperatureOfSurroundings in Kelvin - * @param exergyUnit a {@link java.lang.String} object - * @return exergy in specified unit + * @param fraction a double + * @param specification a {@link java.lang.String} object + * @param specifiedStream a {@link java.lang.String} object + * @param fromPhaseName a {@link java.lang.String} object + * @param toPhaseName a {@link java.lang.String} object */ - public double getExergy(double temperatureOfSurroundings, String exergyUnit); + public void addPhaseFractionToPhase(double fraction, String specification, String specifiedStream, + String fromPhaseName, String toPhaseName); /** - * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis - * average + *+ * addPlusFraction. + *
* - * @return Joule Thomson coefficient in K/bar + * @param componentName a {@link java.lang.String} object + * @param numberOfMoles a double + * @param molarMass a double + * @param density a double */ - public double getJouleThomsonCoefficient(); + public void addPlusFraction(String componentName, double numberOfMoles, double molarMass, + double density); /** - * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis - * average. + *+ * addSalt. + *
* - * @param unit Supported units are K/bar, C/bar - * @return Joule Thomson coefficient in specified unit + * @param componentName a {@link java.lang.String} object + * @param value a double */ - public double getJouleThomsonCoefficient(String unit); + public void addSalt(String componentName, double value); /** - * method to return mass of fluid. + *+ * addSolidComplexPhase. + *
* - * @param unit Supported units are kg, gr, tons - * @return mass in specified unit + * @param type a {@link java.lang.String} object */ - public double getMass(String unit); + public void addSolidComplexPhase(String type); /** - *- * Get sum of mole fractions for all components. NB! init(0) must be called first. - *
+ * method to add true boiling point fraction. * - * @return a double + * @param componentName selected name of the component to be added + * @param numberOfMoles number of moles to be added + * @param molarMass molar mass of the component in kg/mol + * @param density density of the component in g/cm3 */ - public double getMoleFractionsSum(); + public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, + double density); /** - * method to get the speed of sound of a system. The sound speed is implemented based on a molar - * average over the phases + *+ * addTBPfraction. + *
* - * @param unit Supported units are m/s, km/h - * @return speed of sound in m/s + * @param componentName a {@link java.lang.String} object + * @param numberOfMoles a double + * @param molarMass a double + * @param density a double + * @param criticalTemperature a double + * @param criticalPressure a double + * @param acentricFactor a double */ - public double getSoundSpeed(String unit); + public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, + double density, double criticalTemperature, double criticalPressure, double acentricFactor); /** - * method to get the speed of sound of a system. The sound speed is implemented based on a molar - * average over the phases + * Add to component names. * - * @return speed of sound in m/s + * @param name Component name to add */ - public double getSoundSpeed(); + public void addToComponentNames(String name); /** *- * removePhaseKeepTotalComposition. + * Getter for property allowPhaseShift. *
* - * @param specPhase a int - */ - public void removePhaseKeepTotalComposition(int specPhase); - - /** - * Init physical properties for all phases and interfaces. + * @return a boolean */ - public void initPhysicalProperties(); + public boolean allowPhaseShift(); /** - * Calculates physical properties of type propertyName. + *+ * Setter for property allowPhaseShift. + *
* - * @param propertyName a {@link java.lang.String} object + * @param allowPhaseShift a boolean */ - public void initPhysicalProperties(String propertyName); + public void allowPhaseShift(boolean allowPhaseShift); /** - * Calculates thermodynamic and physical properties of a fluid using initThermoProperties() and - * initPhysicalProperties(). + *+ * autoSelectMixingRule. + *
*/ - public void initProperties(); + public void autoSelectMixingRule(); /** - * return two fluid added as a new fluid. + *+ * autoSelectModel. + *
* - * @param addFluid1 first fluid to add - * @param addFluid2 second fluid o add - * @return new fluid + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterface addFluid2) { - SystemInterface newFluid = addFluid1.clone(); - newFluid.addFluid(addFluid2); - return newFluid; - } - - /** - * method to return interfacial tension between two phases. - * - * @param phase1 phase type of phase1 as string (valid phases are gas, oil, aqueous) - * @param phase2 phase type of phase2 as string (valid phases are gas, oil, aqueous) - * @return interfacial tension with unit N/m. If one or both phases does not exist - the method - * will return NaN + public SystemInterface autoSelectModel(); + + /** + *+ * calc_x_y. + *
*/ - public double getInterfacialTension(String phase1, String phase2); + public void calc_x_y(); /** - * method to return interfacial tension between two phases. - * - * @param phase1 phase number of phase1 - * @param phase2 phase number of phase2 - * @return interfacial tension with unit N/m + *+ * calc_x_y_nonorm. + *
*/ - public double getInterfacialTension(int phase1, int phase2); + public void calc_x_y_nonorm(); /** *- * getInterfacialTension. + * calcBeta. For simple gas liquid systems. *
* - * @param phase1 phase number of phase1 - * @param phase2 phase number of phase2 - * @param unit a {@link java.lang.String} object - * @return interfacial tension with specified unit + * @return Beta Mole fraction contained in the heaviest phase, i.e., liquid phase. + * @throws neqsim.util.exception.IsNaNException if any. + * @throws neqsim.util.exception.TooManyIterationsException if any. */ - public double getInterfacialTension(int phase1, int phase2, String unit); + public double calcBeta() + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException; /** - * method to return heat capacity ratio calculated as Cp/(Cp-R). + *+ * calcHenrysConstant. + *
* - * @return kappa + * @param component a {@link java.lang.String} object + * @return a double */ - public default double getGamma2() { - return getCp() / (getCp() - ThermodynamicConstantsInterface.R * getTotalNumberOfMoles()); - } + public double calcHenrysConstant(String component); /** - * method to return heat capacity ratio/adiabatic index/Poisson constant. - * - * @return kappa + *+ * calcInterfaceProperties. + *
*/ - public double getGamma(); + public void calcInterfaceProperties(); /** - * method to return fluid volume. + *+ * calcKIJ. + *
* - * @return volume in unit m3*1e5 + * @param ok a boolean */ - public double getVolume(); + public void calcKIJ(boolean ok); /** - * method to return fluid volume. + *+ * calcResultTable. + *
* - * @param unit Supported units are m3, litre, m3/kg, m3/mol - * @return volume in specified unit + * @return an array of {@link java.lang.String} objects */ - public double getVolume(String unit); + public default String[][] calcResultTable() { + return createTable(""); + } /** - * method to return flow rate of fluid. + *+ * changeComponentName. + *
* - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, m3/min, m3/hr, - * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, mole/min, mole/hr - * @return flow rate in specified unit + * @param name a {@link java.lang.String} object + * @param newName a {@link java.lang.String} object */ - public double getFlowRate(String flowunit); + public void changeComponentName(String name, String newName); /** - * method to set the pressure of a fluid (same pressure for all phases). + *+ * checkStability. + *
* - * @param pres pressure in unit bara (absolute pressure in bar) + * @return a boolean */ - public void setPressure(double pres); + public boolean checkStability(); /** - * method to set the pressure of a fluid (same pressure for all phases). + *+ * checkStability. + *
* - * @param newPressure in specified unit - * @param unit unit can be bar, bara, barg or atm + * @param val a boolean */ - public void setPressure(double newPressure, String unit); + public void checkStability(boolean val); /** *- * method to set the temperature of a fluid (same temperature for all phases). + * chemicalReactionInit. *
- * - * @param temp a double */ - public void setTemperature(double temp); + public void chemicalReactionInit(); /** *- * setTemperature. + * clearAll. *
- * - * @param newTemperature a double - * @param phaseNumber a int */ - public void setTemperature(double newTemperature, int phaseNumber); + public void clearAll(); /** - * method to set the temperature of a fluid (same temperature for all phases). + *+ * clone. + *
* - * @param newTemperature in specified unit - * @param unit unit can be C or K (Celsius or Kelvin) + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public void setTemperature(double newTemperature, String unit); + public SystemInterface clone(); /** - * method to return the volume fraction of a phase note: without Peneloux volume correction. + * method to read pure component and interaction parameters from the NeqSim database and create + * temporary tables with parameters for active fluid. * - * @param phaseNumber number of the phase to get volume fraction for - * @return volume fraction + * @param reset If reset is set to true, new temporary tables with parameters for the added + * components will be created. When parameters are needed (eg. when adding components or + * when setting a mixing rule) it will try to find them in the temporary tables first eg. + * COMPTEMP (for pure component parameters) and INTERTEMP (for interaction parameters). If + * reset is set to false it will not create new temporary tables. If a fluid is created + * with the same components many times, performance improvements will be obtained, if + * temporary tables are created the first time (reset=true), and then the same tables is + * used when creating new fluids with the same temporary tables (reset=false) */ - public double getVolumeFraction(int phaseNumber); + public void createDatabase(boolean reset); /** - * method to return the volume fraction of a phase note: with Peneloux volume correction. + *+ * createTable. + *
* - * @param phaseNumber number of the phase to get volume fraction for - * @return volume fraction + * @param name a {@link java.lang.String} object + * @return an array of {@link java.lang.String} objects */ - public double getCorrectedVolumeFraction(int phaseNumber); + public String[][] createTable(String name); /** *- * getHeatOfVaporization. + * deleteFluidPhase. *
* - * @return a double + * @param phase a int */ - public double getHeatOfVaporization(); + public void deleteFluidPhase(int phase); /** - * method to return internal energy (U) in unit J. - * - * @return internal energy in unit Joule (J) + *+ * display. + *
*/ - public double getInternalEnergy(); + public default void display() { + display(this.getFluidName()); + } /** - * method to return internal energy (U) in a specified unit. + *+ * display. + *
* - * @param unit Supported units are 'J', 'J/mol', 'J/kg' and 'kJ/kg' - * @return enthalpy in specified unit + * @param name a {@link java.lang.String} object */ - public double getInternalEnergy(String unit); + public void display(String name); /** *
- * isForcePhaseTypes.
+ * Getter for property multiPhaseCheck
.
*
- * setForcePhaseTypes. + * doSolidPhaseCheck. *
* - * @param forcePhaseTypes a boolean + * @return a boolean */ - public void setForcePhaseTypes(boolean forcePhaseTypes); + public boolean doSolidPhaseCheck(); - /** - * Set the flow rate (moles) of all components to zero. - */ - public void setEmptyFluid(); + /** {@inheritDoc} */ + @Override + public boolean equals(Object o); /** *
- * setMolarFlowRates.
+ * Getter for property beta
.
+ *
+ * Gets value for heaviest phase.
*
- * setComponentNames.
+ * Getter for property beta
for a specific phase.
*
- * calc_x_y_nonorm. + * getCapeOpenProperties10. *
+ * + * @return an array of {@link java.lang.String} objects */ - public void calc_x_y_nonorm(); + public String[] getCapeOpenProperties10(); /** *- * saveObjectToFile. + * getCapeOpenProperties11. *
* - * @param filePath a {@link java.lang.String} object - * @param fluidName a {@link java.lang.String} object + * @return an array of {@link java.lang.String} objects */ - public void saveObjectToFile(String filePath, String fluidName); + public String[] getCapeOpenProperties11(); /** *- * readObjectFromFile. + * getCASNumbers. *
* - * @param filePath a {@link java.lang.String} object - * @param fluidName a {@link java.lang.String} object - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @return an array of {@link java.lang.String} objects */ - public SystemInterface readObjectFromFile(String filePath, String fluidName); + public String[] getCASNumbers(); /** *- * getLiquidVolume. + * Getter for property characterization. *
* - * @return a double + * @return a {@link neqsim.thermo.characterization.Characterise} object */ - public double getLiquidVolume(); + public neqsim.thermo.characterization.Characterise getCharacterization(); /** *- * resetPhysicalProperties. + * getChemicalReactionOperations. *
+ * + * @return a {@link neqsim.chemicalReactions.ChemicalReactionOperations} object */ - public void resetPhysicalProperties(); + public ChemicalReactionOperations getChemicalReactionOperations(); /** *- * phaseToSystem. + * getCompFormulaes. *
* - * @param phaseNumber a int - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @return an array of {@link java.lang.String} objects */ - public SystemInterface phaseToSystem(int phaseNumber); + public String[] getCompFormulaes(); /** *- * phaseToSystem. + * getCompIDs. *
* - * @param newPhase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @return an array of {@link java.lang.String} objects */ - public SystemInterface phaseToSystem(PhaseInterface newPhase); + public String[] getCompIDs(); /** - *- * phaseToSystem. - *
+ * Get names of all components in System. * - * @param phaseName a {@link java.lang.String} object - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @return an array of {@link java.lang.String} objects */ - public SystemInterface phaseToSystem(String phaseName); + public String[] getCompNames(); /** *- * phaseToSystem. + * Get component by index. *
* - * @param phaseNumber1 a int - * @param phaseNumber2 a int - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @param i Component index + * @return a {@link neqsim.thermo.component.ComponentInterface} object */ - public SystemInterface phaseToSystem(int phaseNumber1, int phaseNumber2); + public default ComponentInterface getComponent(int i) { + return getPhase(0).getComponent(i); + } /** *- * changeComponentName. + * Get component by name. *
* - * @param name a {@link java.lang.String} object - * @param newName a {@link java.lang.String} object + * @param name Name of component + * @return a {@link neqsim.thermo.component.ComponentInterface} object */ - public void changeComponentName(String name, String newName); + public default ComponentInterface getComponent(String name) { + return getPhase(0).getComponent(name); + } /** *
- * getWaxModel.
+ * Getter for property componentNames
.
*
- * getWaxCharacterisation. + * getComponentNameTag. *
* - * @return a {@link neqsim.thermo.characterization.WaxCharacterise} object + * @return a {@link java.lang.String} object */ - public neqsim.thermo.characterization.WaxCharacterise getWaxCharacterisation(); + public String getComponentNameTag(); /** - * method to get the total molar flow rate of individual components in a fluid. + * method to return fluid volume with Peneloux volume correction. * - * @return molar flow of individual components in unit mol/sec + * @return volume in unit m3 */ - public double[] getMolarRate(); + public double getCorrectedVolume(); /** - * Returns true if phase exists and is not null. + * method to return the volume fraction of a phase note: with Peneloux volume correction. * - * @param i Phase number - * @return True if phase exists, false if not. + * @param phaseNumber number of the phase to get volume fraction for + * @return volume fraction */ - public boolean isPhase(int i); + public double getCorrectedVolumeFraction(int phaseNumber); /** - * Get phase number i from SystemInterface object. + * method to return specific heat capacity (Cp). * - * @param i Phase number - * @return a {@link neqsim.thermo.phase.PhaseInterface} object + * @return Cp in unit J/K */ - public PhaseInterface getPhase(int i); + public double getCp(); /** - *- * getPhase. - *
+ * method to return specific heat capacity (Cp) in a specified unit. * - * @param phaseTypeName a {@link java.lang.String} object - * @return a {@link neqsim.thermo.phase.PhaseInterface} object + * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK + * @return Cp in specified unit */ - public PhaseInterface getPhase(String phaseTypeName); + public double getCp(String unit); /** - *- * getPhase. - *
+ * method to return specific heat capacity (Cv). * - * @param pt a {@link neqsim.thermo.phase.PhaseType} object - * @return a {@link neqsim.thermo.phase.PhaseInterface} object + * @return Cv in unit J/K */ - public PhaseInterface getPhase(PhaseType pt); + public double getCv(); /** - *- * Indexed getter for property phaseIndex. - *
+ * method to return specific heat capacity (Cp) in a specified unit. * - * @param i Phase number - * @return PhaseIndex to index into phaseArray. + * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK + * @return Cp in specified unit */ - public int getPhaseIndex(int i); + public double getCv(String unit); /** - * Get property phaseIndex corresponding to a phase. + * method to get density of a fluid note: without Peneloux volume correction. * - * @param phase Phase object to search for. - * @return PhaseIndex to index into phaseArray. + * @return density with unit kg/m3 */ - public int getPhaseIndex(PhaseInterface phase); + public double getDensity(); /** - *- * Get property phaseIndex corresponding to a phase. - *
+ * method to get density of a fluid note: with Peneloux volume correction. * - * @param phaseTypeName a {@link java.lang.String} object - * @return PhaseIndex to index into phaseArray. + * @param unit Supported units are kg/m3, mol/m3 + * @return density in specified unit */ - public int getPhaseIndex(String phaseTypeName); + public double getDensity(String unit); /** *- * setTotalFlowRate. + * getdVdPtn. *
* - * @param flowRate a double - * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, kg/min, kg/hr - * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, Sm3/day, idSm3/hr, idSm3/day + * @return a double */ - public void setTotalFlowRate(double flowRate, String flowunit); + public double getdVdPtn(); /** *- * Returns the overall mole composition vector in unit mole fraction. + * getdVdTpn. *
* - * @return an array of {@link double} objects + * @return a double */ - public double[] getMolarComposition(); + public double getdVdTpn(); /** *- * getNumberOfOilFractionComponents. + * getEmptySystemClone. *
* - * @return a int + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public int getNumberOfOilFractionComponents(); + public SystemInterface getEmptySystemClone(); /** - *- * setHeavyTBPfractionAsPlusFraction. - *
+ * method to get the total enthalpy of a fluid. * - * @return a boolean + * @return molar mass in unit J (Joule) */ - public boolean setHeavyTBPfractionAsPlusFraction(); + public double getEnthalpy(); /** - *- * getCapeOpenProperties11. - *
+ * method to return total enthalpy in a specified unit. * - * @return an array of {@link java.lang.String} objects + * @param unit Supported units are 'J', 'J/mol', 'kJ/kmol', 'J/kg' and 'kJ/kg' + * @return enthalpy in specified unit */ - public String[] getCapeOpenProperties11(); + public double getEnthalpy(String unit); /** - *- * getCapeOpenProperties10. - *
+ * method to return total entropy of the fluid. * - * @return an array of {@link java.lang.String} objects + * @return entropy in unit J/K (Joule/Kelvin) */ - public String[] getCapeOpenProperties10(); + public double getEntropy(); /** - *- * getLowestGibbsEnergyPhase. - *
+ * method to return total entropy of the fluid. * - * @return a {@link neqsim.thermo.phase.PhaseInterface} object + * @param unit unit supported units are J/K, J/molK, J/kgK and kJ/kgK + * @return entropy in specified unit */ - public PhaseInterface getLowestGibbsEnergyPhase(); + public double getEntropy(String unit); /** - *- * getOilFractionNormalBoilingPoints. - *
+ * method to return exergy defined as (h1-T0*s1) in a unit Joule. * - * @return an array of {@link double} objects + * @param temperatureOfSurroundings in Kelvin + * @return a double */ - public double[] getOilFractionNormalBoilingPoints(); + public double getExergy(double temperatureOfSurroundings); /** - *- * getOilFractionLiquidDensityAt25C. - *
+ * method to return exergy in a specified unit. * - * @return an array of {@link double} objects + * @param temperatureOfSurroundings in Kelvin + * @param exergyUnit a {@link java.lang.String} object + * @return exergy in specified unit */ - public double[] getOilFractionLiquidDensityAt25C(); + public double getExergy(double temperatureOfSurroundings, String exergyUnit); /** - *- * getOilFractionMolecularMass. - *
+ * method to return flow rate of fluid. * - * @return an array of {@link double} objects + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, m3/min, m3/hr, + * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, mole/min, mole/hr + * @return flow rate in specified unit */ - public double[] getOilFractionMolecularMass(); + public double getFlowRate(String flowunit); /** *- * getOilFractionIDs. + * Getter for property info. *
* - * @return an array of {@link int} objects + * @return a {@link java.lang.String} object */ - public int[] getOilFractionIDs(); + public String getFluidInfo(); /** *- * getMoleFraction. + * getFluidName. *
* - * @param phaseNumber a int - * @return a double + * @return a {@link java.lang.String} object */ - public double getMoleFraction(int phaseNumber); + public String getFluidName(); /** - * method to return specific heat capacity (Cv). + * method to return heat capacity ratio/adiabatic index/Poisson constant. * - * @return Cv in unit J/K + * @return kappa */ - public double getCv(); + public double getGamma(); /** - * method to return specific heat capacity (Cp) in a specified unit. + * method to return heat capacity ratio calculated as Cp/(Cp-R). * - * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK - * @return Cp in specified unit + * @return kappa */ - public double getCv(String unit); + public default double getGamma2() { + return getCp() / (getCp() - ThermodynamicConstantsInterface.R * getTotalNumberOfMoles()); + } /** *- * Getter for property characterization. + * getGasPhase. *
* - * @return a {@link neqsim.thermo.characterization.Characterise} object + * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ - public neqsim.thermo.characterization.Characterise getCharacterization(); + public PhaseInterface getGasPhase(); /** *- * readObject. + * getGibbsEnergy. *
* - * @param ID a int - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @return a double */ - public SystemInterface readObject(int ID); + public double getGibbsEnergy(); /** *- * getCompIDs. + * getHeatOfVaporization. *
* - * @return an array of {@link java.lang.String} objects + * @return a double */ - public String[] getCompIDs(); + public double getHeatOfVaporization(); /** *- * saveObject. + * getHelmholtzEnergy. *
* - * @param ID a int - * @param text a {@link java.lang.String} object - */ - public void saveObject(int ID, String text); - - /** - * Set mole fractions of all components to 0. + * @return a double */ - public void reset(); + public double getHelmholtzEnergy(); /** *- * getCASNumbers. + * Getter for property hydrateCheck. *
* - * @return an array of {@link java.lang.String} objects + * @return a boolean */ - public String[] getCASNumbers(); + public boolean getHydrateCheck(); /** - *- * getMolecularWeights. - *
+ * Get ideal liquid density of fluid in given unit. * - * @return an array of {@link double} objects + * @param unit {@link java.lang.String} Supported units are kg/m3 and gr/cm3 + * @return a double */ - public double[] getMolecularWeights(); + public double getIdealLiquidDensity(String unit); /** *- * getNormalBoilingPointTemperatures. + * Getter for property initType. *
* - * @return an array of {@link double} objects + * @return a int */ - public double[] getNormalBoilingPointTemperatures(); + public int getInitType(); /** - * Get names of all components in System. + * method to return interfacial tension between two phases. * - * @return an array of {@link java.lang.String} objects + * @param phase1 phase number of phase1 + * @param phase2 phase number of phase2 + * @return interfacial tension with unit N/m */ - public String[] getCompNames(); + public double getInterfacialTension(int phase1, int phase2); /** *- * getCompFormulaes. + * getInterfacialTension. *
* - * @return an array of {@link java.lang.String} objects + * @param phase1 phase number of phase1 + * @param phase2 phase number of phase2 + * @param unit a {@link java.lang.String} object + * @return interfacial tension with specified unit */ - public String[] getCompFormulaes(); + public double getInterfacialTension(int phase1, int phase2, String unit); /** - *- * getWtFraction. - *
+ * method to return interfacial tension between two phases. * - * @param phaseNumber a int - * @return a double + * @param phase1 phase type of phase1 as string (valid phases are gas, oil, aqueous) + * @param phase2 phase type of phase2 as string (valid phases are gas, oil, aqueous) + * @return interfacial tension with unit N/m. If one or both phases does not exist - the method + * will return NaN */ - public double getWtFraction(int phaseNumber); + public double getInterfacialTension(String phase1, String phase2); /** - *- * isMultiphaseWaxCheck. - *
+ * method to return internal energy (U) in unit J. * - * @return a boolean + * @return internal energy in unit Joule (J) */ - public boolean isMultiphaseWaxCheck(); + public double getInternalEnergy(); /** - *- * setMultiphaseWaxCheck. - *
+ * method to return internal energy (U) in a specified unit. * - * @param multiphaseWaxCheck a boolean + * @param unit Supported units are 'J', 'J/mol', 'J/kg' and 'kJ/kg' + * @return enthalpy in specified unit */ - public void setMultiphaseWaxCheck(boolean multiphaseWaxCheck); + public double getInternalEnergy(String unit); /** *- * This method is used to set the total molar composition of a fluid. The total flow rate will be - * kept constant. The input mole fractions will be normalized. + * getInterphaseProperties. *
* - * @param moles an array of {@link double} objects + * @return a {@link neqsim.physicalProperties.interfaceProperties.InterphasePropertiesInterface} + * object */ - public void setMolarComposition(double[] moles); + public InterphasePropertiesInterface getInterphaseProperties(); /** - * return the phase of to specified type if the phase does not exist, the method will return null. + * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis + * average * - * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, hydrate are - * supported) - * @return a {@link neqsim.thermo.phase.PhaseInterface} object + * @return Joule Thomson coefficient in K/bar */ - public PhaseInterface getPhaseOfType(String phaseTypeName); + public double getJouleThomsonCoefficient(); /** - *- * setUseTVasIndependentVariables. - *
+ * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis + * average. * - * @param useTVasIndependentVariables a boolean + * @param unit Supported units are K/bar, C/bar + * @return Joule Thomson coefficient in specified unit */ - public void setUseTVasIndependentVariables(boolean useTVasIndependentVariables); + public double getJouleThomsonCoefficient(String unit); /** - * method to add true boiling point fraction. + * method to return heat capacity ratio/adiabatic index/Poisson constant. * - * @param componentName selected name of the component to be added - * @param numberOfMoles number of moles to be added - * @param molarMass molar mass of the component in kg/mol - * @param density density of the component in g/cm3 + * @return kappa */ - public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, - double density); + public double getKappa(); /** *- * addTBPfraction. + * getKinematicViscosity. *
* - * @param componentName a {@link java.lang.String} object - * @param numberOfMoles a double - * @param molarMass a double - * @param density a double - * @param criticalTemperature a double - * @param criticalPressure a double - * @param acentricFactor a double + * @return a double */ - public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, - double density, double criticalTemperature, double criticalPressure, double acentricFactor); + public double getKinematicViscosity(); /** - *- * addPlusFraction. - *
+ * method to return kinematic viscosity in a specified unit. * - * @param componentName a {@link java.lang.String} object - * @param numberOfMoles a double - * @param molarMass a double - * @param density a double + * @param unit Supported units are m2/sec + * @return kinematic viscosity in specified unit */ - public void addPlusFraction(String componentName, double numberOfMoles, double molarMass, - double density); + public double getKinematicViscosity(String unit); /** *- * addSalt. + * getLiquidPhase. *
* - * @param componentName a {@link java.lang.String} object - * @param value a double + * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ - public void addSalt(String componentName, double value); + public PhaseInterface getLiquidPhase(); /** *- * deleteFluidPhase. + * getLiquidVolume. *
* - * @param phase a int + * @return a double */ - public void deleteFluidPhase(int phase); + public double getLiquidVolume(); /** *- * setBmixType. + * getLowestGibbsEnergyPhase. *
* - * @param bmixType a int - */ - public void setBmixType(int bmixType); - - /** - * Verify if system has a phase of a specific type. - * - * @param pt PhaseType to look for - * @return True if system contains a phase of requested type + * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ - public boolean hasPhaseType(PhaseType pt); + public PhaseInterface getLowestGibbsEnergyPhase(); /** - * Verify if system has a phase of a specific type. + * method to return mass of fluid. * - * @param phaseTypeName PhaseType to look for - * @return True if system contains a phase of requested type + * @param unit Supported units are kg, gr, tons + * @return mass in specified unit */ - public default boolean hasPhaseType(String phaseTypeName) { - return hasPhaseType(PhaseType.byDesc(phaseTypeName)); - } + public double getMass(String unit); /** *
- * hasSolidPhase.
+ * Getter for property maxNumberOfPhases
.
*
- * addSolidComplexPhase. + * getMixingRule. *
* - * @param type a {@link java.lang.String} object - */ - public void addSolidComplexPhase(String type); - - /** - *- * resetCharacterisation. - *
+ * @return a int */ - public void resetCharacterisation(); + public int getMixingRule(); /** *@@ -1069,690 +1101,660 @@ public default boolean hasSolidPhase() { /** *
- * tuneModel. + * Returns the overall mole composition vector in unit mole fraction. *
* - * @param model a {@link java.lang.String} object - * @param val a double - * @param phase a int + * @return an array of {@link double} objects */ - public void tuneModel(String model, double val, int phase); + public double[] getMolarComposition(); /** - * add a component to a fluid. If component already exists, the moles will be added to the - * existing component. + * Get molar mass of system. * - * @param inComponent Component object to add. + * @return molar mass in unit kg/mol */ - public void addComponent(ComponentInterface inComponent); + public double getMolarMass(); /** - * add a component to a fluid with no moles. + * method to get molar mass of a fluid phase. * - * @param name Name of the component to add. See NeqSim database for component in the database. + * @param unit Supported units are kg/mol, gr/mol + * @return molar mass in specified unit */ - public default void addComponent(String name) { - addComponent(name, 0); - } + public double getMolarMass(String unit); /** - * add a component to a fluid. If component already exists, the moles will be added to the - * existing component. + * method to get the total molar flow rate of individual components in a fluid. * - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param moles number of moles (per second) of the component to be added to the fluid + * @return molar flow of individual components in unit mol/sec */ - public void addComponent(String name, double moles); + public double[] getMolarRate(); /** - * add a component to a fluid. If component already exists, the amount will be added to the - * existing component. + * method to return molar volume of the fluid note: without Peneloux volume correction. * - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param value The amount. - * @param unitName the unit of rate (sported units are kg/sec, mol/sec, Nlitre/min, kg/hr, - * Sm^3/hr, Sm^3/day, MSm^3/day .. + * @return molar volume volume in unit m3/mol*1e5 */ - public void addComponent(String name, double value, String unitName); + public double getMolarVolume(); + + /** + * method to return molar volume of the fluid: eventual volume correction included. + * + * @param unit Supported units are m3/mol, litre/mol + * + * @return molar volume volume in unit + */ + public double getMolarVolume(String unit); /** *- * addComponent. + * getMolecularWeights. *
* - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param moles number of moles (per second) of the component to be added to the fluid - * @param TC Critical temperature - * @param PC Critical pressure - * @param acs a double + * @return an array of {@link double} objects */ - public void addComponent(String name, double moles, double TC, double PC, double acs); + public double[] getMolecularWeights(); /** - * add a component to a fluid. If component already exists, the moles will be added to the - * existing component. + *+ * getMoleFraction. + *
* - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param moles number of moles (per second) of the component to be added to the fluid - * @param phaseNumber Number of the phase to add the component to + * @param phaseNumber a int + * @return a double */ - public void addComponent(String name, double moles, int phaseNumber); + public double getMoleFraction(int phaseNumber); /** - * add a component to a fluid. I component already exists, it will be added to the component + *+ * Get sum of mole fractions for all components. NB! init(0) must be called first. + *
* - * @param name Name of the component to add. See NeqSim database for component in the database. - * @param value rate of the component to add to the fluid - * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) - * @param phaseNumber Number of the phase to add the component to + * @return a double */ - public void addComponent(String name, double value, String unitName, int phaseNumber); + public double getMoleFractionsSum(); /** *- * addComponent. + * getNormalBoilingPointTemperatures. *
* - * @param index Component number to add - * @param moles number of moles (per second) of the component to be added to the fluid + * @return an array of {@link double} objects */ - public void addComponent(int index, double moles); + public double[] getNormalBoilingPointTemperatures(); /** *- * addComponent. + * Get number of components added to System. *
* - * @param index Component number to add - * @param moles number of moles (per second) of the component to be added to the fluid - * @param phaseNumber Number of the phase to add the component to + * @return the number of components in System. */ - public void addComponent(int index, double moles, int phaseNumber); + public int getNumberOfComponents(); /** *
- * removeComponent.
+ * Getter for property numberOfMoles
.
*
- * Getter for property beta
.
- *
- * Gets value for heaviest phase.
+ * getNumberOfOilFractionComponents.
*
- * Getter for property beta
for a specific phase.
+ * Getter for property numberOfPhases
.
*
- * Setter for property beta
. NB! Sets beta = b for first phase and 1-b for second
- * phase, not for multiphase systems.
+ * getOilFractionIDs.
*
- * Setter for property beta
for a given phase.
+ * getOilFractionLiquidDensityAt25C.
*
- * Save System object to file. + * getOilFractionMolecularMass. *
* - * @param name File path to save to. + * @return an array of {@link double} objects */ - public void save(String name); + public double[] getOilFractionMolecularMass(); /** *- * setModel. + * getOilFractionNormalBoilingPoints. *
* - * @param model a {@link java.lang.String} object - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @return an array of {@link double} objects */ - public SystemInterface setModel(String model); + public double[] getOilFractionNormalBoilingPoints(); /** - * method to set mixing rule used for the fluid. + *
+ * Getter for property PC
.
+ *
- * setMixingRule. + * getPhase. *
* - * @param typename a {@link java.lang.String} object - * @param GEmodel a {@link java.lang.String} object + * @param pt a {@link neqsim.thermo.phase.PhaseType} object + * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ - public void setMixingRule(String typename, String GEmodel); + public PhaseInterface getPhase(PhaseType pt); /** *- * normalizeBeta. + * getPhase. *
+ * + * @param phaseTypeName a {@link java.lang.String} object + * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ - public void normalizeBeta(); + public PhaseInterface getPhase(String phaseTypeName); /** - *- * Setter for property initType. - *
+ * method to return phase fraction of selected phase. * - * @param initType a int + * @param phaseTypeName gas/oil/aqueous + * @param unit mole/volume/weight + * @return phase: fraction in specified unit */ - public void setInitType(int initType); + public double getPhaseFraction(String phaseTypeName, String unit); /** *- * checkStability. + * Indexed getter for property phaseIndex. *
* - * @return a boolean + * @param i Phase number + * @return PhaseIndex to index into phaseArray. */ - public boolean checkStability(); + public int getPhaseIndex(int i); /** - *- * checkStability. - *
+ * Get property phaseIndex corresponding to a phase. * - * @param val a boolean + * @param phase Phase object to search for. + * @return PhaseIndex to index into phaseArray. */ - public void checkStability(boolean val); + public int getPhaseIndex(PhaseInterface phase); /** *- * Getter for property hasPlusFraction. + * Get property phaseIndex corresponding to a phase. *
* - * @return a boolean + * @param phaseTypeName a {@link java.lang.String} object + * @return PhaseIndex to index into phaseArray. */ - public boolean hasPlusFraction(); + public int getPhaseIndex(String phaseTypeName); /** *- * Getter for property initType. + * Get phase number of phase of specific type. *
* - * @return a int + * @param pt Phase type to look for. + * @return Phase number */ - public int getInitType(); + public int getPhaseNumberOfPhase(PhaseType pt); /** *- * invertPhaseTypes. + * Get phase number of phase of specific type. * *
- */ - public void invertPhaseTypes(); - - /** - * method to return fluid volume with Peneloux volume correction. * - * @return volume in unit m3 + * @param phaseTypeName Name of phase type to look for + * @return Phase number */ - public double getCorrectedVolume(); + public default int getPhaseNumberOfPhase(String phaseTypeName) { + return getPhaseNumberOfPhase(PhaseType.byDesc(phaseTypeName)); + } /** - *- * readFluid. - *
+ * return the phase of to specified type if the phase does not exist, the method will return null. * - * @param fluidName a {@link java.lang.String} object + * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, hydrate are + * supported) + * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ - public void readFluid(String fluidName); + public PhaseInterface getPhaseOfType(String phaseTypeName); /** *- * calcKIJ. + * getPhases. *
* - * @param ok a boolean + * @return an array of {@link neqsim.thermo.phase.PhaseInterface} objects */ - public void calcKIJ(boolean ok); + public PhaseInterface[] getPhases(); /** - *- * write. - *
+ * method to return pressure. * - * @param name a {@link java.lang.String} object - * @param filename a {@link java.lang.String} object - * @param newfile a boolean + * @return pressure in unit bara */ - public void write(String name, String filename, boolean newfile); + public double getPressure(); /** *- * useVolumeCorrection. + * method to return pressure of phase. *
* - * @param volcor a boolean + * @param phaseNumber Number of the phase to get pressure for + * @return pressure in unit bara */ - public void useVolumeCorrection(boolean volcor); + public double getPressure(int phaseNumber); /** - *- * Getter for property numericDerivatives. - *
+ * method to return pressure in a specified unit. * - * @return a boolean + * @param unit Supported units are bara, barg, Pa and MPa + * @return pressure in specified unit */ - public boolean isNumericDerivatives(); + public double getPressure(String unit); /** - *- * Setter for property numericDerivatives. - *
+ * Get physical properties of System. * - * @param numericDerivatives a boolean + * @return System properties */ - public void setNumericDerivatives(boolean numericDerivatives); + public SystemProperties getProperties(); /** *- * Getter for property info. + * getProperty. *
* - * @return a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object + * @return a double */ - public String getFluidInfo(); + public double getProperty(String prop); /** *- * Setter for property info. . + * getProperty. *
* - * @param info a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object + * @param phase a int + * @return a double */ - public void setFluidInfo(String info); + public double getProperty(String prop, int phase); /** *
- * Indexed setter for property phaseIndex
.
- * this.phaseIndex[index] = phaseIndex;
+ * getProperty.
*
- * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure and temperature
- * from the currently existing phase object at index numb
+ * getResultTable.
*
- * resetDatabase. - *
+ * method to get the speed of sound of a system. The sound speed is implemented based on a molar + * average over the phases + * + * @return speed of sound in m/s */ - public void resetDatabase(); + public double getSoundSpeed(); /** - *- * Setter for property solidPhaseCheck. - *
+ * method to get the speed of sound of a system. The sound speed is implemented based on a molar + * average over the phases * - * @param test a boolean + * @param unit Supported units are m/s, km/h + * @return speed of sound in m/s */ - public void setSolidPhaseCheck(boolean test); + public double getSoundSpeed(String unit); /** *- * setSolidPhaseCheck. + * Getter for property standard. *
* - * @param solidComponent a {@link java.lang.String} object + * @return a {@link neqsim.standards.StandardInterface} object */ - public void setSolidPhaseCheck(String solidComponent); + public neqsim.standards.StandardInterface getStandard(); /** *- * doSolidPhaseCheck. + * Getter for property standard. *
* - * @return a boolean + * @param standardName a {@link java.lang.String} object + * @return a {@link neqsim.standards.StandardInterface} object */ - public boolean doSolidPhaseCheck(); + public neqsim.standards.StandardInterface getStandard(String standardName); /** *
- * Getter for property multiPhaseCheck
.
+ * Getter for property TC
.
*
+ * method to return temperature. + *
* - * @see getInitType + * @param phaseNumber phase to get temperature of + * @return temperature in unit Kelvin */ - public default void init() { - this.init(this.getInitType()); - } + public double getTemperature(int phaseNumber); /** - * method to calculate thermodynamic properties of the fluid. The temperature, pressure, number of - * phases and composition of the phases will be used as basis for calculation. + * method to return temperature in a specified unit. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for all phases. 1: - * Calculation of density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, - * Cp, Cv, and most other thermodynamic properties 3: 1+2 + Calculation of composition - * derivatives of fugacity coefficients. + * @param unit Supported units are K, C, R + * @return temperature in specified unit */ - public void init(int number); + public double getTemperature(String unit); /** - * method to calculate thermodynamic properties of the selected phase. The temperature, pressure, - * number of phases and composition of the phase will be used as basis for calculation. + * method to return conductivity of a fluid. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: Calculation of - * density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, Cp, Cv, and - * most other thermodynamic properties 3: 1+2 + Calculation of composition derivatives of - * fugacity coefficients. - * @param phase a int + * @return conductivity in unit W/mK */ - public void init(int number, int phase); + public double getThermalConductivity(); /** - * Calculates thermodynamic properties of a fluid using the init(2) method. + * method to return thermal conductivity in a specified unit. + * + * @param unit Supported units are W/mK, W/cmK + * @return conductivity in specified unit */ - public default void initThermoProperties() { - init(2); - } + public double getThermalConductivity(String unit); /** - * initNumeric. + * Getter for propertytotalNumberOfMoles
.
+ *
+ * @return Total molar flow rate of fluid in unit mol/sec
*/
- public void initNumeric();
+ public double getTotalNumberOfMoles();
/**
- * - * display. - *
+ * method to return viscosity of a fluid. + * + * @return viscosity in unit kg/msec */ - public default void display() { - display(this.getFluidName()); - } + public double getViscosity(); /** - *- * display. - *
+ * method to return viscosity in a specified unit. * - * @param name a {@link java.lang.String} object + * @param unit Supported units are kg/msec, cP (centipoise), Pas (Pascal*second) + * @return viscosity in specified unit */ - public void display(String name); + public double getViscosity(String unit); /** - * Prints the fluid in a visually appealing way. + * method to return fluid volume. + * + * @return volume in unit m3*1e5 */ - public default void prettyPrint() { - neqsim.thermo.util.readwrite.TablePrinter.printTable(createTable(getFluidName())); - } + public double getVolume(); /** - *- * addFluid. - *
+ * method to return fluid volume. * - * @param addSystem a {@link neqsim.thermo.system.SystemInterface} object - * @return SystemInterface + * @param unit Supported units are m3, litre, m3/kg, m3/mol + * @return volume in specified unit */ - public SystemInterface addFluid(SystemInterface addSystem); + public double getVolume(String unit); /** - *- * addFluid. - *
+ * method to return the volume fraction of a phase note: without Peneloux volume correction. * - * @param addSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param phase phase number of phase to add fluid to - * @return SystemInterface + * @param phaseNumber number of the phase to get volume fraction for + * @return volume fraction */ - public SystemInterface addFluid(SystemInterface addSystem, int phase); + public double getVolumeFraction(int phaseNumber); /** *- * Getter for property hydrateCheck. + * getWaxCharacterisation. *
* - * @return a boolean + * @return a {@link neqsim.thermo.characterization.WaxCharacterise} object */ - public boolean getHydrateCheck(); + public neqsim.thermo.characterization.WaxCharacterise getWaxCharacterisation(); /** *- * createTable. + * getWaxModel. *
* - * @param name a {@link java.lang.String} object - * @return an array of {@link java.lang.String} objects + * @return a {@link neqsim.thermo.characterization.WaxModelInterface} object */ - public String[][] createTable(String name); + public WaxModelInterface getWaxModel(); /** *- * setHydrateCheck. + * getWtFraction. *
* - * @param hydrateCheck a boolean + * @param phaseNumber a int + * @return a double */ - public void setHydrateCheck(boolean hydrateCheck); + public double getWtFraction(int phaseNumber); /** - *- * calcBeta. For simple gas liquid systems. - *
+ * method to return compressibility factor of a fluid compressibility factor is defined in EoS + * from PV=ZnRT where V is total volume of fluid. * - * @return Beta Mole fraction contained in the heaviest phase, i.e., liquid phase. - * @throws neqsim.util.exception.IsNaNException if any. - * @throws neqsim.util.exception.TooManyIterationsException if any. + * @return compressibility factor Z */ - public double calcBeta() - throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException; + public double getZ(); + + /** {@inheritDoc} */ + @Override + public int hashCode(); /** - *- * setAllComponentsInPhase. - *
+ * Verify if system has a phase of a specific type. * - * @param phase a int + * @param pt PhaseType to look for + * @return True if system contains a phase of requested type */ - public void setAllComponentsInPhase(int phase); + public boolean hasPhaseType(PhaseType pt); /** - *- * initTotalNumberOfMoles. - *
+ * Verify if system has a phase of a specific type. * - * @param change a double + * @param phaseTypeName PhaseType to look for + * @return True if system contains a phase of requested type */ - public void initTotalNumberOfMoles(double change); + public default boolean hasPhaseType(String phaseTypeName) { + return hasPhaseType(PhaseType.byDesc(phaseTypeName)); + } /** *- * calc_x_y. + * Getter for property hasPlusFraction. *
+ * + * @return a boolean */ - public void calc_x_y(); + public boolean hasPlusFraction(); /** *- * reset_x_y. + * hasSolidPhase. *
+ * + * @return True if system contains a solid phase */ - public void reset_x_y(); - - /** - * Add phase to SystemInterface object. - */ - public void addPhase(); + public default boolean hasSolidPhase() { + return hasPhaseType(PhaseType.SOLID); // || hasPhaseType(PhaseType.SOLIDCOMPLEX); + } /** - *- * setAttractiveTerm. - *
+ * Calculate thermodynamic properties of the fluid using the init type set in fluid. * - * @param i a int + * @see getInitType */ - public void setAttractiveTerm(int i); + public default void init() { + this.init(this.getInitType()); + } /** - *- * removePhase. - *
+ * method to calculate thermodynamic properties of the fluid. The temperature, pressure, number of + * phases and composition of the phases will be used as basis for calculation. * - * @param specPhase a int + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for all phases. 1: + * Calculation of density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, + * Cp, Cv, and most other thermodynamic properties 3: 1+2 + Calculation of composition + * derivatives of fugacity coefficients. */ - public void removePhase(int specPhase); + public void init(int number); // public void setPressure(double newPressure, int phaseNumber); /** - * method to return pressure. - * - * @return pressure in unit bara - */ - public double getPressure(); - - /** - * method to return pressure in a specified unit. + * method to calculate thermodynamic properties of the selected phase. The temperature, pressure, + * number of phases and composition of the phase will be used as basis for calculation. * - * @param unit Supported units are bara, barg, Pa and MPa - * @return pressure in specified unit + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: Calculation of + * density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, Cp, Cv, and + * most other thermodynamic properties 3: 1+2 + Calculation of composition derivatives of + * fugacity coefficients. + * @param phase a int */ - public double getPressure(String unit); + public void init(int number, int phase); /** *- * method to return pressure of phase. + * init_x_y. *
- * - * @param phaseNumber Number of the phase to get pressure for - * @return pressure in unit bara */ - public double getPressure(int phaseNumber); + public void init_x_y(); /** *- * reInitPhaseType. + * Calculate system beta values using Phase.getNumberOfMolesInPhase and getTotalNumberOfMoles. *
*/ - public void reInitPhaseType(); + public void initBeta(); /** - * Set the physical property model type for each phase of the System. + * initNumeric. + */ + public void initNumeric(); + + /** + * Init physical properties for all phases and interfaces. + */ + public void initPhysicalProperties(); + + /** + * Calculates physical properties of type propertyName. * - * @param type 0 Orginal/default 1 Water 2 Glycol 3 Amine 4 CO2Water 6 Basic + * @param propertyName a {@link java.lang.String} object */ - public void setPhysicalPropertyModel(int type); + public void initPhysicalProperties(String propertyName); + + /** + * Calculates thermodynamic and physical properties of a fluid using initThermoProperties() and + * initPhysicalProperties(). + */ + public void initProperties(); /** *- * clearAll. + * initRefPhases. *
*/ - public void clearAll(); + public void initRefPhases(); /** - * method to get density of a fluid note: without Peneloux volume correction. - * - * @return density with unit kg/m3 + * Calculates thermodynamic properties of a fluid using the init(2) method. */ - public double getDensity(); + public default void initThermoProperties() { + init(2); + } /** - * method to get density of a fluid note: with Peneloux volume correction. + *+ * initTotalNumberOfMoles. + *
* - * @param unit Supported units are kg/m3, mol/m3 - * @return density in specified unit + * @param change a double */ - public double getDensity(String unit); + public void initTotalNumberOfMoles(double change); /** *- * getChemicalReactionOperations. + * invertPhaseTypes. *
- * - * @return a {@link neqsim.chemicalReactions.ChemicalReactionOperations} object */ - public ChemicalReactionOperations getChemicalReactionOperations(); + public void invertPhaseTypes(); /** *@@ -1773,406 +1775,402 @@ public double calcBeta() public void isChemicalSystem(boolean temp); /** - * method to return molar volume of the fluid note: without Peneloux volume correction. - * - * @return molar volume volume in unit m3/mol*1e5 - */ - public double getMolarVolume(); - - /** - * method to return molar volume of the fluid: eventual volume correction included. - * - * @param unit Supported units are m3/mol, litre/mol + *
+ * isForcePhaseTypes. + *
* - * @return molar volume volume in unit + * @return a boolean */ - public double getMolarVolume(String unit); + public boolean isForcePhaseTypes(); /** - * Get molar mass of system. + *+ * isImplementedCompositionDeriativesofFugacity. + *
* - * @return molar mass in unit kg/mol + * @return a boolean */ - public double getMolarMass(); + public boolean isImplementedCompositionDeriativesofFugacity(); /** - * method to get molar mass of a fluid phase. + *+ * isImplementedCompositionDeriativesofFugacity. + *
* - * @param unit Supported units are kg/mol, gr/mol - * @return molar mass in specified unit + * @param isImpl a boolean */ - public double getMolarMass(String unit); + public void isImplementedCompositionDeriativesofFugacity(boolean isImpl); /** - * method to get the total enthalpy of a fluid. + *+ * isImplementedPressureDeriativesofFugacity. + *
* - * @return molar mass in unit J (Joule) + * @return a boolean */ - public double getEnthalpy(); + public boolean isImplementedPressureDeriativesofFugacity(); /** - * method to return total enthalpy in a specified unit. + *+ * isImplementedTemperatureDeriativesofFugacity. + *
* - * @param unit Supported units are 'J', 'J/mol', 'kJ/kmol', 'J/kg' and 'kJ/kg' - * @return enthalpy in specified unit + * @return a boolean */ - public double getEnthalpy(String unit); + public boolean isImplementedTemperatureDeriativesofFugacity(); /** *- * calcInterfaceProperties. + * isMultiphaseWaxCheck. *
+ * + * @return a boolean */ - public void calcInterfaceProperties(); + public boolean isMultiphaseWaxCheck(); /** *- * getInterphaseProperties. + * Getter for property numericDerivatives. *
* - * @return a {@link neqsim.physicalProperties.interfaceProperties.InterphasePropertiesInterface} - * object + * @return a boolean */ - public InterphasePropertiesInterface getInterphaseProperties(); + public boolean isNumericDerivatives(); /** - *- * Calculate system beta values using Phase.getNumberOfMolesInPhase and getTotalNumberOfMoles. - *
+ * Returns true if phase exists and is not null. + * + * @param i Phase number + * @return True if phase exists, false if not. */ - public void initBeta(); + public boolean isPhase(int i); /** *- * init_x_y. + * normalizeBeta. *
*/ - public void init_x_y(); + public void normalizeBeta(); /** - * method to return total entropy of the fluid. - * - * @return entropy in unit J/K (Joule/Kelvin) + * Order phases by density. */ - public double getEntropy(); + public void orderByDensity(); /** - * method to return total entropy of the fluid. + *+ * phaseToSystem. + *
* - * @param unit unit supported units are J/K, J/molK, J/kgK and kJ/kgK - * @return entropy in specified unit + * @param phaseNumber a int + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public double getEntropy(String unit); + public SystemInterface phaseToSystem(int phaseNumber); /** - * method to return temperature. + *+ * phaseToSystem. + *
* - * @return temperature in unit Kelvin + * @param phaseNumber1 a int + * @param phaseNumber2 a int + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public double getTemperature(); + public SystemInterface phaseToSystem(int phaseNumber1, int phaseNumber2); /** - * method to return temperature in a specified unit. + *+ * phaseToSystem. + *
* - * @param unit Supported units are K, C, R - * @return temperature in specified unit + * @param newPhase a {@link neqsim.thermo.phase.PhaseInterface} object + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public double getTemperature(String unit); + public SystemInterface phaseToSystem(PhaseInterface newPhase); /** *- * method to return temperature. + * phaseToSystem. *
* - * @param phaseNumber phase to get temperature of - * @return temperature in unit Kelvin + * @param phaseName a {@link java.lang.String} object + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public double getTemperature(int phaseNumber); + public SystemInterface phaseToSystem(String phaseName); /** - *- * chemicalReactionInit. - *
+ * Prints the fluid in a visually appealing way. */ - public void chemicalReactionInit(); + public default void prettyPrint() { + neqsim.thermo.util.readwrite.TablePrinter.printTable(createTable(getFluidName())); + } /** - * Change the phase type of a given phase. + *+ * readFluid. + *
* - * @param phaseToChange the phase number of the phase to set phase type - * @param pt PhaseType to set + * @param fluidName a {@link java.lang.String} object */ - public void setPhaseType(int phaseToChange, PhaseType pt); + public void readFluid(String fluidName); /** - * Set phase type of all phases. + *+ * readObject. + *
* - * @param pt PhaseType to set phases as. + * @param ID a int + * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public void setAllPhaseType(PhaseType pt); + public SystemInterface readObject(int ID); /** *
- * Getter for property TC
.
+ * readObjectFromFile.
*
- * Getter for property TC
.
+ * reInitPhaseType.
*
- * Getter for property PC
.
+ * removeComponent.
*
- * Getter for property PC
.
+ * removePhase.
*
- * getPhases. + * removePhaseKeepTotalComposition. *
* - * @return an array of {@link neqsim.thermo.phase.PhaseInterface} objects + * @param specPhase a int */ - public PhaseInterface[] getPhases(); + public void removePhaseKeepTotalComposition(int specPhase); /** *
- * Getter for property numberOfPhases
.
+ * renameComponent.
*
- * Setter for property numberOfPhases
.
+ * replacePhase.
*
- * Getter for property maxNumberOfPhases
.
- *
- * Setter for property maxNumberOfPhases
.
+ * reset_x_y.
*
- * getGibbsEnergy. + * resetCharacterisation. *
- * - * @return a double */ - public double getGibbsEnergy(); + public void resetCharacterisation(); /** *- * getHelmholtzEnergy. + * resetDatabase. *
- * - * @return a double */ - public double getHelmholtzEnergy(); + public void resetDatabase(); /** *
- * Getter for property componentNames
.
+ * resetPhysicalProperties.
*
- * Get component by name. + * Save System object to file. *
* - * @param name Name of component - * @return a {@link neqsim.thermo.component.ComponentInterface} object + * @param name File path to save to. */ - public default ComponentInterface getComponent(String name) { - return getPhase(0).getComponent(name); - } + public void save(String name); /** *- * Get component by index. + * saveFluid. *
* - * @param i Component index - * @return a {@link neqsim.thermo.component.ComponentInterface} object + * @param id a int */ - public default ComponentInterface getComponent(int i) { - return getPhase(0).getComponent(i); - } + public void saveFluid(int id); /** *- * clone. + * saveFluid. *
* - * @return a {@link neqsim.thermo.system.SystemInterface} object + * @param id a int + * @param text a {@link java.lang.String} object */ - public SystemInterface clone(); + public void saveFluid(int id, String text); /** *- * getdVdPtn. + * saveObject. *
* - * @return a double + * @param ID a int + * @param text a {@link java.lang.String} object */ - public double getdVdPtn(); + public void saveObject(int ID, String text); /** *- * getdVdTpn. + * saveObjectToFile. *
* - * @return a double + * @param filePath a {@link java.lang.String} object + * @param fluidName a {@link java.lang.String} object */ - public double getdVdTpn(); + public void saveObjectToFile(String filePath, String fluidName); /** - * method to return specific heat capacity (Cp). - * - * @return Cp in unit J/K + *+ * saveToDataBase. + *
*/ - public double getCp(); + public void saveToDataBase(); /** - * method to return specific heat capacity (Cp) in a specified unit. + *+ * setAllComponentsInPhase. + *
* - * @param unit Supported units are J/K, J/molK, J/kgK and kJ/kgK - * @return Cp in specified unit + * @param phase a int */ - public double getCp(String unit); + public void setAllComponentsInPhase(int phase); /** - * method to return heat capacity ratio/adiabatic index/Poisson constant. + * Set phase type of all phases. * - * @return kappa + * @param pt PhaseType to set phases as. */ - public double getKappa(); + public void setAllPhaseType(PhaseType pt); /** *- * replacePhase. + * setAttractiveTerm. *
* - * @param repPhase a int - * @param newPhase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param i a int */ - public void replacePhase(int repPhase, PhaseInterface newPhase); + public void setAttractiveTerm(int i); /** *
- * getGasPhase.
+ * Setter for property beta
. NB! Sets beta = b for first phase and 1-b for second
+ * phase, not for multiphase systems.
*
- * getLiquidPhase.
+ * Setter for property beta
for a given phase.
*
+ * setBmixType. + *
* - * @return viscosity in unit kg/msec + * @param bmixType a int */ - public double getViscosity(); + public void setBmixType(int bmixType); /** - * method to return viscosity in a specified unit. + *+ * setComponentNames. + *
* - * @param unit Supported units are kg/msec, cP (centipoise), Pas (Pascal*second) - * @return viscosity in specified unit + * @param componentNames an array of {@link java.lang.String} objects */ - public double getViscosity(String unit); + public void setComponentNames(String[] componentNames); /** - * method to return conductivity of a fluid. + *+ * setComponentNameTag. + *
* - * @return conductivity in unit W/mK + * @param nameTag a {@link java.lang.String} object */ - public double getThermalConductivity(); + public void setComponentNameTag(String nameTag); /** - * method to return thermal conductivity in a specified unit. + *+ * setComponentNameTagOnNormalComponents. + *
* - * @param unit Supported units are W/mK, W/cmK - * @return conductivity in specified unit + * @param nameTag a {@link java.lang.String} object */ - public double getThermalConductivity(String unit); + public void setComponentNameTagOnNormalComponents(String nameTag); /** - *- * initRefPhases. - *
+ * Set the flow rate (moles) of all components to zero. */ - public void initRefPhases(); + public void setEmptyFluid(); /** *- * getFluidName. + * Setter for property info. . *
* - * @return a {@link java.lang.String} object + * @param info a {@link java.lang.String} object */ - public String getFluidName(); + public void setFluidInfo(String info); /** *@@ -2185,372 +2183,374 @@ public default ComponentInterface getComponent(int i) { /** *
- * Getter for property allowPhaseShift. + * setForcePhaseTypes. *
* - * @return a boolean + * @param forcePhaseTypes a boolean */ - public boolean allowPhaseShift(); + public void setForcePhaseTypes(boolean forcePhaseTypes); /** *- * Setter for property allowPhaseShift. + * setHeavyTBPfractionAsPlusFraction. *
* - * @param allowPhaseShift a boolean - */ - public void allowPhaseShift(boolean allowPhaseShift); - - /** - * method to return phase fraction of selected phase. - * - * @param phaseTypeName gas/oil/aqueous - * @param unit mole/volume/weight - * @return phase: fraction in specified unit + * @return a boolean */ - public double getPhaseFraction(String phaseTypeName, String unit); + public boolean setHeavyTBPfractionAsPlusFraction(); /** *- * getProperty. + * setHydrateCheck. *
* - * @param prop a {@link java.lang.String} object - * @param compName a {@link java.lang.String} object - * @param phase a int - * @return a double + * @param hydrateCheck a boolean */ - public double getProperty(String prop, String compName, int phase); + public void setHydrateCheck(boolean hydrateCheck); /** *- * getProperty. + * setImplementedCompositionDeriativesofFugacity. *
* - * @param prop a {@link java.lang.String} object - * @param phase a int - * @return a double + * @param implementedCompositionDeriativesofFugacity a boolean */ - public double getProperty(String prop, int phase); + public void setImplementedCompositionDeriativesofFugacity( + boolean implementedCompositionDeriativesofFugacity); /** *- * getProperty. + * setImplementedPressureDeriativesofFugacity. *
* - * @param prop a {@link java.lang.String} object - * @return a double + * @param implementedPressureDeriativesofFugacity a boolean */ - public double getProperty(String prop); + public void setImplementedPressureDeriativesofFugacity( + boolean implementedPressureDeriativesofFugacity); /** *- * Getter for property standard. + * setImplementedTemperatureDeriativesofFugacity. *
* - * @return a {@link neqsim.standards.StandardInterface} object + * @param implementedTemperatureDeriativesofFugacity a boolean */ - public neqsim.standards.StandardInterface getStandard(); + public void setImplementedTemperatureDeriativesofFugacity( + boolean implementedTemperatureDeriativesofFugacity); /** *- * Getter for property standard. + * Setter for property initType. *
* - * @param standardName a {@link java.lang.String} object - * @return a {@link neqsim.standards.StandardInterface} object + * @param initType a int */ - public neqsim.standards.StandardInterface getStandard(String standardName); + public void setInitType(int initType); /** *
- * Setter for property standard.
+ * Setter for property maxNumberOfPhases
.
*
- * saveToDataBase. - *
+ * method to set mixing rule used for the fluid. + * + * @param type The type of mixing rule to be used for the fluid. 1 - classic mixing rule with all + * kij set to zero 2 -classic mixing rule with kij from NeqSim database 3- classic mixing + * rule with temperature dependent kij 4- Huron Vidal mixing rule with parameters from + * NeqSim database 7 -classic mixing rule with kij of CPA from NeqSim Database 9 + * -classicmixing rule with temperature dependent kij of CPA from NeqSim database + * 10-classic mixing rule with temperature and composition dependent kij of CPA from NeqSim + * database */ - public void saveToDataBase(); + public void setMixingRule(int type); /** - *- * getMixingRule. - *
+ * method to set the mixing rule for the fluid. * - * @return a int + * @param typename a {@link java.lang.String} object */ - public int getMixingRule(); + public void setMixingRule(String typename); /** *- * getResultTable. + * setMixingRule. *
* - * @return an array of {@link java.lang.String} objects + * @param typename a {@link java.lang.String} object + * @param GEmodel a {@link java.lang.String} object */ - public String[][] getResultTable(); + public void setMixingRule(String typename, String GEmodel); /** *- * autoSelectModel. + * setModel. *
* + * @param model a {@link java.lang.String} object * @return a {@link neqsim.thermo.system.SystemInterface} object */ - public SystemInterface autoSelectModel(); + public SystemInterface setModel(String model); /** *- * autoSelectMixingRule. + * This method is used to set the total molar composition of a fluid. The total flow rate will be + * kept constant. The input mole fractions will be normalized. *
+ * + * @param moles an array of {@link double} objects */ - public void autoSelectMixingRule(); + public void setMolarComposition(double[] moles); /** - * Order phases by density. + * This method is used to set the total molar composition of a characterized fluid. The total flow + * rate will be kept constant. The input mole fractions will be normalized. + * + * @param molefractions is a double array taking the molar fraction of the components in the + * fluid. THe last fraction in the array is the total molefraction of the characterized + * components. */ - public void orderByDensity(); + public void setMolarCompositionOfPlusFluid(double[] molefractions); /** - *- * addLiquidToGas. - *
+ * This method is used to set the total molar composition of a plus fluid. The total flow rate + * will be kept constant. The input mole fractions will be normalized. * - * @param fraction a double + * @param molefractions is a double array taking the molar fraction of the components in the + * fluid. THe last molfraction is the mole fraction of the plus component */ - public void addLiquidToGas(double fraction); + public void setMolarCompositionPlus(double[] molefractions); /** *- * addGasToLiquid. + * setMolarFlowRates. *
* - * @param fraction a double + * @param moles an array of {@link double} objects */ - public void addGasToLiquid(double fraction); + public void setMolarFlowRates(double[] moles); /** - * Getter for propertytotalNumberOfMoles
.
+ * method to specify if calculations should check for more than two fluid phases.
*
- * @return Total molar flow rate of fluid in unit mol/sec
+ * @param doMultiPhaseCheck Specify if the calculations should check for more than two fluid
+ * phases. Default is two fluid phases (gas and liquid). If set to true the program will
+ * check for gas and multiple liquid phases (eg. gas-oil-aqueous).
*/
- public double getTotalNumberOfMoles();
+ public void setMultiPhaseCheck(boolean doMultiPhaseCheck);
/**
*
- * Getter for property numberOfMoles
.
+ * setMultiphaseWaxCheck.
*
- * Setter for property totalNumberOfMoles
.
+ * Setter for property numberOfPhases
.
*
- * Get phase number of phase of specific type. + * Setter for property numericDerivatives. *
* - * @param pt Phase type to look for. - * @return Phase number + * @param numericDerivatives a boolean */ - public int getPhaseNumberOfPhase(PhaseType pt); + public void setNumericDerivatives(boolean numericDerivatives); /** *
- * Get phase number of phase of specific type. *
+ * Getter for property PC
.
*
- * getEmptySystemClone.
+ * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure and temperature
+ * from the currently existing phase object at index numb
*
- * calcHenrysConstant.
+ * Indexed setter for property phaseIndex
.
+ * this.phaseIndex[index] = phaseIndex;
*
- * isImplementedTemperatureDeriativesofFugacity. - *
+ * Change the phase type of a given phase. * - * @return a boolean + * @param phaseToChange the phase number of the phase to set phase type + * @param pt PhaseType to set */ - public boolean isImplementedTemperatureDeriativesofFugacity(); + public void setPhaseType(int phaseToChange, PhaseType pt); /** - *- * setImplementedTemperatureDeriativesofFugacity. - *
+ * Set the physical property model type for each phase of the System. * - * @param implementedTemperatureDeriativesofFugacity a boolean + * @param type 0 Orginal/default 1 Water 2 Glycol 3 Amine 4 CO2Water 6 Basic */ - public void setImplementedTemperatureDeriativesofFugacity( - boolean implementedTemperatureDeriativesofFugacity); + public void setPhysicalPropertyModel(int type); + + /** + * method to set the pressure of a fluid (same pressure for all phases). + * + * @param pres pressure in unit bara (absolute pressure in bar) + */ + public void setPressure(double pres); + + /** + * method to set the pressure of a fluid (same pressure for all phases). + * + * @param newPressure in specified unit + * @param unit unit can be bar, bara, barg or atm + */ + public void setPressure(double newPressure, String unit); /** *- * isImplementedPressureDeriativesofFugacity. + * Setter for property solidPhaseCheck. *
* - * @return a boolean + * @param test a boolean */ - public boolean isImplementedPressureDeriativesofFugacity(); + public void setSolidPhaseCheck(boolean test); /** *- * setImplementedPressureDeriativesofFugacity. + * setSolidPhaseCheck. *
* - * @param implementedPressureDeriativesofFugacity a boolean + * @param solidComponent a {@link java.lang.String} object */ - public void setImplementedPressureDeriativesofFugacity( - boolean implementedPressureDeriativesofFugacity); + public void setSolidPhaseCheck(String solidComponent); /** *- * isImplementedCompositionDeriativesofFugacity. + * Setter for property standard. *
* - * @return a boolean + * @param standardName a {@link java.lang.String} object */ - public boolean isImplementedCompositionDeriativesofFugacity(); + public void setStandard(String standardName); /** *
- * isImplementedCompositionDeriativesofFugacity.
+ * Getter for property TC
.
*
- * setImplementedCompositionDeriativesofFugacity. + * method to set the temperature of a fluid (same temperature for all phases). *
* - * @param implementedCompositionDeriativesofFugacity a boolean + * @param temp a double */ - public void setImplementedCompositionDeriativesofFugacity( - boolean implementedCompositionDeriativesofFugacity); + public void setTemperature(double temp); /** *- * addCapeOpenProperty. + * setTemperature. *
* - * @param propertyName a {@link java.lang.String} object + * @param newTemperature a double + * @param phaseNumber a int */ - public void addCapeOpenProperty(String propertyName); + public void setTemperature(double newTemperature, int phaseNumber); /** - * Get physical properties of System. + * method to set the temperature of a fluid (same temperature for all phases). * - * @return System properties + * @param newTemperature in specified unit + * @param unit unit can be C or K (Celsius or Kelvin) */ - public SystemProperties getProperties(); - - /** {@inheritDoc} */ - @Override - public boolean equals(Object o); + public void setTemperature(double newTemperature, String unit); - /** {@inheritDoc} */ - @Override - public int hashCode(); + /** + *+ * setTotalFlowRate. + *
+ * + * @param flowRate a double + * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, kg/min, kg/hr + * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, Sm3/day, idSm3/hr, idSm3/day + */ + public void setTotalFlowRate(double flowRate, String flowunit); /** - * Add to component names. + *
+ * Setter for property totalNumberOfMoles
.
+ *
- * addCharacterized. + * setUseTVasIndependentVariables. *
* - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects - * @param lastIsPlusFraction True if last fraction is a Plus fraction + * @param useTVasIndependentVariables a boolean */ - public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, - double[] relativedensity, boolean lastIsPlusFraction); + public void setUseTVasIndependentVariables(boolean useTVasIndependentVariables); /** *- * addCharacterized. + * tuneModel. *
* - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects - * @param lastIsPlusFraction True if last fraction is a Plus fraction - * @param lumpComponents True if component should be lumped - * @param numberOfPseudoComponents number of pseudo components + * @param model a {@link java.lang.String} object + * @param val a double + * @param phase a int */ - public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, - double[] relativedensity, boolean lastIsPlusFraction, boolean lumpComponents, - int numberOfPseudoComponents); + public void tuneModel(String model, double val, int phase); /** *- * addCharacterized. + * useVolumeCorrection. *
* - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects + * @param volcor a boolean */ - public void addCharacterized(String[] charNames, double[] charFlowrate, double[] molarMass, - double[] relativedensity); + public void useVolumeCorrection(boolean volcor); /** - * Get ideal liquid density of fluid in given unit. + *+ * write. + *
* - * @param unit {@link java.lang.String} Supported units are kg/m3 and gr/cm3 - * @return a double + * @param name a {@link java.lang.String} object + * @param filename a {@link java.lang.String} object + * @param newfile a boolean */ - public double getIdealLiquidDensity(String unit); + public void write(String name, String filename, boolean newfile); } diff --git a/src/main/java/neqsim/thermo/system/SystemPCSAFT.java b/src/main/java/neqsim/thermo/system/SystemPCSAFT.java index 32bdc2f5a7..83fecbbf86 100644 --- a/src/main/java/neqsim/thermo/system/SystemPCSAFT.java +++ b/src/main/java/neqsim/thermo/system/SystemPCSAFT.java @@ -13,8 +13,8 @@ * @version $Id: $Id */ public class SystemPCSAFT extends SystemSrkEos { - private static final long serialVersionUID = 1000; static Logger logger = LogManager.getLogger(SystemPCSAFT.class); + private static final long serialVersionUID = 1000; /** *@@ -76,19 +76,6 @@ public SystemPCSAFT(double T, double P, boolean checkForSolids) { this.useVolumeCorrection(false); } - /** {@inheritDoc} */ - @Override - public SystemPCSAFT clone() { - SystemPCSAFT clonedSystem = null; - try { - clonedSystem = (SystemPCSAFT) super.clone(); - } catch (Exception ex) { - logger.error("Cloning failed.", ex); - } - - return clonedSystem; - } - /** {@inheritDoc} */ @Override public void addTBPfraction(String componentName2, double numberOfMoles, double molarMass, @@ -114,6 +101,19 @@ public void addTBPfraction(String componentName2, double numberOfMoles, double m } } + /** {@inheritDoc} */ + @Override + public SystemPCSAFT clone() { + SystemPCSAFT clonedSystem = null; + try { + clonedSystem = (SystemPCSAFT) super.clone(); + } catch (Exception ex) { + logger.error("Cloning failed.", ex); + } + + return clonedSystem; + } + /** *
* commonInitialization.
diff --git a/src/main/java/neqsim/thermo/system/SystemProperties.java b/src/main/java/neqsim/thermo/system/SystemProperties.java
index 3a7f2858ff..d1f8b06a6a 100644
--- a/src/main/java/neqsim/thermo/system/SystemProperties.java
+++ b/src/main/java/neqsim/thermo/system/SystemProperties.java
@@ -11,10 +11,20 @@
* @version $Id: $Id
*/
public class SystemProperties {
- private Double[] values;
- private String[] names;
/** Constant
@@ -173,69 +173,308 @@ public SystemThermo(double T, double P, boolean checkForSolids) {
/** {@inheritDoc} */
@Override
- public int getNumberOfComponents() {
- return getComponentNames().length;
+ public void addCapeOpenProperty(String propertyName) {
+ String[] tempString = new String[CapeOpenProperties11.length + 1];
+ System.arraycopy(CapeOpenProperties11, 0, tempString, 0, CapeOpenProperties11.length);
+ tempString[CapeOpenProperties11.length] = propertyName;
+ CapeOpenProperties11 = tempString;
+
+ tempString = new String[CapeOpenProperties10.length + 1];
+ System.arraycopy(CapeOpenProperties10, 0, tempString, 0, CapeOpenProperties10.length);
+ tempString[CapeOpenProperties10.length] = propertyName;
+ CapeOpenProperties10 = tempString;
}
/** {@inheritDoc} */
@Override
- public void clearAll() {
- setTotalNumberOfMoles(0);
- phaseType[0] = PhaseType.byValue(1);
- phaseType[1] = PhaseType.byValue(0);
- numberOfComponents = 0;
- setNumberOfPhases(2);
- beta[0] = 1.0;
- beta[1] = 1.0;
- beta[2] = 1.0;
- beta[3] = 1.0;
- beta[4] = 1.0;
- beta[5] = 1.0;
- chemicalSystem = false;
-
- double oldTemp = phaseArray[0].getTemperature();
- double oldPres = phaseArray[0].getPressure();
+ public void addCharacterized(String[] charNames, double[] charFlowrate, double[] molarMass,
+ double[] relativedensity) {
+ if (charNames.length != charFlowrate.length) {
+ logger.error("component names and mole fractions need to be same length...");
+ }
+ for (int i = 0; i < charNames.length; i++) {
+ addTBPfraction(charNames[i], charFlowrate[i], molarMass[i], relativedensity[i]);
+ }
+ }
- for (int i = 0; i < getMaxNumberOfPhases(); i++) {
- try {
- phaseArray[i] = phaseArray[i].getClass().getDeclaredConstructor().newInstance();
- } catch (Exception ex) {
- logger.error("err ", ex);
+ /** {@inheritDoc} */
+ @Override
+ public void addComponent(ComponentInterface inComponent) {
+ if (inComponent.isIsTBPfraction()) {
+ addTBPfraction(inComponent.getComponentName(), inComponent.getNumberOfmoles(),
+ inComponent.getMolarMass(), inComponent.getNormalLiquidDensity());
+ String componentName = inComponent.getComponentName();
+ changeComponentName(componentName + "_PC", componentName.replaceFirst("_PC", ""));
+ for (int i = 0; i < numberOfPhases; i++) {
+ getPhase(i).getComponent(componentName)
+ .setAttractiveTerm(inComponent.getAttractiveTermNumber());
+ getPhase(i).getComponent(componentName).setTC(inComponent.getTC());
+ getPhase(i).getComponent(componentName).setPC(inComponent.getPC());
+ getPhase(i).getComponent(componentName).setMolarMass(inComponent.getMolarMass());
+ getPhase(i).getComponent(componentName).setComponentType("TBPfraction");
+ getPhase(i).getComponent(componentName)
+ .setNormalLiquidDensity(inComponent.getNormalLiquidDensity());
+ getPhase(i).getComponent(componentName)
+ .setNormalBoilingPoint(inComponent.getNormalBoilingPoint());
+ getPhase(i).getComponent(componentName).setAcentricFactor(inComponent.getAcentricFactor());
+ getPhase(i).getComponent(componentName).setCriticalVolume(inComponent.getCriticalVolume());
+ getPhase(i).getComponent(componentName).setRacketZ(inComponent.getRacketZ());
+ getPhase(i).getComponent(componentName).setRacketZCPA(inComponent.getRacketZCPA());
+ getPhase(i).getComponent(componentName).setIsTBPfraction(true);
+ getPhase(i).getComponent(componentName)
+ .setParachorParameter(inComponent.getParachorParameter());
+ getPhase(i).getComponent(componentName)
+ .setTriplePointTemperature(inComponent.getTriplePointTemperature());
+ getPhase(i).getComponent(componentName)
+ .setIdealGasEnthalpyOfFormation(inComponent.getIdealGasEnthalpyOfFormation());
+ getPhase(i).getComponent(componentName).setCpA(inComponent.getCpA());
+ getPhase(i).getComponent(componentName).setCpB(inComponent.getCpB());
+ getPhase(i).getComponent(componentName).setCpC(inComponent.getCpC());
+ getPhase(i).getComponent(componentName).setCpD(inComponent.getCpD());
}
- phaseArray[i].setTemperature(oldTemp);
- phaseArray[i].setPressure(oldPres);
+ } else {
+ addComponent(inComponent.getComponentName(), inComponent.getNumberOfmoles());
}
}
/** {@inheritDoc} */
@Override
- public void resetCharacterisation() {
- int numberOfLumpedComps = characterization.getLumpingModel().getNumberOfLumpedComponents();
- characterization = new Characterise(this);
- characterization.getLumpingModel().setNumberOfLumpedComponents(numberOfLumpedComps);
+ public void addComponent(int index, double moles) {
+ if (index >= getPhase(0).getNumberOfComponents()) {
+ logger.error("componentIndex higher than number of components in system");
+ return;
+ }
+
+ for (PhaseInterface tmpPhase : phaseArray) {
+ // TODO: adding moles to all phases, not just the active ones.
+ if (tmpPhase != null) {
+ tmpPhase.addMolesChemReac(index, moles, moles);
+ }
+ }
+ setTotalNumberOfMoles(getTotalNumberOfMoles() + moles);
}
/** {@inheritDoc} */
@Override
- public SystemInterface addFluid(SystemInterface addSystem) {
- boolean addedNewComponent = false;
- int index = -1;
- for (int i = 0; i < addSystem.getPhase(0).getNumberOfComponents(); i++) {
- if (!getPhase(0).hasComponent(addSystem.getPhase(0).getComponent(i).getComponentName())) {
- index = -1;
- addedNewComponent = true;
+ public void addComponent(int index, double moles, int phaseNumber) {
+ if (index >= getPhase(0).getNumberOfComponents()) {
+ logger.error("componentIndex higher than number of components in system");
+ return;
+ }
+ double k = 1.0;
+
+ for (int i = 0; i < getMaxNumberOfPhases(); i++) {
+ if (phaseNumber == i) {
+ k = 1.0;
} else {
- index = getPhase(0).getComponent(addSystem.getPhase(0).getComponent(i).getComponentName())
- .getComponentNumber();
+ k = 0.0;
}
+ phaseArray[phaseIndex[i]].addMolesChemReac(index, moles * k, moles);
+ }
- if (index != -1) {
- addComponent(index, addSystem.getPhase(0).getComponent(i).getNumberOfmoles());
- } else if (addSystem.getPhase(0).getComponent(i).isIsTBPfraction()) {
- addTBPfraction(
- addSystem.getPhase(0).getComponent(i).getComponentName().replaceFirst("_PC", ""),
- addSystem.getPhase(0).getComponent(i).getNumberOfmoles(),
- addSystem.getPhase(0).getComponent(i).getMolarMass(),
+ setTotalNumberOfMoles(getTotalNumberOfMoles() + moles);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addComponent(String componentName, double moles) {
+ componentName = ComponentInterface.getComponentNameFromAlias(componentName);
+
+ int index = 0;
+
+ boolean addForFirstTime = true;
+ for (int p = 0; p < componentNames.size(); p++) {
+ if (componentNames.get(p).equals(componentName)) {
+ addForFirstTime = false;
+ index = p;
+ break;
+ }
+ }
+
+ if (addForFirstTime) {
+ if (!neqsim.util.database.NeqSimDataBase.hasComponent(componentName)) {
+ throw new RuntimeException(
+ new neqsim.util.exception.InvalidInputException(this, "addComponent", "componentName",
+ "with value " + componentName + " not found in database."));
+ }
+ if (moles < 0.0) {
+ String msg = "is negative input for component: " + componentName;
+ throw new RuntimeException(
+ new neqsim.util.exception.InvalidInputException(this, "addComponent", "moles", msg));
+ }
+ // System.out.println("adding " + componentName);
+ componentNames.add(componentName);
+ for (int i = 0; i < getMaxNumberOfPhases(); i++) {
+ getPhase(i).addComponent(componentName, moles, moles, numberOfComponents);
+ getPhase(i).setAttractiveTerm(attractiveTermNumber);
+ }
+ numberOfComponents++;
+ } else {
+ for (PhaseInterface tmpPhase : phaseArray) {
+ if (tmpPhase != null
+ && (tmpPhase.getComponent(componentName).getNumberOfMolesInPhase() + moles) < 0.0) {
+ init(0);
+ break;
+ }
+ }
+
+ // System.out.println("adding chem reac " + componentName);
+ for (PhaseInterface tmpPhase : phaseArray) {
+ // TODO: adding moles to all phases, not just the active ones.
+ if (tmpPhase != null) {
+ tmpPhase.addMolesChemReac(index, moles, moles);
+ }
+ }
+ }
+ setTotalNumberOfMoles(getTotalNumberOfMoles() + moles);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addComponent(String componentName, double moles, double TC, double PC, double acs) {
+ componentName = ComponentInterface.getComponentNameFromAlias(componentName);
+
+ String comNam = componentName;
+ if (getPhase(0).hasComponent(componentName)) {
+ addComponent(componentName, moles);
+ } else {
+ addComponent("default", moles);
+ comNam = "default";
+ // componentNames.set(componentNames.indexOf("default"), componentName);
+ }
+ for (int i = 0; i < getMaxNumberOfPhases(); i++) {
+ getPhase(i).getComponent(comNam).setComponentName(componentName);
+ getPhase(i).getComponent(componentName).setTC(TC);
+ getPhase(i).getComponent(componentName).setPC(PC);
+ getPhase(i).getComponent(componentName).setAcentricFactor(acs);
+ }
+ if (comNam.equals("default")) {
+ componentNames.remove("default");
+ componentNames.add(componentName);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addComponent(String componentName, double moles, int phaseNumber) {
+ componentName = ComponentInterface.getComponentNameFromAlias(componentName);
+
+ if (!neqsim.util.database.NeqSimDataBase.hasComponent(componentName)) {
+ throw new RuntimeException("No component with name: " + componentName + " in database");
+ }
+
+ for (int p = 0; p < componentNames.size(); p++) {
+ if (componentNames.get(p).equals(componentName)) {
+ addComponent(p, moles, phaseNumber);
+ return;
+ }
+ }
+
+ // Add new component
+ if (moles < 0.0) {
+ String msg = "Negative input number of moles.";
+ neqsim.util.exception.InvalidInputException ex =
+ new neqsim.util.exception.InvalidInputException(this, "addComponent", "moles", msg);
+ throw new RuntimeException(ex);
+ }
+
+ componentNames.add(componentName);
+ double k = 1.0;
+ setTotalNumberOfMoles(getTotalNumberOfMoles() + moles);
+
+ for (int i = 0; i < getMaxNumberOfPhases(); i++) {
+ if (phaseNumber == i) {
+ k = 1.0;
+ } else {
+ k = 1.0e-30;
+ }
+ getPhase(i).addComponent(componentName, moles, moles * k, numberOfComponents);
+ getPhase(i).setAttractiveTerm(attractiveTermNumber);
+ }
+ numberOfComponents++;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addComponent(String componentName, double value, String unitName) {
+ componentName = ComponentInterface.getComponentNameFromAlias(componentName);
+
+ if (!neqsim.util.database.NeqSimDataBase.hasComponent(componentName)) {
+ throw new RuntimeException("No component with name: " + componentName + " in database");
+ }
+
+ double molarmass = 0.0;
+ double stddens = 0.0;
+ double boilp = 0.0;
+ try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase();
+ java.sql.ResultSet dataSet =
+ database.getResultSet(("SELECT * FROM comp WHERE name='" + componentName + "'"))) {
+ dataSet.next();
+ molarmass = Double.parseDouble(dataSet.getString("molarmass")) / 1000.0;
+ stddens = Double.parseDouble(dataSet.getString("stddens"));
+ boilp = Double.parseDouble(dataSet.getString("normboil"));
+ } catch (Exception ex) {
+ // todo: mole amount may be not set. should not be caught?
+ logger.error("failed ", ex);
+ }
+ neqsim.util.unit.Unit unit =
+ new neqsim.util.unit.RateUnit(value, unitName, molarmass, stddens, boilp);
+ double SIval = unit.getSIvalue();
+ // System.out.println("number of moles " + SIval);
+ this.addComponent(componentName, SIval);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addComponent(String componentName, double value, String name, int phase) {
+ componentName = ComponentInterface.getComponentNameFromAlias(componentName);
+
+ if (!neqsim.util.database.NeqSimDataBase.hasComponent(componentName)) {
+ throw new RuntimeException("No component with name: " + componentName + " in database");
+ }
+
+ double molarmass = 0.0;
+ double stddens = 0.0;
+ double boilp = 0.0;
+ try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase();
+ java.sql.ResultSet dataSet =
+ database.getResultSet(("SELECT * FROM comp WHERE name='" + componentName + "'"))) {
+ dataSet.next();
+ molarmass = Double.parseDouble(dataSet.getString("molarmass")) / 1000.0;
+ stddens = Double.parseDouble(dataSet.getString("stddens"));
+ boilp = Double.parseDouble(dataSet.getString("normboil"));
+ } catch (Exception ex) {
+ logger.error("failed ", ex);
+ throw new RuntimeException(ex);
+ }
+ neqsim.util.unit.Unit unit =
+ new neqsim.util.unit.RateUnit(value, name, molarmass, stddens, boilp);
+ double SIval = unit.getSIvalue();
+ // System.out.println("number of moles " + SIval);
+ this.addComponent(componentName, SIval, phase);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public SystemInterface addFluid(SystemInterface addSystem) {
+ boolean addedNewComponent = false;
+ int index = -1;
+ for (int i = 0; i < addSystem.getPhase(0).getNumberOfComponents(); i++) {
+ if (!getPhase(0).hasComponent(addSystem.getPhase(0).getComponent(i).getComponentName())) {
+ index = -1;
+ addedNewComponent = true;
+ } else {
+ index = getPhase(0).getComponent(addSystem.getPhase(0).getComponent(i).getComponentName())
+ .getComponentNumber();
+ }
+
+ if (index != -1) {
+ addComponent(index, addSystem.getPhase(0).getComponent(i).getNumberOfmoles());
+ } else if (addSystem.getPhase(0).getComponent(i).isIsTBPfraction()) {
+ addTBPfraction(
+ addSystem.getPhase(0).getComponent(i).getComponentName().replaceFirst("_PC", ""),
+ addSystem.getPhase(0).getComponent(i).getNumberOfmoles(),
+ addSystem.getPhase(0).getComponent(i).getMolarMass(),
addSystem.getPhase(0).getComponent(i).getNormalLiquidDensity());
} else {
if (addSystem.getPhase(0).getComponent(i).isIsTBPfraction()) {
@@ -269,95 +508,20 @@ public SystemInterface addFluid(SystemInterface addSystem, int phase) {
/** {@inheritDoc} */
@Override
- public void addPhase() {
- /*
- * if (maxNumberOfPhases < 6 && !hydrateCheck) { ArrayList phaseList = new ArrayList(0); for
- * (int i = 0; i < numberOfPhases; i++) { phaseList.add(phaseArray[i]); } // add the new phase
- * phaseList.add(phaseArray[0].clone()); beta[phaseList.size() - 1] = 1.0e-8; // beta[1] -=
- * beta[1]/1.0e5;
- *
- * PhaseInterface[] phaseArray2 = new PhaseInterface[numberOfPhases + 1];
- *
- * for (int i = 0; i < numberOfPhases + 1; i++) { phaseArray2[i] = (PhaseInterface)
- * phaseList.get(i); }
- *
- * phaseArray = phaseArray2;
- *
- * System.out.println("number of phases " + numberOfPhases); if (maxNumberOfPhases <
- * numberOfPhases) { maxNumberOfPhases = numberOfPhases; } }
- */
- numberOfPhases++;
+ public void addGasToLiquid(double fraction) {
+ for (int i = 0; i < getPhase(0).getNumberOfComponents(); i++) {
+ double change = getPhase(0).getComponent(i).getNumberOfMolesInPhase() * fraction;
+ addComponent(i, -change, 0);
+ addComponent(i, change, 1);
+ }
}
/**
*
- * addSolidPhase.
+ * addHydratePhase.
*
- * addHydratePhase.
- *
+ * addSolidPhase.
+ *
- * initAnalytic.
- *
- * initAnalytic.
- *
- * initNumeric.
- *
- * initNumeric.
- *
+ * getAntoineVaporPressure.
+ *
+ * need to call initPhysicalProperties() before this method is called
+ *
- * getAntoineVaporPressure.
- *
- * setMixingRuleGEmodel.
- *
- * need to call initPhysicalProperties() before this method is called
- *
+ * hasTBPFraction.
+ *
+ * initAnalytic.
+ *
+ * initAnalytic.
+ *
+ * initNumeric.
+ *
+ * initNumeric.
+ *
- * write.
- *
- * setLastTBPasPlus.
- *
- * hasTBPFraction.
- *
- * useTVasIndependentVariables.
+ * setLastTBPasPlus.
*
+ * setMixingRuleGEmodel.
+ *
+ * useTVasIndependentVariables.
+ *
+ * write.
+ *
- * getXValue.
+ * getLegendItemCount.
*
+ * getLegendItemLabels.
+ *
- * getLegendItemCount.
+ * getXValue.
*
- * getLegendItemLabels.
- *
* Getter for the field
- * Setter for the field
- * Getter for the field
- * Setter for the field
- * Getter for the field
- * Setter for the field
- * Getter for the field
* Setter for the field
* getConversionFactor.
@@ -95,4 +68,31 @@ public double getConversionFactor(String name) {
return conversionFactor;
}
+
+ /** {@inheritDoc} */
+ @Override
+ public double getValue(double val, String fromunit, String tounit) {
+ invalue = val;
+ return getConversionFactor(fromunit) / getConversionFactor(tounit) * invalue;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public double getValue(String tounit) {
+ if (tounit.equals("barg")) {
+ return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
+ - ThermodynamicConstantsInterface.referencePressure;
+ } else if (inunit.equals("barg")) {
+ return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
+ + ThermodynamicConstantsInterface.referencePressure;
+ } else if (tounit.equals("atm")) {
+ return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
+ / ThermodynamicConstantsInterface.referencePressure;
+ } else if (inunit.equals("atm")) {
+ return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
+ * ThermodynamicConstantsInterface.referencePressure;
+ } else {
+ return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue;
+ }
+ }
}
diff --git a/src/main/java/neqsim/util/unit/RateUnit.java b/src/main/java/neqsim/util/unit/RateUnit.java
index 21bf9714e5..a0ebac47cb 100644
--- a/src/main/java/neqsim/util/unit/RateUnit.java
+++ b/src/main/java/neqsim/util/unit/RateUnit.java
@@ -45,18 +45,6 @@ public RateUnit(double value, String name, double molarmass, double stddens, dou
this.boilp = boilp;
}
- /** {@inheritDoc} */
- @Override
- public double getSIvalue() {
- return getConversionFactor(inunit) / getConversionFactor("SI") * invalue;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getValue(String tounit) {
- return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue;
- }
-
/**
*
* getConversionFactor.
@@ -122,4 +110,16 @@ public double getConversionFactor(String name) {
return factor;
}
+
+ /** {@inheritDoc} */
+ @Override
+ public double getSIvalue() {
+ return getConversionFactor(inunit) / getConversionFactor("SI") * invalue;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public double getValue(String tounit) {
+ return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue;
+ }
}
diff --git a/src/main/java/neqsim/util/unit/TemperatureUnit.java b/src/main/java/neqsim/util/unit/TemperatureUnit.java
index dbd450cd13..339252c7bf 100644
--- a/src/main/java/neqsim/util/unit/TemperatureUnit.java
+++ b/src/main/java/neqsim/util/unit/TemperatureUnit.java
@@ -23,22 +23,6 @@ public TemperatureUnit(double value, String name) {
super(value, name);
}
- /** {@inheritDoc} */
- @Override
- public double getValue(double val, String fromunit, String tounit) {
- invalue = val;
- return getConversionFactor(fromunit) / getConversionFactor(tounit) * invalue;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getValue(String tounit) {
- if (tounit.equals("C")) {
- return getConversionFactor(inunit) / getConversionFactor("K") * invalue - 273.15;
- }
- return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue;
- }
-
/**
*
* getConversionFactor.
@@ -59,4 +43,20 @@ public double getConversionFactor(String name) {
}
return conversionFactor;
}
+
+ /** {@inheritDoc} */
+ @Override
+ public double getValue(double val, String fromunit, String tounit) {
+ invalue = val;
+ return getConversionFactor(fromunit) / getConversionFactor(tounit) * invalue;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public double getValue(String tounit) {
+ if (tounit.equals("C")) {
+ return getConversionFactor(inunit) / getConversionFactor("K") * invalue - 273.15;
+ }
+ return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue;
+ }
}
diff --git a/src/main/java/neqsim/util/unit/Unit.java b/src/main/java/neqsim/util/unit/Unit.java
index cde4b08c2d..da6e787432 100644
--- a/src/main/java/neqsim/util/unit/Unit.java
+++ b/src/main/java/neqsim/util/unit/Unit.java
@@ -24,16 +24,6 @@ public interface Unit {
*/
double getSIvalue();
- /**
- *
- * Get process value in specified unit.
- *
* getValue.
@@ -45,4 +35,14 @@ public interface Unit {
* @return a double
*/
double getValue(double val, String fromunit, String tounit);
+
+ /**
+ *
+ * Get process value in specified unit.
+ *
- * set.
+ * doubleValue.
*
- * doubleValue.
+ * set.
*
* addcomponent. Increase number of components and add moles to phase.
+ *
+ * NB! Does not actually add component to componentarray.
*
- * hasComponent.
- *
- * hasComponent.
- *
- * getName.
+ * Getter for property
- * addcomponent. Increase number of components and add moles to phase.
+ * Increase number of components and add moles to phase.
*
* NB! Does not actually add component to componentarray.
*
- * addcomponent.
+ * Add component to component array and update moles variables.
*
- * getcomponentArray.
+ * Get component array of Phase.
*
* getMass.
@@ -1903,13 +1911,24 @@ public default void setPhaseTypeName(String phaseTypeName) {
*/
public double getActivityCoefficientUnSymetric(int k);
+ /**
+ * Verify if phase has a component.
+ *
+ * @param name Name of component to look for. NB! Converts name to normalized name.
+ * @return True if component is found.
+ */
+ public default boolean hasComponent(String name) {
+ return hasComponent(name, true);
+ }
+
/**
* Verify if phase has a component.
*
* @param name Name of component to look for.
+ * @param normalized Set true to convert input name to normalized component name.
* @return True if component is found.
*/
- public boolean hasComponent(String name);
+ public boolean hasComponent(String name, boolean normalized);
/**
*
diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java
index f7e2b64bc4..01ac9ca8ff 100644
--- a/src/main/java/neqsim/thermo/system/SystemInterface.java
+++ b/src/main/java/neqsim/thermo/system/SystemInterface.java
@@ -644,9 +644,9 @@ public default void display() {
public String[] getCompIDs();
/**
- * Get names of all components in System.
+ * Get normalized names of all components in System.
*
- * @return an array of {@link java.lang.String} objects
+ * @return Array of names of components in System.
*/
public String[] getCompNames();
@@ -675,13 +675,14 @@ public default ComponentInterface getComponent(String name) {
}
/**
- *
- * Getter for property
@@ -1616,16 +1617,22 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) {
/**
* Verify if system has a component.
*
- * @param name Name of component to look for.
+ * @param name Name of component to look for. NB! Converts name to normalized name.
* @return True if component is found.
*/
public default boolean hasComponent(String name) {
- for (String fluidComp : getComponentNames()) {
- if (name == fluidComp) {
- return true;
- }
- }
- return false;
+ return hasComponent(name, true);
+ }
+
+ /**
+ * Verify if system has a component.
+ *
+ * @param name Name of component to look for.
+ * @param normalized Set true to convert input name to normalized component name.
+ * @return True if component is found.
+ */
+ public default boolean hasComponent(String name, boolean normalized) {
+ return getPhase(0).hasComponent(name, normalized);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index b3c91b7f95..8a999cda77 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -33,10 +33,12 @@
* This is the base class of the System classes.
*/
public abstract class SystemThermo implements SystemInterface {
+ /** Logger object for class. */
static Logger logger = LogManager.getLogger(SystemThermo.class);
// Class variables
private static final int MAX_PHASES = 6;
+ /** Serialization version UID. */
private static final long serialVersionUID = 1000;
protected int a;
@@ -945,7 +947,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo
getPhase(i).getComponent(componentName).setIsTBPfraction(true);
getPhase(i).getComponent(componentName).setParachorParameter(
characterization.getTBPModel().calcParachorParameter(molarMass, density)); // 59.3+2.34*molarMass*1000.0);
- // //0.5003*thermo.ThermodynamicConstantsInterface.R*TC/PC*(0.25969-racketZ));
+ // 0.5003*thermo.ThermodynamicConstantsInterface.R*TC/PC*(0.25969-racketZ));
getPhase(i).getComponent(componentName).setCriticalViscosity(
characterization.getTBPModel().calcCriticalViscosity(molarMass * 1000.0, density)); // 7.94830*Math.sqrt(1e3*molarMass)*Math.pow(PC,2.0/3.0)/Math.pow(TC,
// 1.0/6.0)*1e-7);
@@ -1934,21 +1936,6 @@ public String[] getCompNames() {
return names;
}
- /** {@inheritDoc} */
- @Override
- public String[] getComponentNames() {
- ArrayListnCols=(16 * 4) + 6
. */
public static final int nCols = (16 * 4) + 6;
+ /**
+ * Get names of properties.
+ *
+ * @return Array of names of properties
+ */
+ public static String[] getPropertyNames() {
+ SystemProperties p = new SystemProperties(new SystemSrkEos());
+ return p.names;
+ }
+ private String[] names;
+
+ private Double[] values;
/**
* Constructur for SystemProperties.
@@ -204,14 +214,4 @@ public HashMapcomponentConcentrationUnit
.
@@ -22,70 +30,67 @@ public String getComponentConcentrationUnit() {
/**
* componentConcentrationUnit
.
+ * Getter for the field flowRateUnit
.
* flowRateUnit
.
+ * Getter for the field pressureUnit
.
* flowRateUnit
.
+ * Getter for the field temperatureUnit
.
* pressureUnit
.
+ * Setter for the field componentConcentrationUnit
.
* pressureUnit
.
+ * Setter for the field flowRateUnit
.
* temperatureUnit
.
+ * Setter for the field pressureUnit
.
* temperatureUnit
.
@@ -96,9 +101,4 @@ public String getTemperatureUnit() {
public void setTemperatureUnit(String temperatureUnit) {
this.temperatureUnit = temperatureUnit;
}
-
- private String temperatureUnit = "K";
- private String pressureUnit = "bara";
- private String flowRateUnit = "mol/sec";
- private String componentConcentrationUnit = "molefraction";
}
diff --git a/src/main/java/neqsim/util/unit/PressureUnit.java b/src/main/java/neqsim/util/unit/PressureUnit.java
index de81e055a2..0cee5417af 100644
--- a/src/main/java/neqsim/util/unit/PressureUnit.java
+++ b/src/main/java/neqsim/util/unit/PressureUnit.java
@@ -26,33 +26,6 @@ public PressureUnit(double value, String unit) {
super(value, unit);
}
- /** {@inheritDoc} */
- @Override
- public double getValue(double val, String fromunit, String tounit) {
- invalue = val;
- return getConversionFactor(fromunit) / getConversionFactor(tounit) * invalue;
- }
-
- /** {@inheritDoc} */
- @Override
- public double getValue(String tounit) {
- if (tounit.equals("barg")) {
- return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
- - ThermodynamicConstantsInterface.referencePressure;
- } else if (inunit.equals("barg")) {
- return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
- + ThermodynamicConstantsInterface.referencePressure;
- } else if (tounit.equals("atm")) {
- return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
- / ThermodynamicConstantsInterface.referencePressure;
- } else if (inunit.equals("atm")) {
- return (getConversionFactor(inunit) / getConversionFactor("bara")) * invalue
- * ThermodynamicConstantsInterface.referencePressure;
- } else {
- return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue;
- }
- }
-
/**
* InvalidInputException
with a default message.
+ * Constructs an InvalidInputException
with a default message like:
+ *
+ * Input " + inputName + " was invalid.
*
* @param className Class that exception is raised from
* @param methodName Method that exception is raised from
@@ -33,7 +35,9 @@ public InvalidInputException(String className, String methodName, String inputNa
}
/**
- * Constructs an InvalidInputException
with the specified detail message.
+ * Constructs an InvalidInputException
with a message like:
+ *
+ * "Input " + inputName + " " + msg
*
* @param className Class that exception is raised from
* @param methodName Method that exception is raised from
diff --git a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
index d4dde8beb7..a3d1a01f6a 100644
--- a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java
@@ -270,6 +270,53 @@ void testpropertyFlashOnlineSingle() {
Assertions.assertEquals(len, s.fluidProperties.length);
}
+ @Test
+ void testpropertyFlashOnlineTooFewInputComponents() {
+ String[] components = {"nitrogen", "oxygen"};
+ double[] fractions = {0.79, 0.21};
+ int len = 10;
+ List> onlineFractions = createDummyRequest(fractions, len);
+
+ Double[] pressure = {1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 4.0, 3.5, 3.0, 2.5};
+ Double[] temperature = {301.0, 301.5, 302.0, 302.5, 303.0, 304.0, 304.0, 303.5, 303.0, 302.5};
+
+ SystemInterface fluid = new SystemSrkEos(298, 1.0);
+ // Add extra component C1
+ fluid.addComponent("C1");
+ fluid.addComponents(components);
+ // Add extra component iC4
+ fluid.addComponent("iC4");
+
+ ThermodynamicOperations ops = new ThermodynamicOperations(fluid);
+ CalculationResult s = ops.propertyFlash(Arrays.asList(pressure), Arrays.asList(temperature), 1,
+ Arrays.asList(components), onlineFractions);
+ Assertions.assertEquals(len, s.fluidProperties.length);
+ Assertions.assertNull(s.calculationError[0]);
+ }
+
+ @Test
+ void testPropertyFlashTooManyInputComponents() {
+ int len = 10;
+ String[] components_too_many = {"nitrogen", "oxygen", "water"};
+ double[] fractions_to_many = {0.79, 0.21, 0.01};
+
+ Double[] pressure = {1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 4.0, 3.5, 3.0, 2.5};
+ Double[] temperature = {301.0, 301.5, 302.0, 302.5, 303.0, 304.0, 304.0, 303.5, 303.0, 302.5};
+
+ List
> onlineFractions_too_many = createDummyRequest(fractions_to_many, len);
+ SystemInterface fluid = new SystemSrkEos(298, 1.0);
+
+ // Add only two components to fluid
+ String[] components = {"nitrogen", "oxygen"};
+ fluid.addComponents(components);
+ ThermodynamicOperations ops = new ThermodynamicOperations(fluid);
+ CalculationResult s = ops.propertyFlash(Arrays.asList(pressure), Arrays.asList(temperature), 1,
+ Arrays.asList(components_too_many), onlineFractions_too_many);
+ Assertions.assertEquals(len, s.fluidProperties.length);
+ Assertions.assertEquals("Input component list does not match fluid component list.",
+ s.calculationError[0]);
+ }
+
@Disabled
@Test
@SuppressWarnings("unchecked")
From 3ea791dc6ea5f377efd6f2381e0fac3b518596c0 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Wed, 20 Mar 2024 15:16:10 +0100
Subject: [PATCH 153/317] Update MultiPhaseMeter.java (#964)
remove output in MPM
---
.../measurementDevice/MultiPhaseMeter.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java
index ef8ecc9a16..049802db15 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java
@@ -254,13 +254,13 @@ public double getMeasuredValue(String measurement, String unit) {
double GOR_via_corrected_volume = tempFluid.getPhase("gas").getCorrectedVolume()
/ tempFluid.getPhase("oil").getCorrectedVolume();
- System.out.println("Stream 2 (results inside MPM) " + " GOR sm3/sm3 " + GOR_in_sm3_sm3
- + " GOR Corrected by volume " + GOR_via_corrected_volume);
+ //System.out.println("Stream 2 (results inside MPM) " + " GOR sm3/sm3 " + GOR_in_sm3_sm3
+ // + " GOR Corrected by volume " + GOR_via_corrected_volume);
- System.out.println("Stream 2 (results inside MPM) getPhase(gas).getCorrectedVolume() "
- + tempFluid.getPhase("gas").getCorrectedVolume());
- System.out.println("Stream 2 (results inside MPM) getPhase(oil).getCorrectedVolume() "
- + tempFluid.getPhase("oil").getCorrectedVolume());
+ //System.out.println("Stream 2 (results inside MPM) getPhase(gas).getCorrectedVolume() "
+ // + tempFluid.getPhase("gas").getCorrectedVolume());
+ //System.out.println("Stream 2 (results inside MPM) getPhase(oil).getCorrectedVolume() "
+ // + tempFluid.getPhase("oil").getCorrectedVolume());
// GOR_via_corrected_volume and GOR_in_sm3_sm3 should not be so different ?
return tempFluid.getPhase("gas").getCorrectedVolume()
From 08ab6b8602a6fdc9ee8118e514ee6e29888f2e11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 21 Mar 2024 10:39:04 +0100
Subject: [PATCH 154/317] fix: bugfixes Phase.addComponent (#966)
---
src/main/java/neqsim/thermo/phase/Phase.java | 24 ++++++++++++++++---
.../neqsim/thermo/phase/PhaseCSPsrkEos.java | 2 +-
.../neqsim/thermo/phase/PhaseDefault.java | 2 +-
.../thermo/phase/PhaseDesmukhMather.java | 2 +-
.../neqsim/thermo/phase/PhaseDuanSun.java | 2 +-
.../java/neqsim/thermo/phase/PhaseGE.java | 7 ------
.../java/neqsim/thermo/phase/PhaseGENRTL.java | 2 +-
.../thermo/phase/PhaseGENRTLmodifiedHV.java | 2 +-
.../thermo/phase/PhaseGENRTLmodifiedWS.java | 2 +-
.../neqsim/thermo/phase/PhaseGERG2004Eos.java | 2 +-
.../neqsim/thermo/phase/PhaseGEUnifac.java | 2 +-
.../thermo/phase/PhaseGEUnifacPSRK.java | 2 +-
.../thermo/phase/PhaseGEUnifacUMRPRU.java | 2 +-
.../neqsim/thermo/phase/PhaseGEUniquac.java | 2 +-
.../phase/PhaseGEUniquacmodifiedHV.java | 3 ++-
.../neqsim/thermo/phase/PhaseGEWilson.java | 2 +-
.../neqsim/thermo/phase/PhaseHydrate.java | 2 +-
.../thermo/phase/PhaseKentEisenberg.java | 2 +-
.../PhaseModifiedFurstElectrolyteEos.java | 2 +-
...aseModifiedFurstElectrolyteEosMod2004.java | 2 +-
.../java/neqsim/thermo/phase/PhasePCSAFT.java | 2 +-
.../thermo/phase/PhasePCSAFTRahmat.java | 2 +-
.../java/neqsim/thermo/phase/PhasePrEos.java | 2 +-
.../neqsim/thermo/phase/PhasePrEosvolcor.java | 2 +-
.../java/neqsim/thermo/phase/PhaseRK.java | 2 +-
.../java/neqsim/thermo/phase/PhaseSolid.java | 2 +-
.../java/neqsim/thermo/phase/PhaseSrkEos.java | 2 +-
.../thermo/phase/PhaseSrkPenelouxEos.java | 2 +-
.../java/neqsim/thermo/phase/PhaseTSTEos.java | 2 +-
.../java/neqsim/thermo/phase/PhaseWax.java | 2 +-
.../thermo/component/NewComponentTest.java | 17 ++++++++++++-
.../neqsim/thermo/phase/PhaseBWRSEosTest.java | 2 +-
.../thermo/phase/PhaseCSPsrkEosTest.java | 2 +-
.../thermo/phase/PhaseDesmukhMatherTest.java | 2 +-
.../neqsim/thermo/phase/PhaseDuanSunTest.java | 2 +-
.../phase/PhaseElectrolyteCPAOldTest.java | 2 +-
.../thermo/phase/PhaseElectrolyteCPATest.java | 2 +-
.../phase/PhaseElectrolyteCPAstatoilTest.java | 2 +-
.../neqsim/thermo/phase/PhaseGENRTLTest.java | 2 +-
.../phase/PhaseGENRTLmodifiedHVTest.java | 2 +-
.../phase/PhaseGENRTLmodifiedWSTest.java | 2 +-
.../thermo/phase/PhaseGEUnifacPSRKTest.java | 2 +-
.../thermo/phase/PhaseGEUnifacTest.java | 2 +-
.../thermo/phase/PhaseGEUnifacUMRPRUTest.java | 2 +-
.../thermo/phase/PhaseGEUniquacTest.java | 2 +-
.../thermo/phase/PhaseGEWilsonTest.java | 2 +-
.../neqsim/thermo/phase/PhaseHydrateTest.java | 2 +-
.../thermo/phase/PhaseKentEisenbergTest.java | 2 +-
...odifiedFurstElectrolyteEosMod2004Test.java | 2 +-
.../PhaseModifiedFurstElectrolyteEosTest.java | 2 +-
.../thermo/phase/PhasePCSAFTRahmatTest.java | 2 +-
.../neqsim/thermo/phase/PhasePCSAFTTest.java | 2 +-
.../neqsim/thermo/phase/PhasePCSAFTaTest.java | 2 +-
.../neqsim/thermo/phase/PhasePrCPATest.java | 2 +-
.../neqsim/thermo/phase/PhasePrEosTest.java | 2 +-
.../thermo/phase/PhasePrEosvolcorTest.java | 2 +-
.../java/neqsim/thermo/phase/PhaseRKTest.java | 2 +-
.../PhaseSrkCPA_proceduralMatricesTest.java | 2 +-
.../thermo/phase/PhaseSrkCPAojAlgoTest.java | 2 +-
.../thermo/phase/PhaseSrkCPAsOldTest.java | 2 +-
.../neqsim/thermo/phase/PhaseSrkCPAsTest.java | 2 +-
.../neqsim/thermo/phase/PhaseSrkEosTest.java | 8 ++++++-
.../thermo/phase/PhaseSrkPenelouxEosTest.java | 2 +-
.../neqsim/thermo/phase/PhaseTSTEosTest.java | 2 +-
.../neqsim/thermo/phase/PhaseUMRCPATest.java | 2 +-
.../neqsim/thermo/phase/PhaseWaxTest.java | 2 +-
66 files changed, 107 insertions(+), 74 deletions(-)
diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java
index 3ba3218b95..8c2228796d 100644
--- a/src/main/java/neqsim/thermo/phase/Phase.java
+++ b/src/main/java/neqsim/thermo/phase/Phase.java
@@ -22,7 +22,9 @@
* @author Even Solbraa
*/
public abstract class Phase implements PhaseInterface {
+ /** Serialization version UID. */
private static final long serialVersionUID = 1000;
+ /** Logger object for class. */
static Logger logger = LogManager.getLogger(Phase.class);
public int numberOfComponents = 0;
@@ -107,17 +109,22 @@ public Phase clone() {
* @param name Name of component to add.
* @param moles Number of moles of component to add to phase.
*/
- public void addComponent(String name, double moles) {
+ public void addComponent(String name, double moles, int compNumber) {
if (name == null) {
// Will fail anyhow creating component with no name
throw new RuntimeException(
new InvalidInputException(this, "addcomponent", "name", "can not be null"));
}
+ if (name.equals("")) {
+ throw new RuntimeException(
+ new InvalidInputException(this, "addcomponent", "name", "can not be empty."));
+ }
+
if (this.hasComponent(name)) {
// shall use addMoles/addMolesChemreac to adding/subtracting moles for component.
- throw new RuntimeException(
- "Component already exists in phase. Use addMoles or addMolesChemreac.");
+ throw new RuntimeException(new InvalidInputException(this, "addComponent", "name",
+ "component with same name already exists in phase. Use addMoles or addMolesChemreac."));
}
if (moles < 0) {
@@ -125,6 +132,17 @@ public void addComponent(String name, double moles) {
new InvalidInputException(this, "addComponent", "moles", "can not be negative"));
}
+ if (compNumber < 0 || compNumber >= ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS) {
+ throw new RuntimeException(new InvalidInputException(this, "addComponent", "compNumber",
+ " must be valid index, i.e., between 0 and "
+ + ThermodynamicModelSettings.MAX_NUMBER_OF_COMPONENTS + "."));
+ }
+
+ if (componentArray[compNumber] != null) {
+ throw new RuntimeException(new InvalidInputException(this, "addComponent", "compNumber",
+ "number is already in use."));
+ }
+
this.numberOfMolesInPhase += moles;
this.numberOfComponents++;
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java
index e946751e89..79d1d28e25 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseCSPsrkEos.java
@@ -58,7 +58,7 @@ public PhaseCSPsrkEos clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentCSPsrk(name, moles, molesInPhase, compNumber);
((ComponentCSPsrk) componentArray[compNumber]).setRefPhaseBWRS(this);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDefault.java b/src/main/java/neqsim/thermo/phase/PhaseDefault.java
index 9b577f098d..79afd0806e 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDefault.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDefault.java
@@ -48,7 +48,7 @@ public void setComponentType(ComponentInterface comp) {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, moles);
+ super.addComponent(name, moles, compNumber);
try {
componentArray[compNumber] = defComponent.getClass().getDeclaredConstructor().newInstance();
} catch (Exception ex) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
index 468d30288b..4ad343af5e 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
@@ -35,7 +35,7 @@ public PhaseDesmukhMather() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentDesmukhMather(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
index c315624a1b..fcc12f3039 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
@@ -33,7 +33,7 @@ public PhaseDuanSun() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGeDuanSun(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java
index 08f0560018..e3660091e1 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGE.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java
@@ -133,13 +133,6 @@ public void resetMixingRule(int type) {
mixRuleEos = mixSelect.resetMixingRule(2, this);
}
- /** {@inheritDoc} */
- @Override
- public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
- // TODO: compNumber not in use
- }
-
/** {@inheritDoc} */
@Override
public double getActivityCoefficientSymetric(int k) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
index 5465c74324..f617eaf3e6 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
@@ -69,7 +69,7 @@ public PhaseGENRTL(PhaseInterface phase, double[][] alpha, double[][] Dij, Strin
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGeNRTL(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
index 6dffa94249..c92f0c65e4 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
@@ -86,7 +86,7 @@ public PhaseGENRTLmodifiedHV(PhaseInterface phase, double[][] alpha, double[][]
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] =
new ComponentGENRTLmodifiedHV(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
index bae95b38d0..efc0be66cf 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
@@ -84,7 +84,7 @@ public void setMixingRule(int type) {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] =
new ComponentGENRTLmodifiedWS(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java
index 307918702d..40a998a4e8 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java
@@ -60,7 +60,7 @@ public PhaseGERG2004Eos clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGERG2004(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
index b1060211f1..1b5bf36242 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
@@ -62,7 +62,7 @@ public PhaseGEUnifac(PhaseInterface phase, double[][] alpha, double[][] Dij, Str
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGEUnifac(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
index d462c70752..840dd8e3c9 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
@@ -56,7 +56,7 @@ public PhaseGEUnifacPSRK(PhaseInterface phase, double[][] alpha, double[][] Dij,
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGEUnifacPSRK(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
index 7b62645a8f..68c3d0ede1 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
@@ -93,7 +93,7 @@ public double getFCommontemp() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGEUnifacUMRPRU(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
index fad0aaa1e2..a104b865b9 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
@@ -88,7 +88,7 @@ public void setDijT(double[][] DijT) {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGEUniquac(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java
index 6e69f0aa53..7a9b713151 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquacmodifiedHV.java
@@ -29,7 +29,8 @@ public PhaseGEUniquacmodifiedHV() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
+ // todo: does not work? does not add component.
// componentArray[compNumber] = new ComponentGEUniquacmodifiedHV(name, moles, molesInPhase,
// compNumber);
// creates PhaseGEUniquac type component
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
index 19580771f4..09ecd1dec2 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
@@ -73,7 +73,7 @@ public void setDijT(double[][] DijT) {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentGEWilson(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java
index 41580439bb..3ccf36014c 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java
@@ -83,7 +83,7 @@ public double molarVolume(double pressure, double temperature, double A, double
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
// componentArray[compNumber] = new ComponentHydrateStatoil(name, moles, molesInPhase,
// compNumber);
if (hydrateModel.equals("CPAHydrateModel")) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseKentEisenberg.java b/src/main/java/neqsim/thermo/phase/PhaseKentEisenberg.java
index 3821437f96..dce22ef66f 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseKentEisenberg.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseKentEisenberg.java
@@ -25,7 +25,7 @@ public PhaseKentEisenberg() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentKentEisenberg(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java
index 4f5d2ff10f..d5f80eedc4 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEos.java
@@ -192,7 +192,7 @@ public void volInit() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] =
new ComponentModifiedFurstElectrolyteEos(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java
index f0cf2cd3ea..b5cecaaf97 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004.java
@@ -192,7 +192,7 @@ public void volInit() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] =
new neqsim.thermo.component.ComponentModifiedFurstElectrolyteEosMod2004(name, moles,
molesInPhase, compNumber);
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
index 9de1c0bb06..5e21be7db6 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java
@@ -103,7 +103,7 @@ public PhasePCSAFT clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentPCSAFT(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
index 8b9c39d214..505e7005ec 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java
@@ -66,7 +66,7 @@ public PhasePCSAFTRahmat clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentPCSAFT(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhasePrEos.java b/src/main/java/neqsim/thermo/phase/PhasePrEos.java
index cf6ffbf286..714f24e7fd 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePrEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePrEos.java
@@ -43,7 +43,7 @@ public PhasePrEos clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentPR(name, moles, molesInPhase, compNumber);
}
}
diff --git a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java
index 5b9e4e370f..71524fa028 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java
@@ -635,7 +635,7 @@ public PhasePrEosvolcor clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentPRvolcor(name, moles, molesInPhase, compNumber);
}
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseRK.java b/src/main/java/neqsim/thermo/phase/PhaseRK.java
index d700fa7f33..76d8d82af9 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseRK.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseRK.java
@@ -43,7 +43,7 @@ public PhaseRK clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentRK(name, moles, molesInPhase, compNumber);
}
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseSolid.java b/src/main/java/neqsim/thermo/phase/PhaseSolid.java
index 467ecb3587..cde7c6d565 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseSolid.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseSolid.java
@@ -53,7 +53,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentSolid(name, moles, molesInPhase, compNumber);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java b/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java
index 0ee9048b34..a6aa1e5b8a 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseSrkEos.java
@@ -50,7 +50,7 @@ public PhaseSrkEos clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentSrk(name, moles, molesInPhase, compNumber);
}
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkPenelouxEos.java b/src/main/java/neqsim/thermo/phase/PhaseSrkPenelouxEos.java
index a0e046f27f..5221925e54 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseSrkPenelouxEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseSrkPenelouxEos.java
@@ -38,7 +38,7 @@ public PhaseSrkPenelouxEos clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentSrkPeneloux(name, moles, molesInPhase, compNumber);
}
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseTSTEos.java b/src/main/java/neqsim/thermo/phase/PhaseTSTEos.java
index 2e2a32b621..16b0fd8a7c 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseTSTEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseTSTEos.java
@@ -42,7 +42,7 @@ public PhaseTSTEos clone() {
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentTST(name, moles, molesInPhase, compNumber);
}
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseWax.java b/src/main/java/neqsim/thermo/phase/PhaseWax.java
index 79f701a5c6..1b900a059c 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseWax.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseWax.java
@@ -47,7 +47,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType
/** {@inheritDoc} */
@Override
public void addComponent(String name, double moles, double molesInPhase, int compNumber) {
- super.addComponent(name, molesInPhase);
+ super.addComponent(name, molesInPhase, compNumber);
componentArray[compNumber] = new ComponentWax(name, moles, molesInPhase, compNumber);
// componentArray[compNumber] = new ComponentWaxWilson(componentName, moles,
// molesInPhase, compNumber);
diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java
index 9341977b5b..b0f588f253 100644
--- a/src/test/java/neqsim/thermo/component/NewComponentTest.java
+++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java
@@ -25,7 +25,7 @@ public void createComponentTest() {
p.addComponent("", 0, 0, 0);
});
Assertions.assertEquals(
- "neqsim.util.exception.InvalidInputException: ComponentSrk:createComponent - Input name can not be empty",
+ "neqsim.util.exception.InvalidInputException: PhaseSrkEos:addcomponent - Input name can not be empty.",
thrown.getMessage());
RuntimeException thrown_2 = Assertions.assertThrows(RuntimeException.class, () -> {
@@ -34,6 +34,21 @@ public void createComponentTest() {
Assertions.assertEquals(
"neqsim.util.exception.InvalidInputException: PhaseSrkEos:addcomponent - Input name can not be null",
thrown_2.getMessage());
+
+ RuntimeException thrown_3 = Assertions.assertThrows(RuntimeException.class, () -> {
+ p.addComponent("ethane", 0, 0, -1);
+ });
+ Assertions.assertEquals(
+ "neqsim.util.exception.InvalidInputException: PhaseSrkEos:addComponent - Input compNumber must be valid index, i.e., between 0 and 100.",
+ thrown_3.getMessage());
+
+ p.addComponent("ethane", 0, 0, 0);
+ RuntimeException thrown_4 = Assertions.assertThrows(RuntimeException.class, () -> {
+ p.addComponent("methane", 0, 0, 0);
+ });
+ Assertions.assertEquals(
+ "neqsim.util.exception.InvalidInputException: PhaseSrkEos:addComponent - Input compNumber number is already in use.",
+ thrown_4.getMessage());
}
@Test
diff --git a/src/test/java/neqsim/thermo/phase/PhaseBWRSEosTest.java b/src/test/java/neqsim/thermo/phase/PhaseBWRSEosTest.java
index 5dc3770d56..3671e40d39 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseBWRSEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseBWRSEosTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseCSPsrkEosTest.java b/src/test/java/neqsim/thermo/phase/PhaseCSPsrkEosTest.java
index 4b9958fdf5..98b03d6cbe 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseCSPsrkEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseCSPsrkEosTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseDesmukhMatherTest.java b/src/test/java/neqsim/thermo/phase/PhaseDesmukhMatherTest.java
index 496aa9df6c..e2d9263bcc 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseDesmukhMatherTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseDesmukhMatherTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseDuanSunTest.java b/src/test/java/neqsim/thermo/phase/PhaseDuanSunTest.java
index d7971df15c..2d233b9829 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseDuanSunTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseDuanSunTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAOldTest.java b/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAOldTest.java
index 040b9f68eb..e520e086f2 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAOldTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAOldTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPATest.java b/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPATest.java
index 4e197f06ce..e25f080f82 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPATest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPATest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAstatoilTest.java b/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAstatoilTest.java
index c2e29a828f..ee8d32855f 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAstatoilTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseElectrolyteCPAstatoilTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGENRTLTest.java b/src/test/java/neqsim/thermo/phase/PhaseGENRTLTest.java
index 617c69c013..7301e653fe 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGENRTLTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGENRTLTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHVTest.java b/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHVTest.java
index 2ea43070a8..8cc24b389f 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHVTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHVTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWSTest.java b/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWSTest.java
index ce93b42f5b..a3250c82da 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWSTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWSTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGEUnifacPSRKTest.java b/src/test/java/neqsim/thermo/phase/PhaseGEUnifacPSRKTest.java
index 68fec9d31a..13a20df50e 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGEUnifacPSRKTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGEUnifacPSRKTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGEUnifacTest.java b/src/test/java/neqsim/thermo/phase/PhaseGEUnifacTest.java
index d90a2fc322..d3062a9e2f 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGEUnifacTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGEUnifacTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRUTest.java b/src/test/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRUTest.java
index b269db4fbb..430badb6e2 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRUTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRUTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGEUniquacTest.java b/src/test/java/neqsim/thermo/phase/PhaseGEUniquacTest.java
index 9d109f4a3f..991efd9076 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGEUniquacTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGEUniquacTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseGEWilsonTest.java b/src/test/java/neqsim/thermo/phase/PhaseGEWilsonTest.java
index 1ac1808e8e..e5fe86d5e3 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseGEWilsonTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseGEWilsonTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseHydrateTest.java b/src/test/java/neqsim/thermo/phase/PhaseHydrateTest.java
index f4a7814ffd..7964934a99 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseHydrateTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseHydrateTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseKentEisenbergTest.java b/src/test/java/neqsim/thermo/phase/PhaseKentEisenbergTest.java
index df311e2500..a2d66172ed 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseKentEisenbergTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseKentEisenbergTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004Test.java b/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004Test.java
index 8ccdf2b151..2b95a0e5e2 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004Test.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosMod2004Test.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosTest.java b/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosTest.java
index 125383b831..9d65b2f1a9 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseModifiedFurstElectrolyteEosTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhasePCSAFTRahmatTest.java b/src/test/java/neqsim/thermo/phase/PhasePCSAFTRahmatTest.java
index eac997b6bd..1485258f1a 100644
--- a/src/test/java/neqsim/thermo/phase/PhasePCSAFTRahmatTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhasePCSAFTRahmatTest.java
@@ -33,7 +33,7 @@ void testAddcomponent() {
p2.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p2.getNumberOfComponents());
- p2.addComponent("methane", 0, 0, 0);
+ p2.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p2.getNumberOfComponents());
}
diff --git a/src/test/java/neqsim/thermo/phase/PhasePCSAFTTest.java b/src/test/java/neqsim/thermo/phase/PhasePCSAFTTest.java
index f6e97a0be8..dcfbca06c3 100644
--- a/src/test/java/neqsim/thermo/phase/PhasePCSAFTTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhasePCSAFTTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhasePCSAFTaTest.java b/src/test/java/neqsim/thermo/phase/PhasePCSAFTaTest.java
index 82fc574fe0..f1e8708a74 100644
--- a/src/test/java/neqsim/thermo/phase/PhasePCSAFTaTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhasePCSAFTaTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhasePrCPATest.java b/src/test/java/neqsim/thermo/phase/PhasePrCPATest.java
index 69b0ef792c..61365244b3 100644
--- a/src/test/java/neqsim/thermo/phase/PhasePrCPATest.java
+++ b/src/test/java/neqsim/thermo/phase/PhasePrCPATest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhasePrEosTest.java b/src/test/java/neqsim/thermo/phase/PhasePrEosTest.java
index 3c82904a82..b77d9388c7 100644
--- a/src/test/java/neqsim/thermo/phase/PhasePrEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhasePrEosTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhasePrEosvolcorTest.java b/src/test/java/neqsim/thermo/phase/PhasePrEosvolcorTest.java
index 6a2d0c6a62..dad4efa572 100644
--- a/src/test/java/neqsim/thermo/phase/PhasePrEosvolcorTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhasePrEosvolcorTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseRKTest.java b/src/test/java/neqsim/thermo/phase/PhaseRKTest.java
index 6a9b089968..c2004dfa40 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseRKTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseRKTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatricesTest.java b/src/test/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatricesTest.java
index 0b826d94f3..900df3df69 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatricesTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatricesTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseSrkCPAojAlgoTest.java b/src/test/java/neqsim/thermo/phase/PhaseSrkCPAojAlgoTest.java
index 4d4d65baa3..5da225d401 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseSrkCPAojAlgoTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseSrkCPAojAlgoTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsOldTest.java b/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsOldTest.java
index c33e4912ad..e3e52c750f 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsOldTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsOldTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsTest.java b/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsTest.java
index 5feccc7d09..9d23b14f46 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseSrkCPAsTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java b/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java
index 2188a0811a..82e9578398 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java
@@ -18,8 +18,14 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
+ try {
+ p.addComponent("methane", 0, 0, 0);
+ } catch (Exception e) {
+ // Do nothing.
+ }
+ Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseSrkPenelouxEosTest.java b/src/test/java/neqsim/thermo/phase/PhaseSrkPenelouxEosTest.java
index a84d39d99a..b7715920ea 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseSrkPenelouxEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseSrkPenelouxEosTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseTSTEosTest.java b/src/test/java/neqsim/thermo/phase/PhaseTSTEosTest.java
index cbe29234e3..196a189208 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseTSTEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseTSTEosTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseUMRCPATest.java b/src/test/java/neqsim/thermo/phase/PhaseUMRCPATest.java
index 711372a029..d1e8dedb67 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseUMRCPATest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseUMRCPATest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
diff --git a/src/test/java/neqsim/thermo/phase/PhaseWaxTest.java b/src/test/java/neqsim/thermo/phase/PhaseWaxTest.java
index 6693f17785..7bd9a42786 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseWaxTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseWaxTest.java
@@ -19,7 +19,7 @@ void testAddcomponent() {
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
- p.addComponent("methane", 0, 0, 0);
+ p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
}
}
From 06b1485aecc982fb5a3f8bb553f877665a5844f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 21 Mar 2024 11:00:14 +0100
Subject: [PATCH 155/317] Update verify_build.yml
---
.github/workflows/verify_build.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/verify_build.yml b/.github/workflows/verify_build.yml
index 3ae0bf958e..a1285b7573 100644
--- a/.github/workflows/verify_build.yml
+++ b/.github/workflows/verify_build.yml
@@ -29,11 +29,11 @@ jobs:
- name: Create coverage report from jacoco execution data
run: mvn -B jacoco:report -ntp
- name: Upload jacoco coverage reports to Codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v4
with:
file: jacoco.xml
name: codecov
- tags: coverage
+ # tags: coverage
test_java_8:
name: Assert tests with java 8
From 45c4abccaa7b6dfc58617f42804838aa9b17724c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 21 Mar 2024 11:12:12 +0100
Subject: [PATCH 156/317] Create publish_javadoc.yml
---
.github/workflows/publish_javadoc.yml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 .github/workflows/publish_javadoc.yml
diff --git a/.github/workflows/publish_javadoc.yml b/.github/workflows/publish_javadoc.yml
new file mode 100644
index 0000000000..dd19781bbb
--- /dev/null
+++ b/.github/workflows/publish_javadoc.yml
@@ -0,0 +1,21 @@
+name: Deploy Javadoc
+
+on:
+ workflow_dispatch:
+ release:
+ types: [published]
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write # if you have a protection rule on your repository, you'll need to give write permission to the workflow.
+ steps:
+ - name: Deploy JavaDoc 🚀
+ uses: MathieuSoysal/Javadoc-publisher.yml@v2.5.0
+ with:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ javadoc-branch: javadoc
+ java-version: 17
+ target-folder: javadoc # url will be https://equinor.github.io/neqsim/javadoc
+ project: maven
From 3ec2eb5d847f7456db810a4c2b0dcbbe1414850a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 21 Mar 2024 12:14:47 +0100
Subject: [PATCH 157/317] feat: Phase.hasComponent check against normalized
name (#965)
feat: Phase.hasComponent check against normalized name
feat: new function Phase.getComponentNames
fix: check that compnumber is valid and not in use (previously possible to overwrite component in array)
docfix
---
.../thermo/component/ComponentInterface.java | 2 +-
src/main/java/neqsim/thermo/phase/Phase.java | 35 ++++++++++++++++---
.../neqsim/thermo/phase/PhaseInterface.java | 25 +++++++++++--
.../neqsim/thermo/system/SystemInterface.java | 35 +++++++++++--------
.../neqsim/thermo/system/SystemThermo.java | 24 +++++--------
.../neqsim/thermo/phase/PhaseSrkEosTest.java | 14 ++++++++
6 files changed, 97 insertions(+), 38 deletions(-)
diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java
index 013eed2551..612cc9c674 100644
--- a/src/main/java/neqsim/thermo/component/ComponentInterface.java
+++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java
@@ -1416,7 +1416,7 @@ public default double getLogFugacityCoefficient() {
/**
*
componentName
, i.e., normalized component name.
* componentNames
.
- * beta
values.
+ *
+ * @return Sum of beta
beta values
+ */
public final double getSumBeta() {
double sum = 0;
for (int k = 0; k < numberOfPhases; k++) {
diff --git a/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java b/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java
index 82e9578398..1472cafaed 100644
--- a/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java
+++ b/src/test/java/neqsim/thermo/phase/PhaseSrkEosTest.java
@@ -15,9 +15,20 @@ void setUp() {
@Test
void testAddcomponent() {
Assertions.assertEquals(0, p.getNumberOfComponents());
+ Assertions.assertFalse(p.hasComponent("ethane"));
p.addComponent("ethane", 0, 0, 0);
Assertions.assertEquals(1, p.getNumberOfComponents());
+
+ Assertions.assertTrue(p.hasComponent("ethane"));
+
+ // Expects True because C2 normalized -> ethane
+ Assertions.assertTrue(p.hasComponent("C2"));
+ // Expects True because was created as ethane
+ Assertions.assertTrue(p.hasComponent("ethane", false));
+ // expects False because C2 is not equal to ethane
+ Assertions.assertFalse(p.hasComponent("C2", false));
+
try {
p.addComponent("methane", 0, 0, 0);
} catch (Exception e) {
@@ -27,6 +38,9 @@ void testAddcomponent() {
p.addComponent("methane", 0, 0, 1);
Assertions.assertEquals(2, p.getNumberOfComponents());
+ String[] d = p.getComponentNames();
+ Assertions.assertTrue(d[0].equals("ethane"));
+ Assertions.assertTrue(d[1].equals("methane"));
}
@Test
From 2c62bfe0e8136519d5bcdc0da55a76cb4dd8f824 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 21 Mar 2024 12:25:57 +0100
Subject: [PATCH 158/317] Update verify_build.yml
---
.github/workflows/verify_build.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/verify_build.yml b/.github/workflows/verify_build.yml
index a1285b7573..11d0c38376 100644
--- a/.github/workflows/verify_build.yml
+++ b/.github/workflows/verify_build.yml
@@ -33,6 +33,7 @@ jobs:
with:
file: jacoco.xml
name: codecov
+ token: ${{ secrets.CODECOV_TOKEN }}
# tags: coverage
test_java_8:
From eedf990b9f8c35e6cdf1ca5e69743361e7e654c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Thu, 21 Mar 2024 15:01:23 +0100
Subject: [PATCH 159/317] fix: more robust propertyFlash (#967)
---
.../ThermodynamicOperations.java | 7 +-
.../ThermodynamicOperationsTest.java | 75 +++++++++++++++++++
2 files changed, 81 insertions(+), 1 deletion(-)
diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
index f0614c6561..357538ccad 100644
--- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
+++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java
@@ -11,6 +11,7 @@
import org.apache.logging.log4j.Logger;
import neqsim.api.ioc.CalculationResult;
import neqsim.thermo.component.ComponentHydrate;
+import neqsim.thermo.component.ComponentInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemProperties;
import neqsim.thermodynamicOperations.flashOps.CalcIonicComposition;
@@ -2031,6 +2032,9 @@ public CalculationResult propertyFlash(List> onlineFractions = new ArrayList
>();
+
+ for (double d : fractions) {
+ ArrayList
@@ -240,7 +241,13 @@ public void setSolidRefFluidPhase(PhaseInterface phase) {
refPhase.setTemperature(273.0);
refPhase.setPressure(1.0);
try {
- refPhase.addComponent(componentName, 10.0, 10.0, 0);
+ if (NeqSimDataBase.hasComponent(componentName)
+ || NeqSimDataBase.hasTempComponent(componentName)) {
+ refPhase.addComponent(componentName, 10.0, 10.0, 0);
+ } else {
+ refPhase.addComponent("methane", 10.0, 10.0, 0);
+ refPhase.getComponent("methane").setComponentName(componentName);
+ }
} catch (Exception ex) {
logger.error("error occured in setSolidRefFluidPhase ", ex);
refPhase.addComponent("methane", 10.0, 10.0, 0);
diff --git a/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java b/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java
index b156ffa226..16ca81896e 100644
--- a/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java
+++ b/src/main/java/neqsim/thermo/phase/PhasePureComponentSolid.java
@@ -24,7 +24,6 @@ public class PhasePureComponentSolid extends PhaseSolid {
*/
public PhasePureComponentSolid() {
super();
- setType(PhaseType.SOLID);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/thermo/phase/PhaseSolid.java b/src/main/java/neqsim/thermo/phase/PhaseSolid.java
index 7758bba6c8..a82c2299ba 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseSolid.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseSolid.java
@@ -27,6 +27,7 @@ public abstract class PhaseSolid extends PhaseSrkEos {
public PhaseSolid() {
super();
setType(PhaseType.SOLID);
+ calcMolarVolume = false;
}
/** {@inheritDoc} */
@@ -48,6 +49,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType
double beta) {
try {
super.init(totalNumberOfMoles, numberOfComponents, initType, pt, beta);
+ getDensityTemp();
} catch (Exception ex) {
logger.error(ex.getMessage());
}
diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java
index 5cf1d10b88..f6d5a6d7ae 100644
--- a/src/main/java/neqsim/thermo/system/SystemThermo.java
+++ b/src/main/java/neqsim/thermo/system/SystemThermo.java
@@ -47,7 +47,7 @@ public abstract class SystemThermo implements SystemInterface {
// Fraction of moles_in_phase / moles_in_system.
protected double[] beta = new double[MAX_PHASES];
- protected String[] CapeOpenProperties10 = { "molecularWeight", "speedOfSound",
+ protected String[] CapeOpenProperties10 = {"molecularWeight", "speedOfSound",
"jouleThomsonCoefficient", "energy", "energy.Dtemperature", "gibbsFreeEnergy",
"helmholtzFreeEnergy", "fugacityCoefficient", "logFugacityCoefficient",
"logFugacityCoefficient.Dtemperature", "logFugacityCoefficient.Dpressure",
@@ -56,9 +56,9 @@ public abstract class SystemThermo implements SystemInterface {
"entropy.Dmoles", "heatCapacity", "heatCapacityCv", "density", "density.Dtemperature",
"density.Dpressure", "density.Dmoles", "volume", "volume.Dpressure", "volume.Dtemperature",
"molecularWeight.Dtemperature", "molecularWeight.Dpressure", "molecularWeight.Dmoles",
- "compressibilityFactor" };
+ "compressibilityFactor"};
// protected ArrayList
+ * Units class. + *
+ * + * @author even + * @version $Id: $Id + */ +public class Units { + /** + * Unit class nested within Units. + */ + public class Unit { + public String symbol; + public String symbolName; + + public Unit(String symbol, String symbolName) { + this.symbol = symbol; + this.symbolName = symbolName; + } + } + + public static HashMap- * getConversionFactor. - *
+ * Get conversion factor for temperature unit conversions to Kelvin. Note: This is primarily for + * understanding scale, not for direct conversions including offsets. * - * @param name a {@link java.lang.String} object - * @return a double + * @param name a {@link java.lang.String} object representing the temperature unit + * @return a double representing the conversion factor relative to Kelvin */ public double getConversionFactor(String name) { - double conversionFactor = 1.0; switch (name) { case "K": - conversionFactor = 1.0; - break; - case "R": - conversionFactor = 5.0 / 9.0; - break; + return 1.0; + case "C": + return 1.0; // Same scale as Kelvin case "F": - conversionFactor = 5.0 / 9.0; - break; + return 5.0 / 9.0; // Scale factor for Fahrenheit to Kelvin + case "R": + return 5.0 / 9.0; // Scale factor for Rankine to Kelvin + default: + throw new IllegalArgumentException("Unknown unit: " + name); } - return conversionFactor; } - /** {@inheritDoc} */ + /** + * Convert a value from one temperature unit to another. + * + * @param value the temperature value to convert + * @param fromUnit the unit of the input temperature + * @param toUnit the unit to convert the temperature to + * @return the converted temperature value + */ @Override - public double getValue(double val, String fromunit, String tounit) { - invalue = val; - return getConversionFactor(fromunit) / getConversionFactor(tounit) * invalue; + public double getValue(double value, String fromUnit, String toUnit) { + if (fromUnit.equals(toUnit)) { + return value; + } + + // Convert input to Kelvin first + double tempInKelvin = value; + if (fromUnit.equals("C")) { + tempInKelvin += 273.15; + } else if (fromUnit.equals("F")) { + tempInKelvin = (value - 32) * 5.0 / 9.0 + 273.15; + } else if (fromUnit.equals("R")) { + tempInKelvin = value * 5.0 / 9.0; + } + + // Convert from Kelvin to target unit + if (toUnit.equals("K")) { + return tempInKelvin; + } else if (toUnit.equals("C")) { + return tempInKelvin - 273.15; + } else if (toUnit.equals("F")) { + return (tempInKelvin - 273.15) * 9.0 / 5.0 + 32; + } else if (toUnit.equals("R")) { + return tempInKelvin * 9.0 / 5.0; + } + + throw new IllegalArgumentException("Unsupported unit: " + toUnit); } - /** {@inheritDoc} */ + /** + * Convert a given temperature value from Kelvin to a specified unit. + * + * @param toUnit the target unit to convert the temperature to ("C", "F", "R") + * @return the converted temperature value in the target unit + */ @Override - public double getValue(String tounit) { - if (tounit.equals("C")) { - return getConversionFactor(inunit) / getConversionFactor("K") * invalue - 273.15; - } - if (tounit.equals("F")) { - return (getConversionFactor(inunit) / getConversionFactor("K") * invalue - 273.15) * 1.8 - + 32.0; + public double getValue(String toUnit) { + switch (toUnit) { + case "K": + // Convert from Kelvin to Kelvin + return invalue; + case "C": + // Convert from Kelvin to Celsius + return invalue - 273.15; + case "F": + // Convert from Kelvin to Fahrenheit + return invalue * 9.0/5.0 - 459.67; + case "R": + // Convert from Kelvin to Rankine + return invalue * 9.0 / 5.0; + default: + // Handle unsupported units + throw new IllegalArgumentException("Unsupported conversion unit: " + toUnit); } - return getConversionFactor(inunit) / getConversionFactor(tounit) * invalue; } } diff --git a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java index 019931598b..bb138ce817 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java +++ b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java @@ -348,5 +348,6 @@ public void runProcessTEG() throws InterruptedException { } catch (Exception ex) { logger.error("Something failed"); } + System.out.println("water in gas "+ dehydratedGas.getFluid().getComponent("water").getx()); } } diff --git a/src/test/java/neqsim/util/unit/TemperatureUnitTest.java b/src/test/java/neqsim/util/unit/TemperatureUnitTest.java new file mode 100644 index 0000000000..64a002fda3 --- /dev/null +++ b/src/test/java/neqsim/util/unit/TemperatureUnitTest.java @@ -0,0 +1,54 @@ +package neqsim.util.unit; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; +import neqsim.thermodynamicOperations.ThermodynamicOperations; + +class TemperatureUnitTest extends neqsim.NeqSimTest { + /** + *+ * testSetPressure + *
+ */ + @Test + public void testSetTemperature() { + neqsim.thermo.system.SystemPrEos fluid = new neqsim.thermo.system.SystemPrEos(298.0, 10.0); + fluid.addComponent("nitrogen", 10.0); + fluid.addComponent("nC10", 10.0); + fluid.setPressure(0.0, "barg"); + + ThermodynamicOperations testOps = new ThermodynamicOperations(fluid); + testOps.TPflash(); + fluid.initProperties(); + + assertEquals(ThermodynamicConstantsInterface.referencePressure, fluid.getPressure("bara"), + 1e-4); + assertEquals(24.850000000000, fluid.getTemperature("C"), 1e-4); + assertEquals(76.7300000, fluid.getTemperature("F"), 1e-4); + assertEquals(536.4, fluid.getTemperature("R"), 1e-4); + + fluid.setTemperature(11.0, "F"); + testOps.TPflash(); + + assertEquals(470.67, fluid.getTemperature("R"), 1e-4); + assertEquals(-11.6666666666, fluid.getTemperature("C"), 1e-4); + assertEquals(261.483333333, fluid.getTemperature("K"), 1e-4); + + fluid.setTemperature(527.67, "R"); + testOps.TPflash(); + + assertEquals(68.0, fluid.getTemperature("F"), 1e-4); + assertEquals(20.0, fluid.getTemperature("C"), 1e-4); + assertEquals(293.15, fluid.getTemperature("K"), 1e-4); + + fluid.setTemperature(25.25, "C"); + testOps.TPflash(); + + assertEquals(77.4499999999, fluid.getTemperature("F"), 1e-4); + assertEquals(537.12, fluid.getTemperature("R"), 1e-4); + assertEquals(298.4, fluid.getTemperature("K"), 1e-4); + + } +} + From bd3e1186141e13c48b531070205565b792384e25 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:39:14 +0200 Subject: [PATCH 172/317] added more field units (#985) * added more field units * more updates to units * more field units * add possibility to see available units * fix test for units * update text * update --- src/main/java/neqsim/Units.java | 83 ----------- src/main/java/neqsim/thermo/phase/Phase.java | 68 ++++++++- .../neqsim/thermo/phase/PhaseInterface.java | 18 ++- .../neqsim/thermo/system/SystemThermo.java | 114 +++++++++------ .../thermo/system/neqsim_Units.code-search | 82 +++++++++++ src/main/java/neqsim/util/unit/Units.java | 131 ++++++++++++++++++ .../neqsim/thermo/system/SystemPrEoSTest.java | 10 +- src/test/java/neqsim/util/unit/UnitsTest.java | 31 +++++ 8 files changed, 398 insertions(+), 139 deletions(-) delete mode 100644 src/main/java/neqsim/Units.java create mode 100644 src/main/java/neqsim/thermo/system/neqsim_Units.code-search create mode 100644 src/main/java/neqsim/util/unit/Units.java create mode 100644 src/test/java/neqsim/util/unit/UnitsTest.java diff --git a/src/main/java/neqsim/Units.java b/src/main/java/neqsim/Units.java deleted file mode 100644 index 95ea4615ee..0000000000 --- a/src/main/java/neqsim/Units.java +++ /dev/null @@ -1,83 +0,0 @@ -package neqsim; - -import java.util.HashMap; - -/** - *- * Units class. - *
- * - * @author even - * @version $Id: $Id - */ -public class Units { - /** - * Unit class nested within Units. - */ - public class Unit { - public String symbol; - public String symbolName; - - public Unit(String symbol, String symbolName) { - this.symbol = symbol; - this.symbolName = symbolName; - } - } - - public static HashMap* getInternalEnergy. @@ -1973,4 +1980,13 @@ public default boolean hasComponent(String name) { * @return speed of sound in m/s */ public double getSoundSpeed(); + + /** + * method to get the speed of sound of a system. The sound speed is implemented based on a molar + * average over the phases + * + * @param unit Supported units are m/s, km/h + * @return speed of sound in m/s + */ + public double getSoundSpeed(String unit); } diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index bed0896285..cbb768dfe8 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -1589,7 +1589,7 @@ public void createDatabase(boolean reset) { @Override public String[][] createTable(String name) { initProperties(); - neqsim.Units units = new neqsim.Units(); + neqsim.util.unit.Units units = new neqsim.util.unit.Units(); java.text.DecimalFormat nf = new java.text.DecimalFormat(); java.text.DecimalFormatSymbols symbols = new java.text.DecimalFormatSymbols(); @@ -1624,15 +1624,13 @@ public String[][] createTable(String name) { } buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 4][1] = - nf.format(getMolarMass() * 1000, buf, test).toString(); + nf.format(getMolarMass(units.getSymbol("Molar Mass")), buf, test).toString(); buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 9][1] = - nf.format(getEnthalpy() / (getTotalNumberOfMoles() * getMolarMass() * 1000), buf, test) - .toString(); + nf.format(getEnthalpy(units.getSymbol("enthalpy")), buf, test).toString(); buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 10][1] = - nf.format(getEntropy() / (getTotalNumberOfMoles() * getMolarMass() * 1000), buf, test) - .toString(); + nf.format(getEntropy(units.getSymbol("entropy")), buf, test).toString(); for (int i = 0; i < numberOfPhases; i++) { for (int j = 0; j < getPhases()[0].getNumberOfComponents(); j++) { @@ -1645,24 +1643,26 @@ public String[][] createTable(String name) { buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; - table[getPhases()[0].getNumberOfComponents() + 2][i + 2] = nf - .format(getPhase(i).getDensity(neqsim.Units.activeUnits.get("density").symbol), buf, test) - .toString(); + table[getPhases()[0].getNumberOfComponents() + 2][i + 2] = + nf.format(getPhase(i).getDensity(units.activeUnits.get("density").symbol), buf, test) + .toString(); table[getPhases()[0].getNumberOfComponents() + 2][6] = - neqsim.Units.activeUnits.get("density").symbol; + units.activeUnits.get("density").symbol; // Double.longValue(system.getPhase(i).getBeta()); buf = new StringBuffer(); - table[getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; + table[getPhases()[0].getNumberOfComponents() + 3][0] = "Phase Fraction"; table[getPhases()[0].getNumberOfComponents() + 3][i + 2] = nf.format(getPhase(i).getBeta(), buf, test).toString(); table[getPhases()[0].getNumberOfComponents() + 3][6] = "[mole fraction]"; buf = new StringBuffer(); - table[getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; + table[getPhases()[0].getNumberOfComponents() + 4][0] = "Molar Mass"; table[getPhases()[0].getNumberOfComponents() + 4][i + 2] = - nf.format(getPhase(i).getMolarMass() * 1000, buf, test).toString(); - table[getPhases()[0].getNumberOfComponents() + 4][6] = "[kg/kmol]"; + nf.format(getPhase(i).getMolarMass(units.activeUnits.get("Molar Mass").symbol), buf, test) + .toString(); + table[getPhases()[0].getNumberOfComponents() + 4][6] = + units.activeUnits.get("Molar Mass").symbol; buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 5][0] = "Z factor"; @@ -1672,60 +1672,62 @@ public String[][] createTable(String name) { buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 6][0] = "Heat Capacity (Cp)"; - table[getPhases()[0].getNumberOfComponents() + 6][i + 2] = nf.format( - (getPhase(i).getCp() - / (getPhase(i).getNumberOfMolesInPhase() * getPhase(i).getMolarMass() * 1000)), - buf, test).toString(); - table[getPhases()[0].getNumberOfComponents() + 6][6] = "[kJ/kg*K]"; + table[getPhases()[0].getNumberOfComponents() + 6][i + 2] = + nf.format((getPhase(i).getCp(units.activeUnits.get("Heat Capacity (Cp)").symbol)), buf, + test).toString(); + table[getPhases()[0].getNumberOfComponents() + 6][6] = + units.activeUnits.get("Heat Capacity (Cp)").symbol; buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 7][0] = "Heat Capacity (Cv)"; - table[getPhases()[0].getNumberOfComponents() + 7][i + 2] = nf.format( - (getPhase(i).getCv() - / (getPhase(i).getNumberOfMolesInPhase() * getPhase(i).getMolarMass() * 1000)), - buf, test).toString(); - table[getPhases()[0].getNumberOfComponents() + 7][6] = "[kJ/kg*K]"; + table[getPhases()[0].getNumberOfComponents() + 7][i + 2] = + nf.format((getPhase(i).getCv(units.activeUnits.get("Heat Capacity (Cv)").symbol)), buf, + test).toString(); + table[getPhases()[0].getNumberOfComponents() + 7][6] = + units.activeUnits.get("Heat Capacity (Cv)").symbol; buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 8][0] = "Speed of Sound"; table[getPhases()[0].getNumberOfComponents() + 8][i + 2] = - nf.format((getPhase(i).getSoundSpeed()), buf, test).toString(); - table[getPhases()[0].getNumberOfComponents() + 8][6] = "[m/sec]"; + nf.format((getPhase(i).getSoundSpeed(units.getSymbol("speed of sound"))), buf, test) + .toString(); + table[getPhases()[0].getNumberOfComponents() + 8][6] = units.getSymbol("speed of sound"); buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 9][0] = "Enthalpy"; table[getPhases()[0].getNumberOfComponents() + 9][i + 2] = - nf.format((getPhase(i).getEnthalpy(neqsim.Units.getSymbol("enthalpy"))), buf, test) - .toString(); - table[getPhases()[0].getNumberOfComponents() + 9][6] = neqsim.Units.getSymbol("enthalpy"); + nf.format((getPhase(i).getEnthalpy(units.getSymbol("enthalpy"))), buf, test).toString(); + table[getPhases()[0].getNumberOfComponents() + 9][6] = units.getSymbol("enthalpy"); buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 10][0] = "Entropy"; table[getPhases()[0].getNumberOfComponents() + 10][i + 2] = - nf.format((getPhase(i).getEntropy(neqsim.Units.getSymbol("entropy"))), buf, test) - .toString(); - table[getPhases()[0].getNumberOfComponents() + 10][6] = neqsim.Units.getSymbol("entropy"); + nf.format((getPhase(i).getEntropy(units.getSymbol("entropy"))), buf, test).toString(); + table[getPhases()[0].getNumberOfComponents() + 10][6] = units.getSymbol("entropy"); buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 11][0] = "JT coefficient"; table[getPhases()[0].getNumberOfComponents() + 11][i + 2] = - nf.format((getPhase(i).getJouleThomsonCoefficient()), buf, test).toString(); - table[getPhases()[0].getNumberOfComponents() + 11][6] = "[K/bar]"; + nf.format((getPhase(i).getJouleThomsonCoefficient(units.getSymbol("JT coefficient"))), + buf, test).toString(); + table[getPhases()[0].getNumberOfComponents() + 11][6] = units.getSymbol("JT coefficient"); buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 13][0] = "Viscosity"; table[getPhases()[0].getNumberOfComponents() + 13][i + 2] = - nf.format((getPhase(i).getPhysicalProperties().getViscosity()), buf, test).toString(); - table[getPhases()[0].getNumberOfComponents() + 13][6] = "[kg/m*sec]"; + nf.format((getPhase(i).getViscosity(units.getSymbol("viscosity"))), buf, test).toString(); + table[getPhases()[0].getNumberOfComponents() + 13][6] = units.getSymbol("viscosity"); buf = new StringBuffer(); - table[getPhases()[0].getNumberOfComponents() + 14][0] = "Conductivity"; + table[getPhases()[0].getNumberOfComponents() + 14][0] = "Thermal Conductivity"; table[getPhases()[0].getNumberOfComponents() + 14][i + 2] = - nf.format(getPhase(i).getPhysicalProperties().getConductivity(), buf, test).toString(); - table[getPhases()[0].getNumberOfComponents() + 14][6] = "[W/m*K]"; + nf.format(getPhase(i).getThermalConductivity(units.getSymbol("thermal concdutivity")), + buf, test).toString(); + table[getPhases()[0].getNumberOfComponents() + 14][6] = + units.getSymbol("thermal concdutivity"); buf = new StringBuffer(); - table[getPhases()[0].getNumberOfComponents() + 15][0] = "SurfaceTension"; + table[getPhases()[0].getNumberOfComponents() + 15][0] = "Surface Tension"; try { if (i < numberOfPhases - 1) { table[getPhases()[0].getNumberOfComponents() + 15][2] = @@ -1760,14 +1762,14 @@ public String[][] createTable(String name) { buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 19][0] = "Pressure"; table[getPhases()[0].getNumberOfComponents() + 19][i + 2] = - Double.toString(getPhase(i).getPressure(neqsim.Units.getSymbol("pressure"))); - table[getPhases()[0].getNumberOfComponents() + 19][6] = neqsim.Units.getSymbol("pressure"); + Double.toString(getPhase(i).getPressure(units.getSymbol("pressure"))); + table[getPhases()[0].getNumberOfComponents() + 19][6] = units.getSymbol("pressure"); buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 20][0] = "Temperature"; table[getPhases()[0].getNumberOfComponents() + 20][i + 2] = - Double.toString(getPhase(i).getTemperature(neqsim.Units.getSymbol("temperature"))); - table[getPhases()[0].getNumberOfComponents() + 20][6] = neqsim.Units.getSymbol("temperature"); + Double.toString(getPhase(i).getTemperature(units.getSymbol("temperature"))); + table[getPhases()[0].getNumberOfComponents() + 20][6] = units.getSymbol("temperature"); Double.toString(getPhase(i).getTemperature()); buf = new StringBuffer(); @@ -1993,6 +1995,9 @@ public double getCp(String unit) { case "kJ/kgK": conversionFactor = 1.0 / getTotalNumberOfMoles() / getMolarMass() / 1000.0; break; + case "btu/lbmole-F": + conversionFactor = 1.0 / getTotalNumberOfMoles() / getMolarMass() / 1000.0 * 0.2388; + break; default: throw new RuntimeException("unit not supported " + unit); } @@ -2027,6 +2032,9 @@ public double getCv(String unit) { case "kJ/kgK": conversionFactor = 1.0 / getTotalNumberOfMoles() / getMolarMass() / 1000.0; break; + case "btu/lbmole-F": + conversionFactor = 1.0 / getTotalNumberOfMoles() / getMolarMass() / 1000.0 * 0.2388; + break; default: throw new RuntimeException("unit not supported " + unit); } @@ -2206,6 +2214,9 @@ public double getEntropy(String unit) { case "kJ/kgK": conversionFactor = 1.0 / getTotalNumberOfMoles() / getMolarMass() / 1000.0; break; + case "btu/lb-F": + conversionFactor = 1.0 / getTotalNumberOfMoles() / getMolarMass() / 1000.0 * 0.2388; + break; default: throw new RuntimeException("unit not supported " + unit); } @@ -2476,6 +2487,12 @@ public double getJouleThomsonCoefficient(String unit) { case "C/bar": conversionFactor = 1.0; break; + case "K/Pa": + conversionFactor = 1.0e-5; + break; + case "F/psi": + conversionFactor = 1.8 * 1.0 / 14.503773773; + break; default: break; } @@ -2624,6 +2641,9 @@ public double getMolarMass(String unit) { case "gr/mol": conversionFactor = 1000.0; break; + case "lbm/lbmol": + conversionFactor = 1000.0; + break; default: throw new RuntimeException("unit not supported " + unit); } @@ -3012,6 +3032,9 @@ public double getSoundSpeed(String unit) { case "km/hr": conversionFactor = 3.6; break; + case "ft/sec": + conversionFactor = 3.280839895; + break; default: break; } @@ -3092,6 +3115,9 @@ public double getThermalConductivity(String unit) { case "W/cmK": conversionFactor = 0.01; break; + case "Btu/hr-ft-F": + conversionFactor = 0.5781759824; + break; default: throw new RuntimeException("unit not supported " + unit); } diff --git a/src/main/java/neqsim/thermo/system/neqsim_Units.code-search b/src/main/java/neqsim/thermo/system/neqsim_Units.code-search new file mode 100644 index 0000000000..9efddee9b3 --- /dev/null +++ b/src/main/java/neqsim/thermo/system/neqsim_Units.code-search @@ -0,0 +1,82 @@ +# Query: neqsim.Units +# ContextLines: 1 + +26 results - 1 file + +src/main/java/neqsim/thermo/system/SystemThermo.java: + 1635 table[getPhases()[0].getNumberOfComponents() + 9][1] = nf + 1636: .format(getEnthalpy(neqsim.Units.getSymbol("enthalpy")), buf, test) + 1637 .toString(); + + 1639 table[getPhases()[0].getNumberOfComponents() + 10][1] = nf + 1640: .format(getEntropy(neqsim.Units.getSymbol("entropy")), buf, test) + 1641 .toString(); + + 1653 table[getPhases()[0].getNumberOfComponents() + 2][i + 2] = nf + 1654: .format(getPhase(i).getDensity(neqsim.Units.activeUnits.get("density").symbol), buf, test) + 1655 .toString(); + 1656: table[getPhases()[0].getNumberOfComponents() + 2][6] = neqsim.Units.activeUnits.get("density").symbol; + 1657 + + 1666 table[getPhases()[0].getNumberOfComponents() + 4][i + 2] = nf + 1667: .format(getPhase(i).getMolarMass(neqsim.Units.activeUnits.get("Molar Mass").symbol), buf, test) + 1668 .toString(); + 1669: table[getPhases()[0].getNumberOfComponents() + 4][6] = neqsim.Units.activeUnits.get("Molar Mass").symbol; + 1670 + + 1678 table[getPhases()[0].getNumberOfComponents() + 6][i + 2] = nf.format( + 1679: (getPhase(i).getCp(neqsim.Units.activeUnits.get("Heat Capacity (Cp)").symbol)), + 1680 buf, test).toString(); + 1681: table[getPhases()[0].getNumberOfComponents() + 6][6] = neqsim.Units.activeUnits.get("Heat Capacity (Cp)").symbol; + 1682 + + 1685 table[getPhases()[0].getNumberOfComponents() + 7][i + 2] = nf.format( + 1686: (getPhase(i).getCv(neqsim.Units.activeUnits.get("Heat Capacity (Cv)").symbol)), + 1687 buf, test).toString(); + 1688: table[getPhases()[0].getNumberOfComponents() + 7][6] = neqsim.Units.activeUnits.get("Heat Capacity (Cv)").symbol; + 1689 + + 1692 table[getPhases()[0].getNumberOfComponents() + 8][i + 2] = nf + 1693: .format((getPhase(i).getSoundSpeed(neqsim.Units.getSymbol("speed of sound"))), buf, test) + 1694 .toString(); + 1695: table[getPhases()[0].getNumberOfComponents() + 8][6] = neqsim.Units.getSymbol("speed of sound"); + 1696 + + 1699 table[getPhases()[0].getNumberOfComponents() + 9][i + 2] = nf + 1700: .format((getPhase(i).getEnthalpy(neqsim.Units.getSymbol("enthalpy"))), buf, test) + 1701 .toString(); + 1702: table[getPhases()[0].getNumberOfComponents() + 9][6] = neqsim.Units.getSymbol("enthalpy"); + 1703 + + 1706 table[getPhases()[0].getNumberOfComponents() + 10][i + 2] = nf + 1707: .format((getPhase(i).getEntropy(neqsim.Units.getSymbol("entropy"))), buf, test) + 1708 .toString(); + 1709: table[getPhases()[0].getNumberOfComponents() + 10][6] = neqsim.Units.getSymbol("entropy"); + 1710 + + 1713 table[getPhases()[0].getNumberOfComponents() + 11][i + 2] = nf + 1714: .format((getPhase(i).getJouleThomsonCoefficient(neqsim.Units.getSymbol("JT coefficient"))), buf, test) + 1715 .toString(); + 1716: table[getPhases()[0].getNumberOfComponents() + 11][6] = neqsim.Units.getSymbol("JT coefficient"); + 1717 + + 1720 table[getPhases()[0].getNumberOfComponents() + 13][i + 2] = nf + 1721: .format((getPhase(i).getViscosity(neqsim.Units.getSymbol("viscosity"))), buf, test).toString(); + 1722: table[getPhases()[0].getNumberOfComponents() + 13][6] = neqsim.Units.getSymbol("viscosity"); + 1723 + + 1726 table[getPhases()[0].getNumberOfComponents() + 14][i + 2] = nf + 1727: .format(getPhase(i).getThermalConductivity(neqsim.Units.getSymbol("thermal concdutivity")), buf, test) + 1728 .toString(); + 1729: table[getPhases()[0].getNumberOfComponents() + 14][6] = neqsim.Units.getSymbol("thermal concdutivity"); + 1730 + + 1766 table[getPhases()[0].getNumberOfComponents() + 19][i + 2] = Double + 1767: .toString(getPhase(i).getPressure(neqsim.Units.getSymbol("pressure"))); + 1768: table[getPhases()[0].getNumberOfComponents() + 19][6] = neqsim.Units.getSymbol("pressure"); + 1769 + + 1772 table[getPhases()[0].getNumberOfComponents() + 20][i + 2] = Double + 1773: .toString(getPhase(i).getTemperature(neqsim.Units.getSymbol("temperature"))); + 1774: table[getPhases()[0].getNumberOfComponents() + 20][6] = neqsim.Units.getSymbol("temperature"); + 1775 Double.toString(getPhase(i).getTemperature()); diff --git a/src/main/java/neqsim/util/unit/Units.java b/src/main/java/neqsim/util/unit/Units.java new file mode 100644 index 0000000000..8abb83534f --- /dev/null +++ b/src/main/java/neqsim/util/unit/Units.java @@ -0,0 +1,131 @@ +package neqsim.util.unit; + +import java.util.HashMap; + +/** + *
+ * Units class. + *
+ * + * @author even + * @version $Id: $Id + */ +public class Units { + + /** + * Unit class nested within Units. + */ + public class UnitDescription { + public String symbol; + public String symbolName; + + public UnitDescription(String symbol, String symbolName) { + this.symbol = symbol; + this.symbolName = symbolName; + } + } + + public static HashMap+ * toJson. + *
+ * + * @return a String + */ + public String toJson(); } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/TwoPortEquipment.java b/src/main/java/neqsim/processSimulation/processEquipment/TwoPortEquipment.java index 489edf9801..286de84623 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/TwoPortEquipment.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/TwoPortEquipment.java @@ -106,4 +106,10 @@ public void setOutletStream(StreamInterface stream) { public void setOutletTemperature(double temperature) { this.outStream.setTemperature(temperature, "unit"); } + + /** {@inheritDoc} */ + @Override + public String toJson() { + return null; + } } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java index 244264afb1..cdcc8b1b1f 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java @@ -12,9 +12,11 @@ import javax.swing.JTable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.google.gson.GsonBuilder; import neqsim.processSimulation.mechanicalDesign.compressor.CompressorMechanicalDesign; import neqsim.processSimulation.processEquipment.TwoPortEquipment; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.processSimulation.util.monitor.CompressorResponse; import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -1422,4 +1424,9 @@ public void setCompressionRatio(double compRatio) { public double getCompressionRatio() { return compressionRatio; } + + @Override + public String toJson() { + return new GsonBuilder().create().toJson(new CompressorResponse(this)); + } } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Cooler.java b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Cooler.java index 21e9078916..8f3903846b 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Cooler.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Cooler.java @@ -1,8 +1,9 @@ package neqsim.processSimulation.processEquipment.heatExchanger; import java.util.UUID; - +import com.google.gson.GsonBuilder; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.processSimulation.util.monitor.HeaterResponse; /** *@@ -76,4 +77,10 @@ public double getEntropyProduction(String unit) { return entrop; } + + /** {@inheritDoc} */ + @Override + public String toJson() { + return new GsonBuilder().create().toJson(new HeaterResponse(this)); + } } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java index 6a3f761164..1daaad0eac 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/heatExchanger/Heater.java @@ -7,9 +7,11 @@ package neqsim.processSimulation.processEquipment.heatExchanger; import java.util.UUID; +import com.google.gson.GsonBuilder; import neqsim.processSimulation.processEquipment.TwoPortEquipment; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.processSimulation.util.monitor.HeaterResponse; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -369,4 +371,10 @@ public double getExergyChange(String unit, double surroundingTemperature) { return outStream.getThermoSystem().getExergy(surroundingTemperature, unit) - inStream.getThermoSystem().getExergy(surroundingTemperature, unit); } + + /** {@inheritDoc} */ + @Override + public String toJson() { + return new GsonBuilder().create().toJson(new HeaterResponse(this)); + } } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java index 5ff92fd37d..f2c074dbd2 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java @@ -11,6 +11,7 @@ import java.util.UUID; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.google.gson.GsonBuilder; import neqsim.processSimulation.mechanicalDesign.separator.SeparatorMechanicalDesign; import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass; import neqsim.processSimulation.processEquipment.mixer.Mixer; @@ -21,6 +22,7 @@ import neqsim.processSimulation.processEquipment.separator.sectionType.ValveSection; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.processSimulation.util.monitor.SeparatorResponse; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -871,6 +873,12 @@ public boolean equals(Object obj) { && Objects.equals(waterSystem, other.waterSystem); } + /** {@inheritDoc} */ + @Override + public String toJson() { + return new GsonBuilder().create().toJson(new SeparatorResponse(this)); + } + /* * private class SeparatorReport extends Object{ public Double gasLoadFactor; SeparatorReport(){ * gasLoadFactor = getGasLoadFactor(); } } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/ThreePhaseSeparator.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/ThreePhaseSeparator.java index dc1d1abee6..daf8431c6d 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/separator/ThreePhaseSeparator.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/ThreePhaseSeparator.java @@ -1,8 +1,10 @@ package neqsim.processSimulation.processEquipment.separator; import java.util.UUID; +import com.google.gson.GsonBuilder; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.processSimulation.util.monitor.SeparatorResponse; import neqsim.thermodynamicOperations.ThermodynamicOperations; /** @@ -267,4 +269,10 @@ public double getExergyChange(String unit, double surroundingTemperature) { + getOilOutStream().getThermoSystem().getEntropy(unit) + getGasOutStream().getThermoSystem().getExergy(surroundingTemperature, unit) - entrop; } + + /** {@inheritDoc} */ + @Override + public String toJson() { + return new GsonBuilder().create().toJson(new SeparatorResponse(this)); + } } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java index 9ac23af967..1c8434c3d7 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java @@ -6,10 +6,14 @@ package neqsim.processSimulation.processEquipment.stream; +import java.util.ArrayList; +import java.util.HashMap; import java.util.UUID; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.google.gson.GsonBuilder; import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass; +import neqsim.processSimulation.util.monitor.StreamResponse; import neqsim.standards.gasQuality.Standard_ISO6976; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -436,9 +440,11 @@ public void displayResult() { */ @Override public String[][] getResultTable() { - return getFluid().getResultTable(); + return getFluid().calcResultTable(); } + + /** {@inheritDoc} */ @Override public void runTransient(double dt, UUID id) { @@ -607,4 +613,55 @@ public SystemInterface getFluid() { return thermoSystem; } } + + /** + *
+ * getReport. + *
+ * + * @return a String object + */ + public ArrayList* Constructor for StreamResponse. *
* - * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object + * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ public StreamResponse(StreamInterface inputStream) { + name = inputStream.getName(); + + data.add(new String[] {"temperature", + Double + .toString(inputStream.getTemperature(neqsim.util.unit.Units.getSymbol("temperature"))), + neqsim.util.unit.Units.getSymbol("temperature")}); + data.add(new String[] {"pressure", + Double.toString(inputStream.getPressure(neqsim.util.unit.Units.getSymbol("pressure"))), + neqsim.util.unit.Units.getSymbol("pressure")}); + fluid = new Fluid(inputStream.getFluid()); temperature = inputStream.getTemperature("C"); pressure = inputStream.getPressure("bara"); diff --git a/src/main/java/neqsim/processSimulation/util/monitor/ValveResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/ValveResponse.java new file mode 100644 index 0000000000..31530f584a --- /dev/null +++ b/src/main/java/neqsim/processSimulation/util/monitor/ValveResponse.java @@ -0,0 +1,45 @@ +package neqsim.processSimulation.util.monitor; + +import java.util.ArrayList; +import neqsim.processSimulation.processEquipment.valve.ValveInterface; + +/** + *+ * StreamResponse class. + *
+ * + * @author asmund + * @version $Id: $Id + */ +public class ValveResponse { + public String name; + public ArrayList+ * Constructor for StreamResponse. + *
+ * + * @param valve a {@link neqsim.processSimulation.processEquipment.valve.ValveInterface} object + */ + public ValveResponse(ValveInterface valve) { + + name = valve.getName(); + + data.add(new String[] {"outlet temperature", + Double.toString(valve.getOutletStream() + .getTemperature(neqsim.util.unit.Units.getSymbol("temperature"))), + neqsim.util.unit.Units.getSymbol("temperature")}); + data.add(new String[] {"outlet pressure", + Double.toString( + valve.getOutletStream().getPressure(neqsim.util.unit.Units.getSymbol("pressure"))), + neqsim.util.unit.Units.getSymbol("pressure")}); + } + + /** + *+ * print. + *
+ */ + public void print() {} +} diff --git a/src/main/java/neqsim/processSimulation/util/report/Report.java b/src/main/java/neqsim/processSimulation/util/report/Report.java new file mode 100644 index 0000000000..d8df0adffd --- /dev/null +++ b/src/main/java/neqsim/processSimulation/util/report/Report.java @@ -0,0 +1,35 @@ +package neqsim.processSimulation.util.report; + +import java.util.HashMap; +import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface; +import neqsim.processSimulation.processSystem.ProcessSystem; + +/** + *+ * Report class. + *
+ * + * @author even + * @version $Id: $Id + */ +public class Report { + public static HashMap+ * In this method all thermodynamic and unit operations will be calculated in a steady state + * calculation. It does not solve resycles - only calculates one step. + *
+ */ + public default void run_step() { + run_step(UUID.randomUUID()); + } + + /** + *+ * run_step + *
+ * In this method all thermodynamic and unit operations will be calculated in a steady state + * calculation. Sets calc identifier UUID. It does not solve resycles - only calculates one step + * + * @param value Calc identifier UUID to set. + */ + public void run_step(UUID value); + /** *
* runTransient
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java
index 20c2ab9fc4..89b4e8b978 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java
@@ -9,6 +9,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;
+import java.util.UUID;
import org.apache.commons.lang.SerializationUtils;
import neqsim.processSimulation.SimulationBaseClass;
import neqsim.processSimulation.controllerDevice.ControllerDeviceInterface;
@@ -292,4 +293,10 @@ public boolean equals(Object obj) {
public String toJson() {
return null;
}
+
+ /** {@inheritDoc} */
+ @Override
+ public void run_step(UUID id) {
+
+ }
}
diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
index b417d0a614..490914d350 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java
@@ -260,4 +260,11 @@ public ProcessModule copy() {
public ArrayList
* runTransient.
diff --git a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java
index 36d7d4a45a..ee17daeede 100644
--- a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java
+++ b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemTest.java
@@ -572,4 +572,339 @@ public void runTEGProcessTest2() {
assertEquals(1.5322819175995646E-5, dehydratedGas.getFluid().getComponent("water").getx(),
1e-6);
}
+
+
+ @Test
+ public void testRun_step() {
+ neqsim.thermo.system.SystemInterface feedGas =
+ new neqsim.thermo.system.SystemSrkCPAstatoil(273.15 + 42.0, 10.00);
+ feedGas.addComponent("nitrogen", 0.245);
+ feedGas.addComponent("CO2", 3.4);
+ feedGas.addComponent("methane", 85.7);
+ feedGas.addComponent("ethane", 5.981);
+ feedGas.addComponent("propane", 0.2743);
+ feedGas.addComponent("i-butane", 0.037);
+ feedGas.addComponent("n-butane", 0.077);
+ feedGas.addComponent("i-pentane", 0.0142);
+ feedGas.addComponent("n-pentane", 0.0166);
+ feedGas.addComponent("n-hexane", 0.006);
+ feedGas.addComponent("benzene", 0.001);
+ feedGas.addComponent("water", 0.0);
+ feedGas.addComponent("TEG", 0);
+ feedGas.setMixingRule(10);
+ feedGas.setMultiPhaseCheck(false);
+ feedGas.init(0);
+
+ Stream dryFeedGasSmorbukk = new Stream("dry feed gas Smorbukk", feedGas);
+ dryFeedGasSmorbukk.setFlowRate(10.0, "MSm3/day");
+ dryFeedGasSmorbukk.setTemperature(25.0, "C");
+ dryFeedGasSmorbukk.setPressure(40.0, "bara");
+
+ StreamSaturatorUtil saturatedFeedGasSmorbukk =
+ new StreamSaturatorUtil("water saturator Smorbukk", dryFeedGasSmorbukk);
+
+ Stream waterSaturatedFeedGasSmorbukk =
+ new Stream("water saturated feed gas Smorbukk", saturatedFeedGasSmorbukk.getOutletStream());
+
+ HydrateEquilibriumTemperatureAnalyser hydrateTAnalyserSmorbukk =
+ new HydrateEquilibriumTemperatureAnalyser(waterSaturatedFeedGasSmorbukk);
+ hydrateTAnalyserSmorbukk.setName("hydrate temperature analyser Smorbukk");
+
+ Splitter SmorbukkSplit = new Splitter("Smorbukk Splitter", waterSaturatedFeedGasSmorbukk);
+ double[] splitSmorbukk = {1.0 - 1e-10, 1e-10};
+ SmorbukkSplit.setSplitFactors(splitSmorbukk);
+
+ Stream dryFeedGasMidgard = new Stream("dry feed gas Midgard201", feedGas.clone());
+ dryFeedGasMidgard.setFlowRate(10, "MSm3/day");
+ dryFeedGasMidgard.setTemperature(5, "C");
+ dryFeedGasMidgard.setPressure(40.0, "bara");
+
+ StreamSaturatorUtil saturatedFeedGasMidgard =
+ new StreamSaturatorUtil("water saturator Midgard", dryFeedGasMidgard);
+
+ Stream waterSaturatedFeedGasMidgard =
+ new Stream("water saturated feed gas Midgard", saturatedFeedGasMidgard.getOutletStream());
+
+ HydrateEquilibriumTemperatureAnalyser hydrateTAnalyserMidgard =
+ new HydrateEquilibriumTemperatureAnalyser(waterSaturatedFeedGasMidgard);
+ hydrateTAnalyserMidgard.setName("hydrate temperature analyser Midgard");
+
+ Splitter MidgardSplit = new Splitter("Midgard Splitter", waterSaturatedFeedGasMidgard);
+ double[] splitMidgard = {1e-10, 1 - 1e-10};
+ MidgardSplit.setSplitFactors(splitMidgard);
+
+ StaticMixer TrainB = new StaticMixer("mixer TrainB");
+ TrainB.addStream(SmorbukkSplit.getSplitStream(1));
+ TrainB.addStream(MidgardSplit.getSplitStream(1));
+
+ Heater feedTPsetterToAbsorber = new Heater("TP of gas to absorber", TrainB.getOutletStream());
+ feedTPsetterToAbsorber.setOutPressure(40.0, "bara");
+ feedTPsetterToAbsorber.setOutTemperature(37.0, "C");
+
+ Stream feedToAbsorber =
+ new Stream("feed to TEG absorber", feedTPsetterToAbsorber.getOutletStream());
+
+ HydrateEquilibriumTemperatureAnalyser hydrateTAnalyser2 =
+ new HydrateEquilibriumTemperatureAnalyser(feedToAbsorber);
+ hydrateTAnalyser2.setName("hydrate temperature gas to absorber");
+
+ WaterDewPointAnalyser waterDewPointAnalyserToAbsorber =
+ new WaterDewPointAnalyser(feedToAbsorber);
+ waterDewPointAnalyserToAbsorber.setMethod("multiphase");
+ waterDewPointAnalyserToAbsorber.setReferencePressure(40.0);
+ waterDewPointAnalyserToAbsorber.setName("water dew point gas to absorber");
+
+ neqsim.thermo.system.SystemInterface feedTEG =
+ (neqsim.thermo.system.SystemInterface) feedGas.clone();
+ feedTEG.setMolarComposition(
+ new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.99});
+
+ Stream TEGFeed = new Stream("lean TEG to absorber", feedTEG);
+ TEGFeed.setFlowRate(8000.0, "kg/hr");
+ TEGFeed.setTemperature(40.0, "C");
+ TEGFeed.setPressure(40.0, "bara");
+
+ SimpleTEGAbsorber absorber = new SimpleTEGAbsorber("TEG absorber");
+ absorber.addGasInStream(feedToAbsorber);
+ absorber.addSolventInStream(TEGFeed);
+ absorber.setNumberOfStages(4);
+ absorber.setStageEfficiency(0.8);
+ absorber.setInternalDiameter(2.240);
+
+ Stream dehydratedGas = new Stream("dry gas from absorber", absorber.getGasOutStream());
+
+ Stream richTEG = new Stream("rich TEG from absorber", absorber.getLiquidOutStream());
+
+ HydrateEquilibriumTemperatureAnalyser waterDewPointAnalyser =
+ new HydrateEquilibriumTemperatureAnalyser(dehydratedGas);
+ waterDewPointAnalyser.setReferencePressure(70.0);
+ waterDewPointAnalyser.setName("hydrate dew point analyser");
+
+ WaterDewPointAnalyser waterDewPointAnalyser2 = new WaterDewPointAnalyser(dehydratedGas);
+ waterDewPointAnalyser2.setReferencePressure(70.0);
+ waterDewPointAnalyser2.setName("water dew point analyser");
+
+ Heater condHeat = new Heater("Condenser heat exchanger", richTEG);
+
+ ThrottlingValve glycol_flash_valve =
+ new ThrottlingValve("Rich TEG HP flash valve", condHeat.getOutletStream());
+ glycol_flash_valve.setOutletPressure(7.0);
+
+ HeatExchanger heatEx2 =
+ new HeatExchanger("rich TEG heat exchanger 1", glycol_flash_valve.getOutletStream());
+ heatEx2.setGuessOutTemperature(273.15 + 90.0);
+ heatEx2.setUAvalue(1450.0);
+
+ neqsim.thermo.system.SystemInterface feedWater =
+ (neqsim.thermo.system.SystemInterface) feedGas.clone();
+ feedWater.setMolarComposition(
+ new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0});
+
+ double addedWaterRate = 0.0;
+ Stream waterFeed = new Stream("extra water", feedWater);
+ waterFeed.setFlowRate(addedWaterRate, "kg/hr");
+ waterFeed.setTemperature(90.0, "C");
+ waterFeed.setPressure(7.0, "bara");
+
+ Separator flashSep = new Separator("degassing separator", heatEx2.getOutStream(0));
+ if (addedWaterRate > 0) {
+ flashSep.addStream(waterFeed);
+ }
+ flashSep.setInternalDiameter(1.2);
+
+ Stream flashGas = new Stream("gas from degassing separator", flashSep.getGasOutStream());
+
+ Stream flashLiquid =
+ new Stream("liquid from degassing separator", flashSep.getLiquidOutStream());
+
+ Filter filter = new Filter("TEG fine filter", flashLiquid);
+ filter.setDeltaP(0.0, "bara");
+
+ HeatExchanger heatEx =
+ new HeatExchanger("lean/rich TEG heat-exchanger", filter.getOutletStream());
+ heatEx.setGuessOutTemperature(273.15 + 140.0);
+ heatEx.setUAvalue(9140.0);
+
+ double reboilerPressure = 1.4;
+ double condenserPressure = 1.2;
+ double feedPressureGLycol = (reboilerPressure + condenserPressure) / 2.0; // enters middle of
+ // column
+ double feedPressureStripGas = (reboilerPressure + condenserPressure) / 2.0; // enters middle of
+ // column
+
+ ThrottlingValve glycol_flash_valve2 =
+ new ThrottlingValve("LP flash valve", heatEx.getOutStream(0));
+ glycol_flash_valve2.setName("Rich TEG LP flash valve");
+ glycol_flash_valve2.setOutletPressure(feedPressureGLycol);
+
+ neqsim.thermo.system.SystemInterface stripGas =
+ (neqsim.thermo.system.SystemInterface) feedGas.clone();
+ stripGas.setMolarComposition(
+ new double[] {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
+
+ Stream strippingGas = new Stream("stripGas", stripGas);
+ strippingGas.setFlowRate(250.0 * 0.8, "kg/hr");
+ strippingGas.setTemperature(180.0, "C");
+ strippingGas.setPressure(feedPressureStripGas, "bara");
+
+ Stream gasToReboiler = (Stream) strippingGas.clone();
+ gasToReboiler.setName("gas to reboiler");
+
+ DistillationColumn column = new DistillationColumn(1, true, true);
+ column.setName("TEG regeneration column");
+ column.addFeedStream(glycol_flash_valve2.getOutletStream(), 1);
+ column.getReboiler().setOutTemperature(273.15 + 202.0);
+ column.getCondenser().setOutTemperature(273.15 + 89.0);
+ column.getTray(1).addStream(gasToReboiler);
+ column.setTopPressure(condenserPressure);
+ column.setBottomPressure(reboilerPressure);
+ column.setInternalDiameter(0.56);
+
+ Heater coolerRegenGas = new Heater("regen gas cooler", column.getGasOutStream());
+ coolerRegenGas.setOutTemperature(273.15 + 15.0);
+
+ Separator sepregenGas = new Separator("regen gas separator", coolerRegenGas.getOutletStream());
+
+ Stream gasToFlare = new Stream("gas to flare", sepregenGas.getGasOutStream());
+
+ Stream liquidToTrreatment = new Stream("water to treatment", sepregenGas.getLiquidOutStream());
+
+ WaterStripperColumn stripper = new WaterStripperColumn("TEG stripper");
+ stripper.addSolventInStream(column.getLiquidOutStream());
+ stripper.addGasInStream(strippingGas);
+ stripper.setNumberOfStages(3);
+ stripper.setStageEfficiency(0.8);
+
+ Recycle recycleGasFromStripper = new Recycle("stripping gas recirc");
+ recycleGasFromStripper.addStream(stripper.getGasOutStream());
+ recycleGasFromStripper.setOutletStream(gasToReboiler);
+
+ neqsim.thermo.system.SystemInterface pureTEG =
+ (neqsim.thermo.system.SystemInterface) feedGas.clone();
+ pureTEG.setMolarComposition(
+ new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0});
+
+ heatEx.setFeedStream(1, stripper.getLiquidOutStream());
+
+ heatEx2.setFeedStream(1, heatEx.getOutStream(1));
+
+ Pump hotLeanTEGPump = new Pump("lean TEG LP pump", heatEx2.getOutStream(1));
+ hotLeanTEGPump.setOutletPressure(40.0);
+ hotLeanTEGPump.setIsentropicEfficiency(0.9);
+
+ Stream makeupTEG = new Stream("makeup TEG", pureTEG);
+ makeupTEG.setFlowRate(1e-6, "kg/hr");
+ makeupTEG.setTemperature(100.0, "C");
+ makeupTEG.setPressure(40.0, "bara");
+
+ Calculator makeupCalculator = new Calculator("TEG makeup calculator");
+ makeupCalculator.addInputVariable(dehydratedGas);
+ makeupCalculator.addInputVariable(flashGas);
+ makeupCalculator.addInputVariable(gasToFlare);
+ makeupCalculator.addInputVariable(liquidToTrreatment);
+ makeupCalculator.setOutputVariable(makeupTEG);
+
+ StaticMixer makeupMixer = new StaticMixer("makeup mixer");
+ makeupMixer.addStream(hotLeanTEGPump.getOutletStream());
+ makeupMixer.addStream(makeupTEG);
+
+ Heater coolerhOTteg3 = new Heater("lean TEG cooler", makeupMixer.getOutletStream());
+ coolerhOTteg3.setOutTemperature(273.15 + 40.0);
+
+ condHeat.setEnergyStream(column.getCondenser().getEnergyStream());
+
+ Stream leanTEGtoabs = new Stream("resyc lean TEG to absorber", coolerhOTteg3.getOutletStream());
+
+ Recycle resycleLeanTEG = new Recycle("lean TEG resycle");
+ resycleLeanTEG.addStream(leanTEGtoabs);
+ resycleLeanTEG.setOutletStream(TEGFeed);
+ resycleLeanTEG.setPriority(200);
+ resycleLeanTEG.setDownstreamProperty("flow rate");
+
+ neqsim.processSimulation.processSystem.ProcessSystem operations =
+ new neqsim.processSimulation.processSystem.ProcessSystem();
+ operations.add(dryFeedGasSmorbukk);
+ operations.add(saturatedFeedGasSmorbukk);
+ operations.add(waterSaturatedFeedGasSmorbukk);
+ operations.add(hydrateTAnalyserSmorbukk);
+ operations.add(SmorbukkSplit);
+
+ operations.add(dryFeedGasMidgard);
+ operations.add(saturatedFeedGasMidgard);
+ operations.add(waterSaturatedFeedGasMidgard);
+ operations.add(hydrateTAnalyserMidgard);
+
+ operations.add(MidgardSplit);
+
+ operations.add(TrainB);
+
+ operations.add(feedTPsetterToAbsorber);
+ operations.add(feedToAbsorber);
+ operations.add(hydrateTAnalyser2);
+ operations.add(waterDewPointAnalyserToAbsorber);
+ operations.add(TEGFeed);
+ operations.add(absorber);
+ operations.add(dehydratedGas);
+ operations.add(richTEG);
+ operations.add(waterDewPointAnalyser);
+ operations.add(waterDewPointAnalyser2);
+
+ operations.add(condHeat);
+
+ operations.add(glycol_flash_valve);
+ operations.add(heatEx2);
+ operations.add(waterFeed);
+ operations.add(flashSep);
+ operations.add(flashGas);
+ operations.add(flashLiquid);
+
+ operations.add(filter);
+ operations.add(heatEx);
+ operations.add(glycol_flash_valve2);
+ operations.add(strippingGas);
+
+ operations.add(gasToReboiler);
+ operations.add(column);
+
+ operations.add(coolerRegenGas);
+ operations.add(sepregenGas);
+ operations.add(gasToFlare);
+ operations.add(liquidToTrreatment);
+
+ operations.add(stripper);
+ operations.add(recycleGasFromStripper);
+
+ operations.add(hotLeanTEGPump);
+ operations.add(makeupTEG);
+ operations.add(makeupCalculator);
+ operations.add(makeupMixer);
+ operations.add(coolerhOTteg3);
+ operations.add(leanTEGtoabs);
+ operations.add(resycleLeanTEG);
+ operations.run();
+ dryFeedGasMidgard.setFlowRate(11.1, "MSm3/day");
+ operations.run_step();
+ dryFeedGasMidgard.setFlowRate(12.3, "MSm3/day");
+ operations.run_step();
+ dryFeedGasMidgard.setFlowRate(13.5, "MSm3/day");
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ dryFeedGasMidgard.setFlowRate(10.0, "MSm3/day");
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ operations.run_step();
+ assertEquals(1.5322819175995646E-5, dehydratedGas.getFluid().getComponent("water").getx(),
+ 1e-6);
+ }
}
From 861a079c6aac810c4b454e93154d5dd6f334264d Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Tue, 23 Apr 2024 21:24:56 +0200
Subject: [PATCH 175/317] added Value as response (#988)
* added Value as response
* added json report from process object
* update
* update
* fix error.
---
.../SimulationInterface.java | 10 ++++++
.../ProcessEquipmentBaseClass.java | 36 ++++++++++++++-----
.../ProcessEquipmentInterface.java | 10 ++++++
.../processSystem/ProcessModule.java | 36 ++++++++++++++-----
.../processSystem/ProcessModuleBaseClass.java | 9 +++++
.../processSystem/ProcessSystem.java | 10 ++++++
.../util/monitor/StreamResponse.java | 25 ++++++-------
.../processSimulation/util/monitor/Value.java | 15 ++++++++
.../processSimulation/util/report/Report.java | 18 +++++++++-
9 files changed, 138 insertions(+), 31 deletions(-)
create mode 100644 src/main/java/neqsim/processSimulation/util/monitor/Value.java
diff --git a/src/main/java/neqsim/processSimulation/SimulationInterface.java b/src/main/java/neqsim/processSimulation/SimulationInterface.java
index 96b3a9e494..14f971d0bd 100644
--- a/src/main/java/neqsim/processSimulation/SimulationInterface.java
+++ b/src/main/java/neqsim/processSimulation/SimulationInterface.java
@@ -151,4 +151,14 @@ public default void runTransient(double dt, UUID id) {
* @return a boolean
*/
public boolean solved();
+
+ /**
+ *
+ * getReport_json
+ * flowValveController
.
*
energyStream
.
*
*
- * @return a {@link neqsim.processSimulation.processEquipment.stream.EnergyStream} object
+ * @return a
+ * {@link neqsim.processSimulation.processEquipment.stream.EnergyStream}
+ * object
*/
public EnergyStream getEnergyStream() {
return energyStream;
@@ -164,8 +171,9 @@ public EnergyStream getEnergyStream() {
* Setter for the field energyStream
.
*
*
- * @param energyStream a {@link neqsim.processSimulation.processEquipment.stream.EnergyStream}
- * object
+ * @param energyStream a
+ * {@link neqsim.processSimulation.processEquipment.stream.EnergyStream}
+ * object
*/
public void setEnergyStream(EnergyStream energyStream) {
setEnergyStream(true);
@@ -232,7 +240,8 @@ public double getExergyChange(String unit, double surroundingTemperature) {
/** {@inheritDoc} */
@Override
- public void runConditionAnalysis(ProcessEquipmentInterface refExchanger) {}
+ public void runConditionAnalysis(ProcessEquipmentInterface refExchanger) {
+ }
public String conditionAnalysisMessage = "";
@@ -294,6 +303,15 @@ public String toJson() {
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @return a String
+ */
+ public String getReport_json() {
+ return new Report(this).json();
+ }
+
/** {@inheritDoc} */
@Override
public void run_step(UUID id) {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java
index 3e2555bccf..5e29be4dc6 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java
@@ -222,4 +222,14 @@ public default SystemInterface getFluid() {
* @return a String
*/
public String toJson();
+
+ /**
+ * + * getReport_json + *
+ * Return results of simulation in json format + * + * @return a String + */ + public String getReport_json(); } diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java index 490914d350..f6b5230c32 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java +++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModule.java @@ -9,10 +9,13 @@ import neqsim.processSimulation.SimulationBaseClass; import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface; import neqsim.processSimulation.processEquipment.util.Recycle; +import neqsim.processSimulation.util.report.Report; /** - * A class representing a process module class that can contain unit operations and other modules. - * Module will be runnning until all recycles in this module are solved. If no recycle in the module + * A class representing a process module class that can contain unit operations + * and other modules. + * Module will be runnning until all recycles in this module are solved. If no + * recycle in the module * then run only once. * * @author [seros] @@ -53,7 +56,8 @@ public ProcessModule(String name) { /** * Add an unit operation to the process module. * - * @param processSystem the process system that contains the unit operations to be added. + * @param processSystem the process system that contains the unit operations to + * be added. */ public void add(ProcessSystem processSystem) { @@ -82,7 +86,8 @@ public List* Constructor for StreamResponse. *
* - * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param inputStream a + * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ public StreamResponse(StreamInterface inputStream) { name = inputStream.getName(); - data.add(new String[] {"temperature", - Double - .toString(inputStream.getTemperature(neqsim.util.unit.Units.getSymbol("temperature"))), - neqsim.util.unit.Units.getSymbol("temperature")}); - data.add(new String[] {"pressure", - Double.toString(inputStream.getPressure(neqsim.util.unit.Units.getSymbol("pressure"))), - neqsim.util.unit.Units.getSymbol("pressure")}); + data.put("temperature", + new Value(Double.toString(inputStream.getTemperature(neqsim.util.unit.Units.getSymbol("temperature"))), + neqsim.util.unit.Units.getSymbol("temperature"))); + data.put("pressure", + new Value(Double.toString(inputStream.getPressure(neqsim.util.unit.Units.getSymbol("pressure"))), + neqsim.util.unit.Units.getSymbol("pressure"))); fluid = new Fluid(inputStream.getFluid()); temperature = inputStream.getTemperature("C"); @@ -75,5 +75,6 @@ public StreamResponse(StreamInterface inputStream) { * print. * */ - public void print() {} + public void print() { + } } diff --git a/src/main/java/neqsim/processSimulation/util/monitor/Value.java b/src/main/java/neqsim/processSimulation/util/monitor/Value.java new file mode 100644 index 0000000000..a5414e46be --- /dev/null +++ b/src/main/java/neqsim/processSimulation/util/monitor/Value.java @@ -0,0 +1,15 @@ +package neqsim.processSimulation.util.monitor; + +/** + * Unit class nested within Units. + */ +public class Value { + public String value; + public String unit; + + public Value(String value, String unit) { + this.value = value; + this.unit = unit; + } + +} diff --git a/src/main/java/neqsim/processSimulation/util/report/Report.java b/src/main/java/neqsim/processSimulation/util/report/Report.java index d8df0adffd..c12e829548 100644 --- a/src/main/java/neqsim/processSimulation/util/report/Report.java +++ b/src/main/java/neqsim/processSimulation/util/report/Report.java @@ -4,7 +4,10 @@ import java.util.List; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass; import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface; +import neqsim.processSimulation.processSystem.ProcessModule; +import neqsim.processSimulation.processSystem.ProcessModuleBaseClass; import neqsim.processSimulation.processSystem.ProcessSystem; /** @@ -20,12 +23,25 @@ public class Report { public static HashMapflowValveController
.
*
*
- * @param controller a
- * {@link neqsim.processSimulation.controllerDevice.ControllerDeviceInterface}
- * object
+ * @param controller a {@link neqsim.processSimulation.controllerDevice.ControllerDeviceInterface}
+ * object
*/
public void setFlowValveController(ControllerDeviceInterface controller) {
this.flowValveController = controller;
@@ -126,8 +123,7 @@ public MechanicalDesign getMechanicalDesign() {
/** {@inheritDoc} */
@Override
- public void initMechanicalDesign() {
- }
+ public void initMechanicalDesign() {}
/** {@inheritDoc} */
@Override
@@ -158,9 +154,7 @@ public boolean solved() {
* Getter for the field energyStream
.
*
*
- * @return a
- * {@link neqsim.processSimulation.processEquipment.stream.EnergyStream}
- * object
+ * @return a {@link neqsim.processSimulation.processEquipment.stream.EnergyStream} object
*/
public EnergyStream getEnergyStream() {
return energyStream;
@@ -171,9 +165,8 @@ public EnergyStream getEnergyStream() {
* Setter for the field energyStream
.
*
*
- * @param energyStream a
- * {@link neqsim.processSimulation.processEquipment.stream.EnergyStream}
- * object
+ * @param energyStream a {@link neqsim.processSimulation.processEquipment.stream.EnergyStream}
+ * object
*/
public void setEnergyStream(EnergyStream energyStream) {
setEnergyStream(true);
@@ -240,8 +233,7 @@ public double getExergyChange(String unit, double surroundingTemperature) {
/** {@inheritDoc} */
@Override
- public void runConditionAnalysis(ProcessEquipmentInterface refExchanger) {
- }
+ public void runConditionAnalysis(ProcessEquipmentInterface refExchanger) {}
public String conditionAnalysisMessage = "";
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
index 3a3a54262d..9c359a778d 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
@@ -23,27 +23,156 @@ public class StreamResponse {
public Double massflowGas;
public Double massflowOil;
public Double massflowAqueous;
- public HashMap* Constructor for StreamResponse. *
* - * @param inputStream a - * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ public StreamResponse(StreamInterface inputStream) { name = inputStream.getName(); - data.put("temperature", - new Value(Double.toString(inputStream.getTemperature(neqsim.util.unit.Units.getSymbol("temperature"))), + HashMapnumberOfMolesInPhase = numberOfMolesInSystem*beta
. NB!
* numberOfMolesInSystem is not known to the phase.
@@ -2265,6 +2266,12 @@ public double getFlowRate(String flowunit) {
return numberOfMolesInPhase * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R
* ThermodynamicConstantsInterface.standardStateTemperature
/ ThermodynamicConstantsInterface.atm / 1.0e6;
+ } else if (flowunit.equals("lbmole/hr")) {
+ return numberOfMolesInPhase * 3600.0 / 1000.0 * 2.205;
+ } else if (flowunit.equals("lb/hr")) {
+ return numberOfMolesInPhase * getMolarMass() * 60.0 * 2.20462262;
+ } else if (flowunit.equals("barrel/day")) {
+ return numberOfMolesInPhase * getMolarMass() * 60.0 * 2.20462262 * 0.068;
} else {
throw new RuntimeException("failed.. unit: " + flowunit + " not supported");
}
@@ -2304,4 +2311,10 @@ public double getIsothermalCompressibility() {
public double getIsobaricThermalExpansivity() {
return getIsothermalCompressibility() * getdPdTVn();
}
+
+ /** {@inheritDoc} */
+ @Override
+ public String getModelName() {
+ return thermoPropertyModelName;
+ }
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java
index 54a8e4205c..3c910d4a16 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java
@@ -24,10 +24,11 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab
* Add component to component array and update moles variables.
*
*
- * @param name Name of component.
- * @param moles Total number of moles of component.
+ * @param name Name of component.
+ * @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
- * @param compIndex Index number of component in phase object component array.
+ * @param compIndex Index number of component in phase object component
+ * array.
*/
public void addComponent(String name, double moles, double molesInPhase, int compIndex);
@@ -51,10 +52,12 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab
/**
* - * Returns the composition vector in unit molefraction/wtfraction/molespersec/volumefraction. + * Returns the composition vector in unit + * molefraction/wtfraction/molespersec/volumefraction. *
* - * @param unit Supported units are molefraction, wtfraction, molespersec, volumefraction + * @param unit Supported units are molefraction, wtfraction, molespersec, + * volumefraction * @return composition array with unit */ public double[] getComposition(String unit); @@ -120,7 +123,8 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab public double getVolume(String unit); /** - * method to return heat capacity ratio/adiabatic index/Poisson constant. The method calculates it + * method to return heat capacity ratio/adiabatic index/Poisson constant. The + * method calculates it * as Cp (real) /Cv (real). * * @return gamma @@ -128,7 +132,8 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab public double getGamma(); /** - * method to return heat capacity ratio calculated as Cp/(Cp-R*getNumberOfMolesInPhase). + * method to return heat capacity ratio calculated as + * Cp/(Cp-R*getNumberOfMolesInPhase). * * @return kappa */ @@ -226,8 +231,8 @@ public default void init() { * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param initType a int. Use 0 to init, and 1 to reset. - * @param beta Mole fraction of this phase in system. + * @param initType a int. Use 0 to init, and 1 to reset. + * @param beta Mole fraction of this phase in system. */ public default void init(double totalNumberOfMoles, int numberOfComponents, int initType, double beta) { @@ -241,9 +246,9 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param initType a int. Use 0 to init, and 1 to reset. - * @param pt Type of phase. - * @param beta Mole fraction of this phase in system. + * @param initType a int. Use 0 to init, and 1 to reset. + * @param pt Type of phase. + * @param beta Mole fraction of this phase in system. */ public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt, double beta); @@ -332,7 +337,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * Get component array of Phase. * * - * @return an array of {@link neqsim.thermo.component.ComponentInterface} objects + * @return an array of {@link neqsim.thermo.component.ComponentInterface} + * objects */ public ComponentInterface[] getcomponentArray(); @@ -363,14 +369,16 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType public double getWtFraction(SystemInterface system); /** - * method to return molar volume of the phase note: without Peneloux volume correction. + * method to return molar volume of the phase note: without Peneloux volume + * correction. * * @return molar volume volume in unit m3/mol*1e5 */ public double getMolarVolume(); /** - * method to return molar volume of the fluid: eventual volume correction included. + * method to return molar volume of the fluid: eventual volume correction + * included. * * @param unit Supported units are m3/mol, litre/mol * @return molar volume volume in unit @@ -380,8 +388,9 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType /** * method to return flow rate of a phase. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, m3/hr, ft3/sec, - * mole/sec, mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, + * m3/hr, ft3/sec, + * mole/sec, mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -391,7 +400,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * setComponentArray. * * - * @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects + * @param components an array of + * {@link neqsim.thermo.component.ComponentInterface} objects */ public void setComponentArray(ComponentInterface[] components); @@ -412,7 +422,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType public double[] getProperties_GERG2008(); /** - * method to get density of a phase note: does not use Peneloux volume correction. + * method to get density of a phase note: does not use Peneloux volume + * correction. * * @return density with unit kg/m3 */ @@ -431,8 +442,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * Remove component from Phase. * * - * @param name Name of component. - * @param moles Total number of moles of component. + * @param name Name of component. + * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. */ public void removeComponent(String name, double moles, double molesInPhase); @@ -575,7 +586,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType /** *
- * Getter for property beta
. Beta is the mole fraction of a phase of all the moles of
+ * Getter for property beta
. Beta is the mole fraction of a phase
+ * of all the moles of
* a system.
*
- * Setter for property beta
. Beta is the mole fraction of a phase of all the moles of
+ * Setter for property beta
. Beta is the mole fraction of a phase
+ * of all the moles of
* a system.
*
- * Change the number of moles of component of phase,i.e., numberOfMolesInPhase
but do
+ * Change the number of moles of component of phase,i.e.,
+ * numberOfMolesInPhase
but do
* not change the total number of moles of component in system.
*
- * NB! Phase fraction beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of total number of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be
+ * done separately to
+ * keep consistency between phase and component calculation of total number of
+ * moles in system.
*
- * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
, and
- * total number of moles of component in system, i.e., numberOfMoles
with the same
+ * Change the number of moles of component of phase, i.e.,
+ * numberOfMolesInPhase
, and
+ * total number of moles of component in system, i.e.,
+ * numberOfMoles
with the same
* amount.
*
- * NB! Phase fraction beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of total number of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be
+ * done separately to
+ * keep consistency between phase and component calculation of total number of
+ * moles in system.
*
- * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
and
- * Component
properties for the number of moles of component of phase, i.e.,
- * numberOfMolesInPhase
, and total number of moles of component in system, i.e.,
+ * Change the number of moles of component of phase, i.e.,
+ * numberOfMolesInPhase
and
+ * Component
properties for the number of moles of component of
+ * phase, i.e.,
+ * numberOfMolesInPhase
, and total number of moles of component in
+ * system, i.e.,
* numberOfMoles
with separate amounts.
*
- * NB! Phase fraction beta
is not updated by this method. Must be done separately to
- * keep consistency between phase and component calculation of total number of moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be
+ * done separately to
+ * keep consistency between phase and component calculation of total number of
+ * moles in system.
*
* Constructor for PhasePrEos. diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index cbb768dfe8..2f252704c9 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -2305,6 +2305,12 @@ public double getFlowRate(String flowunit) { return totalNumberOfMoles * 60.0; } else if (flowunit.equals("mole/hr")) { return totalNumberOfMoles * 3600.0; + } else if (flowunit.equals("lbmole/hr")) { + return totalNumberOfMoles * 3600.0 / 1000.0 * 2.205; + } else if (flowunit.equals("lb/hr")) { + return totalNumberOfMoles * getMolarMass() * 60.0 * 2.20462262; + } else if (flowunit.equals("barrel/day")) { + return totalNumberOfMoles * getMolarMass() * 60.0 * 2.20462262 * 0.068; } else { throw new RuntimeException("failed.. unit: " + flowunit + " not supported"); } diff --git a/src/main/java/neqsim/util/unit/Units.java b/src/main/java/neqsim/util/unit/Units.java index ff47f8237f..6541257c62 100644 --- a/src/main/java/neqsim/util/unit/Units.java +++ b/src/main/java/neqsim/util/unit/Units.java @@ -83,7 +83,7 @@ public Units() { new UnitDescription("ft3/lbmole", "cubic foot per pound-mass-mole")); fieldUnits.put("mass flow", new UnitDescription("lb/hr", "lb/hr")); fieldUnits.put("molar flow", new UnitDescription("lbmole/hr", "lbmole/hr")); - fieldUnits.put("actual volume flow", new UnitDescription("barrel/day", "barrel/day")); + fieldUnits.put("volume flow", new UnitDescription("barrel/day", "barrel/day")); defaultUnits.putAll(activeUnits); // Makes a copy of activeUnits } diff --git a/src/test/java/neqsim/processSimulation/util/report/ReportTest.java b/src/test/java/neqsim/processSimulation/util/report/ReportTest.java index 2b5be64254..f90e2797c7 100644 --- a/src/test/java/neqsim/processSimulation/util/report/ReportTest.java +++ b/src/test/java/neqsim/processSimulation/util/report/ReportTest.java @@ -42,9 +42,15 @@ void testWrite() { Report report = new Report(processOps); String obj = report.json(); - + // System.out.println(obj); neqsim.util.unit.Units.activateFieldUnits(); String obj2 = report.json(); // System.out.println(obj2); + neqsim.util.unit.Units.activateSIUnits(); + // reporting from process Object + String processreportasjson = processOps.getReport_json(); + // System.out.println(processreportasjson); + // report stream + String streamreportasjson = inletStream.getReport_json(); } } From 96a62f0594583fa2d6dcb8331a8e3d4006da149b Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:04:13 +0200 Subject: [PATCH 178/317] added RVP and TVP methods (#992) --- .../processEquipment/stream/Stream.java | 26 +++++++++++++-- .../stream/StreamInterface.java | 24 ++++++++++++++ src/main/java/neqsim/standards/Standard.java | 8 ++--- .../oilQuality/Standard_ASTM_D6377.java | 32 +++++++++++++++++-- .../oilQuality/Standard_ASTM_D6377Test.java | 24 ++++++++++++++ 5 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java index 1c8434c3d7..dcb3e4b8af 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java @@ -15,6 +15,7 @@ import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass; import neqsim.processSimulation.util.monitor.StreamResponse; import neqsim.standards.gasQuality.Standard_ISO6976; +import neqsim.standards.oilQuality.Standard_ASTM_D6377; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -443,8 +444,6 @@ public String[][] getResultTable() { return getFluid().calcResultTable(); } - - /** {@inheritDoc} */ @Override public void runTransient(double dt, UUID id) { @@ -550,6 +549,29 @@ public double TVP(double temperature, String unit) { return localSyst.getPressure(); } + /** {@inheritDoc} */ + @Override + public double getTVP(double referenceTemperature, String unit, String returnUnit) { + SystemInterface localSyst = getFluid().clone(); + localSyst.setTemperature(referenceTemperature, unit); + ThermodynamicOperations ops = new ThermodynamicOperations(localSyst); + try { + ops.bubblePointPressureFlash(false); + } catch (Exception ex) { + } + return localSyst.getPressure(returnUnit); + } + + /** {@inheritDoc} */ + @Override + public double getRVP(double referenceTemperature, String unit, String returnUnit) { + SystemInterface localSyst = getFluid().clone(); + Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(localSyst); + standard.setReferenceTemperature(referenceTemperature, unit); + standard.calculate(); + return standard.getValue("RVP", returnUnit); + } + /** {@inheritDoc} */ @Override public String[][] reportResults() { diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java index 534e197481..620c06af5c 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java @@ -129,6 +129,30 @@ public default double getFlowRate(String unit) { */ public double TVP(double temperature, String unit); + /** + *
+ * TVP. + *
+ * + * @param referenceTemperature a double + * @param unit a {@link java.lang.String} object + * @param returnUnit a {@link java.lang.String} object + * @return a double + */ + public double getTVP(double referenceTemperature, String unit, String returnUnit); + + /** + *+ * TVP. + *
+ * + * @param referenceTemperature a double + * @param unit a {@link java.lang.String} object + * @param returnUnit a {@link java.lang.String} object + * @return a double + */ + public double getRVP(double referenceTemperature, String unit, String returnUnit); + /** ** setFluid. diff --git a/src/main/java/neqsim/standards/Standard.java b/src/main/java/neqsim/standards/Standard.java index 1896bb60ad..5f9daff797 100644 --- a/src/main/java/neqsim/standards/Standard.java +++ b/src/main/java/neqsim/standards/Standard.java @@ -41,7 +41,7 @@ public abstract class Standard extends NamedBaseClass implements StandardInterfa /** * Constructor for Standard. * - * @param name name of standard + * @param name name of standard * @param description description */ public Standard(String name, String description) { @@ -52,8 +52,8 @@ public Standard(String name, String description) { /** * Constructor for Standard. * - * @param name name of standard - * @param thermoSyst input fluid + * @param name name of standard + * @param thermoSyst input fluid * @param description description of standard */ public Standard(String name, String description, SystemInterface thermoSyst) { @@ -161,7 +161,7 @@ public void display(String name) { Container dialogContentPane = dialog.getContentPane(); dialogContentPane.setLayout(new BorderLayout()); - String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"}; + String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; String[][] table = createTable(name); JTable Jtab = new JTable(table, names); JScrollPane scrollpane = new JScrollPane(Jtab); diff --git a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java index f7b39c235c..12a207557c 100644 --- a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java +++ b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java @@ -21,6 +21,9 @@ public class Standard_ASTM_D6377 extends neqsim.standards.Standard { String unit = "bara"; double RVP = 1.0; + double TVP = 1.0; + double referenceTemperature = 37.8; + String referenceTemperatureUnit = "C"; /** *
@@ -36,7 +39,7 @@ public Standard_ASTM_D6377(SystemInterface thermoSystem) { /** {@inheritDoc} */ @Override public void calculate() { - this.thermoSystem.setTemperature(273.15 + 37.8); + this.thermoSystem.setTemperature(referenceTemperature, "C"); this.thermoSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); this.thermoOps = new ThermodynamicOperations(thermoSystem); try { @@ -45,7 +48,7 @@ public void calculate() { logger.error(ex.getMessage(), ex); } - // double TVP = this.thermoSystem.getPressure(); + TVP = this.thermoSystem.getPressure(); double liquidVolume = thermoSystem.getVolume(); this.thermoSystem.setPressure(0.9); @@ -73,7 +76,16 @@ public String getUnit(String returnParameter) { /** {@inheritDoc} */ @Override public double getValue(String returnParameter, java.lang.String returnUnit) { - return RVP; + if (returnParameter == "RVP") { + neqsim.util.unit.PressureUnit presConversion = new neqsim.util.unit.PressureUnit(RVP, "bara"); + return presConversion.getValue(returnUnit); + } + if (returnParameter == "TVP") { + neqsim.util.unit.PressureUnit presConversion = new neqsim.util.unit.PressureUnit(TVP, "bara"); + return presConversion.getValue(returnUnit); + } else { + return RVP; + } } /** {@inheritDoc} */ @@ -82,6 +94,20 @@ public double getValue(String returnParameter) { return RVP; } + /** + *
+ * setReferenceTemperature. + *
+ * + * @param refTemp a double + * @param refTempUnit a {@link java.lang.String} object + */ + public void setReferenceTemperature(double refTemp, String refTempUnit) { + neqsim.util.unit.TemperatureUnit tempConversion = + new neqsim.util.unit.TemperatureUnit(refTemp, refTempUnit); + referenceTemperature = tempConversion.getValue(refTemp, refTempUnit, "C"); + } + /** *
* main.
diff --git a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
new file mode 100644
index 0000000000..c38fea36f4
--- /dev/null
+++ b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
@@ -0,0 +1,24 @@
+package neqsim.standards.oilQuality;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import neqsim.thermo.system.SystemInterface;
+import neqsim.thermo.system.SystemSrkEos;
+
+public class Standard_ASTM_D6377Test {
+ @Test
+ void testCalculate() {
+ SystemInterface testSystem = new SystemSrkEos(273.15 + 2.0, 1.0);
+ testSystem.addComponent("methane", 0.0006538);
+ testSystem.addComponent("ethane", 0.006538);
+ testSystem.addComponent("propane", 0.006538);
+ testSystem.addComponent("n-pentane", 0.545);
+ testSystem.setMixingRule(2);
+ testSystem.init(0);
+ Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem);
+ standard.setReferenceTemperature(37.8, "C");
+ standard.calculate();
+ Assertions.assertEquals(0.7298246193, standard.getValue("RVP", "bara"), 1e-3);
+ Assertions.assertEquals(1.8710732396722, standard.getValue("TVP", "bara"), 1e-3);
+ }
+}
From 91eae2913162a155d7efb6a36e16979a5181ef24 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Tue, 30 Apr 2024 00:32:07 +0200
Subject: [PATCH 179/317] Update Standard_ASTM_D6377Test.java
---
.../neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
index c38fea36f4..3b297645a3 100644
--- a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
+++ b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
@@ -18,7 +18,7 @@ void testCalculate() {
Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem);
standard.setReferenceTemperature(37.8, "C");
standard.calculate();
- Assertions.assertEquals(0.7298246193, standard.getValue("RVP", "bara"), 1e-3);
+ //Assertions.assertEquals(0.7298246193, standard.getValue("RVP", "bara"), 1e-3);
Assertions.assertEquals(1.8710732396722, standard.getValue("TVP", "bara"), 1e-3);
}
}
From c2e40f79f323ea62181d9e94fbd37fc92edda430 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Tue, 30 Apr 2024 23:59:26 +0200
Subject: [PATCH 180/317] bug fix json stream (#994)
---
.../util/monitor/StreamResponse.java | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
index 9c359a778d..f2e3d2b7bd 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
@@ -143,21 +143,14 @@ public StreamResponse(StreamInterface inputStream) {
inputStream.getFluid().getFlowRate(neqsim.util.unit.Units.getSymbol("volume flow"))),
neqsim.util.unit.Units.getSymbol("volume flow")));
properties.put(inputStream.getName(), newdata);
-
-
- properties.put(inputStream.getName(), newdata);
-
- newdata = new HashMap
- * calcBeta. For simple gas liquid systems.
- *
* calcHenrysConstant.
@@ -2431,14 +2419,14 @@ public void setImplementedTemperatureDeriativesofFugacity(
*/
public void setPhaseType(int phaseToChange, PhaseType pt);
- /**
+ /**
* Change the phase type of a given phase.
*
* @param phaseToChange the phase number of the phase to set phase type
- * @param phaseName String to set
+ * @param phaseName String to set
*/
public void setPhaseType(int phaseToChange, String phaseName);
-
+
/**
* Set the physical property model type for each phase of the System.
*
@@ -2583,4 +2571,19 @@ public void setImplementedTemperatureDeriativesofFugacity(
* @param newfile a boolean
*/
public void write(String name, String filename, boolean newfile);
+
+ /**
+ *
+ * getKvector - return vector of equilibrium constants
+ *
+ * getzvector - return vector of total molar composition
+ *
+ * calcBeta. For gas liquid systems.
+ *
* calcBeta. For gas liquid systems.
*
+ * calcBeta. For gas liquid systems. Method based on Avoiding round-off error in the Rachford–Rice
+ * equation, Nielsen, Lia, 2023
+ *
* Constructor for StreamResponse.
*
+ * getGCV. + *
+ * + * @param unit a String + * @param refTVolume a double in Celcius + * @param refTCombustion a double in Celcius + * @return a double + */ + public double getGCV(String unit, double refTVolume, double refTCombustion); + + /** + *+ * getWI. + *
+ * + * @param unit a String + * @param refTVolume a double in Celcius + * @param refTCombustion a double in Celcius + * @return a double + */ + public double getWI(String unit, double refTVolume, double refTCombustion); + /** *
* LCV.
From f9f717fff8344cf7772e18622409c845273fd73c Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Fri, 3 May 2024 23:13:40 +0200
Subject: [PATCH 186/317] added GCV/WI to stream response (#998)
---
.../util/monitor/StreamResponse.java | 49 +++++++++++++++----
.../util/report/ReportTest.java | 2 +-
2 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
index 0bdac75fa7..b94b9a32ce 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
@@ -1,6 +1,8 @@
package neqsim.processSimulation.util.monitor;
import java.util.HashMap;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
/**
@@ -12,6 +14,7 @@
* @version $Id: $Id
*/
public class StreamResponse {
+ static Logger logger = LogManager.getLogger(StreamResponse.class);
public String name;
public Fluid fluid;
public Double temperature;
@@ -23,18 +26,20 @@ public class StreamResponse {
public Double massflowGas;
public Double massflowOil;
public Double massflowAqueous;
- public HashMap
* Constructor for StreamResponse.
*
* Constructor for StreamResponse. *
* - * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param inputStream a + * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ public StreamResponse(StreamInterface inputStream) { @@ -190,6 +188,11 @@ public StreamResponse(StreamInterface inputStream) { Double.toString(inputStream.getGCV("volume", 15.0, 15.0) / 1e6), "MJ/Sm3 @15C,15C")); newdata.put("WI", new Value(Double.toString(inputStream.getWI("volume", 15.0, 15.0) / 1e6), "MJ/Sm3 @15C,15C")); + newdata.put("standard flow rate", + new Value( + Double.toString(inputStream.getFluid().getPhase(name) + .getFlowRate(neqsim.util.unit.Units.getSymbol("standard volume flow"))), + neqsim.util.unit.Units.getSymbol("standard volume flow"))); } properties.put(name, newdata); } @@ -226,5 +229,6 @@ public StreamResponse(StreamInterface inputStream) { * print. * */ - public void print() {} + public void print() { + } } diff --git a/src/main/java/neqsim/util/unit/Units.java b/src/main/java/neqsim/util/unit/Units.java index 6541257c62..d3db0eef10 100644 --- a/src/main/java/neqsim/util/unit/Units.java +++ b/src/main/java/neqsim/util/unit/Units.java @@ -30,10 +30,9 @@ public UnitDescription(String symbol, String symbolName) { private static HashMap* Constructor for StreamResponse. *
* - * @param inputStream a - * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ public StreamResponse(StreamInterface inputStream) { @@ -150,8 +152,6 @@ public StreamResponse(StreamInterface inputStream) { Double.toString(inputStream.getFluid().getPhase(name) .getDensity(neqsim.util.unit.Units.getSymbol("density"))), neqsim.util.unit.Units.getSymbol("density"))); - newdata.put("relative density", new Value(Double.toString(inputStream.getFluid() - .getPhase(name).getDensity(neqsim.util.unit.Units.getSymbol("density")) / 1000.0), "-")); newdata.put("molar mass", new Value( Double.toString(inputStream.getFluid().getPhase(name) @@ -180,6 +180,9 @@ public StreamResponse(StreamInterface inputStream) { Double.toString( inputStream.getRVP(37.8, "C", neqsim.util.unit.Units.getSymbol("pressure"))), neqsim.util.unit.Units.getSymbol("pressure"))); + newdata.put("relative density", new Value( + Double.toString(inputStream.getFluid().getPhase(name).getDensity("kg/m3") / 1000.0), + "-")); } catch (Exception e) { logger.error(e.getMessage()); } @@ -193,6 +196,8 @@ public StreamResponse(StreamInterface inputStream) { Double.toString(inputStream.getFluid().getPhase(name) .getFlowRate(neqsim.util.unit.Units.getSymbol("standard volume flow"))), neqsim.util.unit.Units.getSymbol("standard volume flow"))); + newdata.put("relative density", + new Value(Double.toString(inputStream.getFluid().getMolarMass("gr/mol") / 28.96), "-")); } properties.put(name, newdata); } @@ -229,6 +234,5 @@ public StreamResponse(StreamInterface inputStream) { * print. * */ - public void print() { - } + public void print() {} } From 11dd1a0ba6984dba9477d1e448ae913a9309f6cb Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sat, 4 May 2024 08:28:52 +0200 Subject: [PATCH 190/317] improved speed of water saturator (#999) --- .../flashOps/SaturateWithWater.java | 58 +++++++----- .../flashOps/SaturateWithWaterTest.java | 92 +++++++++++++++++++ 2 files changed, 125 insertions(+), 25 deletions(-) create mode 100644 src/test/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWaterTest.java diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWater.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWater.java index d90e84886b..f75d3fa9c1 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWater.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWater.java @@ -37,17 +37,20 @@ public SaturateWithWater(SystemInterface system) { @Override public void run() { if (!system.getPhase(0).hasComponent("water")) { - system.addComponent("water", system.getTotalNumberOfMoles()); - system.createDatabase(true); + system.addComponent("water", system.getTotalNumberOfMoles() / 100.0); system.setMixingRule(system.getMixingRule()); - if (system.doMultiPhaseCheck()) { - system.setMultiPhaseCheck(true); - } - system.init(0); } - double dn = 1.0; - int i = 0; + boolean changedMultiPhase = false; + if (system.doMultiPhaseCheck() == false) { + system.setMultiPhaseCheck(true); + changedMultiPhase = true; + } + + + if (system.getComponent("water").getNumberOfmoles() < system.getTotalNumberOfMoles() / 2.0) { + system.addComponent("water", system.getTotalNumberOfMoles()); + } this.tpFlash = new TPflash(system); tpFlash.run(); boolean hasAq = false; @@ -56,32 +59,37 @@ public void run() { } double lastdn = 0.0; if (system.hasPhaseType(PhaseType.AQUEOUS)) { - lastdn = system.getPhaseOfType("aqueous").getComponent("water").getNumberOfMolesInPhase(); + lastdn = system.getPhase(PhaseType.AQUEOUS).getNumberOfMolesInPhase(); } else { - lastdn = system.getPhase(0).getNumberOfMolesInPhase() / 100.0; + lastdn = system.getPhase(0).getNumberOfMolesInPhase(); } - + double dn = 1.0; + int i = 0; do { i++; - - if (!hasAq) { - system.addComponent("water", lastdn * 0.5); - lastdn *= 0.8; + if (system.getNumberOfPhases() == 1 && hasAq) { + lastdn = -system.getComponent("water").getNumberOfmoles() * 0.1; + } else if (!hasAq) { + lastdn = Math.abs(lastdn) * 1.05; } else { - lastdn = system.getPhaseOfType("aqueous").getComponent("water").getNumberOfMolesInPhase(); - dn = lastdn / system.getNumberOfMoles(); - system.addComponent("water", -lastdn); + lastdn = + -system.getPhaseOfType("aqueous").getComponent("water").getNumberOfMolesInPhase() * 0.9; } + dn = lastdn / system.getNumberOfMoles(); + system.addComponent("water", lastdn); tpFlash.run(); - // system.display(); - hasAq = system.hasPhaseType("aqueous"); - } while ((i < 50 && Math.abs(dn) > 1e-7) || !hasAq && i <= 50); + hasAq = system.hasPhaseType(PhaseType.AQUEOUS); + } while (Math.abs(dn) > 1e-7 && i <= 50); if (i == 50) { logger.error("could not find solution - in water saturate : dn " + dn); } - // logger.info("i " + i + " dn " + dn); - system.removePhase(system.getNumberOfPhases() - 1); - tpFlash.run(); + if (system.hasPhaseType(PhaseType.AQUEOUS)) { + system.removePhase(system.getNumberOfPhases() - 1); + tpFlash.run(); + } + if (changedMultiPhase) { + system.setMultiPhaseCheck(false); + } } /** @@ -116,7 +124,7 @@ public static void main(String[] args) { // testSystem.display(); // testSystem.addComponent("water", 1); // testOps.saturateWithWater(); - testSystem.display(); + // testSystem.display(); // testOps.TPflash(); } catch (Exception ex) { logger.error(ex.getMessage(), ex); diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWaterTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWaterTest.java new file mode 100644 index 0000000000..69ad8bfea9 --- /dev/null +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/SaturateWithWaterTest.java @@ -0,0 +1,92 @@ +package neqsim.thermodynamicOperations.flashOps; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.jupiter.api.Test; +import neqsim.thermo.system.SystemInterface; +import neqsim.thermo.system.SystemPrEos; +import neqsim.thermo.system.SystemSrkCPAstatoil; +import neqsim.thermodynamicOperations.ThermodynamicOperations; + +public class SaturateWithWaterTest { + static Logger logger = LogManager.getLogger(SaturateWithWaterTest.class); + + @Test + void testRun() { + SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 70.0, 150.0); + + testSystem.addComponent("methane", 75.0); + testSystem.addComponent("ethane", 7.5); + testSystem.addComponent("propane", 4.0); + testSystem.addComponent("n-butane", 1.0); + testSystem.addComponent("i-butane", 0.6); + testSystem.addComponent("n-hexane", 0.3); + testSystem.addPlusFraction("C6", 1.3, 100.3 / 1000.0, 0.8232); + testSystem.setMixingRule(10); + testSystem.setMultiPhaseCheck(true); + + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + try { + testOps.saturateWithWater(); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + assertEquals(0.0029033655101811814, testSystem.getComponent("water").getz(), 1e-5); + } + + + @Test + void testRun2() { + SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 70.0, 150.0); + + testSystem.addComponent("methane", 75.0); + testSystem.addComponent("ethane", 7.5); + testSystem.addComponent("propane", 4.0); + testSystem.setMixingRule(10); + + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + try { + testOps.saturateWithWater(); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + assertEquals(0.002891748277007660, testSystem.getComponent("water").getz(), 1e-5); + } + + @Test + void testRun3() { + SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 20.0, 150.0); + + testSystem.addComponent("methane", 2.0); + testSystem.addComponent("n-heptane", 75.0); + testSystem.setMixingRule(10); + testSystem.setMultiPhaseCheck(true); + + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + try { + testOps.saturateWithWater(); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + assertEquals(2.8465024974919816E-4, testSystem.getComponent("water").getz(), 1e-5); + } + + @Test + void testRun4() { + SystemInterface testSystem = new SystemPrEos(273.15 + 20.0, 150.0); + + testSystem.addComponent("methane", 2.0); + testSystem.addComponent("n-heptane", 75.0); + testSystem.setMixingRule("classic"); + testSystem.setMultiPhaseCheck(true); + + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + try { + testOps.saturateWithWater(); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + assertEquals(2.4301370485671443E-4, testSystem.getComponent("water").getz(), 1e-5); + } +} From 4fffe48b626942dab40cf0cbfa6816c5cbcd43a8 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sat, 4 May 2024 14:56:56 +0200 Subject: [PATCH 191/317] fix report (#1000) --- .../processEquipment/stream/Stream.java | 14 ++++++++++++-- .../processEquipment/stream/StreamInterface.java | 14 ++++++++++++++ .../util/monitor/StreamResponse.java | 9 ++++++--- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java index 69527196bb..1bd2bf7730 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/Stream.java @@ -613,7 +613,7 @@ public double getGCV(String unit, double refTVolume, double refTCombustion) { new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit); standard.setReferenceState("real"); standard.calculate(); - return standard.getValue("GCV") * 1.0e3; + return standard.getValue("SuperiorCalorificValue") * 1.0e3; } /** {@inheritDoc} */ @@ -623,9 +623,19 @@ public double getWI(String unit, double refTVolume, double refTCombustion) { new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit); standard.setReferenceState("real"); standard.calculate(); - return standard.getValue("WI") * 1.0e3; + return standard.getValue("SuperiorWobbeIndex") * 1.0e3; } + /** {@inheritDoc} */ + @Override + public Standard_ISO6976 getISO6976(String unit, double refTVolume, double refTCombustion) { + Standard_ISO6976 standard = + new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit); + standard.setReferenceState("real"); + return standard; + } + + /** {@inheritDoc} */ @Override public double LCV() { diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java index 1da0e7fc3a..90122eb72a 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/StreamInterface.java @@ -7,6 +7,7 @@ package neqsim.processSimulation.processEquipment.stream; import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface; +import neqsim.standards.gasQuality.Standard_ISO6976; import neqsim.thermo.system.SystemInterface; /** @@ -268,6 +269,19 @@ public default double getFlowRate(String unit) { */ public double getWI(String unit, double refTVolume, double refTCombustion); + /** + *+ * getWI. + *
+ * + * @param unit a String + * @param refTVolume a double in Celcius + * @param refTCombustion a double in Celcius + * @return a Standard_ISO6976 + */ + public Standard_ISO6976 getISO6976(String unit, double refTVolume, double refTCombustion); + + /** ** LCV. diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java index d19504eb4f..0a0c18b964 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java @@ -4,6 +4,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.standards.gasQuality.Standard_ISO6976; /** *
@@ -187,9 +188,11 @@ public StreamResponse(StreamInterface inputStream) { logger.error(e.getMessage()); } } else if (name.equals("gas")) { + Standard_ISO6976 standard = inputStream.getISO6976("volume", 15.0, 15.0); + standard.calculate(); newdata.put("GCV", new Value( - Double.toString(inputStream.getGCV("volume", 15.0, 15.0) / 1e6), "MJ/Sm3 @15C,15C")); - newdata.put("WI", new Value(Double.toString(inputStream.getWI("volume", 15.0, 15.0) / 1e6), + Double.toString(standard.getValue("SuperiorCalorificValue") / 1e3), "MJ/Sm3 @15C,15C")); + newdata.put("WI", new Value(Double.toString(standard.getValue("SuperiorWobbeIndex") / 1e3), "MJ/Sm3 @15C,15C")); newdata.put("standard flow rate", new Value( @@ -197,7 +200,7 @@ public StreamResponse(StreamInterface inputStream) { .getFlowRate(neqsim.util.unit.Units.getSymbol("standard volume flow"))), neqsim.util.unit.Units.getSymbol("standard volume flow"))); newdata.put("relative density", - new Value(Double.toString(inputStream.getFluid().getMolarMass("gr/mol") / 28.96), "-")); + new Value(Double.toString(standard.getValue("RelativeDensity") / 1e3), "[-]")); } properties.put(name, newdata); } From 9142bf157456dc5258c3918db351a00ae728214d Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sun, 5 May 2024 15:00:18 +0200 Subject: [PATCH 192/317] updated diff lib simulation and test (#1001) * updated diff lib simulation and test * update * update CME * update --- .../simulation/BasePVTsimulation.java | 16 +++- .../simulation/ConstantMassExpansion.java | 19 +++- .../simulation/DifferentialLiberation.java | 94 +++++++++---------- .../simulation/SaturationPressure.java | 5 + .../simulation/SimulationInterface.java | 10 ++ .../simulation/ConstantMassExpansionTest.java | 63 ++++++++----- .../DifferentialLiberationTest.java | 60 ++++++++++-- 7 files changed, 184 insertions(+), 83 deletions(-) diff --git a/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java b/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java index 1f36923035..b5b6da66ce 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java @@ -18,12 +18,13 @@ public class BasePVTsimulation implements SimulationInterface { public ThermodynamicOperations thermoOps = null; private double pressure; public double[] pressures = {381.5, 338.9, 290.6, 242.3, 194.1, 145.8, 145.8, 97.5, 49.3}; - public double temperature = 289.0; + public double temperature = Double.NaN; double[][] experimentalData = null; double saturationVolume = 0; double saturationPressure = 0; double saturationTemperature; double Zsaturation = 0; + String temperatureUnit = "K"; public LevenbergMarquardt optimizer = new LevenbergMarquardt(); /** @@ -129,6 +130,19 @@ public void setTemperature(double temperature) { this.temperature = temperature; } + /** + *
+ * Setter for the field temperature
.
+ *
* Getter for the field pressures
.
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java b/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java
index d88e76a658..3a773d58d2 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java
@@ -87,6 +87,13 @@ public void calcSaturationConditions() {
saturationPressure = getThermoSystem().getPressure();
Zsaturation = getThermoSystem().getZ();
saturationConditionFound = true;
+
+ getThermoSystem().initPhysicalProperties();
+ saturationVolume = getThermoSystem().getPhase(0).getMass()
+ / getThermoSystem().getPhase(0).getPhysicalProperties().getDensity();
+ saturationPressure = getThermoSystem().getPressure();
+ Zsaturation = getThermoSystem().getZ();
+ saturationConditionFound = true;
}
/** {@inheritDoc} */
@@ -116,7 +123,9 @@ public void runCalc() {
viscosity = new double[pressures.length];
viscosityOil = new double[pressures.length];
gasExpensionFactor = new double[pressures.length];
- getThermoSystem().setTemperature(temperature);
+ if (!Double.isNaN(temperature)) {
+ getThermoSystem().setTemperature(temperature, temperatureUnit);
+ }
if (!saturationConditionFound) {
calcSaturationConditions();
try {
@@ -152,10 +161,10 @@ public void runCalc() {
density[i] = getThermoSystem().getPhase(0).getDensity("kg/m3");
gasVolume[i] = getThermoSystem().getPhase(0).getNumberOfMolesInPhase()
* getThermoSystem().getPhase(0).getMolarMass() / density[i]; // getThermoSystem().getPhase(0).getVolume();
- gasStandardVolume[i] = getThermoSystem().getPhase(0).getVolume()
- * getThermoSystem().getPhase(0).getPressure()
- / ThermodynamicConstantsInterface.referencePressure
- / getThermoSystem().getPhase(0).getZ() * 288.15 / getThermoSystem().getTemperature();
+ gasStandardVolume[i] =
+ getThermoSystem().getPhase(0).getVolume() * getThermoSystem().getPhase(0).getPressure()
+ / ThermodynamicConstantsInterface.referencePressure
+ / getThermoSystem().getPhase(0).getZ() * 288.15 / getThermoSystem().getTemperature();
Bg[i] = gasVolume[i] * 1e5 / gasStandardVolume[i];
Zgas[i] = getThermoSystem().getPhase(0).getZ();
if (getThermoSystem().getNumberOfPhases() == 1) {
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java b/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java
index 248516c045..ce6f986c68 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java
@@ -3,6 +3,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.ThermodynamicConstantsInterface;
+import neqsim.thermo.phase.PhaseType;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
@@ -77,7 +78,9 @@ public void calcSaturationConditions() {
* try { thermoOps.dewPointPressureFlash(); } catch (Exception ex) {
* logger.error(ex.getMessage(), ex); }
*/
- saturationVolume = getThermoSystem().getVolume();
+ getThermoSystem().initPhysicalProperties();
+ saturationVolume = getThermoSystem().getPhase(0).getMass()
+ / getThermoSystem().getPhase(0).getPhysicalProperties().getDensity();
saturationPressure = getThermoSystem().getPressure();
saturationConditionFound = true;
}
@@ -90,6 +93,7 @@ public void calcSaturationConditions() {
public void runCalc() {
saturationConditionFound = false;
relativeVolume = new double[pressures.length];
+ double[] mass = new double[pressures.length];
totalVolume = new double[pressures.length];
liquidVolumeRelativeToVsat = new double[pressures.length];
liquidVolume = new double[pressures.length];
@@ -103,7 +107,9 @@ public void runCalc() {
oilDensity = new double[pressures.length];
double totalGasStandardVolume = 0;
- getThermoSystem().setTemperature(temperature);
+ if (!Double.isNaN(temperature)) {
+ getThermoSystem().setTemperature(temperature, temperatureUnit);
+ }
for (int i = 0; i < pressures.length; i++) {
getThermoSystem().setPressure(pressures[i]);
@@ -112,9 +118,12 @@ public void runCalc() {
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
- totalVolume[i] = getThermoSystem().getVolume();
- liquidVolume[i] = getThermoSystem().getVolume();
+ getThermoSystem().initPhysicalProperties();
+ oilDensity[i] = getThermoSystem().getDensity("kg/m3");
+ mass[i] = getThermoSystem().getMass("kg");
+ totalVolume[i] = mass[i] / oilDensity[i];
+ liquidVolume[i] = totalVolume[i];
if (getThermoSystem().getNumberOfPhases() > 1) {
if (!saturationConditionFound) {
calcSaturationConditions();
@@ -125,7 +134,8 @@ public void runCalc() {
logger.error(ex.getMessage(), ex);
}
}
- gasStandardVolume[i] = getThermoSystem().getPhase(0).getVolume()
+ gasStandardVolume[i] = getThermoSystem().getPhase(PhaseType.GAS).getMass()
+ / getThermoSystem().getPhase(PhaseType.GAS).getPhysicalProperties().getDensity()
* getThermoSystem().getPhase(0).getPressure()
/ ThermodynamicConstantsInterface.referencePressure
/ getThermoSystem().getPhase(0).getZ() * 288.15 / getThermoSystem().getTemperature();
@@ -133,41 +143,26 @@ public void runCalc() {
// if (totalVolume[i] > saturationVolume) {
Zgas[i] = getThermoSystem().getPhase(0).getZ();
relGasGravity[i] = getThermoSystem().getPhase(0).getMolarMass() / 0.028;
- getThermoSystem().initPhysicalProperties();
- if (getThermoSystem().hasPhaseType("gas") && getThermoSystem().hasPhaseType("oil")) {
- liquidVolume[i] = getThermoSystem().getPhase(1).getVolume();
+ if (getThermoSystem().hasPhaseType(PhaseType.GAS)
+ && getThermoSystem().hasPhaseType(PhaseType.OIL)) {
oilDensity[i] = getThermoSystem().getPhase(1).getPhysicalProperties().getDensity();
+ liquidVolume[i] = getThermoSystem().getPhase(1).getMass() / oilDensity[i];
+ getThermoSystem().getPhase(1).getMass();
} else if (getThermoSystem().hasPhaseType("oil")) {
- liquidVolume[i] = getThermoSystem().getPhase(0).getVolume();
oilDensity[i] = getThermoSystem().getPhase(0).getPhysicalProperties().getDensity();
+ liquidVolume[i] = getThermoSystem().getPhase(0).getMass() / oilDensity[i];
} else {
- liquidVolume[i] = getThermoSystem().getPhase(0).getVolume();
oilDensity[i] = getThermoSystem().getPhase(0).getPhysicalProperties().getDensity();
+ liquidVolume[i] = getThermoSystem().getPhase(0).getMass() / oilDensity[i];
}
if (getThermoSystem().getNumberOfPhases() > 1) {
- gasVolume[i] = getThermoSystem().getPhase(0).getVolume();
- } else {
- gasVolume[i] = 0.0;
+ gasVolume[i] = getThermoSystem().getPhase(PhaseType.GAS).getMass()
+ / getThermoSystem().getPhase(PhaseType.GAS).getPhysicalProperties().getDensity();
}
liquidVolumeRelativeToVsat[i] = liquidVolume[i] / saturationVolume;
- double volumeCorrection =
- getThermoSystem().getVolume() - getThermoSystem().getPhase(1).getVolume();
- double test = volumeCorrection / getThermoSystem().getPhase(0).getMolarVolume();
-
- for (int j = 0; j < getThermoSystem().getPhase(0).getNumberOfComponents(); j++) {
- try {
- double change =
- (test * getThermoSystem().getPhase(0).getComponent(j).getx() < getThermoSystem()
- .getPhase(0).getComponent(j).getNumberOfMolesInPhase())
- ? test * getThermoSystem().getPhase(0).getComponent(j).getx()
- : test * getThermoSystem().getPhase(0).getComponent(j).getx();
- getThermoSystem().addComponent(j, -change);
- } catch (Exception e) {
- logger.debug(e.getMessage());
- }
- }
+ getThermoSystem().removePhase(0);
}
}
getThermoSystem().setPressure(ThermodynamicConstantsInterface.referencePressure);
@@ -177,29 +172,35 @@ public void runCalc() {
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
- VoilStd = getThermoSystem().getPhase(1).getVolume();
- totalGasStandardVolume += getThermoSystem().getPhase(0).getVolume();
- // getThermoSystem().display();
+ getThermoSystem().initPhysicalProperties();
+ VoilStd = getThermoSystem().getPhase(PhaseType.OIL).getMass()
+ / getThermoSystem().getPhase(PhaseType.OIL).getPhysicalProperties().getDensity();
+ if (getThermoSystem().hasPhaseType(PhaseType.GAS)) {
+ totalGasStandardVolume += getThermoSystem().getPhase(PhaseType.GAS).getCorrectedVolume();
+ }
+
double total = 0;
for (int i = 0; i < pressures.length; i++) {
relativeVolume[i] = totalVolume[i] / saturationVolume;
Bo[i] = liquidVolume[i] / VoilStd;
total += getGasStandardVolume()[i];
+ Rs[i] = (totalGasStandardVolume - total) / VoilStd;
if (Zgas[i] > 1e-10) {
Bg[i] = gasVolume[i] / getGasStandardVolume()[i];
- Rs[i] = (totalGasStandardVolume - total) / VoilStd;
}
/*
- * System.out.println("Bo " + getBo()[i] + " Bg " + getBg()[i] + " Rs " + getRs()[i] +
- * " oil density " + getOilDensity()[i] + " gas gracvity " + getRelGasGravity()[i] + " Zgas "
- * + getZgas()[i] + " gasstdvol " + getGasStandardVolume()[i]);
+ * System.out.println("pressure " + pressures[i] + " Bo " + getBo()[i] + " Bg " + getBg()[i] +
+ * " Rs " + getRs()[i] + " oil density " + getOilDensity()[i] + " gas gracvity " +
+ * getRelGasGravity()[i] + " Zgas " + getZgas()[i] + " gasstdvol " +
+ * getGasStandardVolume()[i]);
*/
}
}
/**
+ * *
*
- * main. + * main *
* * @param args an array of {@link java.lang.String} objects @@ -208,11 +209,11 @@ public static void main(String[] args) { SystemInterface tempSystem = new SystemSrkEos(273.15 + 83.5, 450.0); tempSystem.addComponent("nitrogen", 0.586); tempSystem.addComponent("CO2", 0.087); - tempSystem.addComponent("methane", 17.0209); - tempSystem.addComponent("ethane", 5.176); + tempSystem.addComponent("methane", 107.0209); + tempSystem.addComponent("ethane", 15.176); tempSystem.addComponent("propane", 6.652); - tempSystem.addComponent("i-butane", 1.533); - tempSystem.addComponent("n-butane", 3.544); + tempSystem.addComponent("i-butane", 3.533); + tempSystem.addComponent("n-butane", 5.544); tempSystem.addComponent("i-pentane", 1.585); tempSystem.addComponent("n-pentane", 2.036); tempSystem.addTBPfraction("C6", 2.879, 84.9 / 1000.0, 0.6668); @@ -221,13 +222,12 @@ public static void main(String[] args) { tempSystem.addTBPfraction("C9", 3.488, 119.8 / 1000.0, 0.7743); tempSystem.addPlusFraction("C10", 45.944, 320.0 / 1000.0, 0.924); tempSystem.getCharacterization().characterisePlusFraction(); - tempSystem.getCharacterization().characterisePlusFraction(); - - tempSystem.createDatabase(true); - tempSystem.setMixingRule(2); - DifferentialLiberation CVDsim = new DifferentialLiberation(tempSystem); - CVDsim.runCalc(); + DifferentialLiberation differentialLiberation = new DifferentialLiberation(tempSystem); + differentialLiberation.setPressures( + new double[] {350.0, 250.0, 200.0, 150.0, 100.0, 70.0, 50.0, 40.0, 30.0, 20.0, 1.0}); + differentialLiberation.setTemperature(83.5, "C"); + differentialLiberation.runCalc(); } /** diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java b/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java index 2b22f83c9f..957e3f4435 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/SaturationPressure.java @@ -31,6 +31,11 @@ public SaturationPressure(SystemInterface tempSystem) { * @return a double */ public double calcSaturationPressure() { + + if (!Double.isNaN(temperature)) { + getThermoSystem().setTemperature(temperature, temperatureUnit); + } + boolean isMultiPhaseCheckChanged = false; if (!getThermoSystem().doMultiPhaseCheck()) { isMultiPhaseCheckChanged = true; diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SimulationInterface.java b/src/main/java/neqsim/PVTsimulation/simulation/SimulationInterface.java index 4e5def965a..fab1696d8f 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/SimulationInterface.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/SimulationInterface.java @@ -56,4 +56,14 @@ public interface SimulationInterface { * object */ public LevenbergMarquardt getOptimizer(); + + /** + *
+ * Setter for the field temperature
.
+ *
TestTransientFlow2 class.
+ *+ * TestTransientFlow2 class. + *
* * @author ESOL * @version $Id: $Id * @since 2.2.3 */ public class TestTransientFlow2 { - /** - *main.
- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String args[]) { - neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 25.0), 10.00); - testSystem.addComponent("methane", 0.900); - testSystem.addComponent("ethane", 0.100); - testSystem.addComponent("n-heptane", 1.00); - testSystem.createDatabase(true); - testSystem.setMixingRule(2); + /** + *+ * main. + *
+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String args[]) { + neqsim.thermo.system.SystemInterface testSystem = + new neqsim.thermo.system.SystemSrkEos((273.15 + 25.0), 10.00); + testSystem.addComponent("methane", 0.900); + testSystem.addComponent("ethane", 0.100); + testSystem.addComponent("n-heptane", 1.00); + testSystem.createDatabase(true); + testSystem.setMixingRule(2); - Stream stream_1 = new Stream("Stream1", testSystem); - ThrottlingValve valve_1 = new ThrottlingValve("valve_1", stream_1); - valve_1.setOutletPressure(5.0); - valve_1.setPercentValveOpening(50); + Stream stream_1 = new Stream("Stream1", testSystem); + ThrottlingValve valve_1 = new ThrottlingValve("valve_1", stream_1); + valve_1.setOutletPressure(5.0); + valve_1.setPercentValveOpening(50); - Separator separator_1 = new Separator("separator_1"); - separator_1.addStream(valve_1.getOutletStream()); + Separator separator_1 = new Separator("separator_1"); + separator_1.addStream(valve_1.getOutletStream()); - ThrottlingValve valve_2 = new ThrottlingValve("valve_2", separator_1.getLiquidOutStream()); - valve_2.setOutletPressure(1.0); - valve_2.setPercentValveOpening(50); - // valve_2.setCv(10.0); + ThrottlingValve valve_2 = new ThrottlingValve("valve_2", separator_1.getLiquidOutStream()); + valve_2.setOutletPressure(1.0); + valve_2.setPercentValveOpening(50); + // valve_2.setCv(10.0); - ThrottlingValve valve_3 = new ThrottlingValve("valve_3", separator_1.getGasOutStream()); - valve_3.setOutletPressure(1.0); - valve_3.setPercentValveOpening(50); + ThrottlingValve valve_3 = new ThrottlingValve("valve_3", separator_1.getGasOutStream()); + valve_3.setOutletPressure(1.0); + valve_3.setPercentValveOpening(50); - VolumeFlowTransmitter flowTransmitter = new VolumeFlowTransmitter(stream_1); - flowTransmitter.setUnit("m^3/hr"); - flowTransmitter.setMaximumValue(10.0); - flowTransmitter.setMinimumValue(1.0); + VolumeFlowTransmitter flowTransmitter = new VolumeFlowTransmitter(stream_1); + flowTransmitter.setUnit("m^3/hr"); + flowTransmitter.setMaximumValue(10.0); + flowTransmitter.setMinimumValue(1.0); - ControllerDeviceInterface flowController = new ControllerDeviceBaseClass(); - flowController.setTransmitter(flowTransmitter); - flowController.setReverseActing(true); - flowController.setControllerSetPoint(1.0); - flowController.setControllerParameters(0.7, 300.0, 0.0); + ControllerDeviceInterface flowController = new ControllerDeviceBaseClass(); + flowController.setTransmitter(flowTransmitter); + flowController.setReverseActing(true); + flowController.setControllerSetPoint(1.0); + flowController.setControllerParameters(0.7, 300.0, 0.0); - neqsim.processSimulation.processSystem.ProcessSystem operations = - new neqsim.processSimulation.processSystem.ProcessSystem(); - operations.add(stream_1); - operations.add(valve_1); - operations.add(separator_1); - operations.add(valve_2); - operations.add(valve_3); + neqsim.processSimulation.processSystem.ProcessSystem operations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + operations.add(stream_1); + operations.add(valve_1); + operations.add(separator_1); + operations.add(valve_2); + operations.add(valve_3); - operations.add(flowTransmitter); - valve_1.setController(flowController); + operations.add(flowTransmitter); + valve_1.setController(flowController); - operations.run(); - operations.displayResult(); - valve_2.setPercentValveOpening(0.1); - valve_3.setPercentValveOpening(0.1); - // transient behaviour - operations.setTimeStep(5.0); - for (int i = 0; i < 460; i++) { - System.out.println("volume flow " + flowTransmitter.getMeasuredValue() - + " valve opening " + valve_1.getPercentValveOpening() + " pressure " - + separator_1.getGasOutStream().getPressure()); - operations.runTransient(); - } + operations.run(); + operations.displayResult(); + valve_2.setPercentValveOpening(0.1); + valve_3.setPercentValveOpening(0.1); + // transient behaviour + operations.setTimeStep(5.0); + for (int i = 0; i < 460; i++) { + // System.out.println("volume flow " + flowTransmitter.getMeasuredValue() + // + " valve opening " + valve_1.getPercentValveOpening() + " pressure " + // + separator_1.getGasOutStream().getPressure()); + operations.runTransient(); + } - operations.displayResult(); - System.out.println("volume flow " + flowTransmitter.getMeasuredValue() + " valve opening " - + valve_1.getPercentValveOpening()); + operations.displayResult(); + // System.out.println("volume flow " + flowTransmitter.getMeasuredValue() + " valve opening " + // + valve_1.getPercentValveOpening()); - // operations.displayResult(); - } + // operations.displayResult(); + } } diff --git a/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java b/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java index fd0d106f26..14c83345c3 100644 --- a/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java +++ b/src/test/java/neqsim/thermo/system/SystemUMRCPAEoStest.java @@ -93,24 +93,24 @@ public void testCompressibility() { testOps.TPflash(); testSystem.init(3); testSystem.init(3); - System.out.println("molar volume gas+oil is " + testSystem.getMolarVolume()); - System.out.println("molar volume gas is " + testSystem.getPhase(0).getMolarVolume()); - System.out.println("fugacity of gas phase " + testSystem.getPhase(0).getFugacity(0)); - System.out.println("residual enthalpy of gas phase is " + testSystem.getPhase(0).getHresTP()); - System.out.println( - "isochoric heat capacity of gas phase is " + testSystem.getPhase(0).getCv("J/mol")); - System.out - .println("isobaric heat capacity of gas phase is " + testSystem.getPhase(0).getCp("J/mol")); - System.out - .println("internal energy of gas phase is " + testSystem.getPhase(0).getInternalEnergy()); - System.out.println("molar volume liquid is " + testSystem.getPhase(1).getMolarVolume()); - System.out.println("fugacity of gas phase " + testSystem.getPhase(1).getFugacity(0)); - System.out.println("enthalpy of gas phase is " + testSystem.getPhase(1).getEnthalpy("J/mol")); - System.out.println( - "isochoric heat capacity of gas phase is " + testSystem.getPhase(1).getCv("J/mol")); - // ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - // testOps.TPflash(); - + /* + * System.out.println("molar volume gas+oil is " + testSystem.getMolarVolume()); + * System.out.println("molar volume gas is " + testSystem.getPhase(0).getMolarVolume()); + * System.out.println("fugacity of gas phase " + testSystem.getPhase(0).getFugacity(0)); + * System.out.println("residual enthalpy of gas phase is " + + * testSystem.getPhase(0).getHresTP()); System.out.println( + * "isochoric heat capacity of gas phase is " + testSystem.getPhase(0).getCv("J/mol")); + * System.out .println("isobaric heat capacity of gas phase is " + + * testSystem.getPhase(0).getCp("J/mol")); System.out + * .println("internal energy of gas phase is " + testSystem.getPhase(0).getInternalEnergy()); + * System.out.println("molar volume liquid is " + testSystem.getPhase(1).getMolarVolume()); + * System.out.println("fugacity of gas phase " + testSystem.getPhase(1).getFugacity(0)); + * System.out.println("enthalpy of gas phase is " + + * testSystem.getPhase(1).getEnthalpy("J/mol")); System.out.println( + * "isochoric heat capacity of gas phase is " + testSystem.getPhase(1).getCv("J/mol")); // + * ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); // + * testOps.TPflash(); + */ // testSystem.initProperties(); // assertEquals(0.9711401538454589, testSystem.getPhase(0).getZ(), 0.001); } @@ -222,8 +222,8 @@ public void checkPhaseEnvelope() throws Exception { ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); try { testOps.calcPTphaseEnvelope(); - System.out.println("Cricondenbar " + (testOps.get("cricondenbar")[0] - 273.15) + " " - + testOps.get("cricondenbar")[1]); + // System.out.println("Cricondenbar " + (testOps.get("cricondenbar")[0] - 273.15) + " " + // + testOps.get("cricondenbar")[1]); } catch (Exception ex) { assertTrue(false); throw new Exception(ex); diff --git a/src/test/java/neqsim/thermo/util/example/H2Sdistribution.java b/src/test/java/neqsim/thermo/util/example/H2Sdistribution.java index 40f68e1c39..6dc20ca7c4 100644 --- a/src/test/java/neqsim/thermo/util/example/H2Sdistribution.java +++ b/src/test/java/neqsim/thermo/util/example/H2Sdistribution.java @@ -51,6 +51,6 @@ public static void main(String args[]) { } catch (Exception ex) { } testSystem.display(); - System.out.println("pH " + testSystem.getPhase("aqueous").getpH()); + // System.out.println("pH " + testSystem.getPhase("aqueous").getpH()); } } diff --git a/src/test/java/neqsim/thermo/util/example/ReactiveTPflash.java b/src/test/java/neqsim/thermo/util/example/ReactiveTPflash.java index 1ce0df6d96..2fc07cb1e8 100644 --- a/src/test/java/neqsim/thermo/util/example/ReactiveTPflash.java +++ b/src/test/java/neqsim/thermo/util/example/ReactiveTPflash.java @@ -67,7 +67,7 @@ public static void main(String args[]) { } catch (Exception ex) { } testSystem.display(); - System.out.println("pH " + testSystem.getPhase(1).getpH()); + // System.out.println("pH " + testSystem.getPhase(1).getpH()); logger.info("pH " + testSystem.getPhase(1).getpH()); logger.info( "activity coefficiet water " + testSystem.getPhase("aqueous").getActivityCoefficient(2)); diff --git a/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate1.java b/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate1.java index f0d7e8d780..3b15f51a6e 100644 --- a/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate1.java +++ b/src/test/java/neqsim/thermo/util/example/TestCharacterizationCondensate1.java @@ -51,18 +51,18 @@ public static void main(String args[]) { */ testSystem.addTBPfraction("C7", 5, 100.0 / 1000.0, 0.72); testSystem.addPlusFraction("C8", 50, 230.0 / 1000.0, 0.84); - //testSystem.addPlusFraction("C8", 34, 200.0 / 1000.0, 0.82); + // testSystem.addPlusFraction("C8", 34, 200.0 / 1000.0, 0.82); testSystem.getCharacterization().getLumpingModel().setNumberOfLumpedComponents(12); testSystem.getCharacterization().characterisePlusFraction(); /* * testSystem.getInterphaseProperties().setInterfacialTensionModel(0); */ - System.out.println("number of components " + testSystem.getNumberOfComponents()); + // System.out.println("number of components " + testSystem.getNumberOfComponents()); testSystem.useVolumeCorrection(true); testSystem.createDatabase(true); testSystem.setMixingRule(2); testSystem.setMultiPhaseCheck(true); - System.out.println("number of components " + testSystem.getNumberOfComponents()); + // System.out.println("number of components " + testSystem.getNumberOfComponents()); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); try { diff --git a/src/test/java/neqsim/thermo/util/example/TestUMRPRU.java b/src/test/java/neqsim/thermo/util/example/TestUMRPRU.java index 6aa5f0bc31..8b052a110d 100644 --- a/src/test/java/neqsim/thermo/util/example/TestUMRPRU.java +++ b/src/test/java/neqsim/thermo/util/example/TestUMRPRU.java @@ -100,8 +100,8 @@ public static void main(String args[]) { double numCp = (ent1 - ent2) / 0.002; - System.out.println("Cp " + cp + " numCp " + numCp); - System.out.println("entropy " + testSystem.getPhase(1).getEntropy()); + //System.out.println("Cp " + cp + " numCp " + numCp); + //System.out.println("entropy " + testSystem.getPhase(1).getEntropy()); // thermo.ThermodynamicModelTest testModel = new // thermo.ThermodynamicModelTest(testSystem); diff --git a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java index 2e00d9f227..020abcbd2f 100644 --- a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java @@ -410,7 +410,7 @@ void testpropertyFlashRegressions() throws IOException { ArrayList+ * setUp. + *
+ */ + @Test + public void testCp() { + testSystem = new neqsim.thermo.system.SystemPrEos(273.15 + 40.0, 1.0); + testSystem.addComponent("methane", 10.01); + testSystem.addComponent("nC20", 10.68); + testSystem.setMixingRule("classic"); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testOps.TPflash(); + testSystem.initProperties(); + assertEquals(2.274301427480528, testSystem.getPhase(0).getCp("kJ/kgK"), 1e-6); + } + /** ** test setPressure From d11480e613b90a8eb4f630850dc2f89290364fca Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Thu, 9 May 2024 23:16:31 +0200 Subject: [PATCH 199/317] Units-upd (#1009) * update units * update --- .../simulation/DifferentialLiberationTest.java | 7 +++---- src/test/java/neqsim/thermo/system/SystemThermoTest.java | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java b/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java index 8a4a9b3f49..c0d52b4b54 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java @@ -41,16 +41,15 @@ void testRunCalc() { satPresSim.setTemperature(97.5, "C"); satPresSim.run(); assertEquals(190.7882175445, satPresSim.getThermoSystem().getPressure(), 0.1); - tempSystem.prettyPrint(); + // tempSystem.prettyPrint(); - double[] pressures = new double[] {351.4, 323.2, 301.5, 275.9, 250.1, 226.1, 205.9, 179.1, - 154.6, 132.1, 109.0, 78.6, 53.6, 22.0, 1.0}; + double[] pressures = new double[] { 351.4, 323.2, 301.5, 275.9, 250.1, 226.1, 205.9, 179.1, + 154.6, 132.1, 109.0, 78.6, 53.6, 22.0, 1.0 }; DifferentialLiberation differentialLiberation = new DifferentialLiberation(tempSystem); differentialLiberation.setPressures(pressures); differentialLiberation.setTemperature(97.5, "C"); differentialLiberation.runCalc(); - assertEquals(1.689644811955, differentialLiberation.getBo()[0], 0.001); assertEquals(212.366545704, differentialLiberation.getRs()[0], 0.001); assertEquals(677.27184, differentialLiberation.getOilDensity()[0], 0.001); diff --git a/src/test/java/neqsim/thermo/system/SystemThermoTest.java b/src/test/java/neqsim/thermo/system/SystemThermoTest.java index be86f1de2d..abff550621 100644 --- a/src/test/java/neqsim/thermo/system/SystemThermoTest.java +++ b/src/test/java/neqsim/thermo/system/SystemThermoTest.java @@ -35,14 +35,15 @@ public static void setUp() { */ @Test public void testCp() { - testSystem = new neqsim.thermo.system.SystemPrEos(273.15 + 40.0, 1.0); + neqsim.thermo.system.SystemPrEos testSystem = + new neqsim.thermo.system.SystemPrEos(273.15 + 40.0, 1.0); testSystem.addComponent("methane", 10.01); - testSystem.addComponent("nC20", 10.68); + testSystem.addTBPfraction("C20", 10.68, 0.3, 0.85); testSystem.setMixingRule("classic"); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); testOps.TPflash(); testSystem.initProperties(); - assertEquals(2.274301427480528, testSystem.getPhase(0).getCp("kJ/kgK"), 1e-6); + assertEquals(2.0188664689245, testSystem.getPhase(1).getCp("kJ/kgK"), 1e-6); } /** From d4b356ca9a14abe267bc709d1d890861cc1e956c Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Fri, 10 May 2024 23:35:35 +0200 Subject: [PATCH 200/317] added exceptions for units not supported (#1010) * added exceptions for units not supported * typo fix * work on units * update tests * added unit * test for metric units * update units * added fluid report * removed output in json fluid and stream * update respons * Update FluidResponse.java * Update FluidResponse.java * added pure component properties in json * added more parameters to json * update --- .../processSimulation/util/monitor/Fluid.java | 120 ---------- .../util/monitor/FluidComponentResponse.java | 119 ++++++++++ .../util/monitor/FluidResponse.java | 207 ++++++++++++++++++ .../util/monitor/SeparatorResponse.java | 16 +- .../util/monitor/StreamResponse.java | 36 --- .../monitor/ThreePhaseSeparatorResponse.java | 10 +- .../processSimulation/util/report/Report.java | 11 + .../neqsim/thermo/component/Component.java | 41 ++++ .../thermo/component/ComponentInterface.java | 32 +++ src/main/java/neqsim/thermo/phase/Phase.java | 19 +- .../neqsim/thermo/phase/PhaseDefault.java | 6 + .../neqsim/thermo/phase/PhaseHydrate.java | 6 + .../neqsim/thermo/system/SystemInterface.java | 15 ++ .../neqsim/thermo/system/SystemThermo.java | 41 +++- src/main/java/neqsim/util/unit/Units.java | 21 +- .../simulation/WaxFractionSimTest.java | 5 +- .../processSystem/CompressorModule.java | 4 +- .../util/report/FluidCompinentReportTest.java | 24 ++ .../util/report/FluidReportTest.java | 27 +++ .../neqsim/thermo/system/SystemPrEoSTest.java | 2 +- .../flashOps/Degasser.java | 10 +- src/test/java/neqsim/util/unit/UnitsTest.java | 3 +- 22 files changed, 572 insertions(+), 203 deletions(-) delete mode 100644 src/main/java/neqsim/processSimulation/util/monitor/Fluid.java create mode 100644 src/main/java/neqsim/processSimulation/util/monitor/FluidComponentResponse.java create mode 100644 src/main/java/neqsim/processSimulation/util/monitor/FluidResponse.java create mode 100644 src/test/java/neqsim/processSimulation/util/report/FluidCompinentReportTest.java create mode 100644 src/test/java/neqsim/processSimulation/util/report/FluidReportTest.java diff --git a/src/main/java/neqsim/processSimulation/util/monitor/Fluid.java b/src/main/java/neqsim/processSimulation/util/monitor/Fluid.java deleted file mode 100644 index c12dbe9ca3..0000000000 --- a/src/main/java/neqsim/processSimulation/util/monitor/Fluid.java +++ /dev/null @@ -1,120 +0,0 @@ -package neqsim.processSimulation.util.monitor; - -import java.util.HashMap; -import java.util.Map; -import neqsim.thermo.system.SystemInterface; -import neqsim.util.NamedBaseClass; - -/** - *
- * Fluid class. - *
- * - * @author asmund - * @version $Id: $Id - */ -public class Fluid extends NamedBaseClass { - private static final long serialVersionUID = 1L; - public Double volumeFlow; - public Double molarMass; - public Double massDensity; - public Double massflow; - - public Map- * Constructor for Fluid. - *
- */ - @Deprecated - public Fluid() { - this("Fluid"); - } - - /** - *- * Constructor for Fluid. Sets name of inputFluid as name. - *
- * - * @param inputFluid a {@link neqsim.thermo.system.SystemInterface} object - */ - public Fluid(SystemInterface inputFluid) { - this(inputFluid.getFluidName(), inputFluid); - } - - /** - * Constructor for Fluid. - * - * @param name name of fluid - */ - public Fluid(String name) { - super(name); - this.definedComponent = new HashMap<>(); - this.oilComponent = new HashMap<>(); - } - - /** - * Constructor for Fluid. - * - * @param name name of fluid - * @param inputFluid input fluid - */ - public Fluid(String name, SystemInterface inputFluid) { - this(name); - - for (int i = 0; i < inputFluid.getNumberOfComponents(); i++) { - compProp = new HashMap<>(); - if (inputFluid.getPhase(0).getComponent(i).isIsTBPfraction()) { - compProp.put("molFraction", inputFluid.getPhase(0).getComponent(i).getz()); - compProp.put("massFlow", inputFluid.getPhase(0).getComponent(i).getFlowRate("kg/hr")); - compProp.put("molarMass", inputFluid.getPhase(0).getComponent(i).getMolarMass()); - compProp.put("normalLiquidDensity", - inputFluid.getPhase(0).getComponent(i).getNormalLiquidDensity()); - oilComponent.put(inputFluid.getPhase(0).getComponent(i).getComponentName(), compProp); - } else { - compProp.put("molFraction", inputFluid.getPhase(0).getComponent(i).getz()); - compProp.put("massFlow", inputFluid.getPhase(0).getComponent(i).getFlowRate("kg/hr")); - definedComponent.put( - inputFluid.getPhase(0).getComponent(i).getComponentName().replaceAll("-", ""), - compProp); - } - } - - molarMass = inputFluid.getMolarMass(); - massDensity = inputFluid.getDensity("kg/m3"); - massflow = inputFluid.getFlowRate("kg/hr"); - volumeFlow = inputFluid.getFlowRate("m3/hr"); - } - - /** - * @return SystemInterface - */ - SystemInterface getNeqSimFluid() { - SystemInterface tempFluid = new neqsim.thermo.system.SystemSrkEos(); - - definedComponent.keySet().forEach(key -> { - tempFluid.addComponent(key, definedComponent.get(key).get("molFraction")); - }); - - oilComponent.keySet().forEach(key -> { - tempFluid.addTBPfraction(key, definedComponent.get(key).get("molFraction"), - definedComponent.get(key).get("molarMass"), - definedComponent.get(key).get("normalLiquidDensity")); - }); - - tempFluid.setMixingRule(2); - - return tempFluid; - } - - /** - *- * print. - *
- */ - public void print() {} -} diff --git a/src/main/java/neqsim/processSimulation/util/monitor/FluidComponentResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/FluidComponentResponse.java new file mode 100644 index 0000000000..61cc758454 --- /dev/null +++ b/src/main/java/neqsim/processSimulation/util/monitor/FluidComponentResponse.java @@ -0,0 +1,119 @@ +package neqsim.processSimulation.util.monitor; + +import java.util.HashMap; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import neqsim.thermo.component.ComponentInterface; +import neqsim.thermo.phase.PhaseInterface; +import neqsim.thermo.system.SystemInterface; + +/** + *+ * Fluid class. + *
+ * + * @author asmund + * @version $Id: $Id + */ +public class FluidComponentResponse { + private static final long serialVersionUID = 1L; + static Logger logger = LogManager.getLogger(FluidComponentResponse.class); + public String name; + public HashMap+ * Constructor for FluidComponentResponse. + *
+ */ + @Deprecated + public FluidComponentResponse() { + this("Fluid"); + } + + /** + *+ * Constructor for FluidComponentResponse. Sets name of inputFluid as name. + *
+ * + * @param inputFluid a {@link neqsim.thermo.system.SystemInterface} object + */ + public FluidComponentResponse(SystemInterface inputFluid) { + this(inputFluid.getFluidName(), inputFluid); + } + + /** + * Constructor for FluidComponentResponse. + * + * @param nameinp name of fluid + */ + public FluidComponentResponse(String nameinp) { + this.name = nameinp; + } + + /** + * Constructor for FluidComponentResponse. + * + * @param fluidname name of fluid + * @param fluid input fluid + */ + public FluidComponentResponse(String fluidname, SystemInterface fluid) { + this(fluidname); + name = fluidname; + SystemInterface inputFluid = fluid.clone(); + inputFluid.init(0); + + HashMap+ * print. + *
+ */ + public void print() {} +} diff --git a/src/main/java/neqsim/processSimulation/util/monitor/FluidResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/FluidResponse.java new file mode 100644 index 0000000000..a3e6a19376 --- /dev/null +++ b/src/main/java/neqsim/processSimulation/util/monitor/FluidResponse.java @@ -0,0 +1,207 @@ +package neqsim.processSimulation.util.monitor; + +import java.util.HashMap; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import neqsim.thermo.system.SystemInterface; + +/** + *+ * Fluid class. + *
+ * + * @author asmund + * @version $Id: $Id + */ +public class FluidResponse { + private static final long serialVersionUID = 1L; + static Logger logger = LogManager.getLogger(FluidResponse.class); + public String name; + public HashMap+ * Constructor for Fluid. + *
+ */ + @Deprecated + public FluidResponse() { + this("Fluid"); + } + + /** + *+ * Constructor for Fluid. Sets name of inputFluid as name. + *
+ * + * @param inputFluid a {@link neqsim.thermo.system.SystemInterface} object + */ + public FluidResponse(SystemInterface inputFluid) { + this(inputFluid.getFluidName(), inputFluid); + } + + /** + * Constructor for Fluid. + * + * @param nameinp name of fluid + */ + public FluidResponse(String nameinp) { + this.name = nameinp; + } + + /** + * Constructor for Fluid. + * + * @param fluidname name of fluid + * @param inputFluid input fluid + */ + public FluidResponse(String fluidname, SystemInterface inputFluid) { + this(fluidname); + + name = inputFluid.getFluidName(); + + HashMap+ * print. + *
+ */ + public void print() {} +} diff --git a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java index b8510364c1..e6a0a62e56 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java @@ -15,7 +15,7 @@ public class SeparatorResponse { public String name; public Double gasLoadFactor; public Double massflow; - public Fluid gasFluid, liquidFluid, oilFluid, waterFluid; + public FluidResponse gasFluid, liquidFluid, oilFluid, waterFluid; /** *
@@ -30,13 +30,13 @@ public SeparatorResponse(ThreePhaseSeparator inputSeparator) {
massflow = inputSeparator.getFluid().getFlowRate("kg/hr");
gasLoadFactor = inputSeparator.getGasLoadFactor();
if (inputSeparator.getThermoSystem().hasPhaseType("aqueous")) {
- waterFluid = new Fluid(inputSeparator.getWaterOutStream().getFluid());
+ waterFluid = new FluidResponse(inputSeparator.getWaterOutStream().getFluid());
}
if (inputSeparator.getThermoSystem().hasPhaseType("oil")) {
- oilFluid = new Fluid(inputSeparator.getOilOutStream().getFluid());
+ oilFluid = new FluidResponse(inputSeparator.getOilOutStream().getFluid());
}
if (inputSeparator.getThermoSystem().hasPhaseType("gas")) {
- gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid());
+ gasFluid = new FluidResponse(inputSeparator.getGasOutStream().getFluid());
}
}
@@ -53,17 +53,17 @@ public SeparatorResponse(Separator inputSeparator) {
massflow = inputSeparator.getFluid().getFlowRate("kg/hr");
gasLoadFactor = inputSeparator.getGasLoadFactor();
if (inputSeparator.getThermoSystem().hasPhaseType("aqueous")) {
- waterFluid = new Fluid(inputSeparator.getThermoSystem().phaseToSystem("aqueous"));
+ waterFluid = new FluidResponse(inputSeparator.getThermoSystem().phaseToSystem("aqueous"));
}
if (inputSeparator.getThermoSystem().hasPhaseType("oil")) {
- oilFluid = new Fluid(inputSeparator.getThermoSystem().phaseToSystem("oil"));
+ oilFluid = new FluidResponse(inputSeparator.getThermoSystem().phaseToSystem("oil"));
}
if (inputSeparator.getThermoSystem().hasPhaseType("gas")) {
- gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid());
+ gasFluid = new FluidResponse(inputSeparator.getGasOutStream().getFluid());
}
if (inputSeparator.getThermoSystem().hasPhaseType("oil")
|| inputSeparator.getThermoSystem().hasPhaseType("aqueous")) {
- liquidFluid = new Fluid(inputSeparator.getLiquidOutStream().getFluid());
+ liquidFluid = new FluidResponse(inputSeparator.getLiquidOutStream().getFluid());
}
}
}
diff --git a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
index 0a0c18b964..ae58f95c82 100644
--- a/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
+++ b/src/main/java/neqsim/processSimulation/util/monitor/StreamResponse.java
@@ -17,16 +17,6 @@
public class StreamResponse {
static Logger logger = LogManager.getLogger(StreamResponse.class);
public String name;
- public Fluid fluid;
- public Double temperature;
- public Double pressure;
- public Double volumeFlow;
- public Double molarMass;
- public Double massDensity;
- public Double massflow;
- public Double massflowGas;
- public Double massflowOil;
- public Double massflowAqueous;
public HashMap
@@ -28,8 +28,8 @@ public ThreePhaseSeparatorResponse(ThreePhaseSeparator inputSeparator) {
name = inputSeparator.getName();
massflow = inputSeparator.getFluid().getFlowRate("kg/hr");
gasLoadFactor = inputSeparator.getGasLoadFactor();
- oilFluid = new Fluid(inputSeparator.getOilOutStream().getFluid());
- gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid());
+ oilFluid = new FluidResponse(inputSeparator.getOilOutStream().getFluid());
+ gasFluid = new FluidResponse(inputSeparator.getGasOutStream().getFluid());
}
/**
@@ -43,7 +43,7 @@ public ThreePhaseSeparatorResponse(Separator inputSeparator) {
name = inputSeparator.getName();
massflow = inputSeparator.getFluid().getFlowRate("kg/hr");
gasLoadFactor = inputSeparator.getGasLoadFactor();
- oilFluid = new Fluid(inputSeparator.getLiquidOutStream().getFluid());
- gasFluid = new Fluid(inputSeparator.getGasOutStream().getFluid());
+ oilFluid = new FluidResponse(inputSeparator.getLiquidOutStream().getFluid());
+ gasFluid = new FluidResponse(inputSeparator.getGasOutStream().getFluid());
}
}
diff --git a/src/main/java/neqsim/processSimulation/util/report/Report.java b/src/main/java/neqsim/processSimulation/util/report/Report.java
index c5f3e0dc35..913eefe3ea 100644
--- a/src/main/java/neqsim/processSimulation/util/report/Report.java
+++ b/src/main/java/neqsim/processSimulation/util/report/Report.java
@@ -9,6 +9,7 @@
import neqsim.processSimulation.processSystem.ProcessModule;
import neqsim.processSimulation.processSystem.ProcessModuleBaseClass;
import neqsim.processSimulation.processSystem.ProcessSystem;
+import neqsim.thermo.system.SystemInterface;
/**
*
@@ -24,11 +25,16 @@ public class Report {
Gson gson = new Gson();
ProcessSystem process = null;
ProcessEquipmentBaseClass processEquipment = null;
+ SystemInterface fluid = null;
public Report(ProcessSystem process) {
this.process = process;
}
+ public Report(SystemInterface fluid) {
+ this.fluid = fluid;
+ }
+
public Report(ProcessEquipmentBaseClass processEquipmentBaseClass) {
processEquipment = processEquipmentBaseClass;
}
@@ -50,7 +56,12 @@ public String json() {
if (processEquipment != null) {
json_reports.put(processEquipment.getName(), processEquipment.toJson());
}
+ if (fluid != null) {
+ json_reports.put(fluid.getFluidName(), fluid.toJson());
+ }
return new GsonBuilder().setPrettyPrinting().create().toJson(json_reports);
}
+
+
}
diff --git a/src/main/java/neqsim/thermo/component/Component.java b/src/main/java/neqsim/thermo/component/Component.java
index 0f445b7f87..82aa1dbfda 100644
--- a/src/main/java/neqsim/thermo/component/Component.java
+++ b/src/main/java/neqsim/thermo/component/Component.java
@@ -656,6 +656,14 @@ public final double getTC() {
return criticalTemperature;
}
+ /** {@inheritDoc} */
+ @Override
+ public final double getTC(String unit) {
+ neqsim.util.unit.TemperatureUnit tempConversion =
+ new neqsim.util.unit.TemperatureUnit(criticalTemperature, "K");
+ return tempConversion.getValue(unit);
+ }
+
/** {@inheritDoc} */
@Override
public final void setTC(double val) {
@@ -686,6 +694,14 @@ public final double getPC() {
return criticalPressure;
}
+ /** {@inheritDoc} */
+ @Override
+ public final double getPC(String unit) {
+ neqsim.util.unit.PressureUnit presConversion =
+ new neqsim.util.unit.PressureUnit(criticalPressure, "bara");
+ return presConversion.getValue(unit);
+ }
+
/** {@inheritDoc} */
@Override
public double getGibbsEnergyOfFormation() {
@@ -751,6 +767,31 @@ public double getNormalLiquidDensity() {
return normalLiquidDensity;
}
+ /** {@inheritDoc} */
+ @Override
+ public double getNormalLiquidDensity(String unit) {
+ double refDensity = normalLiquidDensity * 1e3; // density in kg/m3
+ double conversionFactor = 1.0;
+ switch (unit) {
+ case "kg/m3":
+ conversionFactor = 1.0;
+ break;
+ case "lb/ft3":
+ conversionFactor = 0.0624279606;
+ break;
+ case "kg/Sm3":
+ return getMolarMass() * ThermodynamicConstantsInterface.atm
+ / ThermodynamicConstantsInterface.R
+ / ThermodynamicConstantsInterface.standardStateTemperature;
+ case "mol/m3":
+ conversionFactor = 1.0 / getMolarMass();
+ break;
+ default:
+ throw new RuntimeException("unit not supported " + unit);
+ }
+ return refDensity * conversionFactor;
+ }
+
/** {@inheritDoc} */
@Override
public double getViscosityCorrectionFactor() {
diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java
index 612cc9c674..17702f1581 100644
--- a/src/main/java/neqsim/thermo/component/ComponentInterface.java
+++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java
@@ -959,6 +959,15 @@ public void Finit(PhaseInterface phase, double temperature, double pressure,
*/
public double getNormalLiquidDensity();
+ /**
+ *
+ * getNormalLiquidDensity.
+ *
* Getter for property
+ * getTC.
+ *
+ * getPC.
+ *
+ * toJson - return String with json inormation of fluid
+ *
+ * toCompJson - return String with json inormation of pure component properties of fluid
+ *
@@ -80,4 +81,31 @@ public void increaseTime(double dt) {
}
this.time = this.time + dt;
}
+
+ /**
+ *
+ * setRunInSteps
+ *
+ * isRunInSteps.
+ *
- * In this method all thermodynamic and unit operations will be calculated in a steady state
- * calculation. Sets calc identifier UUID.
+ * setRunInSteps
*
+ * isRunInSteps.
+ *
+ * run
+ *
* run
* componentName
.
@@ -2245,4 +2254,27 @@ public static LinkedHashMap
* getComponentNameTag. @@ -689,7 +718,8 @@ public default String[] getComponentNames() { public double getCorrectedVolume(); /** - * method to return the volume fraction of a phase note: with Peneloux volume correction. + * method to return the volume fraction of a phase note: with Peneloux volume + * correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -810,7 +840,7 @@ public default String[] getComponentNames() { * method to return exergy in a specified unit. * * @param temperatureOfSurroundings in Kelvin - * @param exergyUnit a {@link java.lang.String} object + * @param exergyUnit a {@link java.lang.String} object * @return exergy in specified unit */ public double getExergy(double temperatureOfSurroundings, String exergyUnit); @@ -818,8 +848,10 @@ public default String[] getComponentNames() { /** * method to return flow rate of fluid. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, m3/min, m3/hr, - * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, + * m3/min, m3/hr, + * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, + * mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -936,7 +968,7 @@ public default double getGamma2() { * * @param phase1 phase number of phase1 * @param phase2 phase number of phase2 - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object * @return interfacial tension with specified unit */ public double getInterfacialTension(int phase1, int phase2, String unit); @@ -944,9 +976,12 @@ public default double getGamma2() { /** * method to return interfacial tension between two phases. * - * @param phase1 phase type of phase1 as string (valid phases are gas, oil, aqueous) - * @param phase2 phase type of phase2 as string (valid phases are gas, oil, aqueous) - * @return interfacial tension with unit N/m. If one or both phases does not exist - the method + * @param phase1 phase type of phase1 as string (valid phases are gas, oil, + * aqueous) + * @param phase2 phase type of phase2 as string (valid phases are gas, oil, + * aqueous) + * @return interfacial tension with unit N/m. If one or both phases does not + * exist - the method * will return NaN */ public double getInterfacialTension(String phase1, String phase2); @@ -971,13 +1006,15 @@ public default double getGamma2() { * getInterphaseProperties. *
* - * @return a {@link neqsim.physicalProperties.interfaceProperties.InterphasePropertiesInterface} + * @return a + * {@link neqsim.physicalProperties.interfaceProperties.InterphasePropertiesInterface} * object */ public InterphasePropertiesInterface getInterphaseProperties(); /** - * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis + * method to get the Joule Thomson Coefficient of a system. Based on a phase + * mole fraction basis * average * * @return Joule Thomson coefficient in K/bar @@ -985,7 +1022,8 @@ public default double getGamma2() { public double getJouleThomsonCoefficient(); /** - * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis + * method to get the Joule Thomson Coefficient of a system. Based on a phase + * mole fraction basis * average. * * @param unit Supported units are K/bar, C/bar @@ -1120,14 +1158,16 @@ public default double getGamma2() { public double[] getMolarRate(); /** - * method to return molar volume of the fluid note: without Peneloux volume correction. + * method to return molar volume of the fluid note: without Peneloux volume + * correction. * * @return molar volume volume in unit m3/mol*1e5 */ public double getMolarVolume(); /** - * method to return molar volume of the fluid: eventual volume correction included. + * method to return molar volume of the fluid: eventual volume correction + * included. * * @param unit Supported units are m3/mol, litre/mol * @@ -1156,7 +1196,8 @@ public default double getGamma2() { /** *- * Get sum of mole fractions for all components. NB! init(0) must be called first. + * Get sum of mole fractions for all components. NB! init(0) must be called + * first. *
* * @return a double @@ -1289,7 +1330,7 @@ public default double getNumberOfMoles() { * method to return phase fraction of selected phase. * * @param phaseTypeName gas/oil/aqueous - * @param unit mole/volume/weight + * @param unit mole/volume/weight * @return phase: fraction in specified unit */ public double getPhaseFraction(String phaseTypeName, String unit); @@ -1345,10 +1386,12 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { } /** - * return the phase of to specified type if the phase does not exist, the method will return null. + * return the phase of to specified type if the phase does not exist, the method + * will return null. * - * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, hydrate are - * supported) + * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, + * hydrate are + * supported) * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ public PhaseInterface getPhaseOfType(String phaseTypeName); @@ -1409,7 +1452,7 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param phase a int * @return a double */ @@ -1420,9 +1463,9 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param compName a {@link java.lang.String} object - * @param phase a int + * @param phase a int * @return a double */ public double getProperty(String prop, String compName, int phase); @@ -1437,7 +1480,8 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public String[][] getResultTable(); /** - * method to get the speed of sound of a system. The sound speed is implemented based on a molar + * method to get the speed of sound of a system. The sound speed is implemented + * based on a molar * average over the phases * * @return speed of sound in m/s @@ -1445,7 +1489,8 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public double getSoundSpeed(); /** - * method to get the speed of sound of a system. The sound speed is implemented based on a molar + * method to get the speed of sound of a system. The sound speed is implemented + * based on a molar * average over the phases * * @param unit Supported units are m/s, km/h @@ -1559,7 +1604,8 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public double getVolume(String unit); /** - * method to return the volume fraction of a phase note: without Peneloux volume correction. + * method to return the volume fraction of a phase note: without Peneloux volume + * correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -1595,17 +1641,26 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public double getWtFraction(int phaseNumber); /** - * method to return compressibility factor of a fluid compressibility factor is defined in EoS + * method to return compressibility factor of a fluid compressibility factor is + * defined in EoS * from PV=ZnRT where V is total volume of fluid. * * @return compressibility factor Z */ public double getZ(); + /** + * method to return Z volume corrected gas compressibility + * + * @return double Z volume corrected + */ + public double getZvolcorr(); + /** * Verify if system has a component. * - * @param name Name of component to look for. NB! Converts name to normalized name. + * @param name Name of component to look for. NB! Converts name to normalized + * name. * @return True if component is found. */ public default boolean hasComponent(String name) { @@ -1615,8 +1670,9 @@ public default boolean hasComponent(String name) { /** * Verify if system has a component. * - * @param name Name of component to look for. - * @param normalized Set true to convert input name to normalized component name. + * @param name Name of component to look for. + * @param normalized Set true to convert input name to normalized component + * name. * @return True if component is found. */ public default boolean hasComponent(String name, boolean normalized) { @@ -1666,7 +1722,8 @@ public default boolean hasSolidPhase() { } /** - * Calculate thermodynamic properties of the fluid using the init type set in fluid. + * Calculate thermodynamic properties of the fluid using the init type set in + * fluid. * * @see getInitType */ @@ -1675,27 +1732,36 @@ public default void init() { } /** - * method to calculate thermodynamic properties of the fluid. The temperature, pressure, number of + * method to calculate thermodynamic properties of the fluid. The temperature, + * pressure, number of * phases and composition of the phases will be used as basis for calculation. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for all phases. 1: - * Calculation of density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, - * Cp, Cv, and most other thermodynamic properties 3: 1+2 + Calculation of composition - * derivatives of fugacity coefficients. + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for + * all phases. 1: + * Calculation of density, fugacities and Z-factor 2: 1 + + * calculation of enthalpy, entropy, + * Cp, Cv, and most other thermodynamic properties 3: 1+2 + + * Calculation of composition + * derivatives of fugacity coefficients. */ public void init(int number); // public void setPressure(double newPressure, int phaseNumber); /** - * method to calculate thermodynamic properties of the selected phase. The temperature, pressure, - * number of phases and composition of the phase will be used as basis for calculation. + * method to calculate thermodynamic properties of the selected phase. The + * temperature, pressure, + * number of phases and composition of the phase will be used as basis for + * calculation. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: Calculation of - * density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, Cp, Cv, and - * most other thermodynamic properties 3: 1+2 + Calculation of composition derivatives of - * fugacity coefficients. - * @param phase a int + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: + * Calculation of + * density, fugacities and Z-factor 2: 1 + calculation of + * enthalpy, entropy, Cp, Cv, and + * most other thermodynamic properties 3: 1+2 + Calculation of + * composition derivatives of + * fugacity coefficients. + * @param phase a int */ public void init(int number, int phase); @@ -1708,7 +1774,8 @@ public default void init() { /** *- * Calculate system beta values using Phase.getNumberOfMolesInPhase and getTotalNumberOfMoles. + * Calculate system beta values using Phase.getNumberOfMolesInPhase and + * getTotalNumberOfMoles. *
*/ public void initBeta(); @@ -1731,7 +1798,8 @@ public default void init() { public void initPhysicalProperties(String propertyName); /** - * Calculates thermodynamic and physical properties of a fluid using initThermoProperties() and + * Calculates thermodynamic and physical properties of a fluid using + * initThermoProperties() and * initPhysicalProperties(). */ public void initProperties(); @@ -1939,7 +2007,7 @@ public default void prettyPrint() { * readObjectFromFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object * @return a {@link neqsim.thermo.system.SystemInterface} object */ @@ -1957,7 +2025,8 @@ public default void prettyPrint() { * removeComponent. * * - * @param name Name of the component to remove. See NeqSim database for component in the database. + * @param name Name of the component to remove. See NeqSim database for + * component in the database. */ public void removeComponent(String name); @@ -2055,7 +2124,7 @@ public default void prettyPrint() { * saveFluid. * * - * @param id a int + * @param id a int * @param text a {@link java.lang.String} object */ public void saveFluid(int id, String text); @@ -2065,7 +2134,7 @@ public default void prettyPrint() { * saveObject. * * - * @param ID a int + * @param ID a int * @param text a {@link java.lang.String} object */ public void saveObject(int ID, String text); @@ -2075,7 +2144,7 @@ public default void prettyPrint() { * saveObjectToFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object */ public void saveObjectToFile(String filePath, String fluidName); @@ -2114,7 +2183,8 @@ public default void prettyPrint() { /** *
- * Setter for property beta
. NB! Sets beta = b for first phase and 1-b for second
+ * Setter for property beta
. NB! Sets beta = b for first phase and
+ * 1-b for second
* phase, not for multiphase systems.
*
- * This method is used to set the total molar composition of a fluid. The total flow rate will be + * This method is used to set the total molar composition of a fluid. The total + * flow rate will be * kept constant. The input mole fractions will be normalized. *
* @@ -2317,21 +2394,27 @@ public void setImplementedTemperatureDeriativesofFugacity( public void setMolarComposition(double[] moles); /** - * This method is used to set the total molar composition of a characterized fluid. The total flow + * This method is used to set the total molar composition of a characterized + * fluid. The total flow * rate will be kept constant. The input mole fractions will be normalized. * - * @param molefractions is a double array taking the molar fraction of the components in the - * fluid. THe last fraction in the array is the total molefraction of the characterized - * components. + * @param molefractions is a double array taking the molar fraction of the + * components in the + * fluid. THe last fraction in the array is the total + * molefraction of the characterized + * components. */ public void setMolarCompositionOfPlusFluid(double[] molefractions); /** - * This method is used to set the total molar composition of a plus fluid. The total flow rate + * This method is used to set the total molar composition of a plus fluid. The + * total flow rate * will be kept constant. The input mole fractions will be normalized. * - * @param molefractions is a double array taking the molar fraction of the components in the - * fluid. THe last molfraction is the mole fraction of the plus component + * @param molefractions is a double array taking the molar fraction of the + * components in the + * fluid. THe last molfraction is the mole fraction of the + * plus component */ public void setMolarCompositionPlus(double[] molefractions); @@ -2345,11 +2428,15 @@ public void setImplementedTemperatureDeriativesofFugacity( public void setMolarFlowRates(double[] moles); /** - * method to specify if calculations should check for more than two fluid phases. + * method to specify if calculations should check for more than two fluid + * phases. * - * @param doMultiPhaseCheck Specify if the calculations should check for more than two fluid - * phases. Default is two fluid phases (gas and liquid). If set to true the program will - * check for gas and multiple liquid phases (eg. gas-oil-aqueous). + * @param doMultiPhaseCheck Specify if the calculations should check for more + * than two fluid + * phases. Default is two fluid phases (gas and + * liquid). If set to true the program will + * check for gas and multiple liquid phases (eg. + * gas-oil-aqueous). */ public void setMultiPhaseCheck(boolean doMultiPhaseCheck); @@ -2391,7 +2478,8 @@ public void setImplementedTemperatureDeriativesofFugacity( /** *
- * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure and temperature
+ * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure
+ * and temperature
* from the currently existing phase object at index numb
*
this.phaseIndex[index] = phaseIndex;
*
*
- * @param index a int
+ * @param index a int
* @param phaseIndex a int
*/
public void setPhaseIndex(int index, int phaseIndex);
@@ -2415,7 +2503,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* Change the phase type of a given phase.
*
* @param phaseToChange the phase number of the phase to set phase type
- * @param pt PhaseType to set
+ * @param pt PhaseType to set
*/
public void setPhaseType(int phaseToChange, PhaseType pt);
@@ -2423,7 +2511,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* Change the phase type of a given phase.
*
* @param phaseToChange the phase number of the phase to set phase type
- * @param phaseName String to set
+ * @param phaseName String to set
*/
public void setPhaseType(int phaseToChange, String phaseName);
@@ -2445,7 +2533,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* method to set the pressure of a fluid (same pressure for all phases).
*
* @param newPressure in specified unit
- * @param unit unit can be bar, bara, barg or atm
+ * @param unit unit can be bar, bara, barg or atm
*/
public void setPressure(double newPressure, String unit);
@@ -2500,7 +2588,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
*
*
* @param newTemperature a double
- * @param phaseNumber a int
+ * @param phaseNumber a int
*/
public void setTemperature(double newTemperature, int phaseNumber);
@@ -2508,7 +2596,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* method to set the temperature of a fluid (same temperature for all phases).
*
* @param newTemperature in specified unit
- * @param unit unit can be C or K (Celsius or Kelvin)
+ * @param unit unit can be C or K (Celsius or Kelvin)
*/
public void setTemperature(double newTemperature, String unit);
@@ -2518,8 +2606,10 @@ public void setImplementedTemperatureDeriativesofFugacity(
*
*
* @param flowRate a double
- * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, kg/min, kg/hr
- * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, Sm3/day, idSm3/hr, idSm3/day
+ * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec,
+ * kg/min, kg/hr
+ * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr,
+ * Sm3/day, idSm3/hr, idSm3/day
*/
public void setTotalFlowRate(double flowRate, String flowunit);
@@ -2547,7 +2637,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
*
*
* @param model a {@link java.lang.String} object
- * @param val a double
+ * @param val a double
* @param phase a int
*/
public void tuneModel(String model, double val, int phase);
@@ -2566,9 +2656,9 @@ public void setImplementedTemperatureDeriativesofFugacity(
* write.
*
*
- * @param name a {@link java.lang.String} object
+ * @param name a {@link java.lang.String} object
* @param filename a {@link java.lang.String} object
- * @param newfile a boolean
+ * @param newfile a boolean
*/
public void write(String name, String filename, boolean newfile);
@@ -2579,7 +2669,6 @@ public void setImplementedTemperatureDeriativesofFugacity(
*/
public double[] getKvector();
-
/**
* * getzvector - return vector of total molar composition @@ -2596,7 +2685,8 @@ public void setImplementedTemperatureDeriativesofFugacity( /** *
- * toCompJson - return String with json inormation of pure component properties of fluid + * toCompJson - return String with json inormation of pure component properties + * of fluid *
*/ public String toCompJson(); diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 37c0ad3f60..ce3bd25a0a 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -1493,7 +1493,7 @@ public String[][] createTable(String name) { buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 5][0] = "Z factor"; table[getPhases()[0].getNumberOfComponents() + 5][i + 2] = - nf.format(getPhase(i).getZ(), buf, test).toString(); + nf.format(getPhase(i).getZvolcorr(), buf, test).toString(); table[getPhases()[0].getNumberOfComponents() + 5][6] = "[-]"; buf = new StringBuffer(); @@ -3065,6 +3065,13 @@ public double getZ() { return Z; } + /** {@inheritDoc} */get + @Override + public double getZvolcorr() { + return getPressure("Pa") * getMolarMass() / neqsim.thermo.ThermodynamicConstantsInterface.R + / getTemperature() / getDensity("kg/m3"); + } + /** * Verify if system has a phase of a specific type. * diff --git a/src/test/java/neqsim/thermo/system/SystemPrEoSTest.java b/src/test/java/neqsim/thermo/system/SystemPrEoSTest.java index b4b647a33c..df738c0566 100644 --- a/src/test/java/neqsim/thermo/system/SystemPrEoSTest.java +++ b/src/test/java/neqsim/thermo/system/SystemPrEoSTest.java @@ -172,12 +172,16 @@ public void checkKappa() { testSystem.addComponent("methane", 0.68); testSystem.addComponent("ethane", 0.1); testSystem.setMixingRule("classic"); + testSystem.useVolumeCorrection(true); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); testOps.TPflash(); testSystem.initProperties(); testSystem.getKappa(); testSystem.getPhase("gas").getKappa(); assertEquals(testSystem.getKappa(), testSystem.getPhase("gas").getKappa(), 1e-5); + assertEquals(0.817374332, testSystem.getZ(), 1e-6); + assertEquals(0.833031816, testSystem.getZvolcorr(), 1e-6); + assertEquals(0.833031816, testSystem.getPhase("gas").getZvolcorr(), 1e-6); } /** From afac3a99ecf5f43e625a0b771d92394b7a2d39e7 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Wed, 15 May 2024 23:24:48 +0200 Subject: [PATCH 206/317] Update SystemThermo.java --- src/main/java/neqsim/thermo/system/SystemThermo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index ce3bd25a0a..7e351eefb7 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -3065,7 +3065,7 @@ public double getZ() { return Z; } - /** {@inheritDoc} */get + /** {@inheritDoc} */ @Override public double getZvolcorr() { return getPressure("Pa") * getMolarMass() / neqsim.thermo.ThermodynamicConstantsInterface.R From 8b23ec973fb4cb2c512f5ec0a54a185ed4cd78a6 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 20 May 2024 23:58:00 +0200 Subject: [PATCH 207/317] update json reporting (#1016) * update json reporting * update test --- .../processEquipment/separator/Separator.java | 4 ++ .../util/monitor/SeparatorResponse.java | 30 +++++------ .../processSimulation/util/report/Report.java | 14 +---- .../neqsim/thermo/system/SystemThermo.java | 1 - .../util/monitor/SeparatorResponseTest.java | 54 +++++++++++++++++++ 5 files changed, 73 insertions(+), 30 deletions(-) create mode 100644 src/test/java/neqsim/processSimulation/util/monitor/SeparatorResponseTest.java diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java index f2c074dbd2..d8c803fdd9 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java @@ -873,6 +873,10 @@ public boolean equals(Object obj) { && Objects.equals(waterSystem, other.waterSystem); } + public StreamInterface getFeedStream() { + return new Stream(getName(), getThermoSystem()); + } + /** {@inheritDoc} */ @Override public String toJson() { diff --git a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java index e6a0a62e56..14f4e938f2 100644 --- a/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java +++ b/src/main/java/neqsim/processSimulation/util/monitor/SeparatorResponse.java @@ -14,8 +14,7 @@ public class SeparatorResponse { public String name; public Double gasLoadFactor; - public Double massflow; - public FluidResponse gasFluid, liquidFluid, oilFluid, waterFluid; + public StreamResponse feed, gas, liquid, oil, water; /** *
@@ -27,17 +26,19 @@ public class SeparatorResponse {
*/
public SeparatorResponse(ThreePhaseSeparator inputSeparator) {
name = inputSeparator.getName();
- massflow = inputSeparator.getFluid().getFlowRate("kg/hr");
gasLoadFactor = inputSeparator.getGasLoadFactor();
+
+ feed = new StreamResponse(inputSeparator.getFeedStream());
if (inputSeparator.getThermoSystem().hasPhaseType("aqueous")) {
- waterFluid = new FluidResponse(inputSeparator.getWaterOutStream().getFluid());
+ water = new StreamResponse(inputSeparator.getWaterOutStream());
}
if (inputSeparator.getThermoSystem().hasPhaseType("oil")) {
- oilFluid = new FluidResponse(inputSeparator.getOilOutStream().getFluid());
+ oil = new StreamResponse(inputSeparator.getOilOutStream());
}
if (inputSeparator.getThermoSystem().hasPhaseType("gas")) {
- gasFluid = new FluidResponse(inputSeparator.getGasOutStream().getFluid());
+ gas = new StreamResponse(inputSeparator.getGasOutStream());
}
+
}
/**
@@ -50,20 +51,15 @@ public SeparatorResponse(ThreePhaseSeparator inputSeparator) {
*/
public SeparatorResponse(Separator inputSeparator) {
name = inputSeparator.getName();
- massflow = inputSeparator.getFluid().getFlowRate("kg/hr");
gasLoadFactor = inputSeparator.getGasLoadFactor();
- if (inputSeparator.getThermoSystem().hasPhaseType("aqueous")) {
- waterFluid = new FluidResponse(inputSeparator.getThermoSystem().phaseToSystem("aqueous"));
- }
- if (inputSeparator.getThermoSystem().hasPhaseType("oil")) {
- oilFluid = new FluidResponse(inputSeparator.getThermoSystem().phaseToSystem("oil"));
+ feed = new StreamResponse(inputSeparator.getFeedStream());
+ if (inputSeparator.getThermoSystem().hasPhaseType("aqueous")
+ || inputSeparator.getThermoSystem().hasPhaseType("liquid")
+ || inputSeparator.getThermoSystem().hasPhaseType("oil")) {
+ liquid = new StreamResponse(inputSeparator.getLiquidOutStream());
}
if (inputSeparator.getThermoSystem().hasPhaseType("gas")) {
- gasFluid = new FluidResponse(inputSeparator.getGasOutStream().getFluid());
- }
- if (inputSeparator.getThermoSystem().hasPhaseType("oil")
- || inputSeparator.getThermoSystem().hasPhaseType("aqueous")) {
- liquidFluid = new FluidResponse(inputSeparator.getLiquidOutStream().getFluid());
+ gas = new StreamResponse(inputSeparator.getGasOutStream());
}
}
}
diff --git a/src/main/java/neqsim/processSimulation/util/report/Report.java b/src/main/java/neqsim/processSimulation/util/report/Report.java
index af7c1f525e..d3609d6860 100644
--- a/src/main/java/neqsim/processSimulation/util/report/Report.java
+++ b/src/main/java/neqsim/processSimulation/util/report/Report.java
@@ -1,7 +1,6 @@
package neqsim.processSimulation.util.report;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -23,9 +22,6 @@
* @version $Id: $Id
*/
public class Report {
- private HashMap
+ * ReservoirCVDsim class.
+ *
+ * ReservoirDiffLibsim class.
+ *
+ * ReservoirTPsim class.
+ *
+ * GORfitter class.
+ *
+ * Constructor for MPFMfitter.
+ *
+ * Constructor for MPFMfitter.
+ *
+ * Constructor for MPFMfitter.
+ *
+ * getGFV.
+ *
+ * Setter for the field
+ * Getter for the field
+ * Setter for the field
+ * getTemperature.
+ *
+ * Setter for the field
+ * getGOR.
+ *
+ * setGOR.
+ *
+ * setGVF.
+ *
+ * Getter for the field
+ * Setter for the field
+ * isFitAsGVF.
+ *
+ * Setter for the field inletStream
.
+ * pressure
.
+ * pressure
.
+ * temperature
.
+ * referenceConditions
.
+ * referenceConditions
.
+ * fitAsGVF
.
+ *
+ * FlowInducedVibrationAnalyser class. + *
+ * + * @author SEROS + * @version $Id: $Id + */ +public class FlowInducedVibrationAnalyser extends MeasurementDeviceBaseClass { + private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(WaterDewPointAnalyser.class); + + private double supportDistance = 3; + + private Boolean calcSupportArrangement = false; + + private String supportArrangement = "Stiff"; // Consult with a mechanical engineer regarding + // either the support distance or + // natural frequency of vibrations, especially if measurements have been taken + + private String method = "LOF"; // Likelihood of failure + private PipeBeggsAndBrills pipe; + private Boolean segmentSet = false; + private int segment; + private double FRMSConstant = 6.7; + + + /** + *+ * Constructor for WaterDewPointAnalyser. + *
+ * + * @param pipe a {@link neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills} + * object + */ + public FlowInducedVibrationAnalyser(PipeBeggsAndBrills pipe) { + this("Pipeline Flow Induced Vibration Analyzer", pipe); + } + + /** + *+ * Constructor for FlowInducedVibrationAnalyser. + *
+ * + * @param name Name of FlowInducedVibrationAnalyser + * @param pipe a {@link neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills} + * object + */ + public FlowInducedVibrationAnalyser(String name, PipeBeggsAndBrills pipe) { + super(name, "pipe"); + this.pipe = pipe; + } + + /** {@inheritDoc} */ + @Override + public void displayResult() { + try { + } finally { + } + } + + /** {@inheritDoc} */ + @Override + public double getMeasuredValue(String unit) { + if (!segmentSet) { + segment = pipe.getNumberOfIncrements(); + } + double mixDensity = pipe.getSegmentMixtureDensity(segment); + double mixVelocity = pipe.getSegmentMixtureSuperficialVelocity(segment); + double gasVelocity = pipe.getSegmentGasSuperficialVelocity(segment); + double GVF = gasVelocity / mixVelocity; + if (method.equals("LOF")) { + double FVF = 1.0; + if (GVF > 0.88) { + if (GVF > 0.99) { + FVF = Math.sqrt(pipe.getSegmentMixtureViscosity(segment) / Math.sqrt(0.001)); + } else { + FVF = -27.882 * GVF * GVF + 45.545 * GVF - 17.495; + } + } + double externalDiamater = (pipe.getDiameter() + 2 * pipe.getThickness()) * 1000;// mm + double alpha = 0.0; + double betta = 0.0; + if (supportArrangement == "Stiff") { + alpha = 446187 + 646 * externalDiamater + + 9.17E-4 * externalDiamater * externalDiamater * externalDiamater; + betta = 0.1 * Math.log(externalDiamater) - 1.3739; + } else if (supportArrangement == "Medium stiff") { + alpha = 283921 + 370 * externalDiamater; + betta = 0.1106 * Math.log(externalDiamater) - 1.501; + } else if (supportArrangement == "Medium") { + alpha = 150412 + 209 * externalDiamater; + betta = 0.0815 * Math.log(externalDiamater) - 1.3269; + } else { + alpha = 41.21 * Math.log(externalDiamater) + 49397; + betta = 0.0815 * Math.log(externalDiamater) - 1.3842; + } + double diameterOverThickness = externalDiamater / (1000 * pipe.getThickness()); + double Fv = alpha * Math.pow(diameterOverThickness, betta); + double LOF = mixDensity * mixVelocity * mixVelocity * FVF / Fv; + return LOF; + } else if (method == "FRMS") { + if (GVF < 0.8) { + return GVF; + } else { + return 1 + 5 * (1 - GVF) * Math.pow(pipe.getDiameter(), 1.6) * FRMSConstant + * Math.pow(pipe.getSegmentLiquidDensity(segment), 0.6) * Math.pow(mixVelocity, 1.2); + } + } + return Double.NaN; + } + + + /** + *
+ * Getter for the field method
.
+ *
+ * Setter for the field method
.
+ *
+ * Setter for the field segment
.
+ *
+ * Setter for the support arrangement supportArrangement
.
+ *
+ * Setter for the support distance .
+ *
pipeSpecification
.
*
*
- * @param nominalDiameter a double
+ * @param nominalDiameter a double in inch
* @param pipeSec a {@link java.lang.String} object
*/
public void setPipeSpecification(double nominalDiameter, String pipeSec) {
- pipeSpecification = pipeSec;
- insideDiameter = nominalDiameter / 1000.0;
+ this.pipeSpecification = pipeSec;
+ this.nominalDiameter = nominalDiameter;
+ this.PipeSpecSet = true;
+
+ neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase();
+ java.sql.ResultSet dataSet =
+ database.getResultSet("SELECT * FROM pipedata where Size='" + nominalDiameter + "'");
+ try {
+ if (dataSet.next()) {
+ this.pipeThickness = Double.parseDouble(dataSet.getString(pipeSpecification)) / 1000;
+ this.insideDiameter =
+ (Double.parseDouble(dataSet.getString("OD"))) / 1000 - 2 * this.pipeThickness;
+ }
+ } catch (NumberFormatException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
}
/** {@inheritDoc} */
@@ -228,6 +256,30 @@ public void setDiameter(double diameter) {
insideDiameter = diameter;
}
+ /**
+ * + * setThickness. + *
+ * + * @param pipeThickness the thickness to set + */ + public void setThickness(double pipeThickness) { + this.pipeThickness = pipeThickness; + } + + + /** + *+ * getThickness. + *
+ * + */ + public double getThickness() { + return this.pipeThickness; + } + + + /** *
* Setter for the field
+ * Adjuster class.
+ *
+ * Constructor for FlowRateAdjuster.
+ *
+ * Constructor for FlowRateAdjuster.
+ *
+ * setAdjustedVariable.
+ *
+ * setAdjustedVariable.
+ *
@@ -25,7 +28,7 @@ public class RachfordRice {
* @throws neqsim.util.exception.IsNaNException if any.
* @throws neqsim.util.exception.TooManyIterationsException if any.
*/
- public static double calcBeta(double[] K, double[] z) throws neqsim.util.exception.IsNaNException,
+ public double calcBeta(double[] K, double[] z) throws neqsim.util.exception.IsNaNException,
neqsim.util.exception.TooManyIterationsException {
int i;
@@ -138,6 +141,8 @@ public static double calcBeta(double[] K, double[] z) throws neqsim.util.excepti
} else if (nybeta >= 1.0 - tolerance) {
nybeta = 1.0 - tolerance;
}
+ beta[0] = nybeta;
+ beta[1] = 1.0 - nybeta;
if (iterations >= maxIterations) {
throw new neqsim.util.exception.TooManyIterationsException(new RachfordRice(), "calcBeta",
@@ -159,8 +164,7 @@ public static double calcBeta(double[] K, double[] z) throws neqsim.util.excepti
* @throws neqsim.util.exception.IsNaNException if any.
* @throws neqsim.util.exception.TooManyIterationsException if any.
*/
- public static double calcBeta2(double[] K, double[] z)
- throws neqsim.util.exception.IsNaNException,
+ public double calcBeta2(double[] K, double[] z) throws neqsim.util.exception.IsNaNException,
neqsim.util.exception.TooManyIterationsException {
double tolerance = neqsim.thermo.ThermodynamicModelSettings.phaseFractionMinimumLimit;
@@ -269,6 +273,9 @@ public static double calcBeta2(double[] K, double[] z)
V = 1.0 - tolerance;
}
+ beta[0] = V;
+ beta[1] = 1.0 - V;
+
if (iter >= maxIterations) {
throw new neqsim.util.exception.TooManyIterationsException(new RachfordRice(), "calcBeta",
maxIterations);
@@ -280,4 +287,8 @@ public static double calcBeta2(double[] K, double[] z)
return V;
}
+ public double[] getBeta() {
+ return beta;
+ }
+
}
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
index 8698b69238..3c53c63e27 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
@@ -90,8 +90,10 @@ public void sucsSubs() {
}
double oldBeta = system.getBeta();
+
+ RachfordRice rachfordRice = new RachfordRice();
try {
- system.setBeta(RachfordRice.calcBeta(system.getKvector(), system.getzvector()));
+ system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector()));
} catch (IsNaNException ex) {
logger.warn("Not able to calculate beta. Value is NaN");
system.setBeta(oldBeta);
@@ -132,13 +134,16 @@ public void accselerateSucsSubs() {
system.getPhase(1).getComponent(i).setK(Math.exp(lnK[i]));
}
double oldBeta = system.getBeta();
+ RachfordRice rachfordRice = new RachfordRice();
try {
- system.setBeta(RachfordRice.calcBeta(system.getKvector(), system.getzvector()));
+ system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector()));
} catch (Exception ex) {
+ system.setBeta(rachfordRice.getBeta()[0]);
if (system.getBeta() > 1.0 - betaTolerance || system.getBeta() < betaTolerance) {
system.setBeta(oldBeta);
}
- logger.info("temperature " + system.getTemperature() + " pressure " + system.getPressure());
+ // logger.info("temperature " + system.getTemperature() + " pressure " +
+ // system.getPressure());
logger.error(ex.getMessage(), ex);
}
@@ -178,7 +183,8 @@ public void resetK() {
system.getPhase(1).getComponents()[i].setK(Math.exp(lnK[i]));
}
try {
- system.setBeta(RachfordRice.calcBeta(system.getKvector(), system.getzvector()));
+ RachfordRice rachfordRice = new RachfordRice();
+ system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector()));
system.calc_x_y();
system.init(1);
} catch (Exception ex) {
@@ -249,7 +255,8 @@ public void run() {
// Calculates phase fractions and initial composition based on Wilson K-factors
try {
- system.setBeta(RachfordRice.calcBeta(system.getKvector(), system.getzvector()));
+ RachfordRice rachfordRice = new RachfordRice();
+ system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector()));
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java
index 4a4d3b4e38..6ec88b80a8 100644
--- a/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java
+++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java
@@ -11,7 +11,8 @@ void testCalcBeta() {
double[] K = new double[] {2.0, 0.01};
try {
- Assertions.assertEquals(0.407070707, RachfordRice.calcBeta(K, z), 1e-6);
+ RachfordRice rachfordRice = new RachfordRice();
+ Assertions.assertEquals(0.407070707, rachfordRice.calcBeta(K, z), 1e-6);
} catch (Exception e) {
e.printStackTrace();
}
@@ -25,7 +26,8 @@ void testCalcBetaMethod2() {
double[] K = new double[] {2.0, 0.01};
try {
- Assertions.assertEquals(0.407070707, RachfordRice.calcBeta(K, z), 1e-6);
+ RachfordRice rachfordRice = new RachfordRice();
+ Assertions.assertEquals(0.407070707, rachfordRice.calcBeta(K, z), 1e-6);
} catch (Exception e) {
e.printStackTrace();
}
From 984f484c9e1df1454f915c737be8dee1cb5877ce Mon Sep 17 00:00:00 2001
From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com>
Date: Fri, 21 Jun 2024 11:46:47 +0200
Subject: [PATCH 221/317] fix: but with str units (#1028)
---
.../measurementDevice/FlowInducedVibrationAnalyser.java | 8 ++++----
.../measurementDevice/simpleFlowRegime/Pipe.java | 4 ++--
.../processEquipment/util/FlowRateAdjuster.java | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/FlowInducedVibrationAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/FlowInducedVibrationAnalyser.java
index 7ec4c2da87..3c87028c0d 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/FlowInducedVibrationAnalyser.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/FlowInducedVibrationAnalyser.java
@@ -87,14 +87,14 @@ public double getMeasuredValue(String unit) {
double externalDiamater = (pipe.getDiameter() + 2 * pipe.getThickness()) * 1000;// mm
double alpha = 0.0;
double betta = 0.0;
- if (supportArrangement == "Stiff") {
+ if (supportArrangement.equals("Stiff")) {
alpha = 446187 + 646 * externalDiamater
+ 9.17E-4 * externalDiamater * externalDiamater * externalDiamater;
betta = 0.1 * Math.log(externalDiamater) - 1.3739;
- } else if (supportArrangement == "Medium stiff") {
+ } else if (supportArrangement.equals("Medium stiff")) {
alpha = 283921 + 370 * externalDiamater;
betta = 0.1106 * Math.log(externalDiamater) - 1.501;
- } else if (supportArrangement == "Medium") {
+ } else if (supportArrangement.equals("Medium")) {
alpha = 150412 + 209 * externalDiamater;
betta = 0.0815 * Math.log(externalDiamater) - 1.3269;
} else {
@@ -105,7 +105,7 @@ public double getMeasuredValue(String unit) {
double Fv = alpha * Math.pow(diameterOverThickness, betta);
double LOF = mixDensity * mixVelocity * mixVelocity * FVF / Fv;
return LOF;
- } else if (method == "FRMS") {
+ } else if (method.equals("FRMS")) {
if (GVF < 0.8) {
return GVF;
} else {
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java
index b797fb517b..f6e2abdcd0 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/Pipe.java
@@ -157,9 +157,9 @@ public void setAngle(double angle) {
* @return a double
*/
public double getAngle(String unit) {
- if (unit == "Degree") {
+ if (unit.equals("Degree")) {
return this.angle;
- } else if (unit == "Radian") {
+ } else if (unit.equals("Radian")) {
return this.angle * pi / 180;
}
return this.angle;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java
index d018a3fa5f..0a27953ed0 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java
@@ -137,7 +137,7 @@ public void run(UUID id) {
waterStream.setTemperature(temperature, "C");
waterStream.setPressure(pressure, "bara");
- if (unit == "Sm3/hr") {
+ if (unit.equals("Sm3/hr")) {
gasStream.setFlowRate(desiredGasFlow, unit);
oilStream.setFlowRate(desiredOilFlow * oilDensity, "kg/hr");
waterStream.setFlowRate(desiredWaterFlow * waterDensity, "kg/hr");
From 098761f7f303373ebbfc22ac44fdb6ef68e5033f Mon Sep 17 00:00:00 2001
From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com>
Date: Fri, 21 Jun 2024 16:12:46 +0200
Subject: [PATCH 222/317] fix: bug with Oil Test increase (#1032)
---
.../neqsim/thermodynamicOperations/flashOps/RachfordRice.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/RachfordRice.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/RachfordRice.java
index 75fca6f7f4..208a794a66 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/RachfordRice.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/RachfordRice.java
@@ -135,7 +135,7 @@ public double calcBeta(double[] K, double[] z) throws neqsim.util.exception.IsNa
nybeta = 1.0 - betal;
}
step = gbeta / deriv;
- } while (Math.abs(step) >= 1.0e-10 && iterations < maxIterations);
+ } while (Math.abs(step) >= 1.5e-10 && iterations < maxIterations);
if (nybeta <= tolerance) {
nybeta = tolerance;
} else if (nybeta >= 1.0 - tolerance) {
From 987979d798267f17a165431b3379cf7028b52582 Mon Sep 17 00:00:00 2001
From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com>
Date: Fri, 21 Jun 2024 16:13:05 +0200
Subject: [PATCH 223/317] fix: flow induced vibrations (#1031)
---
.../util/FlowRateAdjuster.java | 34 +++++++-----------
.../FLowInducedVibrationTest.java | 35 ++++---------------
2 files changed, 18 insertions(+), 51 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java
index 0a27953ed0..aec7f663ab 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java
@@ -3,8 +3,8 @@
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
+import neqsim.processSimulation.processEquipment.TwoPortEquipment;
import neqsim.processSimulation.processEquipment.mixer.Mixer;
import neqsim.processSimulation.processEquipment.mixer.StaticMixer;
import neqsim.processSimulation.processEquipment.stream.Stream;
@@ -20,12 +20,11 @@
* @author Even Solbraa
* @version $Id: $Id
*/
-public class FlowRateAdjuster extends ProcessEquipmentBaseClass {
+public class FlowRateAdjuster extends TwoPortEquipment {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(Adjuster.class);
- StreamInterface adjustedStream;
- StreamInterface outletStream;
+ String name = "Flow Rate Adjuster";
public double desiredGasFlow;
public double desiredOilFlow;
@@ -61,7 +60,7 @@ public class FlowRateAdjuster extends ProcessEquipmentBaseClass {
*/
@Deprecated
public FlowRateAdjuster() {
- this("FlowRateAdjuster");
+ this("Flow Rate Adjuster");
}
/**
@@ -75,14 +74,8 @@ public FlowRateAdjuster(String name) {
super(name);
}
- /**
- *
- * setAdjustedVariable.
- *
* Returns the density of the phase. Unit: kg/m^3
- *
* calcBeta. For gas liquid systems. Method based on Avoiding round-off error in the Rachford–Rice
@@ -291,4 +295,159 @@ public double[] getBeta() {
return beta;
}
+
+
+ /** {@inheritDoc} */
+ public final double calcBetaS(SystemInterface system) throws neqsim.util.exception.IsNaNException,
+ neqsim.util.exception.TooManyIterationsException {
+ ComponentInterface[] compArray = system.getPhase(0).getComponents();
+
+ int i;
+ double tolerance = neqsim.thermo.ThermodynamicModelSettings.phaseFractionMinimumLimit;
+ double midler = 0;
+ double minBeta = tolerance;
+ double maxBeta = 1.0 - tolerance;
+ double g0 = -1.0;
+ double g1 = 1.0;
+
+ for (i = 0; i < system.getNumberOfComponents(); i++) {
+ midler = (compArray[i].getK() * compArray[i].getz() - 1.0) / (compArray[i].getK() - 1.0);
+ if ((midler > minBeta) && (compArray[i].getK() > 1.0)) {
+ minBeta = midler;
+ }
+ midler = (1.0 - compArray[i].getz()) / (1.0 - compArray[i].getK());
+ if ((midler < maxBeta) && (compArray[i].getK() < 1.0)) {
+ maxBeta = midler;
+ }
+ g0 += compArray[i].getz() * compArray[i].getK();
+ g1 += -compArray[i].getz() / compArray[i].getK();
+ }
+
+ if (g0 < 0) {
+ this.beta[1] = 1.0 - tolerance;
+ this.beta[0] = tolerance;
+ return this.beta[0];
+ }
+ if (g1 > 0) {
+ this.beta[1] = tolerance;
+ this.beta[0] = 1.0 - tolerance;
+ return this.beta[0];
+ }
+
+ double nybeta = (minBeta + maxBeta) / 2.0;
+
+ double gtest = 0.0;
+ for (i = 0; i < system.getNumberOfComponents(); i++) {
+ gtest += compArray[i].getz() * (compArray[i].getK() - 1.0)
+ / (1.0 - nybeta + nybeta * compArray[i].getK());
+ }
+
+ if (gtest >= 0) {
+ minBeta = nybeta;
+ } else {
+ maxBeta = nybeta;
+ }
+
+ if (gtest < 0) {
+ double minold = minBeta;
+ minBeta = 1.0 - maxBeta;
+ maxBeta = 1.0 - minold;
+ }
+
+ int iterations = 0;
+ int maxIterations = 300;
+ double step = 1.0;
+ double deriv = 0.0;
+ double gbeta = 0.0;
+ double betal = 1.0 - nybeta;
+
+ do {
+ iterations++;
+ if (gtest >= 0) {
+ deriv = 0.0;
+ gbeta = 0.0;
+
+ for (i = 0; i < system.getNumberOfComponents(); i++) {
+ double temp1 = (compArray[i].getK() - 1.0);
+ double temp2 = 1.0 + temp1 * nybeta;
+ deriv += -(compArray[i].getz() * temp1 * temp1) / (temp2 * temp2);
+ gbeta += compArray[i].getz() * (compArray[i].getK() - 1.0)
+ / (1.0 + (compArray[i].getK() - 1.0) * nybeta);
+ }
+
+ if (gbeta >= 0) {
+ minBeta = nybeta;
+ } else {
+ maxBeta = nybeta;
+ }
+ nybeta -= (gbeta / deriv);
+
+ if (nybeta > maxBeta) {
+ nybeta = maxBeta;
+ }
+ if (nybeta < minBeta) {
+ nybeta = minBeta;
+ }
+
+ } else {
+ deriv = 0.0;
+ gbeta = 0.0;
+
+ for (i = 0; i < system.getNumberOfComponents(); i++) {
+ deriv -= (compArray[i].getz() * (compArray[i].getK() - 1.0) * (1.0 - compArray[i].getK()))
+ / Math.pow((betal + (1 - betal) * compArray[i].getK()), 2);
+ gbeta += compArray[i].getz() * (compArray[i].getK() - 1.0)
+ / (betal + (-betal + 1.0) * compArray[i].getK());
+ }
+
+ if (gbeta < 0) {
+ minBeta = betal;
+ } else {
+ maxBeta = betal;
+ }
+
+ betal -= (gbeta / deriv);
+
+ if (betal > maxBeta) {
+ betal = maxBeta;
+ }
+ if (betal < minBeta) {
+ betal = minBeta;
+ }
+
+ nybeta = 1.0 - betal;
+ }
+ step = gbeta / deriv;
+ } while (Math.abs(step) >= 1.0e-10 && iterations < maxIterations); // &&
+
+ if (nybeta <= tolerance) {
+ // this.phase = 1;
+ nybeta = tolerance;
+ } else if (nybeta >= 1.0 - tolerance) {
+ // this.phase = 0;
+ nybeta = 1.0 - tolerance;
+ // superheated vapour
+ } else {
+ // this.phase = 2;
+ } // two-phase liquid-gas
+
+ this.beta[0] = nybeta;
+ this.beta[1] = 1.0 - nybeta;
+
+ if (iterations >= maxIterations) {
+ throw new neqsim.util.exception.TooManyIterationsException(this, "calcBeta", maxIterations);
+ }
+ if (Double.isNaN(beta[1])) {
+ /*
+ * for (i = 0; i < numberOfComponents; i++) { System.out.println("K " + compArray[i].getK());
+ * System.out.println("z " + compArray[i].getz()); }
+ */
+ throw new neqsim.util.exception.IsNaNException(this, "calcBeta", "beta");
+ }
+ return this.beta[0];
+ }
+
+
}
+
+
diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
index 3c53c63e27..9c2dfe83ca 100644
--- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
+++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java
@@ -93,7 +93,8 @@ public void sucsSubs() {
RachfordRice rachfordRice = new RachfordRice();
try {
- system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector()));
+ system.setBeta(rachfordRice.calcBetaS(system));
+ //system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector()));
} catch (IsNaNException ex) {
logger.warn("Not able to calculate beta. Value is NaN");
system.setBeta(oldBeta);
diff --git a/src/test/java/neqsim/processSimulation/processSystem/OilProcessTest.java b/src/test/java/neqsim/processSimulation/processSystem/OilProcessTest.java
new file mode 100644
index 0000000000..a4df4b5e1c
--- /dev/null
+++ b/src/test/java/neqsim/processSimulation/processSystem/OilProcessTest.java
@@ -0,0 +1,29 @@
+package neqsim.processSimulation.processSystem;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.junit.jupiter.api.BeforeEach;
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.security.AnyTypePermission;
+
+/**
+ * Test class for GlycolRig.
+ */
+public class OilProcessTest extends neqsim.NeqSimTest {
+ static Logger logger = LogManager.getLogger(OilProcessTest.class);
+
+ ProcessSystem p;
+ String _name = "TestProcess";
+
+ @BeforeEach
+ public void setUp() {
+ p = new ProcessSystem();
+ p.setName(_name);
+ }
+
+
+}
From 31d6d6eed9230514fc69eaa2b693479f009cc222 Mon Sep 17 00:00:00 2001
From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com>
Date: Mon, 1 Jul 2024 11:54:33 +0200
Subject: [PATCH 229/317] version 2.5.28 (#1038)
---
pom.xml | 2 +-
pomJava21.xml | 2 +-
pomJava8.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0ab4ea397f..66a9ac4b38 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
+ * setMolarMass.
+ *
* calcActivity.
@@ -768,6 +779,16 @@ public default void addMolesChemReac(double dn) {
*/
public void setTC(double val);
+ /**
+ *
+ * setTC.
+ *
* setPC.
@@ -777,6 +798,16 @@ public default void addMolesChemReac(double dn) {
*/
public void setPC(double val);
+ /**
+ *
+ * setPC.
+ *
* getDiElectricConstantdTdT.
@@ -1212,6 +1243,14 @@ public default double getLogFugacityCoefficient() {
*/
public double getMolarMass();
+ /**
+ * Get molar mass of component.
+ *
+ * @param unit a String
+ * @return molar mass in unit kg/mol
+ */
+ public double getMolarMass(String unit);
+
/**
*
* getLennardJonesMolecularDiameter.
diff --git a/src/main/java/neqsim/thermo/system/neqsim_Units.code-search b/src/main/java/neqsim/thermo/system/neqsim_Units.code-search
deleted file mode 100644
index 9efddee9b3..0000000000
--- a/src/main/java/neqsim/thermo/system/neqsim_Units.code-search
+++ /dev/null
@@ -1,82 +0,0 @@
-# Query: neqsim.Units
-# ContextLines: 1
-
-26 results - 1 file
-
-src/main/java/neqsim/thermo/system/SystemThermo.java:
- 1635 table[getPhases()[0].getNumberOfComponents() + 9][1] = nf
- 1636: .format(getEnthalpy(neqsim.Units.getSymbol("enthalpy")), buf, test)
- 1637 .toString();
-
- 1639 table[getPhases()[0].getNumberOfComponents() + 10][1] = nf
- 1640: .format(getEntropy(neqsim.Units.getSymbol("entropy")), buf, test)
- 1641 .toString();
-
- 1653 table[getPhases()[0].getNumberOfComponents() + 2][i + 2] = nf
- 1654: .format(getPhase(i).getDensity(neqsim.Units.activeUnits.get("density").symbol), buf, test)
- 1655 .toString();
- 1656: table[getPhases()[0].getNumberOfComponents() + 2][6] = neqsim.Units.activeUnits.get("density").symbol;
- 1657
-
- 1666 table[getPhases()[0].getNumberOfComponents() + 4][i + 2] = nf
- 1667: .format(getPhase(i).getMolarMass(neqsim.Units.activeUnits.get("Molar Mass").symbol), buf, test)
- 1668 .toString();
- 1669: table[getPhases()[0].getNumberOfComponents() + 4][6] = neqsim.Units.activeUnits.get("Molar Mass").symbol;
- 1670
-
- 1678 table[getPhases()[0].getNumberOfComponents() + 6][i + 2] = nf.format(
- 1679: (getPhase(i).getCp(neqsim.Units.activeUnits.get("Heat Capacity (Cp)").symbol)),
- 1680 buf, test).toString();
- 1681: table[getPhases()[0].getNumberOfComponents() + 6][6] = neqsim.Units.activeUnits.get("Heat Capacity (Cp)").symbol;
- 1682
-
- 1685 table[getPhases()[0].getNumberOfComponents() + 7][i + 2] = nf.format(
- 1686: (getPhase(i).getCv(neqsim.Units.activeUnits.get("Heat Capacity (Cv)").symbol)),
- 1687 buf, test).toString();
- 1688: table[getPhases()[0].getNumberOfComponents() + 7][6] = neqsim.Units.activeUnits.get("Heat Capacity (Cv)").symbol;
- 1689
-
- 1692 table[getPhases()[0].getNumberOfComponents() + 8][i + 2] = nf
- 1693: .format((getPhase(i).getSoundSpeed(neqsim.Units.getSymbol("speed of sound"))), buf, test)
- 1694 .toString();
- 1695: table[getPhases()[0].getNumberOfComponents() + 8][6] = neqsim.Units.getSymbol("speed of sound");
- 1696
-
- 1699 table[getPhases()[0].getNumberOfComponents() + 9][i + 2] = nf
- 1700: .format((getPhase(i).getEnthalpy(neqsim.Units.getSymbol("enthalpy"))), buf, test)
- 1701 .toString();
- 1702: table[getPhases()[0].getNumberOfComponents() + 9][6] = neqsim.Units.getSymbol("enthalpy");
- 1703
-
- 1706 table[getPhases()[0].getNumberOfComponents() + 10][i + 2] = nf
- 1707: .format((getPhase(i).getEntropy(neqsim.Units.getSymbol("entropy"))), buf, test)
- 1708 .toString();
- 1709: table[getPhases()[0].getNumberOfComponents() + 10][6] = neqsim.Units.getSymbol("entropy");
- 1710
-
- 1713 table[getPhases()[0].getNumberOfComponents() + 11][i + 2] = nf
- 1714: .format((getPhase(i).getJouleThomsonCoefficient(neqsim.Units.getSymbol("JT coefficient"))), buf, test)
- 1715 .toString();
- 1716: table[getPhases()[0].getNumberOfComponents() + 11][6] = neqsim.Units.getSymbol("JT coefficient");
- 1717
-
- 1720 table[getPhases()[0].getNumberOfComponents() + 13][i + 2] = nf
- 1721: .format((getPhase(i).getViscosity(neqsim.Units.getSymbol("viscosity"))), buf, test).toString();
- 1722: table[getPhases()[0].getNumberOfComponents() + 13][6] = neqsim.Units.getSymbol("viscosity");
- 1723
-
- 1726 table[getPhases()[0].getNumberOfComponents() + 14][i + 2] = nf
- 1727: .format(getPhase(i).getThermalConductivity(neqsim.Units.getSymbol("thermal concdutivity")), buf, test)
- 1728 .toString();
- 1729: table[getPhases()[0].getNumberOfComponents() + 14][6] = neqsim.Units.getSymbol("thermal concdutivity");
- 1730
-
- 1766 table[getPhases()[0].getNumberOfComponents() + 19][i + 2] = Double
- 1767: .toString(getPhase(i).getPressure(neqsim.Units.getSymbol("pressure")));
- 1768: table[getPhases()[0].getNumberOfComponents() + 19][6] = neqsim.Units.getSymbol("pressure");
- 1769
-
- 1772 table[getPhases()[0].getNumberOfComponents() + 20][i + 2] = Double
- 1773: .toString(getPhase(i).getTemperature(neqsim.Units.getSymbol("temperature")));
- 1774: table[getPhases()[0].getNumberOfComponents() + 20][6] = neqsim.Units.getSymbol("temperature");
- 1775 Double.toString(getPhase(i).getTemperature());
diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java
index f3b487f6bc..9312ae3579 100644
--- a/src/test/java/neqsim/thermo/component/NewComponentTest.java
+++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java
@@ -67,4 +67,32 @@ public void newComponentIsoButeneTest() {
thermoSystem.init(0);
assertEquals(56.10632e-3, thermoSystem.getMolarMass("kg/mol"), 0.01);
}
+
+ @Test
+ public void setTCPC_test() {
+ thermoSystem = new SystemSrkEos(298.0, ThermodynamicConstantsInterface.referencePressure);
+ thermoSystem.addComponent("iso-butene", 1.0);
+ thermoSystem.init(0);
+ thermoSystem.getPhase(0).getComponent(0).setTC(190.0);
+ assertEquals(190.0, thermoSystem.getPhase(0).getComponent(0).getTC(), 0.01);
+
+ thermoSystem.getPhase(0).getComponent(0).setTC(190.0, "R");
+ assertEquals(190.0, thermoSystem.getPhase(0).getComponent(0).getTC("R"), 0.01);
+
+ thermoSystem.getPhase(0).getComponent(0).setTC(190.0, "R");
+ assertEquals(105.55555, thermoSystem.getPhase(0).getComponent(0).getTC("K"), 0.01);
+
+ thermoSystem.getPhase(0).getComponent(0).setPC(1290.0, "psia");
+ assertEquals(1290.0, thermoSystem.getPhase(0).getComponent(0).getPC("psia"), 0.01);
+ assertEquals(88.9423690, thermoSystem.getPhase(0).getComponent(0).getPC("bara"), 0.01);
+
+ thermoSystem.getPhase(0).getComponent(0).setMolarMass(0.090);
+ assertEquals(0.09, thermoSystem.getPhase(0).getComponent(0).getMolarMass(), 0.01);
+ assertEquals(90.0, thermoSystem.getPhase(0).getComponent(0).getMolarMass("gr/mol"), 0.01);
+ assertEquals(90.0, thermoSystem.getPhase(0).getComponent(0).getMolarMass("lbm/lbmol"), 0.01);
+
+ thermoSystem.getPhase(0).getComponent(0).setMolarMass(85.0, "lbm/lbmol");
+ assertEquals(85.0, thermoSystem.getPhase(0).getComponent(0).getMolarMass("gr/mol"), 0.01);
+
+ }
}
From 8e983c08e343d73fd4791a67a35ff709981d2584 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Mon, 8 Jul 2024 12:15:44 +0200
Subject: [PATCH 232/317] Update Splitter.java (#1043)
* Update Splitter.java
get split factor values
* Update Splitter.java
---
.../processEquipment/splitter/Splitter.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
index 1e22ac0478..41843ac5a1 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
@@ -264,6 +264,14 @@ public void runTransient(double dt, UUID id) {
}
}
+ public double getSplitFactor(int i){
+ return splitFactor[i];
+ }
+
+ public double[] getSplitFactors(){
+ return splitFactor;
+ }
+
/** {@inheritDoc} */
@Override
public void displayResult() {}
From 5b99a1542b1385709a071edad62b1537f3e793ac Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Mon, 8 Jul 2024 12:16:00 +0200
Subject: [PATCH 233/317] remove unhandeled runtime exception (#1042)
* remove unhandeled runtime exception
* added possibility to chenge method used in Rachford RIce
* update
* Update PhaseEos.java
---
.../java/neqsim/thermo/phase/PhaseEos.java | 36 +++++++-------
.../flashOps/RachfordRice.java | 48 ++++++++++++++-----
.../flashOps/RachfordRiceTest.java | 9 ++++
3 files changed, 63 insertions(+), 30 deletions(-)
diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java
index 9bac2f1fb6..c189ae82e1 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java
@@ -109,6 +109,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType
}
} catch (Exception ex) {
logger.warn("Failed to solve for molarVolume within the iteration limit.");
+ logger.error(ex.getMessage());
throw new RuntimeException(ex);
// logger.error("too many iterations in volume calc!", ex);
// logger.info("moles " + numberOfMolesInPhase);
@@ -191,21 +192,20 @@ public void resetMixingRule(int type) {
* molarVolume2.
* angle
.
@@ -586,24 +638,30 @@ public double calcFrictionPressureLoss() {
+ (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
muNoSlip = mixtureLiquidViscosity * inputVolumeFractionLiquid
+ (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
+ liquidDensityProfile.add(mixtureLiquidDensity * 16.01846);
+ } else {
+ rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3")) * inputVolumeFractionLiquid
+ + (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
+ muNoSlip = system.getPhase(1).getViscosity("cP") * inputVolumeFractionLiquid
+ + (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
+ liquidDensityProfile.add((system.getPhase(1).getDensity("lb/ft3")) * 16.01846);
}
- rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3")) * inputVolumeFractionLiquid
- + (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
- muNoSlip = system.getPhase(1).getViscosity("cP") * inputVolumeFractionLiquid
- + (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
} else {
rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3")) * inputVolumeFractionLiquid
+ (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
muNoSlip = system.getPhase(1).getViscosity("cP") * inputVolumeFractionLiquid
+ (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
+ liquidDensityProfile.add((system.getPhase(1).getDensity("lb/ft3")) * 16.01846);
}
} else {
if (system.hasPhaseType("gas")) {
rhoNoSlip = (system.getPhase(0).getDensity("lb/ft3"));
muNoSlip = (system.getPhase(0).getViscosity("cP"));
+ liquidDensityProfile.add(0.0);
} else {
rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3"));
muNoSlip = (system.getPhase(1).getViscosity("cP"));
+ liquidDensityProfile.add(rhoNoSlip * 16.01846);
}
}
@@ -648,6 +706,7 @@ public double calcPressureDrop() {
/** {@inheritDoc} */
@Override
public void run(UUID id) {
+
iteration = 0;
pressureProfile = new ArrayList<>();
@@ -662,6 +721,7 @@ public void run(UUID id) {
mixtureViscosityProfile = new ArrayList<>();
mixtureDensityProfile = new ArrayList<>();
+ liquidDensityProfile = new ArrayList<>();
liquidHoldupProfile = new ArrayList<>();
mixtureReynoldsNumber = new ArrayList<>();
@@ -965,6 +1025,12 @@ public List
* calcBeta. For gas liquid systems. *
* - * Method based on Michelsen Mollerup, 2001 + * Method used is defined in method String variable * * @return Beta Mole fraction of gas phase * @throws neqsim.util.exception.IsNaNException if any. @@ -32,6 +41,29 @@ public class RachfordRice implements Serializable { */ public double calcBeta(double[] K, double[] z) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { + if (method.equals("Michelsen2001")) { + return calcBetaMichelsen2001(K, z); + } else if (method.equals("Nielsen2023")) { + return calcBetaNielsen2023(K, z); + } else { + return calcBetaMichelsen2001(K, z); + } + } + + /** + *+ * calcBeta. For gas liquid systems. + *
+ * + * Method based on Michelsen Mollerup, 2001 + * + * @return Beta Mole fraction of gas phase + * @throws neqsim.util.exception.IsNaNException if any. + * @throws neqsim.util.exception.TooManyIterationsException if any. + */ + public double calcBetaMichelsen2001(double[] K, double[] z) + throws neqsim.util.exception.IsNaNException, + neqsim.util.exception.TooManyIterationsException { int i; double tolerance = neqsim.thermo.ThermodynamicModelSettings.phaseFractionMinimumLimit; @@ -156,19 +188,18 @@ public double calcBeta(double[] K, double[] z) throws neqsim.util.exception.IsNa return nybeta; } - - /** *- * calcBeta. For gas liquid systems. Method based on Avoiding round-off error in the Rachford–Rice - * equation, Nielsen, Lia, 2023 + * calcBetaNielsen2023. For gas liquid systems. Method based on Avoiding round-off error in the + * Rachford–Rice equation, Nielsen, Lia, 2023 *
* * @return Beta Mole fraction of gas phase * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ - public double calcBeta2(double[] K, double[] z) throws neqsim.util.exception.IsNaNException, + public double calcBetaNielsen2023(double[] K, double[] z) + throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { double tolerance = neqsim.thermo.ThermodynamicModelSettings.phaseFractionMinimumLimit; @@ -295,8 +326,6 @@ public double[] getBeta() { return beta; } - - /** {@inheritDoc} */ public final double calcBetaS(SystemInterface system) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { @@ -447,7 +476,4 @@ public final double calcBetaS(SystemInterface system) throws neqsim.util.excepti return this.beta[0]; } - } - - diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java index 6ec88b80a8..132e29b31a 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/RachfordRiceTest.java @@ -17,6 +17,15 @@ void testCalcBeta() { e.printStackTrace(); } + try { + RachfordRice rachfordRice = new RachfordRice(); + rachfordRice.setMethod("Nielsen2023"); + Assertions.assertEquals(0.407070707, rachfordRice.calcBeta(K, z), 1e-6); + rachfordRice.setMethod("Michelsen2001"); + } catch (Exception e) { + e.printStackTrace(); + } + } @Test From 579e8c14fe2f2a8e1e452e0cf114f31d20b34630 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:16:18 +0200 Subject: [PATCH 234/317] add vol correction test (#1041) --- .../thermo/component/NewComponentTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java index 9312ae3579..bf88df7738 100644 --- a/src/test/java/neqsim/thermo/component/NewComponentTest.java +++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java @@ -7,6 +7,7 @@ import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseSrkEos; import neqsim.thermo.system.SystemInterface; +import neqsim.thermo.system.SystemPrEos; import neqsim.thermo.system.SystemSrkEos; public class NewComponentTest extends neqsim.NeqSimTest { @@ -95,4 +96,24 @@ public void setTCPC_test() { assertEquals(85.0, thermoSystem.getPhase(0).getComponent(0).getMolarMass("gr/mol"), 0.01); } + + @Test + public void volTransTtest() { + thermoSystem = new SystemPrEos(318.0, 20.01325); + thermoSystem.addComponent("CO2", 1.0); + thermoSystem.init(0); + thermoSystem.init(1); + thermoSystem.initPhysicalProperties("density"); + assertEquals(36.68212551, thermoSystem.getDensity("kg/m3"), 0.01); + + thermoSystem.getComponent("CO2").setVolumeCorrectionT(0.2); + + thermoSystem.initPhysicalProperties("density"); + assertEquals(37.6425616, thermoSystem.getDensity("kg/m3"), 0.01); + + thermoSystem.getComponent("CO2").setRacketZ(0.3); + + thermoSystem.initPhysicalProperties("density"); + assertEquals(37.557573, thermoSystem.getDensity("kg/m3"), 0.01); + } } From b30c81564cf542590d92f13c11acc64ba13e5ad8 Mon Sep 17 00:00:00 2001 From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:26:27 +0200 Subject: [PATCH 235/317] feat: update flow rate adjuster (#1044) --- .../util/FlowRateAdjuster.java | 46 ++++++++++++++----- .../neqsim/thermo/component/Component.java | 20 +++++--- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java index e970c55785..a71f6c190f 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java @@ -52,6 +52,8 @@ public class FlowRateAdjuster extends TwoPortEquipment { int iterations = 0; private boolean activateWhenLess = false; + Stream waterStream; + double waterDensity; /** *@@ -92,6 +94,17 @@ public void setAdjustedFlowRates(Double desiredGasFlow, Double desiredOilFlow, this.unit = unit; } + /** + *
+ * setAdjustedVariable. + *
+ * + */ + public void setAdjustedFlowRates(Double desiredGasFlow, Double desiredOilFlow, String unit){ + this.setAdjustedFlowRates(desiredGasFlow, desiredOilFlow, + 0.0, unit); + } + /** {@inheritDoc} */ @Override public void run(UUID id) { @@ -105,18 +118,25 @@ public void run(UUID id) { SystemInterface gasFluid = adjustedFluid.phaseToSystem("gas").clone(); SystemInterface oilFluid = adjustedFluid.phaseToSystem("oil").clone(); - SystemInterface waterFluid = adjustedFluid.phaseToSystem("aqueous").clone(); + double temperature = inStream.getTemperature("C"); + double pressure = inStream.getPressure("bara"); + if (desiredWaterFlow > 0.0){ + SystemInterface waterFluid = adjustedFluid.phaseToSystem("aqueous").clone(); + waterFluid.initPhysicalProperties(); + waterDensity = waterFluid.getDensity("kg/m3"); + + waterStream = new Stream("Water Stream", waterFluid); + waterStream.setTemperature(temperature, "C"); + waterStream.setPressure(pressure, "bara"); + + } gasFluid.initPhysicalProperties(); oilFluid.initPhysicalProperties(); - waterFluid.initPhysicalProperties(); - double oilDensity = oilFluid.getDensity("kg/m3"); - double waterDensity = waterFluid.getDensity("kg/m3"); - double temperature = inStream.getTemperature("C"); - double pressure = inStream.getPressure("bara"); + double oilDensity = oilFluid.getDensity("kg/m3"); Stream gasStream = new Stream("Gas Stream", gasFluid); gasStream.setTemperature(temperature, "C"); @@ -126,27 +146,31 @@ public void run(UUID id) { oilStream.setTemperature(temperature, "C"); oilStream.setPressure(pressure, "bara"); - Stream waterStream = new Stream("Water Stream", waterFluid); - waterStream.setTemperature(temperature, "C"); - waterStream.setPressure(pressure, "bara"); - if (unit.equals("Sm3/hr")) { gasStream.setFlowRate(desiredGasFlow, unit); oilStream.setFlowRate(desiredOilFlow * oilDensity, "kg/hr"); - waterStream.setFlowRate(desiredWaterFlow * waterDensity, "kg/hr"); + if (desiredWaterFlow > 0.0){ + waterStream.setFlowRate(desiredWaterFlow * waterDensity, "kg/hr"); + } } else { gasStream.setFlowRate(desiredGasFlow, unit); oilStream.setFlowRate(desiredOilFlow, unit); + if (desiredWaterFlow > 0.0){ waterStream.setFlowRate(desiredWaterFlow, unit); + } } gasStream.run(); oilStream.run(); + if (desiredWaterFlow > 0.0){ waterStream.run(); + } Mixer wellStramMixer = new StaticMixer("Stream mixer"); wellStramMixer.addStream(gasStream); wellStramMixer.addStream(oilStream); + if (desiredWaterFlow > 0.0){ wellStramMixer.addStream(waterStream); + } wellStramMixer.run(); outStream.setThermoSystem(wellStramMixer.getOutletStream().getFluid()); diff --git a/src/main/java/neqsim/thermo/component/Component.java b/src/main/java/neqsim/thermo/component/Component.java index 20f54e329f..2ff33ace06 100644 --- a/src/main/java/neqsim/thermo/component/Component.java +++ b/src/main/java/neqsim/thermo/component/Component.java @@ -499,13 +499,19 @@ public Component clone() { @Override public void addMolesChemReac(double dn, double totdn) { if (numberOfMoles + totdn < 0 || numberOfMolesInPhase + dn < 0) { - String msg = "will lead to negative number of moles of component in phase for component " - + getComponentName() + " who has " + numberOfMolesInPhase - + " in phase and chage request was " + dn; - neqsim.util.exception.InvalidInputException ex = - new neqsim.util.exception.InvalidInputException(this, "addMolesChemReac", "dn", msg); - throw new RuntimeException(ex); - // logger.error(ex.getMessage()); + if (Math.abs(dn) < 1e-12){ + dn = 0; + totdn = 0; + } + else{ + String msg = "will lead to negative number of moles of component in phase for component " + + getComponentName() + " who has " + numberOfMolesInPhase + + " in phase and chage request was " + dn; + neqsim.util.exception.InvalidInputException ex = + new neqsim.util.exception.InvalidInputException(this, "addMolesChemReac", "dn", msg); + throw new RuntimeException(ex); + // logger.error(ex.getMessage()); + } } numberOfMoles += totdn; numberOfMolesInPhase += dn; From 59c7b1095d82d6a23614ac76d8e92e1a5f43cfb5 Mon Sep 17 00:00:00 2001 From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:31:06 +0200 Subject: [PATCH 236/317] fix: flow rate adjuster phases (#1045) --- .../processEquipment/util/FlowRateAdjuster.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java index a71f6c190f..0d64157944 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/util/FlowRateAdjuster.java @@ -116,14 +116,14 @@ public void run(UUID id) { logger.error(ex.getMessage(), ex); } - SystemInterface gasFluid = adjustedFluid.phaseToSystem("gas").clone(); - SystemInterface oilFluid = adjustedFluid.phaseToSystem("oil").clone(); + SystemInterface gasFluid = adjustedFluid.phaseToSystem(0).clone(); + SystemInterface oilFluid = adjustedFluid.phaseToSystem(1).clone(); double temperature = inStream.getTemperature("C"); double pressure = inStream.getPressure("bara"); if (desiredWaterFlow > 0.0){ - SystemInterface waterFluid = adjustedFluid.phaseToSystem("aqueous").clone(); + SystemInterface waterFluid = adjustedFluid.phaseToSystem(2).clone(); waterFluid.initPhysicalProperties(); waterDensity = waterFluid.getDensity("kg/m3"); From 9857eb8e5724c5fe2272efd0192110a76c07430c Mon Sep 17 00:00:00 2001 From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:54:04 +0200 Subject: [PATCH 237/317] 2.5.29 (#1046) --- pom.xml | 2 +- pomJava21.xml | 2 +- pomJava8.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 66a9ac4b38..ad6d146904 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@@@ -179,6 +182,268 @@ && getOutletPressure() == getOutletStream().getPressure()) { } } + /** + * Adjusts the flow coefficient (Cv) based on the percentage valve opening. + * + * @param Cv Flow coefficient in US gallons per minute (USG/min). + * @param percentValveOpening Percentage valve opening (0 to 100). + * @return Adjusted flow coefficient (Cv) in US gallons per minute (USG/min). + */ + private static double adjustCv(double Cv, double percentValveOpening) { + return Cv * (percentValveOpening / 100); + } + + /** + * Calculates the mass flow rate through a control valve for a liquid based on the given + * parameters. + * + * @param P1 Upstream pressure in bar. + * @param P2 Downstream pressure in bar. + * @param rho Density of the fluid in kilograms per cubic meter (kg/m³). + * @param Cv Flow coefficient in US gallons per minute (USG/min). + * @param Fp Piping geometry factor (dimensionless). + * @param percentValveOpening Percentage valve opening (0 to 100). + * @return Mass flow rate in kilograms per hour (kg/h). + */ + public static double liquidValveMassFlow(double P1, double P2, double rho, double Cv, double Fp, + double percentValveOpening) { + // Equation unit conversion constant + final double N1 = 0.0865; + + // Convert pressures from bar to Pascals directly in the code + double P1Pa = P1 * 100000; + double P2Pa = P2 * 100000; + + // Adjust Cv based on the percentage valve opening + double adjustedCv = adjustCv(Cv, percentValveOpening); + + // Clip Cv value to be non-negative + double clippedCv = Math.max(adjustedCv, 0); + // Calculate pressure difference and clip to be non-negative + double deltaP = Math.max(P1Pa - P2Pa, 0); + // Calculate mass flow rate + double massFlowRate = clippedCv * N1 * Fp * Math.sqrt(deltaP * rho); + + return massFlowRate; + } + + /** + * Calculates the percent valve opening given the mass flow rate through a valve, upstream + * pressure (P1), downstream pressure (P2), fluid density (rho), flow coefficient (Cv), and piping + * geometry factor (Fp). + * + * @param massFlowRate The mass flow rate through the valve in kg/hr. + * @param P1 The upstream pressure in bar. + * @param P2 The downstream pressure in bar. + * @param rho The density of the fluid in kilograms per cubic meter (kg/m³). + * @param Cv The flow coefficient of the valve in US gallons per minute (USG/min). + * @param Fp The piping geometry factor (dimensionless). + * @return The percent valve opening. + */ + public static double calcPercentValveOpeningLiquid(double massFlowRate, double P1, double P2, + double rho, double Cv, double Fp) { + // Equation unit conversion constant + final double N1 = 0.0865; + + // Convert pressures from bar to Pascals directly in the code + double P1Pa = P1 * 100000; + double P2Pa = P2 * 100000; + + // Calculate pressure difference and clip to be non-negative + double deltaP = Math.max(P1Pa - P2Pa, 0); + + // Calculate the denominator part of the equation + double denominator = Cv * N1 * Fp * Math.sqrt(deltaP * rho); + + // Calculate percent valve opening + double percentValveOpening = (massFlowRate / denominator) * 100; + + return percentValveOpening; + } + + /** + * Calculates the downstream pressure (P2) through a control valve for a liquid based on the given + * parameters. + * + * @param P1 Upstream pressure in bar. + * @param m Mass flow rate in kilograms per hour (kg/h). + * @param rho Density of the fluid in kilograms per cubic meter (kg/m³). + * @param Cv Flow coefficient in US gallons per minute (USG/min). + * @param Fp Piping geometry factor (dimensionless). + * @param percentValveOpening Percentage valve opening (0 to 100). + * @return Downstream pressure in bar. + */ + public static double liquidValvePout(double P1, double m, double rho, double Cv, double Fp, + double percentValveOpening) { + // Equation unit conversion constant + final double N1 = 0.0865; + + // Convert upstream pressure from bar to Pascals directly in the code + double P1Pa = P1 * 100000; + + // Adjust Cv based on the percentage valve opening + double adjustedCv = adjustCv(Cv, percentValveOpening); + + // Clip Cv value to be non-negative + double clippedCv = Math.max(adjustedCv, 0); + // Calculate deltaP from mass flow rate + double deltaP = Math.pow(m / (clippedCv * N1 * Fp), 2) / rho; + // Calculate downstream pressure + double P2Pa = P1Pa - deltaP; + + // Ensure downstream pressure is non-negative + P2Pa = Math.max(P2Pa, 0); + + // Convert downstream pressure from Pascals to bar directly in the code + return P2Pa / 100000; + } + + /** + * Calculates the flow coefficient (Cv) of a control valve for a liquid based on the given + * parameters. + * + * @param P1 Upstream pressure in bar. + * @param P2 Downstream pressure in bar. + * @param rho Density of the fluid in kilograms per cubic meter (kg/m³). + * @param m Mass flow rate in kilograms per hour (kg/h). + * @param Fp Piping geometry factor (dimensionless). + * @param percentValveOpening Percentage valve opening (0 to 100). + * @return Flow coefficient (Cv) in US gallons per minute (USG/min). + */ + public static double liquidValveCv(double P1, double P2, double rho, double m, double Fp, + double percentValveOpening) { + // Equation unit conversion constant + final double N1 = 0.0865; + + // Convert pressures from bar to Pascals directly in the code + double P1Pa = P1 * 100000; + double P2Pa = P2 * 100000; + + // Calculate pressure difference and clip to be non-negative + double deltaP = Math.max(P1Pa - P2Pa, 0); + // Calculate flow coefficient + double Cv = m / (N1 * Fp * Math.sqrt(deltaP * rho)); + + // Adjust Cv based on the percentage valve opening + return Cv / (percentValveOpening / 100); + } + + + + /** + * Calculates the mass flow rate through a valve given the upstream pressure (Pus), downstream + * pressure (Pds), fluid density (rhous), and flow coefficient (Cv). + * + * The calculation is based on the formula for mass flow through a valve. + * + * @param Pus The upstream pressure (Pus) in bara. + * @param Pds The downstream pressure (Pds) in bara. + * @param rhous The density of the fluid upstream of the valve in kg/m^3. + * @param Cv The flow coefficient of the valve. + * @param percentValveOpening Opening of valve in % + * @return The mass flow rate through the valve in kg/hr. + */ + public double calcmassflow(double Pus, double Pds, double rhous, double Cv, + double percentValveOpening) { + + // Sine of 3417 / 30.0 + double sineFactor = Math.sin(3417 / 30.0); + + // Calculate the mass flow rate + double massFlowRate = 0.0457 * Math.sqrt(Pus * 100.0 * rhous) * sineFactor + * Math.sqrt((Pus - Pds) / Pus) * Cv * percentValveOpening / 100.0; + return massFlowRate; + } + + /** + * Calculates the downstream pressure (Pds) of a valve given the upstream pressure (Pus), fluid + * density (rhous), flow coefficient (Cv), mass flow rate, and the percent valve opening. + * + * The calculation is based on the formula for mass flow through a valve, rearranged to solve for + * Pds. + * + * @param Pus The upstream pressure (Pus) in bara. + * @param rhous The density of the fluid upstream of the valve in kg/m^3. + * @param Cv The flow coefficient of the valve. + * @param massFlowRate The mass flow rate through the valve in kg/hr. + * @param percentValveOpening Opening of valve in % + * @return The downstream pressure (Pds) in bara. + */ + public double calcValvePout(double Pus, double rhous, double Cv, double massFlowRate, + double percentValveOpening) { + // Sine of 3417 / 30.0 + double sineFactor = Math.sin(3417 / 30.0); + + // Calculate the term that involves the mass flow rate, Cv, and percent valve opening + double flowTerm = (massFlowRate / (0.0457 * Math.sqrt(Pus * 100.0 * rhous) * sineFactor * Cv + * (percentValveOpening / 100.0))); + + // Square the flowTerm to eliminate the square root + double flowTermSquared = flowTerm * flowTerm; + + // Calculate Pds + double Pds = Pus * (1 - flowTermSquared); + + return Pds; + } + + + /** + * Calculates the flow coefficient (Cv) of a valve given the upstream pressure (Pus), downstream + * pressure (Pds), fluid density (rhous), mass flow rate, and the percent valve opening. + * + * The calculation is based on the formula for mass flow through a valve, rearranged to solve for + * Cv. + * + * @param Pus The upstream pressure (Pus) in bara. + * @param Pds The downstream pressure (Pds) in bara. + * @param rhous The density of the fluid upstream of the valve in kg/m^3. + * @param massFlowRate The mass flow rate through the valve in kg/hr. + * @param percentValveOpening Opening of valve in % + * @return The flow coefficient (Cv) of the valve. + */ + public double calcCv(double Pus, double Pds, double rhous, double massFlowRate, + double percentValveOpening) { + // Sine of 3417 / 30.0 + double sineFactor = Math.sin(3417 / 30.0); + + // Calculate Cv + double Cv = massFlowRate / (0.0457 * Math.sqrt(Pus * 100.0 * rhous) * sineFactor + * Math.sqrt((Pus - Pds) / Pus) * percentValveOpening / 100.0); + + return Cv; + } + + /** + * Calculates the percent valve opening given the upstream pressure (Pus), downstream pressure + * (Pds), fluid density (rhous), flow coefficient (Cv), and mass flow rate. + * + * The calculation is based on the formula for mass flow through a valve, rearranged to solve for + * percent valve opening. + * + * @param Pus The upstream pressure (Pus) in bara. + * @param Pds The downstream pressure (Pds) in bara. + * @param rhous The density of the fluid upstream of the valve in kg/m^3. + * @param Cv The flow coefficient of the valve. + * @param massFlowRate The mass flow rate through the valve in kg/hr. + * @return The percent valve opening. + */ + public double calcPercentValveOpening(double Pus, double Pds, double rhous, double Cv, + double massFlowRate) { + // Sine of 3417 / 30.0 + double sineFactor = Math.sin(3417 / 30.0); + + // Calculate the term that involves the mass flow rate, Pus, rhous, and Cv + double term = massFlowRate / (0.0457 * Math.sqrt(Pus * 100 * rhous) * sineFactor * Cv); + + // Calculate the percent valve opening + double percentValveOpening = term / Math.sqrt(1 - (Pds / Pus)) * 100.0; + + return percentValveOpening; + } + + + /** {@inheritDoc} */ @Override public void run(UUID id) { @@ -188,11 +453,26 @@ public void run(UUID id) { ThermodynamicOperations thermoOps = new ThermodynamicOperations(thermoSystem); thermoSystem.init(3); double enthalpy = thermoSystem.getEnthalpy(); + inStream.getThermoSystem().initPhysicalProperties("density"); + double outp = 0.0; + + if (inStream.getThermoSystem().hasPhaseType(PhaseType.GAS) + && inStream.getThermoSystem().getVolumeFraction(0) > 0.9) { + setGasValve(true); + } else { + setGasValve(false); + } if (valveCvSet && isCalcPressure) { - double outp = (inStream.getThermoSystem().getPressure() - - Math.pow(inStream.getThermoSystem().getTotalNumberOfMoles() / Cv - / getPercentValveOpening() * 100.0, 2.0) * thermoSystem.getDensity()); + if (gasValve) { + outp = calcValvePout(inStream.getThermoSystem().getPressure(), + inStream.getThermoSystem().getDensity("kg/m3"), Cv, inStream.getFlowRate("kg/hr"), + percentValveOpening); + } else { + outp = + liquidValvePout(inStream.getThermoSystem().getPressure(), inStream.getFlowRate("kg/hr"), + inStream.getThermoSystem().getDensity("kg/m3"), Cv, Fp, percentValveOpening); + } setOutletPressure(outp); } @@ -225,22 +505,38 @@ public void run(UUID id) { // If valve CV is not set, calculate it from inletstream flow, percent opening // and // differential pressure over valve. - Cv = inStream.getThermoSystem().getTotalNumberOfMoles() / (getPercentValveOpening() / 100.0 - * Math.sqrt( - (inStream.getThermoSystem().getPressure() - outStream.getThermoSystem().getPressure()) - / thermoSystem.getDensity())); + if (gasValve) { + Cv = calcCv(inStream.getThermoSystem().getPressure(), + outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), + inStream.getFlowRate("kg/hr"), percentValveOpening); + } else { + Cv = liquidValveCv(inStream.getThermoSystem().getPressure(), + outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), + inStream.getFlowRate("kg/hr"), Fp, percentValveOpening); + } valveCvSet = true; } + if (gasValve) { + percentValveOpening = calcPercentValveOpening(inStream.getThermoSystem().getPressure(), + outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), Cv, + inStream.getFlowRate("kg/hr")); - percentValveOpening = inStream.getThermoSystem().getTotalNumberOfMoles() / (getCv()) * 100.0 - / Math.sqrt( - (inStream.getThermoSystem().getPressure() - outStream.getThermoSystem().getPressure()) - / thermoSystem.getDensity()); + } else { + percentValveOpening = calcPercentValveOpeningLiquid(inStream.getFlowRate("kg/hr"), + inStream.getThermoSystem().getPressure(), outStream.getThermoSystem().getPressure(), + inStream.getFluid().getDensity("kg/m3"), Cv, Fp); + } + + if (gasValve) { + molarFlow = calcmassflow(inStream.getThermoSystem().getPressure(), + outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), Cv, + percentValveOpening) / 3600.0 / inStream.getFluid().getMolarMass("kg/mol"); + } else { + molarFlow = liquidValveMassFlow(inStream.getThermoSystem().getPressure(), + outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), Cv, + Fp, percentValveOpening) / 3600.0 / inStream.getFluid().getMolarMass("kg/mol"); + } - molarFlow = getCv() * getPercentValveOpening() / 100.0 - * Math.sqrt( - (inStream.getThermoSystem().getPressure() - outStream.getThermoSystem().getPressure()) - / thermoSystem.getDensity()); if (Math.abs(pressure - inStream.getThermoSystem().getPressure()) < 1e-6) { molarFlow = inStream.getThermoSystem().getTotalNumberOfMoles(); } @@ -256,10 +552,6 @@ public void run(UUID id) { outStream.setThermoSystem(thermoSystem.clone()); outStream.getThermoSystem().setTotalNumberOfMoles(molarFlow); outStream.getThermoSystem().init(3); - // outStream.run(id); - // Cv = - // inletStream.getThermoSystem().getTotalNumberOfMoles()/Math.sqrt(inletStream.getPressure()-outStream.getPressure()); - // molarFlow = inletStream.getThermoSystem().getTotalNumberOfMoles(); outStream.setCalculationIdentifier(id); setCalculationIdentifier(id); } @@ -301,11 +593,16 @@ public void runTransient(double dt, UUID id) { } thermoSystem.initPhysicalProperties("density"); outStream.setThermoSystem(thermoSystem); - // if(getPercentValveOpening()<99){ - molarFlow = getCv() * getPercentValveOpening() / 100.0 - * Math.sqrt( - (inStream.getThermoSystem().getPressure() - outStream.getThermoSystem().getPressure()) - / thermoSystem.getDensity()); + + if (gasValve) { + molarFlow = calcmassflow(inStream.getThermoSystem().getPressure(), + outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), Cv, + percentValveOpening) / 3600.0 / inStream.getFluid().getMolarMass("kg/mol"); + } else { + molarFlow = liquidValveMassFlow(inStream.getThermoSystem().getPressure(), + outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), Cv, + Fp, percentValveOpening) / 3600.0 / inStream.getFluid().getMolarMass("kg/mol"); + } try { inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow); @@ -321,12 +618,6 @@ public void runTransient(double dt, UUID id) { } catch (Exception e) { logger.error(e.getMessage()); } - // System.out.println("delta p valve " + - // (inletStream.getThermoSystem().getPressure() - - // outStream.getThermoSystem().getPressure())); - // System.out.println("total molar flow out " + molarFlow); - // System.out.println("Total volume flow " + - // outStream.getThermoSystem().getVolume()); setCalculationIdentifier(id); } @@ -363,6 +654,16 @@ public double getCv() { return Cv; } + /** {@inheritDoc} */ + @Override + public double getCv(String unit) { + if (unit.equals("US")) { + return Cv / 54.9; + } else { + return Cv; + } + } + /** {@inheritDoc} */ @Override public void setCv(double cv) { @@ -370,6 +671,18 @@ public void setCv(double cv) { valveCvSet = true; } + /** {@inheritDoc} */ + @Override + public void setCv(double cv, String unit) { + if (unit.equals("US")) { + this.Cv = cv * 54.9; + } else { + this.Cv = cv; + } + valveCvSet = true; + } + + /** {@inheritDoc} */ @Override public double getPercentValveOpening() { @@ -480,4 +793,20 @@ public void setIsCalcOutPressure(boolean isSetPres) { public String toJson() { return new GsonBuilder().create().toJson(new ValveResponse(this)); } + + public boolean isGasValve() { + return gasValve; + } + + public void setGasValve(boolean gasValve) { + this.gasValve = gasValve; + } + + public double getFp() { + return Fp; + } + + public void setFp(double fp) { + Fp = fp; + } } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/valve/ValveInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/valve/ValveInterface.java index 21a4fd1ce2..11bc2c5396 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/valve/ValveInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/valve/ValveInterface.java @@ -64,6 +64,16 @@ public interface ValveInterface extends ProcessEquipmentInterface, TwoPortInterf */ public double getCv(); + /** + *
+ * getCv. + *
+ * + * @param unit can be SI or US SI is unit litre/minute US is gallons per minute + * @return a double + */ + public double getCv(String unit); + /** ** setCv. @@ -73,6 +83,16 @@ public interface ValveInterface extends ProcessEquipmentInterface, TwoPortInterf */ public void setCv(double Cv); + /** + *
+ * setCv. + *
+ * + * @param Cv a double + * @param unit can be SI or US SI is unit litre/minute US is gallons per minute + */ + public void setCv(double Cv, String unit); + /** {@inheritDoc} */ @Override public SystemInterface getThermoSystem(); diff --git a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java index 12a207557c..41f32bd08d 100644 --- a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java +++ b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java @@ -51,7 +51,7 @@ public void calculate() { TVP = this.thermoSystem.getPressure(); double liquidVolume = thermoSystem.getVolume(); - this.thermoSystem.setPressure(0.9); + this.thermoSystem.setPressure(TVP * 0.9); try { this.thermoOps.TVflash(liquidVolume * 4.0); } catch (Exception ex) { diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 8f6486903e..f570c4a78a 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -2105,6 +2105,9 @@ public double getFlowRate(String flowunit) { return totalNumberOfMoles * getMolarMass() * 3600.0 / getDensity("kg/m3"); } else if (flowunit.equals("idSm3/hr")) { return totalNumberOfMoles * getMolarMass() * 3600.0 / getIdealLiquidDensity("kg/m3"); + } else if (flowunit.equals("gallons/min")) { + initPhysicalProperties("density"); + return totalNumberOfMoles * getMolarMass() * 60.0 / getDensity("kg/m3") * 1000 / 3.78541178; } else if (flowunit.equals("Sm3/sec")) { return totalNumberOfMoles * ThermodynamicConstantsInterface.R * ThermodynamicConstantsInterface.standardStateTemperature @@ -4914,7 +4917,8 @@ public void setTotalFlowRate(double flowRate, String flowunit) { logger.error(e.getMessage()); } double density = 0.0; - if (flowunit.equals("Am3/hr") || flowunit.equals("Am3/min") || flowunit.equals("Am3/sec")) { + if (flowunit.equals("Am3/hr") || flowunit.equals("Am3/min") || flowunit.equals("gallons/min") + || flowunit.equals("Am3/sec")) { initPhysicalProperties("density"); } diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java index 60732baa32..83258ebf48 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java @@ -75,8 +75,10 @@ public double solveQ() { double oldPres = system.getPressure(); double nyPres = system.getPressure(); double iterations = 1; + double error = 100.0, errorOld = 1000.0; do { iterations++; + errorOld = error; oldPres = nyPres; system.init(3); nyPres = oldPres - (iterations) / (iterations + 10.0) * calcdQdV() / calcdQdVV(); @@ -88,9 +90,11 @@ public double solveQ() { } system.setPressure(nyPres); tpFlash.run(); - // System.out.println(" dQdv " + calcdQdV() + " new pressure " + nyPres + " error " + - // Math.abs((nyPres-oldPres)/(nyPres)) + " numberofphases "+system.getNumberOfPhases()); - } while (Math.abs((nyPres - oldPres) / (nyPres)) > 1e-9 && iterations < 1000 || iterations < 3); + // System.out.println(" dQdv " + calcdQdV() + " new pressure " + nyPres + " error " + // + Math.abs((nyPres - oldPres) / (nyPres)) + " numberofphases " + // + system.getNumberOfPhases()); + error = Math.abs(calcdQdV()); + } while (Math.abs(error) > 1e-9 && iterations < 200 && error < errorOld || iterations < 3); return nyPres; } diff --git a/src/main/java/neqsim/util/unit/RateUnit.java b/src/main/java/neqsim/util/unit/RateUnit.java index a0ebac47cb..88da94593c 100644 --- a/src/main/java/neqsim/util/unit/RateUnit.java +++ b/src/main/java/neqsim/util/unit/RateUnit.java @@ -103,6 +103,8 @@ public double getConversionFactor(String name) { factor = 1.0 / molarmass / 3600.0 * stddens; } else if (name.equals("idSm3/day")) { factor = 1.0 / molarmass / (3600.0 * 24.0) * stddens; + } else if (name.equals("gallons/min")) { + factor = 1.0 / molarmass / 60.0 * stddens / 10.0 * 3.78541178; } else { throw new RuntimeException( new InvalidInputException(this, "getConversionFactor", "unit", "not supported")); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValveTest.java b/src/test/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValveTest.java new file mode 100644 index 0000000000..f0d964279d --- /dev/null +++ b/src/test/java/neqsim/processSimulation/processEquipment/valve/ThrottlingValveTest.java @@ -0,0 +1,56 @@ +package neqsim.processSimulation.processEquipment.valve; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import neqsim.processSimulation.processEquipment.stream.Stream; + +public class ThrottlingValveTest { + @Test + void testCalcCvGas() { + neqsim.thermo.system.SystemInterface testSystem2 = + new neqsim.thermo.system.SystemSrkEos((273.15 + 25.0), 10.00); + testSystem2.addComponent("methane", 1.0); + testSystem2.setMixingRule(2); + + Stream stream1 = new Stream("Stream1", testSystem2); + stream1.setFlowRate(7000, "Sm3/hr"); + stream1.setPressure(10.0, "bara"); + stream1.setTemperature(55.0, "C"); + stream1.run(); + + ThrottlingValve valve1 = new ThrottlingValve("valve_1", stream1); + valve1.setOutletPressure(5.0); + valve1.setPercentValveOpening(100); + valve1.run(); + + assertEquals(48.2652, valve1.getCv("US"), 1e-2); + assertEquals(2649.7612, valve1.getCv("SI"), 1e-2); + + } + + @Test + void testCalcCvLiquid() { + neqsim.thermo.system.SystemInterface testSystem2 = + new neqsim.thermo.system.SystemSrkEos((273.15 + 25.0), 10.00); + testSystem2.addComponent("water", 1.0); + testSystem2.setMixingRule(2); + + Stream stream1 = new Stream("Stream1", testSystem2); + stream1.setFlowRate(100.0, "kg/hr"); + stream1.setPressure(100.0, "bara"); + stream1.setTemperature(55.0, "C"); + stream1.run(); + + ThrottlingValve valve1 = new ThrottlingValve("valve_1", stream1); + valve1.setOutletPressure(50.0); + valve1.setPercentValveOpening(100); + valve1.run(); + + assertEquals(0.4515327970, stream1.getFlowRate("gallons/min"), 1e-2); + assertEquals(0.0165567743765, valve1.getCv("SI"), 1e-2); + assertEquals(100.0, valve1.getPercentValveOpening(), 1e-2); + assertEquals(100, stream1.getFlowRate("kg/hr"), 1e-2); + assertEquals(3.015805897362369E-4, valve1.getCv("US"), 1e-2); + + } +} diff --git a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java index 3b297645a3..b600da8565 100644 --- a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java +++ b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java @@ -11,14 +11,34 @@ void testCalculate() { SystemInterface testSystem = new SystemSrkEos(273.15 + 2.0, 1.0); testSystem.addComponent("methane", 0.0006538); testSystem.addComponent("ethane", 0.006538); - testSystem.addComponent("propane", 0.006538); + testSystem.addComponent("propane", 0.06538); + testSystem.addComponent("n-pentane", 0.1545); + testSystem.addComponent("nC10", 0.545); + testSystem.setMixingRule(2); + testSystem.init(0); + Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem); + standard.setReferenceTemperature(37.8, "C"); + standard.calculate(); + Assertions.assertEquals(0.94552559993, standard.getValue("RVP", "bara"), 1e-3); + Assertions.assertEquals(1.666298367, standard.getValue("TVP", "bara"), 1e-3); + } + + @Test + void testCalculate2() { + SystemInterface testSystem = new SystemSrkEos(273.15 + 2.0, 1.0); + testSystem.addComponent("methane", 0.026538); + testSystem.addComponent("ethane", 0.16538); + testSystem.addComponent("propane", 0.26538); testSystem.addComponent("n-pentane", 0.545); + testSystem.addComponent("nC10", 0.545); + testSystem.addTBPfraction("C11", 0.545, 145.0 / 1000.0, 0.82); testSystem.setMixingRule(2); testSystem.init(0); + testSystem.setPressure(100.0); Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem); standard.setReferenceTemperature(37.8, "C"); standard.calculate(); - //Assertions.assertEquals(0.7298246193, standard.getValue("RVP", "bara"), 1e-3); - Assertions.assertEquals(1.8710732396722, standard.getValue("TVP", "bara"), 1e-3); + Assertions.assertEquals(3.017010, standard.getValue("RVP", "bara"), 1e-3); + Assertions.assertEquals(7.8448385024, standard.getValue("TVP", "bara"), 1e-3); } } From d62564ff3469e8f2fd9811d7408816e08c7f64e4 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Thu, 18 Jul 2024 23:38:03 +0200 Subject: [PATCH 239/317] Rvpupdate2 (#1049) * Cv method valves * added Cv for liquids * update formulaes * update * sstill something wrong here... * fixed error * update RVP calc * update 2 * update --- .../thermodynamicOperations/flashOps/TVflash.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java index 83258ebf48..0ace56583a 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java @@ -43,11 +43,13 @@ public TVflash(SystemInterface system, double Vspec) { * * @return a double */ - public double calcdQdVV() { + public double calcdQdVdP() { double dQdVV = 0.0; for (int i = 0; i < system.getNumberOfPhases(); i++) { - dQdVV += 1.0 / (system.getPhase(i).getVolume() / system.getVolume()) * 1.0 - / system.getPhase(i).getdPdVTn(); // *system.getPhase(i).getdVdP();system.getPhase(i).getVolume()/system.getVolume()* + dQdVV += 1.0 / system.getPhase(i).getdPdVTn(); + // dQdVV += 1.0 / (system.getPhase(i).getVolume() / system.getVolume()) * 1.0 + // / system.getPhase(i).getdPdVTn(); // + // *system.getPhase(i).getdVdP();system.getPhase(i).getVolume()/system.getVolume()* } return dQdVV; } @@ -81,7 +83,7 @@ public double solveQ() { errorOld = error; oldPres = nyPres; system.init(3); - nyPres = oldPres - (iterations) / (iterations + 10.0) * calcdQdV() / calcdQdVV(); + nyPres = oldPres - 1.0 / 10.0 * calcdQdV() / calcdQdVdP(); if (nyPres <= 0.0) { nyPres = oldPres / 2.0; } From ad6a647ade7d7e2c9fa4113f065c083c587bbea6 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Fri, 19 Jul 2024 08:25:47 +0200 Subject: [PATCH 240/317] improved TVflash (#1051) --- .../flashOps/TVflash.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java index 0ace56583a..95f7f9a646 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java @@ -38,20 +38,17 @@ public TVflash(SystemInterface system, double Vspec) { /** *- * calcdQdVV. + * calcdQdVP. *
* * @return a double */ public double calcdQdVdP() { - double dQdVV = 0.0; + double dQdVP = 0.0; for (int i = 0; i < system.getNumberOfPhases(); i++) { - dQdVV += 1.0 / system.getPhase(i).getdPdVTn(); - // dQdVV += 1.0 / (system.getPhase(i).getVolume() / system.getVolume()) * 1.0 - // / system.getPhase(i).getdPdVTn(); // - // *system.getPhase(i).getdVdP();system.getPhase(i).getVolume()/system.getVolume()* + dQdVP += 1.0 / system.getPhase(i).getdPdVTn(); } - return dQdVV; + return dQdVP; } /** @@ -77,26 +74,39 @@ public double solveQ() { double oldPres = system.getPressure(); double nyPres = system.getPressure(); double iterations = 1; - double error = 100.0, errorOld = 1000.0; + double error = 100.0; + double numericdQdVdP = 0.0; + double olddQdV = 0.0; + double pressureStep = 1.0; do { iterations++; - errorOld = error; oldPres = nyPres; system.init(3); - nyPres = oldPres - 1.0 / 10.0 * calcdQdV() / calcdQdVdP(); + + double dQDVdP = calcdQdVdP(); + numericdQdVdP = (calcdQdV() - olddQdV) / pressureStep; + + if (iterations < 5) { + nyPres = oldPres - 1.0 / 10.0 * calcdQdV() / dQDVdP; + } else { + nyPres = oldPres - calcdQdV() / numericdQdVdP; + } if (nyPres <= 0.0) { - nyPres = oldPres / 2.0; + nyPres = oldPres * 0.9; } if (nyPres >= oldPres * 2) { nyPres = oldPres * 2.0; } + pressureStep = nyPres - oldPres; + olddQdV = error; system.setPressure(nyPres); tpFlash.run(); + error = Math.abs(calcdQdV()); // System.out.println(" dQdv " + calcdQdV() + " new pressure " + nyPres + " error " // + Math.abs((nyPres - oldPres) / (nyPres)) + " numberofphases " - // + system.getNumberOfPhases()); - error = Math.abs(calcdQdV()); - } while (Math.abs(error) > 1e-9 && iterations < 200 && error < errorOld || iterations < 3); + // + system.getNumberOfPhases() + " dQDVdP " + dQDVdP + " dQDVdPnumeric" + numericdQdVdP); + + } while (Math.abs(error) > 1e-9 && iterations < 200 || iterations < 3); return nyPres; } From 68f85e07ab0c9b9627f336e8d4d31ffaaa591722 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Fri, 19 Jul 2024 09:24:02 +0200 Subject: [PATCH 241/317] Fix-failed-SimpleReservoirTest.testRun (#1052) * improved TVflash * fixed bug TVflash * Update TVflash.java --- .../flashOps/TVflash.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java index 95f7f9a646..af25a996a3 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVflash.java @@ -76,20 +76,22 @@ public double solveQ() { double iterations = 1; double error = 100.0; double numericdQdVdP = 0.0; + double dQdV = 0.0; double olddQdV = 0.0; double pressureStep = 1.0; do { + iterations++; oldPres = nyPres; system.init(3); - double dQDVdP = calcdQdVdP(); + numericdQdVdP = (calcdQdV() - olddQdV) / pressureStep; if (iterations < 5) { nyPres = oldPres - 1.0 / 10.0 * calcdQdV() / dQDVdP; } else { - nyPres = oldPres - calcdQdV() / numericdQdVdP; + nyPres = oldPres - 1.0 * calcdQdV() / numericdQdVdP; } if (nyPres <= 0.0) { nyPres = oldPres * 0.9; @@ -98,15 +100,17 @@ public double solveQ() { nyPres = oldPres * 2.0; } pressureStep = nyPres - oldPres; - olddQdV = error; + + olddQdV = calcdQdV(); system.setPressure(nyPres); tpFlash.run(); - error = Math.abs(calcdQdV()); - // System.out.println(" dQdv " + calcdQdV() + " new pressure " + nyPres + " error " - // + Math.abs((nyPres - oldPres) / (nyPres)) + " numberofphases " - // + system.getNumberOfPhases() + " dQDVdP " + dQDVdP + " dQDVdPnumeric" + numericdQdVdP); + error = Math.abs(calcdQdV()) / system.getVolume(); + // System.out.println("error " + error + "iteration " + iterations + " dQdv " + calcdQdV() + // + " new pressure " + nyPres + " error " + Math.abs((nyPres - oldPres) / (nyPres)) + // + " numberofphases " + system.getNumberOfPhases() + " dQDVdP " + dQDVdP + " dQDVdPnumeric" + // + numericdQdVdP); - } while (Math.abs(error) > 1e-9 && iterations < 200 || iterations < 3); + } while ((error > 1e-9 && iterations < 200) || iterations < 3); return nyPres; } From ad33f317c7c5fce3949ef3496205533207eea778 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Fri, 19 Jul 2024 09:05:59 +0000 Subject: [PATCH 242/317] RVP fix --- .../oilQuality/Standard_ASTM_D6377.java | 25 ++++ .../ThermodynamicOperations.java | 12 ++ .../flashOps/TVfractionFlash.java | 131 ++++++++++++++++++ .../oilQuality/Standard_ASTM_D6377Test.java | 4 +- 4 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 src/main/java/neqsim/thermodynamicOperations/flashOps/TVfractionFlash.java diff --git a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java index 41f32bd08d..547aaa4c11 100644 --- a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java +++ b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java @@ -48,6 +48,31 @@ public void calculate() { logger.error(ex.getMessage(), ex); } + TVP = this.thermoSystem.getPressure(); + + this.thermoSystem.setPressure(TVP * 0.9); + try { + // ASTM D323 -08 method is used for this property calculation. It is defined at the pressure + // at 100°F (37.8°C) at which 80% of the stream by volume is vapor at 100°F. In + this.thermoOps.TVfractionFlash(0.8); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + + RVP = this.thermoSystem.getPressure(); + } + + // old method for RVP + public void calculate2() { + this.thermoSystem.setTemperature(referenceTemperature, "C"); + this.thermoSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); + this.thermoOps = new ThermodynamicOperations(thermoSystem); + try { + this.thermoOps.bubblePointPressureFlash(false); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + } + TVP = this.thermoSystem.getPressure(); double liquidVolume = thermoSystem.getVolume(); diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java index 357538ccad..177ac80708 100644 --- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java +++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java @@ -576,6 +576,18 @@ public void TVflash(double Vspec) { getOperation().run(); } + /** + *+ * TVfractionFlash. + *
+ * + * @param Vspec a double volume fraction of first/lightest phase + */ + public void TVfractionFlash(double Vspec) { + operation = new neqsim.thermodynamicOperations.flashOps.TVfractionFlash(system, Vspec); + getOperation().run(); + } + /** ** PVrefluxFlash. diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/TVfractionFlash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVfractionFlash.java new file mode 100644 index 0000000000..40ca820ff5 --- /dev/null +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/TVfractionFlash.java @@ -0,0 +1,131 @@ +/* + * TVflash.java + * + * Created on 8. mars 2001, 10:56 + */ + +package neqsim.thermodynamicOperations.flashOps; + +import neqsim.thermo.system.SystemInterface; + +/** + *
+ * TVflash class. + *
+ * + * @author even solbraa + * @version $Id: $Id + */ +public class TVfractionFlash extends Flash { + private static final long serialVersionUID = 1000; + + double Vfractionspec = 0; + Flash tpFlash; + + /** + *+ * Constructor for TVflash. + *
+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param Vfractionspec a double + */ + public TVfractionFlash(SystemInterface system, double Vfractionspec) { + this.system = system; + this.tpFlash = new TPflash(system); + this.Vfractionspec = Vfractionspec; + } + + /** + *+ * calcdQdVP. + *
+ * + * @return a double + */ + public double calcdQdVdP() { + double dQdVP = 0.0; + dQdVP = 1.0 / system.getPhase(i).getdPdVTn() / system.getVolume(); + return dQdVP; + } + + /** + *+ * calcdQdV. + *
+ * + * @return a double + */ + public double calcdQdV() { + double dQ = system.getPhase(0).getVolume() / system.getVolume() - Vfractionspec; + return dQ; + } + + /** + *+ * solveQ. + *
+ * + * @return a double + */ + public double solveQ() { + double oldPres = system.getPressure(); + double nyPres = system.getPressure(); + double iterations = 1; + double error = 100.0; + double numericdQdVdP = 0.0; + double dQdV = 0.0; + double olddQdV = 0.0; + double pressureStep = 1.0; + do { + + iterations++; + oldPres = nyPres; + system.init(3); + double dQDVdP = calcdQdVdP(); + + numericdQdVdP = (calcdQdV() - olddQdV) / pressureStep; + + if (iterations < 5) { + nyPres = oldPres - 1.0 / 10.0 * calcdQdV() / dQDVdP; + } else { + nyPres = oldPres - 1.0 * calcdQdV() / numericdQdVdP; + } + if (nyPres <= 0.0) { + nyPres = oldPres * 0.9; + } + if (nyPres >= oldPres * 2) { + nyPres = oldPres * 2.0; + } + pressureStep = nyPres - oldPres; + + olddQdV = calcdQdV(); + system.setPressure(nyPres); + tpFlash.run(); + error = Math.abs(calcdQdV()) / system.getVolume(); + // System.out.println("error " + error + "iteration " + iterations + " dQdv " + calcdQdV() + // + " new pressure " + nyPres + " error " + Math.abs((nyPres - oldPres) / (nyPres)) + // + " numberofphases " + system.getNumberOfPhases() + " dQDVdP " + dQDVdP + " dQDVdPnumeric" + // + numericdQdVdP); + + } while ((error > 1e-9 && iterations < 200) || iterations < 3); + return nyPres; + } + + /** {@inheritDoc} */ + @Override + public void run() { + tpFlash.run(); + // System.out.println("enthalpy: " + system.getEnthalpy()); + solveQ(); + + // System.out.println("volume: " + system.getVolume()); + // System.out.println("Temperature: " + system.getTemperature()); + } + + /** {@inheritDoc} */ + @Override + public org.jfree.chart.JFreeChart getJFreeChart(String name) { + return null; + } +} diff --git a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java index b600da8565..c5673924ed 100644 --- a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java +++ b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java @@ -19,7 +19,7 @@ void testCalculate() { Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem); standard.setReferenceTemperature(37.8, "C"); standard.calculate(); - Assertions.assertEquals(0.94552559993, standard.getValue("RVP", "bara"), 1e-3); + Assertions.assertEquals(1.10455465, standard.getValue("RVP", "bara"), 1e-3); Assertions.assertEquals(1.666298367, standard.getValue("TVP", "bara"), 1e-3); } @@ -38,7 +38,7 @@ void testCalculate2() { Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem); standard.setReferenceTemperature(37.8, "C"); standard.calculate(); - Assertions.assertEquals(3.017010, standard.getValue("RVP", "bara"), 1e-3); + Assertions.assertEquals(3.604002003478, standard.getValue("RVP", "bara"), 1e-3); Assertions.assertEquals(7.8448385024, standard.getValue("TVP", "bara"), 1e-3); } } From a25cc6a75a9261f207f848ce6a414451490b9e19 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sat, 20 Jul 2024 00:49:48 +0200 Subject: [PATCH 243/317] added more methods (#1053) --- .../oilQuality/Standard_ASTM_D6377.java | 107 ++++++++++++++---- .../oilQuality/Standard_ASTM_D6377Test.java | 7 ++ 2 files changed, 92 insertions(+), 22 deletions(-) diff --git a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java index 547aaa4c11..d86fe27203 100644 --- a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java +++ b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java @@ -24,6 +24,49 @@ public class Standard_ASTM_D6377 extends neqsim.standards.Standard { double TVP = 1.0; double referenceTemperature = 37.8; String referenceTemperatureUnit = "C"; + String methodRVP = "VPCR4"; // RVP_ASTM_D6377 // RVP_ASTM_D323_73_79 // + // RVP_ASTM_D323_82 // VPCR4_no_water // VPCR4 + + private double VPCR4_no_water = 0.0; + private double VPCR4 = 0.0; + private double RVP_ASTM_D6377 = 0.0; + private double RVP_ASTM_D323_73_79 = 0.0; + private double RVP_ASTM_D323_82 = 0.0; + + /** + * Gets the method used for measuring Reid Vapor Pressure (RVP). + * + * The method can be one of the following: + *
@@ -59,31 +102,24 @@ public void calculate() {
logger.error(ex.getMessage(), ex);
}
- RVP = this.thermoSystem.getPressure();
- }
+ VPCR4 = this.thermoSystem.getPressure();
+ RVP_ASTM_D6377 = 0.834 * VPCR4;
+ RVP_ASTM_D323_82 = (0.752 * (100.0 * this.thermoSystem.getPressure()) + 6.07) / 100.0;
- // old method for RVP
- public void calculate2() {
- this.thermoSystem.setTemperature(referenceTemperature, "C");
- this.thermoSystem.setPressure(ThermodynamicConstantsInterface.referencePressure);
- this.thermoOps = new ThermodynamicOperations(thermoSystem);
- try {
- this.thermoOps.bubblePointPressureFlash(false);
- } catch (Exception ex) {
- logger.error(ex.getMessage(), ex);
+ SystemInterface fluid1 = this.thermoSystem.clone();
+ if (fluid1.hasComponent("water")) {
+ fluid1.removeComponent("water");
+ fluid1.init(0);
}
-
- TVP = this.thermoSystem.getPressure();
- double liquidVolume = thermoSystem.getVolume();
-
- this.thermoSystem.setPressure(TVP * 0.9);
try {
- this.thermoOps.TVflash(liquidVolume * 4.0);
+ // ASTM D323 -08 method is used for this property calculation. It is defined at the pressure
+ // at 100°F (37.8°C) at which 80% of the stream by volume is vapor at 100°F. In
+ this.thermoOps.TVfractionFlash(0.8);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
-
- RVP = (0.752 * (100.0 * this.thermoSystem.getPressure()) + 6.07) / 100.0;
+ VPCR4_no_water = this.thermoSystem.getPressure();
+ RVP_ASTM_D323_73_79 = VPCR4_no_water;
}
/** {@inheritDoc} */
@@ -102,11 +138,14 @@ public String getUnit(String returnParameter) {
@Override
public double getValue(String returnParameter, java.lang.String returnUnit) {
if (returnParameter == "RVP") {
- neqsim.util.unit.PressureUnit presConversion = new neqsim.util.unit.PressureUnit(RVP, "bara");
+ double RVPlocal = getValue("RVP");
+ neqsim.util.unit.PressureUnit presConversion =
+ new neqsim.util.unit.PressureUnit(RVPlocal, "bara");
return presConversion.getValue(returnUnit);
}
if (returnParameter == "TVP") {
- neqsim.util.unit.PressureUnit presConversion = new neqsim.util.unit.PressureUnit(TVP, "bara");
+ neqsim.util.unit.PressureUnit presConversion =
+ new neqsim.util.unit.PressureUnit(getValue("TVP"), "bara");
return presConversion.getValue(returnUnit);
} else {
return RVP;
@@ -116,7 +155,27 @@ public double getValue(String returnParameter, java.lang.String returnUnit) {
/** {@inheritDoc} */
@Override
public double getValue(String returnParameter) {
- return RVP;
+ if (returnParameter.equals("RVP")) {
+ switch (methodRVP) {
+ case "RVP_ASTM_D6377":
+ return RVP_ASTM_D6377;
+ case "RVP_ASTM_D323_73_79":
+ return RVP_ASTM_D323_73_79;
+ case "VPCR4":
+ return VPCR4;
+ case "RVP_ASTM_D323_82":
+ return RVP_ASTM_D323_82;
+ case "VPCR4_no_water":
+ return VPCR4_no_water;
+ default:
+ return VPCR4;
+ }
+ } else if (returnParameter.equals("TVP")) {
+ return TVP;
+ } else {
+ logger.error("returnParameter not supported.. " + returnParameter);
+ return 0.0;
+ }
}
/**
@@ -146,10 +205,14 @@ public static void main(String args[]) {
testSystem.addComponent("ethane", 0.006538);
testSystem.addComponent("propane", 0.006538);
testSystem.addComponent("n-pentane", 0.545);
+ testSystem.addComponent("water", 0.00545);
testSystem.setMixingRule(2);
testSystem.init(0);
Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem);
standard.calculate();
System.out.println("RVP " + standard.getValue("RVP", "bara"));
+ standard.setMethodRVP("RVP_ASTM_D323_73_79");
+ standard.calculate();
+ System.out.println("RVP_ASTM_D323_73_79 " + standard.getValue("RVP", "bara"));
}
}
diff --git a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
index c5673924ed..fff91d0133 100644
--- a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
+++ b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java
@@ -36,9 +36,16 @@ void testCalculate2() {
testSystem.init(0);
testSystem.setPressure(100.0);
Standard_ASTM_D6377 standard = new Standard_ASTM_D6377(testSystem);
+ standard.setMethodRVP("VPCR4");
standard.setReferenceTemperature(37.8, "C");
standard.calculate();
Assertions.assertEquals(3.604002003478, standard.getValue("RVP", "bara"), 1e-3);
Assertions.assertEquals(7.8448385024, standard.getValue("TVP", "bara"), 1e-3);
+
+ standard.setMethodRVP("RVP_ASTM_D6377");
+ standard.setReferenceTemperature(37.8, "C");
+ standard.calculate();
+ Assertions.assertEquals(3.00573767, standard.getValue("RVP", "bara"), 1e-3);
+ Assertions.assertEquals(7.8448385024, standard.getValue("TVP", "bara"), 1e-3);
}
}
From 8365c567696690e57bdb7627ffc1b58267fa9209 Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Sat, 20 Jul 2024 18:32:00 +0200
Subject: [PATCH 244/317] fix: upgrade org.jfree:jfreechart from 1.5.4 to 1.5.5
(#1054)
Snyk has created this PR to upgrade org.jfree:jfreechart from 1.5.4 to 1.5.5.
See this package in maven:
org.jfree:jfreechart
See this project in Snyk:
https://app.snyk.io/org/evensol/project/5734e76a-5ebe-4fe0-9fb9-776e0cbc8504?utm_source=github&utm_medium=referral&page=upgrade-pr
Co-authored-by: snyk-bot
@@ -34,19 +36,18 @@ public HXResponse() {}
* Constructor for HXResponse.
*
+ * Setter for the field
* Setter for the field pressure
.
+ * speed
.
From 1275400ebc7d4650cee348b001772f870c206a4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?=
<34712686+asmfstatoil@users.noreply.github.com>
Date: Fri, 2 Aug 2024 09:41:24 +0200
Subject: [PATCH 251/317] doc: fix javadoc @link to type double causing javadoc
warnings (#1057)
* doc: fix javadoc link
---
.../neqsim/MathLib/generalMath/TDMAsolve.java | 10 +-
.../nonLinearSolver/NumericalDerivative.java | 2 +-
.../nonLinearSolver/newtonRhapson.java | 2 +-
.../simulation/BasePVTsimulation.java | 2 +-
.../simulation/ConstantMassExpansion.java | 4 +-
.../simulation/ConstantVolumeDepletion.java | 4 +-
.../PVTsimulation/simulation/DensitySim.java | 4 +-
.../neqsim/PVTsimulation/simulation/GOR.java | 4 +-
.../simulation/SeparatorTest.java | 4 +-
.../simulation/SwellingTest.java | 2 +-
.../simulation/ViscositySim.java | 4 +-
.../simulation/ViscosityWaxOilSim.java | 4 +-
.../simulation/WaxFractionSim.java | 4 +-
.../ChemicalReactionOperations.java | 6 +-
.../chemicalEquilibriaum/ChemEq.java | 18 +-
.../ChemicalEquilibrium.java | 8 +-
.../LinearProgrammingChemicalEquilibrium.java | 12 +-
.../chemicalReaction/ChemicalReaction.java | 10 +-
.../ChemicalReactionList.java | 18 +-
.../dataPresentation/JFreeChart/graph2b.java | 8 +-
.../dataPresentation/SampleXYDataSource.java | 2 +-
.../dataPresentation/dataHandeling.java | 2 +-
.../createTextFile/TextFile.java | 2 +-
.../flowNode/FlowNodeInterface.java | 2 +-
.../FluidBoundaryInterface.java | 2 +-
.../ReactiveFluidBoundary.java | 2 +-
.../flowSystem/FlowSystemInterface.java | 12 +-
.../util/timeSeries/TimeSeries.java | 10 +-
.../GTSurfaceTensionFullGT.java | 44 +-
.../surfaceTension/GTSurfaceTensionODE.java | 8 +-
.../GTSurfaceTensionSimple.java | 8 +-
.../surfaceTension/GTSurfaceTensionUtils.java | 8 +-
.../surfaceTension/LGTSurfaceTension.java | 8 +-
.../methodInterface/DiffusivityInterface.java | 2 +-
.../compressor/CompressorChart.java | 4 +-
.../CompressorChartAlternativeMapLookup.java | 4 +-
.../compressor/CompressorChartInterface.java | 16 +-
.../compressor/CompressorCurve.java | 6 +-
.../compressor/StoneWallCurve.java | 10 +-
.../compressor/SurgeCurve.java | 10 +-
.../processEquipment/manifold/Manifold.java | 2 +-
.../pipeline/PipeLineInterface.java | 10 +-
.../processEquipment/pipeline/Pipeline.java | 4 +-
.../pump/PumpChartInterface.java | 16 +-
.../processEquipment/pump/PumpCurve.java | 6 +-
.../splitter/ComponentSplitter.java | 2 +-
.../processEquipment/splitter/Splitter.java | 4 +-
.../stream/VirtualStream.java | 2 +-
.../datasmoothing/DataSmoother.java | 4 +-
.../parameterFitting/FunctionInterface.java | 10 +-
.../parameterFitting/SampleValue.java | 10 +-
.../parameterFitting/StatisticsBaseClass.java | 8 +-
.../LevenbergMarquardtFunction.java | 2 +-
src/main/java/neqsim/thermo/Fluid.java | 4 +-
.../neqsim/thermo/atomElement/Element.java | 2 +-
.../thermo/atomElement/UNIFACgroup.java | 2 +-
.../CharacteriseInterface.java | 8 +-
.../PlusFractionModelInterface.java | 8 +-
.../characterization/WaxModelInterface.java | 12 +-
.../neqsim/thermo/component/Component.java | 2 +-
.../component/ComponentCPAInterface.java | 10 +-
.../component/ComponentDesmukhMather.java | 2 +-
.../component/ComponentElectrolyteCPA.java | 2 +-
.../component/ComponentElectrolyteCPAOld.java | 2 +-
.../component/ComponentEosInterface.java | 2 +-
.../component/ComponentGEInterface.java | 8 +-
.../component/ComponentGENRTLmodifiedHV.java | 10 +-
.../component/ComponentGENRTLmodifiedWS.java | 10 +-
.../component/ComponentGEUnifacUMRPRU.java | 2 +-
.../thermo/component/ComponentGEUniquac.java | 8 +-
.../thermo/component/ComponentGEWilson.java | 4 +-
.../thermo/component/ComponentGeDuanSun.java | 14 +-
.../thermo/component/ComponentHydrate.java | 10 +-
.../thermo/component/ComponentInterface.java | 16 +-
.../thermo/component/ComponentPCSAFTa.java | 2 +-
.../thermo/component/ComponentSrkCPA.java | 2 +-
.../thermo/component/ComponentUMRCPA.java | 2 +-
.../AtractiveTermMatCopPRUMRNew.java | 2 +-
.../AttractiveTermMatCop.java | 14 +-
.../AttractiveTermMatCopPR.java | 5 +-
.../AttractiveTermMatCopPRUMR.java | 14 +-
.../AttractiveTermMollerup.java | 2 +-
.../AttractiveTermSchwartzentruber.java | 25 +-
.../AttractiveTermTwuCoonParam.java | 2 +-
.../AttractiveTermTwuCoonStatoil.java | 2 +-
.../thermo/mixingRule/EosMixingRules.java | 2 +-
src/main/java/neqsim/thermo/phase/Phase.java | 2 +-
.../thermo/phase/PhaseDesmukhMather.java | 4 +-
.../thermo/phase/PhaseElectrolyteCPA.java | 10 +-
.../thermo/phase/PhaseElectrolyteCPAOld.java | 2 +-
.../java/neqsim/thermo/phase/PhaseEos.java | 49 ++-
.../java/neqsim/thermo/phase/PhaseGE.java | 2 +-
.../neqsim/thermo/phase/PhaseGEInterface.java | 8 +-
.../java/neqsim/thermo/phase/PhaseGENRTL.java | 6 +-
.../thermo/phase/PhaseGENRTLmodifiedHV.java | 14 +-
.../thermo/phase/PhaseGENRTLmodifiedWS.java | 14 +-
.../neqsim/thermo/phase/PhaseGEUnifac.java | 6 +-
.../thermo/phase/PhaseGEUnifacPSRK.java | 6 +-
.../thermo/phase/PhaseGEUnifacUMRPRU.java | 10 +-
.../neqsim/thermo/phase/PhaseGEUniquac.java | 6 +-
.../neqsim/thermo/phase/PhaseGEWilson.java | 6 +-
.../neqsim/thermo/phase/PhaseInterface.java | 234 +++++-----
.../PhaseModifiedFurstElectrolyteEos.java | 2 +-
...aseModifiedFurstElectrolyteEosMod2004.java | 2 +-
.../java/neqsim/thermo/phase/PhasePCSAFT.java | 4 +-
.../java/neqsim/thermo/phase/PhaseSrkCPA.java | 14 +-
.../phase/PhaseSrkCPA_proceduralMatrices.java | 10 +-
.../thermo/phase/PhaseSrkCPAojAlgo.java | 10 +-
.../java/neqsim/thermo/phase/PhaseUMRCPA.java | 12 +-
.../neqsim/thermo/system/SystemInterface.java | 413 +++++++-----------
.../java/neqsim/thermo/util/GERG/DETAIL.java | 8 +-
.../neqsim/thermo/util/GERG/GERG2008.java | 8 +-
.../thermo/util/GERG/NeqSimAGA8Detail.java | 10 +-
.../thermo/util/GERG/NeqSimGERG2008.java | 6 +-
.../neqsim/thermo/util/JNI/GERG2004EOS.java | 6 +-
.../OperationInterface.java | 6 +-
.../ThermodynamicOperations.java | 24 +-
.../saturationOps/cricondenBarTemp1.java | 4 +-
.../freezingPointTemperatureFlash.java | 2 +-
.../CricondenBarFlash.java | 6 +-
.../CricondenThermFlash.java | 6 +-
...GApropertyTableGeneratorKeywordFormat.java | 12 +-
.../OLGApropertyTableGeneratorWater.java | 12 +-
.../OLGApropertyTableGeneratorWaterEven.java | 12 +-
...pertyTableGeneratorWaterKeywordFormat.java | 12 +-
...GApropertyTableGeneratorWaterStudents.java | 12 +-
...propertyTableGeneratorWaterStudentsPH.java | 12 +-
.../util/generator/PropertyGenerator.java | 4 +-
128 files changed, 741 insertions(+), 851 deletions(-)
diff --git a/src/main/java/neqsim/MathLib/generalMath/TDMAsolve.java b/src/main/java/neqsim/MathLib/generalMath/TDMAsolve.java
index a4ffb42d3c..d501d3c3ad 100644
--- a/src/main/java/neqsim/MathLib/generalMath/TDMAsolve.java
+++ b/src/main/java/neqsim/MathLib/generalMath/TDMAsolve.java
@@ -25,11 +25,11 @@ private TDMAsolve() {}
* solve.
*
experimentalData
.
*
*
- * @param expData an array of {@link double} objects
+ * @param expData an array of type double
*/
public void setExperimentalData(double[][] expData) {
experimentalData = expData;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java b/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java
index e23ab59007..80744fb9db 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java
@@ -396,8 +396,8 @@ public double getSaturationIsoThermalCompressibility() {
* setTemperaturesAndPressures.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setTemperaturesAndPressures(double[] temperature, double[] pressure) {
this.pressures = pressure;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/ConstantVolumeDepletion.java b/src/main/java/neqsim/PVTsimulation/simulation/ConstantVolumeDepletion.java
index ddd8419898..270333b309 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/ConstantVolumeDepletion.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/ConstantVolumeDepletion.java
@@ -49,8 +49,8 @@ public ConstantVolumeDepletion(SystemInterface tempSystem) {
* setTemperaturesAndPressures.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setTemperaturesAndPressures(double[] temperature, double[] pressure) {
this.pressure = pressure;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/DensitySim.java b/src/main/java/neqsim/PVTsimulation/simulation/DensitySim.java
index e47c60bb56..63d9dca18f 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/DensitySim.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/DensitySim.java
@@ -49,8 +49,8 @@ public DensitySim(SystemInterface tempSystem) {
* setTemperaturesAndPressures.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setTemperaturesAndPressures(double[] temperature, double[] pressure) {
this.pressure = pressure;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/GOR.java b/src/main/java/neqsim/PVTsimulation/simulation/GOR.java
index 57ece9cb73..b91d7677ed 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/GOR.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/GOR.java
@@ -41,8 +41,8 @@ public GOR(SystemInterface tempSystem) {
* setTemperaturesAndPressures.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setTemperaturesAndPressures(double[] temperature, double[] pressure) {
this.pressure = pressure;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java b/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java
index 678b5c4d3d..506faaf966 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java
@@ -41,8 +41,8 @@ public SeparatorTest(SystemInterface tempSystem) {
* setSeparatorConditions.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setSeparatorConditions(double[] temperature, double[] pressure) {
this.pressure = pressure;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SwellingTest.java b/src/main/java/neqsim/PVTsimulation/simulation/SwellingTest.java
index 24f701d1b7..0398db0f14 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/SwellingTest.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/SwellingTest.java
@@ -48,7 +48,7 @@ public void setInjectionGas(SystemInterface injectionGas) {
* setCummulativeMolePercentGasInjected.
*
*
- * @param gasInjected an array of {@link double} objects
+ * @param gasInjected an array of type double
*/
public void setCummulativeMolePercentGasInjected(double[] gasInjected) {
this.gasInjected = gasInjected;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/ViscositySim.java b/src/main/java/neqsim/PVTsimulation/simulation/ViscositySim.java
index d3a54dd136..571191c83f 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/ViscositySim.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/ViscositySim.java
@@ -49,8 +49,8 @@ public ViscositySim(SystemInterface tempSystem) {
* setTemperaturesAndPressures.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setTemperaturesAndPressures(double[] temperature, double[] pressure) {
this.pressure = pressure;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/ViscosityWaxOilSim.java b/src/main/java/neqsim/PVTsimulation/simulation/ViscosityWaxOilSim.java
index 8dfafd4584..b3d5b2ad1c 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/ViscosityWaxOilSim.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/ViscosityWaxOilSim.java
@@ -53,8 +53,8 @@ public ViscosityWaxOilSim(SystemInterface tempSystem) {
* setTemperaturesAndPressures.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setTemperaturesAndPressures(double[] temperature, double[] pressure) {
this.pressure = pressure;
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/WaxFractionSim.java b/src/main/java/neqsim/PVTsimulation/simulation/WaxFractionSim.java
index fab7282e03..f4a6e4778a 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/WaxFractionSim.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/WaxFractionSim.java
@@ -52,8 +52,8 @@ public WaxFractionSim(SystemInterface tempSystem) {
* setTemperaturesAndPressures.
*
*
- * @param temperature an array of {@link double} objects
- * @param pressure an array of {@link double} objects
+ * @param temperature an array of type double
+ * @param pressure an array of type double
*/
public void setTemperaturesAndPressures(double[] temperature, double[] pressure) {
this.pressure = pressure;
diff --git a/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java b/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java
index 9b0198c65f..ce4e5bf703 100644
--- a/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java
+++ b/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java
@@ -294,7 +294,7 @@ public boolean hasReactions() {
* calcNVector.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] calcNVector() {
double[] nvec = new double[components.length];
@@ -310,7 +310,7 @@ public double[] calcNVector() {
* calcBVector.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] calcBVector() {
Matrix tempA = new Matrix(Amatrix);
@@ -329,7 +329,7 @@ public double[] calcBVector() {
*
*
* @param phase a int
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] calcChemRefPot(int phase) {
double[] referencePotentials = new double[components.length];
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java
index 82d5186f0f..b2acd76b87 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java
@@ -74,10 +74,10 @@ public ChemEq() {
*
* @param T a double
* @param P a double
- * @param A_matrix an array of {@link double} objects
- * @param n_mol an array of {@link double} objects
- * @param chem_ref an array of {@link double} objects
- * @param b_element an array of {@link double} objects
+ * @param A_matrix an array of type double
+ * @param n_mol an array of type double
+ * @param chem_ref an array of type double
+ * @param b_element an array of type double
*/
public ChemEq(double T, double P, double[][] A_matrix, double[] n_mol, double[] chem_ref,
double[] b_element) {
@@ -116,7 +116,7 @@ public ChemEq(double T, double P, double[][] A_matrix, double[] n_mol, double[]
* Constructor for ChemEq.
*
*
- * @param A_matrix an array of {@link double} objects
+ * @param A_matrix an array of type double
*/
public ChemEq(double[][] A_matrix) {
this.A_matrix = A_matrix;
@@ -129,7 +129,7 @@ public ChemEq(double[][] A_matrix) {
*
* @param T a double
* @param P a double
- * @param A_matrix an array of {@link double} objects
+ * @param A_matrix an array of type double
*/
public ChemEq(double T, double P, double[][] A_matrix) {
this.T = T;
@@ -286,7 +286,7 @@ public double step() {
* innerStep.
*
*
- * @param n_omega an array of {@link double} objects
+ * @param n_omega an array of type double
* @param check a int
* @param step a double
* @return a double
@@ -322,8 +322,8 @@ public double innerStep(double[] n_omega, int check, double step) {
*
* @param T a double
* @param P a double
- * @param n_mol an array of {@link double} objects
- * @param chem_ref an array of {@link double} objects
+ * @param n_mol an array of type double
+ * @param chem_ref an array of type double
*/
public void solve(double T, double P, double[] n_mol, double[] chem_ref) {
this.T = T;
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
index 2db46cae9f..f9f212c962 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java
@@ -64,8 +64,8 @@ public class ChemicalEquilibrium implements java.io.Serializable {
* Constructor for ChemicalEquilibrium.
*
*
- * @param A_matrix an array of {@link double} objects
- * @param b_element an array of {@link double} objects
+ * @param A_matrix an array of type double
+ * @param b_element an array of type double
* @param system a {@link neqsim.thermo.system.SystemInterface} object
* @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects
* @param phase a int
@@ -377,7 +377,7 @@ public void printComp() {
* getMoles.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getMoles() {
return n_mol;
@@ -482,7 +482,7 @@ public double step() {
*
*
* @param i a int
- * @param n_omega an array of {@link double} objects
+ * @param n_omega an array of type double
* @param check a int
* @param step a double
* @param test a boolean
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java
index b2f590ff2c..e9270e1a93 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/LinearProgrammingChemicalEquilibrium.java
@@ -56,7 +56,7 @@ public class LinearProgrammingChemicalEquilibrium
* Constructor for LinearProgrammingChemicalEquilibrium.
*
*
- * @param chemRefPot an array of {@link double} objects
+ * @param chemRefPot an array of type double
* @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects
* @param elements an array of {@link java.lang.String} objects
* @param operations a {@link neqsim.chemicalReactions.ChemicalReactionOperations} object
@@ -112,7 +112,7 @@ public LinearProgrammingChemicalEquilibrium(double[] chemRefPot, ComponentInterf
* calcA.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] calcA() {
int A_size = components.length - operations.getReactionList().getChemicalReactionList().size();
@@ -151,7 +151,7 @@ public double[][] calcA() {
* getA.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getA() {
return Amatrix;
@@ -162,7 +162,7 @@ public double[][] getA() {
* getRefPot.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getRefPot() {
return chemRefPot;
@@ -329,10 +329,10 @@ public void calcx(Matrix atemp, Matrix lagrangeTemp) {
*
*
* @param system a {@link neqsim.thermo.system.SystemInterface} object
- * @param bVector an array of {@link double} objects
+ * @param bVector an array of type double
* @param inertMoles a double
* @param phase a int
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] generateInitialEstimates(SystemInterface system, double[] bVector,
double inertMoles, int phase) {
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java
index 5572bef6c2..7b4616a892 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java
@@ -47,8 +47,8 @@ public class ChemicalReaction extends NamedBaseClass
*
* @param name a {@link java.lang.String} object
* @param names an array of {@link java.lang.String} objects
- * @param stocCoefs an array of {@link double} objects
- * @param K an array of {@link double} objects
+ * @param stocCoefs an array of type double
+ * @param K an array of type double
* @param r a double
* @param activationEnergy a double
* @param refT a double
@@ -135,7 +135,7 @@ public double getRateFactor(PhaseInterface phase) {
* Getter for the field stocCoefs
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getStocCoefs() {
return this.stocCoefs;
@@ -244,8 +244,8 @@ public double calcK(neqsim.thermo.system.SystemInterface system, int phaseNumb)
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects
- * @param Amatrix an array of {@link double} objects
- * @param chemRefPot an array of {@link double} objects
+ * @param Amatrix an array of type double
+ * @param chemRefPot an array of type double
*/
public void initMoleNumbers(PhaseInterface phase, ComponentInterface[] components,
double[][] Amatrix, double[] chemRefPot) {
diff --git a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java
index 2fe125bd27..136df62f9e 100644
--- a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java
+++ b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReactionList.java
@@ -185,8 +185,8 @@ public void checkReactions(PhaseInterface phase) {
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects
- * @param Amatrix an array of {@link double} objects
- * @param chemRefPot an array of {@link double} objects
+ * @param Amatrix an array of type double
+ * @param chemRefPot an array of type double
*/
public void initMoleNumbers(PhaseInterface phase, ComponentInterface[] components,
double[][] Amatrix, double[] chemRefPot) {
@@ -229,7 +229,7 @@ public String[] getAllComponents() {
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] createReactionMatrix(PhaseInterface phase, ComponentInterface[] components) {
IteratorreacMatrix
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getReacMatrix() {
return tempReacMatrix;
@@ -387,7 +387,7 @@ public double[][] getReacMatrix() {
* getStocMatrix.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getStocMatrix() {
return tempStocMatrix;
diff --git a/src/main/java/neqsim/dataPresentation/JFreeChart/graph2b.java b/src/main/java/neqsim/dataPresentation/JFreeChart/graph2b.java
index d53eb7920f..7aa6ca33fb 100644
--- a/src/main/java/neqsim/dataPresentation/JFreeChart/graph2b.java
+++ b/src/main/java/neqsim/dataPresentation/JFreeChart/graph2b.java
@@ -51,7 +51,7 @@ public graph2b() {
* Constructor for graph2b.
*
*
- * @param points an array of {@link double} objects
+ * @param points an array of type double
*/
public graph2b(double[][] points) {
String[] seriesNames = new String[points.length];
@@ -97,7 +97,7 @@ public graph2b(double[][] points) {
* Constructor for graph2b.
*
*
- * @param points an array of {@link double} objects
+ * @param points an array of type double
* @param seriesNames an array of {@link java.lang.String} objects
* @param tit a {@link java.lang.String} object
* @param xaxis a {@link java.lang.String} object
@@ -139,8 +139,8 @@ public graph2b(double[][] points, String[] seriesNames, String tit, String xaxis
* Constructor for graph2b.
*
*
- * @param xpoints an array of {@link double} objects
- * @param points an array of {@link double} objects
+ * @param xpoints an array of type double
+ * @param points an array of type double
* @param seriesNames an array of {@link java.lang.String} objects
* @param tit a {@link java.lang.String} object
* @param xaxis a {@link java.lang.String} object
diff --git a/src/main/java/neqsim/dataPresentation/SampleXYDataSource.java b/src/main/java/neqsim/dataPresentation/SampleXYDataSource.java
index 5e67e71ce0..42c0f87e86 100644
--- a/src/main/java/neqsim/dataPresentation/SampleXYDataSource.java
+++ b/src/main/java/neqsim/dataPresentation/SampleXYDataSource.java
@@ -36,7 +36,7 @@ public class SampleXYDataSource {
* Constructor for SampleXYDataSource.
*
*
- * @param p an array of {@link double} objects
+ * @param p an array of type double
* @param name an array of {@link java.lang.String} objects
* @param title a {@link java.lang.String} object
* @param xaxis a {@link java.lang.String} object
diff --git a/src/main/java/neqsim/dataPresentation/dataHandeling.java b/src/main/java/neqsim/dataPresentation/dataHandeling.java
index d8d45d8534..5da9caccbc 100644
--- a/src/main/java/neqsim/dataPresentation/dataHandeling.java
+++ b/src/main/java/neqsim/dataPresentation/dataHandeling.java
@@ -119,7 +119,7 @@ public Number getYValue(int series, int item) {
* printToFile.
*
*
- * @param points an array of {@link double} objects
+ * @param points an array of type double
* @param filename a {@link java.lang.String} object
*/
public void printToFile(double[][] points, String filename) {
diff --git a/src/main/java/neqsim/dataPresentation/fileHandeling/createTextFile/TextFile.java b/src/main/java/neqsim/dataPresentation/fileHandeling/createTextFile/TextFile.java
index fb25a08023..2431ca49f0 100644
--- a/src/main/java/neqsim/dataPresentation/fileHandeling/createTextFile/TextFile.java
+++ b/src/main/java/neqsim/dataPresentation/fileHandeling/createTextFile/TextFile.java
@@ -70,7 +70,7 @@ public void setValues(String[][] values) {
* Setter for the field values
.
*
*
- * @param valuesloca an array of {@link double} objects
+ * @param valuesloca an array of type double
*/
public void setValues(double[][] valuesloca) {
values = new String[valuesloca[0].length][valuesloca.length];
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/FlowNodeInterface.java b/src/main/java/neqsim/fluidMechanics/flowNode/FlowNodeInterface.java
index 3ef19b9189..62beeb5ba0 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/FlowNodeInterface.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/FlowNodeInterface.java
@@ -608,7 +608,7 @@ public default void setVelocityIn(DoubleCloneable vel) {
* setFluxes.
*
*
- * @param dn an array of {@link double} objects
+ * @param dn an array of type double
*/
public void setFluxes(double[] dn);
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundaryInterface.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundaryInterface.java
index ef8788fd52..ba885c5ce2 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundaryInterface.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundaryInterface.java
@@ -123,7 +123,7 @@ public interface FluidBoundaryInterface extends Cloneable {
* calcFluxes.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] calcFluxes();
diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java
index 1f57f01475..773c0d3d62 100644
--- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java
+++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java
@@ -523,7 +523,7 @@ public double[] calcFluxes() {
* calcFluxes2.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] calcFluxes2() {
double sum = 0.0;
diff --git a/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystemInterface.java b/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystemInterface.java
index 40fe2474aa..5e0b3a7d39 100644
--- a/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystemInterface.java
+++ b/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystemInterface.java
@@ -147,7 +147,7 @@ public default void solveTransient(int type) {
* setLegHeights.
*
*
- * @param legHeights an array of {@link double} objects
+ * @param legHeights an array of type double
*/
public void setLegHeights(double[] legHeights);
@@ -156,7 +156,7 @@ public default void solveTransient(int type) {
* getLegHeights.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getLegHeights();
@@ -165,7 +165,7 @@ public default void solveTransient(int type) {
* setLegPositions.
*
*
- * @param legPositions an array of {@link double} objects
+ * @param legPositions an array of type double
*/
public void setLegPositions(double[] legPositions);
@@ -200,7 +200,7 @@ public default void solveTransient(int type) {
* setLegOuterHeatTransferCoefficients.
*
*
- * @param coefs an array of {@link double} objects
+ * @param coefs an array of type double
*/
public void setLegOuterHeatTransferCoefficients(double[] coefs);
@@ -209,7 +209,7 @@ public default void solveTransient(int type) {
* setLegWallHeatTransferCoefficients.
*
*
- * @param coefs an array of {@link double} objects
+ * @param coefs an array of type double
*/
public void setLegWallHeatTransferCoefficients(double[] coefs);
@@ -301,7 +301,7 @@ public default void solveSteadyState(int type) {
* setLegOuterTemperatures.
*
*
- * @param temps an array of {@link double} objects
+ * @param temps an array of type double
*/
public void setLegOuterTemperatures(double[] temps);
diff --git a/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java b/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java
index 4d3b9dc8bb..725bc48986 100644
--- a/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java
+++ b/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java
@@ -40,7 +40,7 @@ public TimeSeries() {
* Setter for the field times
.
*
*
- * @param times an array of {@link double} objects
+ * @param times an array of type double
*/
public void setTimes(double[] times) {
this.timeSeries = times;
@@ -62,7 +62,7 @@ public void setInletThermoSystems(SystemInterface[] inletThermoSystem) {
* Setter for the field outletMolarFlowRate
.
*
*
- * @param outletMolarFlowRate an array of {@link double} objects
+ * @param outletMolarFlowRate an array of type double
*/
public void setOutletMolarFlowRate(double[] outletMolarFlowRate) {
this.outletMolarFlowRate = outletMolarFlowRate;
@@ -73,7 +73,7 @@ public void setOutletMolarFlowRate(double[] outletMolarFlowRate) {
* Getter for the field outletMolarFlowRates
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getOutletMolarFlowRates() {
return this.outletMolarFlowRates;
@@ -136,7 +136,7 @@ public SystemInterface[] getThermoSystem() {
* getTimeStep.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getTimeStep() {
return timeSteps;
@@ -147,7 +147,7 @@ public double[] getTimeStep() {
* getTime.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getTime() {
return times;
diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionFullGT.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionFullGT.java
index af07d91073..36563801b9 100644
--- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionFullGT.java
+++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionFullGT.java
@@ -265,17 +265,17 @@ public double runcase() {
* large 4. Iterate until convergence or max #iterations (N_Newton)
*
*
- * @param cij an array of {@link double} objects
+ * @param cij an array of type double
* @param L a double
* @param N_Newton a int
* @param allowedRelChange a double
* @param highOrder a boolean
* @param directMethod a boolean
- * @param rhomat an array of {@link double} objects
+ * @param rhomat an array of type double
* @param sys a {@link neqsim.thermo.system.SystemInterface} object
* @param ncomp a int
* @param t a double
- * @param mueq an array of {@link double} objects
+ * @param mueq an array of type double
* @return sigma The surface tension [N/m]
*/
public static double Newton(double[][] cij, double L, int N_Newton, double allowedRelChange,
@@ -428,12 +428,12 @@ public static double Newton(double[][] cij, double L, int N_Newton, double allow
* directsolve. Solve linear system for Full Gradient method
*
*
- * @param rres an array of {@link double} objects
- * @param JJ an array of {@link double} objects
- * @param C an array of {@link double} objects
+ * @param rres an array of type double
+ * @param JJ an array of type double
+ * @param C an array of type double
* @param H a double
* @param Ngrid a int
- * @param rhomat an array of {@link double} objects
+ * @param rhomat an array of type double
* @param ncomp a int
*/
public static void directsolve(double[][] rres, double[][][] JJ, double[][] C, double H,
@@ -524,10 +524,10 @@ public static void directsolve(double[][] rres, double[][][] JJ, double[][] C, d
*
*
* @param h a double
- * @param rrho an array of {@link double} objects
- * @param C an array of {@link double} objects
+ * @param rrho an array of type double
+ * @param C an array of type double
* @param highOrder a boolean
- * @param drhodz an array of {@link double} objects
+ * @param drhodz an array of type double
* @param ncomp a int
* @return sigma The surface tension [N/m]
*/
@@ -570,9 +570,9 @@ public static double sigmaCalc(double h, double[][] rrho, double[][] C, boolean
* integrand. Used to adjust the domain size
*
*
- * @param z an array of {@link double} objects
- * @param C an array of {@link double} objects
- * @param drhodz an array of {@link double} objects
+ * @param z an array of type double
+ * @param C an array of type double
+ * @param drhodz an array of type double
* @return Interface width (length scale) [nm]
*/
public double calc_std_integral(double[] z, double[][] C, double[][] drhodz) {
@@ -612,10 +612,10 @@ public double calc_std_integral(double[] z, double[][] C, double[][] drhodz) {
* @param sys a {@link neqsim.thermo.system.SystemInterface} object
* @param ncomp a int
* @param t a double
- * @param mueq an array of {@link double} objects
- * @param rho an array of {@link double} objects
- * @param delta_mu an array of {@link double} objects
- * @param dmu_drho an array of {@link double} objects
+ * @param mueq an array of type double
+ * @param rho an array of type double
+ * @param delta_mu an array of type double
+ * @param dmu_drho an array of type double
*/
public static void delta_mu(SystemInterface sys, int ncomp, double t, double[] mueq, double[] rho,
double[] delta_mu, double[][] dmu_drho) {
@@ -638,7 +638,7 @@ public static void delta_mu(SystemInterface sys, int ncomp, double t, double[] m
* @param a start of range
* @param b end of range
* @param N number of values.
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public static double[] linspace(double a, double b, int N) {
double[] x = new double[N];
@@ -687,10 +687,10 @@ public static void debugPlot(double[] x, double[][] y) {
* @param sys a {@link neqsim.thermo.system.SystemInterface} object
* @param ncomp a int
* @param t a double
- * @param rho_ph1 an array of {@link double} objects
- * @param rho_ph2 an array of {@link double} objects
- * @param mueq an array of {@link double} objects
- * @param p0 an array of {@link double} objects
+ * @param rho_ph1 an array of type double
+ * @param rho_ph2 an array of type double
+ * @param mueq an array of type double
+ * @param p0 an array of type double
* @param reltol a double
*/
public static void initmu(SystemInterface sys, int ncomp, double t, double[] rho_ph1,
diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionODE.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionODE.java
index 89105f3180..faf49f6e29 100644
--- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionODE.java
+++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionODE.java
@@ -346,10 +346,10 @@ private void solveRho(double[] rho, double[] mu, double[][] dmu_drho, double[] p
/**
* Residual function for the algebraic equilibrium equations.
*
- * @param mu an array of {@link double} objects
- * @param dmu_drho an array of {@link double} objects
- * @param f an array of {@link double} objects
- * @param jac an array of {@link double} objects
+ * @param mu an array of type double
+ * @param dmu_drho an array of type double
+ * @param f an array of type double
+ * @param jac an array of type double
*/
public void fjacfun(double[] mu, double[][] dmu_drho, double[] f, double[][] jac) {
int i;
diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionSimple.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionSimple.java
index 2b25f3ffc3..dcf8adf553 100644
--- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionSimple.java
+++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionSimple.java
@@ -328,7 +328,7 @@ public double calcSurfaceTension(int interface1, int interface2) {
*
*
* @param compnum a int
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getMolarDensity(int compnum) {
double[] temp = new double[ite_step];
@@ -343,7 +343,7 @@ public double[] getMolarDensity(int compnum) {
* getMolarDensityTotal.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getMolarDensityTotal() {
double[] temp = new double[ite_step];
@@ -360,7 +360,7 @@ public double[] getMolarDensityTotal() {
* getz.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getz() {
return z_step;
@@ -371,7 +371,7 @@ public double[] getz() {
* getPressure.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getPressure() {
return pressure_interface;
diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionUtils.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionUtils.java
index 453526d21b..9bde4be2f5 100644
--- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionUtils.java
+++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/GTSurfaceTensionUtils.java
@@ -30,10 +30,10 @@ public class GTSurfaceTensionUtils {
* @param sys a {@link neqsim.thermo.system.SystemInterface} object
* @param ncomp a int
* @param t a double
- * @param rho an array of {@link double} objects
- * @param mu an array of {@link double} objects
- * @param dmu_drho an array of {@link double} objects
- * @param p an array of {@link double} objects
+ * @param rho an array of type double
+ * @param mu an array of type double
+ * @param dmu_drho an array of type double
+ * @param p an array of type double
*/
public static void mufun(SystemInterface sys, int ncomp, double t, double[] rho, double[] mu,
double[][] dmu_drho, double[] p) {
diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/LGTSurfaceTension.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/LGTSurfaceTension.java
index 7933b98f54..f9f29ebeac 100644
--- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/LGTSurfaceTension.java
+++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/LGTSurfaceTension.java
@@ -205,7 +205,7 @@ public double calcSurfaceTension(int interface1, int interface2) {
*
*
* @param compnum a int
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getMolarDensity(int compnum) {
double[] temp = new double[ite_step];
@@ -220,7 +220,7 @@ public double[] getMolarDensity(int compnum) {
* getMolarDensityTotal.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getMolarDensityTotal() {
double[] temp = new double[ite_step];
@@ -237,7 +237,7 @@ public double[] getMolarDensityTotal() {
* getz.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getz() {
return z_step;
@@ -248,7 +248,7 @@ public double[] getz() {
* getPressure.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getPressure() {
return pressure_interface;
diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/methodInterface/DiffusivityInterface.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/methodInterface/DiffusivityInterface.java
index 971510ea3c..7e75bd2b38 100644
--- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/methodInterface/DiffusivityInterface.java
+++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/methodInterface/DiffusivityInterface.java
@@ -31,7 +31,7 @@ public interface DiffusivityInterface extends ThermodynamicConstantsInterface,
*
* @param binaryDiffusionCoefficientMethod a int
* @param multicomponentDiffusionMethod a int
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] calcDiffusionCoefficients(int binaryDiffusionCoefficientMethod,
int multicomponentDiffusionMethod);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java
index 845cd4fd74..aca0a8841b 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java
@@ -193,8 +193,8 @@ public double getFlow(double head, double speed, double guessFlow) {
* addSurgeCurve.
*
*
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
*/
public void addSurgeCurve(double[] flow, double[] head) {
surgeCurve = new SurgeCurve(flow, head);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java
index a1ded377f8..f4c47b52bb 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartAlternativeMapLookup.java
@@ -168,8 +168,8 @@ public double getPolytropicEfficiency(double flow, double speed) {
* addSurgeCurve.
*
*
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
*/
public void addSurgeCurve(double[] flow, double[] head) {
surgeCurve = new SurgeCurve(flow, head);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java
index 53e7507da1..872f16b81e 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java
@@ -13,20 +13,20 @@ public interface CompressorChartInterface extends Cloneable {
* This method is used add a curve to the CompressorChart object.
*
* @param speed a double
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
- * @param polytropicEfficiency an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
+ * @param polytropicEfficiency an array of type double
*/
public void addCurve(double speed, double[] flow, double[] head, double[] polytropicEfficiency);
/**
* This method is used add a set of curves to the CompressorChart object.
*
- * @param chartConditions an array of {@link double} objects
- * @param speed an array of {@link double} objects
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
- * @param polyEff an array of {@link double} objects
+ * @param chartConditions an array of type double
+ * @param speed an array of type double
+ * @param flow an array of type double
+ * @param head an array of type double
+ * @param polyEff an array of type double
*/
public void setCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head,
double[][] polyEff);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorCurve.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorCurve.java
index 3820b4cfab..9fd12cb869 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorCurve.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorCurve.java
@@ -35,9 +35,9 @@ public CompressorCurve() {
*
*
* @param speed a double
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
- * @param polytropicEfficiency an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
+ * @param polytropicEfficiency an array of type double
*/
public CompressorCurve(double speed, double[] flow, double[] head,
double[] polytropicEfficiency) {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/StoneWallCurve.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/StoneWallCurve.java
index 31cb09263f..6727b9f236 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/StoneWallCurve.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/StoneWallCurve.java
@@ -42,8 +42,8 @@ public StoneWallCurve() {
* Constructor for StoneWallCurve.
*
*
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
*/
public StoneWallCurve(double[] flow, double[] head) {
this.flow = flow;
@@ -55,9 +55,9 @@ public StoneWallCurve(double[] flow, double[] head) {
* setCurve.
*
*
- * @param chartConditions an array of {@link double} objects
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
+ * @param chartConditions an array of type double
+ * @param flow an array of type double
+ * @param head an array of type double
*/
public void setCurve(double[] chartConditions, double[] flow, double[] head) {
this.chartConditions = chartConditions;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/SurgeCurve.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/SurgeCurve.java
index be9e915102..7011bf34b4 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/SurgeCurve.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/SurgeCurve.java
@@ -40,8 +40,8 @@ public SurgeCurve() {}
* Constructor for SurgeCurve.
*
*
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
*/
public SurgeCurve(double[] flow, double[] head) {
this.flow = flow;
@@ -53,9 +53,9 @@ public SurgeCurve(double[] flow, double[] head) {
* setCurve.
*
*
- * @param chartConditions an array of {@link double} objects
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
+ * @param chartConditions an array of type double
+ * @param flow an array of type double
+ * @param head an array of type double
*/
public void setCurve(double[] chartConditions, double[] flow, double[] head) {
this.flow = flow;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java b/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java
index 33d0915459..76eb814ac4 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/manifold/Manifold.java
@@ -56,7 +56,7 @@ public void addStream(StreamInterface newStream) {
* setSplitFactors.
*
*
- * @param splitFact an array of {@link double} objects
+ * @param splitFact an array of type double
*/
public void setSplitFactors(double[] splitFact) {
splitFactors = splitFact;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeLineInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeLineInterface.java
index ab499bcf08..5072ae3ee8 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeLineInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeLineInterface.java
@@ -33,7 +33,7 @@ public interface PipeLineInterface extends SimulationInterface, TwoPortInterface
* setHeightProfile.
*
*
- * @param heights an array of {@link double} objects
+ * @param heights an array of type double
*/
public void setHeightProfile(double[] heights);
@@ -42,7 +42,7 @@ public interface PipeLineInterface extends SimulationInterface, TwoPortInterface
* setLegPositions.
*
*
- * @param positions an array of {@link double} objects
+ * @param positions an array of type double
*/
public void setLegPositions(double[] positions);
@@ -51,7 +51,7 @@ public interface PipeLineInterface extends SimulationInterface, TwoPortInterface
* setPipeDiameters.
*
*
- * @param diameter an array of {@link double} objects
+ * @param diameter an array of type double
*/
public void setPipeDiameters(double[] diameter);
@@ -60,7 +60,7 @@ public interface PipeLineInterface extends SimulationInterface, TwoPortInterface
* setPipeWallRoughness.
*
*
- * @param rough an array of {@link double} objects
+ * @param rough an array of type double
*/
public void setPipeWallRoughness(double[] rough);
@@ -69,7 +69,7 @@ public interface PipeLineInterface extends SimulationInterface, TwoPortInterface
* setOuterTemperatures.
*
*
- * @param outerTemp an array of {@link double} objects
+ * @param outerTemp an array of type double
*/
public void setOuterTemperatures(double[] outerTemp);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/Pipeline.java b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/Pipeline.java
index 823d79ed8c..12aa3e56fb 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/Pipeline.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/Pipeline.java
@@ -170,7 +170,7 @@ public void setPipeDiameters(double[] diameter) {
* setPipeOuterHeatTransferCoefficients.
*
*
- * @param heatCoefs an array of {@link double} objects
+ * @param heatCoefs an array of type double
*/
public void setPipeOuterHeatTransferCoefficients(double[] heatCoefs) {
if (heatCoefs.length != this.numberOfLegs + 1) {
@@ -187,7 +187,7 @@ public void setPipeOuterHeatTransferCoefficients(double[] heatCoefs) {
* setPipeWallHeatTransferCoefficients.
*
*
- * @param heatCoefs an array of {@link double} objects
+ * @param heatCoefs an array of type double
*/
public void setPipeWallHeatTransferCoefficients(double[] heatCoefs) {
if (heatCoefs.length != this.numberOfLegs + 1) {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChartInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChartInterface.java
index efe3d72ec4..9123c23cc2 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChartInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChartInterface.java
@@ -13,20 +13,20 @@ public interface PumpChartInterface extends Cloneable {
* This method is used add a curve to the CompressorChart object.
*
* @param speed a double
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
- * @param efficiency an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
+ * @param efficiency an array of type double
*/
public void addCurve(double speed, double[] flow, double[] head, double[] efficiency);
/**
* This method is used add a set of curves to the CompressorChart object.
*
- * @param chartConditions an array of {@link double} objects
- * @param speed an array of {@link double} objects
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
- * @param polyEff an array of {@link double} objects
+ * @param chartConditions an array of type double
+ * @param speed an array of type double
+ * @param flow an array of type double
+ * @param head an array of type double
+ * @param polyEff an array of type double
*/
public void setCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head,
double[][] polyEff);
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpCurve.java b/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpCurve.java
index dc209a04d4..3d5d364bde 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpCurve.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpCurve.java
@@ -32,9 +32,9 @@ public PumpCurve() {
*
*
* @param speed a double
- * @param flow an array of {@link double} objects
- * @param head an array of {@link double} objects
- * @param efficiency an array of {@link double} objects
+ * @param flow an array of type double
+ * @param head an array of type double
+ * @param efficiency an array of type double
*/
public PumpCurve(double speed, double[] flow, double[] head, double[] efficiency) {
this.speed = speed;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/splitter/ComponentSplitter.java b/src/main/java/neqsim/processSimulation/processEquipment/splitter/ComponentSplitter.java
index e772739d8c..01d77e52ec 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/splitter/ComponentSplitter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/splitter/ComponentSplitter.java
@@ -64,7 +64,7 @@ public ComponentSplitter(String name, StreamInterface inletStream) {
* setSplitFactors.
*
*
- * @param factors an array of {@link double} objects
+ * @param factors an array of type double
*/
public void setSplitFactors(double[] factors) {
splitFactor = factors;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
index 41843ac5a1..7ceeae63f3 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/splitter/Splitter.java
@@ -109,7 +109,7 @@ public void setSplitNumber(int i) {
* setSplitFactors.
*
*
- * @param splitFact an array of {@link double} objects
+ * @param splitFact an array of type double
*/
public void setSplitFactors(double[] splitFact) {
double sum = 0.0;
@@ -133,7 +133,7 @@ public void setSplitFactors(double[] splitFact) {
* setFlowRates.
*
*
- * @param flowRates an array of {@link double} objects
+ * @param flowRates an array of type double
* @param flowUnit a {@link java.lang.String} object
*/
public void setFlowRates(double[] flowRates, String flowUnit) {
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/stream/VirtualStream.java b/src/main/java/neqsim/processSimulation/processEquipment/stream/VirtualStream.java
index d15edeb02d..ae73adffa2 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/stream/VirtualStream.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/stream/VirtualStream.java
@@ -88,7 +88,7 @@ public void setFlowRate(double rate, String unit) {
* Setter for the field composition
.
*
*
- * @param comps an array of {@link double} objects
+ * @param comps an array of type double
* @param unit a {@link java.lang.String} object
*/
public void setComposition(double[] comps, String unit) {
diff --git a/src/main/java/neqsim/statistics/dataanalysis/datasmoothing/DataSmoother.java b/src/main/java/neqsim/statistics/dataanalysis/datasmoothing/DataSmoother.java
index 613d500c02..3923a9ab25 100644
--- a/src/main/java/neqsim/statistics/dataanalysis/datasmoothing/DataSmoother.java
+++ b/src/main/java/neqsim/statistics/dataanalysis/datasmoothing/DataSmoother.java
@@ -38,7 +38,7 @@ public class DataSmoother {
* Constructor for DataSmoothor.
*
*
- * @param nonSmoothedNumbers an array of {@link double} objects
+ * @param nonSmoothedNumbers an array of type double
* @param nl a int
* @param nr a int
* @param ld a int
@@ -154,7 +154,7 @@ public void setSmoothedNumbers() {
* Getter for the field smoothedNumbers
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getSmoothedNumbers() {
return smoothedNumbers;
diff --git a/src/main/java/neqsim/statistics/parameterFitting/FunctionInterface.java b/src/main/java/neqsim/statistics/parameterFitting/FunctionInterface.java
index 7baa7cc9b1..a936162a8e 100644
--- a/src/main/java/neqsim/statistics/parameterFitting/FunctionInterface.java
+++ b/src/main/java/neqsim/statistics/parameterFitting/FunctionInterface.java
@@ -22,7 +22,7 @@ public interface FunctionInterface extends Cloneable {
* calcValue.
*
*
- * @param dependentValues an array of {@link double} objects
+ * @param dependentValues an array of type double
* @return a double
*/
public double calcValue(double[] dependentValues);
@@ -69,7 +69,7 @@ public interface FunctionInterface extends Cloneable {
* getFittingParams.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getFittingParams();
@@ -87,7 +87,7 @@ public interface FunctionInterface extends Cloneable {
* setInitialGuess.
*
*
- * @param guess an array of {@link double} objects
+ * @param guess an array of type double
*/
public void setInitialGuess(double[] guess);
@@ -123,7 +123,7 @@ public interface FunctionInterface extends Cloneable {
* getBounds.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getBounds();
@@ -152,7 +152,7 @@ public interface FunctionInterface extends Cloneable {
* setBounds.
*
*
- * @param bounds an array of {@link double} objects
+ * @param bounds an array of type double
*/
public void setBounds(double[][] bounds);
}
diff --git a/src/main/java/neqsim/statistics/parameterFitting/SampleValue.java b/src/main/java/neqsim/statistics/parameterFitting/SampleValue.java
index 105f564e38..3707faf178 100644
--- a/src/main/java/neqsim/statistics/parameterFitting/SampleValue.java
+++ b/src/main/java/neqsim/statistics/parameterFitting/SampleValue.java
@@ -48,7 +48,7 @@ public SampleValue() {}
*
* @param sampleValue a double
* @param standardDeviation a double
- * @param dependentValues an array of {@link double} objects
+ * @param dependentValues an array of type double
*/
public SampleValue(double sampleValue, double standardDeviation, double[] dependentValues) {
this.dependentValues = new double[dependentValues.length];
@@ -64,8 +64,8 @@ public SampleValue(double sampleValue, double standardDeviation, double[] depend
*
* @param sampleValue a double
* @param standardDeviation a double
- * @param dependentValues an array of {@link double} objects
- * @param standardDeviations an array of {@link double} objects
+ * @param dependentValues an array of type double
+ * @param standardDeviations an array of type double
*/
public SampleValue(double sampleValue, double standardDeviation, double[] dependentValues,
double[] standardDeviations) {
@@ -165,7 +165,7 @@ public double getSampleValue() {
* Getter for the field dependentValues
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getDependentValues() {
return dependentValues;
@@ -188,7 +188,7 @@ public double getDependentValue(int i) {
* Setter for the field dependentValues
.
*
*
- * @param vals an array of {@link double} objects
+ * @param vals an array of type double
*/
public void setDependentValues(double[] vals) {
System.arraycopy(vals, 0, this.dependentValues, 0, dependentValues.length);
diff --git a/src/main/java/neqsim/statistics/parameterFitting/StatisticsBaseClass.java b/src/main/java/neqsim/statistics/parameterFitting/StatisticsBaseClass.java
index 91a8f3cc8c..f37d205059 100644
--- a/src/main/java/neqsim/statistics/parameterFitting/StatisticsBaseClass.java
+++ b/src/main/java/neqsim/statistics/parameterFitting/StatisticsBaseClass.java
@@ -178,7 +178,7 @@ public double calcTrueValue(double val, SampleValue sample) {
* setFittingParameters.
*
*
- * @param parameterVals an array of {@link double} objects
+ * @param parameterVals an array of type double
*/
public void setFittingParameters(double[] parameterVals) {
for (int i = 0; i < sampleSet.getLength(); i++) {
@@ -243,7 +243,7 @@ public double calcChiSquare() {
* calcAlphaMatrix.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] calcAlphaMatrix() {
double[][] alpha = new double[sampleSet.getSample(0).getFunction()
@@ -268,7 +268,7 @@ public double[][] calcAlphaMatrix() {
* calcBetaMatrix.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] calcBetaMatrix() {
double[] beta = new double[sampleSet.getSample(0).getFunction().getFittingParams().length];
@@ -287,7 +287,7 @@ public double[] calcBetaMatrix() {
* calcDerivatives.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] calcDerivatives() {
dyda = new double[sampleSet.getLength()][sampleSet.getSample(0).getFunction()
diff --git a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtFunction.java b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtFunction.java
index 5c3c4cc1d7..15af7533b9 100644
--- a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtFunction.java
+++ b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtFunction.java
@@ -53,7 +53,7 @@ public int getNumberOfFittingParams() {
* setFittingParams.
*
*
- * @param value an array of {@link double} objects
+ * @param value an array of type double
*/
public void setFittingParams(double[] value) {
System.arraycopy(value, 0, params, 0, value.length);
diff --git a/src/main/java/neqsim/thermo/Fluid.java b/src/main/java/neqsim/thermo/Fluid.java
index 555a346d49..d89bb48c19 100644
--- a/src/main/java/neqsim/thermo/Fluid.java
+++ b/src/main/java/neqsim/thermo/Fluid.java
@@ -75,7 +75,7 @@ public neqsim.thermo.system.SystemInterface create2(String[] componentNames) {
*
*
* @param componentNames an array of {@link java.lang.String} objects
- * @param flowrate an array of {@link double} objects
+ * @param flowrate an array of type double
* @param unit a {@link java.lang.String} object
* @return a {@link neqsim.thermo.system.SystemInterface} object
*/
@@ -229,7 +229,7 @@ public neqsim.thermo.system.SystemInterface create(String fluidType) {
*
*
* @param componentNames an array of {@link java.lang.String} objects
- * @param flowrate an array of {@link double} objects
+ * @param flowrate an array of type double
* @param unit a {@link java.lang.String} object
* @return a {@link neqsim.thermo.system.SystemInterface} object
*/
diff --git a/src/main/java/neqsim/thermo/atomElement/Element.java b/src/main/java/neqsim/thermo/atomElement/Element.java
index dd9b308078..d82149f7dd 100644
--- a/src/main/java/neqsim/thermo/atomElement/Element.java
+++ b/src/main/java/neqsim/thermo/atomElement/Element.java
@@ -105,7 +105,7 @@ public double getNumberOfElements(String elementName) {
/**
* Getter for property coefArray.
*
- * @return an array of {@link double} objects. Coefficient corresponding to nameArray.
+ * @return an array of type double. Coefficient corresponding to nameArray.
*/
public double[] getElementCoefs() {
return coefArray;
diff --git a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
index 3beaa2da26..256c6d05fd 100644
--- a/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
+++ b/src/main/java/neqsim/thermo/atomElement/UNIFACgroup.java
@@ -355,7 +355,7 @@ public double calcQMix(PhaseGEUnifac phase) {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseGEUnifac} object
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] calcQMixdN(PhaseGEUnifac phase) {
setQMixdN(new double[phase.getNumberOfComponents()]);
diff --git a/src/main/java/neqsim/thermo/characterization/CharacteriseInterface.java b/src/main/java/neqsim/thermo/characterization/CharacteriseInterface.java
index 279e754cb0..f793bc5aba 100644
--- a/src/main/java/neqsim/thermo/characterization/CharacteriseInterface.java
+++ b/src/main/java/neqsim/thermo/characterization/CharacteriseInterface.java
@@ -120,7 +120,7 @@ public interface CharacteriseInterface {
* getCoefs.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getCoefs();
@@ -166,7 +166,7 @@ public interface CharacteriseInterface {
* getPlusCoefs.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getPlusCoefs();
@@ -185,7 +185,7 @@ public interface CharacteriseInterface {
* setPlusCoefs.
*
*
- * @param plusCoefs an array of {@link double} objects
+ * @param plusCoefs an array of type double
*/
public void setPlusCoefs(double[] plusCoefs);
@@ -239,7 +239,7 @@ public interface CharacteriseInterface {
* setCoefs.
*
*
- * @param coefs an array of {@link double} objects
+ * @param coefs an array of type double
*/
public void setCoefs(double[] coefs);
diff --git a/src/main/java/neqsim/thermo/characterization/PlusFractionModelInterface.java b/src/main/java/neqsim/thermo/characterization/PlusFractionModelInterface.java
index 4b760e17eb..df08e6fa83 100644
--- a/src/main/java/neqsim/thermo/characterization/PlusFractionModelInterface.java
+++ b/src/main/java/neqsim/thermo/characterization/PlusFractionModelInterface.java
@@ -122,7 +122,7 @@ public interface PlusFractionModelInterface extends java.io.Serializable {
* getZ.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getZ();
@@ -131,7 +131,7 @@ public interface PlusFractionModelInterface extends java.io.Serializable {
* getM.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getM();
@@ -140,7 +140,7 @@ public interface PlusFractionModelInterface extends java.io.Serializable {
* getDens.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getDens();
@@ -149,7 +149,7 @@ public interface PlusFractionModelInterface extends java.io.Serializable {
* getCoefs.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getCoefs();
diff --git a/src/main/java/neqsim/thermo/characterization/WaxModelInterface.java b/src/main/java/neqsim/thermo/characterization/WaxModelInterface.java
index 9e73bffc8a..5775e008db 100644
--- a/src/main/java/neqsim/thermo/characterization/WaxModelInterface.java
+++ b/src/main/java/neqsim/thermo/characterization/WaxModelInterface.java
@@ -30,7 +30,7 @@ public interface WaxModelInterface extends java.io.Serializable, Cloneable {
* setWaxParameters.
*
*
- * @param parameters an array of {@link double} objects
+ * @param parameters an array of type double
*/
public void setWaxParameters(double[] parameters);
@@ -39,7 +39,7 @@ public interface WaxModelInterface extends java.io.Serializable, Cloneable {
* getWaxParameters.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getWaxParameters();
@@ -68,7 +68,7 @@ public interface WaxModelInterface extends java.io.Serializable, Cloneable {
* setParameterWaxHeatOfFusion.
*
*
- * @param parameterWaxHeatOfFusion an array of {@link double} objects
+ * @param parameterWaxHeatOfFusion an array of type double
*/
public void setParameterWaxHeatOfFusion(double[] parameterWaxHeatOfFusion);
@@ -84,7 +84,7 @@ public interface WaxModelInterface extends java.io.Serializable, Cloneable {
* getParameterWaxHeatOfFusion.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getParameterWaxHeatOfFusion();
@@ -93,7 +93,7 @@ public interface WaxModelInterface extends java.io.Serializable, Cloneable {
* getParameterWaxTriplePointTemperature.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getParameterWaxTriplePointTemperature();
@@ -102,7 +102,7 @@ public interface WaxModelInterface extends java.io.Serializable, Cloneable {
* setParameterWaxTriplePointTemperature.
*
*
- * @param parameterWaxTriplePointTemperature an array of {@link double} objects
+ * @param parameterWaxTriplePointTemperature an array of type double
*/
public void setParameterWaxTriplePointTemperature(double[] parameterWaxTriplePointTemperature);
diff --git a/src/main/java/neqsim/thermo/component/Component.java b/src/main/java/neqsim/thermo/component/Component.java
index 2ff33ace06..befcaffbc5 100644
--- a/src/main/java/neqsim/thermo/component/Component.java
+++ b/src/main/java/neqsim/thermo/component/Component.java
@@ -1567,7 +1567,7 @@ public final double[] getMatiascopemanParams() {
* Getter for the field matiascopemanParamsPR
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public final double[] getMatiascopemanParamsPR() {
return matiascopemanParamsPR;
diff --git a/src/main/java/neqsim/thermo/component/ComponentCPAInterface.java b/src/main/java/neqsim/thermo/component/ComponentCPAInterface.java
index 2f5567e21a..1f0ee6d24d 100644
--- a/src/main/java/neqsim/thermo/component/ComponentCPAInterface.java
+++ b/src/main/java/neqsim/thermo/component/ComponentCPAInterface.java
@@ -16,7 +16,7 @@ public interface ComponentCPAInterface extends ComponentEosInterface {
* getXsite.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getXsite();
@@ -25,7 +25,7 @@ public interface ComponentCPAInterface extends ComponentEosInterface {
* getXsiteOld.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getXsiteOld();
@@ -34,7 +34,7 @@ public interface ComponentCPAInterface extends ComponentEosInterface {
* getXsitedT.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getXsitedT();
@@ -43,7 +43,7 @@ public interface ComponentCPAInterface extends ComponentEosInterface {
* getXsitedTdT.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getXsitedTdT();
@@ -83,7 +83,7 @@ public interface ComponentCPAInterface extends ComponentEosInterface {
* getXsitedV.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getXsitedV();
diff --git a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java
index 2da73b3e50..4b62e6cc26 100644
--- a/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java
+++ b/src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java
@@ -70,7 +70,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
*/
public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature,
diff --git a/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java b/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java
index 7c2ded05f7..cde1830079 100644
--- a/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java
+++ b/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPA.java
@@ -571,7 +571,7 @@ public double[] getXsiteOld() {
/**
* Setter for property xsite.
*
- * @param xsiteOld an array of {@link double} objects
+ * @param xsiteOld an array of type double
*/
public void setXsiteOld(double[] xsiteOld) {
this.xsiteOld = xsiteOld;
diff --git a/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPAOld.java b/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPAOld.java
index a21bd4b344..8405866e56 100644
--- a/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPAOld.java
+++ b/src/main/java/neqsim/thermo/component/ComponentElectrolyteCPAOld.java
@@ -377,7 +377,7 @@ public double[] getXsiteOld() {
/**
* Setter for property xsite.
*
- * @param xsiteOld an array of {@link double} objects
+ * @param xsiteOld an array of type double
*/
public void setXsiteOld(double[] xsiteOld) {
this.xsiteOld = xsiteOld;
diff --git a/src/main/java/neqsim/thermo/component/ComponentEosInterface.java b/src/main/java/neqsim/thermo/component/ComponentEosInterface.java
index 5dccf077fc..1e44427f9b 100644
--- a/src/main/java/neqsim/thermo/component/ComponentEosInterface.java
+++ b/src/main/java/neqsim/thermo/component/ComponentEosInterface.java
@@ -180,7 +180,7 @@ public interface ComponentEosInterface extends ComponentInterface {
* getDeltaEosParameters.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getDeltaEosParameters();
diff --git a/src/main/java/neqsim/thermo/component/ComponentGEInterface.java b/src/main/java/neqsim/thermo/component/ComponentGEInterface.java
index 1be6925d2c..bf09d8b862 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGEInterface.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGEInterface.java
@@ -27,10 +27,10 @@ public interface ComponentGEInterface extends ComponentInterface {
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
- * @param HValpha an array of {@link double} objects
- * @param HVgij an array of {@link double} objects
- * @param intparam an array of {@link double} objects
+ * @param pt the PhaseType of the phase
+ * @param HValpha an array of type double
+ * @param HVgij an array of type double
+ * @param intparam an array of type double
* @param mixRule an array of {@link java.lang.String} objects
* @return a double
*/
diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java
index 452a498f44..be1f98c343 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedHV.java
@@ -53,11 +53,11 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
- * @param HValpha an array of {@link double} objects
- * @param HVgij an array of {@link double} objects
- * @param HVgijT an array of {@link double} objects
- * @param intparam an array of {@link double} objects
+ * @param pt the PhaseType of the phase
+ * @param HValpha an array of type double
+ * @param HVgij an array of type double
+ * @param HVgijT an array of type double
+ * @param intparam an array of type double
* @param mixRule an array of {@link java.lang.String} objects
* @return a double
*/
diff --git a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java
index 65b12537ff..aa37b657f3 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGENRTLmodifiedWS.java
@@ -59,11 +59,11 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
- * @param WSalpha an array of {@link double} objects
- * @param WSgij an array of {@link double} objects
- * @param WSgijT an array of {@link double} objects
- * @param intparam an array of {@link double} objects
+ * @param pt the PhaseType of the phase
+ * @param WSalpha an array of type double
+ * @param WSgij an array of type double
+ * @param WSgijT an array of type double
+ * @param intparam an array of type double
* @param mixRule an array of {@link java.lang.String} objects
* @return a double
*/
diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java
index 80bd562ca2..b2bd488f15 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGEUnifacUMRPRU.java
@@ -519,7 +519,7 @@ public void calcUnifacGroupParamsdT(PhaseInterface phase) {
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
*/
public void calcGammaNumericalDerivatives(PhaseInterface phase, int numberOfComponents,
double temperature, double pressure, PhaseType pt) {
diff --git a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java
index 2178437dae..752a6746e2 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGEUniquac.java
@@ -76,7 +76,7 @@ public ComponentGEUniquac(String name, double moles, double molesInPhase, int co
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return Fugacity coefficient
*/
public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature,
@@ -103,7 +103,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
*/
public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature,
@@ -162,7 +162,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
*/
public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, double temperature,
@@ -181,7 +181,7 @@ public double fugcoefDiffPres(PhaseInterface phase, int numberOfComponents, doub
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
*/
public double fugcoefDiffTemp(PhaseInterface phase, int numberOfComponents, double temperature,
diff --git a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java
index bc10dbc7f5..6d5aaf3455 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java
@@ -39,7 +39,7 @@ public ComponentGEWilson(String name, double moles, double molesInPhase, int com
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return Fugacity coefficient
*/
public double fugcoef(PhaseInterface phase, int numberOfComponents, double temperature,
@@ -58,7 +58,7 @@ public double fugcoef(PhaseInterface phase, int numberOfComponents, double tempe
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
*/
public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature,
diff --git a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java
index cf72d8c022..e163d5cfc2 100644
--- a/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java
+++ b/src/main/java/neqsim/thermo/component/ComponentGeDuanSun.java
@@ -42,9 +42,9 @@ public ComponentGeDuanSun(String name, double moles, double molesInPhase, int co
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
- * @param HValpha an array of {@link double} objects
- * @param HVgij an array of {@link double} objects
+ * @param pt the PhaseType of the phase
+ * @param HValpha an array of type double
+ * @param HVgij an array of type double
* @return a double
*/
public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature,
@@ -75,9 +75,9 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
- * @param HValpha an array of {@link double} objects
- * @param HVgij an array of {@link double} objects
+ * @param pt the PhaseType of the phase
+ * @param HValpha an array of type double
+ * @param HVgij an array of type double
* @return a double
*/
public double getGammaNRTL(PhaseInterface phase, int numberOfComponents, double temperature,
@@ -456,7 +456,7 @@ public double fugcoef(PhaseInterface phase) {
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @param salinity a double
* @return a double
*/
diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrate.java b/src/main/java/neqsim/thermo/component/ComponentHydrate.java
index f95b061fb2..833d1e19fa 100644
--- a/src/main/java/neqsim/thermo/component/ComponentHydrate.java
+++ b/src/main/java/neqsim/thermo/component/ComponentHydrate.java
@@ -476,7 +476,7 @@ public double delt(double n, double radius, int struccture, int cavityType,
* Getter for the field dGfHydrate
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getDGfHydrate() {
return dGfHydrate;
@@ -487,7 +487,7 @@ public double[] getDGfHydrate() {
* Setter for the field dGfHydrate
.
*
*
- * @param dGfHydrate an array of {@link double} objects
+ * @param dGfHydrate an array of type double
*/
public void setDGfHydrate(double[] dGfHydrate) {
this.dGfHydrate = dGfHydrate;
@@ -510,7 +510,7 @@ public void setDGfHydrate(double dGfHydrate, int i) {
* Getter for the field dHfHydrate
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getDHfHydrate() {
return dHfHydrate;
@@ -533,7 +533,7 @@ public void setDHfHydrate(double dHfHydrate, int i) {
* Setter for the field dHfHydrate
.
*
*
- * @param dHfHydrate an array of {@link double} objects
+ * @param dHfHydrate an array of type double
*/
public void setDHfHydrate(double[] dHfHydrate) {
this.dHfHydrate = dHfHydrate;
@@ -730,7 +730,7 @@ public double getCavprwat(int structure, int cavityType) {
* Getter for the field cavprwat
.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getCavprwat() {
return cavprwat;
diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java
index 77d08084db..16823d7686 100644
--- a/src/main/java/neqsim/thermo/component/ComponentInterface.java
+++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java
@@ -535,7 +535,7 @@ public double fugcoefDiffTempNumeric(PhaseInterface phase, int numberOfComponent
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] logfugcoefdN(PhaseInterface phase);
@@ -1550,7 +1550,7 @@ public default double getLogFugacityCoefficient() {
* getSchwartzentruberParams.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getSchwartzentruberParams();
@@ -1569,7 +1569,7 @@ public default double getLogFugacityCoefficient() {
* getTwuCoonParams.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getTwuCoonParams();
@@ -1693,7 +1693,7 @@ public default double getLogFugacityCoefficient() {
* getMatiascopemanParams.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getMatiascopemanParams();
@@ -1712,7 +1712,7 @@ public default double getLogFugacityCoefficient() {
* setMatiascopemanParams.
*
*
- * @param matiascopemanParams an array of {@link double} objects
+ * @param matiascopemanParams an array of type double
*/
public void setMatiascopemanParams(double[] matiascopemanParams);
@@ -1961,7 +1961,7 @@ public default double getLogFugacityCoefficient() {
* getHenryCoefParameter.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getHenryCoefParameter();
@@ -1970,7 +1970,7 @@ public default double getLogFugacityCoefficient() {
* setHenryCoefParameter.
*
*
- * @param henryCoefParameter an array of {@link double} objects
+ * @param henryCoefParameter an array of type double
*/
public void setHenryCoefParameter(double[] henryCoefParameter);
@@ -2000,7 +2000,7 @@ public default double getLogFugacityCoefficient() {
* getMatiascopemanSolidParams.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getMatiascopemanSolidParams();
diff --git a/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java b/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java
index 0b1d6a5164..370db747b4 100644
--- a/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java
+++ b/src/main/java/neqsim/thermo/component/ComponentPCSAFTa.java
@@ -280,7 +280,7 @@ public double[] getXsiteOld() {
/**
* Setter for property xsite.
*
- * @param xsiteOld an array of {@link double} objects
+ * @param xsiteOld an array of type double
*/
public void setXsiteOld(double[] xsiteOld) {
this.xsiteOld = xsiteOld;
diff --git a/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java b/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java
index 42d75980c9..37649b61d7 100644
--- a/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java
+++ b/src/main/java/neqsim/thermo/component/ComponentSrkCPA.java
@@ -573,7 +573,7 @@ public double[] getXsiteOld() {
/**
* Setter for property xsite.
*
- * @param xsiteOld an array of {@link double} objects
+ * @param xsiteOld an array of type double
*/
public void setXsiteOld(double[] xsiteOld) {
this.xsiteOld = xsiteOld;
diff --git a/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java b/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java
index 4b34d043bf..84c59ec625 100644
--- a/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java
+++ b/src/main/java/neqsim/thermo/component/ComponentUMRCPA.java
@@ -575,7 +575,7 @@ public double[] getXsiteOld() {
/**
* Setter for property xsite.
*
- * @param xsiteOld an array of {@link double} objects
+ * @param xsiteOld an array of type double
*/
public void setXsiteOld(double[] xsiteOld) {
this.xsiteOld = xsiteOld;
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AtractiveTermMatCopPRUMRNew.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AtractiveTermMatCopPRUMRNew.java
index 13e126c281..d2acf67d07 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AtractiveTermMatCopPRUMRNew.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AtractiveTermMatCopPRUMRNew.java
@@ -36,7 +36,7 @@ public AtractiveTermMatCopPRUMRNew(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AtractiveTermMatCopPRUMRNew(ComponentEosInterface component, double[] params) {
this(component);
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCop.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCop.java
index abba15d977..c99ffc08b9 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCop.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCop.java
@@ -34,7 +34,7 @@ public AttractiveTermMatCop(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AttractiveTermMatCop(ComponentEosInterface component, double[] params) {
this(component);
@@ -103,14 +103,14 @@ public double diffalphaT(double temperature) {
public double diffdiffalphaT(double temperature) {
double Tr = temperature / getComponent().getTC();
double TC = getComponent().getTC();
- return 2.0 * Math.pow(-parameters[0] / Math.sqrt(Tr) / TC / 2.0
- - parameters[1] * (1.0 - Math.sqrt(Tr)) / Math.sqrt(Tr) / TC
+ return 2.0
+ * Math.pow(-parameters[0] / Math.sqrt(Tr) / TC / 2.0
+ - parameters[1] * (1.0 - Math.sqrt(Tr)) / Math.sqrt(Tr) / TC
- 3.0 / 2.0 * parameters[2] * Math.pow(1.0 - Math.sqrt(Tr), 2.0) / Math.sqrt(Tr) / TC,
2.0)
- + 2.0
- * (1.0 + parameters[0] * (1.0 - Math.sqrt(Tr))
- + parameters[1] * Math.pow(1.0 - Math.sqrt(Tr), 2.0)
- + parameters[2] * Math.pow(1.0 - Math.sqrt(Tr), 3.0))
+ + 2.0 * (1.0 + parameters[0] * (1.0 - Math.sqrt(Tr))
+ + parameters[1] * Math.pow(1.0 - Math.sqrt(Tr), 2.0)
+ + parameters[2] * Math.pow(1.0 - Math.sqrt(Tr), 3.0))
* (parameters[0] / Math.sqrt(Tr * Tr * Tr) / (TC * TC) / 4.0
+ parameters[1] / temperature / TC / 2.0
+ parameters[1] * (1.0 - Math.sqrt(Tr)) / Math.sqrt(Tr * Tr * Tr) / (TC * TC) / 2.0
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPR.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPR.java
index 2ac6c10d03..fbda40b094 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPR.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPR.java
@@ -46,7 +46,7 @@ public AttractiveTermMatCopPR(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AttractiveTermMatCopPR(ComponentEosInterface component, double[] params) {
this(component);
@@ -136,7 +136,8 @@ public double diffdiffalphaT(double temperature) {
double Tr = temperature / getComponent().getTC();
double TC = getComponent().getTC();
double rootTR = 1.0 - Math.sqrt(Tr);
- return 2.0 * Math.pow(
+ return 2.0
+ * Math.pow(
-parameters[0] / Math.sqrt(Tr) / TC / 2.0 - parameters[1] * rootTR / Math.sqrt(Tr) / TC
- 3.0 / 2.0 * parameters[2] * rootTR * rootTR / Math.sqrt(Tr) / TC,
2.0)
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPRUMR.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPRUMR.java
index 33afef6ed2..dd48e4f4de 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPRUMR.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMatCopPRUMR.java
@@ -47,7 +47,7 @@ public AttractiveTermMatCopPRUMR(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AttractiveTermMatCopPRUMR(ComponentEosInterface component, double[] params) {
this(component);
@@ -136,14 +136,14 @@ public double diffdiffalphaT(double temperature) {
double Tr = temperature / getComponent().getTC();
double TC = getComponent().getTC();
- return 2.0 * Math.pow(-parameters[0] / Math.sqrt(Tr) / TC / 2.0
- - parameters[1] * (1.0 - Math.sqrt(Tr)) / Math.sqrt(Tr) / TC
+ return 2.0
+ * Math.pow(-parameters[0] / Math.sqrt(Tr) / TC / 2.0
+ - parameters[1] * (1.0 - Math.sqrt(Tr)) / Math.sqrt(Tr) / TC
- 3.0 / 2.0 * parameters[2] * Math.pow(1.0 - Math.sqrt(Tr), 2.0) / Math.sqrt(Tr) / TC,
2.0)
- + 2.0
- * (1.0 + parameters[0] * (1.0 - Math.sqrt(Tr))
- + parameters[1] * Math.pow(1.0 - Math.sqrt(Tr), 2.0)
- + parameters[2] * Math.pow(1.0 - Math.sqrt(Tr), 3.0))
+ + 2.0 * (1.0 + parameters[0] * (1.0 - Math.sqrt(Tr))
+ + parameters[1] * Math.pow(1.0 - Math.sqrt(Tr), 2.0)
+ + parameters[2] * Math.pow(1.0 - Math.sqrt(Tr), 3.0))
* (parameters[0] / Math.sqrt(Tr * Tr * Tr) / (TC * TC) / 4.0
+ parameters[1] / temperature / TC / 2.0
+ parameters[1] * (1.0 - Math.sqrt(Tr)) / Math.sqrt(Tr * Tr * Tr) / (TC * TC) / 2.0
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMollerup.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMollerup.java
index b447d46f39..6b0d436642 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMollerup.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermMollerup.java
@@ -30,7 +30,7 @@ public AttractiveTermMollerup(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AttractiveTermMollerup(ComponentEosInterface component, double[] params) {
this(component);
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermSchwartzentruber.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermSchwartzentruber.java
index 8f3411780c..38cad498c5 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermSchwartzentruber.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermSchwartzentruber.java
@@ -35,7 +35,7 @@ public AttractiveTermSchwartzentruber(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AttractiveTermSchwartzentruber(ComponentEosInterface component, double[] params) {
this(component);
@@ -72,9 +72,11 @@ public double alpha(double temperature) {
// parameters[0]*(1.0-temperature/component.getTC()) *
// (1.0+parameters[1]*temperature/component.getTC()+parameters[2] *
// Math.pow(temperature/component.getTC(),2.0)),2.0));
- return Math.pow(1.0 + m * (1.0 - Math.sqrt(temperature / getComponent().getTC()))
- - parameters[0] * (1.0 - temperature / getComponent().getTC())
- * (1.0 + parameters[1] * temperature / getComponent().getTC()
+ return Math
+ .pow(
+ 1.0 + m * (1.0 - Math.sqrt(temperature / getComponent().getTC()))
+ - parameters[0] * (1.0 - temperature / getComponent().getTC())
+ * (1.0 + parameters[1] * temperature / getComponent().getTC()
+ parameters[2] * Math.pow(temperature / getComponent().getTC(), 2.0)),
2.0);
}
@@ -150,8 +152,9 @@ public double diffalphaT(double temperature) {
/** {@inheritDoc} */
@Override
public double diffdiffalphaT(double temperature) {
- return 2.0 * Math.pow(-m / Math.sqrt(temperature / getComponent().getTC())
- / getComponent().getTC() / 2.0
+ return 2.0
+ * Math
+ .pow(-m / Math.sqrt(temperature / getComponent().getTC()) / getComponent().getTC() / 2.0
+ parameters[0] / getComponent().getTC()
* (1.0 + parameters[1] * temperature / getComponent().getTC()
+ parameters[2] * temperature * temperature
@@ -161,11 +164,11 @@ public double diffdiffalphaT(double temperature) {
/ (getComponent().getTC() * getComponent().getTC())),
2.0)
+ 2.0
- * (1.0 + m * (1.0 - Math.sqrt(temperature / getComponent().getTC()))
- - parameters[0] * (1.0 - temperature / getComponent().getTC())
- * (1.0 + parameters[1] * temperature / getComponent().getTC()
- + parameters[2] * temperature * temperature
- / (getComponent().getTC() * getComponent().getTC())))
+ * (1.0 + m * (1.0 - Math.sqrt(temperature / getComponent().getTC())) - parameters[0]
+ * (1.0 - temperature / getComponent().getTC())
+ * (1.0 + parameters[1] * temperature / getComponent().getTC()
+ + parameters[2] * temperature * temperature
+ / (getComponent().getTC() * getComponent().getTC())))
* (m / Math.sqrt(temperature * temperature * temperature
/ (getComponent().getTC() * getComponent().getTC() * getComponent().getTC()))
/ (getComponent().getTC() * getComponent().getTC()) / 4.0
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonParam.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonParam.java
index 628c0f2120..264ebfbcd8 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonParam.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonParam.java
@@ -37,7 +37,7 @@ public AttractiveTermTwuCoonParam(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AttractiveTermTwuCoonParam(ComponentEosInterface component, double[] params) {
this(component);
diff --git a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonStatoil.java b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonStatoil.java
index f609c5d93b..59a0567663 100644
--- a/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonStatoil.java
+++ b/src/main/java/neqsim/thermo/component/attractiveEosTerm/AttractiveTermTwuCoonStatoil.java
@@ -37,7 +37,7 @@ public AttractiveTermTwuCoonStatoil(ComponentEosInterface component) {
*
*
* @param component a {@link neqsim.thermo.component.ComponentEosInterface} object
- * @param params an array of {@link double} objects
+ * @param params an array of type double
*/
public AttractiveTermTwuCoonStatoil(ComponentEosInterface component, double[] params) {
this(component);
diff --git a/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java b/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java
index 2bb1ff7a40..7cd7faa3bf 100644
--- a/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java
+++ b/src/main/java/neqsim/thermo/mixingRule/EosMixingRules.java
@@ -2605,7 +2605,7 @@ public void setMixingRuleGEModel(java.lang.String GEmodel) {
* getSRKbinaryInteractionParameters.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getSRKbinaryInteractionParameters() {
return intparam;
diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java
index b6e8b3f19f..2f71cc4bd3 100644
--- a/src/main/java/neqsim/thermo/phase/Phase.java
+++ b/src/main/java/neqsim/thermo/phase/Phase.java
@@ -1961,7 +1961,7 @@ public double getFugacity(String compName) {
* groupTBPfractions.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] groupTBPfractions() {
double[] TPBfrac = new double[20];
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
index 4ad343af5e..76413838c0 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
@@ -121,7 +121,7 @@ public double getAij(int i, int j) {
* Setter for the field aij
.
*
*
- * @param alpha an array of {@link double} objects
+ * @param alpha an array of type double
*/
public void setAij(double[][] alpha) {
for (int i = 0; i < alpha.length; i++) {
@@ -134,7 +134,7 @@ public void setAij(double[][] alpha) {
* Setter for the field bij
.
*
*
- * @param Bij an array of {@link double} objects
+ * @param Bij an array of type double
*/
public void setBij(double[][] Bij) {
for (int i = 0; i < Bij.length; i++) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java
index e03723fce0..a1e4f3a556 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java
@@ -827,7 +827,7 @@ public double getGcpa() {
* calcRootVolFinder.
*
*
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
*/
public double calcRootVolFinder(PhaseType pt) {
@@ -1169,7 +1169,7 @@ public double molarVolume(double pressure, double temperature, double A, double
* @param temperature a double
* @param A a double
* @param B a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
* @throws neqsim.util.exception.IsNaNException if any.
* @throws neqsim.util.exception.TooManyIterationsException if any.
@@ -1357,9 +1357,9 @@ public int getCrossAssosiationScheme(int comp1, int comp2, int site1, int site2)
* croeneckerProduct.
*
*
- * @param a an array of {@link double} objects
- * @param b an array of {@link double} objects
- * @return an array of {@link double} objects
+ * @param a an array of type double
+ * @param b an array of type double
+ * @return an array of type double
*/
public double[][] croeneckerProduct(double[][] a, double[][] b) {
int aLength = a.length;
diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java
index 512a9ab16d..1658ef37ee 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java
@@ -536,7 +536,7 @@ public double getGcpa() {
* @param temperature a double
* @param A a double
* @param B a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
* @throws neqsim.util.exception.IsNaNException if any.
* @throws neqsim.util.exception.TooManyIterationsException if any.
diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java
index c189ae82e1..b867fb167f 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseEos.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java
@@ -192,20 +192,21 @@ public void resetMixingRule(int type) {
* molarVolume2.
*
*
- * @param pressure a double
+ * @param pressure a double
* @param temperature a double
- * @param A a double
- * @param B a double
- * @param pt the PhaseType of the phase.
+ * @param A a double
+ * @param B a double
+ * @param pt the PhaseType of the phase
* @return a double
- * @throws neqsim.util.exception.IsNaNException if any.
+ * @throws neqsim.util.exception.IsNaNException if any.
* @throws neqsim.util.exception.TooManyIterationsException if any.
*/
public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt)
throws neqsim.util.exception.IsNaNException,
neqsim.util.exception.TooManyIterationsException {
- double BonV = pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature())
- : pressure * getB() / (numberOfMolesInPhase * temperature * R);
+ double BonV =
+ pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature())
+ : pressure * getB() / (numberOfMolesInPhase * temperature * R);
if (BonV < 0) {
BonV = 0.0;
}
@@ -288,8 +289,9 @@ public double molarVolume2(double pressure, double temperature, double A, double
public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
throws neqsim.util.exception.IsNaNException,
neqsim.util.exception.TooManyIterationsException {
- double BonV = pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature())
- : pressure * getB() / (numberOfMolesInPhase * temperature * R);
+ double BonV =
+ pt == PhaseType.LIQUID ? 2.0 / (2.0 + temperature / getPseudoCriticalTemperature())
+ : pressure * getB() / (numberOfMolesInPhase * temperature * R);
if (BonV < 0) {
BonV = 1.0e-4;
@@ -437,10 +439,10 @@ public double calcAi(int compNumb, PhaseInterface phase, double temperature, dou
* calcAT.
*
*
- * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
+ * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param temperature a double
- * @param pressure a double
- * @param numbcomp a int
+ * @param pressure a double
+ * @param numbcomp a int
* @return a double
*/
public double calcAT(PhaseInterface phase, double temperature, double pressure, int numbcomp) {
@@ -453,10 +455,10 @@ public double calcAT(PhaseInterface phase, double temperature, double pressure,
* calcATT.
*
*
- * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
+ * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param temperature a double
- * @param pressure a double
- * @param numbcomp a int
+ * @param pressure a double
+ * @param numbcomp a int
* @return a double
*/
public double calcATT(PhaseInterface phase, double temperature, double pressure, int numbcomp) {
@@ -1053,7 +1055,7 @@ public double getdUdSdVn(PhaseInterface phase) {
* getdTVndSVnJaobiMatrix.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getdTVndSVnJaobiMatrix() {
double[][] jacobiMatrix = new double[2 + numberOfComponents][2 + numberOfComponents];
@@ -1076,7 +1078,7 @@ public double[][] getdTVndSVnJaobiMatrix() {
* getGradientVector.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getGradientVector() {
double[] gradientVector = new double[2 + numberOfComponents];
@@ -1090,7 +1092,7 @@ public double[] getGradientVector() {
* getUSVHessianMatrix.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] getUSVHessianMatrix() {
double[][] jacobiMatrix = new double[2 + numberOfComponents][2 + numberOfComponents];
@@ -1113,7 +1115,7 @@ public double[][] getUSVHessianMatrix() {
* dFdxMatrixSimple.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] dFdxMatrixSimple() {
double[] matrix = new double[numberOfComponents + 2];
@@ -1144,7 +1146,7 @@ public double[] dFdxMatrixSimple() {
* dFdxMatrix.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] dFdxMatrix() {
double[] matrix = new double[numberOfComponents + 2];
@@ -1163,7 +1165,7 @@ public double[] dFdxMatrix() {
* dFdxdxMatrixSimple.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] dFdxdxMatrixSimple() {
double[][] matrix = new double[numberOfComponents + 2][numberOfComponents + 2];
@@ -1198,7 +1200,8 @@ public double[][] dFdxdxMatrixSimple() {
}
for (int i = 0; i < numberOfComponents; i++) {
- matrix[i][numberOfComponents] = (FBT + FBD * AT) * Bi[i] + FDT * Ai[i] + FD * componentArray[i].getAiT(); // dFdndT
+ matrix[i][numberOfComponents] =
+ (FBT + FBD * AT) * Bi[i] + FDT * Ai[i] + FD * componentArray[i].getAiT(); // dFdndT
matrix[numberOfComponents][i] = matrix[i][numberOfComponents];
matrix[i][numberOfComponents + 1] = FnV + FBV * Bi[i] + FDV * Ai[i]; // dFdndV
@@ -1212,7 +1215,7 @@ public double[][] dFdxdxMatrixSimple() {
* dFdxdxMatrix.
*
*
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[][] dFdxdxMatrix() {
double[][] matrix = new double[numberOfComponents + 2][numberOfComponents + 2];
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java
index e3660091e1..974adffbe6 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGE.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java
@@ -51,7 +51,7 @@ public PhaseGE() {
* @param totalNumberOfMoles a double
* @param beta a double
* @param numberOfComponents a int
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @param phase a int
*/
public void init(double temperature, double pressure, double totalNumberOfMoles, double beta,
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java
index 12d413d3ea..ccb91d60c9 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java
@@ -24,7 +24,7 @@ public interface PhaseGEInterface {
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
* @return a double
*/
public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
@@ -35,7 +35,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
* setAlpha.
*
*
- * @param alpha an array of {@link double} objects
+ * @param alpha an array of type double
*/
public void setAlpha(double[][] alpha);
@@ -44,7 +44,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
* setDij.
*
*
- * @param Dij an array of {@link double} objects
+ * @param Dij an array of type double
*/
public void setDij(double[][] Dij);
@@ -53,7 +53,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents,
* setDijT.
*
*
- * @param DijT an array of {@link double} objects
+ * @param DijT an array of type double
*/
public void setDijT(double[][] DijT);
}
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
index f617eaf3e6..9e4988603b 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
@@ -43,10 +43,10 @@ public PhaseGENRTL() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGENRTL(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule,
double[][] intparam) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
index c92f0c65e4..7117877844 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
@@ -39,10 +39,10 @@ public PhaseGENRTLmodifiedHV() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGENRTLmodifiedHV(PhaseInterface phase, double[][] alpha, double[][] Dij,
String[][] mixRule, double[][] intparam) {
@@ -63,11 +63,11 @@ public PhaseGENRTLmodifiedHV(PhaseInterface phase, double[][] alpha, double[][]
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
- * @param DijT an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
+ * @param DijT an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGENRTLmodifiedHV(PhaseInterface phase, double[][] alpha, double[][] Dij,
double[][] DijT, String[][] mixRule, double[][] intparam) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
index efc0be66cf..5793df3913 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
@@ -29,10 +29,10 @@ public PhaseGENRTLmodifiedWS() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGENRTLmodifiedWS(PhaseInterface phase, double[][] alpha, double[][] Dij,
String[][] mixRule, double[][] intparam) {
@@ -53,11 +53,11 @@ public PhaseGENRTLmodifiedWS(PhaseInterface phase, double[][] alpha, double[][]
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
- * @param DijT an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
+ * @param DijT an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGENRTLmodifiedWS(PhaseInterface phase, double[][] alpha, double[][] Dij,
double[][] DijT, String[][] mixRule, double[][] intparam) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
index 1b5bf36242..84200acb19 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
@@ -42,10 +42,10 @@ public PhaseGEUnifac() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGEUnifac(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule,
double[][] intparam) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
index 840dd8e3c9..4a9f2ac1c9 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
@@ -35,10 +35,10 @@ public PhaseGEUnifacPSRK() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGEUnifacPSRK(PhaseInterface phase, double[][] alpha, double[][] Dij,
String[][] mixRule, double[][] intparam) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
index 68c3d0ede1..06e2b87775 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
@@ -42,10 +42,10 @@ public PhaseGEUnifacUMRPRU() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGEUnifacUMRPRU(PhaseInterface phase, double[][] alpha, double[][] Dij,
String[][] mixRule, double[][] intparam) {
@@ -68,7 +68,7 @@ public PhaseGEUnifacUMRPRU(PhaseInterface phase, double[][] alpha, double[][] Di
* @param numberOfComponents a int
* @param temperature a double
* @param pressure a double
- * @param pt the PhaseType of the phase.
+ * @param pt the PhaseType of the phase
*/
public void calcCommontemp(PhaseInterface phase, int numberOfComponents, double temperature,
double pressure, PhaseType pt) {
@@ -182,7 +182,7 @@ public double getQmix(String name) {
*
*
* @param name a {@link String} object
- * @return an array of {@link double} objects
+ * @return an array of type double
*/
public double[] getQmixdN(String name) {
// int test = ((ComponentGEUnifac) componentArray[0]).getUnifacGroups().length;
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
index a104b865b9..ba4ae00b17 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java
@@ -45,10 +45,10 @@ public PhaseGEUniquac() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGEUniquac(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule,
double[][] intparam) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
index 09ecd1dec2..9c104d2ca3 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java
@@ -34,10 +34,10 @@ public PhaseGEWilson() {
*
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
- * @param alpha an array of {@link double} objects
- * @param Dij an array of {@link double} objects
+ * @param alpha an array of type double
+ * @param Dij an array of type double
* @param mixRule an array of {@link String} objects
- * @param intparam an array of {@link double} objects
+ * @param intparam an array of type double
*/
public PhaseGEWilson(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule,
double[][] intparam) {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java
index 20da727888..a19a7ec570 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java
@@ -24,11 +24,10 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab
* Add component to component array and update moles variables.
*
*
- * @param name Name of component.
- * @param moles Total number of moles of component.
+ * @param name Name of component.
+ * @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
- * @param compIndex Index number of component in phase object component
- * array.
+ * @param compIndex Index number of component in phase object component array.
*/
public void addComponent(String name, double moles, double molesInPhase, int compIndex);
@@ -37,7 +36,7 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab
* setMoleFractions.
*
*
- * @param x an array of {@link double} objects
+ * @param x an array of type double
*/
public void setMoleFractions(double[] x);
@@ -52,12 +51,10 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab
/**
* - * Returns the composition vector in unit - * molefraction/wtfraction/molespersec/volumefraction. + * Returns the composition vector in unit molefraction/wtfraction/molespersec/volumefraction. *
* - * @param unit Supported units are molefraction, wtfraction, molespersec, - * volumefraction + * @param unit Supported units are molefraction, wtfraction, molespersec, volumefraction * @return composition array with unit */ public double[] getComposition(String unit); @@ -96,7 +93,7 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab /** * Returns the mole composition vector in unit mole fraction. * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getMolarComposition(); @@ -123,8 +120,7 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab public double getVolume(String unit); /** - * method to return heat capacity ratio/adiabatic index/Poisson constant. The - * method calculates it + * method to return heat capacity ratio/adiabatic index/Poisson constant. The method calculates it * as Cp (real) /Cv (real). * * @return gamma @@ -132,8 +128,7 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab public double getGamma(); /** - * method to return heat capacity ratio calculated as - * Cp/(Cp-R*getNumberOfMolesInPhase). + * method to return heat capacity ratio calculated as Cp/(Cp-R*getNumberOfMolesInPhase). * * @return kappa */ @@ -231,8 +226,8 @@ public default void init() { * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param initType a int. Use 0 to init, and 1 to reset. - * @param beta Mole fraction of this phase in system. + * @param initType a int. Use 0 to init, and 1 to reset. + * @param beta Mole fraction of this phase in system. */ public default void init(double totalNumberOfMoles, int numberOfComponents, int initType, double beta) { @@ -246,9 +241,9 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param initType a int. Use 0 to init, and 1 to reset. - * @param pt Type of phase. - * @param beta Mole fraction of this phase in system. + * @param initType a int. Use 0 to init, and 1 to reset. + * @param pt Type of phase. + * @param beta Mole fraction of this phase in system. */ public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt, double beta); @@ -337,8 +332,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * Get component array of Phase. * * - * @return an array of {@link neqsim.thermo.component.ComponentInterface} - * objects + * @return an array of {@link neqsim.thermo.component.ComponentInterface} objects */ public ComponentInterface[] getcomponentArray(); @@ -369,16 +363,14 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType public double getWtFraction(SystemInterface system); /** - * method to return molar volume of the phase note: without Peneloux volume - * correction. + * method to return molar volume of the phase note: without Peneloux volume correction. * * @return molar volume volume in unit m3/mol*1e5 */ public double getMolarVolume(); /** - * method to return molar volume of the fluid: eventual volume correction - * included. + * method to return molar volume of the fluid: eventual volume correction included. * * @param unit Supported units are m3/mol, litre/mol * @return molar volume volume in unit @@ -388,9 +380,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType /** * method to return flow rate of a phase. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, - * m3/hr, ft3/sec, - * mole/sec, mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, m3/hr, ft3/sec, + * mole/sec, mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -400,8 +391,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * setComponentArray. * * - * @param components an array of - * {@link neqsim.thermo.component.ComponentInterface} objects + * @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects */ public void setComponentArray(ComponentInterface[] components); @@ -417,13 +407,12 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * method to get GERG properties of a phase using the GERG-2008 EoS. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getProperties_GERG2008(); /** - * method to get density of a phase note: does not use Peneloux volume - * correction. + * method to get density of a phase note: does not use Peneloux volume correction. * * @return density with unit kg/m3 */ @@ -442,8 +431,8 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * Remove component from Phase. * * - * @param name Name of component. - * @param moles Total number of moles of component. + * @param name Name of component. + * @param moles Total number of moles of component. * @param molesInPhase Number of moles in phase. */ public void removeComponent(String name, double moles, double molesInPhase); @@ -586,8 +575,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType /** *
- * Getter for property beta
. Beta is the mole fraction of a phase
- * of all the moles of
+ * Getter for property beta
. Beta is the mole fraction of a phase of all the moles of
* a system.
*
- * Setter for property beta
. Beta is the mole fraction of a phase
- * of all the moles of
+ * Setter for property beta
. Beta is the mole fraction of a phase of all the moles of
* a system.
*
- * Change the number of moles of component of phase,i.e.,
- * numberOfMolesInPhase
but do
+ * Change the number of moles of component of phase,i.e., numberOfMolesInPhase
but do
* not change the total number of moles of component in system.
*
- * NB! Phase fraction beta
is not updated by this method. Must be
- * done separately to
- * keep consistency between phase and component calculation of total number of
- * moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be done separately to
+ * keep consistency between phase and component calculation of total number of moles in system.
*
- * Change the number of moles of component of phase, i.e.,
- * numberOfMolesInPhase
, and
- * total number of moles of component in system, i.e.,
- * numberOfMoles
with the same
+ * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
, and
+ * total number of moles of component in system, i.e., numberOfMoles
with the same
* amount.
*
- * NB! Phase fraction beta
is not updated by this method. Must be
- * done separately to
- * keep consistency between phase and component calculation of total number of
- * moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be done separately to
+ * keep consistency between phase and component calculation of total number of moles in system.
*
- * Change the number of moles of component of phase, i.e.,
- * numberOfMolesInPhase
and
- * Component
properties for the number of moles of component of
- * phase, i.e.,
- * numberOfMolesInPhase
, and total number of moles of component in
- * system, i.e.,
+ * Change the number of moles of component of phase, i.e., numberOfMolesInPhase
and
+ * Component
properties for the number of moles of component of phase, i.e.,
+ * numberOfMolesInPhase
, and total number of moles of component in system, i.e.,
* numberOfMoles
with separate amounts.
*
- * NB! Phase fraction beta
is not updated by this method. Must be
- * done separately to
- * keep consistency between phase and component calculation of total number of
- * moles in system.
+ * NB! Phase fraction beta
is not updated by this method. Must be done separately to
+ * keep consistency between phase and component calculation of total number of moles in system.
*
- * Get sum of mole fractions for all components. NB! init(0) must be called - * first. + * Get sum of mole fractions for all components. NB! init(0) must be called first. *
* * @return a double @@ -1209,7 +1167,7 @@ public default double getGamma2() { * getNormalBoilingPointTemperatures. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getNormalBoilingPointTemperatures(); @@ -1267,7 +1225,7 @@ public default double getNumberOfMoles() { * getOilFractionLiquidDensityAt25C. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getOilFractionLiquidDensityAt25C(); @@ -1276,7 +1234,7 @@ public default double getNumberOfMoles() { * getOilFractionMolecularMass. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getOilFractionMolecularMass(); @@ -1285,7 +1243,7 @@ public default double getNumberOfMoles() { * getOilFractionNormalBoilingPoints. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getOilFractionNormalBoilingPoints(); @@ -1330,7 +1288,7 @@ public default double getNumberOfMoles() { * method to return phase fraction of selected phase. * * @param phaseTypeName gas/oil/aqueous - * @param unit mole/volume/weight + * @param unit mole/volume/weight * @return phase: fraction in specified unit */ public double getPhaseFraction(String phaseTypeName, String unit); @@ -1386,12 +1344,10 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { } /** - * return the phase of to specified type if the phase does not exist, the method - * will return null. + * return the phase of to specified type if the phase does not exist, the method will return null. * - * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, - * hydrate are - * supported) + * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, hydrate are + * supported) * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ public PhaseInterface getPhaseOfType(String phaseTypeName); @@ -1452,7 +1408,7 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param phase a int * @return a double */ @@ -1463,9 +1419,9 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { * getProperty. * * - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param compName a {@link java.lang.String} object - * @param phase a int + * @param phase a int * @return a double */ public double getProperty(String prop, String compName, int phase); @@ -1480,8 +1436,7 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public String[][] getResultTable(); /** - * method to get the speed of sound of a system. The sound speed is implemented - * based on a molar + * method to get the speed of sound of a system. The sound speed is implemented based on a molar * average over the phases * * @return speed of sound in m/s @@ -1489,8 +1444,7 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public double getSoundSpeed(); /** - * method to get the speed of sound of a system. The sound speed is implemented - * based on a molar + * method to get the speed of sound of a system. The sound speed is implemented based on a molar * average over the phases * * @param unit Supported units are m/s, km/h @@ -1604,8 +1558,7 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public double getVolume(String unit); /** - * method to return the volume fraction of a phase note: without Peneloux volume - * correction. + * method to return the volume fraction of a phase note: without Peneloux volume correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -1641,8 +1594,7 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { public double getWtFraction(int phaseNumber); /** - * method to return compressibility factor of a fluid compressibility factor is - * defined in EoS + * method to return compressibility factor of a fluid compressibility factor is defined in EoS * from PV=ZnRT where V is total volume of fluid. * * @return compressibility factor Z @@ -1659,8 +1611,7 @@ public default int getPhaseNumberOfPhase(String phaseTypeName) { /** * Verify if system has a component. * - * @param name Name of component to look for. NB! Converts name to normalized - * name. + * @param name Name of component to look for. NB! Converts name to normalized name. * @return True if component is found. */ public default boolean hasComponent(String name) { @@ -1670,9 +1621,8 @@ public default boolean hasComponent(String name) { /** * Verify if system has a component. * - * @param name Name of component to look for. - * @param normalized Set true to convert input name to normalized component - * name. + * @param name Name of component to look for. + * @param normalized Set true to convert input name to normalized component name. * @return True if component is found. */ public default boolean hasComponent(String name, boolean normalized) { @@ -1722,8 +1672,7 @@ public default boolean hasSolidPhase() { } /** - * Calculate thermodynamic properties of the fluid using the init type set in - * fluid. + * Calculate thermodynamic properties of the fluid using the init type set in fluid. * * @see getInitType */ @@ -1732,36 +1681,27 @@ public default void init() { } /** - * method to calculate thermodynamic properties of the fluid. The temperature, - * pressure, number of + * method to calculate thermodynamic properties of the fluid. The temperature, pressure, number of * phases and composition of the phases will be used as basis for calculation. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for - * all phases. 1: - * Calculation of density, fugacities and Z-factor 2: 1 + - * calculation of enthalpy, entropy, - * Cp, Cv, and most other thermodynamic properties 3: 1+2 + - * Calculation of composition - * derivatives of fugacity coefficients. + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for all phases. 1: + * Calculation of density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, + * Cp, Cv, and most other thermodynamic properties 3: 1+2 + Calculation of composition + * derivatives of fugacity coefficients. */ public void init(int number); // public void setPressure(double newPressure, int phaseNumber); /** - * method to calculate thermodynamic properties of the selected phase. The - * temperature, pressure, - * number of phases and composition of the phase will be used as basis for - * calculation. + * method to calculate thermodynamic properties of the selected phase. The temperature, pressure, + * number of phases and composition of the phase will be used as basis for calculation. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: - * Calculation of - * density, fugacities and Z-factor 2: 1 + calculation of - * enthalpy, entropy, Cp, Cv, and - * most other thermodynamic properties 3: 1+2 + Calculation of - * composition derivatives of - * fugacity coefficients. - * @param phase a int + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: Calculation of + * density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, Cp, Cv, and + * most other thermodynamic properties 3: 1+2 + Calculation of composition derivatives of + * fugacity coefficients. + * @param phase a int */ public void init(int number, int phase); @@ -1774,8 +1714,7 @@ public default void init() { /** *- * Calculate system beta values using Phase.getNumberOfMolesInPhase and - * getTotalNumberOfMoles. + * Calculate system beta values using Phase.getNumberOfMolesInPhase and getTotalNumberOfMoles. *
*/ public void initBeta(); @@ -1798,8 +1737,7 @@ public default void init() { public void initPhysicalProperties(String propertyName); /** - * Calculates thermodynamic and physical properties of a fluid using - * initThermoProperties() and + * Calculates thermodynamic and physical properties of a fluid using initThermoProperties() and * initPhysicalProperties(). */ public void initProperties(); @@ -2007,7 +1945,7 @@ public default void prettyPrint() { * readObjectFromFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object * @return a {@link neqsim.thermo.system.SystemInterface} object */ @@ -2025,8 +1963,7 @@ public default void prettyPrint() { * removeComponent. * * - * @param name Name of the component to remove. See NeqSim database for - * component in the database. + * @param name Name of the component to remove. See NeqSim database for component in the database. */ public void removeComponent(String name); @@ -2124,7 +2061,7 @@ public default void prettyPrint() { * saveFluid. * * - * @param id a int + * @param id a int * @param text a {@link java.lang.String} object */ public void saveFluid(int id, String text); @@ -2134,7 +2071,7 @@ public default void prettyPrint() { * saveObject. * * - * @param ID a int + * @param ID a int * @param text a {@link java.lang.String} object */ public void saveObject(int ID, String text); @@ -2144,7 +2081,7 @@ public default void prettyPrint() { * saveObjectToFile. * * - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object */ public void saveObjectToFile(String filePath, String fluidName); @@ -2183,8 +2120,7 @@ public default void prettyPrint() { /** *
- * Setter for property beta
. NB! Sets beta = b for first phase and
- * 1-b for second
+ * Setter for property beta
. NB! Sets beta = b for first phase and 1-b for second
* phase, not for multiphase systems.
*
- * This method is used to set the total molar composition of a fluid. The total - * flow rate will be + * This method is used to set the total molar composition of a fluid. The total flow rate will be * kept constant. The input mole fractions will be normalized. *
* - * @param moles an array of {@link double} objects + * @param moles an array of type double */ public void setMolarComposition(double[] moles); /** - * This method is used to set the total molar composition of a characterized - * fluid. The total flow + * This method is used to set the total molar composition of a characterized fluid. The total flow * rate will be kept constant. The input mole fractions will be normalized. * - * @param molefractions is a double array taking the molar fraction of the - * components in the - * fluid. THe last fraction in the array is the total - * molefraction of the characterized - * components. + * @param molefractions is a double array taking the molar fraction of the components in the + * fluid. THe last fraction in the array is the total molefraction of the characterized + * components. */ public void setMolarCompositionOfPlusFluid(double[] molefractions); /** - * This method is used to set the total molar composition of a plus fluid. The - * total flow rate + * This method is used to set the total molar composition of a plus fluid. The total flow rate * will be kept constant. The input mole fractions will be normalized. * - * @param molefractions is a double array taking the molar fraction of the - * components in the - * fluid. THe last molfraction is the mole fraction of the - * plus component + * @param molefractions is a double array taking the molar fraction of the components in the + * fluid. THe last molfraction is the mole fraction of the plus component */ public void setMolarCompositionPlus(double[] molefractions); @@ -2423,20 +2346,16 @@ public void setImplementedTemperatureDeriativesofFugacity( * setMolarFlowRates. * * - * @param moles an array of {@link double} objects + * @param moles an array of type double */ public void setMolarFlowRates(double[] moles); /** - * method to specify if calculations should check for more than two fluid - * phases. + * method to specify if calculations should check for more than two fluid phases. * - * @param doMultiPhaseCheck Specify if the calculations should check for more - * than two fluid - * phases. Default is two fluid phases (gas and - * liquid). If set to true the program will - * check for gas and multiple liquid phases (eg. - * gas-oil-aqueous). + * @param doMultiPhaseCheck Specify if the calculations should check for more than two fluid + * phases. Default is two fluid phases (gas and liquid). If set to true the program will + * check for gas and multiple liquid phases (eg. gas-oil-aqueous). */ public void setMultiPhaseCheck(boolean doMultiPhaseCheck); @@ -2478,8 +2397,7 @@ public void setImplementedTemperatureDeriativesofFugacity( /** *
- * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure
- * and temperature
+ * Set phaseArray[phaseIndex] = phase
. NB! Transfers the pressure and temperature
* from the currently existing phase object at index numb
*
this.phaseIndex[index] = phaseIndex;
*
*
- * @param index a int
+ * @param index a int
* @param phaseIndex a int
*/
public void setPhaseIndex(int index, int phaseIndex);
@@ -2503,7 +2421,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* Change the phase type of a given phase.
*
* @param phaseToChange the phase number of the phase to set phase type
- * @param pt PhaseType to set
+ * @param pt PhaseType to set
*/
public void setPhaseType(int phaseToChange, PhaseType pt);
@@ -2511,7 +2429,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* Change the phase type of a given phase.
*
* @param phaseToChange the phase number of the phase to set phase type
- * @param phaseName String to set
+ * @param phaseName String to set
*/
public void setPhaseType(int phaseToChange, String phaseName);
@@ -2533,7 +2451,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* method to set the pressure of a fluid (same pressure for all phases).
*
* @param newPressure in specified unit
- * @param unit unit can be bar, bara, barg or atm
+ * @param unit unit can be bar, bara, barg or atm
*/
public void setPressure(double newPressure, String unit);
@@ -2588,7 +2506,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
*
*
* @param newTemperature a double
- * @param phaseNumber a int
+ * @param phaseNumber a int
*/
public void setTemperature(double newTemperature, int phaseNumber);
@@ -2596,7 +2514,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
* method to set the temperature of a fluid (same temperature for all phases).
*
* @param newTemperature in specified unit
- * @param unit unit can be C or K (Celsius or Kelvin)
+ * @param unit unit can be C or K (Celsius or Kelvin)
*/
public void setTemperature(double newTemperature, String unit);
@@ -2606,10 +2524,8 @@ public void setImplementedTemperatureDeriativesofFugacity(
*
*
* @param flowRate a double
- * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec,
- * kg/min, kg/hr
- * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr,
- * Sm3/day, idSm3/hr, idSm3/day
+ * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, kg/min, kg/hr
+ * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, Sm3/day, idSm3/hr, idSm3/day
*/
public void setTotalFlowRate(double flowRate, String flowunit);
@@ -2637,7 +2553,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
*
*
* @param model a {@link java.lang.String} object
- * @param val a double
+ * @param val a double
* @param phase a int
*/
public void tuneModel(String model, double val, int phase);
@@ -2656,9 +2572,9 @@ public void setImplementedTemperatureDeriativesofFugacity(
* write.
*
*
- * @param name a {@link java.lang.String} object
+ * @param name a {@link java.lang.String} object
* @param filename a {@link java.lang.String} object
- * @param newfile a boolean
+ * @param newfile a boolean
*/
public void write(String name, String filename, boolean newfile);
@@ -2685,8 +2601,7 @@ public void setImplementedTemperatureDeriativesofFugacity(
/**
* - * toCompJson - return String with json inormation of pure component properties - * of fluid + * toCompJson - return String with json inormation of pure component properties of fluid *
*/ public String toCompJson(); diff --git a/src/main/java/neqsim/thermo/util/GERG/DETAIL.java b/src/main/java/neqsim/thermo/util/GERG/DETAIL.java index 701c7cf55f..9478f8cadb 100644 --- a/src/main/java/neqsim/thermo/util/GERG/DETAIL.java +++ b/src/main/java/neqsim/thermo/util/GERG/DETAIL.java @@ -96,7 +96,7 @@ public double sq(double x) { * MolarMassDetail. * * - * @param x an array of {@link double} objects + * @param x an array of type double * @param Mm a {@link org.netlib.util.doubleW} object */ public void MolarMassDetail(double[] x, doubleW Mm) { @@ -126,7 +126,7 @@ public void MolarMassDetail(double[] x, doubleW Mm) { * * @param T a double * @param D a double - * @param x an array of {@link double} objects + * @param x an array of type double * @param P a {@link org.netlib.util.doubleW} object * @param Z a {@link org.netlib.util.doubleW} object */ @@ -175,7 +175,7 @@ public void PressureDetail(double T, double D, double[] x, doubleW P, doubleW Z) * * @param T a double * @param P a double - * @param x an array of {@link double} objects + * @param x an array of type double * @param D a {@link org.netlib.util.doubleW} object * @param ierr a {@link org.netlib.util.intW} object * @param herr a {@link org.netlib.util.StringW} object @@ -260,7 +260,7 @@ public void DensityDetail(double T, double P, double[] x, doubleW D, intW ierr, * * @param T a double * @param D a double - * @param x an array of {@link double} objects + * @param x an array of type double * @param P a {@link org.netlib.util.doubleW} object * @param Z a {@link org.netlib.util.doubleW} object * @param dPdD a {@link org.netlib.util.doubleW} object diff --git a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java index f73ea75f1c..2422c71b86 100644 --- a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java +++ b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java @@ -71,7 +71,7 @@ public class GERG2008 { * MolarMassGERG. * * - * @param x an array of {@link double} objects + * @param x an array of type double * @param Mm a {@link org.netlib.util.doubleW} object */ public void MolarMassGERG(double[] x, doubleW Mm) { @@ -103,7 +103,7 @@ public void MolarMassGERG(double[] x, doubleW Mm) { * * @param T a double * @param D a double - * @param x an array of {@link double} objects + * @param x an array of type double * @param P a {@link org.netlib.util.doubleW} object * @param Z a {@link org.netlib.util.doubleW} object */ @@ -151,7 +151,7 @@ public void PressureGERG(double T, double D, double[] x, doubleW P, doubleW Z) { * @param iFlag a int * @param T a double * @param P a double - * @param x an array of {@link double} objects + * @param x an array of type double * @param D a {@link org.netlib.util.doubleW} object * @param ierr a {@link org.netlib.util.intW} object * @param herr a {@link org.netlib.util.StringW} object @@ -334,7 +334,7 @@ public void DensityGERG(int iFlag, double T, double P, double[] x, doubleW D, in * * @param T a double * @param D a double - * @param x an array of {@link double} objects + * @param x an array of type double * @param P a {@link org.netlib.util.doubleW} object * @param Z a {@link org.netlib.util.doubleW} object * @param dPdD a {@link org.netlib.util.doubleW} object diff --git a/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java b/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java index eac675645f..d880a5f9df 100644 --- a/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java +++ b/src/main/java/neqsim/thermo/util/GERG/NeqSimAGA8Detail.java @@ -122,8 +122,8 @@ public double getMolarDensity() { StringW herr = new StringW(""); doubleW D = new doubleW(0.0); double pressure = phase.getPressure() * 100.0; - DETAIL.DensityDetail(phase.getTemperature(), pressure, - normalizedGERGComposition, D, ierr, herr); + DETAIL.DensityDetail(phase.getTemperature(), pressure, normalizedGERGComposition, D, ierr, + herr); return D.val; } @@ -133,7 +133,7 @@ public double getMolarDensity() { * * * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return an array of {@link double} objects + * @return an array of type double */ public double[] propertiesDetail(PhaseInterface phase) { this.setPhase(phase); @@ -147,7 +147,7 @@ public double[] propertiesDetail(PhaseInterface phase) { * * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param properties an array of {@link java.lang.String} objects - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getProperties(PhaseInterface phase, String[] properties) { // double molarDens = getMolarDensity(phase); @@ -178,7 +178,7 @@ public double[] getProperties(PhaseInterface phase, String[] properties) { * propertiesDetail. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] propertiesDetail() { // int _x_offset = 0; diff --git a/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java b/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java index 051a75c3ce..5066df0bed 100644 --- a/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java +++ b/src/main/java/neqsim/thermo/util/GERG/NeqSimGERG2008.java @@ -134,7 +134,7 @@ public double getMolarDensity() { * * * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return an array of {@link double} objects + * @return an array of type double */ public double[] propertiesGERG(PhaseInterface phase) { this.setPhase(phase); @@ -148,7 +148,7 @@ public double[] propertiesGERG(PhaseInterface phase) { * * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param properties an array of {@link java.lang.String} objects - * @return an array of {@link double} objects + * @return an array of type double */ public double[] getProperties(PhaseInterface phase, String[] properties) { double[] allProperties = propertiesGERG(); @@ -180,7 +180,7 @@ public double[] getProperties(PhaseInterface phase, String[] properties) { * propertiesGERG. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[] propertiesGERG() { doubleW p = new doubleW(0.0); diff --git a/src/main/java/neqsim/thermo/util/JNI/GERG2004EOS.java b/src/main/java/neqsim/thermo/util/JNI/GERG2004EOS.java index ef3c8f93f3..d058b7cf09 100644 --- a/src/main/java/neqsim/thermo/util/JNI/GERG2004EOS.java +++ b/src/main/java/neqsim/thermo/util/JNI/GERG2004EOS.java @@ -371,7 +371,7 @@ public static native double AOTPX(double c1, double c2, double c3, double c4, do * @param c19 a double * @param c20 a double * @param IPHASE a int - * @return an array of {@link double} objects + * @return an array of type double */ public static native double[] SFUGOTPX(double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9, double c10, double c11, double c12, double c13, @@ -404,7 +404,7 @@ public static native double[] SFUGOTPX(double c1, double c2, double c3, double c * @param c19 a double * @param c20 a double * @param IPHASE a int - * @return an array of {@link double} objects + * @return an array of type double */ public static native double[] SPHIOTPX(double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9, double c10, double c11, double c12, double c13, @@ -470,7 +470,7 @@ public static native double CVOTPX(double c1, double c2, double c3, double c4, d * @param c19 a double * @param c20 a double * @param IPHASE a int - * @return an array of {@link double} objects + * @return an array of type double */ public static native double[] SALLOTPX(double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9, double c10, double c11, double c12, double c13, diff --git a/src/main/java/neqsim/thermodynamicOperations/OperationInterface.java b/src/main/java/neqsim/thermodynamicOperations/OperationInterface.java index d8572ea4a6..d71e51f175 100644 --- a/src/main/java/neqsim/thermodynamicOperations/OperationInterface.java +++ b/src/main/java/neqsim/thermodynamicOperations/OperationInterface.java @@ -30,7 +30,7 @@ public interface OperationInterface extends Runnable, java.io.Serializable { * * * @param i a int - * @return an array of {@link double} objects + * @return an array of type double */ public double[][] getPoints(int i); @@ -40,7 +40,7 @@ public interface OperationInterface extends Runnable, java.io.Serializable { * * * @param name a {@link java.lang.String} object - * @param data an array of {@link double} objects + * @param data an array of type double */ public void addData(String name, double[][] data); @@ -68,7 +68,7 @@ public interface OperationInterface extends Runnable, java.io.Serializable { * * * @param name a {@link java.lang.String} object - * @return an array of {@link double} objects + * @return an array of type double */ public double[] get(String name); diff --git a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java index 177ac80708..b36c97fd1c 100644 --- a/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java +++ b/src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java @@ -1006,9 +1006,9 @@ public void calcSolidComlexTemperature(String comp1, String comp2) throws Except * calcImobilePhaseHydrateTemperature. * * - * @param temperature an array of {@link double} objects - * @param pressure an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperature an array of type double + * @param pressure an array of type double + * @return an array of type double */ public double[] calcImobilePhaseHydrateTemperature(double[] temperature, double[] pressure) { double[] hydTemps = new double[temperature.length]; @@ -1217,9 +1217,9 @@ public void hydrateEquilibriumLine(double minimumPressure, double maximumPressur * calcCricoP. * * - * @param cricondenBar an array of {@link double} objects - * @param cricondenBarX an array of {@link double} objects - * @param cricondenBarY an array of {@link double} objects + * @param cricondenBar an array of type double + * @param cricondenBarX an array of type double + * @param cricondenBarY an array of type double */ public void calcCricoP(double[] cricondenBar, double[] cricondenBarX, double[] cricondenBarY) { double phasefraction = 1.0 - 1e-10; @@ -1235,9 +1235,9 @@ public void calcCricoP(double[] cricondenBar, double[] cricondenBarX, double[] c * calcCricoT. * * - * @param cricondenTherm an array of {@link double} objects - * @param cricondenThermX an array of {@link double} objects - * @param cricondenThermY an array of {@link double} objects + * @param cricondenTherm an array of type double + * @param cricondenThermX an array of type double + * @param cricondenThermY an array of type double */ public void calcCricoT(double[] cricondenTherm, double[] cricondenThermX, double[] cricondenThermY) { @@ -1716,7 +1716,7 @@ public void printToFile(String name) { * getData. * * - * @return an array of {@link double} objects + * @return an array of type double */ public double[][] getData() { return getOperation().getPoints(0); @@ -1832,7 +1832,7 @@ public void display() { * * * @param name a {@link java.lang.String} object - * @return an array of {@link double} objects + * @return an array of type double */ public double[] get(String name) { return getOperation().get(name); @@ -1899,7 +1899,7 @@ public void setThermoOperationThread(Thread thermoOperationThread) { * * * @param name a {@link java.lang.String} object - * @param data an array of {@link double} objects + * @param data an array of type double */ public void addData(String name, double[][] data) { operation.addData(name, data); diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/cricondenBarTemp1.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/cricondenBarTemp1.java index aebaa69bb0..8c7d17d6f8 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/cricondenBarTemp1.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/cricondenBarTemp1.java @@ -196,7 +196,7 @@ public org.jfree.chart.JFreeChart getJFreeChart(String name) { * * * @param name a {@link java.lang.String} object - * @return an array of {@link double} objects + * @return an array of type double */ public double[] get(String name) { return new double[0]; @@ -224,7 +224,7 @@ public void displayResult() {} * * * @param i a int - * @return an array of {@link double} objects + * @return an array of type double */ public double[][] getPoints(int i) { return null; diff --git a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/freezingPointTemperatureFlash.java b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/freezingPointTemperatureFlash.java index 5c5e25b584..bc700a7806 100644 --- a/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/freezingPointTemperatureFlash.java +++ b/src/main/java/neqsim/thermodynamicOperations/flashOps/saturationOps/freezingPointTemperatureFlash.java @@ -169,7 +169,7 @@ public void run() { * * @param name a {@link java.lang.String} object * @param FCompNames an array of {@link java.lang.String} objects - * @param FCompTemp an array of {@link double} objects + * @param FCompTemp an array of type double */ public void printToFile(String name, String[] FCompNames, double[] FCompTemp) { for (int n = 0; n < system.getPhases()[0].getNumberOfComponents(); n++) { diff --git a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenBarFlash.java b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenBarFlash.java index 5eecfc8701..3e39689f6d 100644 --- a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenBarFlash.java +++ b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenBarFlash.java @@ -56,9 +56,9 @@ public class CricondenBarFlash extends pTphaseEnvelope { * @param system a {@link neqsim.thermo.system.SystemInterface} object * @param name a {@link java.lang.String} object * @param phaseFraction a double - * @param cricondenBar an array of {@link double} objects - * @param cricondenBarX an array of {@link double} objects - * @param cricondenBarY an array of {@link double} objects + * @param cricondenBar an array of type double + * @param cricondenBarX an array of type double + * @param cricondenBarY an array of type double */ public CricondenBarFlash(SystemInterface system, String name, double phaseFraction, double[] cricondenBar, double[] cricondenBarX, double[] cricondenBarY) { diff --git a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenThermFlash.java b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenThermFlash.java index 3b0408b641..68c699a01a 100644 --- a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenThermFlash.java +++ b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/CricondenThermFlash.java @@ -55,9 +55,9 @@ public class CricondenThermFlash extends pTphaseEnvelope { * @param system a {@link neqsim.thermo.system.SystemInterface} object * @param name a {@link java.lang.String} object * @param phaseFraction a double - * @param cricondenTherm an array of {@link double} objects - * @param cricondenThermX an array of {@link double} objects - * @param cricondenThermY an array of {@link double} objects + * @param cricondenTherm an array of type double + * @param cricondenThermX an array of type double + * @param cricondenThermY an array of type double */ public CricondenThermFlash(SystemInterface system, String name, double phaseFraction, double[] cricondenTherm, double[] cricondenThermX, double[] cricondenThermY) { diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java index 77bc570676..dd8ea2e0af 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java @@ -145,8 +145,8 @@ public void calcPhaseEnvelope() { * calcBubP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcBubP(double[] temperatures) { double[] bubP = new double[temperatures.length]; @@ -170,8 +170,8 @@ public double[] calcBubP(double[] temperatures) { * calcDewP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcDewP(double[] temperatures) { double[] dewP = new double[temperatures.length]; @@ -195,8 +195,8 @@ public double[] calcDewP(double[] temperatures) { * calcBubT. * * - * @param pressures an array of {@link double} objects - * @return an array of {@link double} objects + * @param pressures an array of type double + * @return an array of type double */ public double[] calcBubT(double[] pressures) { double[] bubT = new double[pressures.length]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java index f93e59eec9..def27913b0 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java @@ -170,8 +170,8 @@ public void calcPhaseEnvelope() { * calcBubP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcBubP(double[] temperatures) { double[] bubP = new double[temperatures.length]; @@ -195,8 +195,8 @@ public double[] calcBubP(double[] temperatures) { * calcDewP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcDewP(double[] temperatures) { double[] dewP = new double[temperatures.length]; @@ -220,8 +220,8 @@ public double[] calcDewP(double[] temperatures) { * calcBubT. * * - * @param pressures an array of {@link double} objects - * @return an array of {@link double} objects + * @param pressures an array of type double + * @return an array of type double */ public double[] calcBubT(double[] pressures) { double[] bubTemps = new double[pressures.length]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java index c592069a3a..e2ea191777 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java @@ -133,8 +133,8 @@ public void calcPhaseEnvelope() { * calcBubP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcBubP(double[] temperatures) { double[] bubP = new double[temperatures.length]; @@ -158,8 +158,8 @@ public double[] calcBubP(double[] temperatures) { * calcDewP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcDewP(double[] temperatures) { double[] dewP = new double[temperatures.length]; @@ -183,8 +183,8 @@ public double[] calcDewP(double[] temperatures) { * calcBubT. * * - * @param pressures an array of {@link double} objects - * @return an array of {@link double} objects + * @param pressures an array of type double + * @return an array of type double */ public double[] calcBubT(double[] pressures) { double[] bubTemps = new double[pressures.length]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java index a96467f600..7ae34f92ad 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java @@ -147,8 +147,8 @@ public void calcPhaseEnvelope() { * calcBubP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcBubP(double[] temperatures) { double[] bubP = new double[temperatures.length]; @@ -172,8 +172,8 @@ public double[] calcBubP(double[] temperatures) { * calcDewP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcDewP(double[] temperatures) { double[] dewP = new double[temperatures.length]; @@ -197,8 +197,8 @@ public double[] calcDewP(double[] temperatures) { * calcBubT. * * - * @param pressures an array of {@link double} objects - * @return an array of {@link double} objects + * @param pressures an array of type double + * @return an array of type double */ public double[] calcBubT(double[] pressures) { double[] bubT = new double[pressures.length]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java index 47ec15230a..4cf8638415 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java @@ -179,8 +179,8 @@ public void calcPhaseEnvelope() { * calcBubP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcBubP(double[] temperatures) { double[] bubP = new double[temperatures.length]; @@ -205,8 +205,8 @@ public double[] calcBubP(double[] temperatures) { * calcDewP. * * - * @param temperatures an array of {@link double} objects - * @return an array of {@link double} objects + * @param temperatures an array of type double + * @return an array of type double */ public double[] calcDewP(double[] temperatures) { double[] dewP = new double[temperatures.length]; @@ -232,8 +232,8 @@ public double[] calcDewP(double[] temperatures) { * calcBubT. * * - * @param pressures an array of {@link double} objects - * @return an array of {@link double} objects + * @param pressures an array of type double + * @return an array of type double */ public double[] calcBubT(double[] pressures) { double[] bubTemps = new double[pressures.length]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java index 53832fc2d6..9fb65b8ef6 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java @@ -177,8 +177,8 @@ public void calcPhaseEnvelope() { * calcBubP. * * - * @param enthalpies an array of {@link double} objects - * @return an array of {@link double} objects + * @param enthalpies an array of type double + * @return an array of type double */ public double[] calcBubP(double[] enthalpies) { double[] bubP = new double[enthalpies.length]; @@ -203,8 +203,8 @@ public double[] calcBubP(double[] enthalpies) { * calcDewP. * * - * @param enthalpies an array of {@link double} objects - * @return an array of {@link double} objects + * @param enthalpies an array of type double + * @return an array of type double */ public double[] calcDewP(double[] enthalpies) { double[] dewP = new double[enthalpies.length]; @@ -230,8 +230,8 @@ public double[] calcDewP(double[] enthalpies) { * calcBubT. * * - * @param pressures an array of {@link double} objects - * @return an array of {@link double} objects + * @param pressures an array of type double + * @return an array of type double */ public double[] calcBubT(double[] pressures) { double[] bubTemps = new double[pressures.length]; diff --git a/src/main/java/neqsim/util/generator/PropertyGenerator.java b/src/main/java/neqsim/util/generator/PropertyGenerator.java index 533b9ccde2..e4ba9a856b 100644 --- a/src/main/java/neqsim/util/generator/PropertyGenerator.java +++ b/src/main/java/neqsim/util/generator/PropertyGenerator.java @@ -23,8 +23,8 @@ public class PropertyGenerator { * * * @param fluid a {@link neqsim.thermo.system.SystemInterface} object - * @param temperatures an array of {@link double} objects - * @param pressures an array of {@link double} objects + * @param temperatures an array of type double + * @param pressures an array of type double */ public PropertyGenerator(SystemInterface fluid, double[] temperatures, double[] pressures) { this.fluid = fluid; From 90ada706ab767bc7f96d3e1b681f33630cea0e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 2 Aug 2024 10:34:59 +0200 Subject: [PATCH 252/317] chore: update maven plugins, require maven version 3.8.8 and java 8 (#1064) * chore: update maven plugins --- pom.xml | 22 +++++++++++----------- pomJava21.xml | 22 +++++++++++----------- pomJava8.xml | 18 +++++++++--------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index d2766dfa8f..54e7cd33fc 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@+ * Abstract Component class. + *
+ * + * @author Even Solbraa + */ public abstract class Component implements ComponentInterface { private static final long serialVersionUID = 1000; static Logger logger = LogManager.getLogger(Component.class); @@ -499,11 +506,10 @@ public Component clone() { @Override public void addMolesChemReac(double dn, double totdn) { if (numberOfMoles + totdn < 0 || numberOfMolesInPhase + dn < 0) { - if (Math.abs(dn) < 1e-12){ + if (Math.abs(dn) < 1e-12) { dn = 0; totdn = 0; - } - else{ + } else { String msg = "will lead to negative number of moles of component in phase for component " + getComponentName() + " who has " + numberOfMolesInPhase + " in phase and chage request was " + dn; @@ -2285,13 +2291,7 @@ public double getVolumeCorrectionT() { return volumeCorrectionT; } - /** - *- * getVolumeCorrection. - *
- * - * @return a double - */ + /** {@inheritDoc} */ @Override public double getVolumeCorrection() { return 0.0; diff --git a/src/main/java/neqsim/thermo/component/ComponentEos.java b/src/main/java/neqsim/thermo/component/ComponentEos.java index 935d52ae0c..b48e16fedf 100644 --- a/src/main/java/neqsim/thermo/component/ComponentEos.java +++ b/src/main/java/neqsim/thermo/component/ComponentEos.java @@ -33,6 +33,10 @@ import neqsim.thermo.phase.PhaseInterface; /** + *+ * Abstract ComponentEos class. + *
+ * * @author Even Solbraa */ public abstract class ComponentEos extends Component implements ComponentEosInterface { diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java index 16823d7686..eece17095e 100644 --- a/src/main/java/neqsim/thermo/component/ComponentInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java @@ -635,9 +635,8 @@ public double fugcoefDiffTempNumeric(PhaseInterface phase, int numberOfComponent ** setMolarMass. *
- * + * * @param molarMass a double - * * @param unit a String */ public void setMolarMass(double molarMass, String unit); @@ -994,8 +993,9 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, ** getNormalLiquidDensity. *
- * + * * @param unit i String with unit of return return a double + * @return a double */ public double getNormalLiquidDensity(String unit); diff --git a/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java b/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java index 204f91649d..b4abaf4883 100644 --- a/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java +++ b/src/main/java/neqsim/thermo/component/ComponentPRvolcor.java @@ -102,7 +102,13 @@ public void init(double temp, double pres, double totMoles, double beta, int ini c = calcc(); } - /** {@inheritDoc} */ + /** + *+ * getc. + *
+ * + * @return a double + */ public double getc() { return c; } diff --git a/src/main/java/neqsim/thermo/mixingRule/EosMixingRulesInterface.java b/src/main/java/neqsim/thermo/mixingRule/EosMixingRulesInterface.java index 086949a171..6332ab9778 100644 --- a/src/main/java/neqsim/thermo/mixingRule/EosMixingRulesInterface.java +++ b/src/main/java/neqsim/thermo/mixingRule/EosMixingRulesInterface.java @@ -275,6 +275,13 @@ public double calcAiT(int compNumb, PhaseInterface phase, double temperature, do */ public PhaseInterface getGEPhase(); + /** + *+ * getBinaryInteractionParameters. + *
+ * + * @return an array of type double + */ public double[][] getBinaryInteractionParameters(); // double calcA2(PhaseInterface phase, double temperature, double pressure, int // numbcomp); diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index 2f71cc4bd3..d3c8407ded 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -1276,7 +1276,7 @@ public void initRefPhases(boolean onlyPure) { * * * @param onlyPure a boolean - * @param name a {@link String} object + * @param name a {@link java.lang.String} object */ public void initRefPhases(boolean onlyPure, String name) { refPhase = new PhaseInterface[numberOfComponents]; @@ -2294,7 +2294,7 @@ public double getFlowRate(String flowunit) { * Getter for the fieldthermoPropertyModelName
.
*
*
- * @return a {@link String} object
+ * @return a {@link java.lang.String} object
*/
public String getThermoPropertyModelName() {
return thermoPropertyModelName;
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
index 76413838c0..b40d6006e4 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
@@ -282,6 +282,7 @@ public double getSolventMolarMass() {
return molesMass / moles;
}
+ /** {@inheritDoc} */
@Override
public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
throws IsNaNException, TooManyIterationsException {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
index fcc12f3039..0af4f441e5 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java
@@ -120,6 +120,7 @@ public double getGibbsEnergy() {
return R * temperature * numberOfMolesInPhase * (GE + Math.log(pressure));
}
+ /** {@inheritDoc} */
@Override
public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
throws IsNaNException, TooManyIterationsException {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseEosInterface.java b/src/main/java/neqsim/thermo/phase/PhaseEosInterface.java
index 4420be0b23..0fbab32499 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseEosInterface.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseEosInterface.java
@@ -35,7 +35,7 @@ public interface PhaseEosInterface extends PhaseInterface {
* getMixingRuleName.
*
*
- * @return a {@link String} object
+ * @return a {@link java.lang.String} object
*/
public String getMixingRuleName();
@@ -80,7 +80,7 @@ public interface PhaseEosInterface extends PhaseInterface {
* displayInteractionCoefficients.
*
*
- * @param intType a {@link String} object
+ * @param intType a {@link java.lang.String} object
*/
public void displayInteractionCoefficients(String intType);
// public double getA();
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
index 9e4988603b..8bd014d5f7 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java
@@ -45,7 +45,7 @@ public PhaseGENRTL() {
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param alpha an array of type double
* @param Dij an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGENRTL(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule,
@@ -133,6 +133,7 @@ public double getGibbsEnergy() {
return R * temperature * numberOfMolesInPhase * (GE + Math.log(pressure));
}
+ /** {@inheritDoc} */
@Override
public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt)
throws IsNaNException, TooManyIterationsException {
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
index 7117877844..6ddb386f36 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java
@@ -41,7 +41,7 @@ public PhaseGENRTLmodifiedHV() {
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param alpha an array of type double
* @param Dij an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGENRTLmodifiedHV(PhaseInterface phase, double[][] alpha, double[][] Dij,
@@ -66,7 +66,7 @@ public PhaseGENRTLmodifiedHV(PhaseInterface phase, double[][] alpha, double[][]
* @param alpha an array of type double
* @param Dij an array of type double
* @param DijT an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGENRTLmodifiedHV(PhaseInterface phase, double[][] alpha, double[][] Dij,
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
index 5793df3913..5d0704d8bb 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java
@@ -31,7 +31,7 @@ public PhaseGENRTLmodifiedWS() {
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param alpha an array of type double
* @param Dij an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGENRTLmodifiedWS(PhaseInterface phase, double[][] alpha, double[][] Dij,
@@ -56,7 +56,7 @@ public PhaseGENRTLmodifiedWS(PhaseInterface phase, double[][] alpha, double[][]
* @param alpha an array of type double
* @param Dij an array of type double
* @param DijT an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGENRTLmodifiedWS(PhaseInterface phase, double[][] alpha, double[][] Dij,
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
index 84200acb19..8275d73433 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java
@@ -44,7 +44,7 @@ public PhaseGEUnifac() {
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param alpha an array of type double
* @param Dij an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGEUnifac(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule,
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
index 4a9f2ac1c9..9629aa678e 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java
@@ -37,7 +37,7 @@ public PhaseGEUnifacPSRK() {
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param alpha an array of type double
* @param Dij an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGEUnifacPSRK(PhaseInterface phase, double[][] alpha, double[][] Dij,
diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
index 06e2b87775..1c99290b90 100644
--- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
+++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
@@ -44,7 +44,7 @@ public PhaseGEUnifacUMRPRU() {
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param alpha an array of type double
* @param Dij an array of type double
- * @param mixRule an array of {@link String} objects
+ * @param mixRule an array of {@link java.lang.String} objects
* @param intparam an array of type double
*/
public PhaseGEUnifacUMRPRU(PhaseInterface phase, double[][] alpha, double[][] Dij,
@@ -82,10 +82,20 @@ public void calcCommontemp(PhaseInterface phase, int numberOfComponents, double
}
}
+ /**
+ * getVCommontemp.
+ * + * @return a double + */ public double getVCommontemp() { return VCommontemp; } + /** + *getFCommontemp.
+ * + * @return a double + */ public double getFCommontemp() { return FCommontemp; } @@ -163,7 +173,7 @@ public void initQmixdN() { * getQmix. * * - * @param name a {@link String} object + * @param name a {@link java.lang.String} object * @return a double */ public double getQmix(String name) { @@ -181,7 +191,7 @@ public double getQmix(String name) { * getQmixdN. * * - * @param name a {@link String} object + * @param name a {@link java.lang.String} object * @return an array of type double */ public double[] getQmixdN(String name) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java index ba4ae00b17..ce2b236542 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java @@ -47,7 +47,7 @@ public PhaseGEUniquac() { * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param alpha an array of type double * @param Dij an array of type double - * @param mixRule an array of {@link String} objects + * @param mixRule an array of {@link java.lang.String} objects * @param intparam an array of type double */ public PhaseGEUniquac(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule, @@ -120,6 +120,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, return R * temperature * numberOfMolesInPhase * GE; } + /** {@inheritDoc} */ @Override public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java index 9c104d2ca3..d79b79a1ea 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java @@ -36,7 +36,7 @@ public PhaseGEWilson() { * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param alpha an array of type double * @param Dij an array of type double - * @param mixRule an array of {@link String} objects + * @param mixRule an array of {@link java.lang.String} objects * @param intparam an array of type double */ public PhaseGEWilson(PhaseInterface phase, double[][] alpha, double[][] Dij, String[][] mixRule, @@ -110,6 +110,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, return R * temperature * numberOfMolesInPhase * GE; } + /** {@inheritDoc} */ @Override public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException { diff --git a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java index e8a2f83aa6..e49a1ddefd 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseHydrate.java +++ b/src/main/java/neqsim/thermo/phase/PhaseHydrate.java @@ -36,7 +36,7 @@ public PhaseHydrate() { * Constructor for PhaseHydrate. * * - * @param fluidModel a {@link String} object + * @param fluidModel a {@link java.lang.String} object */ public PhaseHydrate(String fluidModel) { if (fluidModel.isEmpty()) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index a19a7ec570..c2861712b0 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -260,7 +260,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * initPhysicalProperties. * * - * @param type a {@link String} object + * @param type a {@link java.lang.String} object */ public void initPhysicalProperties(String type); @@ -452,7 +452,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * getFugacity. * * - * @param compName a {@link String} object + * @param compName a {@link java.lang.String} object * @return a double */ public double getFugacity(String compName); @@ -608,7 +608,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * getWtFrac. * * - * @param componentName a {@link String} object + * @param componentName a {@link java.lang.String} object * @return a double */ public double getWtFrac(String componentName); @@ -618,7 +618,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType * setMixingRuleGEModel. * * - * @param name a {@link String} object + * @param name a {@link java.lang.String} object */ public void setMixingRuleGEModel(String name); @@ -1846,7 +1846,7 @@ public default void addMolesChemReac(int component, double dn) { * @param alpha an array of type double * @param Dij an array of type double * @param DijT an array of type double - * @param mixRule an array of {@link String} objects + * @param mixRule an array of {@link java.lang.String} objects * @param intparam an array of type double */ public void setParams(PhaseInterface phase, double[][] alpha, double[][] Dij, double[][] DijT, @@ -1871,7 +1871,7 @@ public void setParams(PhaseInterface phase, double[][] alpha, double[][] Dij, do * Getter for property phaseTypeName. * * - * @return a {@link String} object + * @return a {@link java.lang.String} object */ public default String getPhaseTypeName() { return getType().getDesc(); @@ -1882,7 +1882,7 @@ public default String getPhaseTypeName() { * Setter for property phaseTypeName. * * - * @param phaseTypeName a {@link String} object + * @param phaseTypeName a {@link java.lang.String} object */ public default void setPhaseTypeName(String phaseTypeName) { setType(PhaseType.byDesc(phaseTypeName)); diff --git a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java index 71524fa028..02641bde54 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java +++ b/src/main/java/neqsim/thermo/phase/PhasePrEosvolcor.java @@ -296,13 +296,7 @@ public double gVV() { // return -1.0 / (val2 * val2) + 1.0 / (val1 * val1); } - /** - *- * gVVV. - *
- * - * @return a double - */ + /** {@inheritDoc} */ @Override public double gVVV() { double val1 = numberOfMolesInPhase * getMolarVolume(); @@ -332,13 +326,7 @@ public double fVV() { // return 1.0 / (R * loc_B * (delta1 - delta2)) * (-1.0 / (val1 * val1) + 1.0 / (val2 * val2)); } - /** - *- * fVVV. - *
- * - * @return a double - */ + /** {@inheritDoc} */ @Override public double fVVV() { double val1 = numberOfMolesInPhase * molarVolume + getB() * delta1 + getC(); diff --git a/src/main/java/neqsim/thermo/phase/PhaseType.java b/src/main/java/neqsim/thermo/phase/PhaseType.java index e00b3781fa..82d8171713 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseType.java +++ b/src/main/java/neqsim/thermo/phase/PhaseType.java @@ -5,6 +5,8 @@ /** * Types of phases. + * + * @author ASMF */ public enum PhaseType implements Serializable { LIQUID("liquid", 0), GAS("gas", 1), OIL("oil", 2), AQUEOUS("aqueous", 3), HYDRATE("hydrate", diff --git a/src/main/java/neqsim/thermo/phase/StateOfMatter.java b/src/main/java/neqsim/thermo/phase/StateOfMatter.java index ccf16bd1ab..8ce4150c92 100644 --- a/src/main/java/neqsim/thermo/phase/StateOfMatter.java +++ b/src/main/java/neqsim/thermo/phase/StateOfMatter.java @@ -2,6 +2,8 @@ /** * States of matter, a way of relating the PhaseTypes to classical states of matter. + * + * @author ASMF */ public enum StateOfMatter { GAS, LIQUID, SOLID; diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index 90daf4d133..4db3307a74 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -1129,7 +1129,6 @@ public default double getGamma2() { * method to return molar volume of the fluid: eventual volume correction included. * * @param unit Supported units are m3/mol, litre/mol - * * @return molar volume volume in unit */ public double getMolarVolume(String unit); @@ -2580,30 +2579,37 @@ public void setImplementedTemperatureDeriativesofFugacity( /** *- * getKvector - return vector of equilibrium constants + * getKvector - return vector of equilibrium constants. *
+ * + * @return an array of {@link double} objects */ public double[] getKvector(); /** *- * getzvector - return vector of total molar composition + * getzvector - return vector of total molar composition. *
+ * + * @return an array of {@link double} objects */ public double[] getzvector(); /** *- * toJson - return String with json inormation of fluid + * toJson - return String with json inormation of fluid. *
+ * + * @return a {@link java.lang.String} object */ public String toJson(); /** *- * toCompJson - return String with json inormation of pure component properties of fluid + * toCompJson - return String with json inormation of pure component properties of fluid. *
+ * + * @return a {@link java.lang.String} object */ public String toCompJson(); - } diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index f570c4a78a..1b37514249 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -32,6 +32,8 @@ /** * This is the base class of the System classes. + * + * @author Even Solbraa */ public abstract class SystemThermo implements SystemInterface { /** Logger object for class. */ @@ -3074,12 +3076,7 @@ public double getZvolcorr() { / getTemperature() / getDensity("kg/m3"); } - /** - * Verify if system has a phase of a specific type. - * - * @param pt PhaseType to look for. - * @return True if system contains a phase of requested type. - */ + /** {@inheritDoc} */ @Override public boolean hasPhaseType(PhaseType pt) { for (int i = 0; i < numberOfPhases; i++) { From eea4b3b94bee51a1cc43699754b55c16cd9d283a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:51:08 +0200 Subject: [PATCH 254/317] chore: fix javadoc (#1067) * chore: fix javadoc --- .../simulation/BasePVTsimulation.java | 12 +- .../simulation/SaturationPressure.java | 1 - .../dataPresentation/SampleXYDataSource.java | 2 + .../FluidBoundarySolver.java | 8 +- .../SimulationBaseClass.java | 19 +-- .../SimulationInterface.java | 30 ++-- .../CombustionEmissionsCalculator.java | 21 +++ .../FlowInducedVibrationAnalyser.java | 14 +- .../measurementDevice/LevelTransmitter.java | 4 +- .../MeasurementDeviceInterface.java | 2 +- .../measurementDevice/WellAllocator.java | 1 - .../simpleFlowRegime/SevereSlugAnalyser.java | 8 +- .../mechanicalDesign/MechanicalDesign.java | 28 ++++ .../SystemMechanicalDesign.java | 7 + .../ProcessEquipmentBaseClass.java | 14 +- .../ProcessEquipmentInterface.java | 12 +- .../absorber/SimpleAbsorber.java | 7 +- .../absorber/SimpleTEGAbsorber.java | 9 +- .../adsorber/SimpleAdsorber.java | 7 +- .../compressor/Compressor.java | 44 +++--- .../compressor/CompressorChart.java | 20 +++ .../compressor/CompressorChartGenerator.java | 14 ++ .../compressor/CompressorChartInterface.java | 9 +- .../compressor/CompressorInterface.java | 25 ++++ .../distillation/Condenser.java | 19 +-- .../distillation/DistillationColumn.java | 8 +- .../heatExchanger/HeatExchanger.java | 1 - .../processEquipment/manifold/Manifold.java | 17 ++- .../mixer/MixerInterface.java | 4 +- .../pipeline/PipeBeggsAndBrills.java | 131 +++++++++++++++++- .../processEquipment/pipeline/Pipeline.java | 16 ++- .../powerGeneration/GasTurbine.java | 10 +- .../processEquipment/pump/Pump.java | 1 + .../reservoir/ReservoirCVDsim.java | 13 +- .../reservoir/ReservoirDiffLibsim.java | 13 +- .../reservoir/ReservoirTPsim.java | 68 +++++++-- .../reservoir/SimpleReservoir.java | 24 +++- .../processEquipment/reservoir/WellFlow.java | 10 ++ .../separator/GasScrubber.java | 8 +- .../separator/GasScrubberSimple.java | 8 +- .../separator/NeqGasScrubber.java | 8 +- .../processEquipment/separator/Separator.java | 22 ++- .../separator/SeparatorInterface.java | 7 + .../separator/sectionType/ManwaySection.java | 8 +- .../separator/sectionType/MeshSection.java | 6 +- .../separator/sectionType/NozzleSection.java | 8 +- .../separator/sectionType/ValveSection.java | 8 +- .../separator/sectionType/VaneSection.java | 8 +- .../processEquipment/splitter/Splitter.java | 19 ++- .../processEquipment/stream/Stream.java | 9 +- .../stream/StreamInterface.java | 7 +- .../processEquipment/util/Adjuster.java | 20 +++ .../util/FlowRateAdjuster.java | 42 ++++-- .../processEquipment/util/FlowSetter.java | 27 +++- .../processEquipment/util/GORfitter.java | 8 +- .../processEquipment/util/MPFMfitter.java | 22 ++- .../processEquipment/util/PressureDrop.java | 6 + .../processEquipment/util/Recycle.java | 15 +- .../valve/ThrottlingValve.java | 58 ++++++-- .../valve/ValveInterface.java | 2 +- .../processSystem/ProcessModule.java | 26 ++-- .../processSystem/ProcessModuleBaseClass.java | 14 +- .../processSystem/ProcessSystem.java | 23 +-- .../util/monitor/FluidComponentResponse.java | 4 +- .../util/monitor/FluidResponse.java | 4 +- .../util/monitor/SeparatorResponse.java | 1 - .../util/monitor/StreamResponse.java | 1 - .../processSimulation/util/monitor/Value.java | 11 +- .../util/monitor/ValveResponse.java | 1 - .../processSimulation/util/report/Report.java | 32 ++++- .../neqsim/standards/StandardInterface.java | 4 +- .../BestPracticeHydrocarbonDewPoint.java | 2 +- .../standards/gasQuality/Draft_GERG2004.java | 2 +- .../standards/gasQuality/Draft_ISO18453.java | 2 +- .../gasQuality/GasChromotograpyhBase.java | 2 +- .../gasQuality/Standard_ISO15403.java | 9 +- .../gasQuality/Standard_ISO6578.java | 2 +- .../gasQuality/Standard_ISO6976.java | 2 +- .../gasQuality/Standard_ISO6976_2016.java | 2 +- .../gasQuality/SulfurSpecificationMethod.java | 2 +- .../gasQuality/UKspecifications_ICF_SI.java | 2 +- .../oilQuality/Standard_ASTM_D6377.java | 7 +- .../thermo/component/ComponentGEUnifac.java | 1 - .../thermo/component/ComponentInterface.java | 51 ++++--- .../java/neqsim/thermo/phase/PhasePrEos.java | 2 - .../neqsim/thermo/system/SystemInterface.java | 4 +- .../util/readwrite/EclipseFluidReadWrite.java | 1 - .../thermo/util/readwrite/TablePrinter.java | 2 + .../flashOps/RachfordRice.java | 50 +++++-- .../flashOps/SaturateWithWater.java | 1 - .../flashOps/TPmultiflash.java | 7 +- .../flashOps/TVflash.java | 1 - .../flashOps/TVfractionFlash.java | 1 - .../saturationOps/constantDutyFlash.java | 3 + src/main/java/neqsim/util/NamedInterface.java | 8 +- .../util/database/NeqSimContractDataBase.java | 11 +- .../neqsim/util/database/NeqSimDataBase.java | 10 +- .../database/NeqSimProcessDesignDataBase.java | 11 +- .../neqsim/util/unit/TemperatureUnit.java | 16 +-- src/main/java/neqsim/util/unit/Unit.java | 2 +- src/main/java/neqsim/util/unit/Units.java | 77 +++++++++- .../ConstantVolumeDepletionTest.java | 4 - .../FrictionTheoryViscosityMethodTest.java | 40 +++--- .../FLowInducedVibrationTest.java | 9 +- .../processEquipment/util/MPFMfitterTest.java | 2 - .../CombinedOilGasFieldTest.java | 10 +- .../processSystem/OilProcessTest.java | 8 -- .../ProcessSystemSerializationTest.java | 1 - .../processSystem/ProcessSystemTest.java | 8 -- .../util/monitor/SeparatorResponseTest.java | 2 - .../util/report/FluidCompinentReportTest.java | 3 - .../util/report/FluidReportTest.java | 3 - .../util/report/ReportTest.java | 1 - .../ThermodynamicOperationsTest.java | 1 - .../flashOps/PHFlashCPATest.java | 2 - .../flashOps/RachfordRiceTest.java | 4 - .../flashOps/SaturateWithWaterTest.java | 1 - .../flashOps/TVFlashTest.java | 2 +- .../bubblePointPressureFlashTest.java | 1 - .../dewPointPressureFlashTest.java | 3 - src/test/java/neqsim/util/unit/UnitsTest.java | 3 - 121 files changed, 946 insertions(+), 555 deletions(-) diff --git a/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java b/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java index 71394cc2c0..e6838e108a 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/BasePVTsimulation.java @@ -121,7 +121,7 @@ public double getTemperature() { /** *
- * Setter for the field temperature
.
+ * Setter for the field temperature
. NB! Verify unit is correct.
*
- * Setter for the field temperature
.
- *
- * setRunInSteps - *
- * - * @param setRunSteps boolean set if run in steps - */ + /** {@inheritDoc} */ @Override public void setRunInSteps(boolean setRunSteps) { runInSteps = setRunSteps; } - /** - *- * isRunInSteps. - *
- * - * @return boolean - */ + /** {@inheritDoc} */ @Override public boolean isRunInSteps() { return runInSteps; } - - - } diff --git a/src/main/java/neqsim/processSimulation/SimulationInterface.java b/src/main/java/neqsim/processSimulation/SimulationInterface.java index 319426689d..f651c028f0 100644 --- a/src/main/java/neqsim/processSimulation/SimulationInterface.java +++ b/src/main/java/neqsim/processSimulation/SimulationInterface.java @@ -40,21 +40,21 @@ public interface SimulationInterface extends NamedInterface, Runnable, Serializa public void setCalculateSteadyState(boolean steady); /** - * Getter for property time. + * Getter for the fieldtime
.
*
* @return Value of property time.
*/
public double getTime();
/**
- * Setter for property time.
+ * Setter for field time
.
*
* @param value Value to set.
*/
public void setTime(double value);
/**
- * Method to increase parameter time by a given value.
+ * Method to increase field time
by a given value.
*
* @param dt Value to increase time by.
*/
@@ -62,10 +62,10 @@ public interface SimulationInterface extends NamedInterface, Runnable, Serializa
/**
* - * setRunInSteps + * setRunInSteps. *
- * - * @param setRunSteps boolean set if run in steps + * + * @param setRunSteps boolean set true to run in steps */ public void setRunInSteps(boolean setRunSteps); @@ -73,14 +73,14 @@ public interface SimulationInterface extends NamedInterface, Runnable, Serializa ** isRunInSteps. *
- * + * * @return boolean */ public boolean isRunInSteps(); /** *- * run + * run. *
* * @param id UUID @@ -89,9 +89,8 @@ public interface SimulationInterface extends NamedInterface, Runnable, Serializa /** *- * run + * run. *
- * */ public default void run() { if (isRunInSteps()) { @@ -102,12 +101,11 @@ public default void run() { } /** - * {@inheritDoc} - * *+ * run_step + *
* In this method all thermodynamic and unit operations will be calculated in a steady state * calculation. It does not solve resycles - only calculates one step. - * */ public default void run_step() { run_step(UUID.randomUUID()); @@ -162,7 +160,7 @@ public default void runTransient(double dt, UUID id) { /** *- * solved. + * Returns whether or not the module has been solved. *
* * @return a boolean @@ -171,10 +169,10 @@ public default void runTransient(double dt, UUID id) { /** *- * getReport_json + * getReport_json. *
* Return results of simulation in json format - * + * * @return a String */ public String getReport_json(); diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/CombustionEmissionsCalculator.java b/src/main/java/neqsim/processSimulation/measurementDevice/CombustionEmissionsCalculator.java index 7296d60400..c2882e9e43 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/CombustionEmissionsCalculator.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/CombustionEmissionsCalculator.java @@ -4,6 +4,13 @@ import java.util.Map; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +/** + *+ * CombustionEmissionsCalculator class. + *
+ * + * @author Even Solbraa + */ public class CombustionEmissionsCalculator extends StreamMeasurementDeviceBaseClass { private static final long serialVersionUID = 1L; @@ -37,6 +44,11 @@ public CombustionEmissionsCalculator(String name, StreamInterface stream) { super(name, "kg/hr", stream); } + /** + *+ * setComponents. + *
+ */ public void setComponents() { NATURAL_GAS_COMPOSITION.clear(); CO2_EMISSIONS_FACTORS.clear(); @@ -71,6 +83,15 @@ public double getMeasuredValue(String unit) { * stream.getFluid().getFlowRate(unit); } + /** + *+ * calculateCO2Emissions. + *
+ * + * @param composition a {@link java.util.Map} object + * @param emissionsFactors a {@link java.util.Map} object + * @return a double + */ public static double calculateCO2Emissions(Map* Constructor for WaterDewPointAnalyser. @@ -116,7 +115,6 @@ public double getMeasuredValue(String unit) { return Double.NaN; } - /** *
* Getter for the field method
.
@@ -151,7 +149,13 @@ public void setSegment(int segment) {
this.segmentSet = true;
}
-
+ /**
+ *
+ * setFRMSConstant. + *
+ * + * @param frms a double + */ public void setFRMSConstant(double frms) { this.FRMSConstant = frms; } @@ -167,7 +171,6 @@ public void setSupportArrangement(String arrangement) { this.supportArrangement = arrangement; } - /** *
* Setter for the support distance .
@@ -178,7 +181,4 @@ public void setSupportArrangement(String arrangement) {
public void setSupportDistance(Double distance) {
this.supportDistance = distance;
}
-
-
-
}
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/LevelTransmitter.java b/src/main/java/neqsim/processSimulation/measurementDevice/LevelTransmitter.java
index cd8e7c299e..c2ee757350 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/LevelTransmitter.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/LevelTransmitter.java
@@ -47,9 +47,7 @@ public void displayResult() {
System.out.println("measured level " + separator.getLiquidLevel());
}
- /**
- * Get level as volume fraction.
- */
+ /** {@inheritDoc} */
@Override
public double getMeasuredValue(String unit) {
if (!unit.equalsIgnoreCase("")) {
diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/MeasurementDeviceInterface.java b/src/main/java/neqsim/processSimulation/measurementDevice/MeasurementDeviceInterface.java
index 2c70cd2ab2..4f0e11d220 100644
--- a/src/main/java/neqsim/processSimulation/measurementDevice/MeasurementDeviceInterface.java
+++ b/src/main/java/neqsim/processSimulation/measurementDevice/MeasurementDeviceInterface.java
@@ -32,7 +32,7 @@ public default double getMeasuredValue() {
/**
*
- * getMeasuredValue. + * Get Measured value in specified unit. *
* * @param unit a {@link java.lang.String} object diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/WellAllocator.java b/src/main/java/neqsim/processSimulation/measurementDevice/WellAllocator.java index cb7723b685..ac2e7e2439 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/WellAllocator.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/WellAllocator.java @@ -74,7 +74,6 @@ public double getMeasuredValue(String unit) { * @param unit Unit to get value in * @return Measured value */ - public double getMeasuredValue(String measurement, String unit) { int numberOfComps = stream.getThermoSystem().getNumberOfComponents(); double[] splitFactors = new double[numberOfComps]; diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java index 2bad207261..986f0e48e0 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java @@ -627,13 +627,7 @@ public String checkFlowRegime(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalys return flowPattern; } - /** - *- * getMeasuredValue. - *
- * - * @return a double - */ + /** {@inheritDoc} */ @Override public double getMeasuredValue(String unit) { if (!unit.equalsIgnoreCase("m3/sec")) { diff --git a/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java b/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java index 1713d29cae..82e64570ae 100644 --- a/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java +++ b/src/main/java/neqsim/processSimulation/mechanicalDesign/MechanicalDesign.java @@ -1083,18 +1083,46 @@ public UnitCostEstimateBaseClass getCostEstimate() { return costEstimate; } + /** + *
+ * Setter for the field defaultLiquidDensity
.
+ *
+ * Getter for the field defaultLiquidDensity
.
+ *
+ * Setter for the field defaultLiquidViscosity
.
+ *
+ * Getter for the field defaultLiquidViscosity
.
+ *
+ * getProcess. + *
+ * + * @return a {@link neqsim.processSimulation.processSystem.ProcessSystem} object + */ public ProcessSystem getProcess() { return processSystem; } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java index 5982884ab2..2799a1a065 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java @@ -243,13 +243,7 @@ public String getConditionAnalysisMessage() { return conditionAnalysisMessage; } - /** - *- * getResultTable. - *
- * - * @return an array of {@link java.lang.String} objects - */ + /** {@inheritDoc} */ @Override public String[][] getResultTable() { return null; @@ -297,7 +291,7 @@ public String toJson() { /** * {@inheritDoc} - * + * * @return a String */ public String getReport_json() { @@ -306,7 +300,5 @@ public String getReport_json() { /** {@inheritDoc} */ @Override - public void run_step(UUID id) { - - } + public void run_step(UUID id) {} } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java index 5e29be4dc6..4fea2f15a6 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java @@ -25,9 +25,9 @@ public interface ProcessEquipmentInterface extends SimulationInterface { /** *
- * Get a initMechanicalDesign
for the equipment.
+ * Initialize a initMechanicalDesign
for the equipment.
*
- * getPressure.
+ * Getter for the field pressure
.
*
- * getPressure.
+ * Getter for the field pressure
converted to specified unit.
*
- * setPressure.
+ * Setter for the field pressure
.
*
- * getGasLoadFactor. - *
- * - * @return a double - */ + /** {@inheritDoc} */ @Override public double getGasLoadFactor() { double intArea = 3.14 * getInternalDiameter() * getInternalDiameter() / 4.0; diff --git a/src/main/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorber.java b/src/main/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorber.java index 233e4ac14f..870187ab20 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorber.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/adsorber/SimpleAdsorber.java @@ -118,12 +118,7 @@ public SimpleAdsorber(String name, StreamInterface inStream1) { outStream[1].run(); } - /** - * {@inheritDoc} - * - * @return a {@link neqsim.processSimulation.mechanicalDesign.adsorber.AdsorberMechanicalDesign} - * object - */ + /** {@inheritDoc} */ @Override public AdsorberMechanicalDesign getMechanicalDesign() { return new AdsorberMechanicalDesign(this); diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java index cdcc8b1b1f..e4b217beb1 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java @@ -135,25 +135,13 @@ public Compressor(String name, boolean interpolateMapLookup) { } } - /** - * {@inheritDoc} - * - * @return a - * {@link neqsim.processSimulation.mechanicalDesign.compressor.CompressorMechanicalDesign} - * object - */ + /** {@inheritDoc} */ @Override public CompressorMechanicalDesign getMechanicalDesign() { return new CompressorMechanicalDesign(this); } - /** - *- * Create deep copy. - *
- * - * @return a {@link neqsim.processSimulation.processSystem.ProcessSystem} object - */ + /** {@inheritDoc} */ @Override public Compressor copy() { return (Compressor) super.copy(); @@ -200,13 +188,7 @@ public void setOutletPressure(double pressure, String unit) { this.pressureUnit = unit; } - /** - *- * getOutletPressure. - *
- * - * @return a double - */ + /** {@inheritDoc} */ @Override public double getOutletPressure() { return pressure; @@ -1010,6 +992,7 @@ public boolean isSurge(double flow, double head) { return getAntiSurge().isSurge(); } + /** {@inheritDoc} */ @Override public double getDistanceToSurge() { return (getInletStream().getFlowRate("m3/hr") @@ -1396,35 +1379,54 @@ public boolean equals(Object obj) { && useRigorousPolytropicMethod == other.useRigorousPolytropicMethod; } + /** {@inheritDoc} */ @Override public void setMaximumSpeed(double maxSpeed) { this.maxspeed = maxSpeed; } + /** {@inheritDoc} */ @Override public void setMinimumSpeed(double minspeed) { this.minspeed = minspeed; } + /** {@inheritDoc} */ @Override public double getMaximumSpeed() { return maxspeed; } + /** {@inheritDoc} */ @Override public double getMinimumSpeed() { return minspeed; } + /** + *
+ * Setter for the field compressionRatio
.
+ *
+ * Getter for the field compressionRatio
.
+ *
Getter for the field maxSpeedCurve
.
Setter for the field maxSpeedCurve
.
Getter for the field minSpeedCurve
.
Setter for the field minSpeedCurve
.
+ * Constructor for CompressorChartGenerator. + *
+ * + * @param inpcompressor a {@link neqsim.processSimulation.processEquipment.compressor.Compressor} + * object + */ public CompressorChartGenerator(Compressor inpcompressor) { this.compressor = inpcompressor; } /** + *+ * generateCompressorChart. + *
+ * * @param generationOption string to specify how to generate the compressor chart * @return a {@link neqsim.processSimulation.processEquipment.compressor.CompressorChart} object */ diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java index 872f16b81e..2a2178a078 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChartInterface.java @@ -167,6 +167,13 @@ public void setReferenceConditions(double refMW, double refTemperature, double r @Override public int hashCode(); - /** {@inheritDoc} */ + /** + *getFlow.
+ * + * @param head a double + * @param speed a double + * @param guessFlow a double + * @return a double + */ public double getFlow(double head, double speed, double guessFlow); } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java index a746e80f1f..d78bb058db 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorInterface.java @@ -72,13 +72,38 @@ public interface CompressorInterface extends ProcessEquipmentInterface, TwoPortI */ public AntiSurge getAntiSurge(); + /** + *getDistanceToSurge.
+ * + * @return a double + */ public double getDistanceToSurge(); + /** + *setMaximumSpeed.
+ * + * @param maxSpeed a double + */ public void setMaximumSpeed(double maxSpeed); + /** + *setMinimumSpeed.
+ * + * @param minspeed a double + */ public void setMinimumSpeed(double minspeed); + /** + *getMaximumSpeed.
+ * + * @return a double + */ public double getMaximumSpeed(); + /** + *getMinimumSpeed.
+ * + * @return a double + */ public double getMinimumSpeed(); } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/distillation/Condenser.java b/src/main/java/neqsim/processSimulation/processEquipment/distillation/Condenser.java index 14975f1081..4bb8c4f304 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/distillation/Condenser.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/distillation/Condenser.java @@ -24,6 +24,13 @@ public class Condenser extends SimpleTray { boolean totalCondenser = false; Splitter mixedStreamSplitter = null; + /** + *
+ * Setter for the field totalCondenser
.
+ *
- * getGasOutStream. - *
- * - * @return a {@link neqsim.processSimulation.processEquipment.stream.Stream} object - */ + /** {@inheritDoc} */ @Override public StreamInterface getGasOutStream() { if (totalCondenser) { @@ -100,11 +101,11 @@ public StreamInterface getProductOutStream() { } /** + * {@inheritDoc} + * ** getLiquidOutStream. *
- * - * @return a {@link neqsim.processSimulation.processEquipment.stream.Stream} object */ @Override public StreamInterface getLiquidOutStream() { diff --git a/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java b/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java index c10e58b94c..222c902371 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/distillation/DistillationColumn.java @@ -720,13 +720,7 @@ public double getInternalDiameter() { return internalDiameter; } - /** - *
- * Getter for the field solved
.
- *
+ * addStream. + *
+ * + * @param newStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object + */ public void addStream(StreamInterface newStream) { localmixer.addStream(newStream); } @@ -64,7 +72,12 @@ public void setSplitFactors(double[] splitFact) { localsplitter.setSplitFactors(splitFactors); } - /** {@inheritDoc} */ + /** + *getSplitStream.
+ * + * @param i a int + * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object + */ public StreamInterface getSplitStream(int i) { return localsplitter.getSplitStream(i); } @@ -75,7 +88,7 @@ public StreamInterface getSplitStream(int i) { * * * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - **/ + */ public StreamInterface getMixedStream() { return localmixer.getOutletStream(); } diff --git a/src/main/java/neqsim/processSimulation/processEquipment/mixer/MixerInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/mixer/MixerInterface.java index 5fbba08e36..390fd06220 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/mixer/MixerInterface.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/mixer/MixerInterface.java @@ -31,7 +31,7 @@ public interface MixerInterface extends ProcessEquipmentInterface { /** *- * getOutStream. + * Getter for outlet stream object. *
* * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object @@ -40,7 +40,7 @@ public interface MixerInterface extends ProcessEquipmentInterface { /** *- * getOutStream. + * Getter for outlet stream object. *
* * @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java index e43e3548ca..84617a167f 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java @@ -214,7 +214,6 @@ public void setPipeSpecification(double nominalDiameter, String pipeSec) { // TODO Auto-generated catch block e.printStackTrace(); } - } /** {@inheritDoc} */ @@ -267,19 +266,17 @@ public void setThickness(double pipeThickness) { this.pipeThickness = pipeThickness; } - /** ** getThickness. *
* + * @return a double */ public double getThickness() { return this.pipeThickness; } - - /** *
* Setter for the field angle
.
@@ -371,6 +368,11 @@ public void convertSystemUnitToMetric() {
pressureDrop = pressureDrop * 1.48727E-05;
}
+ /**
+ *
+ * calculateMissingValue. + *
+ */ public void calculateMissingValue() { if (Double.isNaN(totalLength)) { totalLength = calculateLength(); @@ -420,7 +422,6 @@ private double calculateAngle() { } /** - * /** ** calcFlowRegime. *
@@ -706,7 +707,6 @@ public double calcPressureDrop() { /** {@inheritDoc} */ @Override public void run(UUID id) { - iteration = 0; pressureProfile = new ArrayList<>(); @@ -840,6 +840,10 @@ public int getNumberOfIncrements() { } /** + *
+ * Getter for the field angle
.
+ *
+ * Getter for the field length
.
+ *
+ * Getter for the field elevation
.
+ *
+ * getSegmentPressureDrop. + *
+ * * @param index segment number * @return Double */ @@ -953,6 +969,10 @@ public Double getSegmentPressureDrop(int index) { } /** + *
+ * Getter for the field temperatureProfile
.
+ *
+ * getSegmentTemperature. + *
+ * * @param index segment number * @return Double */ @@ -972,6 +996,10 @@ public Double getSegmentTemperature(int index) { } /** + *
+ * Getter for the field flowRegimeProfile
.
+ *
+ * getSegmentFlowRegime. + *
+ * * @param index segment number * @return String */ @@ -991,6 +1023,10 @@ public String getSegmentFlowRegime(int index) { } /** + *
+ * Getter for the field liquidSuperficialVelocityProfile
.
+ *
+ * Getter for the field gasSuperficialVelocityProfile
.
+ *
+ * Getter for the field mixtureSuperficialVelocityProfile
.
+ *
+ * Getter for the field mixtureViscosityProfile
.
+ *
+ * Getter for the field mixtureDensityProfile
.
+ *
+ * Getter for the field liquidDensityProfile
.
+ *
+ * Getter for the field liquidHoldupProfile
.
+ *
+ * Getter for the field mixtureReynoldsNumber
.
+ *
+ * Getter for the field lengthProfile
.
+ *