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

Transient interFoam with MRF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 18, 2007, 17:46
Default Hi OpenFOAMers Wish you all
  #1
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi OpenFOAMers

Wish you all a nice evening

I have attempted to modify PISO based interfoam solver to the Transient interFoam solver which uses MRF as well. I am posting here the code and hope to get some expert feedback. Please correct me if I am wrong somewhere.

--\*---------------------------------------------------------------------------* /

#include "fvCFD.H"
#include "MULES.H"
#include "subCycle.H"
#include "interfaceProperties.H"
#include "twoPhaseMixture.H"
#include "MRFZones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{

# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "readEnvironmentalProperties.H"
# include "readPISOControls.H"
# include "initContinuityErrs.H"
# include "createFields.H"
# include "readTimeControls.H"
# include "correctPhi.H"
# include "setInitialDeltaT.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

for (runTime++; !runTime.end(); runTime++)
{
# include "readPISOControls.H"
# include "readTimeControls.H"
# include "CourantNo.H"

Info<< "Time = " << runTime.timeName() << nl << endl;

twoPhaseProperties.correct();

# include "gammaEqnSubCycle.H"

surfaceScalarField muf = twoPhaseProperties.muf();

// pressure velocity Transient SIMPLE corrector loop

for (int corr=0; corr<nCorr; corr++)
{
tmp<fvvectormatrix> UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
);


mrfZone_1.addCoriolis(UEqn());

UEqn().relax();

solve
(
UEqn()
==
fvc::reconstruct
(
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(g amma)
- ghf*fvc::snGrad(rho)
- fvc::snGrad(pd)
) * mesh.magSf()
)
);

pd.boundaryField().updateCoeffs();

volScalarField rUA = 1.0/UEqn().A();
surfaceScalarField rUAf = fvc::interpolate(rUA);

U = rUA*UEqn().H();
UEqn.clear();

surfaceScalarField phiU
(
"phiU",
(fvc::interpolate(U) & mesh.Sf())
);
phi = phiU +
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(g amma)
- ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf();


mrfZone_1.relativeFlux(phi);
adjustPhi(phi, U, pd);

pd.storePrevIter();

for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pdEqn
(
fvm::laplacian(rUAf, pd) == fvc::div(phi)
);

pdEqn.setReference(pdRefCell, pdRefValue);

if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pdEqn.solve(mesh.solver(pd.name() + "Final"));
}
else
{
pdEqn.solve(mesh.solver(pd.name()));
}

if (nonOrth == nNonOrthCorr)
{
phi -= pdEqn.flux();
}
}

# include "movingMeshRhoUContinuityErrs.H"

U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
U.correctBoundaryConditions();

}


runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return(0);
}

--------------------------------
Thanks in advance
Best Regards
Jaswinder
jaswi is offline   Reply With Quote

Old   April 17, 2009, 13:04
Default MRF interFoam solver
  #2
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
I realize this thread is a bit stale, but I wanted to give an update in this area. Based on the code posted by Jaswinder, I made a MRFinterFoam solver and have been doing some testing. The first test case was to take the setup from the MRFSimpleFoam tutorial on the wiki (http://openfoamwiki.net/index.php/MRFSimpleFoam) which consists of a rotating cube in a cylinder. For this test I started with the liquid level just below the top of the rotating box. Originally I tried an MRF omega value that I though was reasonable (~10-100) and got problems so I changed it to 1.0 (I assume this is radians per second, but the result make me suspicious). Here is the gamma and U distributions on a couple cross-sections at t=0.5s :




1 rad/s is pretty slow rotation, the maximum velocity should be very small, but as you can see from the the U image things are up to ~0.5 m/s.

Is there some problem with using MRFZones with interfoam that is causing unphysical results?
kwardle is offline   Reply With Quote

Old   April 17, 2009, 15:48
Default MRF interFoam solver #2
  #3
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
Second example, same problem. For another test, I constructed a bottom-fed centrifuge type geometry where there are two feeds coming into a T junction which flows upward into the centrifuge bowl (the rotating domain). The centrifuge has two small baffles and a weir above which the fluid flows out radially. The radius of the centrifuge cylinder is only 1cm.
Here you can see the geometry and the initially gamma field:



The inlet velocity on the two inlets was 0.1m/s.

For this MRFZones was set to:
1
(
rotor
{
patches (rotwalls outlet);
origin origin [0 1 0 0 0 0 0] (0 0 0);
axis axis [0 0 0 0 0 0 0] (0 0 1);
omega omega [0 0 -1 0 0 0 0] 0.1;
}
)
Incidentally, I also tried leaving out the two patches and didn't see any difference in the solution. Again, I also tried initially a larger omega, but got extremely small time steps (indicating large velocity).

Here is the gamma field and U vectors for t=1s


You can see here that the max velocities are up to 1.19 m/s. For this radius (r=1cm) and omega = 0.1 rad/s, the outer wall velocity should only be U_tan = r*omega = 0.1*0.01 = 0.001 m/s = 1mm/s = snail speed. Something is wrong. Also I didn't show the axes, but the rotation here is clockwise--perhaps I am missing something, but I would have thought that omega would have the standard definition and the rotation of the flow should be counter-clockwise.

Can anyone offer help? I would be happy to send and/or post the solver I am using and the files for this test case.
kwardle is offline   Reply With Quote

Old   May 2, 2009, 16:23
Default
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Kent

I got your mail. Send me the solver and test case . My guess is that there
is some very basic mistake in the solver. Back then I just left it like that as there was no feedback. We can try to bring this solver back to life :-)

Kind Regards
Jaswi
jaswi is offline   Reply With Quote

Old   May 4, 2009, 10:43
Default MRFinterFoam solver
  #5
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
Atached is the MRFinterFoam solver that I constructed by modifying the interFoam solver based on the code posted by Jaswinder above along with one based directly on his code (MRFinterFoamJPS) with only a few modifications needed to make it compile and run without errors. Also, here are the two test cases described in my previous posts. I get essentially the same behavior with either solver.

http://sites.google.com/site/kwardle..._rotbox.tar.gz

http://sites.google.com/site/kwardle...tBaffle.tar.gz

Thank you for taking a look at this!
-Kent
Attached Files
File Type: gz MRFinterFoam.tar.gz (7.1 KB, 74 views)
File Type: gz MRFinterFoamJPS.tar.gz (6.8 KB, 54 views)
kwardle is offline   Reply With Quote

Old   May 22, 2009, 21:58
Default
  #6
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Kent

To start with I have first done some first principle checks using the MRFSimpleFOAM on the rotating box case setup. The velocity values and direction for this setup is correct.

Here is a picture of velocity field. As expected the maximum velocity is at the diagonals of the cube. The cube is 1.5 cm (LxBxH) and at 10 rad/sec the velocity calculates to 0.021 m/sec

The inner cylinder shows the size of the rotating zone - rotor.


I will analyze the MRFSimpleFOAM code once again and report back tomorrow about my findings. On that basis we will able to figure out what are we doing wrong in MRFInterFAOM. My wildest guess is that water's density is having some effect here as we have mass flux term rhoPhi in this case and a quick nudge is creating those velocities. I have to check what happens If I increase the velocity gradually .

Best Regards
Jaswi
Attached Images
File Type: jpg firstPrincipleAnalysis.jpg (31.1 KB, 227 views)
jaswi is offline   Reply With Quote

Old   June 23, 2009, 07:56
Default
  #7
Senior Member
 
Hannes Kröger
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 124
Rep Power: 18
hannes is on a distinguished road
Hello Guys,

besides phi, there is another flux in this solver: phiU. I guess you should insert a

mrfZones.relativeFlux(phiU);

Best regards, Hannes
hannes is offline   Reply With Quote

Old   June 23, 2009, 08:02
Default
  #8
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Hannes

Thanks for the tip.

I guess the correct formulation will turn up once we have the VOF equations in rotating frame of reference.

Any idea or reference will be really great.

Regards
Jaswi
jaswi is offline   Reply With Quote

Old   June 23, 2009, 10:25
Default MRFInterFoam solver
  #9
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
Jaswi,
Thought I would post an update on this since you have given of your time to look into this.

Here is a working MRFInterFoam solver written by Henry Weller (I finally got a support contract).
MRFInterFoam.tgz

Apparently, it requires you to download and recompile the most recent 1.5.x distribution. I have done this and it works great. Note that this solver also solves directly for p (rather than pd--a big plus for me if you have read some of my other posts about issues with static pressure and pressure outlets) a change that will be part of the interFoam solvers for 1.6. Not sure if this solver will be included in the 1.6 release (not sure when the release will be either, but I was told 'soon').
kwardle is offline   Reply With Quote

Old   June 23, 2009, 10:30
Default
  #10
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
BTW,
I think Hannes is right--it should have been "mrfZones.relativeFlux(phiU);" in pEqn.H (not phi). I am not sure what other changes were needed to the main libraries that requires recompilation and use of 1.5.x. Maybe that was just for the p solve?
kwardle is offline   Reply With Quote

Old   June 24, 2009, 04:20
Default
  #11
Senior Member
 
Hannes Kröger
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 124
Rep Power: 18
hannes is on a distinguished road
Hi Kent,

thanks for the link.
I think 1.5.x is needed because changes in the "MRFZone" class. There is a variant of addCoriolis() in 1.5.x which takes the density.

Regards, Hannes
hannes is offline   Reply With Quote

Old   August 18, 2009, 18:21
Default MRFInterFoam
  #12
New Member
 
Evgeniy Redekop
Join Date: Mar 2009
Posts: 5
Rep Power: 17
unit is on a distinguished road
Hello,

kwardle, could you, please, post the link to MRFInterFoam.tgz again? The link you gave in your post on June 23, 2009, 09:25 does not work any more.

I have just started diving into openFoam to simulate a stirred tank and it would be very helpful to look at this solver. As far as I understood, it works in OF 1.5.x only. Am I right?

Thank you in advance.
unit is offline   Reply With Quote

Old   August 18, 2009, 18:36
Default included in 1.6
  #13
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
Since it was written by the guys at OpenCFD, the MRFinterFoam solver is included as part of 1.6--look in the tutorials under multiphase/interFoam/MRFinterFoam. If you want the 1.5.x version, the link from the previous post should work now.
kwardle is offline   Reply With Quote

Old   August 19, 2009, 15:22
Default
  #14
New Member
 
Evgeniy Redekop
Join Date: Mar 2009
Posts: 5
Rep Power: 17
unit is on a distinguished road
Thank you, kwardle, very much. It works great!

unit
unit is offline   Reply With Quote

Old   December 3, 2009, 14:12
Default
  #15
New Member
 
P.M.Bronow
Join Date: Nov 2009
Location: Poland/Germany
Posts: 14
Rep Power: 17
PrzemekPL is on a distinguished road
Hallo,


Does anyone know how to set time varying angular speed (omega)?
I'd like to simulate rotation with given acceleration. I'm using MRFInterFoam.


I couldn't find on the forum any hints but please give me a link if similar problem has been already somewhere discussed.


Thanks a lot!


Przemek

Last edited by PrzemekPL; December 4, 2009 at 03:52.
PrzemekPL is offline   Reply With Quote

Old   January 19, 2010, 18:32
Default
  #16
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
I have not done this before so I am just taking a stab, but you might take a look at this post which talks about implementing a time varying g.

http://www.cfd-online.com/Forums/ope...vity-time.html

Perhaps you would do something similar for omega--that is, define a new field for omega and write an equation to change omega within your time loop. You can look in src/finiteVolume/cfdTools/general/MRF/MRFZone.* to get an idea of how omega is set. It looks like "omega" is read from the dict as a dimensionedScalar but is immediately changed to a dimensionedVector "Omega" by multiplying with the "axis" vector. I assume "Omega" is what is used later on.

Hope this helps in some way...
kwardle is offline   Reply With Quote

Old   October 21, 2011, 00:18
Default MRFInterFoam
  #17
New Member
 
theja
Join Date: Oct 2011
Posts: 17
Rep Power: 15
theja is on a distinguished road
Quote:
Originally Posted by kwardle View Post
Atached is the MRFinterFoam solver that I constructed by modifying the interFoam solver based on the code posted by Jaswinder above along with one based directly on his code (MRFinterFoamJPS) with only a few modifications needed to make it compile and run without errors. Also, here are the two test cases described in my previous posts. I get essentially the same behavior with either solver.

http://sites.google.com/site/kwardle..._rotbox.tar.gz

http://sites.google.com/site/kwardle...tBaffle.tar.gz

Thank you for taking a look at this!
-Kent
Very good morning kent

i am trying to solve a airpurifier by using MRFInterFoam whether it suits good or not.,
if not which solver is best to solve for it

thanking you in advance
theja is offline   Reply With Quote

Old   October 21, 2011, 00:22
Default MRFInterFoam
  #18
New Member
 
theja
Join Date: Oct 2011
Posts: 17
Rep Power: 15
theja is on a distinguished road
dear foamers

i am trying to solve a airpurifier by using mrfinterfoam so please, if there if any tutorial on mrfinterfoam can you please send it to me.
and also please suggest me if the solver can solve the airpurifier or not, and if not which is the best solver to solve the problem
theja is offline   Reply With Quote

Old   October 21, 2011, 00:29
Default MRFInterFoam
  #19
New Member
 
theja
Join Date: Oct 2011
Posts: 17
Rep Power: 15
theja is on a distinguished road
dear foamers

i am trying to solve a airpurifier by using mrfinterfoam so please, if there if any tutorial on mrfinterfoam can you please send it to me.
and also please suggest me if the solver can solve the airpurifier or not, and if not which is the best solver to solve the problem
theja 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
InterfaceCompression interFoam sega OpenFOAM Running, Solving & CFD 4 May 25, 2016 11:29
Outlet bc in interFoam happysimulant OpenFOAM Running, Solving & CFD 0 November 6, 2008 11:06
InterFoam floooo OpenFOAM Running, Solving & CFD 0 November 3, 2008 12:00
InterFoam vs lesInterFoam in_flu_ence OpenFOAM Running, Solving & CFD 2 October 29, 2007 16:41
Transient Flow, Transient Pressure in Work Bench Erich CFX 1 May 8, 2007 12:55


All times are GMT -4. The time now is 20:52.