CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Artificial compressibility in open foam (http://www.cfd-online.com/Forums/openfoam/82163-artificial-compressibility-open-foam.html)

 doubtsincfd November 18, 2010 17:00

Artificial compressibility in open foam

Is there Artificial Compressibility solver in openfoam first introduced by Chorin?

 nakul November 19, 2010 02:27

Hi

The description of the available solvers can be found in User'd Guide and in the source code locate in "\$/applications/solvers/".

You may find suitable solver four your specific problem.

If you just elaborate exactly what you want to do then it would be easier to suggest some perticular solver.

 boger November 19, 2010 09:06

Artificial compressibility is a method used in time-marching algorithms to solve for incompressible flows. All of the solvers in OpenFOAM so far have been pressure-based solvers, so artificial compressibility is not used.

 smehdi609 November 19, 2010 15:08

It's not hard to implement the artificial compressibility method. I wrote one long time ago, just as a CFD fun !
It's not in a coupled way though !
The time loop looks like this:

do
{
runTime++;
counter++;
Info<< "Time = " << runTime.timeName() << nl << endl;

fvScalarMatrix pEqn
(
fvm::ddt(p)
+ (1/beta)*fvc::div(phi)

);
pEqn.setReference(pRefCell, pRefValue);
volScalarField p_old = p;
pEqn.solve();
p_residual = max(mag(p_old - p)).value();

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

volVectorField U_old = U;
solve(UEqn == -fvc::grad(p));
u_residual = max(mag(U_old - U)).value();
Info << "Residual in U: " << u_residual << " Residual in P: "
<< p_residual << endl;

max_residual = max(u_residual, p_residual);
//solve(UEqn == -fvc::grad(p));
phi = linearInterpolate(U) & mesh.Sf();

}while (max_residual > epsilon);

 doubtsincfd November 28, 2010 03:35

Thank you all!

 nsreddysrsit December 20, 2010 00:19

to edit SIMPLE solver

Quote:
 Originally Posted by boger (Post 284095) Artificial compressibility is a method used in time-marching algorithms to solve for incompressible flows. All of the solvers in OpenFOAM so far have been pressure-based solvers, so artificial compressibility is not used.
Dear David A. Boger,
Is it possible to write a code for the artificial compressibility method or manipulating the given solvers (like SIMPLE) in OpenFOAM.

With Regargs
N.S. Reddy,
DS college of Engg,
Bangalore

 boger December 20, 2010 08:47

I'm sure it's possible, but it's not clear to me what you're trying to achieve. My interpretation of the artificial compressibility method is that it is a method to extend an efficient compressible solver to incompressible flows through pre-conditioning. If you simply want to solve for incompressible flow, you already have solvers here to choose from. If you simply want to add an artificial compressibility term to simpleFoam, you can read how to do that in one of the posts above, although I'm not sure what exactly it buys you. If you're determined to write an artificial compressibility code and want it to be block coupled, then I would look at the new block coupling methods that were released in the 1.6-extend version.

 nsreddysrsit December 21, 2010 00:52

Artificial Compressibility method

Quote:
 Originally Posted by boger (Post 287868) I'm sure it's possible, but it's not clear to me what you're trying to achieve. My interpretation of the artificial compressibility method is that it is a method to extend an efficient compressible solver to incompressible flows through pre-conditioning. If you simply want to solve for incompressible flow, you already have solvers here to choose from. If you simply want to add an artificial compressibility term to simpleFoam, you can read how to do that in one of the posts above, although I'm not sure what exactly it buys you. If you're determined to write an artificial compressibility code and want it to be block coupled, then I would look at the new block coupling methods that were released in the 1.6-extend version.
Dear David A. Boger,
Thanks a lot for your kind information, actually I am trying to use compressible solvers ( like Roe Scheme and Riemann solver based schemes ) for solving incompressible flows. My Problem is how to write a code for the above problem in OpenFOAM. can u please send me a format of the code. My email id is "nsreddysrsit@gmail.com". Once again thanks.

With Regards
N.S. Reddy,
DS college of Engg,
Bangalore

 nsreddysrsit February 23, 2011 01:21

dear M. Mahdi Salehi,
the above code is applicable for which solver for example, for icoFoam or SimpleFoam.

 smehdi609 February 23, 2011 02:41

It's a stand-alone solver.

 nsreddysrsit February 23, 2011 20:32

what is the difference between time preconditioning in openfoam and the artificial co

thank you Mr. M. Mahdi Salehi, I understood, my doubt is, is it possible to modify icoFoam, simpleFoam or rhoCentralFoam to Artificial Compressibility Method.
and one More question what is the difference between time preconditioning in openfoam and the artificial compressibility method.

Regards
N.S.Reddy

 smehdi609 February 24, 2011 14:29

Hi,
Yes, you can modify them to get the artificial compressibility method. However, your new solver is just the artificial compressibility solver. I do not think you can easily make this to be an "all-speed" method so that you can run both the compressible and incompressible flows with the same solver. (I am not quit sure though)

About your second question, basically both the artificial compressibility method and preconditioning methods remove the stiffness of the system of equations in low-Mach number regimes caused by the spread in wave speed. In the artificial compressibility method you tweak your governing equations to remove the stiffness. In the preconditioning method the stiffness is removed mathematically by multiplying the equations by a matrix.
Cheers
Mahdi

 nsreddysrsit February 24, 2011 20:58

Hi,
thank you for your reply, You are exactly correct, one more issue if I want to implement convection schemes like Lax-Friedrich Method or Roe scheme, is there any suitable scheme to edit or I should write a new code.

 venkataramana September 5, 2011 20:50

Acm

hi,
anybody working on artificial Compressibility method in openFoam, any comments on this method are welcome, if anybody working on this please provide the information about it.

thanks in advance,
Best Regards,

 gdmcbain September 5, 2011 22:34

I've been thinking about writing an artificial compressibility solver for OpenFOAM, partly because I noticed that all the existing viscous incompressible solvers (that I'm aware of) ignore the viscous term in the boundary condition for the pressure Poisson equation at solid walls. Actually that boundary condition is not strictly the job of the solver, but in the case files, a zero Neumann condition is applied, and I'm not too sure how one would go about specifying the correct viscous condition there, since they involve the velocity's second derivative (Peyret & Taylor 1983, eqs. 6.2.29, 6.3.8a; Anderson, Tannehill, & Pletcher 1984, eq. 9-171, p. 514). The point is that with artificial compressibility or similar, e.g. the "conjugate gradient" algorithms introduced to finite element methods by Glowinski & Pironneau (1979), one doesn't formulate a Poisson equation for pressure and so doesn't need to formulate boundary conditions for it.

It's often argued that the viscous term is negligible because it's of order of 1/Re; this is true: it's proportional to the viscosity, but if the Reynolds number is small, that's not a good argument.
• Anderson, D. A., J. C. Tannehill, & R. H. Pletcher (1984). Computational Fluid Mechanics and Heat Transfer. Series in Computational Methods in Mechanics and Thermal Sciences. Washington: Hemisphere
• Glowinski, R., & O. Pironneau (1979). On numerical methods for the Stokes problem. In R. Glowinksi, E. Y. Rodin, & O. C. Zienkiewicz (Eds.), Energy Methods in Finite Element Analysis, Numerical Methods in Engineering, pp. 243-264. Chichester:John Wiley & Sons
• Peyret, R., & T. D. Taylor (1983). Computational Methods for Fluid Flow. Springer Series in Computational Physics. New York: Springer

 venkataramana September 6, 2011 02:01

Acm

Dear G. D. McBain, thank you for the information given,

I would like to create a new solver using Artificial Compressibility Method in openFoam, How to Start writing a code,any suggestions, comments are welcome. I wanted to use compressible solver Schemes for incompressible flows using Artificial Compressibility Method.

Thanks in advance,

 gdmcbain September 6, 2011 02:33

Dear venkataramana:

Doesn't the code posted by smehdi609 work? It looks right.

As to `how to start writing a code', I suggest reading http://openfoam.com/docs/user/compil...plications.php and then inspecting and tinkering with some of the simpler solvers provided, e.g. potentialFoam.C.

For the background on the method, try Chorin's original paper, or the book by Peyet & Taylor that I cited before. The basic idea is to locally decrease the pressure wherever the velocity is divergent (this is what smehdi609's pEqn does), and to keep iterating on that until the velocity isn't divergent anywhere. The smehdi609 code tests for the pressures no longer changing rather than testing divergence directly, but given the directness of the pressure update in the artificial compressibility method, it amounts to much the same thing.

Best of luck.

 venkataramana September 6, 2011 05:13

hi

Dear G. D. McBain,

Thank you very much for your valuable suggestions, I will try it

Regards,

 nsreddysrsit January 7, 2012 14:02

dear foamers,
anybody can help me where the code is available for the the following method.
http://openfoamwiki.net/index.php/TestLucaG

Regards,

 gdeneyer April 2, 2012 10:17

hello,

I would like to improve the code of M. Mahdi Salehi for unsteady problems, which is possible by using a certain amount of pseudo-timesteps at each "real timestep" of the case.

My problem is that I don't know how I could modelize a time derivative for these pseudo time-steps in OpenFoam.

Any idea ?

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