@@ -10,8 +10,7 @@ public abstract class MultiPhaseFlowNode extends FlowNode {
1010
1111 private static final long serialVersionUID = 1000 ;
1212
13- public MultiPhaseFlowNode () {
14- }
13+ public MultiPhaseFlowNode () {}
1514
1615 public MultiPhaseFlowNode (SystemInterface system , GeometryDefinitionInterface pipe ) {
1716 super (system , pipe );
@@ -39,51 +38,58 @@ public double initVelocity() {
3938 molarFlowRate [0 ] = getBulkSystem ().getPhases ()[0 ].getNumberOfMolesInPhase ();
4039 massFlowRate [1 ] = molarFlowRate [1 ] * getBulkSystem ().getPhases ()[1 ].getMolarMass ();
4140 massFlowRate [0 ] = molarFlowRate [0 ] * getBulkSystem ().getPhases ()[0 ].getMolarMass ();
42- volumetricFlowRate [0 ] = massFlowRate [0 ] / getBulkSystem ().getPhases ()[0 ].getPhysicalProperties ().getDensity ();
43- volumetricFlowRate [1 ] = massFlowRate [1 ] / getBulkSystem ().getPhases ()[1 ].getPhysicalProperties ().getDensity ();
41+ volumetricFlowRate [0 ] = massFlowRate [0 ]
42+ / getBulkSystem ().getPhases ()[0 ].getPhysicalProperties ().getDensity ();
43+ volumetricFlowRate [1 ] = massFlowRate [1 ]
44+ / getBulkSystem ().getPhases ()[1 ].getPhysicalProperties ().getDensity ();
4445 velocity [0 ] = volumetricFlowRate [0 ] / (phaseFraction [0 ] * pipe .getArea ());
4546 velocity [1 ] = volumetricFlowRate [1 ] / (phaseFraction [1 ] * pipe .getArea ());
4647 return velocity [1 ];
4748 }
4849
4950 @ Override
50- public void initFlowCalc () {
51+ public void initFlowCalc () {
5152 this .init ();
5253 initVelocity ();
5354
5455 phaseFraction [0 ] = 1.0 - 1.0e-10 ;
5556 phaseFraction [1 ] = 1.0 - phaseFraction [0 ];
56- double f = 0 , df = 0 , fOld = 0 , betaOld = 0 ;
57+ double f = 0 , fOld = 0 , betaOld = 0 ;
5758 int iterations = 0 ;
5859 double step = 100.0 ;
5960
61+ // double df
62+
6063 do {
6164 iterations ++;
6265 fOld = f ;
6366
6467 initVelocity ();
6568 init ();
6669
67- double Fg = 0.5 * bulkSystem .getPhases ()[0 ].getPhysicalProperties ().getDensity () * wallFrictionFactor [0 ]
68- * Math .pow (velocity [0 ], 2.0 ) * wallContactLength [0 ] / (pipe .getArea () * 4.0 );
69- double Fl = 0.5 * bulkSystem .getPhases ()[1 ].getPhysicalProperties ().getDensity () * wallFrictionFactor [1 ]
70- * Math .pow (velocity [1 ], 2.0 ) * wallContactLength [1 ] / (pipe .getArea () * 4.0 );
70+ double Fg = 0.5 * bulkSystem .getPhases ()[0 ].getPhysicalProperties ().getDensity ()
71+ * wallFrictionFactor [0 ] * Math .pow (velocity [0 ], 2.0 ) * wallContactLength [0 ]
72+ / (pipe .getArea () * 4.0 );
73+ double Fl = 0.5 * bulkSystem .getPhases ()[1 ].getPhysicalProperties ().getDensity ()
74+ * wallFrictionFactor [1 ] * Math .pow (velocity [1 ], 2.0 ) * wallContactLength [1 ]
75+ / (pipe .getArea () * 4.0 );
7176 double Fi = 0.5 * bulkSystem .getPhases ()[0 ].getPhysicalProperties ().getDensity ()
7277 * interphaseFrictionFactor [0 ] * Math .pow (velocity [0 ] - velocity [1 ], 2.0 )
7378 * interphaseContactLength [0 ] / (pipe .getArea () * 4.0 );
7479
75- f = -phaseFraction [0 ] * Fl + (1 - phaseFraction [0 ]) * Fg + Fi
76- + (1.0 - phaseFraction [0 ]) * phaseFraction [0 ]
77- * (bulkSystem .getPhases ()[1 ].getPhysicalProperties ().getDensity ()
78- - bulkSystem .getPhases ()[0 ].getPhysicalProperties ().getDensity ())
79- * gravity * inclination ;
80- df = -Fl - Fg
81- + (bulkSystem .getPhases ()[1 ].getPhysicalProperties ().getDensity ()
82- - bulkSystem .getPhases ()[0 ].getPhysicalProperties ().getDensity ()) * gravity * inclination
83- - Math .pow (phaseFraction [0 ], 2.0 )
84- * (bulkSystem .getPhases ()[1 ].getPhysicalProperties ().getDensity ()
85- - bulkSystem .getPhases ()[0 ].getPhysicalProperties ().getDensity ())
86- * gravity * inclination ;
80+ f = -phaseFraction [0 ] * Fl + (1 - phaseFraction [0 ]) * Fg + Fi + (1.0 - phaseFraction [0 ])
81+ * phaseFraction [0 ]
82+ * (bulkSystem .getPhases ()[1 ].getPhysicalProperties ().getDensity ()
83+ - bulkSystem .getPhases ()[0 ].getPhysicalProperties ().getDensity ())
84+ * gravity * inclination ;
85+ /*
86+ * df = -Fl - Fg + (bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() -
87+ * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) gravity * inclination
88+ * - Math.pow(phaseFraction[0], 2.0) * (bulkSystem.getPhases()[1]
89+ * .getPhysicalProperties().getDensity() -
90+ * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) gravity *
91+ * inclination;
92+ */
8793
8894 if (f > 0 ) {
8995 phaseFraction [0 ] += (betaOld - phaseFraction [0 ]);
@@ -123,14 +129,16 @@ public double calcReynoldNumber() {
123129
124130 public double calcWallFrictionFactor () {
125131 for (int i = 0 ; i < 2 ; i ++) {
126- wallFrictionFactor [i ] = Math .pow ((1.0 / (-1.8 * GeneralMath .log10 (6.9 / getReynoldsNumber (i )
127- * Math .pow (pipe .getRelativeRoughnes (this .getHydraulicDiameter (i )) / 3.7 , 1.11 )))), 2.0 );
132+ wallFrictionFactor [i ] = Math .pow (
133+ (1.0 / (-1.8 * GeneralMath .log10 (6.9 / getReynoldsNumber (i ) * Math .pow (
134+ pipe .getRelativeRoughnes (this .getHydraulicDiameter (i )) / 3.7 , 1.11 )))),
135+ 2.0 );
128136 }
129137 return wallFrictionFactor [0 ];
130138 }
131139
132140 @ Override
133- public void setFluxes (double dn []) {
141+ public void setFluxes (double dn []) {
134142 for (int i = 0 ; i < getBulkSystem ().getPhases ()[0 ].getNumberOfComponents (); i ++) {
135143 getBulkSystem ().getPhases ()[0 ].addMoles (i , -dn [i ]);
136144 getBulkSystem ().getPhases ()[1 ].addMoles (i , +dn [i ]);
@@ -141,12 +149,13 @@ public void setFluxes(double dn[]) {
141149 }
142150
143151 @ Override
144- public void updateMolarFlow () {
152+ public void updateMolarFlow () {
145153 for (int phase = 0 ; phase < 2 ; phase ++) {
146154 for (int i = 0 ; i < getBulkSystem ().getPhases ()[0 ].getNumberOfComponents (); i ++) {
147- getBulkSystem ().getPhases ()[phase ].addMoles (i , (getBulkSystem ().getPhases ()[phase ].getComponents ()[i ]
148- .getx ()
149- * (molarFlowRate [phase ] - getBulkSystem ().getPhases ()[phase ].getNumberOfMolesInPhase ())));
155+ getBulkSystem ().getPhases ()[phase ].addMoles (i ,
156+ (getBulkSystem ().getPhases ()[phase ].getComponents ()[i ].getx ()
157+ * (molarFlowRate [phase ] - getBulkSystem ().getPhases ()[phase ]
158+ .getNumberOfMolesInPhase ())));
150159 }
151160 }
152161 getBulkSystem ().init (1 );
@@ -157,12 +166,14 @@ public double calcContactLength() {
157166 }
158167
159168 @ Override
160- public void init () {
169+ public void init () {
161170 super .init ();
162- massFlowRate [0 ] = velocity [0 ] * getBulkSystem ().getPhases ()[0 ].getPhysicalProperties ().getDensity ()
163- * pipe .getArea () * phaseFraction [0 ];
164- massFlowRate [1 ] = velocity [1 ] * getBulkSystem ().getPhases ()[1 ].getPhysicalProperties ().getDensity ()
165- * pipe .getArea () * phaseFraction [1 ];
171+ massFlowRate [0 ] =
172+ velocity [0 ] * getBulkSystem ().getPhases ()[0 ].getPhysicalProperties ().getDensity ()
173+ * pipe .getArea () * phaseFraction [0 ];
174+ massFlowRate [1 ] =
175+ velocity [1 ] * getBulkSystem ().getPhases ()[1 ].getPhysicalProperties ().getDensity ()
176+ * pipe .getArea () * phaseFraction [1 ];
166177 molarFlowRate [0 ] = massFlowRate [0 ] / getBulkSystem ().getPhases ()[0 ].getMolarMass ();
167178 molarFlowRate [1 ] = massFlowRate [1 ] / getBulkSystem ().getPhases ()[1 ].getMolarMass ();
168179 superficialVelocity [0 ] = velocity [0 ] * phaseFraction [0 ];
@@ -178,8 +189,10 @@ public void init() {
178189 wallFrictionFactor [0 ] = interphaseTransportCoefficient .calcWallFrictionFactor (0 , this );
179190 wallFrictionFactor [1 ] = interphaseTransportCoefficient .calcWallFrictionFactor (1 , this );
180191
181- interphaseFrictionFactor [0 ] = interphaseTransportCoefficient .calcInterPhaseFrictionFactor (0 , this );
182- interphaseFrictionFactor [1 ] = interphaseTransportCoefficient .calcInterPhaseFrictionFactor (0 , this );
192+ interphaseFrictionFactor [0 ] =
193+ interphaseTransportCoefficient .calcInterPhaseFrictionFactor (0 , this );
194+ interphaseFrictionFactor [1 ] =
195+ interphaseTransportCoefficient .calcInterPhaseFrictionFactor (0 , this );
183196 }
184197
185198 public double calcGasLiquidContactArea () {
@@ -188,7 +201,7 @@ public double calcGasLiquidContactArea() {
188201 }
189202
190203 @ Override
191- public void calcFluxes () {
204+ public void calcFluxes () {
192205 if (bulkSystem .isChemicalSystem ()) {
193206 // getBulkSystem().getChemicalReactionOperations().setSystem(getBulkSystem());
194207 // getOperations().chemicalEquilibrium();
@@ -198,47 +211,58 @@ public void calcFluxes() {
198211 }
199212
200213 @ Override
201- public void update () {
214+ public void update () {
202215
203216 double heatFluxGas = getFluidBoundary ().getInterphaseHeatFlux (0 );// getInterphaseTransportCoefficient().calcInterphaseHeatTransferCoefficient(0,
204- // getPrandtlNumber(0), this) *
217+ // getPrandtlNumber(0),
218+ // this) *
205219 // (getInterphaseSystem().getPhase(0).getTemperature()
206220 // -
207221 // getBulkSystem().getPhase(0).getTemperature())
208- // * getInterphaseContactArea();
222+ // *
223+ // getInterphaseContactArea();
209224
210225 double heatFluxLiquid = getFluidBoundary ().getInterphaseHeatFlux (1 );// getInterphaseTransportCoefficient().calcInterphaseHeatTransferCoefficient(1,
211- // getPrandtlNumber(1), this) *
226+ // getPrandtlNumber(1),
227+ // this) *
212228 // (getInterphaseSystem().getPhase(1).getTemperature()
213229 // -
214230 // getBulkSystem().getPhase(1).getTemperature())
215- // * getInterphaseContactArea();
231+ // *
232+ // getInterphaseContactArea();
216233
217- double liquid_dT = this .flowDirection [1 ] * heatFluxLiquid * getGeometry ().getNodeLength () / getVelocity ( 1 )
218- / getBulkSystem ().getPhase (1 ).getCp ();
219- double gas_dT = this .flowDirection [0 ] * heatFluxGas * getGeometry ().getNodeLength () / getVelocity ( 0 )
220- / getBulkSystem ().getPhase (0 ).getCp ();
234+ double liquid_dT = this .flowDirection [1 ] * heatFluxLiquid * getGeometry ().getNodeLength ()
235+ / getVelocity ( 1 ) / getBulkSystem ().getPhase (1 ).getCp ();
236+ double gas_dT = this .flowDirection [0 ] * heatFluxGas * getGeometry ().getNodeLength ()
237+ / getVelocity ( 0 ) / getBulkSystem ().getPhase (0 ).getCp ();
221238 liquid_dT -= getInterphaseTransportCoefficient ().calcWallHeatTransferCoefficient (1 , this )
222239 * (getBulkSystem ().getPhase (1 ).getTemperature () - pipe .getInnerWallTemperature ())
223- * getWallContactLength (1 ) * getGeometry ().getNodeLength () / getBulkSystem ().getPhase (1 ).getCp ();
240+ * getWallContactLength (1 ) * getGeometry ().getNodeLength ()
241+ / getBulkSystem ().getPhase (1 ).getCp ();
224242 gas_dT -= getInterphaseTransportCoefficient ().calcWallHeatTransferCoefficient (0 , this )
225243 * (getBulkSystem ().getPhase (0 ).getTemperature () - pipe .getInnerWallTemperature ())
226- * getWallContactLength (0 ) * getGeometry ().getNodeLength () / getBulkSystem ().getPhase (0 ).getCp ();
227- double fluxwallinternal = getInterphaseTransportCoefficient ().calcWallHeatTransferCoefficient (1 , this )
244+ * getWallContactLength (0 ) * getGeometry ().getNodeLength ()
245+ / getBulkSystem ().getPhase (0 ).getCp ();
246+ double fluxwallinternal = getInterphaseTransportCoefficient ()
247+ .calcWallHeatTransferCoefficient (1 , this )
228248 * (getBulkSystem ().getPhase (1 ).getTemperature () - pipe .getInnerWallTemperature ())
229249 * getWallContactLength (1 ) * getGeometry ().getNodeLength ()
230250 + getInterphaseTransportCoefficient ().calcWallHeatTransferCoefficient (0 , this )
231- * (getBulkSystem ().getPhase (0 ).getTemperature () - pipe .getInnerWallTemperature ())
251+ * (getBulkSystem ().getPhase (0 ).getTemperature ()
252+ - pipe .getInnerWallTemperature ())
232253 * getWallContactLength (0 ) * getGeometry ().getNodeLength ();
233254
234255 double JolprK = 3.14 * 0.2032 * 0.0094 * getGeometry ().getNodeLength () * 7500 * 500 ;
235256 double fluxOut = -50.0 * 3.14 * (0.2032 + 0.01 ) * getGeometry ().getNodeLength ()
236- * (pipe .getInnerWallTemperature () - pipe .getSurroundingEnvironment ().getTemperature ());
257+ * (pipe .getInnerWallTemperature ()
258+ - pipe .getSurroundingEnvironment ().getTemperature ());
237259 double dTwall = (fluxOut + fluxwallinternal ) / JolprK ;
238260 pipe .setInnerWallTemperature (pipe .getInnerWallTemperature () + dTwall );
239261
240- getBulkSystem ().getPhase (1 ).setTemperature (getBulkSystem ().getPhase (1 ).getTemperature () + liquid_dT );
241- getBulkSystem ().getPhase (0 ).setTemperature (getBulkSystem ().getPhase (0 ).getTemperature () + gas_dT );
262+ getBulkSystem ().getPhase (1 )
263+ .setTemperature (getBulkSystem ().getPhase (1 ).getTemperature () + liquid_dT );
264+ getBulkSystem ().getPhase (0 )
265+ .setTemperature (getBulkSystem ().getPhase (0 ).getTemperature () + gas_dT );
242266
243267 for (int componentNumber = 0 ; componentNumber < getBulkSystem ().getPhases ()[0 ]
244268 .getNumberOfComponents (); componentNumber ++) {
@@ -248,8 +272,10 @@ public void update() {
248272 double gasMolarRate = -getFluidBoundary ().getInterphaseMolarFlux (componentNumber )
249273 * getInterphaseContactArea ();// getInterphaseContactLength(0)*getGeometry().getNodeLength();
250274
251- getBulkSystem ().getPhase (0 ).addMoles (componentNumber , this .flowDirection [0 ] * gasMolarRate );
252- getBulkSystem ().getPhase (1 ).addMoles (componentNumber , this .flowDirection [1 ] * liquidMolarRate );
275+ getBulkSystem ().getPhase (0 ).addMoles (componentNumber ,
276+ this .flowDirection [0 ] * gasMolarRate );
277+ getBulkSystem ().getPhase (1 ).addMoles (componentNumber ,
278+ this .flowDirection [1 ] * liquidMolarRate );
253279 }
254280
255281 getBulkSystem ().initBeta ();
@@ -261,4 +287,4 @@ public void update() {
261287 getOperations ().chemicalEquilibrium ();
262288 }
263289 }
264- }
290+ }
0 commit comments