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

How to update density and viscosity on PimpleFoam?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 15, 2024, 21:23
Default How to update density and viscosity on PimpleFoam?
  #1
New Member
 
Join Date: Jan 2024
Posts: 2
Rep Power: 0
mohammad_majidi is on a distinguished road
If I want to define density/viscosity based on the relative composition of two solvents in the flow field, how can I add this line to the main solver so I can update the value of density/viscosity at the end of each iteration in OpenFOAM? For example, /rho = /rho_w (T1) + /rho_e(T2). I have already built the main body of my solver, but I need to add this functionality at the end of the solver as well, but I'm not sure how to do it.
Any help would be greatly appreciated.
mohammad_majidi is offline   Reply With Quote

Old   April 17, 2024, 12:24
Default
  #2
Member
 
Shravan
Join Date: Mar 2017
Posts: 60
Rep Power: 9
Severus is on a distinguished road
Hello,
You can take a look at twoLiquidMixingFoam solver.
For example the densities (also viscosities) of the two fluids are read. The mixture density is calculated based on the composition of the solvent. This mixture density then is used when solving in the pressure equation.

Solver
https://cpp.openfoam.org/v9/twoLiqui...8C_source.html

Tutorial
https://github.com/OpenFOAM/OpenFOAM...m/lockExchange

Thanks
Severus is offline   Reply With Quote

Old   April 17, 2024, 12:29
Default
  #3
New Member
 
Join Date: Jan 2024
Posts: 2
Rep Power: 0
mohammad_majidi is on a distinguished road
Thanks a lot for your reply. So, does this solver solve the convection-diffusion equation for two different scalars and then update density and viscosity with a linear relationship?Can this solver be used for turbulent flows? I'm dealing with high Reynolds numbers here.


Thanks a lot for your help.
mohammad_majidi is offline   Reply With Quote

Old   April 17, 2024, 12:44
Default
  #4
Member
 
Shravan
Join Date: Mar 2017
Posts: 60
Rep Power: 9
Severus is on a distinguished road
Hello,
Yes this solves the scalar transport equation of one scalar (lets say alpha1), the other will simply be alpha2= 1 - alpha1.

For example the mixture density is calculated in the following way
rho_mixture = alpha1*rho1 + alpha2*rho2

It can be used for turbulent flows (both RANS and LES modelling are possible).


You can check out this thesis, the solver is explained very well.
Jacobsen, K. Å. (2018). The dead water phenomenon. A computational fluid dynamics study (Master's thesis).
https://www.duo.uio.no/handle/10852/63453

Thanks
Severus is offline   Reply With Quote

Old   April 24, 2024, 00:51
Default
  #5
New Member
 
mo magd
Join Date: Apr 2024
Posts: 3
Rep Power: 2
mo___ is on a distinguished road
When I run the simulaiton using this foam you recommended, it only outputs U, p_rgh, and alpha. I don't know how I can add the contour f density or viscosity in paraview.
mo___ is offline   Reply With Quote

Old   April 24, 2024, 12:01
Default
  #6
Member
 
Shravan
Join Date: Mar 2017
Posts: 60
Rep Power: 9
Severus is on a distinguished road
Hello,
In Paraview, you can use the Calculator filter for this purpose.

Once you select the calculator filter, enter the formula in the box.
For density, for example let us say you call it density_effective as your Result array name.
The formula that you have to enter will be density_effective = alpha*rho_1 + (1-alpha)*rho_2. Where rho_1 and rho_2 are constants. Similar to what I also mentioned earlier in this thread.

Once you successfully implement this filter, you can see this density_effective field along with your other fields and you can now visualize it.

Thanks
Severus 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
Multiphase non-Newtonian viscosity of blood mdmtramper Fluent Multiphase 3 January 22, 2021 06:09
Density correction function for turbulent viscosity Bando STAR-CCM+ 1 July 9, 2017 02:44
PLEASE EXPLAIN: why reactingFoam is not outputting density and viscosity sahmed OpenFOAM Running, Solving & CFD 2 December 7, 2016 16:31
Variable density and viscosity ravibhadauria FLUENT 0 September 15, 2011 17:09
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23


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