CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   writing out a volScalarField (https://www.cfd-online.com/Forums/openfoam-programming-development/118402-writing-out-volscalarfield.html)

Natalie2210 May 27, 2013 06:42

writing out a volScalarField
 
Hi!

I would like another variable to be written to the output, namely, I'm using the porousInterFoam solver and I would like to write mu every writeInterval.

I tried it with

Code:

mu.write()
but this writes mu every timestep and I only want it at the specified writeIntervals. So I set up a corresponding field in the createFields.H:

Code:


volScalarField mu
(
    IOobject
    (
      "mu",
      runTime.timeName(),
      mesh,
      IOobject::READ_IF_PRESENT,
      IOobject::AUTO_WRITE
    ),
    twoPhaseProperties.mu(),
    alpha1.boundaryField().types()
 );

in the solver mu is then set by

Code:

mu = twoPhaseProperties.mu()
The code compiles, however, after one timestep I get the following error message:

Quote:

--> FOAM FATAL ERROR:
request for volScalarField mu from objectRegistry region0 failed
available objects of type volScalarField are
11
(
K
rho
p_rgh
alpha1_0
nu
gh
nu1
p
rho_0
nu2
alpha1
)

From function objectRegistry::lookupObject<Type>(const word&) const
in file /home/openfoam/TryoutOF/openfoam211/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 131.
FOAM aborting
Does anyone know what's the problem here?

Thank you,
Natalie

Tushar@cfd May 27, 2013 06:59

Quote:

Originally Posted by Natalie2210 (Post 430232)
Hi!

I would like another variable to be written to the output, namely, I'm using the porousInterFoam solver and I would like to write mu every writeInterval.

I tried it with

Code:

mu.write()
but this writes mu every timestep and I only want it at the specified writeIntervals. So I set up a corresponding field in the createFields.H:

Code:


volScalarField mu
(
    IOobject
    (
      "mu",
      runTime.timeName(),
      mesh,
      IOobject::READ_IF_PRESENT,
      IOobject::AUTO_WRITE
    ),
    twoPhaseProperties.mu(),
    alpha1.boundaryField().types()
 );

in the solver mu is then set by

Code:

mu = twoPhaseProperties.mu()
The code compiles, however, after one timestep I get the following error message:



Does anyone know what's the problem here?

Thank you,
Natalie


Why don't you write out nu?, if you look at the error then nu (volScalarField) seems to be available with respect to your code.

Natalie2210 May 27, 2013 08:05

Hi!

I want to write mu since mu is somehow interpolated due to the twoPhases and I want to have a look at that.. nu is an input parameter and should be constant over the entire domain.

greetings,
Natalie

Tushar@cfd May 27, 2013 08:26

Quote:

Originally Posted by Natalie2210 (Post 430256)
Hi!

I want to write mu since mu is somehow interpolated due to the twoPhases and I want to have a look at that.. nu is an input parameter and should be constant over the entire domain.

greetings,
Natalie

Ok, now I understood.. Thanks for explaining..

create a file named "mu" in your case folder inside a 0 folder & set all BC as 0 value.

aditya95 August 16, 2018 13:33

Quote:

Originally Posted by Natalie2210 (Post 430256)
Hi!

I want to write mu since mu is somehow interpolated due to the twoPhases and I want to have a look at that.. nu is an input parameter and should be constant over the entire domain.

greetings,
Natalie

I am facing a similar problem, did you find a way to solve it?
if yes, could you please let me know how?


All times are GMT -4. The time now is 02:41.