CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Read .csv ffile in codeStream

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   December 22, 2018, 19:02
Question Read .csv ffile in codeStream
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 35
Rep Power: 10
Akshay_11235 is on a distinguished road
Hello everyone,

I am trying to implement a simple codeStream implementation for inlet boundary condition.

I have a .dat file which is stored in postProcessing/volFlowRateSurface/0/surfaceFieldValue.dat which looks something like this

# Region type : sampledSurface sampleSurfaceDict
# Faces  :    2880
# Area   :    1.596839e+02
# Time            areaNormalIntegrate(U)
0.001             (1.339634e+00 0.000000e+00 0.000000e+00)
0.002             (2.785413e+00 0.000000e+00 0.000000e+00)
I want to read the value t-1 for the time instance t. I dont know how to read the .csv file in codeStream

So far I could not even build the boundary condition logic since I cannot import the value.

I assume it should follow something like this.


        type            variableHeightFlowRateInletVelocity;
        flowRate          //Set the value for flowRate using codeStream       
            #include "fvCFD.H" 
            #include "IOstream"  //Not sure if this is the right library to include for reading a .csv file  
            -I$(LIB_SRC)/finiteVolume/lnInclude \
            -lmeshTools \
            //This sets the time index, which will be used to locate the outflow value from file
            scalar t = this->db().time().value() //Introduce t scalar for indexing the .csv file later         

             //Import the csv file (say) with name "foo"

             //Set initial flow rate value
            if(t = 0)     
                scalar flowRate = 0


                //Index the .csv file 

                //Pseudo Code as below
                scalar Inflow      //construct a variable
                //Index through the .csv file 

                Inflow = foo[t-1]



        alpha        alpha.water;
        value        uniform (0 0 0);
Akshay_11235 is offline   Reply With Quote


boundary condition u, codestream, csv files, programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Read Force Report by UDF FLUENT 1 June 1, 2018 09:11
Workbench Parametric Runs - Obtaion .csv files Automatically nikos_ FLUENT 3 April 3, 2017 03:14
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 10:52
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 UDS_rambler FLUENT 2 November 22, 2011 09:46

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