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

accessing 0 time directory in coded functionObject

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2018, 09:41
Question accessing 0 time directory in coded functionObject
  #1
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8
JM27 is on a distinguished road
Hi there,


I am hoping to get some help with coded function objects in openFoam.

I have written a function object to compute the radius of a bubble based on volume fraction alpha and cell volume as follows (compressibleInterFoam):

Code:
// section of coded to be executed, in controlDict

forAll(centers, I)   
            {
                        if (alpha[I] < th)         
                {

                    // TO COMPUTE RADIUS

                    // compute numerator, time-varying
                            sumNumerator   += (1-alpha[I])*(V[I]); // per time-step
                                                               
                 
                    // compute denominator, constant at t = 0
                          sumDenominator += (1-alpha[I])*(V[I]);     // CHANGE TO ACCESS VALUES AT TIME = 0 -- how?
        

                   // At each time-step
                    bracket        = pow(sumNumerator/sumDenominator, 1/3);    

                   

                    // compute Radius                
                    Radius         = Rstart*bracket;
               }
       }
However, I cannot seem to figure out how to access the properties at time directory 0.

The code compiles and runs but with the above setting the radius clearly stays constant for all time-directories.
Please help. Any advice will be greatly appreciated.

p.s. I know I can do something similar in swak4Foam but so far I have not managed to make this work for my current version (v5.0) and I want to try out some coding in OpenFOAM and c++ as an exercise (still a newbie).
JM27 is offline   Reply With Quote

Reply

Tags
codedfunctionobjects, compressibleinterfoam, functionobjects, postprocessing, time


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
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 06:49
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 14:40
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
same geometry,structured and unstructured mesh,different behaviour. sharonyue OpenFOAM Running, Solving & CFD 13 January 2, 2013 23:40
1.7.x Environment Variables on Linux 10.04 rasma OpenFOAM Installation 9 July 30, 2010 05:43


All times are GMT -4. The time now is 13:59.