Skip to content

Commit

Permalink
fix solid calcs (#976)
Browse files Browse the repository at this point in the history
* fix solid flash

* update

* update

* update

* add chack for component in temp database

* remove output
  • Loading branch information
EvenSol authored Apr 1, 2024
1 parent ae2bc5f commit 7204d95
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 124 deletions.
9 changes: 8 additions & 1 deletion src/main/java/neqsim/thermo/component/ComponentSolid.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import neqsim.thermo.phase.PhaseInterface;
import neqsim.thermo.phase.PhaseType;
import neqsim.util.database.NeqSimDataBase;

/**
* <p>
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class PhasePureComponentSolid extends PhaseSolid {
*/
public PhasePureComponentSolid() {
super();
setType(PhaseType.SOLID);
}

/** {@inheritDoc} */
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/neqsim/thermo/phase/PhaseSolid.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public abstract class PhaseSolid extends PhaseSrkEos {
public PhaseSolid() {
super();
setType(PhaseType.SOLID);
calcMolarVolume = false;
}

/** {@inheritDoc} */
Expand All @@ -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());
}
Expand Down
Loading

0 comments on commit 7204d95

Please sign in to comment.