Skip to content

Commit

Permalink
added methods for field allocation (#1272)
Browse files Browse the repository at this point in the history
* added methods for field allocation

* update doc leachman

* update
  • Loading branch information
EvenSol authored Feb 8, 2025
1 parent 264f7a2 commit 9f53a0a
Show file tree
Hide file tree
Showing 10 changed files with 1,382 additions and 955 deletions.
8 changes: 4 additions & 4 deletions src/main/java/neqsim/thermo/phase/Phase.java
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,8 @@ public double[] getProperties_GERG2008() {
/** {@inheritDoc} */
@Override
public double getDensity_Leachman(String hydrogenType) {
neqsim.thermo.util.Leachman.NeqSimLeachman test =
new neqsim.thermo.util.Leachman.NeqSimLeachman(this, hydrogenType);
neqsim.thermo.util.leachman.NeqSimLeachman test =
new neqsim.thermo.util.leachman.NeqSimLeachman(this, hydrogenType);
return test.getDensity();
}

Expand All @@ -2253,8 +2253,8 @@ public double getDensity_Leachman() {
/** {@inheritDoc} */
@Override
public double[] getProperties_Leachman(String hydrogenType) {
neqsim.thermo.util.Leachman.NeqSimLeachman test =
new neqsim.thermo.util.Leachman.NeqSimLeachman(this, hydrogenType);
neqsim.thermo.util.leachman.NeqSimLeachman test =
new neqsim.thermo.util.leachman.NeqSimLeachman(this, hydrogenType);
return test.propertiesLeachman();
}

Expand Down
19 changes: 10 additions & 9 deletions src/main/java/neqsim/thermo/phase/PhaseInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,17 @@ public default void initPhysicalProperties(String name) {

/**
* method to get Leachman density of a phase using the Leachman EoS.
*
*
* @param hydrogenType Supported types are 'normal', 'para', 'ortho'
* @return density with unit kg/m3
*/
public double getDensity_Leachman(String hydrogenType);

/**
* Overloaded method to get the Leachman density with default hydrogen type ('normal').
*
* @return density with unit kg/m3
*/
* Overloaded method to get the Leachman density with default hydrogen type ('normal').
*
* @return density with unit kg/m3
*/
public double getDensity_Leachman();

/**
Expand All @@ -445,10 +446,10 @@ public default void initPhysicalProperties(String name) {
public double[] getProperties_Leachman(String hydrogenType);

/**
* Overloaded method to get the Leachman properties with default hydrogen type ('normal').
*
* @return density with unit kg/m3
*/
* Overloaded method to get the Leachman properties with default hydrogen type ('normal').
*
* @return density with unit kg/m3
*/

public double[] getProperties_Leachman();

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/neqsim/thermo/system/SystemInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -2663,4 +2663,12 @@ public default void setPhysicalPropertyModel(int type) {
* @return a boolean
*/
public boolean isInitialized();

/**
* Sets the molar composition of components whose names contain the specified definition.
*
* @param nameDef the definition to match component names against
* @param molarComposition an array of molar compositions to set for the matching components
*/
public void setMolarCompositionOfNamedComponents(String nameDef, double[] molarComposition);
}
19 changes: 19 additions & 0 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -5083,4 +5083,23 @@ public void setForceSinglePhase(PhaseType phasetype) {
public void setForceSinglePhase(String phasetype) {
setForceSinglePhase(PhaseType.byName(phasetype));
}

/**
* Sets the molar composition of components whose names contain the specified definition.
*
* @param nameDef the definition to match component names against
* @param molarComposition an array of molar compositions to set for the matching components
*/
public void setMolarCompositionOfNamedComponents(String nameDef, double[] molarComposition) {
int place = 0;
double[] comp = new double[getNumberOfComponents()];
for (int i = 0; i < getNumberOfComponents(); i++) {
comp[i] = 0.0;
if (getPhase(0).getComponent(i).getName().contains(nameDef)) {
comp[i] = molarComposition[place];
place++;
}
}
setMolarComposition(comp);
}
}
Loading

0 comments on commit 9f53a0a

Please sign in to comment.