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

coded function object and field average

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By wyldckat
  • 1 Post By fabian_roesler

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2014, 10:53
Default coded function object and field average
  #1
Member
 
Matthias Walter
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 63
Rep Power: 17
matthias is on a distinguished road
Hi folks,

I'm using the coded function object to create and calculate the field epsilon

Code:
   epsilonAverage
    {
        functionObjectLibs ("libutilityFunctionObjects.so");
        type coded;
        redirectType average1;
        outputControl timeStep;
        code
        #{
            volScalarField epsilon
            (
                IOobject
                (
                    "epsilon",
                    mesh().time().timeName(),
                    mesh(),
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                2*mesh().lookupObject<volScalarField>("nu")*magSqr(symm(fvc::grad(mesh().lookupObject<volVectorField>("U"))))
            );

            //epsilon.write();
        #};

    }
When I call the fieldAverage function object and apply the averaging to epsilon, it isn't known since the field epsilon is not registered globally but only within the code directive.

So is it possible to use the fieldAverage function object for this purpose?

(Of course I can implement the code into the solver directly but using the coded function object I must not change the solver)


Best regards

Matthias
matthias is offline   Reply With Quote

Old   June 28, 2014, 16:42
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Matthias,

I'm not certain I understand the problem you're describing, but my understanding is that you're using something like the utility execFlowFunctionObjects and using that function object to calculate the average of epsilon field!? The part I'm not certain is why you're using a coded function object...

OK, there are two possible answers, from what I can figure out from your question:
  1. Use the option "-noFlow" when calling execFlowFunctionObjects: http://openfoamwiki.net/index.php/Ex...unctionObjects
  2. Or use another function object to load up the fields you need (before the one you're using):
    Code:
        readFields
        {
            functionObjectLibs ( "libfieldFunctionObjects.so" );
            type readFields;
            fields (p U epsilon);
        }
Best regards,
Bruno
maetlg likes this.
__________________
wyldckat is offline   Reply With Quote

Old   June 30, 2014, 05:41
Default
  #3
Member
 
Matthias Walter
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 63
Rep Power: 17
matthias is on a distinguished road
Hi Bruno,

actually I don't use the execFlowFunctionObjects. My intention was to calculate the dissipation field (epsilon) on-the-fly without modifying the solver.

I can calculate the epsilon field in system/controlDict using the coded function object but how does the averaging work? After the coded function object has been finished the epsilon field can be written to disk but it is not registered! If you call the averaging function object after coded function object it won't find a field named epsilon.

I will have a look at execFlowFunctionObjects if it will do the job.

Best regards

Matthias
matthias is offline   Reply With Quote

Old   June 30, 2014, 05:52
Default create registered object during runtime using functionobject
  #4
Senior Member
 
Fabian Roesler
Join Date: Mar 2009
Location: Germany
Posts: 213
Rep Power: 18
fabian_roesler is on a distinguished road
Hi Matthias

Have a look into this thread:

http://www.cfd-online.com/Forums/ope...ionobject.html

In post #12 (http://www.cfd-online.com/Forums/ope...tml#post387459) Eelco explains the solution to his problem using functionobjects.

Cheers

Fabian
wyldckat likes this.
fabian_roesler 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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 06:37
How to use DESModelRegions function object hakonbar OpenFOAM Running, Solving & CFD 33 April 21, 2019 07:17
Problem with using function object to compute Nu number in parallel. feldy77 OpenFOAM Programming & Development 0 September 9, 2011 20:17
Problem with using function object to compute Nu number in parallel. feldy77 OpenFOAM Programming & Development 0 September 9, 2011 20:17
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06


All times are GMT -4. The time now is 12:37.