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

Accessing transportProperties from coded functionObject

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   April 19, 2021, 11:35
Default Accessing transportProperties from coded functionObject
  #1
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Hello to all,


I would like to create a custom functionObject to use in laplacianFoam.



For this purpose, I need the parameter DT in the dictionary transportProperties.


I have:


Code:
functions
{
    myCodedFunction
    {
        type coded;
        libs (utilityFunctionObjects);
        writeControl runTime;
        writeInterval $writeInterval;


        // Name of on-the-fly generated functionObject
        name test;
        
        codeWrite
        #{
            // Lookup for T
            const volScalarField& T = mesh().lookupObject<volScalarField>("T");

            // Gets the DT coefficient from 
          const dictionary& transportProperties = mesh().lookupObject<IOdictionary>
          (
             "transportProperties"
          );    

            const scalar alpha (transportProperties.getScalar("DT"));

            Info << "Alpha is: " << alpha << endl;

        #};
    }

}
However, I get the error:

Code:
    request for dictionary transportProperties from objectRegistry region0 failed
    available objects of type dictionary are
4(fvSchemes fvOptions fvSolution data)

It the transportProperties not created yet? Am I looking for it in a wrong manner?
Shibi is offline   Reply With Quote

 


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
accessing 0 time directory in coded functionObject JM27 OpenFOAM Programming & Development 3 May 26, 2023 16:50
Cannot find functionObject file residuals vava10 OpenFOAM Pre-Processing 2 November 14, 2020 12:21
accessing 0 time directory in coded functionObject JM27 OpenFOAM Post-Processing 0 November 21, 2018 08:41
Coded FunctionObject to calculate distance to axis? Nothing written be_inspired OpenFOAM Programming & Development 0 February 22, 2018 18:23
codeInclude in coded function in controlDict, and yPlus LuisAlberto OpenFOAM Programming & Development 4 August 18, 2015 12:48


All times are GMT -4. The time now is 01:39.