Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Oct 28, 2024
1 parent 3babb8d commit 9df7215
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void setPhysicalProperties(PhaseInterface phase, PhysicalPropertyModel pp
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @return a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalProperties} object
*/
public PhysicalProperties getPhysicalProperty(PhaseInterface phase) {
public PhysicalProperties getPhysicalProperties(PhaseInterface phase) {
switch (phase.getType()) {
case GAS:
return gasPhysicalProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*
* @author ASMF
*/

public enum PhysicalPropertyModel {
DEFAULT(0), WATER(1), GLYCOL(2), AMINE(3), CO2WATER(4), BASIC(6);

Expand Down
30 changes: 16 additions & 14 deletions src/main/java/neqsim/thermo/phase/Phase.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

/**
* Abstract Phase class. All Phase classes shall subclass this class.
*
*
* From wiki: A phase is a region of a space (a thermodynamic system), in neqsim named a
* SystemInterface, throughout which all physical properties of a material are essentially uniform.
* A SystemInterface can contain a single or multiple PhaseInterface objects.
*
*
* See PhaseType for the types of Phases that NeqSim is aware of. See also StateOfMatter.
*
*
* In NeqSim, there are multiple Phase classes, each representing a specific set of Equations Of
* State. Phases have corresponding Component classes and System classes to ensure same EoS is used
* throughout.
Expand Down Expand Up @@ -445,7 +445,7 @@ public PhysicalProperties getPhysicalProperties() {
if (physicalPropertyHandler == null) {
initPhysicalProperties();
}
return physicalPropertyHandler.getPhysicalProperty(this);
return physicalPropertyHandler.getPhysicalProperties(this);
}

/** {@inheritDoc} */
Expand All @@ -472,22 +472,24 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType

/** {@inheritDoc} */
@Override
public void setPhysicalPropertySystemType(PhysicalPropertyModel ppm) {
setPhysicalPropertyModel(ppm);
if (physicalPropertyHandler == null) {
physicalPropertyHandler = new PhysicalPropertyHandler();
}
physicalPropertyHandler.setPhysicalProperties(this, ppm);
public void setPpm(PhysicalPropertyModel ppm) {
this.ppm = ppm;
}

/** {@inheritDoc} */
@Override
public PhysicalPropertyModel getPhysicalPropertyModel() {
return this.ppm;
}

/** {@inheritDoc} */
@Override
public void setPhysicalPropertyModel(PhysicalPropertyModel ppm) {
this.ppm = ppm;
setPpm(ppm);
if (physicalPropertyHandler == null) {
physicalPropertyHandler = new PhysicalPropertyHandler();
}
physicalPropertyHandler.setPhysicalProperties(this, ppm);
}

/** {@inheritDoc} */
Expand All @@ -503,10 +505,9 @@ public void initPhysicalProperties() {
physicalPropertyHandler = new PhysicalPropertyHandler();
}

if (physicalPropertyHandler.getPhysicalProperty(this) == null) {
if (physicalPropertyHandler.getPhysicalProperties(this) == null) {
setPhysicalPropertyModel(ppm);
}
getPhysicalProperties().setPhase(this);
getPhysicalProperties().init(this);
}

Expand All @@ -517,13 +518,14 @@ public void initPhysicalProperties(PhysicalPropertyType ppt) {
physicalPropertyHandler = new PhysicalPropertyHandler();
}

if (physicalPropertyHandler.getPhysicalProperty(this) == null) {
if (physicalPropertyHandler.getPhysicalProperties(this) == null) {
setPhysicalPropertyModel(ppm);
}
getPhysicalProperties().setPhase(this);
getPhysicalProperties().init(this, ppt);
}

/** {@inheritDoc} */
public void setPhysicalProperties(PhysicalPropertyModel ppm) {
physicalPropertyHandler.setPhysicalProperties(this, ppm);
}
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/neqsim/thermo/phase/PhaseInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -814,20 +814,28 @@ public default void setPhysicalProperties() {
*/
public void setPhysicalProperties(PhysicalPropertyModel ppm);

/**
* <p>
* Getter for property ppm.
* </p>
*
* @return a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel} object
*/
public PhysicalPropertyModel getPhysicalPropertyModel();

/**
* <p>
* Setter for property physicalPropertySystemType.
* Setter for property ppm.
* </p>
*
* @param ppm PhysicalPropertyModel enum object
*/
public void setPhysicalPropertySystemType(PhysicalPropertyModel ppm);
public void setPpm(PhysicalPropertyModel ppm);

/**
*
* @param ppm
* <p>setPhysicalPropertyModel.</p>
*
* @param ppm a {@link neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel} object
*/
public void setPhysicalPropertyModel(PhysicalPropertyModel ppm);

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/neqsim/thermo/system/SystemInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -2451,7 +2451,11 @@ public void setImplementedTemperatureDeriativesofFugacity(
*
* @param ppm PhysicalPropertyModel enum object
*/
public void setPhysicalPropertyModel(PhysicalPropertyModel ppm);
public default void setPhysicalPropertyModel(PhysicalPropertyModel ppm) {
for (int i = 0; i < getNumberOfPhases(); i++) {
getPhase(i).setPhysicalPropertyModel(ppm);
}
}

/**
* method to set the pressure of a fluid (same pressure for all phases).
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import neqsim.physicalproperties.PhysicalPropertyType;
import neqsim.physicalproperties.interfaceproperties.InterfaceProperties;
import neqsim.physicalproperties.interfaceproperties.InterphasePropertiesInterface;
import neqsim.physicalproperties.physicalpropertysystem.PhysicalPropertyModel;
import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.ThermodynamicModelSettings;
import neqsim.thermo.characterization.Characterise;
Expand Down Expand Up @@ -4780,14 +4779,6 @@ public void setPhaseType(int phaseToChange, PhaseType pt) {
}
}

/** {@inheritDoc} */
@Override
public void setPhysicalPropertyModel(PhysicalPropertyModel ppm) {
for (int i = 0; i < numberOfPhases; i++) {
getPhase(i).setPhysicalPropertyModel(ppm);
}
}

/** {@inheritDoc} */
@Override
public final void setPressure(double newPressure) {
Expand Down

0 comments on commit 9df7215

Please sign in to comment.