Skip to content

Commit

Permalink
Merge branch 'master' into refact_getPhase
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Mar 14, 2024
2 parents ba49e1c + b8ca880 commit 8c30ba6
Show file tree
Hide file tree
Showing 65 changed files with 465 additions and 858 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_to_github_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3.6.0
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release_with_jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Check out neqsim java project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get version number for pomJava8.xml
id: java-8
uses: JActions/[email protected]
Expand All @@ -50,9 +50,9 @@ jobs:

steps:
- name: Check out neqsim java project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up JDK 8 environment
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
Expand All @@ -75,9 +75,9 @@ jobs:

steps:
- name: Check out neqsim java project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up JDK 11 environment
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
Expand All @@ -100,9 +100,9 @@ jobs:

steps:
- name: Check out neqsim java project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up JDK 21 environment
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/verify_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
name: Assert tests and javadoc with java 11
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
Expand All @@ -41,9 +41,9 @@ jobs:
needs: test_java_11

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
Expand All @@ -56,9 +56,9 @@ jobs:
name: Assert tests with java 21
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
![Build maven](https://github.com/equinor/neqsim/actions/workflows/verify_build.yml/badge.svg?branch=master)
[![Known Vulnerabilities](https://snyk.io/test/github/equinor/neqsim/badge.svg)](https://snyk.io/test/github/equinor/neqsim)
[![codecov](https://codecov.io/gh/equinor/neqsim/branch/master/graph/badge.svg?token=IRnbAwRDtc)](https://codecov.io/gh/equinor/neqsim)
[![SCM Compliance](https://scm-compliance-api.radix.equinor.com/repos/equinor/neqsim/badge)](https://scm-compliance-api.radix.equinor.com/repos/equinor/neqsim/badge)


NeqSim is the main part of the [NeqSim project](https://equinor.github.io/neqsimhome/). NeqSim (Non-Equilibrium Simulator) is a Java library for estimating fluid properties and process design.
The basis for NeqSim is a library of fundamental mathematical models related to phase behavior and physical properties of fluids. NeqSim is easilly extended with new models. NeqSim development was initiated at the [Norwegian University of Science and Technology (NTNU)](https://www.ntnu.edu/employees/even.solbraa).
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.22.1</version>
<version>2.23.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.22.1</version>
<version>2.23.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
38 changes: 17 additions & 21 deletions src/main/java/neqsim/thermo/component/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,41 +194,38 @@ public Component(int number, double TC, double PC, double M, double a, double mo
* Constructor for Component.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public Component(String component_name, double moles, double molesInPhase, int compnumber) {
createComponent(component_name, moles, molesInPhase, compnumber);
public Component(String name, double moles, double molesInPhase, int compIndex) {
createComponent(name, moles, molesInPhase, compIndex);
}

/** {@inheritDoc} */
@Override
public void createComponent(String component_name, double moles, double molesInPhase,
int compnumber) {
if (component_name == null) {
public void createComponent(String name, double moles, double molesInPhase, int compIndex) {
if (name == null) {
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"createComponent", "component_name", "can not be null"));
"createComponent", "name", "can not be null"));
}
if (component_name.trim() == "") {
if (name.trim() == "") {
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"createComponent", "component_name", "can not be empty"));
"createComponent", "name", "can not be empty"));
}
component_name = ComponentInterface.getComponentNameFromAlias(component_name);
componentName = component_name;
name = ComponentInterface.getComponentNameFromAlias(name);
componentName = name;
numberOfMoles = moles;
numberOfMolesInPhase = molesInPhase;
java.sql.ResultSet dataSet = null;
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
if (!component_name.equals("default")) {
if (!name.equals("default")) {
try {
if (NeqSimDataBase.createTemporaryTables()) {
dataSet = database
.getResultSet(("SELECT * FROM comptemp WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM comptemp WHERE name='" + name + "'"));
} else {
dataSet =
database.getResultSet(("SELECT * FROM comp WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM comp WHERE name='" + name + "'"));
}
dataSet.next();
dataSet.getString("ID");
Expand All @@ -237,9 +234,8 @@ public void createComponent(String component_name, double moles, double molesInP
try {
dataSet.close();
// logger.info("no parameters in tempcomp -- trying comp.. " +
// component_name);
dataSet =
database.getResultSet(("SELECT * FROM comp WHERE name='" + component_name + "'"));
// name);
dataSet = database.getResultSet(("SELECT * FROM comp WHERE name='" + name + "'"));
dataSet.next();
} catch (Exception e2) {
throw new RuntimeException(e2);
Expand Down Expand Up @@ -445,7 +441,7 @@ public void createComponent(String component_name, double moles, double molesInP
waxFormer = Integer.parseInt(dataSet.getString("waxformer")) == 1;
// System.out.println(componentName + " pure component parameters: ok...");
}
componentNumber = compnumber;
componentNumber = compIndex;
} catch (Exception ex) {
logger.error("error in comp", ex);
}
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/neqsim/thermo/component/ComponentBWRS.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,18 @@ public class ComponentBWRS extends ComponentSrk {
* Constructor for ComponentBWRS.
* </p>
*
* @param component_name a {@link java.lang.String} object
* @param moles a double
* @param molesInPhase a double
* @param compnumber a int
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentBWRS(String component_name, double moles, double molesInPhase, int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentBWRS(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);

try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
java.sql.ResultSet dataSet = null;
try {
dataSet = database
.getResultSet(("SELECT * FROM mbwr32param WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM mbwr32param WHERE name='" + name + "'"));
dataSet.next();
dataSet.getClob("name");
} catch (Exception ex) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/neqsim/thermo/component/ComponentCSPsrk.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public class ComponentCSPsrk extends ComponentSrk {
* Constructor for ComponentCSPsrk.
* </p>
*
* @param component_name a {@link java.lang.String} object
* @param moles a double
* @param molesInPhase a double
* @param compnumber a int
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentCSPsrk(String component_name, double moles, double molesInPhase, int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentCSPsrk(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down
23 changes: 10 additions & 13 deletions src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,25 @@ public class ComponentDesmukhMather extends ComponentGE {
* Constructor for ComponentDesmukhMather.
* </p>
*
* @param component_name a {@link java.lang.String} object
* @param moles a double
* @param molesInPhase a double
* @param compnumber a int
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentDesmukhMather(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentDesmukhMather(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
java.sql.ResultSet dataSet = null;

try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
if (!component_name.equals("default")) {
if (!name.equals("default")) {
try {
dataSet =
database.getResultSet(("SELECT * FROM comptemp WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM comptemp WHERE name='" + name + "'"));
dataSet.next();
dataSet.getString("FORMULA");
} catch (Exception ex) {
dataSet.close();
logger.info("no parameters in tempcomp -- trying comp.. " + component_name);
dataSet =
database.getResultSet(("SELECT * FROM comp WHERE name='" + component_name + "'"));
logger.info("no parameters in tempcomp -- trying comp.. " + name);
dataSet = database.getResultSet(("SELECT * FROM comp WHERE name='" + name + "'"));
dataSet.next();
}
deshMathIonicDiameter = Double.parseDouble(dataSet.getString("DeshMatIonicDiameter"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ public class ComponentElectrolyteCPA extends ComponentModifiedFurstElectrolyteEo
* Constructor for ComponentElectrolyteCPA.
* </p>
*
* @param component_name a {@link java.lang.String} object
* @param moles a double
* @param molesInPhase a double
* @param compnumber a int
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentElectrolyteCPA(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentElectrolyteCPA(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
xsite = new double[numberOfAssociationSites];
xsitedni = new double[numberOfAssociationSites][100];
xsitedV = new double[numberOfAssociationSites];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ public class ComponentElectrolyteCPAOld extends ComponentModifiedFurstElectrolyt
* Constructor for ComponentElectrolyteCPAOld.
* </p>
*
* @param component_name a {@link java.lang.String} object
* @param moles a double
* @param molesInPhase a double
* @param compnumber a int
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentElectrolyteCPAOld(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentElectrolyteCPAOld(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
xsite = new double[numberOfAssociationSites];
xsitedV = new double[numberOfAssociationSites];
xsiteOld = new double[numberOfAssociationSites];
Expand Down Expand Up @@ -271,8 +270,8 @@ public double calc_lngidV(PhaseInterface phase) {
return 2.0 * getBi() * (10.0)
/ ((8.0 * phase.getTotalVolume() - phase.getB())
* (4.0 * phase.getTotalVolume() - phase.getB()))
- 2.0 * getBi() * (10.0 * phase.getTotalVolume() - phase.getB()) * (32
* Math.pow(phase.getTotalVolume(), 2.0)
- 2.0 * getBi() * (10.0 * phase.getTotalVolume() - phase.getB())
* (32 * Math.pow(phase.getTotalVolume(), 2.0)
- 12.0 * phase.getTotalVolume() * phase.getB() + Math.pow(phase.getB(), 2.0))
/ Math.pow(((8.0 * phase.getTotalVolume() - phase.getB())
* (4.0 * phase.getTotalVolume() - phase.getB())), 2.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public class ComponentElectrolyteCPAstatoil extends ComponentElectrolyteCPA {
* Constructor for ComponentElectrolyteCPAstatoil.
* </p>
*
* @param component_name a {@link java.lang.String} object
* @param moles a double
* @param molesInPhase a double
* @param compnumber a int
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentElectrolyteCPAstatoil(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentElectrolyteCPAstatoil(String name, double moles, double molesInPhase,
int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/neqsim/thermo/component/ComponentEos.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ public abstract class ComponentEos extends Component implements ComponentEosInte
* Constructor for ComponentEos.
* </p>
*
* @param component_name a {@link java.lang.String} object
* @param moles a double
* @param molesInPhase a double
* @param compnumber a int
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentEos(String component_name, double moles, double molesInPhase, int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentEos(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down Expand Up @@ -226,6 +226,8 @@ public AttractiveTermInterface getAttractiveTerm() {
}

/**
* Get reduced temperature.
*
* @param temperature temperature of fluid
* @return double reduced temperature T/TC
*/
Expand All @@ -234,6 +236,10 @@ public AttractiveTermInterface getAttractiveTerm() {
}

/**
* <p>
* Get reduced pressure.
* </p>
*
* @param pressure pressure in unit bara
* @return double
*/
Expand Down
Loading

0 comments on commit 8c30ba6

Please sign in to comment.