Skip to content

Commit 9f53a0a

Browse files
authored
added methods for field allocation (#1272)
* added methods for field allocation * update doc leachman * update
1 parent 264f7a2 commit 9f53a0a

File tree

10 files changed

+1382
-955
lines changed

10 files changed

+1382
-955
lines changed

src/main/java/neqsim/thermo/phase/Phase.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -2231,8 +2231,8 @@ public double[] getProperties_GERG2008() {
22312231
/** {@inheritDoc} */
22322232
@Override
22332233
public double getDensity_Leachman(String hydrogenType) {
2234-
neqsim.thermo.util.Leachman.NeqSimLeachman test =
2235-
new neqsim.thermo.util.Leachman.NeqSimLeachman(this, hydrogenType);
2234+
neqsim.thermo.util.leachman.NeqSimLeachman test =
2235+
new neqsim.thermo.util.leachman.NeqSimLeachman(this, hydrogenType);
22362236
return test.getDensity();
22372237
}
22382238

@@ -2253,8 +2253,8 @@ public double getDensity_Leachman() {
22532253
/** {@inheritDoc} */
22542254
@Override
22552255
public double[] getProperties_Leachman(String hydrogenType) {
2256-
neqsim.thermo.util.Leachman.NeqSimLeachman test =
2257-
new neqsim.thermo.util.Leachman.NeqSimLeachman(this, hydrogenType);
2256+
neqsim.thermo.util.leachman.NeqSimLeachman test =
2257+
new neqsim.thermo.util.leachman.NeqSimLeachman(this, hydrogenType);
22582258
return test.propertiesLeachman();
22592259
}
22602260

src/main/java/neqsim/thermo/phase/PhaseInterface.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -422,16 +422,17 @@ public default void initPhysicalProperties(String name) {
422422

423423
/**
424424
* method to get Leachman density of a phase using the Leachman EoS.
425-
*
425+
*
426+
* @param hydrogenType Supported types are 'normal', 'para', 'ortho'
426427
* @return density with unit kg/m3
427428
*/
428429
public double getDensity_Leachman(String hydrogenType);
429430

430431
/**
431-
* Overloaded method to get the Leachman density with default hydrogen type ('normal').
432-
*
433-
* @return density with unit kg/m3
434-
*/
432+
* Overloaded method to get the Leachman density with default hydrogen type ('normal').
433+
*
434+
* @return density with unit kg/m3
435+
*/
435436
public double getDensity_Leachman();
436437

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

447448
/**
448-
* Overloaded method to get the Leachman properties with default hydrogen type ('normal').
449-
*
450-
* @return density with unit kg/m3
451-
*/
449+
* Overloaded method to get the Leachman properties with default hydrogen type ('normal').
450+
*
451+
* @return density with unit kg/m3
452+
*/
452453

453454
public double[] getProperties_Leachman();
454455

src/main/java/neqsim/thermo/system/SystemInterface.java

+8
Original file line numberDiff line numberDiff line change
@@ -2663,4 +2663,12 @@ public default void setPhysicalPropertyModel(int type) {
26632663
* @return a boolean
26642664
*/
26652665
public boolean isInitialized();
2666+
2667+
/**
2668+
* Sets the molar composition of components whose names contain the specified definition.
2669+
*
2670+
* @param nameDef the definition to match component names against
2671+
* @param molarComposition an array of molar compositions to set for the matching components
2672+
*/
2673+
public void setMolarCompositionOfNamedComponents(String nameDef, double[] molarComposition);
26662674
}

src/main/java/neqsim/thermo/system/SystemThermo.java

+19
Original file line numberDiff line numberDiff line change
@@ -5083,4 +5083,23 @@ public void setForceSinglePhase(PhaseType phasetype) {
50835083
public void setForceSinglePhase(String phasetype) {
50845084
setForceSinglePhase(PhaseType.byName(phasetype));
50855085
}
5086+
5087+
/**
5088+
* Sets the molar composition of components whose names contain the specified definition.
5089+
*
5090+
* @param nameDef the definition to match component names against
5091+
* @param molarComposition an array of molar compositions to set for the matching components
5092+
*/
5093+
public void setMolarCompositionOfNamedComponents(String nameDef, double[] molarComposition) {
5094+
int place = 0;
5095+
double[] comp = new double[getNumberOfComponents()];
5096+
for (int i = 0; i < getNumberOfComponents(); i++) {
5097+
comp[i] = 0.0;
5098+
if (getPhase(0).getComponent(i).getName().contains(nameDef)) {
5099+
comp[i] = molarComposition[place];
5100+
place++;
5101+
}
5102+
}
5103+
setMolarComposition(comp);
5104+
}
50865105
}

0 commit comments

Comments
 (0)