CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Coded function object in openfoam v5

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 4 Post By bjnieuwboer

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 30, 2018, 10:48
Question Coded function object in openfoam v5
  #1
New Member
 
Fantastic Boy
Join Date: Oct 2017
Posts: 11
Rep Power: 8
kit607 is on a distinguished road
Greetings,

Recently I upgraded my OpenFOAM 2.1.1 to 5.0. Basically the simulation run smoothly until I insert coded function object into controlDict. The simulation detected the code and the dynamicCode folder is created but in the log file, there is no data generate from the coded function object. I installed swak4foam-dev and compiled correctly. I'm using funkySetFields to generate initial condition for fluid.

I tried the method post #12 Create registered object at runtime using a functionObject, unfortunately I got the error of 'functions' entry is not a dictionary.

Is the openfoam v5 still support coded function object in 2.1.1? Or the v5 is using new script?

Thank You
kit607 is offline   Reply With Quote

Old   January 30, 2018, 11:10
Default *Update
  #2
New Member
 
Fantastic Boy
Join Date: Oct 2017
Posts: 11
Rep Power: 8
kit607 is on a distinguished road
Eventually wrong symbol was used, and the previous error is gone. But Currently lead to another warning which is No critical "code" prefixed keywords were found. Please check the code documentation for more details.

The things is I double check the code, and it is working in OF 2.1.1. I have no clue at all, anyone please help.

Thank You
kit607 is offline   Reply With Quote

Old   April 30, 2018, 12:04
Default code keyword has been updated in version 4.x
  #3
Member
 
Bas Nieuwboer
Join Date: Mar 2013
Posts: 32
Rep Power: 13
bjnieuwboer is on a distinguished road
Hi,

I encountered the same error and came across this bugreport about it. It mentions that you should use the keyword "codeExecute" instead of "code". So a minimal working example would be:

Code:
functions
{
    printMinU
    {
        functionObjectLibs ( "libutilityFunctionObjects.so" );
        enabled         true;
        type            coded;
        redirectType    printMinU;
        writeControl   timeStep;
        writeInterval 1;

        codeOptions
        #{
            -I$(LIB_SRC)/meshTools/lnInclude
        #};

        codeExecute
        #{
            const volVectorField& U
            (
                mesh().lookupObject<volVectorField>("U")
            );
            Info << "minU = " << min(U) <<endl;
       #};
    }

}

Last edited by bjnieuwboer; May 1, 2018 at 10:27.
bjnieuwboer is offline   Reply With Quote

Old   September 29, 2020, 15:43
Default
  #4
Senior Member
 
Alejandro
Join Date: Jan 2014
Location: Argentina
Posts: 128
Rep Power: 12
ancolli is on a distinguished road
Quote:
Originally Posted by bjnieuwboer View Post
Hi,

I encountered the same error and came across this bugreport about it. It mentions that you should use the keyword "codeExecute" instead of "code". So a minimal working example would be:

Code:
functions
{
    printMinU
    {
        functionObjectLibs ( "libutilityFunctionObjects.so" );
        enabled         true;
        type            coded;
        redirectType    printMinU;
        writeControl   timeStep;
        writeInterval 1;

        codeOptions
        #{
            -I$(LIB_SRC)/meshTools/lnInclude
        #};

        codeExecute
        #{
            const volVectorField& U
            (
                mesh().lookupObject<volVectorField>("U")
            );
            Info << "minU = " << min(U) <<endl;
       #};
    }

}
name instead of redirectType for the new OF versions
ancolli is offline   Reply With Quote

Reply

Tags
coded functions, openfoam v5


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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 05:29
OpenFOAM 4.0 Released CFDFoundation OpenFOAM Announcements from OpenFOAM Foundation 2 October 6, 2017 05:40
[foam-extend.org] Error compiling OpenFOAM-1.6-ext Canesin OpenFOAM Installation 137 January 20, 2016 14:56
[swak4Foam] installation problem with version 0.2.3 Claudio87 OpenFOAM Community Contributions 9 May 8, 2013 10:20
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11


All times are GMT -4. The time now is 22:53.