Skip to content

Commit 9a9886f

Browse files
committed
update
1 parent 9825ccf commit 9a9886f

File tree

9 files changed

+334
-244
lines changed

9 files changed

+334
-244
lines changed

src/main/java/neqsim/process/processmodel/JsonProcessBuilder.java

Lines changed: 71 additions & 71 deletions
Large diffs are not rendered by default.

src/main/java/neqsim/thermo/component/ComponentEos.java

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@ public abstract class ComponentEos extends Component implements ComponentEosInte
9797
* Constructor for ComponentEos.
9898
* </p>
9999
*
100-
* @param name Name of component.
101-
* @param moles Total number of moles of component.
100+
* @param name Name of component.
101+
* @param moles Total number of moles of component.
102102
* @param molesInPhase Number of moles in phase.
103-
* @param compIndex Index number of component in phase object component array.
103+
* @param compIndex Index number of component in phase object component
104+
* array.
104105
*/
105106
public ComponentEos(String name, double moles, double molesInPhase, int compIndex) {
106107
super(name, moles, molesInPhase, compIndex);
@@ -112,11 +113,11 @@ public ComponentEos(String name, double moles, double molesInPhase, int compInde
112113
* </p>
113114
*
114115
* @param number a int. Not used.
115-
* @param TC Critical temperature [K]
116-
* @param PC Critical pressure [bara]
117-
* @param M Molar mass
118-
* @param a Acentric factor
119-
* @param moles Total number of moles of component.
116+
* @param TC Critical temperature [K]
117+
* @param PC Critical pressure [bara]
118+
* @param M Molar mass
119+
* @param a Acentric factor
120+
* @param moles Total number of moles of component.
120121
*/
121122
public ComponentEos(int number, double TC, double PC, double M, double a, double moles) {
122123
super(number, TC, PC, M, a, moles);
@@ -335,9 +336,8 @@ public double getaT() {
335336
public double fugcoef(PhaseInterface phase) {
336337
double temperature = phase.getTemperature();
337338
double pressure = phase.getPressure();
338-
double logFugacityCoefficient =
339-
dFdN(phase, phase.getNumberOfComponents(), temperature, pressure)
340-
- Math.log(pressure * phase.getMolarVolume() / (R * temperature));
339+
double logFugacityCoefficient = dFdN(phase, phase.getNumberOfComponents(), temperature, pressure)
340+
- Math.log(pressure * phase.getMolarVolume() / (R * temperature));
341341
fugacityCoefficient = Math.exp(logFugacityCoefficient);
342342
return fugacityCoefficient;
343343
}
@@ -395,7 +395,8 @@ public double[] logfugcoefdN(PhaseInterface phase) {
395395

396396
// Method added by Neeraj
397397
/*
398-
* public double getdfugdn(int i){ double[] dfugdnv = this.logfugcoefdN(phase); //return 0.0001;
398+
* public double getdfugdn(int i){ double[] dfugdnv = this.logfugcoefdN(phase);
399+
* //return 0.0001;
399400
* return dfugdnv[i]; }
400401
*/
401402
// Added By Neeraj
@@ -519,7 +520,8 @@ public double getdBdT() {
519520

520521
/** {@inheritDoc} */
521522
@Override
522-
public void setdBdTdT(double val) {}
523+
public void setdBdTdT(double val) {
524+
}
523525

524526
/** {@inheritDoc} */
525527
@Override
@@ -590,7 +592,7 @@ public double diffdiffaT(double temperature) {
590592
/** {@inheritDoc} */
591593
@Override
592594
public double[] getDeltaEosParameters() {
593-
double[] param = {delta1, delta2};
595+
double[] param = { delta1, delta2 };
594596
return param;
595597
}
596598

@@ -601,8 +603,10 @@ public void seta(double a) {
601603
}
602604

603605
/**
604-
* Override the OmegaA parameter used in {@link #calca()}. Once set, every call to
605-
* {@code calca()} (including those triggered by {@code init()}) will use this value instead of
606+
* Override the OmegaA parameter used in {@link #calca()}. Once set, every call
607+
* to
608+
* {@code calca()} (including those triggered by {@code init()}) will use this
609+
* value instead of
606610
* the EOS class default. Use {@code Double.NaN} to revert to the EOS default.
607611
*
608612
* @param omegaA the OmegaA value, e.g. 0.45724 for PR or 0.42748 for SRK.
@@ -612,7 +616,8 @@ public void setOmegaA(double omegaA) {
612616
}
613617

614618
/**
615-
* Returns true when a per-component OmegaA override has been set via {@link #setOmegaA}.
619+
* Returns true when a per-component OmegaA override has been set via
620+
* {@link #setOmegaA}.
616621
*
617622
* @return true if an OmegaA override is active
618623
*/
@@ -621,7 +626,8 @@ public boolean hasOmegaAOverride() {
621626
}
622627

623628
/**
624-
* Returns the active OmegaA value, or {@code Double.NaN} when no override has been set.
629+
* Returns the active OmegaA value, or {@code Double.NaN} when no override has
630+
* been set.
625631
*
626632
* @return active OmegaA override, or NaN
627633
*/
@@ -648,12 +654,16 @@ public void setb(double b) {
648654
public double getSurfaceTenisionInfluenceParameter(double temperature) {
649655
/*
650656
* double a_inf = -3.471 + 4.927 * getCriticalCompressibilityFactor() + 13.085 *
651-
* Math.pow(getCriticalCompressibilityFactor(), 2.0) - 2.067 * getAcentricFactor() + 1.891 *
657+
* Math.pow(getCriticalCompressibilityFactor(), 2.0) - 2.067 *
658+
* getAcentricFactor() + 1.891 *
652659
* Math.pow(getAcentricFactor(), 2.0); double b_inf = -1.690 + 2.311 *
653-
* getCriticalCompressibilityFactor() + 5.644 * Math.pow(getCriticalCompressibilityFactor(),
654-
* 2.0) - 1.027 * getAcentricFactor() + 1.424 * Math.pow(getAcentricFactor(), 2.0); double c_inf
660+
* getCriticalCompressibilityFactor() + 5.644 *
661+
* Math.pow(getCriticalCompressibilityFactor(),
662+
* 2.0) - 1.027 * getAcentricFactor() + 1.424 * Math.pow(getAcentricFactor(),
663+
* 2.0); double c_inf
655664
* = -0.318 + 0.299 * getCriticalCompressibilityFactor() + 1.710 *
656-
* Math.pow(getCriticalCompressibilityFactor(), 2.0) - 0.174 * getAcentricFactor() + 0.157 *
665+
* Math.pow(getCriticalCompressibilityFactor(), 2.0) - 0.174 *
666+
* getAcentricFactor() + 0.157 *
657667
* Math.pow(getAcentricFactor(), 2.0);
658668
*/
659669

@@ -760,7 +770,7 @@ public double getdUdVdnS(PhaseInterface phase) {
760770
* getdUdndnSV.
761771
* </p>
762772
*
763-
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
773+
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
764774
* @param compNumb1 a int
765775
* @param compNumb2 a int
766776
* @return a double
@@ -778,7 +788,9 @@ public double getdUdndnSV(PhaseInterface phase, int compNumb1, int compNumb2) {
778788
* Getter for the field <code>attractiveParameter</code>.
779789
* </p>
780790
*
781-
* @return a {@link neqsim.thermo.component.attractiveeosterm.AttractiveTermInterface} object
791+
* @return a
792+
* {@link neqsim.thermo.component.attractiveeosterm.AttractiveTermInterface}
793+
* object
782794
*/
783795
public AttractiveTermInterface getAttractiveParameter() {
784796
return attractiveParameter;
@@ -790,7 +802,8 @@ public AttractiveTermInterface getAttractiveParameter() {
790802
* </p>
791803
*
792804
* @param attractiveParameter a
793-
* {@link neqsim.thermo.component.attractiveeosterm.AttractiveTermInterface} object
805+
* {@link neqsim.thermo.component.attractiveeosterm.AttractiveTermInterface}
806+
* object
794807
*/
795808
public void setAttractiveParameter(AttractiveTermInterface attractiveParameter) {
796809
this.attractiveParameter = attractiveParameter;

src/main/java/neqsim/thermo/component/attractiveeosterm/AttractiveTermPrLeeKesler.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,26 @@
33
import neqsim.thermo.component.ComponentEosInterface;
44

55
/**
6-
* Alternative alpha function for the Peng-Robinson EOS using a Soave-form m-factor.
6+
* Alternative alpha function for the Peng-Robinson EOS using a Soave-form
7+
* m-factor.
78
*
89
* <p>
9-
* Uses the Soave (SRK) m-factor correlation applied within the PR EOS framework:
10+
* Uses the Soave (SRK) m-factor correlation applied within the PR EOS
11+
* framework:
1012
*
1113
* <pre>
1214
* m = 0.480 + 1.574 \omega - 0.176 \omega^2
1315
* </pre>
1416
*
1517
* <p>
16-
* <b>Note:</b> Despite the class name, this implements the Soave m-factor — NOT the standard
18+
* <b>Note:</b> Despite the class name, this implements the Soave m-factor — NOT
19+
* the standard
1720
* PR76 m-factor and NOT the Lee-Kesler BWR enthalpy method.
1821
* {@link neqsim.thermo.system.SystemPrLeeKeslerEos}
19-
* uses {@code attractiveTermNumber=1} (standard PR76 alpha), not this class. This class is
20-
* retained at dispatch index 21 for backward compatibility and research purposes.
22+
* uses {@code attractiveTermNumber=1} (standard PR76 alpha), not this class.
23+
* This class is
24+
* retained at dispatch index 21 for backward compatibility and research
25+
* purposes.
2126
*
2227
* <p>
2328
* The alpha function form is:
@@ -35,7 +40,8 @@ public class AttractiveTermPrLeeKesler extends AttractiveTermPr {
3540
/**
3641
* Constructs a Lee-Kesler alpha term for the given PR component.
3742
*
38-
* @param component the EOS component holding critical properties and acentric factor
43+
* @param component the EOS component holding critical properties and acentric
44+
* factor
3945
*/
4046
public AttractiveTermPrLeeKesler(ComponentEosInterface component) {
4147
super(component);
@@ -71,10 +77,9 @@ public void init() {
7177
@Override
7278
public void setm(double val) {
7379
this.m = val;
74-
neqsim.mathlib.nonlinearsolver.NewtonRhapson solve =
75-
new neqsim.mathlib.nonlinearsolver.NewtonRhapson();
80+
neqsim.mathlib.nonlinearsolver.NewtonRhapson solve = new neqsim.mathlib.nonlinearsolver.NewtonRhapson();
7681
solve.setOrder(2);
77-
double[] acentricConstants = {-0.176, 1.574, (0.480 - this.m)};
82+
double[] acentricConstants = { -0.176, 1.574, (0.480 - this.m) };
7883
solve.setConstants(acentricConstants);
7984
getComponent().setAcentricFactor(solve.solve(0.2));
8085
}

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

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
* Fluent builder for creating pre-configured thermodynamic fluid systems.
1313
*
1414
* <p>
15-
* Provides both a fluent builder API for custom fluids and static factory methods for common
16-
* industry fluid types. All fluids are returned as {@link SystemInterface} with the mixing rule
15+
* Provides both a fluent builder API for custom fluids and static factory
16+
* methods for common
17+
* industry fluid types. All fluids are returned as {@link SystemInterface} with
18+
* the mixing rule
1719
* already set, ready for flash calculations.
1820
* </p>
1921
*
@@ -98,7 +100,9 @@ public enum EOSType {
98100
SRK_PENELOUX,
99101
/** PR 1978 modification. */
100102
PR_1978,
101-
/** Peng-Robinson with PR76 alpha function and Lee-Kesler BWR enthalpy (PR-LK). */
103+
/**
104+
* Peng-Robinson with PR76 alpha function and Lee-Kesler BWR enthalpy (PR-LK).
105+
*/
102106
PR_LK
103107
}
104108

@@ -127,7 +131,7 @@ public static FluidBuilder create(double temperatureK, double pressureBara) {
127131
/**
128132
* Adds a component with a mole fraction.
129133
*
130-
* @param name component name (e.g., "methane", "CO2")
134+
* @param name component name (e.g., "methane", "CO2")
131135
* @param moleFraction mole fraction (0 to 1)
132136
* @return this builder for chaining
133137
*/
@@ -139,10 +143,10 @@ public FluidBuilder addComponent(String name, double moleFraction) {
139143
/**
140144
* Adds a TBP (True Boiling Point) fraction for oil characterization.
141145
*
142-
* @param name fraction name (e.g., "C7", "C8")
143-
* @param moleFraction mole fraction
146+
* @param name fraction name (e.g., "C7", "C8")
147+
* @param moleFraction mole fraction
144148
* @param molarMassKgPerMol molar mass in kg/mol
145-
* @param density density in g/cm3
149+
* @param density density in g/cm3
146150
* @return this builder for chaining
147151
*/
148152
public FluidBuilder addTBPFraction(String name, double moleFraction, double molarMassKgPerMol,
@@ -154,10 +158,10 @@ public FluidBuilder addTBPFraction(String name, double moleFraction, double mola
154158
/**
155159
* Adds a plus fraction (e.g., C20+) for oil characterization.
156160
*
157-
* @param name fraction name (e.g., "C20+")
158-
* @param moleFraction mole fraction
161+
* @param name fraction name (e.g., "C20+")
162+
* @param moleFraction mole fraction
159163
* @param molarMassKgPerMol molar mass in kg/mol
160-
* @param density density in g/cm3
164+
* @param density density in g/cm3
161165
* @return this builder for chaining
162166
*/
163167
public FluidBuilder addPlusFraction(String name, double moleFraction, double molarMassKgPerMol,
@@ -315,7 +319,8 @@ private SystemInterface createSystem() {
315319
* Creates a lean natural gas (dry gas) with typical North Sea composition.
316320
*
317321
* <p>
318-
* Composition: CH4 (85%), C2H6 (8%), C3H8 (3%), iC4 (0.5%), nC4 (1%), N2 (1.5%), CO2 (1%). Uses
322+
* Composition: CH4 (85%), C2H6 (8%), C3H8 (3%), iC4 (0.5%), nC4 (1%), N2
323+
* (1.5%), CO2 (1%). Uses
319324
* SRK EOS with classic mixing rule.
320325
* </p>
321326
*
@@ -334,7 +339,8 @@ public static SystemInterface leanNaturalGas(double temperatureK, double pressur
334339
* Creates a rich natural gas (wet gas) with heavier components.
335340
*
336341
* <p>
337-
* Composition: CH4 (72%), C2H6 (10%), C3H8 (6%), iC4 (2%), nC4 (3%), iC5 (1%), nC5 (1%), N2 (1%),
342+
* Composition: CH4 (72%), C2H6 (10%), C3H8 (6%), iC4 (2%), nC4 (3%), iC5 (1%),
343+
* nC5 (1%), N2 (1%),
338344
* CO2 (2%), nC6 (1%), nC8 (1%). Uses SRK EOS with classic mixing rule.
339345
* </p>
340346
*
@@ -355,7 +361,8 @@ public static SystemInterface richNaturalGas(double temperatureK, double pressur
355361
* Creates a typical black oil with C7+ characterization.
356362
*
357363
* <p>
358-
* Includes light ends plus TBP fractions for C7-C10 and a C20+ plus fraction. Uses PR EOS with
364+
* Includes light ends plus TBP fractions for C7-C10 and a C20+ plus fraction.
365+
* Uses PR EOS with
359366
* classic mixing rule and automatic characterization with 6 lumped components.
360367
* </p>
361368
*
@@ -380,7 +387,8 @@ public static SystemInterface typicalBlackOil(double temperatureK, double pressu
380387
* Creates a CO2-rich stream typical for carbon capture and storage (CCS).
381388
*
382389
* <p>
383-
* Composition: CO2 (95%), N2 (2%), methane (2%), H2S (0.5%), water (0.5%). Uses SRK-CPA EOS
390+
* Composition: CO2 (95%), N2 (2%), methane (2%), H2S (0.5%), water (0.5%). Uses
391+
* SRK-CPA EOS
384392
* (mixing rule 10) with multi-phase check to handle water-CO2 phase behavior.
385393
* </p>
386394
*
@@ -398,7 +406,8 @@ public static SystemInterface co2Rich(double temperatureK, double pressureBara)
398406
* Creates an acid gas stream with significant H2S and CO2 content.
399407
*
400408
* <p>
401-
* Composition: methane (70%), CO2 (10%), H2S (5%), ethane (5%), propane (3%), n-butane (2%),
409+
* Composition: methane (70%), CO2 (10%), H2S (5%), ethane (5%), propane (3%),
410+
* n-butane (2%),
402411
* water (2%), nitrogen (3%). Uses SRK-CPA EOS with multi-phase check.
403412
* </p>
404413
*
@@ -417,7 +426,8 @@ public static SystemInterface acidGas(double temperatureK, double pressureBara)
417426
* Creates a gas condensate fluid.
418427
*
419428
* <p>
420-
* Composition: CH4 (75%), C2H6 (7%), C3H8 (4%), iC4 (1.5%), nC4 (2%), iC5 (1%), nC5 (1%), nC6
429+
* Composition: CH4 (75%), C2H6 (7%), C3H8 (4%), iC4 (1.5%), nC4 (2%), iC5 (1%),
430+
* nC5 (1%), nC6
421431
* (1.5%), plus C7-C10 TBP fractions and C15+ plus fraction. Uses SRK EOS.
422432
* </p>
423433
*
@@ -441,7 +451,8 @@ public static SystemInterface gasCondensate(double temperatureK, double pressure
441451
* Creates a dry export gas with simple composition.
442452
*
443453
* <p>
444-
* Composition: CH4 (92%), C2H6 (4%), C3H8 (1.5%), N2 (1.5%), CO2 (1%). Uses SRK EOS. Suitable for
454+
* Composition: CH4 (92%), C2H6 (4%), C3H8 (1.5%), N2 (1.5%), CO2 (1%). Uses SRK
455+
* EOS. Suitable for
445456
* pipeline transport calculations.
446457
* </p>
447458
*
@@ -470,7 +481,7 @@ private static class ComponentEntry implements Serializable {
470481
/**
471482
* Creates a component entry.
472483
*
473-
* @param name component name
484+
* @param name component name
474485
* @param moleFraction mole fraction
475486
*/
476487
ComponentEntry(String name, double moleFraction) {
@@ -492,10 +503,10 @@ private static class TBPEntry implements Serializable {
492503
/**
493504
* Creates a TBP entry.
494505
*
495-
* @param name fraction name
506+
* @param name fraction name
496507
* @param moleFraction mole fraction
497-
* @param molarMass molar mass in kg/mol
498-
* @param density density in g/cm3
508+
* @param molarMass molar mass in kg/mol
509+
* @param density density in g/cm3
499510
*/
500511
TBPEntry(String name, double moleFraction, double molarMass, double density) {
501512
this.name = name;

0 commit comments

Comments
 (0)