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

Non stationary simulation of a 2D cylinder

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By kmooney
  • 1 Post By vkrastev

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2012, 18:35
Default Non stationary simulation of a 2D cylinder
  #1
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
Hi all;
I'm trying to run a non stationary simulation of a 2D circular cylinder and I have some questions:

1. If I use icoFoam (can I use it in my case?) I have a floating point exception due to the courant number. I can avoid that but I need to lower my time step below 0.000001.

2. If I use pisoFoam it complies about the empty patches…

3. [Warning - stupid question!] what's the different between using simpleFoam and saving the result at different time steps and using a non stationary solver? Even with simpleFoam I can get the vortex shedding…

Thank you!

Last edited by lovecraft22; April 3, 2012 at 11:13.
lovecraft22 is offline   Reply With Quote

Old   March 23, 2012, 12:36
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18
kmooney is on a distinguished road
If you tar up the case I wouldn't mind taking a look at it.
kmooney is offline   Reply With Quote

Old   March 23, 2012, 13:39
Default
  #3
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
Thank you kmooney.
Had to do a .zip file instead of a .tar because of the size allowance by the forum…I hope that's fine…
Attached Files
File Type: zip 5_cilindro.zip (31.7 KB, 28 views)
lovecraft22 is offline   Reply With Quote

Old   April 3, 2012, 11:05
Default
  #4
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18
kmooney is on a distinguished road
The high Co numbers appear to be a result of some bad cells generated by snappyHexMesh. I added a little code to CoNumber.H to write out the local Courant numbers:

Code:
//Compute and write Co field
        scalar CoNum = 0.0;
        scalar meanCoNum = 0.0;

        volScalarField CoField
        (
        IOobject
        (
            "CoField",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        fvc::surfaceSum(mag(phi))()
        );

        if (mesh.nInternalFaces())
        {
            scalarField sumPhi
            (
            fvc::surfaceSum(mag(phi))().internalField()
            );

            CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();

                    CoField.internalField() = 0.5*(CoField/mesh.V().field())*runTime.deltaTValue();

            meanCoNum =
            0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();

        }
        Info<< "Courant Number mean: " << meanCoNum
            << " max: " << CoNum << endl;
//END Co Number
Those bad cells cause a 3 order of magnitude variation of Co throughout the domain. (Images attached!) It may just be easier to use something else to mesh it or work with your snappyHexMesh settings to avoid the bad cells. I hope that helps!
Attached Images
File Type: jpg CoField_largeView.jpg (58.7 KB, 143 views)
File Type: jpg CoField_zoomView.jpg (53.7 KB, 155 views)
davcrisp likes this.
kmooney is offline   Reply With Quote

Old   April 3, 2012, 11:21
Default
  #5
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
Thank you Kyle, I really appreciate you help.

I had noticed indeed that my extruded mesh was bad on the cylinder surface so I played a little bit with the snappyHexMesh parameters and eventually I got a really good looking surface mesh but, again, no look with the convergence…

Could you please have a look at this case as well and see if the problem may be the same? The runScript is included. I got rid of the feature edges as it makes no differences for a 2D case like mine.

Those lines you posted, is that just something you need to add at the bottom of your controlDict?

Also, could you please explain the difference between running simpleFoam and looking at the flow at different time steps and doing the same thing with icoFoam? I know simpleFoam is a steady state solver but yet I can get the vortex shedding… is that just some numerical stuff?

Thank you again for your help!
Attached Files
File Type: zip 5_cilindro.zip (33.1 KB, 13 views)
lovecraft22 is offline   Reply With Quote

Old   May 4, 2012, 06:01
Default
  #6
New Member
 
Anne Severt
Join Date: May 2012
Posts: 4
Rep Power: 14
Anne Severt is on a distinguished road
Hey Kyle,

I´m new to CFD and OpenFoam, but I´m very much interested in your CoField implementation. Could you explain to me how you created the pictures? I edited the CourantNo.H file as you described, but I can´t create the images of CoField.

Thank you!

I was able to get a pic, but they don´t change in time. Aren´t they supposed to change?

Last edited by Anne Severt; May 7, 2012 at 11:21.
Anne Severt is offline   Reply With Quote

Old   May 4, 2012, 09:19
Default
  #7
Senior Member
 
Vesselin Krastev
Join Date: Jan 2010
Location: University of Tor Vergata, Rome
Posts: 368
Rep Power: 20
vkrastev is on a distinguished road
Quote:
Originally Posted by lovecraft22 View Post
Also, could you please explain the difference between running simpleFoam and looking at the flow at different time steps and doing the same thing with icoFoam? I know simpleFoam is a steady state solver but yet I can get the vortex shedding… is that just some numerical stuff?
In one word, yes. The "transient" solution you got from simpleFoam is just a numerical transitory till the algorithm goes convergent and generally speaking it does not have any physical meaning (although it could qualitatively seem so).

Regards

V.
lovecraft22 likes this.
vkrastev is offline   Reply With Quote

Old   May 7, 2012, 15:18
Default
  #8
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18
kmooney is on a distinguished road
Quote:
Originally Posted by Anne Severt View Post
Hey Kyle,

I´m new to CFD and OpenFoam, but I´m very much interested in your CoField implementation. Could you explain to me how you created the pictures? I edited the CourantNo.H file as you described, but I can´t create the images of CoField.

Thank you!

I was able to get a pic, but they don´t change in time. Aren´t they supposed to change?
Hi Anne,

As far as I can tell the Co field should be changing as long as U or deltaT is changing. The values are only valid on the internal field however so the patch values aren't accurate. It's always possible there is a bug but I haven't spent much time at all on it.
kmooney is offline   Reply With Quote

Old   May 8, 2012, 03:06
Default
  #9
New Member
 
Anne Severt
Join Date: May 2012
Posts: 4
Rep Power: 14
Anne Severt is on a distinguished road
Hey Kyle,

thanks for your answer. Is there a way to plot accurate patch values? How can I access the volScalarField to keep track of the values while time is running?

Could you explain, why the patch values aren´t accurate? Thus, why is ().internalField() used?

Thanks!

Last edited by Anne Severt; May 11, 2012 at 06:32.
Anne Severt is offline   Reply With Quote

Old   August 2, 2016, 06:04
Default
  #10
Member
 
AdOo
Join Date: Mar 2016
Location: Bordeaux
Posts: 91
Rep Power: 10
adrieno is on a distinguished road
Hi all,

I'm facing some problem of cfl and I would like to see the courant number on my mesh to know were comes my problem... I've seen that the code made by mister Mooney was able to do that, but I have two questions about how to implement it.

FIRST: do we just have to copy this code on a file called CourantNo.H ?

SECOND : were exactly do we have to put #include "CourantNo.H" in the XiFoam.C file ?
Let see on the code below, HERE n°1 or n°2 or n°3 ? or non of them ?

Code:
 
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
XiFoam
Description
Compressible premixed/partially-premixed combustion solver with turbulence
modelling.
Combusting RANS code using the b-Xi two-equation model.
Xi may be obtained by either the solution of the Xi transport
equation or from an algebraic exression. Both approaches are
based on Gulder's flame speed correlation which has been shown
to be appropriate by comparison with the results from the
spectral model.
Strain effects are encorporated directly into the Xi equation
but not in the algebraic approximation. Further work need to be
done on this issue, particularly regarding the enhanced removal rate
caused by flame compression. Analysis using results of the spectral
model will be required.
For cases involving very lean Propane flames or other flames which are
very strain-sensitive, a transport equation for the laminar flame
speed is present. This equation is derived using heuristic arguments
involving the strain time scale and the strain-rate at extinction.
the transport velocity is the same as that for the Xi equation.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hhuCombustionThermo.H"
#include "compressible/RASModel/RASModel.H"
#include "laminarFlameSpeed.H"
#include "ignition.H"
#include "Switch.H"
HERE n°1
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "readCombustionProperties.H"
# include "readEnvironmentalProperties.H"
# include "createFields.H"
# include "readPISOControls.H"
# include "initContinuityErrs.H"
# include "readTimeControls.H"
# include "compressibleCourantNo.H"
# include "setInitialDeltaT.H"
HERE n°2
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
# include "readTimeControls.H"
# include "readPISOControls.H"
# include "compressibleCourantNo.H"
# include "setDeltaT.H"
HERE n°3
 
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "rhoEqn.H"
# include "UEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
# include "ftEqn.H"
# include "bEqn.H"
# include "huEqn.H"
# include "hEqn.H"
if (!ign.ignited())
{
hu == h;
}
# include "pEqn.H"
}
turbulence->correct();
rho = thermo->rho();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return(0);
}
 
// ************************************************************************* //
Thank you and have a nice day,
Adrien ORSINI
adrieno 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
k-omega SST simulation of turbulent flow around a circular cylinder DanM OpenFOAM Running, Solving & CFD 17 October 13, 2016 14:29
benchmark: flow over a circular cylinder goodegg Main CFD Forum 12 January 22, 2013 12:47
Boundary condition setting regarding turbine simulation using CFX Lacerlacer CFX 11 March 12, 2012 10:32
modification for rotating cylinder simulation zonexo Main CFD Forum 3 July 21, 2006 15:24
Simulation of the Flow past a circular cylinder using STAR-CD M. S. GUEROUACHE Main CFD Forum 0 October 1, 1998 11:51


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