|
[Sponsors] |
How to write rho field for incompressible interFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 27, 2020, 13:23 |
How to write rho field for incompressible interFoam
|
#1 |
New Member
Prasad ADHAV
Join Date: Apr 2020
Location: Belval, Luxembourg
Posts: 10
Rep Power: 6 |
Hello Foamers,
This is my first time asking a question here, so please be patient with any mistakes. System: OpenFOAM 7 Ubuntu 18.04LTS Problem-Statement: I am trying to couple interFoam to a in-house DEM solver.(Using preCICE) When using pimpleFoam I could just hard set the values for density and viscocity. I need the rho and nu field for calculating the Bouyant force on particles. But currently just trying to solve the issue with rho. In interFoam we have two-phase, so different densities through the domain depending on where you see. I am using the incompressible interFoam solver. Changes I have the following changes in the createFields.H 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(); // Need to store rho for ddt(rho, U) volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT IOobject::AUTO_WRITE ), alpha1*rho1 + alpha2*rho2 ); rho.oldTime(); I get the following error when I compile the solver using wmake command. Code:
./createFields.H: In function ‘int main(int, char**)’: ./createFields.H:110:5: error: expected primary-expression before ‘(’ token ( ^ ./createFields.H:115:9: error: expected ‘)’ before ‘IOobject’ IOobject::AUTO_WRITE ^~~~~~~~ In file included from exInterFoam.C:60:0: createFields.H:110:5: error: expected primary-expression before ‘(’ token ( ^ createFields.H:115:9: error: expected ‘)’ before ‘IOobject’ IOobject::AUTO_WRITE ^~~~~~~~ Any tips, advice and help is welcome. Thank you. |
|
October 27, 2020, 14:33 |
|
#2 |
New Member
Wenyuan Fan
Join Date: Mar 2017
Posts: 27
Rep Power: 9 |
Hi,
It seems that a comma is missing before the newly added line. |
|
October 28, 2020, 02:53 |
|
#3 |
New Member
Prasad ADHAV
Join Date: Apr 2020
Location: Belval, Luxembourg
Posts: 10
Rep Power: 6 |
Thank you.
It works. |
|
October 28, 2020, 04:39 |
|
#4 |
New Member
Prasad ADHAV
Join Date: Apr 2020
Location: Belval, Luxembourg
Posts: 10
Rep Power: 6 |
In the above code in createFields.H, how can I add the nu field?
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(); // Getting viscocity volScalarField nu ( IOobject ( "nu", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), alpha1*nu1 + alpha2*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 28, 2020, 05:19 |
|
#5 |
New Member
Wenyuan Fan
Join Date: Mar 2017
Posts: 27
Rep Power: 9 |
nu1() and nu2() are not defined in incompressibleTwoPhaseMixture, which is the parent class of immiscibleIncompressibleTwoPhaseMixture.
You can call nu() directly, which returns a tmp<volScalarField>. |
|
October 28, 2020, 05:40 |
|
#6 |
New Member
Prasad ADHAV
Join Date: Apr 2020
Location: Belval, Luxembourg
Posts: 10
Rep Power: 6 |
Thank you. The solver is compiling.
I was also able to write out mu field in the similar way since it is present in incompressibleTwoPhaseMixture.H. Code:
//- Return the dynamic laminar viscosity tmp<volScalarField> mu() const; |
|
July 8, 2021, 01:15 |
|
#7 |
New Member
Abhishek Mukherjee
Join Date: Sep 2014
Posts: 6
Rep Power: 12 |
Hi, I want to use turbulence->nut() and turbulence->nu() in interFoam solver, but I am getting the error while compiling
Code:
error: ‘class Foam::incompressibleInterPhaseTransportModel<Foam::immiscibleIncompressibleTwoPhaseMixture>’ has no member named ‘nu’ error: ‘class Foam::incompressibleInterPhaseTransportModel<Foam::immiscibleIncompressibleTwoPhaseMixture>’ has no member named ‘nut’ If I use mixture->nu() I did not get any error, but how would I access nut? |
|
October 18, 2021, 13:53 |
|
#8 | |
Member
Venkat Ganesh
Join Date: May 2020
Location: Cincinnati, Ohio
Posts: 49
Rep Power: 6 |
Quote:
Did you have to do something in addition to what you have mentioned earlier? |
||
Tags |
createfields, interfoam, rho, write data |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mesh file for flow over a circular cylinder | Ardalan | Main CFD Forum | 7 | December 15, 2020 14:06 |
[swak4Foam] swakExpression not writing to log | alexfells | OpenFOAM Community Contributions | 3 | March 16, 2020 19:19 |
strange distribution of velocity field when using O-block mesh in interFoam | Zhanyuan Wang | OpenFOAM | 0 | December 18, 2019 22:41 |
pisoFoam with k-epsilon turb blows up - Some questions | Heroic | OpenFOAM Running, Solving & CFD | 26 | December 17, 2012 04:34 |
Phase locked average in run time | panara | OpenFOAM | 2 | February 20, 2008 15:37 |