Skip to content

Commit

Permalink
Merge branch 'master' into rm_phaseEOSIntrerface_1
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Sep 20, 2022
2 parents c13697f + 78a327b commit bc2538a
Show file tree
Hide file tree
Showing 11 changed files with 644 additions and 649 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@ test_*.ser

#Intellij IDEA
.idea

# doxygen results
html/
latex/
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,8 @@ public void calcNonIdealCorrections(int phase) {
nonIdealCorrections[phase].set(i, j,
temp + bulkSystem.getPhases()[phase].getComponents()[i].getx()
* bulkSystem.getPhases()[phase].getComponents()[i].getdfugdn(j)
* bulkSystem.getPhases()[phase].getNumberOfMolesInPhase()); // her
// maa
// det
// fylles
// inn
* bulkSystem.getPhases()[phase].getNumberOfMolesInPhase());
// her må det fylles inn
}
}
// System.out.println("non-id");
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,56 @@
* @version $Id: $Id
*/
public class Wall implements WallInterface {
/**
* <p>
* Getter for the field <code>heatTransferCoefficient</code>.
* </p>
*
* @return the heatTransferCOefficient
*/
public double getHeatTransferCoefficient() {
return heatTransferCoefficient;
}
/**
* <p>
* Getter for the field <code>heatTransferCoefficient</code>.
* </p>
*
* @return the heatTransferCOefficient
*/
public double getHeatTransferCoefficient() {
return heatTransferCoefficient;
}

/**
* <p>
* Setter for the field <code>heatTransferCoefficient</code>.
* </p>
*
* @param heatTransferCOefficient the heatTransferCOefficient to set
*/
public void setHeatTransferCoefficient(double heatTransferCOefficient) {
this.heatTransferCoefficient = heatTransferCOefficient;
}
/**
* <p>
* Setter for the field <code>heatTransferCoefficient</code>.
* </p>
*
* @param heatTransferCOefficient the heatTransferCOefficient to set
*/
public void setHeatTransferCoefficient(double heatTransferCOefficient) {
this.heatTransferCoefficient = heatTransferCOefficient;
}

private ArrayList<MaterialLayer> wallMaterialLayers = new ArrayList<MaterialLayer>();
private double heatTransferCoefficient = 10.0;
private ArrayList<MaterialLayer> wallMaterialLayers = new ArrayList<MaterialLayer>();
private double heatTransferCoefficient = 10.0;

/** {@inheritDoc} */
@Override
public void addMaterialLayer(MaterialLayer layer) {
wallMaterialLayers.add(layer);
heatTransferCoefficient = calcHeatTransferCoefficient();
}
/** {@inheritDoc} */
@Override
public void addMaterialLayer(MaterialLayer layer) {
wallMaterialLayers.add(layer);
heatTransferCoefficient = calcHeatTransferCoefficient();
}

/** {@inheritDoc} */
@Override
public MaterialLayer getWallMaterialLayer(int i) {
return wallMaterialLayers.get(i);
}
/** {@inheritDoc} */
@Override
public MaterialLayer getWallMaterialLayer(int i) {
return wallMaterialLayers.get(i);
}

/**
* <p>
* calcHeatTransferCoefficient.
* </p>
*
* @return a double
*/
public double calcHeatTransferCoefficient() {
double invheatTransCoef = 0.0;
for (MaterialLayer mat : wallMaterialLayers) {
invheatTransCoef += 1.0 / (mat.getConductivity() / mat.getThickness());
}
return 1.0 / invheatTransCoef;
/**
* <p>
* calcHeatTransferCoefficient.
* </p>
*
* @return a double
*/
public double calcHeatTransferCoefficient() {
double invheatTransCoef = 0.0;
for (MaterialLayer mat : wallMaterialLayers) {
invheatTransCoef += 1.0 / (mat.getConductivity() / mat.getThickness());
}
return 1.0 / invheatTransCoef;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,75 +14,74 @@
* @version $Id: $Id
*/
public class GTSurfaceTensionUtils {
private static final double Pa = 1e-5;
private static final double m3 = 1e-5;
private static final double Pa = 1e-5;
private static final double m3 = 1e-5;

/**
* Calculate chemical potential, chemical potential derivative, and pressure.
*
* Note that the volume/pressure units used in NeqSim renders the number density incorrect by a
* factor of 1e5. When selecting the volume to unity to avoid caring about volume derivatives
* when using number density as the free variable, the mole number input to NeqSIM must be
* scaled by a factor 1e-5. The chemical potential is unaffected by this as it is a intensive
* property. The chemical potential derivative will scale inversely proportional with the mole
* numbers according to the Euler homogeneity of the Gibbs energy function.
*
* @param sys a {@link neqsim.thermo.system.SystemInterface} object
* @param ncomp a int
* @param t a double
* @param rho an array of {@link double} objects
* @param mu an array of {@link double} objects
* @param dmu_drho an array of {@link double} objects
* @param p an array of {@link double} objects
*/
public static void mufun(SystemInterface sys, int ncomp, double t, double[] rho, double[] mu,
double[][] dmu_drho, double[] p) {
double v = 1.0;
double n;
int i, j;
PhaseInterface phase;
/**
* Calculate chemical potential, chemical potential derivative, and pressure.
*
* Note that the volume/pressure units used in NeqSim renders the number density incorrect by a
* factor of 1e5. When selecting the volume to unity to avoid caring about volume derivatives when
* using number density as the free variable, the mole number input to NeqSIM must be scaled by a
* factor 1e-5. The chemical potential is unaffected by this as it is a intensive property. The
* chemical potential derivative will scale inversely proportional with the mole numbers according
* to the Euler homogeneity of the Gibbs energy function.
*
* @param sys a {@link neqsim.thermo.system.SystemInterface} object
* @param ncomp a int
* @param t a double
* @param rho an array of {@link double} objects
* @param mu an array of {@link double} objects
* @param dmu_drho an array of {@link double} objects
* @param p an array of {@link double} objects
*/
public static void mufun(SystemInterface sys, int ncomp, double t, double[] rho, double[] mu,
double[][] dmu_drho, double[] p) {
double v = 1.0;
double n;
int i, j;
PhaseInterface phase;

double[] nv = new double[ncomp];
phase = sys.getPhase(0);
sys.setTemperature(t);
phase.setTotalVolume(v);
double[] nv = new double[ncomp];
phase = sys.getPhase(0);
sys.setTemperature(t);
phase.setTotalVolume(v);

for (i = 0; i < ncomp; i++) {
if (rho[i] < 0.) {
throw new RuntimeException("Number density is negative.");
}
// ComponentInterface component = phase.getComponent(i);
n = rho[i] * Pa;
nv[i] = n;
}
for (i = 0; i < ncomp; i++) {
if (rho[i] < 0.) {
throw new RuntimeException("Number density is negative.");
}
// ComponentInterface component = phase.getComponent(i);
n = rho[i] * Pa;
nv[i] = n;
}

// Set the composition multiple times to overcome round off error
// in NeqSIM due to n += (n_new - nold)
// sys.setMolarComposition(nv);
// sys.setMolarComposition(nv);
// sys.setMolarComposition(nv);
// Set the composition multiple times to overcome round off error
// in NeqSIM due to n += (n_new - nold)
// sys.setMolarComposition(nv);
// sys.setMolarComposition(nv);
// sys.setMolarComposition(nv);

sys.setMolarFlowRates(nv);
// sys.setMolarFlowRates(nv);
// sys.setMolarFlowRates(nv);
sys.setMolarFlowRates(nv);
// sys.setMolarFlowRates(nv);
// sys.setMolarFlowRates(nv);

sys.init_x_y();
sys.setBeta(1.0);
sys.init(3);
sys.init_x_y();
sys.setBeta(1.0);
sys.init(3);

for (i = 0; i < ncomp; i++) {
mu[i] = sys.getPhase(0).getComponent(i).getChemicalPotential(sys.getPhase(0));
if (Double.isNaN(mu[i])) {
throw new RuntimeException("Thermo returned NaN for chemical potential.");
}
for (j = 0; j < ncomp; j++) {
dmu_drho[i][j] =
sys.getPhase(0).getComponent(i).getChemicalPotentialdNTV(j, sys.getPhase(0))
* Pa;
}
}
p[0] = sys.getPhase(0).getPressure() / Pa;
for (i = 0; i < ncomp; i++) {
mu[i] = sys.getPhase(0).getComponent(i).getChemicalPotential(sys.getPhase(0));
if (Double.isNaN(mu[i])) {
throw new RuntimeException("Thermo returned NaN for chemical potential.");
}
for (j = 0; j < ncomp; j++) {
dmu_drho[i][j] =
sys.getPhase(0).getComponent(i).getChemicalPotentialdNTV(j, sys.getPhase(0)) * Pa;
}
}
p[0] = sys.getPhase(0).getPressure() / Pa;
}

private GTSurfaceTensionUtils() {}
private GTSurfaceTensionUtils() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,17 @@ public void calcDesign() {
SimpleAdsorber separator = (SimpleAdsorber) getProcessEquipment();
// double Fg = 1.0;

double emptyVesselWeight = 0.0, internalsWeight = 0.0, externalNozzelsWeight = 0.0;
double pipingWeight = 0.0, structualWeight = 0.0, electricalWeight = 0.0;
double emptyVesselWeight = 0.0;
double internalsWeight = 0.0;
double externalNozzelsWeight = 0.0;
double pipingWeight = 0.0;
double structualWeight = 0.0;
double electricalWeight = 0.0;
double totalSkidWeight = 0.0;

double moduleWidth = 0.0, moduleHeight = 0.0, moduleLength = 0.0;

double moduleWidth = 0.0;
double moduleHeight = 0.0;
double moduleLength = 0.0;
double materialsCost = 0.0;
// double sepLength = 0.0;

Expand Down
Loading

0 comments on commit bc2538a

Please sign in to comment.