|
[Sponsors] |
[swak4Foam] and accessing flux on remote patches for setting B.C's |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 10, 2013, 11:44 |
and accessing flux on remote patches for setting B.C's
|
#1 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Hi Foamers,
I am trying to access flux at 'INLET' patch and set the B.C at 'OUTLET1' patch equal to 0.52 times the flux at inlet patch and B.C at 'OUTLET2' patch equal to 0.48 times the flux at inlet patch. Since I have specified parabolic velocity profile at inlet I don't know the exact value of flux at inlet so I need to access the flux at inlet somehow from within simulation. I am working to fix this bug for over a month but with no success. I used below B.C's for setting flow rate B.C's at inlet and outlet: INLET { type groovyBC; variables "r2=(pow(pos().x,2)+pow(pos().z,2));R2=sum(are a())/pi;para=-((R2-r2)/R2)*normal();"; valueExpression "2*0.351*para"; //where 0.351 is the average velocity value uniform (0 0 0); } WALL { type fixedValue; value uniform (0 0 0); } OUTLET1 { type flowRateInletVelocity; flowRateExpression "0"; flowRate swak { variables "phi1{INLET}=-0.52*sum(phi);"; expression "phi1"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet valueType patch; patchName OUTLET1; }; value uniform ( 0 0 0 ); } OUTLET2 { type flowRateInletVelocity; flowRateExpression "0"; flowRate swak { variables "phi2{INLET}=-0.48*sum(phi);"; expression "phi2"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet valueType patch; patchName OUTLET2; }; value uniform ( 0 0 0 ); } Error message: --> FOAM FATAL ERROR: Continuity error cannot be removed by adjusting the outflow. Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow. Total flux : 0.000360325 Specified mass inflow : 0.000400984 Specified mass outflow : 0 Adjustable mass outflow : 0 From function adjustPhi(surfaceScalarField& phi, const volVectorField& U,const volScalarField& p in file cfdTools/general/adjustPhi/adjustPhi.C at line 118. FOAM exiting The problem lies in using the expression "phi1{INLET}= -0.52*sum(phi)" here the value of "sum(phi)" is returned zero everytime and I am unable to understand why? |
|
August 10, 2013, 14:26 |
|
#2 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
Hi
I'm curious about the cause . are you sure you can use groovyBC dictionary mixed with ordinary BC types like flowRateInletVelocity? it seems it always read flowRateExpression "0"; not the Swak dictionary if not mistake. isn't there a BC like flowRateOutletVelocity for outlet? it will be nice if you find an example related to this subject.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
August 10, 2013, 23:00 |
|
#3 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Hi Ehsan,
Thanks for your response. No, even if I change the value of 'flowRateExpression' to '1' it doesn't make any difference for 'flowRateInletVelocity' with sawk4Foam data entry. I haven't found any examples of this sort in which an expression for setting volume flow rate is used . Infact, it doesn't make any difference if I remove 'flowRateExpression' field itself. There is definitely some problem with expression " phi1{INLET}=-0.52*sum(phi)" or " phi1{INLET}=-0.48*sum(phi)" as value of "sum(phi)" returned is 'zero' everytime. Also, when I give some constant value in place of expression it is reflected in mass outflow as a non zero value in the output that means giving volume flow rate expression is a problem. May be there is a scope of bug fix with swak4Foam in this case as everytime the value of "sum(phi)" at inlet is taken as zero....while it is not......it is around 0.0004 m3/s which is reflected in mass inflow in the output as below: Continuity error cannot be removed by adjusting the outflow. Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow. Total flux : 0.000360325 Specified mass inflow : 0.000400984 Specified mass outflow : 0 Adjustable mass outflow : 0 FYI: I have also tried running 'potentialFoam' to initialize the flow and then run simpleFoam but it didn't help either. Somebody can help, I am stuck for long time or tell an alternative? |
|
August 11, 2013, 04:04 |
|
#4 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
then where you have find flowRate swak{} dictionary?
I hope Bernhard see it and help.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
August 11, 2013, 04:23 |
|
#5 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Hi Ehsan,
If you have installed Swak4Foam then u will find the use of flowRateInletVelocity with swak4Foam data entry in the following example case included with swak4Foam: /run/Swak4Foam_2.x_release_0.2.3/Examples/tests/swakDataEntry/flowRateAngledDuct Is there a way I can tag people in my posts to attract their attention for some specific problems? for example in this case Bernhard Regards, Mayank |
|
August 11, 2013, 04:36 |
|
#6 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
inlet
{ type flowRateInletVelocity; // type groovyFlowRateInletVelocity; flowRateExpression "0.1"; flowRate swak { expression "0.1"; valueType patch; patchName inlet; }; // flowRate constant 0.1; value uniform (0 0 0); } here it is written for inlet I'm not sure if it be applicable for outlet in this form and expression is a constant maybe it has some issue with expressions. Bernhard Gschaider reads threads carefully,don't worry.its in tests folder,its fine if you could find another example anywhere else I think.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
August 11, 2013, 08:43 |
|
#7 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Its applicable for the outlet too the only thing is that you have to put a negative sign for example "-0.1" and it is taken as outflow. I can't find any other example for the usage of "flowRateInletVelocity" with swak4Foam data entry in expression form.
May be it is a bug as this kind of stuff works fine on ANSYS i.e setting of mass flow/volume flow B.C's........ |
|
August 11, 2013, 20:38 |
|
#8 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
I'm not totally sure, but I guess the problem here is that when U gets loaded there is no phi. Thus the value becomes 0. When phi gets calculated the first time it sees a U of 0 .... thus becomes 0 itself ... and the result you see in the error message. Anyway: what I would recommend: avoid setting the velocity on all boundaries. Just set it on ONE of the outlets and leave the other one "free" (zeroGradient/inlet). The flow on the "free" outlet has to adjust to the "other" 48% anyway. You can even use that as a measure for the convergence/accuracy of your calculation. PS: it also occured to me that you sum up phi in the expression (==total massflow) but don't divide it (which should give you too high an outflow anyway)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
August 12, 2013, 03:09 |
|
#9 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Thanks Bernhard for your reply.
As I wrote I was researching on this problem for a long time. I got across this thread: http://www.cfd-online.com/Forums/ope...-split-bc.html where you gave same advice. Accordingly, I set the boundary condition as follows: 1.) Steady state simulation with simpleFoam Inlet: U parabolic profile with groovyBC, p- zerogradient outlet1: U volume flow rate set to x% of inlet flux, p=zerogradient outlet2: U zero gradient, p=0 (fixed value) The simulation ran for long time but can't achieve converged solution? Any thoughts how can I improve convergence performance. 2.) Transient simulation with pimpleFoam: Inlet: U parabolic profile with groovyBC varying with space and time , p- zerogradient outlet1: U volume flow rate set to x% of inlet flux, p=zerogradient outlet2: U pressureInletOutletVelocity, p=0 (fixed value) Do these B.C's look ok as there is a chance of backflow from both the outlets? Also, above transient simulation crashes with icoFoam at around t=0.05 and takes unusually long with pimpleFoam Regards, Mayank |
|
August 12, 2013, 13:31 |
|
#10 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
One possibility to reduce backflow is making the outlet channel longer (if possible). Apart from that it is hard to give you any hints without looking at your actual case (which I'm not prepared to do)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
August 13, 2013, 15:31 |
|
#11 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Hi Bernhard,
It looks like, I am making some progress. I got the steady state simulation running with discussed boundary conditions for simpleFoam in my previous post. I had to play around a little with divergence schemes and relaxation factors to get convergence. I applied similar B.C's for transient simulation(except time varying parabolic velocity profile at inlet) and ran it with both icoFoam as well as pimpleFoam but they both blew up. My case(consisting of a tube with one inlet and two outlets) has a backflow from both outlets at some point of time as the same case was simulated on ANSYS-CFX. I have attached two images of ANSYS-CFX results to give you a better idea. Can you advice me how to get similar results with backflow using icoFoam or pimpleFoam? |
|
August 13, 2013, 20:00 |
|
#12 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
August 19, 2013, 12:32 |
|
#13 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Thanks Bernhard, all the issues related to steady and transient simulations are now resolved.
Mayank. |
|
August 19, 2013, 14:58 |
|
#14 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
You might want to add a short description what you did (or a link if it was solved in another thread) so that people who have a similar problem and search for a solution on the board might be helped. Thanks
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
August 19, 2013, 16:49 |
|
#15 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
Hi Mayank
how did you solve the problem? how it was related to steady and transient?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
August 21, 2013, 11:54 |
|
#16 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Refer:
http://www.cfd-online.com/Forums/ope...tml#post446682 AND For steady state I was facing trouble with achieving convergence. So I changed the divergence scheme for U from linear to upwind. There was no such trouble with transient but there was a backflow, which was desired, and as Bernhard said I imposed a zeroGradient B.C on outlets and obtained a stable solution with backflow. Regards, Mayank |
|
August 21, 2013, 17:59 |
|
#17 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
I didn't understand exactly,you mean you expect that flow be reversed completely,means outlets become inlet and inlet become outlet during transient study and it should be so?it has been in plan?
then you should change BC's when this essential change in flow occurs,how did you do it? and in steady state doesn't occur this situation?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
August 21, 2013, 19:25 |
|
#18 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
Hi Ehsan,
Yaa, flow reversal was in plan. Velocity at inlet was function of time and space and sure it becomes negative at some point of time. It was not required to reverse B.C's at the time of flow reversal. I have attached snapshots from simulation at t=1, t=5, t=10, t=15, t=20 to give you an idea of simulation results and what I wanted. Regards, Mayank. |
|
August 21, 2013, 19:28 |
|
#19 |
Member
India
Join Date: Oct 2012
Posts: 84
Rep Power: 14 |
I had one more question. I am also doing a particle simulation on the same bifurcating tube geometry using icoUcoupledKinematicParcelFoam and I want to count the number of particles coming out of each outlet separately. Can this be done using swak4Foam or any other method?
Mayank |
|
August 21, 2013, 20:01 |
|
#20 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing multiple boundary patches from a custom boundary condition file | ripudaman | OpenFOAM Programming & Development | 0 | October 22, 2014 19:34 |