CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Solver looking for Foam::NO_READ fields ...

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 22, 2020, 11:06
Default Solver looking for Foam::NO_READ fields ...
  #1
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 348
Rep Power: 10
Gerry Kan is on a distinguished road
Howdy Foamers:

I have something which I can't quite understand. Perhaps you could spot what the problem could be.

In my solver implemention, I have two variables set to IOobject::NO_READ in source file createFields.H:

Code:
volScalarField rho  (
    IOobject  (
        "rho",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    thermo.rho()
);

volVectorField rhoG  (
    IOobject  (
        "rhoG",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    mesh
);
The code compiled without warnings (aside from a few unused variables which I expected to see). When the solver started, it complained about rhoG not being defined in the 0/ folder, while it not have any problems with rho at all.

In the end, I just wanted to have the field "rhoG" as temporary storage, as it will be used in a number of equations and I only wanted to calculate it once per outer iteration. I could define calculated boundary conditions in the 0 folder for rhoG, but ultimately I would like to hide that from the end user. How would I go about doing that?

Thanks in advance, Gerry.
Gerry Kan is offline   Reply With Quote

Old   April 23, 2020, 08:09
Default
  #2
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 348
Rep Power: 10
Gerry Kan is on a distinguished road
I realized what happened. In the above example, rho is constructed from an existing volScalarField thermo.rho(), so the solver did not need to look for values.

So in my case, the constructor for rhoG was modified to this:

Code:
volVectorField rhoG  (
    IOobject  (
        "rhoG",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    thermo.rho() * grav
);
where gravity was already defined prior as:

Code:
dimensionedVector grav     (
    "grav",
    dimensionSet(0,1,-2,0,0,0,0),
    ( 0 0 -9.81 ) );
With these changes, the code compiled and ran without problems.
Gerry Kan is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] Help with element size sandri_92 ANSYS Meshing & Geometry 14 November 14, 2018 07:54
Incompatible fields for operation divphi Ub vvqf OpenFOAM Running, Solving & CFD 4 April 4, 2018 03:28
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 11:34
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 14:08
How to access solver fields from fvPatchField%2360Type derived class that defines BC kar OpenFOAM Running, Solving & CFD 0 February 29, 2008 12:41


All times are GMT -4. The time now is 07:42.