Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact: getPhases()[k] -> getPhase(k) #1190

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asmfstatoil
Copy link
Collaborator

No description provided.

}
system.init(1);
// logger.info("solid phase will form..." + system.getNumberOfPhases());
// logger.info("freezing component " + solid);
system.setBeta(system.getNumberOfPhases() - 1, frac);
system.initBeta();
system.setBeta(system.getNumberOfPhases() - 1,
system.getPhases()[3].getComponent(solid).getNumberOfmoles()
/ system.getNumberOfMoles());
system.getPhase(3).getComponent(solid).getNumberOfmoles() / system.getNumberOfMoles());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

@@ -397,36 +397,35 @@ public void solidPhaseFlash() {
tempVar[k] = system.getPhase(0).getComponent(k).getz();
for (int i = 0; i < system.getNumberOfPhases() - 1; i++) {
tempVar[k] -=
system.getBeta(i) * system.getPhases()[3].getComponent(k).getFugacityCoefficient()
system.getBeta(i) * system.getPhase(3).getComponent(k).getFugacityCoefficient()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

Copy link
Collaborator

@EvenSol EvenSol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thin every time we need to use solid phases like solid, hdyrate etc., we need to use the phase array.

/ system.getPhase(i).getComponent(k).getFugacityCoefficient();
}

if (tempVar[k] > 0.0 && tempVar[k] > frac) {
solidPhase = true;
solid = k;
frac = tempVar[k];
for (int p = 0; p < system.getPhases()[0].getNumberOfComponents(); p++) {
system.getPhases()[3].getComponent(p).setx(1.0e-20);
for (int p = 0; p < system.getPhase(0).getNumberOfComponents(); p++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

@@ -68,7 +68,7 @@ public void run() {
* double solidEnthalpy = 0.0;
*
* if (system.doSolidPhaseCheck()) { system.init(3, 3); solidEnthalpy =
* system.getPhases()[3].getEnthalpy() / system.getPhases()[3].getNumberOfMolesInPhase()
* system.getPhase(3).getEnthalpy() / system.getPhase(3).getNumberOfMolesInPhase()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

@@ -137,7 +137,7 @@ public void calcE() {
// system.getBeta(system.getNumberOfPhases()-1) /
// system.getPhase(3).getComponent(solidComponent).getFugacityCoefficient();
E[solidComponent] = system.getPhase(0).getComponent(solidComponent).getz()
/ system.getPhases()[3].getComponents()[solidComponent].getFugacityCoefficient();
/ system.getPhase(3).getComponents()[solidComponent].getFugacityCoefficient();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

1.0 - system.getPhases()[3].getComponents()[solidComponent].getFugacityCoefficient()
/ system.getPhase(k).getComponent(solidComponent).getFugacityCoefficient();
for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) {
dQdbeta[k] = 1.0 - system.getPhase(3).getComponents()[solidComponent].getFugacityCoefficient()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

if (i != solidIndex) {
system.getPhase(k).getComponent(i).setx(system.getPhase(0).getComponent(i).getz() / E[i]
/ system.getPhase(k).getComponent(i).getFugacityCoefficient());
} else {
system.getPhase(k).getComponent(i)
.setx(system.getPhases()[3].getComponent(i).getFugacityCoefficient()
.setx(system.getPhase(3).getComponent(i).getFugacityCoefficient()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.


for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) {
if (system.getTemperature() > system.getPhase(0).getComponent(k)
.getTriplePointTemperature()) {
solidCandidate[k] = -10;
} else {
solidCandidate[k] = system.getPhase(0).getComponent(k).getz();
system.getPhases()[3].getComponent(k).setx(1.0);
system.getPhase(3).getComponent(k).setx(1.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.


for (int i = 0; i < system.getNumberOfPhases(); i++) {
solidCandidate[k] -= system.getPhases()[3].getComponent(k).fugcoef(system.getPhases()[3])
solidCandidate[k] -= system.getPhase(3).getComponent(k).fugcoef(system.getPhase(3))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

/ system.getPhase(i).getComponent(k).getFugacityCoefficient();
}
}
}

for (int i = 0; i < solidCandidate.length; i++) {
if (solidCandidate[i] > 0.0) {
system.getPhases()[3].getComponent(i).setx(1.0);
system.getPhase(3).getComponent(i).setx(1.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

solidIndex = i;
solidsNumber++;
} else {
system.getPhases()[3].getComponent(i).setx(0.0);
system.getPhase(3).getComponent(i).setx(0.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

solidCandidate -=
system.getPhases()[3].getComponent(solidIndex).fugcoef(system.getPhases()[3])
/ system.getPhase(i).getComponent(solidIndex).getFugacityCoefficient();
solidCandidate -= system.getPhase(3).getComponent(solidIndex).fugcoef(system.getPhase(3))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

@@ -1184,7 +1184,7 @@ public void hydrateFormationTemperature(int structure) throws IsNaNException {
}

for (int i = 0; i < system.getPhase(4).getNumberOfComponents(); i++) {
((ComponentHydrate) system.getPhases()[4].getComponent(i)).setHydrateStructure(structure - 1);
((ComponentHydrate) system.getPhase(4).getComponent(i)).setHydrateStructure(structure - 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[4] - as the hydrate phase is always number four (and getPhase(4) can point to a different phase.

}
system.getPhases()[3].getComponents()[solid].setx(1.0);
system.getPhase(3).getComponents()[solid].setx(1.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I beleive we have to used system.getPhases()[3] - as the solid phase is always number three (and getPhase(3) can point to a different phase.

@asmfstatoil asmfstatoil marked this pull request as draft November 26, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants