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

Create a volScalarField from a dictionary variable

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2023, 12:30
Default Create a volScalarField from a dictionary variable
  #1
New Member
 
Jesus
Join Date: Sep 2021
Posts: 11
Rep Power: 5
jgs55 is on a distinguished road
Dear Foamers:

During the execution of my program, I create a dictionary with the same structure than p file, which means:

Code:
{
dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 101325;

boundaryField
{	
    upperwall
    {
        type            fixedFluxPressure;
        value           $internalField;
    }
	
    lowerwall
    {
        type            fixedFluxPressure;
        value           $internalField;
    }
	
    column
    {
        type            fixedFluxPressure;
        value           $internalField;
    }
	
    inlet
    {
        type            fixedFluxPressure;
        value           $internalField;
    }
	
    outlet
    {
        type            fixedValue;
        value           $internalField;
    }
	
    defaultFaces
    {
        type            empty;
    }
}
}
I need to create a volScalarField from this dictionary, but I do not know how. The only way to create a volScalarField I know is from a IOobject that reads the dictionary from a file, but I want to create it from a dictionary variable. Thanks in advance!
jgs55 is offline   Reply With Quote

Old   January 11, 2023, 01:53
Default
  #2
Member
 
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4
überschwupper is on a distinguished road
According to the doxygen you have either the option of IOobject or a copy construct.
https://cpp.openfoam.org/v10/classFo...tricField.html
überschwupper is offline   Reply With Quote

Old   January 13, 2023, 07:20
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Look for the "Construct from dictionary" in the header. Eg,
Code:
       //- Construct from dictionary
        GeometricField
        (
            const IOobject& io,
            const Mesh& mesh,
            const dictionary& dict
        );

Just make certain that your IOobject has the NO_READ option.
olesen is offline   Reply With Quote

Reply

Tags
dictionary, ioobject, volscalarfield


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
How to create initiate a volScalarField p without reading from disk NO_READ does not seem to work dbxmcf OpenFOAM Running, Solving & CFD 14 March 25, 2022 06:08
Error Illegal dictionary entry or environment variable name gotterstab OpenFOAM 0 February 4, 2022 09:41
Unhandled variable DPM-dist mahesh248f1 FLUENT 4 July 15, 2021 10:50
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
[blockMesh] Include list of points Hikachu OpenFOAM Meshing & Mesh Conversion 0 June 20, 2011 09:03


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