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

Reading in Custom Field for Multiple Blocks using blockMesh

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 2, 2018, 21:02
Default Reading in Custom Field for Multiple Blocks using blockMesh
  #1
New Member
 
Join Date: Jun 2018
Posts: 3
Rep Power: 7
AustinG is on a distinguished road
Hello,



I'm new here and I've looked through several forums and google searches with no luck on this issue, but feel free to redirect me if I have overlooked something. I am trying to read in a custom volScalarField, "R", using blockMesh. Should be pretty straight forward but I have a few blocks and I want a different value of "R" in one of the blocks. See the code snippets below.


blockMeshDict:


Code:
.
.
blocks
(
    hex ( . . . ) Region_0 ( . . . ) simpleGrading ( . . . )
    hex ( . . . ) Region_1 ( . . . ) simpleGrading ( . . . )
    .
    .
    .

    hex ( . . . ) Region_5 ( . . . ) simpleGrading ( . . . ) 
);
.
.
R:


Code:
.
.
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      R;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -2 0 0 0 0];

internalField
{
    Region_0
    {
        type            fixedValue;
        value           0;
    }

    Region_1
    {
        type            fixedValue;
        value           0;
    }
.
.
.
    Region_5
    {
        type            fixedValue;
        value           10E10;
    }
}
.
.
.
createFields.H:


Code:
.
.
Info <<"Reading field R\n" <<endl;
volScalarField R
(
    IOobject
    (
       IOobject::groupName("R",continuousPhaseName),
       runTime.timeName(),
       mesh,
       IOobject::MUST_READ,
       IOobject::AUTO_WRITE
    ),
    mesh
);
.
.
When I run blockMesh I get no error, but when I try to run my solver I get the following message:


Code:

Reading field R



--> FOAM FATAL IO ERROR: 
Attempt to return dictionary entry as a primitive

file: . . . /0/R.internalField from line 23 to line 54.

    From function virtual Foam::ITstream& Foam::dictionaryEntry::stream() const
    in file db/dictionary/dictionaryEntry/dictionaryEntry.C at line 83.

FOAM aborting

Any help is appreciated!
AustinG is offline   Reply With Quote

Old   July 3, 2018, 11:28
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
If you're only trying to set the values of R in one of your regions, why not try the setFields utility? The utility allows you to set the values of a field within a subsection of cells -- selected with boxToCell, for example. Here is a link to an example from one of the tutorials : https://github.com/OpenFOAM/OpenFOAM.../setFieldsDict.

Caelan
clapointe is offline   Reply With Quote

Old   July 5, 2018, 19:10
Default
  #3
New Member
 
Join Date: Jun 2018
Posts: 3
Rep Power: 7
AustinG is on a distinguished road
Hi Caelan,


That seems to do the trick for this case! Thanks for the help


Austin
AustinG is offline   Reply With Quote

Reply

Tags
blockmeshdict, createfields.h, volscalarfield

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
[Other] dynamicTopoFVMesh and pointDisplacement RandomUser OpenFOAM Meshing & Mesh Conversion 6 April 26, 2018 08:30
[Commercial meshers] Problem converting fluent mesh vinz OpenFOAM Meshing & Mesh Conversion 28 October 12, 2015 07:37
AMI memory leak? MichiB OpenFOAM Programming & Development 14 August 1, 2015 19:18
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51


All times are GMT -4. The time now is 21:34.