-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add EosMixingRuleType enum type and test
- Loading branch information
1 parent
9a34746
commit 05bc993
Showing
4 changed files
with
128 additions
and
12 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
src/main/java/neqsim/thermo/mixingrule/EosMixingRuleType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package neqsim.thermo.mixingrule; | ||
|
||
import neqsim.util.exception.InvalidInputException; | ||
|
||
/** | ||
* Types of EosMixingRule, relating to different kind of mixing rules relevant for EOS type phases. | ||
* Available types are: | ||
* <ul> | ||
* <li>NO - 1 - classic mixing rule with all kij set to zero</li> | ||
* <li>CLASSIC - 2 - classic mixing rule with kij from NeqSim database</li> | ||
* <li>HV - 4 - Huron Vidal mixing rule with parameters from NeqSim database</li> | ||
* <li>WS - 5 -</li> | ||
* <li>CPA_MIX - 7 - classic mixing rule with kij of CPA from NeqSim Database</li> | ||
* <li>CLASSIC_T - 8 - classic mixing rule with temperature dependent kij</li> | ||
* <li>CLASSIC_T_CPA - 9 - classic mixing rule with temperature dependent kij of CPA from NeqSim | ||
* database</li> | ||
* <li>CLASSIC_TX_CPA - 10 - classic mixing rule with temperature and composition dependent kij of | ||
* CPA from NeqSim database</li> | ||
* </ul> | ||
* | ||
* @author ASMF | ||
*/ | ||
public enum EosMixingRuleType { | ||
NO(1), CLASSIC(2), HV(4), WS(5), CPA_MIX(7), CLASSIC_T(8), CLASSIC_T_CPA(9), CLASSIC_TX_CPA(10); | ||
|
||
/** Holder for old style integer pt. */ | ||
private final int value; | ||
/** Holder for old style string physical property description. */ | ||
|
||
// We know we'll never mutate this, so we can keep | ||
// a local copy for fast lookup in forName | ||
private static final EosMixingRuleType[] copyOfValues = values(); | ||
|
||
/** | ||
* Constructor for EosMixingRuleType enum. | ||
* | ||
* @param value Numeric value index for mixing rule | ||
*/ | ||
private EosMixingRuleType(int value) { | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* Getter for property value. | ||
* | ||
* @return Numeric index of phase type | ||
*/ | ||
@Deprecated | ||
public int getValue() { | ||
return this.value; | ||
} | ||
|
||
/** | ||
* Get EosMixingRuleType by name. | ||
* | ||
* @param name Name to get EosMixingRuleType for. | ||
* @return EosMixingRuleType object | ||
*/ | ||
public static EosMixingRuleType byName(String name) { | ||
for (EosMixingRuleType mr : copyOfValues) { | ||
if (mr.name().equals(name.toUpperCase())) { | ||
return mr; | ||
} | ||
} | ||
throw new RuntimeException( | ||
new InvalidInputException("EosMixingRuleType", "byName", "name", "is not valid.")); | ||
} | ||
|
||
/** | ||
* Get EosMixingRuleTypes by value. | ||
* | ||
* @param value Value to get EosMixingRuleTypes for. | ||
* @return EosMixingRuleTypes object | ||
*/ | ||
public static EosMixingRuleType byValue(int value) { | ||
for (EosMixingRuleType mr : copyOfValues) { | ||
if (mr.getValue() == (value)) { | ||
return mr; | ||
} | ||
} | ||
throw new RuntimeException( | ||
new InvalidInputException("EosMixingRuleType", "byValue", "value", "is not valid.")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters