|
[Sponsors] |
[swak4Foam] VariableHeightFlowRateInletFlowVelocity altered using GroovyBC |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 18, 2016, 09:31 |
VariableHeightFlowRateInletFlowVelocity altered using GroovyBC
|
#1 |
New Member
Kate Bradbrook
Join Date: Nov 2015
Posts: 12
Rep Power: 10 |
The code for VariableHeightFlowRateInletFlowVelocity is:
scalar avgU = -flowRate_/gSum(patch().magSf()*alphap); vectorField n(patch().nf()); operator==(n*avgU*alphap); I cannot understand why avgU is multiplied by alphap..... I have a function object to track the inflow (and also one for outflow to see when they have equalised): volFlowIn { type swakExpression; valueType patch; patchName inlet; verbose true; aliases { alphaWater alpha.water; } expression "alphaWater*U&normal()"; accumulations (integrate); outputControl timeStep; outputInterval 20; } And, predictably, this is always slighlty less than the flow rate I specify in boundary as the mass flow I calculate in any cell is effectively avgU*alphaWater^2 which is wrong in any cells where alphaWater<1. I therefore made a GroovyBC to implement it as: inlet { type groovyBC; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform 1; value uniform (0 0 0); valueExpression "-vel1*normal()"; gradientExpression "vector(0,0,0)"; fractionExpression "1"; evaluateDuringConstruction 0; variables 3 ( "area1=sum(alphaWater*mag(Sf()));" "flowRate1=650;" "vel1= (alphaWater>1e-3) ? (flowRate1/area1) : 0;" //the threshold is arbitrary - need to check implications ); timelines ( ); lookuptables ( ); aliases { alphaWater alpha.water; } } I would be very grateful for confirmation of my interpretation from experienced users to reassure me in what I have done, or an explanation as to why the code in VariableHeightFlowRateInletFlowVelocity is correct and my function object flow calc wrong! Last edited by KateBradbrook; April 18, 2016 at 13:07. |
|
April 26, 2016, 17:31 |
|
#2 |
New Member
Kate Bradbrook
Join Date: Nov 2015
Posts: 12
Rep Power: 10 |
OK. So I wrote: "I cannot understand why avgU is multiplied by alphap..... " I think it is for stability - my GroovyBC above introduces instabilities. So instead, I just adjust the velocities to account for the alphap^2 effect, so my variables become:
"area1=sum(alphaWater*alphaWater*mag(Sf()));" "flowRate1=$inletFlowRate;" "vel1= (flowRate1/area1)*alphaWater;" So far, so good, but I'll post again if I need to revise further! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] groovyBC for oscillatory flow | liybzd | OpenFOAM Community Contributions | 5 | November 12, 2018 08:53 |
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC | zanilu70 | OpenFOAM Community Contributions | 4 | December 13, 2016 07:46 |
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam | dani2702 | OpenFOAM Community Contributions | 0 | November 17, 2016 04:30 |
[swak4Foam] groovyBC issue - k and epsilon | sagnikmazumdar | OpenFOAM Community Contributions | 24 | March 1, 2015 08:16 |
[swak4Foam] groovyBC and Eqn.setReference() | benk | OpenFOAM Community Contributions | 3 | June 2, 2011 09:49 |