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

quick way to change from incompressible to compressible?

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 3 Post By swahono
  • 1 Post By swahono

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2012, 14:56
Default quick way to change from incompressible to compressible?
  #1
Senior Member
 
Mihai Pruna
Join Date: Apr 2010
Location: Boston
Posts: 195
Rep Power: 16
mihaipruna is on a distinguished road
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!
__________________
Mihai Pruna's Bio
mihaipruna is offline   Reply With Quote

Old   April 1, 2012, 19:29
Default
  #2
Senior Member
 
Mihai Pruna
Join Date: Apr 2010
Location: Boston
Posts: 195
Rep Power: 16
mihaipruna is on a distinguished road
I should state that I'm looking mainly at external flows right now with Aerospace applications.
__________________
Mihai Pruna's Bio
mihaipruna is offline   Reply With Quote

Old   April 1, 2012, 21:35
Default
  #3
Member
 
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 15
swahono is on a distinguished road
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
Attached Files
File Type: c convertPhi.C (4.2 KB, 219 views)
namsivag, jeanbvb and rilteber like this.
__________________
Stefano Wahono

Defence Science and Technology Organisation
Propulsion Systems
swahono is offline   Reply With Quote

Old   April 4, 2012, 12:56
Default
  #4
Senior Member
 
Mihai Pruna
Join Date: Apr 2010
Location: Boston
Posts: 195
Rep Power: 16
mihaipruna is on a distinguished road
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?
__________________
Mihai Pruna's Bio
mihaipruna is offline   Reply With Quote

Old   April 4, 2012, 21:31
Default
  #5
Member
 
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 15
swahono is on a distinguished road
> 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
gabrielfelix likes this.
__________________
Stefano Wahono

Defence Science and Technology Organisation
Propulsion Systems
swahono is offline   Reply With Quote

Old   April 4, 2012, 21:38
Default
  #6
Senior Member
 
Mihai Pruna
Join Date: Apr 2010
Location: Boston
Posts: 195
Rep Power: 16
mihaipruna is on a distinguished road
thanks Stefano. i think i will use rhoSimpleFoam.
SHM is snappyhexmesh and BM is blockmesh
__________________
Mihai Pruna's Bio
mihaipruna is offline   Reply With Quote

Old   October 6, 2016, 03:54
Default
  #7
Member
 
annn
Join Date: Jun 2016
Posts: 40
Rep Power: 9
cleoo is on a distinguished road
Quote:
Originally Posted by swahono View Post

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
cleoo is offline   Reply With Quote

Old   September 7, 2018, 16:20
Default
  #8
New Member
 
Nilay Kulkarni
Join Date: May 2018
Posts: 24
Rep Power: 7
neilk is on a distinguished road
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
neilk is offline   Reply With Quote

Old   January 20, 2020, 03:29
Default
  #9
Member
 
Join Date: Dec 2018
Posts: 75
Rep Power: 7
hbulus is on a distinguished road
Where should i define rhoRef?

Quote:
Originally Posted by swahono View Post
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,
hbulus is offline   Reply With Quote

Old   October 29, 2021, 14:54
Default
  #10
New Member
 
Ventós
Join Date: Dec 2017
Posts: 7
Rep Power: 8
Aurelius is on a distinguished road
Hi hbulus,

did you find out where to define "rhoRef"?

Thanks.
Aurelius 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
Incompressible Compressible coupling... dog5011 Main CFD Forum 4 June 19, 2009 03:50
Using compressible BCs for incompressible problems cfd Main CFD Forum 1 April 16, 2006 02:41
Compressible or Incompressible? Samy CFX 5 November 18, 2004 12:16
Compressible vs. Incompressible formulations Fernando Velasco Hurtado Main CFD Forum 3 January 7, 2000 16:51
Compressible vs. incompressible NS at high Temperatures Jean Lacroix Main CFD Forum 1 December 24, 1999 06:21


All times are GMT -4. The time now is 05:53.