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

periodic set up - cyclicAMI

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2020, 06:29
Default periodic set up - cyclicAMI
  #1
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
Hi everyone,

I am OpenFOAM newbie, so bear with me!

I am a bit confused about cyclicAMI and how to set it up... I have not been able to find some tutorials that replicate what I am trying to do.

So, I am studying 3D periodic porous structures. Previously, I had access to commercial software (STAR CCM+) and I will have a set up with a single unit cell with periodic conditions in all 3 directions (in the flow direction, a special type of periodic BC which is called "fully developed flow" that allows specifying certain mass flow rate through the boundary). This set up keeps the domain (and thus cell count) very low, which is important as I have to characterize many different geometries (100-1000) every time.

The objective is to replicate this set up in OpenFOAM (if possible). I was thinking cyclicAMI may be the best option, as creating periodic meshes can be challenging for complex geometries (as my case). I will be using simpleFOAM at the moment (with a modified version to account for heat transfer later on)

- Is it cyclicAMI the right choice?
- For the special case of the periodicity in the flow direction, can cyclicAMI be used? how can I specify certain flow through the boundary?
- Once I created the mesh, I just have to modify the following files:
- constant/polyMesh/boundary
- 0/U , 0/p , 0/T ...
Is this workflow correct? what will be correct set up in each file?

Thanks!

Javier
jvinuales is offline   Reply With Quote

Old   February 14, 2020, 00:39
Default
  #2
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
You can use cyclicAMI. But I think translation periodic will need additional implementation. It can be either pressure gradient specification or mass flow rate specification. You can use it for rotational periodic directly.
ybapat is offline   Reply With Quote

Old   February 14, 2020, 05:03
Default
  #3
New Member
 
Join Date: Mar 2017
Posts: 25
Rep Power: 9
.bastian is on a distinguished road
Quote:
Originally Posted by jvinuales View Post
[...]
- Is it cyclicAMI the right choice?
- For the special case of the periodicity in the flow direction, can cyclicAMI be used? how can I specify certain flow through the boundary?
[...]
Hello Javier.

Lets begin with some of your questions.
Generally there are two main options to set periodicity.
If you are able to generate a conformal mesh, cyclic would be the choice: User Guide: Cyclic
In case of non conformal meshes you may choose CyclicAMI oder GGI (foam-extend): User Guide: cyclicAMI
Conformal mesh means, that the nodes of the faces you want to connect are matching together perfectly.

As far i know, you can't specify a flow through an cyclic/cyclicAMI interface. Its only a connection of both sides.

It would be nice if you can give us a few more informations like:
- which OpenFOAM version do you want to use?
- how do you generate the mesh?

Greetings
bastian

Last edited by .bastian; February 14, 2020 at 07:53.
.bastian is offline   Reply With Quote

Old   February 14, 2020, 07:37
Default
  #4
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
Thank you for your answers.

I thought I would go about this step by step:
- first, will try to set up cyclicAMI in the 2 directions perpendicular to the flow.
- second, I will try to implement periodicity in the flow direction.

The first case should be more straight-forward. I managed to set it up in 1 direction, and it ran without problems. However, the results seemed odd as not as much flow as expected was getting through the cyclicAMI boundary. Furthermore, if I added the second pair it will not run (file attached).

Regarding the second case, I saw that some flow rate can be forced through the boundary with fvOptions (momentumsource:meanVelocityForce), and hopefully works well with cyclicAMI. For the pressure, I saw jumpCyclicAMI, that could work for representing a jump in pressure from inlet to outlet. However, I am not sure about other fields such temperature and turbulence variables.

Javier

Last edited by jvinuales; February 19, 2020 at 11:24.
jvinuales is offline   Reply With Quote

Old   February 14, 2020, 07:46
Default
  #5
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
Quote:
Originally Posted by .bastian View Post
Hello Javier.


It would be nice if you can give us a few more informations like:
- which OpenFOAM version do you want to use?
- how do you generate the mesh?
I am running openFOAM in a windows machine. I am currently working with 2 versions (have not decided yet what works better for me): BlueCFD with OpenFOAM 5.x and v1912 with an Ubuntu Bash.

In terms of meshing, currently using cf-mesh+ (with a trial)... also still trying to figure out what works better for me.
jvinuales is offline   Reply With Quote

Old   February 19, 2020, 08:02
Default
  #6
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
I made some progress with this case.

I have the periodicity in all three directions, and the case run without problems.

I used cyclicAMI in all the directions, and add the following to fvOptions:

Code:
momentumSource
{
    type            meanVelocityForce;

    selectionMode   all;

    fields          (U);
    Ubar            (-0.6 0 0);
}

pRefCell	0;
pRefValue	0;
The problem is that the results are not very physical or realistic, as there is no pressure drop along the flow (obviously, as the pressure is mapped from one face to another).

Is there any boundary condition I can apply for the pressure that results in a physically realistic condition? Like an undefined constant offset?? or any other set up recommendations?

case:
https://drive.google.com/file/d/1R85...ew?usp=sharing

gyroid_p.JPG
gyroid_U.JPG
gyroid_U_zx.JPG
Akimlav likes this.
jvinuales is offline   Reply With Quote

Old   February 20, 2020, 05:44
Default
  #7
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
I found the fixedJumpAMI boundary condition that could be applied in the flow direction:

0/p
Code:
    x1
	{
		type            fixedJumpAMI;
		patchType       cyclicAMI;
		jump            uniform 1;
		value           $internalField;
	}
    x2
    {
		type            fixedJumpAMI;
		patchType       cyclicAMI;
		value           $internalField;
    }
0/U
Code:
    x1
    {

        type		cyclicAMI;

    }
    x2
    {

        type		cyclicAMI;

    }
This, in theory, achieves the expected behaviour:

Gyroid_p.JPG
Gyroid_U.JPG

I will start trying to set up turbulence and temperature. Regarding turbulence, can I assume that the turbulence parameters are periodic (as U)? hence I can use cyclic?
jvinuales is offline   Reply With Quote

Old   February 23, 2020, 21:48
Default
  #8
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
I've done a few simulations almost exactly like this meanvelocityForce is a closed loop control method that applies a pressure gradient to the flow to sustain the desired flow rate. If you watch the logs there should be a printout of the current pressure drop the solver is using.

I've found this to be the most reliable and convergent method. Especially if you want to study the flow at particular flow rates rather than applying pressure drops and hoping to find a flow rate.

I used cyclic turbulence parameters and U in my study and p ends up being cyclic with a jump. T can be difficult because if it is cyclic it will blow up. Additionally, if the flow is compressible then the physical properties are dependant on T so a cyclic study is non-physical.

The other way I have achieved good results is using mappedPatch.
Inlet is set to mappedPatch type and condition is mapped.
Turbulence is mapped from outlet to inlet, outlets are zeroGradient.
U is mapped the same but with setAverage true; as is T.
p is the only field that does not get mapped. outlet uses the fixedMean condition and inlet uses zeroGradient.
Start the flow overdamped and then lower the damping after it's starred and you should see convergence.
You may also need to extend your domain to be 2,3, or 4 repetitions of the geometry.
Teresa.Z likes this.
pete20r2 is offline   Reply With Quote

Old   February 28, 2020, 06:48
Default
  #9
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
Thanks for your answer! It really helps.

Quote:
Originally Posted by pete20r2 View Post
I've found this to be the most reliable and convergent method. Especially if you want to study the flow at particular flow rates rather than applying pressure drops and hoping to find a flow rate.
Yes, I found convergence is much better with meanVelocityForce than using a jump in pressure. As you point out, I also need to control the flow rate through the domain rather than the pressure jump, so it seems more logical as well. However, I do not understand what boundary condition should apply in p as the cyclicAMi will result in no gradient in pressure, meaning that the results are unphysical... am I missing something?

Quote:
Originally Posted by pete20r2 View Post
I used cyclic turbulence parameters and U in my study and p ends up being cyclic with a jump.
do you use cyclicAMI in 0/p? If I do so I get no gradient/jump

Quote:
Originally Posted by pete20r2 View Post
T can be difficult because if it is cyclic it will blow up. Additionally, if the flow is compressible then the physical properties are dependant on T so a cyclic study is non-physical.
I am using incompressible fluid, so I am not concern about compressibility. Also, I can live with non-temperature-dependant properties for this study. I wonder if a fixedJump in T, together with a fixed gradient in the wall would result in a const heat flux conditions... I need to investigate more.

Quote:
Originally Posted by pete20r2 View Post
The other way I have achieved good results is using mappedPatch.
I will give a try to this... do you still use meanVelocityForce to keep the flow going? or just the initial conditions?

Quote:
Originally Posted by pete20r2 View Post
Start the flow overdamped and then lower the damping after it's starred and you should see convergence.
I am not sure I fully understand what you mean with this statement?
jvinuales is offline   Reply With Quote

Old   March 4, 2020, 03:34
Default
  #10
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
Quote:
However, I do not understand what boundary condition should apply in p as the cyclicAMi will result in no gradient in pressure, meaning that the results are unphysical... am I missing something?
meanVelocityForce will apply a gradient to the entire p field.
The meanVelocityForce fvOption will cause these outputs:

Start of execution
Code:
Creating finite volume options from "constant/fvOptions"

Selecting finite volume options type meanVelocityForce
    Source: momentumSource
    - selecting all cells
    - selected 60000 cell(s) with volume 16
    Initial pressure gradient = 0
Per iteration
Code:
Time = 0.8

PIMPLE: iteration 1
smoothSolver:  Solving for Ux, Initial residual = 0.0112044, Final residual = 5.90986e-06, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.0606708, Final residual = 3.37513e-06, No Iterations 3
smoothSolver:  Solving for Uz, Initial residual = 0.0579524, Final residual = 2.73287e-06, No Iterations 3
Pressure gradient source: uncorrected Ubar = 0.1335, pressure gradient = 2.67342e-05
GAMG:  Solving for p, Initial residual = 0.13367, Final residual = 0.00203606, No Iterations 2
time step continuity errors : sum local = 1.22471e-06, global = 1.74992e-20, cumulative = -2.29145e-19
Pressure gradient source: uncorrected Ubar = 0.1335, pressure gradient = 2.6722e-05
GAMG:  Solving for p, Initial residual = 0.0107536, Final residual = 7.18508e-07, No Iterations 5
time step continuity errors : sum local = 4.79701e-10, global = -5.57251e-20, cumulative = -2.84871e-19
Pressure gradient source: uncorrected Ubar = 0.1335, pressure gradient = 2.66637e-05
ExecutionTime = 0.52 s  ClockTime = 2 s

fieldAverage fieldAverage1 write:
    Calculating averages

Courant Number mean: 0.302291 max: 0.522438
This is a kinematic pressure because we are in an incompressible solver. If you take that gradient and multiply by the length of your channel, you will get the kinematic pressure drop between inlet and outlet.
Please look at the channel395 tutorial in "openfoam/tutorials/incompressible/pimpleFoam/LES/channel395". It works just fine for RAS cases, but that tutorial just happens to be where the function is demonstrated.

T can be added as a passive scalar using a function in controlDict called scalarTransport. I have a rough example but I'm not sure it works properly.

Or you can duplicate the case and create a new case for the scalarTransportFoam solver to run after your original case on the frozen field.

About mapped patches:

Quote:
I will give a try to this... do you still use meanVelocityForce to keep the flow going? or just the initial conditions?
No, mappedPatch provides for mapping an outlet to an inlet and ensuring a specified flow rate with the setAverage option.
Achuth likes this.
pete20r2 is offline   Reply With Quote

Old   March 4, 2020, 05:22
Default
  #11
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
ok, I finally understand!! Thanks!!

My problem was that the pressure field is not updated... I was just checking the results with Paraview and with functions as pressureDifferencePatch and these do not reflect the pressure gradient.

Is there a way to update the p field with the pressure gradient source so the results in Paraview and the postprocessing functions reflect the actual p?
jvinuales is offline   Reply With Quote

Old   March 4, 2020, 22:42
Default
  #12
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
Sure you can, but not automatically without using more functions.
I do this by using the calculator function in paraview.

Hit ctrl+space to bring up the filter search and look for "calculator".
Grab the pressure gradient from the last iteration in your log file.
Multiply the pressure gradient by the point position in the direction of your flow, for me that is the X coordinate. The gradient may need to be negative to be in the correct direction but that should be obvious.

You now have a new field called realP that includes the pressure gradient.
While you're in there you could also multiply by density to calculate the real static pressure instead of kinematic pressure.
Attached Images
File Type: png calc.PNG (4.5 KB, 1340 views)
pete20r2 is offline   Reply With Quote

Old   March 6, 2020, 09:59
Default
  #13
Member
 
Javier Vinuales
Join Date: May 2016
Posts: 42
Rep Power: 9
jvinuales is on a distinguished road
Thanks again.

Quote:
Originally Posted by pete20r2 View Post
T can be added as a passive scalar using a function in controlDict called scalarTransport. I have a rough example but I'm not sure it works properly.

Or you can duplicate the case and create a new case for the scalarTransportFoam solver to run after your original case on the frozen field.
I figured out that in terms of temperature, for a constant heat flux case, there is an analogy with pressure i.e. there is a constant jump in the flow for subsequent repeatable structures. (source: Lattice Boltzmann simulations of heat transfer in fully developed periodic incompressible flows, Zimeng Wang et al).

If that is the case, jumpAMI should work correctly and lay physical results, always making sure that gradT and dT (jump) are consistent with each other for the fluid properties. However, the temperature increases without control, as there is no temperature reference or any ways to specify the inlet temperature (for example).

In the case of the pressure this is avoided through pRefCell and pRefValue... is there any equivalent formulation for temperature?

Also, I saw the possibility to try to force the inlet average temperature to be maintained as here:

Maintaining average temperature at Inlet in cyclic Boundary condition

did you have any success implementing this option?
jvinuales is offline   Reply With Quote

Old   March 13, 2020, 23:19
Default fully developed pipe flow in LES
  #14
Member
 
bany
Join Date: Nov 2019
Posts: 38
Rep Power: 7
bany is on a distinguished road
Hi, peter, i am interested in your method. But when using these in a pipe to get a fully developed pipe flow, i am always failed.
For your mapped method, did you add a initial perturbation to the flow field such as turbulentInlet or other? Because i found if there is no initial perturbation , it is difficult to produce a fully developed pipe flow.
And for my case with a pipe of 20D length, U is mapped with setAverage ture (110 0 0). k is also mapped with setAverage no. p and nut is not mapped. After about 100 flow times, i cannot see a fully developed flow structure and the Umean is gradually increasing.
By the way, i found add a wallFunction to nut only change the U profile near the wall having few effect on the entire U proflie.
Attached Images
File Type: jpg mesh.jpg (95.7 KB, 54 views)
File Type: jpg u.jpg (18.7 KB, 35 views)
bany is offline   Reply With Quote

Old   April 21, 2020, 22:47
Default
  #15
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
Hi bany,
Sorry for the delayed reply. What are your pressure conditions?
Also every quantity except for pressure should be mapped, this includes the turbulent fields.
I have not used many LES simulations but from my understanding LES is much more sensitive to initial conditions than RAS. Obviously in a periodic flow we should see convergence to the same solution over a wide range of initial conditions. I think you are right to try and introduce some initial perturbations.
pete20r2 is offline   Reply With Quote

Old   April 21, 2020, 23:20
Default
  #16
Member
 
bany
Join Date: Nov 2019
Posts: 38
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by pete20r2 View Post
Hi bany,
Sorry for the delayed reply. What are your pressure conditions?
Also every quantity except for pressure should be mapped, this includes the turbulent fields.
I have not used many LES simulations but from my understanding LES is much more sensitive to initial conditions than RAS. Obviously in a periodic flow we should see convergence to the same solution over a wide range of initial conditions. I think you are right to try and introduce some initial perturbations.
Hi, thanks for your replying. The following is my setup:
Attached Files
File Type: zip pipe-mapped BC.zip (6.9 KB, 31 views)
jvinuales likes this.
bany is offline   Reply With Quote

Old   April 22, 2020, 04:50
Default
  #17
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
Your zip file is broken, do you want to try again?
pete20r2 is offline   Reply With Quote

Old   April 22, 2020, 07:57
Default
  #18
Member
 
bany
Join Date: Nov 2019
Posts: 38
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by pete20r2 View Post
Your zip file is broken, do you want to try again?
OK.
The y+~5, and the solver pisoFoam is used.
Much thanks!
Attached Files
File Type: zip pipe-mapped.zip (8.0 KB, 42 views)
bany is offline   Reply With Quote

Old   April 24, 2020, 04:47
Default
  #19
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
Is this not what you are expecting?


I changed a few things:
Pipe made shorter
Mapping taken from exit patch instead of offset
Mapped nut also
p field uses fixedFluxPressure (probably has no effect in this context)
Have a look at how blockMeshDict is defined for the patches
Added minIter 1 to U and p solutions

I had to turn some of your functions off to get it to run but shouldn't effect solution. See attached

pipe-mapped-short2.zip
Attached Images
File Type: jpg developed2.jpg (60.7 KB, 1315 views)
File Type: jpg log.jpg (56.1 KB, 1310 views)
pete20r2 is offline   Reply With Quote

Old   April 24, 2020, 08:23
Default
  #20
Member
 
bany
Join Date: Nov 2019
Posts: 38
Rep Power: 7
bany is on a distinguished road
Quote:
Originally Posted by pete20r2 View Post
Is this not what you are expecting?

I changed a few things:
Pipe made shorter
Mapping taken from exit patch instead of offset
Mapped nut also
p field uses fixedFluxPressure (probably has no effect in this context)
Have a look at how blockMeshDict is defined for the patches
Added minIter 1 to U and p solutions

I had to turn some of your functions off to get it to run but shouldn't effect solution. See attached
What i am expecting is that a fully developed turbulent circular pipe flow with mapped BC. So the wall functions are used. Now, according to your results, there is no turbulence and the U profile is also parabolic.However, i also cannot get a correct turbulent flow in the pipe.
bany is offline   Reply With Quote

Reply

Tags
cyclic, cyclic ami, cyclicami, periodic bc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[ANSYS Meshing] Solution to periodic boundary problem SophieLee ANSYS Meshing & Geometry 1 June 28, 2017 02:51
cyclicAMI and interDyMFoam for periodic box kwardle OpenFOAM 1 March 11, 2014 14:40
correction of Grub after installing Windows XP and 8 immortality Lounge 20 January 5, 2014 18:41
How to set periodic boundaries with initial conditions? jiandai OpenFOAM 6 October 24, 2013 08:00
[snappyHexMesh] determining displacement for added points CFDnewbie147 OpenFOAM Meshing & Mesh Conversion 1 October 22, 2013 10:53


All times are GMT -4. The time now is 07:22.