Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename class CalcIonicComposition #921

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: rename class CalcIonicComposition
asmfstatoil committed Feb 21, 2024
commit f44a0fdb5912a9b775478d6a3bc65aa0570603a5
Original file line number Diff line number Diff line change
@@ -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.
* </p>
*/
public ThermodynamicOperations() {
}
public ThermodynamicOperations() {}

/**
* <p>
@@ -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.
* </p>
*
* @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.
* </p>
*
* @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() {
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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) {
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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) {
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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
* </p>
*
* @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.
* </p>
*
* @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
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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() {
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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) {
* </p>
*
* @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<Double> Spec1, List<Double> Spec2, int FlashMode,
@@ -2050,14 +2046,12 @@ public CalculationResult propertyFlash(List<Double> Spec1, List<Double> Spec2, i
*
* this.system.setEmptyFluid();
*
* // Components in system with no corresponding value in onlineFractions will
* be zero.
* // Components in system with no corresponding value in onlineFractions will be zero.
* for (int componentNumber = 0; componentNumber < onlineFractions .size();
* componentNumber++) { this.system.addComponent(componentNumber,
* onlineFractions.get(componentNumber).get(t).doubleValue()); }
*
* if (this.system.getTotalNumberOfMoles() < 1e-5) {
* this.system.setTotalNumberOfMoles(1);
* if (this.system.getTotalNumberOfMoles() < 1e-5) { this.system.setTotalNumberOfMoles(1);
* }
*/

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* calcIonicComposition.java
* CalcIonicComposition.java
*
* Created on 8. mars 2001, 10:56
*/
@@ -14,28 +14,28 @@

/**
* <p>
* calcIonicComposition class.
* CalcIonicComposition class.
* </p>
*
* @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;

/**
* <p>
* Constructor for calcIonicComposition.
* Constructor for CalcIonicComposition.
* </p>
*
* @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;
}