Hi, I would like to save durin
Hi, I would like to save during the run time, data (and cells) that intersect a plane. I saw the cuttingPlane class, but is there a code snippet on the web showing how to save those cells in a top level solver?
I want later on to be able to read those files with paraFoam or paraview. Dragos |
Hi Dragos,
yes, check this th
Hi Dragos,
yes, check this thread. In case you need further advice please continue the thread and I'll help you. The cutting plane is very practical if you like to take your data to matlab, gnuplot etc for further analysis. http://www.cfd-online.com/OpenFOAM_D...tml?1197913395 best regards, Ville |
Hi Ville,
Actually your answe
Hi Ville,
Actually your answer was the source of my information in the first place. There you show how to access the cells and data, but I am interested in saving them in openfoam format. Can you show me how to do that? If you help me, I promise to put toghether a wiki page so other people would benefit from it. Dragos |
Hi,
unfortunately I doubt if
Hi,
unfortunately I doubt if that is possible since the cutting plane option is needed to extract data from the mesh so that connectivity information (which the post processor should need) is lost.. -Ville |
Get the cells from the cutting
Get the cells from the cutting plane and construct a cellSet from them. Something like
const labelList& cutCells = cutPlane.cells(); cellSet someCells(mesh, "someCells", cutCells); someCells.write(); Then use foamToVTK with -cellSet option. |
Thanks both of you!
This is w
Thanks both of you!
This is what I was after. |
...me again.
The following co
...me again.
The following code works very well: point pnt(0.5,0.25,-0.25); vector direction(1,0,0); plane pl1(pnt,direction); cuttingPlane cutPlane(mesh,pl1); const labelList& cutCells = cutPlane.cells(); cellSet someCells(mesh, "someCells", cutCells); someCells.write(); Here is a slice obtained with it: http://www.cfd-online.com/OpenFOAM_D...ges/1/6528.png ... but I would like more. Is it possible to save together with the above cell set also the data associated to it at a certain time? Dragos |
Hi Dragos
Thanks for the co
Hi Dragos
Thanks for the code. Could you also please post the list of include files so that this code compiles successfully. I put the code in my post processing routine exactly as you have psoted point pnt(0.0,0.0,0.04); vector direction(1,0,0); plane pl1(pnt,direction); cuttingPlane cutPlane(mesh,pl1); const labelList& cutCells = cutPlane.cells(); cellSet someCells(mesh, "someCells", cutCells); someCells.write(); and get the following error: postProcessing.C:654: error: 'plane' was not declared in this scope postProcessing.C:654: error: expected `;' before 'pl1' postProcessing.C:655: error: 'cuttingPlane' was not declared in this scope postProcessing.C:655: error: expected `;' before 'cutPlane' postProcessing.C:656: error: 'cutPlane' was not declared in this scope postProcessing.C:657: error: 'cellSet' was not declared in this scope postProcessing.C:657: error: expected `;' before 'someCells' postProcessing.C:658: error: 'someCells' was not declared in this scope postProcessing.C:656: warning: unused variable 'cutCells' The list of files I have already included are: #include "fvCFD.H" #include "wallFvPatch.H" #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "incompressible/turbulenceModel/turbulenceModel.H" #include "nearWallDist.H" #include "fixedValuePointPatchFields.H" Thanks alot With Kind Regards Jaswinder |
Hi Dragos
I just checked o
Hi Dragos
I just checked out the cuttingPlane code and it has a member function called //- Sample the cell field template<class> tmp<field<type> > sample(const Field<type>&) const; It seems that if you add the following to your code snippet point pnt(0.0,0.0,0.04); vector direction(1,0,0); plane pl1(pnt,direction); cuttingPlane cutPlane(mesh,pl1); const labelList& cutCells = cutPlane.cells(); ---------------- volScalarField slicedDesiredField = cutPlane.sample(desiredField); ----------------- cellSet someCells(mesh, "someCells", cutCells); someCells.write(); You might be able to extract the field you want. I could not test whether if it works as i am unable to compile the original code offered by you. With Kind Regards Jaswinder |
Hi Dragos
I have solved the
Hi Dragos
I have solved the compilation problem but now I have problem visualizing it. I give the following command: foamToVTK <root> <case> -cellSet someCells and it writes Exec : foamToVTK . 7_flask_10ml_320rpm -cellSet someCells Date : Jan 30 2008 Time : 17:48:12 Host : taifun PID : 5343 Root : <root> Case : <case> Nprocs : 1 Create time Number of cells in new mesh : 6034 Number of faces in new mesh : 24264 Number of points in new mesh: 12342 --> FOAM FATAL IO ERROR : cannot open file file: /scratch1/power_consumption_sims/1st_10ml/7_flask_10ml_320rpm/system/subsetSubse t/fvSchemes at line 0. From function regIOobject::readStream(const word&) in file db/regIOobject/regIOobjectRead.C at line 66. FOAM exiting Could you please give me a clue what is missing With kind Regards Jaswinder |
Hi Jaswinder,
Thanks for the
Hi Jaswinder,
Thanks for the information, I'll definitely try it (I have to check if volScalarField class can write down the data). On the other hand I have no idea why you get that error. Dragos |
foamToVTK .. cavity -cellSet c
foamToVTK .. cavity -cellSet c0
works for me (1.4.1): Time constant Internal : "../cavity/VTK/c0_0.vtk" Original cells:5 points:24 Additional cells:0 additional points:0 Patch : "../cavity/VTK/movingWall/c0_0.vtk" Patch : "../cavity/VTK/fixedWalls/c0_0.vtk" Patch : "../cavity/VTK/frontAndBack/c0_0.vtk" Patch : "../cavity/VTK/oldInternalFaces/c0_0.vtk" |
Hi Mattijs,
Will you give me
Hi Mattijs,
Will you give me a clue on how to get only the slice (both geometry and data)? I don't want to save the entire domain and then to get the slice. Dragos |
pull out the bits of code from
pull out the bits of code from subsetMesh. It takes a cellSet and creates a whole new fvMesh from it and subsets the cells as well.
|
Ok, new questions...
In the s
Ok, new questions...
In the subsetMesh utility the following lines read the mesh and the volume scalars from a specific time directory: IOobjectList objects(mesh, runTime.timeName()); wordList scalarNames(objects.names(volScalarField::typeName )); PtrList<volscalarfield> scalarFlds(scalarNames.size()); then a subset of it is constructed by subsetVolFields(subsetter, scalarNames, scalarFlds); Now my question is: how do I construct the subset from the variables I have in memory (during the calculation) and not read them from a dictionary? Dragos |
wiki: TurbPlaneCutFoam
wiki: TurbPlaneCutFoam
|
Hmm, I need an idea: how to ma
Hmm, I need an idea: how to make it run in parallel?
Anybody can give me a clue? This is the log file with the error I get when I run the solver in parallel: http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif channel_par.log Dragos |
Hello again,
Running in paral
Hello again,
Running in parallel and getting the slices saved, seems to be ok. But how should I reconstruct the plane back from each processor? For instance, two processors will give me two pieces like in the following image: http://www.cfd-online.com/OpenFOAM_D...ges/1/6593.png How should I put them together? reconstructPar doesn't seem to work for the cells saved from the cuttingPlane. I can merge the mesh using mergeMeshes, but how can I merge the data? Dragos |
Hi Dragos,
I tried your cod
Hi Dragos,
I tried your code snip, but have some problems compiling it: -lincompressibleLESmodels -lincompressibleTransportModels -lfiniteVolume -lmeshTools -lOpenFOAM -liberty -ldl -lm -o /home/gcae504/OpenFOAM/gcae504-1.4.1/applications/bin/linux64GccDPOpt/no_avg_ood les Make/linux64GccDPOpt/no_avg_oodles.o(.text+0x31b5): In function `main': : undefined reference to `Foam::cuttingPlane::cuttingPlane(Foam::primitiveM esh const&, Foam::plane const&)' Make/linux64GccDPOpt/no_avg_oodles.o(.text+0x31c2): In function `main': : undefined reference to `Foam::cuttingPlane::cells() const' collect2: ld returned 1 exit status make: *** [/home/gcae504/OpenFOAM/gcae504-1.4.1/applications/bin/linux64GccDPOpt/no_avg_oo dles] Error 1 I added these libraries to the oodles solver: #include "plane.H" #include "cuttingPlane.H" #include "cellSet.H" #include "fvMeshSubset.H" Would be nice, if you have a hint, how to compile it!? Regards! Fabian |
Hi Fabian,
It seems that you
Hi Fabian,
It seems that you have all the correct "#include" directives, since the error is from the link stage and not from compilation. What you basically need is the "-lsampling" option. Here is how my options file looks like: EXE_INC = \ -I$(LIB_SRC)/LESmodels \ -I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -lincompressibleLESmodels \ -lincompressibleTransportModels \ -lfiniteVolume \ -lmeshTools \ -lsampling |
All times are GMT -4. The time now is 11:20. |