# Accessing information about Volume Fraction of Phases

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 30, 2014, 07:40 Accessing information about Volume Fraction of Phases #1 Senior Member   Paritosh Vasava Join Date: Oct 2012 Location: Lappeenranta, Finland Posts: 592 Rep Power: 13 I want to write a new viscosity model where viscosity is also a function of volume fraction of one of the phases in a multiphase flow. I have played a bit with CrossPowerLaw. I made some minor modifications and everything was nice. I understood that this piece of code does is the main equation for the viscosity model. Code: ```Foam::tmp Foam::viscosityModels::NewCrossPowerLaw::calcNu() const { return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_; }``` My question is how do I add information about volume fraction of certain phase into this code?? For example I want to multiply the final viscosity with volume fraction of one of the phases. My C++ skills are way too basic so you would also have to explain about changes in the header file. Thanks!! PS: I would use this with twoPhaseEulerFoam or multiphaseEulerFoam. I have openfoam 2.3.0

April 30, 2014, 12:06
#2
Member

Andrew Somorjai
Join Date: May 2013
Posts: 77
Rep Power: 5
Quote:
 Originally Posted by vasava I want to write a new viscosity model where viscosity is also a function of volume fraction of one of the phases in a multiphase flow. I have played a bit with CrossPowerLaw. I made some minor modifications and everything was nice. I understood that this piece of code does is the main equation for the viscosity model. Code: ```Foam::tmp Foam::viscosityModels::NewCrossPowerLaw::calcNu() const { return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_; }``` My question is how do I add information about volume fraction of certain phase into this code?? For example I want to multiply the final viscosity with volume fraction of one of the phases. My C++ skills are way too basic so you would also have to explain about changes in the header file. Thanks!! PS: I would use this with twoPhaseEulerFoam or multiphaseEulerFoam. I have openfoam 2.3.0
In the code which variable is the final viscosity?

Code:
```Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::NewCrossPowerLaw::calcNu() const
{
return (nu0_ - nuInf_)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_;
}```
I'm assuming it's

nuInf_

so you would create it (volume fraction)

double vol_frac = function_for_calculation_of_vol_frac();

and then plug it into the code

Code:
```Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::NewCrossPowerLaw::calcNu() const
{
double vol_frac = function_for_calculation_of_vol_frac();

return (nu0_ - nuInf_*vol_frac)/(scalar(1) + pow(m_*strainRate(), n_)) + nuInf_*vol_frac;
}```
I'm not sure what the type for nuInf_ is. What file is this in by the way?

For the header file you would need to add the function for

function_for_calculation_of_vol_frac()

if not then you would need to include the volume fraction calculation within the function Foam::viscosityModels::NewCrossPowerLaw::calcNu() and there's no need to change any header file.

Last edited by massive_turbulence; May 1, 2014 at 15:24.

 May 2, 2014, 01:17 #3 Senior Member   Paritosh Vasava Join Date: Oct 2012 Location: Lappeenranta, Finland Posts: 592 Rep Power: 13 Thanks for your response. This code as I mentioned is from CrossPowerLaw. I have included this code just for illustration. Right now I do not know how to include the information about the volume fraction of a phase.

May 2, 2014, 11:45
#4
Member

Andrew Somorjai
Join Date: May 2013
Posts: 77
Rep Power: 5
Quote:
 Originally Posted by vasava Thanks for your response. This code as I mentioned is from CrossPowerLaw. I have included this code just for illustration. Right now I do not know how to include the information about the volume fraction of a phase.
How is the 'volume fraction of the phase' calculated though, surely there's a simple formula (I think I remember something about this from thermo)? You might be able to read data from a dat file using fstream although if time dependence is necessary or some other variable changes then the function call would get more difficult to implement.

Last edited by massive_turbulence; May 2, 2014 at 16:31.

 Tags openfoam, viscosity models

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post multiphase-flow FLUENT 4 August 7, 2014 10:35 Wokl OpenFOAM Running, Solving & CFD 4 January 9, 2014 03:52 flow_CH FLUENT 9 December 16, 2013 13:29 achuneka FLUENT 8 September 4, 2009 06:22 gopala OpenFOAM Running, Solving & CFD 0 April 27, 2009 10:46

All times are GMT -4. The time now is 11:22.