CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

InterFoam cyclic BC

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By chegdan
  • 1 Post By chegdan
  • 1 Post By sfotovati

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 22, 2013, 18:01
Default InterFoam cyclic BC
  #1
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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.
sfotovati is offline   Reply With Quote

Old   August 22, 2013, 18:44
Default
  #2
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
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
chegdan is offline   Reply With Quote

Old   August 22, 2013, 19:24
Default
  #3
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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,
sfotovati is offline   Reply With Quote

Old   August 22, 2013, 19:35
Default
  #4
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
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
If you go back to OpenFOAM-2.1.x you will see a solver called channelFoam which may help.
chegdan is offline   Reply With Quote

Old   August 22, 2013, 19:41
Default
  #5
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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?
sfotovati is offline   Reply With Quote

Old   August 22, 2013, 19:44
Default
  #6
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
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
  • What is the rest of the error message?
  • What have you tried already?
  • Do you have a test case you can share?

This will make it much easier to help and be less work.
yanxiang likes this.
chegdan is offline   Reply With Quote

Old   August 22, 2013, 19:58
Default
  #7
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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.
Attached Files
File Type: zip testcase1.zip (10.3 KB, 29 views)
sfotovati is offline   Reply With Quote

Old   August 22, 2013, 23:24
Default
  #8
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Quote:
Originally Posted by sfotovati View Post
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.
  1. The flow fades away to nothing because there is no driving force to move the flow hence why you need to have a gradient source term (as you have noted), so this is expected behavior. Even if you place an initital veolcity value for eh cyclcic boundaries...that is jsut a place holder.
  2. your error is because there is no fvOptions implemented in the solver (its read but not implemented so thats why you get that strange "object not allocated" error)....did you try to code it like pimpleFoam? Because when you do, and you try and use the pressureGradientExplicitSource source fvOption you will find that your units wont match up. Therefore you need to do a custom fvOption or do a coded fvOption

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 08:53. Reason: added another option to solve this problem
chegdan is offline   Reply With Quote

Old   August 23, 2013, 12:56
Default
  #9
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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?
sfotovati is offline   Reply With Quote

Old   August 23, 2013, 13:52
Default
  #10
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
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.
chegdan is offline   Reply With Quote

Old   August 23, 2013, 14:07
Default
  #11
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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.
sfotovati is offline   Reply With Quote

Old   August 23, 2013, 14:24
Default
  #12
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
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
  1. If the cyclic flow is perpendicular to the direction of gravity and you need to induce a flow, you may use something similar to the "mapped" boundary conditions. The issue with this is that the BC is one-way coupled i.e. information will flow from outlet to inlet but not inlet to outlet. The strength of this is that it may not require any coding whatsoever.
  2. If the flow is aligned with the gravity field you may need to split off gravity from pressure as the other links I gave earlier discussed. From there you need to add a driving force. You can use fvOptions which will require coding and there are examples of how to add this. You may need to have a custom explicitPressure gradient fvOption that will allow for the units to work out. Alternately, you can go back to the methods in OpenFOAM-2.1 to the solver channelFoam or even search the forum for channelFoam.

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
hhu_lulu likes this.
chegdan is offline   Reply With Quote

Old   August 23, 2013, 14:30
Default
  #13
Member
 
Shawn Fotovati
Join Date: Jul 2009
Location: Dallas, TX
Posts: 42
Rep Power: 16
sfotovati is on a distinguished road
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,
chegdan likes this.
sfotovati is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 03:56
interFoam and cyclic boundary condition issue General_Gee OpenFOAM Running, Solving & CFD 17 October 8, 2018 09:33
Pressure instability with rhoSimpleFoam daniel_mills OpenFOAM Running, Solving & CFD 44 February 17, 2011 17:08
Pressure reference in cyclic interFoam AlmostSurelyRob OpenFOAM 7 February 16, 2011 09:58
interFoam & cyclic condition Ingenierias2003 OpenFOAM 2 June 7, 2010 11:16


All times are GMT -4. The time now is 09:57.