|
[Sponsors] |
April 24, 2018, 15:17 |
Re: mu in interFoam ...SOLVED
|
#1 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 148
Rep Power: 9 |
I have worked on this for a few days. I need to output mu during an interFoam run so I can see mu field change as water wave shape changes. I wrote the following code and put it in createField.H. I expect that mixture.mu() calculate mu field at each output time. But I found (viewing using paraFoam) that mu field at each output time doesn't change and is the initial mu field where I set it using setFields. Any help is appreciated!
Code:
volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mixture.mu()*1.0 ); Last edited by Marpole; April 26, 2018 at 12:31. Reason: problem solved. |
|
April 25, 2018, 12:55 |
|
#2 |
Member
Mohammad Reza
Join Date: Sep 2015
Posts: 44
Rep Power: 10 |
Hi Marpole
Currently I am kind of struggling with this problem too, try this one: volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mixture.nu()*rho ); it will write "mu" field in every time step, but it doesn't change over time. BTW I want to use "mu" field to add a kinematicCloud to interfoam and I tried this: basicKinematicTypeCloud kinematicCloud ( kinematicCloudName, rho, U, mu, g ); it works, but I do not know where and how to update the "mu" field and it is important for computing Re number and Drag Coefficient that affects motion of particles.If you have found anything helpful, I will appreciate sharing it with me. Regards |
|
April 25, 2018, 14:13 |
Re: mu in interFoam
|
#3 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 148
Rep Power: 9 |
Hi Mohammad,
I will share the solution with if I come up one. So far, I want to give up using mixture.mu() but use something like Code:
volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), alpha1*rho1*nu1 + alpha2*rho2*nu2 ); Regards, |
|
April 26, 2018, 01:33 |
Re: mu in interFoam
|
#4 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 148
Rep Power: 9 |
Hello Mohammad,
I figured it out. In interFoam, you need add following line within the loop. Code:
mu = mixture.mu(); |
|
April 26, 2018, 03:33 |
|
#5 |
Member
Mohammad Reza
Join Date: Sep 2015
Posts: 44
Rep Power: 10 |
Hi Charles,
Thank you very much for sharing your findings. It worked for me too!! I put it right after pimple.loop() and before evolving the cloud. Best regards, Last edited by Bana; April 26, 2018 at 04:45. |
|
September 3, 2019, 03:32 |
|
#6 |
Member
Anna Feichtner
Join Date: Dec 2016
Location: Cornwall (UK)
Posts: 36
Rep Power: 9 |
Hi! I just want to add something as it took me a while to realize
To write/load mu into the objectRegistry without declaring it beforehand e.g. in the createFields.H file, one must not forget to declare it in the pimple.loop(): HTML Code:
volScalarField mu = mixture.mu(); |
|
October 28, 2020, 04:20 |
|
#7 |
New Member
Prasad ADHAV
Join Date: Apr 2020
Location: Belval, Luxembourg
Posts: 10
Rep Power: 6 |
Hello,
I am trying to add mu to interFoam as well. (OpenFOam v7) I have the followingI have used different color for things that I added Code:
Info<< "Reading transportProperties\n" << endl; immiscibleIncompressibleTwoPhaseMixture mixture(U, phi); volScalarField& alpha1(mixture.alpha1()); volScalarField& alpha2(mixture.alpha2()); const dimensionedScalar& rho1 = mixture.rho1(); const dimensionedScalar& rho2 = mixture.rho2(); const dimensionedScalar& nu1 = mixture.nu1(); const dimensionedScalar& nu2 = mixture.nu2(); volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), alpha1*rho1*nu1 + alpha2*rho2*nu2 ); Code:
./createFields.H:107:40: error: ‘class Foam::immiscibleIncompressibleTwoPhaseMixture’ has no member named ‘nu1’; did you mean ‘nu’? const dimensionedScalar& nu1 = mixture.nu1(); ^~~ nu ./createFields.H:108:40: error: ‘class Foam::immiscibleIncompressibleTwoPhaseMixture’ has no member named ‘nu2’; did you mean ‘nu’? const dimensionedScalar& nu2 = mixture.nu2(); ^~~ nu |
|
October 29, 2020, 12:22 |
|
#8 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 148
Rep Power: 9 |
It was a long time ago. Can you help me to explain what you need to do?
If you want just to output mu of the mixture, you can, as Anna F said, declare mu in the loop of interFoam. And in volSaclarField mu in createFields.H, add mixture.mu() to calculate mu for the mixture. I believe there is no nu1 and nu2 like rho1 and rho2.
__________________
Charles L. |
|
July 30, 2021, 12:31 |
|
#9 |
New Member
renos
Join Date: Dec 2019
Posts: 16
Rep Power: 6 |
I have the same problem. Please can you share the code here?
Kind regards, Renos |
|
July 30, 2021, 17:20 |
|
#10 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 148
Rep Power: 9 |
For openfoam-8, you can make two changes as described below.
1. Add a line (highlighted) for computing mu in file interFoam.C before runTime.write(). Code:
if (pimple.turbCorr()) { turbulence->correct(); } } // calculate variable mu mu = mixture.mu(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Code:
// Need to store rho for ddt(rho, U) volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT ), alpha1*rho1 + alpha2*rho2 ); rho.oldTime(); // declare mu volScalarField mu ( IOobject ( "mu", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mixture.mu() );
__________________
Charles L. |
|
July 31, 2021, 05:01 |
|
#11 |
New Member
renos
Join Date: Dec 2019
Posts: 16
Rep Power: 6 |
Dear Charles,
Thank you very much for your valuable help and quick response. Now, the solver is compiled without errors! Kind regards, Renos |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding diffusion term to interFoam transport equation | Gearb0x | OpenFOAM Programming & Development | 3 | February 14, 2023 04:16 |
interFoam vs. simpleFoam channel flow comparison | DanM | OpenFOAM Running, Solving & CFD | 12 | January 31, 2020 15:26 |
interFoam (HELYX-OS) pressure boundary conditions | SFr | OpenFOAM Running, Solving & CFD | 8 | June 23, 2016 16:36 |
k-e & GAMG interFoam Schemitisation Stability Issue | JFM | OpenFOAM Running, Solving & CFD | 3 | December 1, 2015 05:58 |
Problem of InterFoam with LES SpalartAllmarasIDDES | keepfit | OpenFOAM | 3 | August 29, 2013 11:21 |