|
[Sponsors] |
September 5, 2019, 09:19 |
How to retrieve nu1 and nu2
|
#1 | |
New Member
Elisabeth Diehl
Join Date: Jun 2019
Posts: 8
Rep Power: 6 |
Hi everybody,
I need to retrieve nu1 and nu2 for the calculation of mu1 and mu2 (adapting interFoam). I added the following code into the createFields.H file, to the section "Reading transport properties". Code:
const viscosityModel& nu1 = mixture.nuModel1(); const viscosityModel& nu2 = mixture.nuModel2(); dimensionedScalar mu1 = nu1 * rho1; dimensionedScalar mu2 = nu2 * rho2; Quote:
|
||
September 12, 2019, 10:54 |
|
#2 |
Senior Member
Andrea
Join Date: Feb 2012
Location: Leeds, UK
Posts: 179
Rep Power: 16 |
Hi Elisabeth,
the nuModel1() method does not return a scalar, but a reference to a viscosityModel. The compiler is telling you that you cannot multiply two variables of different type. nu1 is a constant reference to a Foam::viscosityModel object, whilst rho1 is referring to a const Foam::zeroField. Easiest way I can think of to access the values of the kinematic viscosity of your phases is to read them directly from the transportProperties file, something like: dimensionedScalar nu1 ("nu", dimensionSet(0, 2, -1, 0, 0), 0); ( nu1 = transportProperties.subDict("fluid1").lookup("nu") ); where "fluid1" is the name of the first phase. You can probably avoid to manually insert the name by replacing "fluid1" with something like mixture.phase1Name(). Did not test it, but it should work. Andrea Andrea |
|
September 12, 2019, 15:24 |
|
#3 |
New Member
Elisabeth Diehl
Join Date: Jun 2019
Posts: 8
Rep Power: 6 |
Hi Andrea,
thank you very much for your helpful answer! It worked for me when I additionally insert the following to declare transportProperties: Code:
IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); |
|
September 13, 2019, 03:35 |
|
#4 |
Senior Member
Andrea
Join Date: Feb 2012
Location: Leeds, UK
Posts: 179
Rep Power: 16 |
Yes, I assumed you had already instantiated your transport properties dictionary.
Glad to know it worked Andrea |
|
|
|