CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   quick way to change from incompressible to compressible? (https://www.cfd-online.com/Forums/openfoam-solving/99346-quick-way-change-incompressible-compressible.html)

mihaipruna April 1, 2012 14:56

quick way to change from incompressible to compressible?
 
assuming I am all set up for incompressible flow using simpleFOAM, what do I need to change to perform compressible analysis on the same geometry with minimal fuss?
which tutorial should I look at?
thanks!

mihaipruna April 1, 2012 19:29

I should state that I'm looking mainly at external flows right now with Aerospace applications.

swahono April 1, 2012 21:35

1 Attachment(s)
Hi Mihai,

You can use rhoSimpleFoam for the steady compressible solver, or rhoPimpleFoam for the unsteady counterpart.

I assume your question was "how to restart your incompressible simulation using a compressible solver"?

The problem with the above scenario is the different dimension of the phi between the incompressible and compressible cases.
The incompressible solver uses a volumetric form of phi (normalised by rho), while the compressible solver uses the mass flux form for phi.

What you can do is convert your incompressible phi (volumetric flux) to the compressible phi (mass flux) using the attached utility.
The utility will writes out two new fields into your time directories, i.e. rhophi and rhop.
You can then clone your case into a new case, and rename the rhophi to phi, and rhop to p.
If you are using turbulence model, then you need to extend the attached utility to also convert the nu to mu. The method is exactly the same as the p conversion.

You need to create your own Make/files and Make/options.

Code:

$ cat Make/files
 
convertPhi.C
EXE = $(FOAM_USER_APPBIN)/convertPhi

Code:

$ cat Make/options
 
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
 
EXE_LIBS = \
-lfiniteVolume


Good Luck,

Stefano

mihaipruna April 4, 2012 12:56

thanks. I think I'll start from scratch instead.
is sonicFoam a good solver for external compressible flows?
Assuming I followed the motorcycle tutorial to set up an imcompressible flow case of my own, can I reuse the mesh dicts for SHM and BM, and, from the NACA Airfoil tutorial, adapt the controldict,fvsolution and fvscheme, add the new variables in the time 0 folder with the files alphat etc, and the RAS, thermo and turb files from the constant folder?

swahono April 4, 2012 21:31

> is sonicFoam a good solver for external compressible flows?

Depends. If you want low subsonic then NO.
If you need steady solver, then NO.
If you need to solve high Mach (transonic to supersonic) and unsteady, then YES.
If you need steady compressible solver (from low subsonic to transonic) then use rhoSimpleFoam.
If you need unsteady solver (from low subsonic to transonic), use rhoPimpleFoam.
***remember to enable/disable the transonic setting in rhoSimpleFoam and rhoPimpleFoam.

> Assuming I followed the motorcycle tutorial to set up an imcompressible
> flow case of my own, can I reuse the mesh dicts for SHM and BM, and,
> from the NACA Airfoil tutorial, adapt the controldict,fvsolution and
> fvscheme, add the new variables in the time 0 folder with the files alphat
> etc, and the RAS, thermo and turb files from the constant folder?

What is SHM and BM?
You can transfer mesh between cases by just copying the constant/polyMesh directory.

Yes, you can adapt the controlDict, fvSolution and fvSchemes files from the tutorials.
The settings in the tutorials (i.e. fvSchemes and fvSolution) are NOT optimal for complex flow and bad mesh.

You need BCs in 0:
U, p, T, mut, alphat, k, epsilon, or omega.
Solver will calculate and write phi during runtime.

You can copy RASModel, turbulenceModel and thermophysicalPorperties from the tutorial.
Change them to suit what you are trying to model.

Best regards,
Stefano

mihaipruna April 4, 2012 21:38

thanks Stefano. i think i will use rhoSimpleFoam.
SHM is snappyhexmesh and BM is blockmesh :)

cleoo October 6, 2016 03:54

Quote:

Originally Posted by swahono (Post 353208)

Yes, you can adapt the controlDict, fvSolution and fvSchemes files from the tutorials.

You need BCs in 0:
U, p, T, mut, alphat, k, epsilon, or omega.
Solver will calculate and write phi during runtime.

You can copy RASModel, turbulenceModel and thermophysicalPorperties from the tutorial.
Change them to suit what you are trying to model.

this is what I did with the same turbulence model but it didn't seem to work, I am using the solver rhoCentralFoam now

neilk September 7, 2018 16:20

Hello,

I am using the reactingParcelFilmFoam for a simulation. Is there a way to turn off the compressibility so that I can use it for an incompressible flow? The reason being the p_rgh goes negative and the simulation crashes but the other variables are fine.

Thank you

hbulus January 20, 2020 03:29

Where should i define rhoRef?

Quote:

Originally Posted by swahono (Post 352590)
Hi Mihai,

You can use rhoSimpleFoam for the steady compressible solver, or rhoPimpleFoam for the unsteady counterpart.

I assume your question was "how to restart your incompressible simulation using a compressible solver"?

The problem with the above scenario is the different dimension of the phi between the incompressible and compressible cases.
The incompressible solver uses a volumetric form of phi (normalised by rho), while the compressible solver uses the mass flux form for phi.

What you can do is convert your incompressible phi (volumetric flux) to the compressible phi (mass flux) using the attached utility.
The utility will writes out two new fields into your time directories, i.e. rhophi and rhop.
You can then clone your case into a new case, and rename the rhophi to phi, and rhop to p.
If you are using turbulence model, then you need to extend the attached utility to also convert the nu to mu. The method is exactly the same as the p conversion.

You need to create your own Make/files and Make/options.

Code:

$ cat Make/files
 
convertPhi.C
EXE = $(FOAM_USER_APPBIN)/convertPhi

Code:

$ cat Make/options
 
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
 
EXE_LIBS = \
-lfiniteVolume


Good Luck,

Stefano

Hello Stefano,

Aurelius October 29, 2021 14:54

Hi hbulus,

did you find out where to define "rhoRef"?

Thanks.


All times are GMT -4. The time now is 14:44.