Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Dec 9, 2024
1 parent 7a6c1e3 commit 7cb35f4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ public void calculate() {

this.thermoSystem.setPressure(TVP * 0.9);
try {
// ASTM D323 -08 method is used for this property calculation. It is defined at the pressure
// 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);
logger.error("not able to find RVP...", ex);
}

VPCR4 = this.thermoSystem.getPressure();
Expand All @@ -116,7 +117,8 @@ public void calculate() {
fluid1.init(0);
}
try {
// ASTM D323 -08 method is used for this property calculation. It is defined at the pressure
// 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,11 @@ public void TVflash(double Vspec) {
*/
public void TVfractionFlash(double Vspec) {
operation = new neqsim.thermodynamicoperations.flashops.TVfractionFlash(system, Vspec);
getOperation().run();
try {
getOperation().run();
} catch (Exception e) {
throw e;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ public double solveBeta() {
try {
ans = dQdBM.solve(dQM).transpose();
} catch (Exception ex) {
logger.error(ex.getMessage());
break;
}
betaMatrix = betaMatrix.minus(ans.scale(iter / (iter + 3.0)));
removePhase = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package neqsim.thermodynamicoperations.flashops;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.system.SystemInterface;

/**
Expand All @@ -18,6 +20,7 @@
*/
public class TVfractionFlash extends Flash {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(TVfractionFlash.class);

double Vfractionspec = 0;
Flash tpFlash;
Expand Down Expand Up @@ -86,12 +89,23 @@ public double solveQ() {
if (nyPres <= 0.0) {
nyPres = oldPres * 0.9;
}
if (Math.abs(nyPres - oldPres) >= 10.0) {
nyPres = oldPres + Math.signum(nyPres - oldPres) * 10.0;
}
system.setPressure(nyPres);
tpFlash.run();
if (system.getPressure() < 5000) {
tpFlash.run();
} else {
logger.error("too high pressure in TVfractionFLash.....stopping");
break;
}

error = Math.abs(dqdv / Vfractionspec);
// System.out.println("error " + error + "iteration " + iterations + " dQdv " + calcdQdV()
// + " new pressure " + nyPres + " error " + Math.abs((nyPres - oldPres) / (nyPres))
logger.debug("pressure " + nyPres + " iteration " + iterations);
// System.out.println("error " + error + "iteration " + iterations + " dQdv " +
// calcdQdV()
// + " new pressure " + nyPres + " error " + Math.abs((nyPres - oldPres) /
// (nyPres))
// + " numberofphases " + system.getNumberOfPhases());
} while ((error > 1e-6 && Math.abs(pressureStep) > 1e-6 && iterations < 200) || iterations < 6);
return nyPres;
Expand All @@ -109,8 +123,11 @@ public void run() {
}

// System.out.println("enthalpy: " + system.getEnthalpy());
solveQ();

try {
solveQ();
} catch (Exception e) {
throw e;
}
// System.out.println("volume: " + system.getVolume());
// System.out.println("Temperature: " + system.getTemperature());
}
Expand Down

0 comments on commit 7cb35f4

Please sign in to comment.