|
[Sponsors] |
August 22, 2013, 19:01 |
InterFoam cyclic BC
|
#1 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
Hi everybody,
I have recently started to use OF, for VOF using interFoam. the case is that I have a cube and I want to inject droplets into it. the pair- sides of this cube are cyclic, and there is a shear flow inside the cube. My Mesh is like: boundary ( leftWall { type cyclic; neighbourPatch rightWall; faces ( (0 4 7 3) ); } rightWall { type cyclic; neighbourPatch leftWall; faces ( (1 2 6 5) ); } lowerWall { type wall; faces ( (0 1 5 4) ); } atmosphere { type patch; faces ( (3 7 6 2) ); } ); and the BC's are: U BC: dimensions [0 1 -1 0 0 0 0]; internalField uniform (20 0 0); boundaryField { leftWall { type cyclic; value uniform (20 0 0); } rightWall { type cyclic; value uniform (20 0 0); } lowerWall { type fixedValue; value uniform (0 0 0); } atmosphere { type pressureInletOutletVelocity; value uniform (20 0 0); } defaultFaces { type empty; } } p-rgh BC: dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { leftWall { type cyclic; } rightWall { type cyclic; } lowerWall { type fixedFluxPressure; adjoint no; } atmosphere { type totalPressure; p0 uniform 0; U U; phi phi; rho rho; psi none; gamma 1; value uniform 0; } defaultFaces { type empty; } } and for alpha1: internalField uniform 0; boundaryField { leftWall { type cyclic; } rightWall { type cyclic; } lowerWall { type constantAlphaContactAngle; theta0 110; limit gradient; value uniform 0; } atmosphere { type inletOutlet; inletValue uniform 0; value uniform 0; } defaultFaces { type empty; } } As you could see, I want the 20m/s shear flow to be inside the cube. But as I run the case, the flow inside the cube goes to rest after almost very short time. I noticed that I need to add source term (fvOptions), but I do not know how to do it. I checked the pimpleFoam, there is a source term defined for channel-flow, but I do not know to to set such a source term for interFoam. Any help and suggestions would be appreciated. Thanks, Shawn. |
|
August 22, 2013, 19:44 |
|
#2 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Greetings Shawn,
I remember running into some issues with cyclics and interFoam that required some additional terms. Have a look at the following posts for some inspiration
I'ts been a while but that may help you. Good luck |
|
August 22, 2013, 20:24 |
|
#3 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
Thanks for the links.
However, I still see the issue to be there. These post were really useful to fix the droplet motion. But I also have other problem, which causes the flow to stop inside the cube when I am using cyclic BC. I tried to add fvOptions, but it gives me FATAL ERROR when I run interFoam. I appreciate if you could help me with that. Thanks, |
|
August 22, 2013, 20:35 |
|
#4 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
So the discussion in those posts about adding a pressure source term to induce channel flow was not sufficient? There was some code in the channel flow post related to
Code:
+ flowDirection*gradP //added for channel flow |
|
August 22, 2013, 20:41 |
|
#5 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
The solver pimpleFoam is actually the same as channelFoam in the latest version. I compared pimpleFoam, and interFoam together. In order to maintain the mass flow rate through the channel, they defined a source term using fvOptions. The file can be found in the system directory for channel395 example in tutorial. This allows to maintain the flow rate (speed) inside the channel with cyclic BC. I have no idea how to apply this in interFoam!
Any idea? |
|
August 22, 2013, 20:44 |
|
#6 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
I was aware that channelFoam has been replaced by pimpleFoam + fvOptions, I was going for the simple solution that has been proven to work and was in a previous post by mimicking channelFoam
This will make it much easier to help and be less work. |
|
August 22, 2013, 20:58 |
|
#7 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
Attached please file the test case.
if you just run it, you will see how velocity fades inside the domain. then to see the error, just remove the comment marks for the fvOptions in the system directory. |
|
August 23, 2013, 00:24 |
|
#8 | |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Quote:
So you can add fvOption just like pimpleFoam and then do a custom pressureGradientExplicitSource and reformulate it correctly for units...or you can do what I suggested in the earlier posts in this thread and go back to how channelFoam did this in 2.1. The two will give you the same result. Edit: Another option may be to use a mapped BC where the outlet values are mapped to the inlet. You can then prescribe a flow rate which scales the velocity to maintain a certain flow rate. this involves no programming at all. Good luck. Last edited by chegdan; August 23, 2013 at 09:53. Reason: added another option to solve this problem |
||
August 23, 2013, 13:56 |
|
#9 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
Thanks for the suggestions.
I just changed UEqn file, so it includes fvOpetions: fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) - fvm::laplacian(muf, U) - (fvc::grad(U) & fvc::grad(muf)) + turbulence->divDevRhoReff(rho, U) - rho*g + flowDirection*gradP == fvOptions(rho,U) ); UEqn.relax(); fvOptions.constrain(UEqn()); if (pimple.momentumPredictor()) { solve ( UEqn == fvc::reconstruct ( ( fvc::interpolate(interface.sigmaK())*fvc::snGrad(a lpha1) - ghf*fvc::snGrad(rho) - fvc::snGrad(p_rgh) ) * mesh.magSf() ) ); solve(UEqn() == -fvc::grad(p)); fvOptions.correct(U); } ---------------------------------------------------------------------- I added Ubar and it still gives the erroe: --> FOAM FATAL ERROR: object is not allocated From function T& Foam::autoPtr<T>:perator()() in file /builddir/build/BUILD/OpenFOAM-2.2.1/src/OpenFOAM/lnInclude/autoPtrI.H at line 118. FOAM aborting #0 Foam::error:rintStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::fv:ressureGradientExplicitSource::correct( Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) at ??:? #3 at ??:? #4 at ??:? #5 __libc_start_main at ??:? #6 at ??:? Aborted (core dumped) ------------------------------------------------------------------------------ DO you have any idea what this error is about? |
|
August 23, 2013, 14:52 |
|
#10 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
your fvOption that you tried to add in there before is uncommented. Comment that out. Make sure to have all the proper code in there to define the flowDirection and get uBar as what channelFoam did int he past.
|
|
August 23, 2013, 15:07 |
|
#11 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
Well, it was not commented. I removed all the comment lines. as I comment them, there is no error. That is why I got confused. The fvOption, has the exact format that I found in channel flow files.
|
|
August 23, 2013, 15:24 |
|
#12 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
I know you uncommented the fvOptions in your last example because the channel395 tutorial did. You are mixing these approaches together as one uses fvOptions and one uses an old approach with a flowDirection like that implemented in channeFoam in OpenFOAM-2.1. Okay I'm going to clarify this, as I think there is a miscommunication. You can handle cyclic boundaries in interFoam with several approach
Learning OpenFOAM does not happen overnight and it takes patience to sit down and look through code. All of the information that I have provided can be used to solve your problem. I know its possible because I have done this, at this level one need to so slow down a bit and think about what terms are being added as its not apparent right off the bat |
|
August 23, 2013, 15:30 |
|
#13 |
Member
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 17 |
Thanks for the explanation Dan,
It is my first week with OpenFoam, and as you mentioned, problems will not be solved this weekend I will try to get back to mapping method, as you said, and see if I can get through it. Going through codes might not be a good way at this point as I am still learning the software. I will try to fix it, in case if did not work, I will get back to you for more hints, if you do not mind. Thank you again for very useful tips. Shawn, |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cyclic boundaries importing Gambit msh file and interFoam | chegdan | OpenFOAM Running, Solving & CFD | 16 | February 14, 2023 04:56 |
interFoam and cyclic boundary condition issue | General_Gee | OpenFOAM Running, Solving & CFD | 17 | October 8, 2018 10:33 |
Pressure instability with rhoSimpleFoam | daniel_mills | OpenFOAM Running, Solving & CFD | 44 | February 17, 2011 18:08 |
Pressure reference in cyclic interFoam | AlmostSurelyRob | OpenFOAM | 7 | February 16, 2011 10:58 |
interFoam & cyclic condition | Ingenierias2003 | OpenFOAM | 2 | June 7, 2010 12:16 |