CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Save data only from a plane

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 22, 2013, 01:58
Default Save data only from a plane
  #1
Pj.
Member
 
Luca
Join Date: Mar 2013
Posts: 68
Rep Power: 4
Pj. is on a distinguished road
I need to run a 2M cells simulation and i need to save the pressure and the speed on a surface for about 9000 time steps.

The way I proceed right now is to save all the cells value for the 9000 time steps and THEN sample the value on the surface I need.

The problem is that, this way, I create an huge amount of datas (about 1TB) to extract from it 5GB of datas that i actually need.

Moreover the sample utility is slower than pisoFoam (both are running on parallel on 60 cores).


Is there a more efficient way to do this operation?


I thought I could delete the time-steps folders with the purgeWrite option, but to do so I need to sample the surface during the pisoFoam execution. Is this possible?
Pj. is offline   Reply With Quote

Old   May 22, 2013, 04:52
Default
  #2
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8
fredo490 is on a distinguished road
When you say a "plane", is it a patch ?

If yes, you can edit your solver, create a new field where you copy only the data of the desired patch.

1) create the field
Code:
    volScalarField ExportPressure
    (
        IOobject
        (
            "ExportPressure",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
2) Find the patch (let's say it is named "wall")
Code:
    label patchWallID = mesh.boundaryMesh().findPatchID("wall");
    const fvPatch& patchWallFaces = mesh.boundary()[patchWallID];
so we get the ID of the wall and also the patch faces

3) Loop over the cells of your patch to save the data
Code:
    forAll(patchWallFaces, facei)
    {
      ExportPressure.boundaryField()[patchWallID][facei] = P.boundaryField()[patchWallID][facei] ;
    }
Or even simplier (need to check if it works in parallel)
Code:
      ExportPressure.boundaryField()[patchWallID] = P.boundaryField()[patchWallID];
4) Your new field ExportPressure will be written with the other variables.
However, if you want to export it at each time step (no matter what), just add the following code after "calculating" the step 3:
Code:
 ExportPressure.write();
I wrote this quickly so you might have to debug my code
fredo490 is offline   Reply With Quote

Old   May 22, 2013, 05:40
Default
  #3
Pj.
Member
 
Luca
Join Date: Mar 2013
Posts: 68
Rep Power: 4
Pj. is on a distinguished road
Thank you very much Fredo.

Actually my "plane" is not a patch, but it's a plane I define in sampleDict with a point and a normal inside my domain.

Code:
surfaces
(
    constantPlane
    {
        type plane;
        name in;
        basePoint ( 0 0 25 );
        normalVector ( 1 0 0 );
    }
);
(My domain is a box from (-1,-3,0) to (26,3,3). So the plane is parallel to the outlet patch but 1m before it)

Moreover (I'm sorry i forgot to say it before), I need this data to be read by the BC timeVaryingMappedFixedValue. To obtain so I set the output format in sampleDict to foamFile and then i need to do some minor manipulation.
What kind of format are the data written with your method?

Moreover I'm sorry, but I'm not an expert with OF. So, the commands you wrote me where have to be written? Inside pisoFoam.C or something like that?

Anyway, even if it's not "perfect" it's a good solution. I will give it a deep look and maybe a try. Thank you very much.
Pj. is offline   Reply With Quote

Old   May 22, 2013, 06:21
Default
  #4
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 236
Rep Power: 8
fredo490 is on a distinguished road
yeah, the code needs to be included in the solver code.
1) in the createField.H
2) / 3) and 4) can be included inside the C file (pisoFoam.C I guess).

The output file looks like the one enclosed. I have exported the temperature only on the wall patch from the Temperature Field T.
Attached Files
File Type: zip Tr.zip (3.8 KB, 4 views)
fredo490 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Gmsh nishant_hull Open Source Meshers: Gmsh, Netgen, CGNS, ... 23 August 5, 2015 02:09
Get data over a plane mali28 Fluent UDF and Scheme Programming 1 May 25, 2012 13:52
Error importing symmetry plane data prikeyma FLUENT 0 September 1, 2010 11:44
Smallest binary file format to save large data Zonexo Main CFD Forum 2 June 2, 2008 20:25
how to save uds' data in each time-step ? xiaodong FLUENT 0 March 26, 2008 12:28


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