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

Is there a way to write only the probe locations instead the whole fields?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By akidess

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2016, 11:47
Question Is there a way to write only the probe locations instead the whole fields?
  #1
New Member
 
Jean Schuster
Join Date: Jan 2015
Posts: 8
Rep Power: 11
jeanbvb is on a distinguished road
Hi guys.

I'm running a case that consist in a rectangular box with dimensions height h, (2 \pi h) for the streamwise direction and \left( \frac{4 \pi h}{3}\right) in the spanwise direction, with about 700 K cells in total.

The OpenFoam version used is the 2.4.0 running over Debian 8. The solver used is the buoyantPimpleFoam.

The simulation runs well, and I've concluded 1 hour of simulation. Now I want to change some parametres like temperature and continue the simulation from 1 hour to another few hours.

As I already have the full fields of the initial 1 hour of simulation, the subsequent full fields are no longer necessary. I wonder if I could write only the probe locations instead of the whole fields after i restart the simulation from 1 hour, and write the full fields after a certain number of write intervals (like at every 500 write intervals), in case I need to restart the simulation.

I'm asking that because i'm running out of disk quota on the cluster, which is about 7.5 TB.

I'm hopefull that someone can help me, since I'm not very familiar with object-oriente programming.

Thanks in advance.
jeanbvb is offline   Reply With Quote

Old   September 28, 2016, 03:30
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
http://www.cfdsupport.com/OpenFOAM-T...t/node138.html
jeanbvb and AnthonyP like this.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   October 3, 2016, 10:46
Default
  #3
New Member
 
Jean Schuster
Join Date: Jan 2015
Posts: 8
Rep Power: 11
jeanbvb is on a distinguished road
Quote:
Originally Posted by akidess View Post
Hi akidess, thanks for you interest in help me.

I friend of mine made some changes in the buoyantPimpleFoam.C file as you can see bellow:

Code:
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "rhoThermo.H"
#include "turbulenceModel.H"
#include "radiationModel.H"
#include "fvIOoptionList.H"
#include "pimpleControl.H"
#include "fixedFluxPressureFvPatchScalarField.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "readGravitationalAcceleration.H"
    #include "createFields.H"
    #include "createFvOptions.H"
    #include "createRadiationModel.H"
    #include "initContinuityErrs.H"
    #include "readTimeControls.H"
    #include "compressibleCourantNo.H"
    #include "setInitialDeltaT.H"

    pimpleControl pimple(mesh);

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

/*    Info<< "\n#Starting time loop\n" << endl;*/

    IOdictionary controlDict(IOobject("controlDict", runTime.system(),mesh,IOobject::MUST_READ,IOobject ::AUTO_WRITE));
    scalar wi = readScalar(controlDict.lookup("writeInterval"));
    scalar deltat = readScalar(controlDict.lookup("deltaT"));
    scalar st = readScalar(controlDict.lookup("startTime"));
    Info<< "#wi = " << wi << endl;
    Info<< "#deltat = " << deltat << endl;
    Info<< "#st = " << st << endl;


    while (runTime.run())
    {
        #include "readTimeControls.H"
        #include "compressibleCourantNo.H"
        #include "setDeltaT.H"

/******************************************/ 
IOdictionary pLocs 
( 
IOobject 
( 
"probeLocations", 
runTime.constant(), 
mesh, 
IOobject::MUST_READ, 
IOobject::NO_WRITE 
) 
); 
const pointField& probeLocations(pLocs.lookup("probeLocations")); 

labelList probeCells(probeLocations.size(), -1); 

forAll(probeLocations, pI) 
{ 
probeCells[pI] = mesh.findCell(probeLocations[pI]); 
} 
/******************************************/ 

        runTime++;

        Info<< "#Time = " << runTime.timeName() << nl << endl;

        #include "rhoEqn.H"

        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            #include "UEqn.H"
            #include "EEqn.H"

            // --- Pressure corrector loop
            while (pimple.correct())
            {
                #include "pEqn.H"
            }

            if (pimple.turbCorr())
            {
                turbulence->correct();
            }
        }

        rho = thermo.rho();

/*        runTime.write();*/

/*        Info<< "#ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "#  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;*/

/*******************************************/ 
    Info<< "#passo = " << (runTime.value()-st)/deltat << endl;

if ( (int)((runTime.value()-st)/deltat) % (int)wi == 0)
forAll(probeCells, pI) 
{ 
if(probeCells[pI] != -1) 
{ 
label cellNo = probeCells[pI]; 
Info << runTime.timeName()
<< " "
<< pI << ". Location: " 
<< probeLocations[pI]
<< ", alphaSgs: " << alphaSgs[cellNo]
<< ", k: " << k[cellNo]
<< ", muSgs: " << muSgs[cellNo]
<< ", p: " << p[cellNo]
<< ", phi: " << phi[cellNo]
<< ", pMean: " << pMean[cellNo]
<< ", pPrime2Mean: " << pPrime2Mean[cellNo]
<< ", p_rgh: " << p_rgh[cellNo]
<< ", T: " << T[cellNo]
<< ", U: " << U[cellNo]
<< ", UMean: " << UMean[cellNo]
<< ", UPrime2Mean: " << UPrime2Mean[cellNo] 
//add any other fields here 
<< endl; 
} 
} 

/*******************************************/ 


    }

/*    Info<< "End\n" << endl;*/

    return 0;
}


// ************************************************************************* //
The whole solver can be found in the following link:

https://drive.google.com/open?id=0B-...0JxZjlpWV9pSk0

The new solver was named buoyantPimpleFoamD and compiles ok.

The intention was to make the solver read a file called probeLocations inside the constant folder, this file contains the fields and locations that I want to probe, then write only the probes in a text file through the command "buoyantPimpleFoamD | grep Location > data".

When I try to run the case with the new solver it gives me the following error:

Code:
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  ? at ??:?
#4  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#5  ? at ??:?
The case runs fine when I use the original buoyantPimpleFoam solver.

Could some one help me debug this error?
jeanbvb is offline   Reply With Quote

Old   October 4, 2016, 03:19
Default
  #4
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Did you even have a look at the link I provided? The changes made to the solver are unnecessary.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   October 4, 2016, 12:39
Thumbs up
  #5
New Member
 
Jean Schuster
Join Date: Jan 2015
Posts: 8
Rep Power: 11
jeanbvb is on a distinguished road
Quote:
Originally Posted by akidess View Post
Did you even have a look at the link I provided? The changes made to the solver are unnecessary.
Yes, i did read your post.

At first it was still writting the whole fields in each time steps together whit the probes. Then a set a purgeTime in the controlDict and now is working the way I wanted.

Your solution was a way easier than what I had in my mind, at first i couldnt belive it.

Thank you so much.
jeanbvb is offline   Reply With Quote

Old   October 5, 2016, 03:05
Default
  #6
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Try setting writeInterval to whatever large value you want to have, and adding "outputInterval 1;" to the secion where you define the probe instead of purging the field data.

Edit: You also need to set "outputControl" accordingly (probably "timeStep").
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   October 5, 2016, 11:57
Default
  #7
New Member
 
Jean Schuster
Join Date: Jan 2015
Posts: 8
Rep Power: 11
jeanbvb is on a distinguished road
I added "outputControl timeStep;" and "outputInterval 1;" in the probes function and set "writeInterval 600;", so my probes will be written according my deltaT and the time folder will be written at every 600s of simulation, once I've set "writeControl runTime;".

Correct me if i'm wrong.
jeanbvb 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
Plotting Velocity Probe File with gnuplot McCharles OpenFOAM Post-Processing 9 November 18, 2019 08:44
Empty Probe File - Probes not working rvmedina20 OpenFOAM Post-Processing 3 May 11, 2016 20:36
Probe for X or Y velocity msrinath80 OpenFOAM Running, Solving & CFD 29 July 22, 2015 18:46
Line Probe Smoothing badger1 STAR-CCM+ 1 May 21, 2013 23:36
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 10:15


All times are GMT -4. The time now is 09:33.