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 Eclipse PR vs PR78 #1003

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ public AttractiveTermPr1978(ComponentEosInterface component) {
}
}

/** {@inheritDoc} */
@Override
public void setm(double val) {
this.m = val;
neqsim.MathLib.nonLinearSolver.newtonRhapson solve =
new neqsim.MathLib.nonLinearSolver.newtonRhapson();
solve.setOrder(2);
double[] acentricConstants = {-0.26992, 1.54226, (0.37464 - this.m)};
if (this.m > 0.49) {
solve.setOrder(3);
acentricConstants = new double[] {0.01666, -0.164423, 1.48503, (0.379642 - this.m)};
}
solve.setConstants(acentricConstants);
getComponent().setAcentricFactor(solve.solve(0.2));
}

/** {@inheritDoc} */
@Override
public AttractiveTermPr1978 clone() {
Expand Down
31 changes: 3 additions & 28 deletions src/main/java/neqsim/thermo/system/SystemPrEos1978.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package neqsim.thermo.system;

import neqsim.thermo.phase.PhaseHydrate;
import neqsim.thermo.phase.PhasePrEos;
import neqsim.thermo.phase.PhasePureComponentSolid;

/**
* This class defines a thermodynamic system using the Peng Robinson v. 1978 equation of state
*
* @author Even Solbraa
* @version $Id: $Id
*/
public class SystemPrEos1978 extends SystemEos {
public class SystemPrEos1978 extends SystemPrEos {
private static final long serialVersionUID = 1000;

/**
Expand Down Expand Up @@ -45,29 +41,8 @@ public SystemPrEos1978(double T, double P) {
*/
public SystemPrEos1978(double T, double P, boolean checkForSolids) {
super(T, P, checkForSolids);
attractiveTermNumber = 13;
modelName = "PR1978-EOS";

for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhasePrEos();
phaseArray[i].setTemperature(T);
phaseArray[i].setPressure(P);
}

if (solidPhaseCheck) {
setNumberOfPhases(5);
phaseArray[numberOfPhases - 1] = new PhasePureComponentSolid();
phaseArray[numberOfPhases - 1].setTemperature(T);
phaseArray[numberOfPhases - 1].setPressure(P);
phaseArray[numberOfPhases - 1].setRefPhase(phaseArray[1].getRefPhase());
}

if (hydrateCheck) {
phaseArray[numberOfPhases - 1] = new PhaseHydrate();
phaseArray[numberOfPhases - 1].setTemperature(T);
phaseArray[numberOfPhases - 1].setPressure(P);
phaseArray[numberOfPhases - 1].setRefPhase(phaseArray[1].getRefPhase());
}
attractiveTermNumber = 6;
modelName = "PR78-EoS";
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,17 @@ public static SystemInterface read(String inputFile) {
fluid = new neqsim.thermo.system.SystemSrkEos(288.15,
ThermodynamicConstantsInterface.referencePressure);
} else if (EOS.contains("PR")) {
String corr = br.readLine().replace("/", "");
if (corr.equals("PRCORR")) {
fluid = new neqsim.thermo.system.SystemPrEos1978(288.15,
ThermodynamicConstantsInterface.referencePressure);
} else {
fluid = new neqsim.thermo.system.SystemPrEos(288.15,
ThermodynamicConstantsInterface.referencePressure);
}
} else {
fluid = new neqsim.thermo.system.SystemPrEos(288.15,
ThermodynamicConstantsInterface.referencePressure);
} else if (EOS.contains("PR78")) {
fluid = new neqsim.thermo.system.SystemPrEos1978(288.15,
ThermodynamicConstantsInterface.referencePressure);
}
}
if (st.equals("CNAMES")) {
Expand Down