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

Cannot save surface as .vtk

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 15, 2019, 09:14
Default Cannot save surface as .vtk
  #1
Member
 
Rasmus Iwersen
Join Date: Jan 2019
Location: Denmark
Posts: 56
Rep Power: 3
Rasmusiwersen is on a distinguished road
Hi all,

I am trying to save the water/air interface in my 3D simulation. My controlDict file looks like the following:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// D 2
application interFoam;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 90;

deltaT 0.001; // Rendered unimportant if adjustTimeStep is enabled.

writeControl adjustableRunTime;

writeInterval 0.5;

//purgeWrite 0;

writeFormat ascii;

writePrecision 15;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

adjustTimeStep yes; // If set to "no", deltaT specified above will be maintained.

maxCo 0.9;
maxAlphaCo 0.9;
maxDeltaT 0.1;

functions
{
forceCoeffs_Object_cylinder1
{
type forceCoeffs;
libs ("libforces.so");
patches (cylinder1);

pName p;
Uname U;
rho rhoInf;
rhoInf 1027;

log true;
CofR (0.0 0 0);
liftDir (0 0 1);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 1.0;
lRef 1.0;
Aref 1.0;

writeControl timeStep;
timeInterval 0.05;
}
forces_Object_cylinder1
{
type forces;
libs ("libforces.so");
patches (cylinder1);

pName p;
Uname U;
rho rhoInf;
rhoInf 1027;

log yes;
CofR (0.0 0 0);
liftDir (0 0 1);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 1.0;
lRef 1.0;
Aref 1.0;

writeControl timeStep;
timeInterval 0.05;
binData
{
nBin 100;
direction (0 0 1);
cumulative no;
}
}
freeSurface
{
type surfaces;
libs
(
"libsampling.so"
);
writeControl timeStep;
writeInterval 4;
surfaceFormat csv;
fields
(
alpha.water
);
surfaces
(
freeSurface
{
type isoSurfaceCell;
isoField alpha.water;
isoValue 0.5;
interpolate false;
regularise false;
}
);
interpolationScheme cell;
}

cylinderResult
{
type surfaces;
libs
(
"libsampling.so"
);
writeControl timeStep;
writeInterval 4;
surfaceFormat vtk;
rhoName rhoInf;
rhoInf 1027; //Reference density for fluid
interpolationScheme cell;
fields
(
alpha.water
p_rgh
nut
);
surfaces
(
cylinder1
{
type patch;
patches (cylinder1);
interpolate false;
triangulate false;
rhoName rhoInf;
rhoInf 1027; //Reference density for fluid
}
);
}

}

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

Although I have specified the freeSurface to save as .vtk, .vtp files are created in the psotProcessing folder. Changing the surfaceFormat back to .vtp also just creates .vtp files. What to do??

Best
Rasmus
Rasmusiwersen is offline   Reply With Quote

Old   November 18, 2019, 11:13
Default Anoyone?
  #2
Member
 
Rasmus Iwersen
Join Date: Jan 2019
Location: Denmark
Posts: 56
Rep Power: 3
Rasmusiwersen is on a distinguished road
No one with any advice? Unfortunately the data export from the other surfaceformats doesn't provide the same output as the .vtp does.

I've succeeded in exporting .vtp files to csv through paraview, however with multiple files, paraview simply lists them all in one go making it impossible to see when a new dataset begins.
Rasmusiwersen is offline   Reply With Quote

Old   November 29, 2019, 09:14
Default Solved!
  #3
Member
 
Rasmus Iwersen
Join Date: Jan 2019
Location: Denmark
Posts: 56
Rep Power: 3
Rasmusiwersen is on a distinguished road
Okay.. So this took me way too long.

Anyway, in my case the freesurface.vtp were NOT saved in one folder.. They were all saved in different folders for some reason. A matlab script quickly copied all files into the same folder having added i+1 as the last part of the file name (freeSurface1.vtp, freesSurface2.vtp... and so on).

Then, selecting ALL the freeSurface.vtp files in Paraview was easy, as they are now grouped by Paraview. Selecting the prefix "freeSurface" after selecting "File->Open" makes Paraview read all files at once, like a timeseries. Again "File->Save Data", then selecting "freeSurface" again and typing any name you want leads you to the final window, which is where the magic happens (which i apparently haven't been able to see as i am blind as a mule).. Select "Write All Time Steps" and BAM, you now have all your .vtp files previously in binary format exported as .csv easily read by MatLab....
Rasmusiwersen is offline   Reply With Quote

Reply

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
[snappyHexMesh] snappyHexMesh generates not planar surface krzychu111 OpenFOAM Meshing & Mesh Conversion 0 December 12, 2018 13:39
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
[Gmsh] Vertex numbering is dense KateEisenhower OpenFOAM Meshing & Mesh Conversion 7 August 3, 2015 11:49
[snappyHexMesh] SnappyHexMesh no layers and no decent mesh for complex geometry pizzaspinate OpenFOAM Meshing & Mesh Conversion 1 February 25, 2015 08:05
[ICEM] Automatic mesh generation script surface intersection problem stuart23 ANSYS Meshing & Geometry 0 May 13, 2011 02:10


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