|
[Sponsors] |
Write cells and data intersecting a plane cuttingPlane |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 28, 2008, 11:57 |
Hi, I would like to save durin
|
#1 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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 |
|
January 28, 2008, 12:48 |
Hi Dragos,
yes, check this th
|
#2 |
Member
ville vuorinen
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
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 |
|
January 29, 2008, 03:14 |
Hi Ville,
Actually your answe
|
#3 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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 |
|
January 29, 2008, 05:41 |
Hi,
unfortunately I doubt if
|
#4 |
Member
ville vuorinen
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
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 |
|
January 29, 2008, 05:57 |
Get the cells from the cutting
|
#5 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
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. |
|
January 29, 2008, 15:58 |
Thanks both of you!
This is w
|
#6 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Thanks both of you!
This is what I was after. |
|
January 30, 2008, 02:40 |
...me again.
The following co
|
#7 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
...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: ... 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 |
|
January 30, 2008, 11:17 |
Hi Dragos
Thanks for the co
|
#8 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
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 |
|
January 30, 2008, 11:37 |
Hi Dragos
I just checked o
|
#9 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
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 |
|
January 30, 2008, 12:51 |
Hi Dragos
I have solved the
|
#10 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
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 |
|
January 30, 2008, 16:42 |
Hi Jaswinder,
Thanks for the
|
#11 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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 |
|
January 30, 2008, 17:09 |
foamToVTK .. cavity -cellSet c
|
#12 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
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" |
|
January 31, 2008, 02:46 |
Hi Mattijs,
Will you give me
|
#13 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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 |
|
January 31, 2008, 06:04 |
pull out the bits of code from
|
#14 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
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.
|
|
February 1, 2008, 11:40 |
Ok, new questions...
In the s
|
#15 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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 |
|
February 5, 2008, 06:41 |
wiki: TurbPlaneCutFoam
|
#16 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
wiki: TurbPlaneCutFoam
|
|
February 5, 2008, 06:59 |
Hmm, I need an idea: how to ma
|
#17 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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: channel_par.log Dragos |
|
February 6, 2008, 10:25 |
Hello again,
Running in paral
|
#18 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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: 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 |
|
February 26, 2008, 14:06 |
Hi Dragos,
I tried your cod
|
#19 |
Senior Member
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19 |
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 |
|
February 27, 2008, 06:09 |
Hi Fabian,
It seems that you
|
#20 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF to write a data file | lichun Dong | FLUENT | 2 | August 4, 2005 12:21 |
write transient data of plane | Fabian | CFX | 2 | June 27, 2005 03:38 |
UDF TO WRITE OUT DATA!! | Aishwarya | FLUENT | 1 | August 14, 2004 11:32 |
UDF TO WRITE OUT DATA!! | Aishwarya | FLUENT | 0 | August 12, 2004 11:11 |
UDF to read and write data | Mcgregor | FLUENT | 4 | June 9, 2003 14:21 |