...and by the way, to close th
...and by the way, to close the problem: in order to put back results from a parallel computation, I used mergeMeshes for the mesh and mapFields for the fields:
http://www.cfd-online.com/OpenFOAM_D...ges/1/6828.png |
Hi Dragos,
thank! But how c
Hi Dragos,
thank! But how can one know this from the error message? Fabian |
Hi Fabian,
Well the error com
Hi Fabian,
Well the error comes from the linker because it belongs to an object file not to a source file: Make/linux64GccDPOpt/no_avg_oodles.o(.text+0x31c2): In function `main': : undefined reference to `Foam::cuttingPlane::cells() const' Then, a little bit trickier is to find the library that contains the missing function (in this case cuttingPlane::cells()). For that I first go to the source directory of OpenFOAM, and then search for the class cuttingPlane: home2/dragosm> src OpenFOAM-1.4.1/src> find ./ -name cuttingPlane.C ./sampling/cuttingPlane/cuttingPlane.C ./sampling/lnInclude/cuttingPlane.C ...so it is in the sampling directory. Go there and list it: OpenFOAM-1.4.1/src> cd sampling/ src/sampling> ls cuttingPlane include Make probes graphField lnInclude meshToMeshInterpolation samplingLine As seen above, a Make directory exists. Let see what does it produce: src/sampling> cat Make/files probes/probes.C probes/probesFunctionObject/probesFunctionObject.C probes/IOprobes.C samplingLine/pointAddressing.C samplingLine/samplingLine.C cuttingPlane/cuttingPlane.C graphField/writePatchGraph.C graphField/writeCellGraph.C graphField/makeGraph.C meshToMesh = meshToMeshInterpolation/meshToMesh $(meshToMesh)/meshToMesh.C $(meshToMesh)/calculateMeshToMeshAddressing.C $(meshToMesh)/calculateMeshToMeshWeights.C LIB = $(FOAM_LIBBIN)/libsampling So all it generates is a library called libsampling. In this library you will find the requested function, which means that you need to include it in your own options file, if you want the compilation to be completed. I hope this is usefull, Dragos |
Hi,
great, thanks for the e
Hi,
great, thanks for the explanation! Fabian |
Hi Dragos,
i am writing a
Hi Dragos,
i am writing a Bachlor thesis at Lth, i have a probelm with the code you posted. I am really new with openFOAM and i am running a LES over a 2 cylinder flow. My problem is, in which file should i ionclude your code? And did i understand it correctly, that it creates an output at every timestep for one defined slice of the field for all the variables Thanks for help Fabian |
Hi Fabian,
The code goes in t
Hi Fabian,
The code goes in the main top solver. For simplicity you can put it entirely in the main time loop. That means it will construct and save the slice every time step. It is true, it saves every time step but only the variables that you tell it to save. For instance, if you want pressure you have to use something like: scalarNames[0] = "p" Dragos |
Hi Dragos,
do you have a hi
Hi Dragos,
do you have a hint, how to write out more than one plane at a time? I tried using the same code twice with different names, which does not work. I think 'subsetter' makes some problems!? Regards! Fabian |
Hm, it is strange! I would exp
Hm, it is strange! I would expect it to work. You have 2 subsetters, right? One for each slice, as well as with the rest of the variables.
|
Yes, I have 2 subsetters like
Yes, I have 2 subsetters like this:
#-------------------------------------------- // Plane 1 point pnt(0,25,0); vector direction(0,1,1); plane pl1(pnt,direction); cuttingPlane cutPlane1(mesh,pl1); const labelList& cutCells1 = cutPlane1.cells(); word setName("someCells"); cellSet currentSet1(mesh, setName, cutCells1); // Create mesh subsetting engine fvMeshSubset subsetter1(mesh); label patchI = -1; subsetter1.setLargeCellSubset(currentSet1, patchI, true); wordList scalarNames(1); scalarNames[0] = "p"; PtrList<volscalarfield> scalarFlds1(scalarNames.size()); wordList vectorNames(1); vectorNames[0] = "U"; PtrList<volvectorfield> vectorFlds1(vectorNames.size()); // Plane 2 point pnt2(0,25,25); vector direction2(0,1,1); plane pl2(pnt2,direction2); cuttingPlane cutPlane2(mesh,pl2); const labelList& cutCells2 = cutPlane2.cells(); word setName2("someCells2"); cellSet currentSet2(mesh, setName2, cutCells2); // Create mesh subsetting engine fvMeshSubset subsetter2(mesh); label patchI2 = -1; subsetter2.setLargeCellSubset(currentSet2, patchI2, true); //wordList scalarNames(1); scalarNames[0] = "p"; PtrList<volscalarfield> scalarFlds2(scalarNames.size()); //wordList vektorNames(1); vectorNames[0] = "U"; PtrList<volvectorfield> vectorFlds2(vectorNames.size()); ... scalarFlds1.set(0, subsetter1.interpolate(p)); vectorFlds1.set(0, subsetter1.interpolate(U)); scalarFlds2.set(0, subsetter2.interpolate(p)); vectorFlds2.set(0, subsetter2.interpolate(U)); Info<< "Writing subsetted mesh and fields to time " << runTime.value() << endl; subsetter1.subMesh().write(); subsetter2.subMesh().write(); forAll(scalarFlds1, i) { scalarFlds1[i].write(); } forAll(vectorFlds1, i) { vectorFlds1[i].write(); } forAll(vectorFlds2, i) { vectorFlds2[i].write(); } #-------------------------------------------- but I just get one subsetP and one subsetU in my time directory. Strange... |
Both slices have the same name
Both slices have the same name: subsetp and subsetU, and they get overwritten.
You have to rename them for one of them (let say subset1p and subset1U) before you save them with scalarFlds1[i].write() and vectorFlds1[i].write(). For renaming check the ~/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/mesh/manipulation/subsetMesh/su bsetMesh.C from line 242 and below. Dragos |
Thanks for the file hint, but
Thanks for the file hint, but it does not work due to the different number of cells in the two planes, because it writes just one 'polyMesh' for both planes. Maybe, there is a chance to write it in vtk format, just like in sampleSurf!? Or even 'better' one somehow integrates sampleSurf; then one could use the sampleSurfDict as well...
Fabian |
Hi Dragos,
thanks for the fa
Hi Dragos,
thanks for the fast answer, Now a second question how did you mamage it to reconnect the meshes after a parrallel run with 4 processors. I saw you used the mergeMesh command, but how does it work? Hopefully the question is not to stupid. Thanks Fabian |
Hello Fabian B.
Indeed you ar
Hello Fabian B.
Indeed you are right, the polyMesh gets rewritten too. Beside your excellent ideas, another one would be to collect both planes in one set and write that down, maybe write sets information to be able to extract later the planes separately. Hi Fabian K. To put together two pieces of mesh you can use the mergeMesh. Check this answer on how to do it: mergeMesh. When you will be ready with that you have to "merge" the data too. For that you have to use mapFields... but first fix the merging part. Dragos |
Hi,
hopefully the last que
Hi,
hopefully the last question, during compiling i got the follwing massage, i gues caused by PtrList. Here is the the entry of oodles.C wordList scalarNames(1); scalarNames[0] = "c"; PtrList<volscalarfield> and the Error massage oodles.C: In function 'int main(int, char**)': oodles.C:98: error: 'volscalarfield' was not declared in this scope oodles.C:98: error: template argument 1 is invalid oodles.C:98: error: invalid type in declaration before '(' token oodles.C:102: error: 'volvectorfield' was not declared in this scope oodles.C:102: error: template argument 1 is invalid oodles.C:102: error: invalid type in declaration before '(' token oodles.C:98: warning: unused variable 'scalarFlds1' oodles.C:102: warning: unused variable 'vectorFlds1' make: *** [Make/linuxGccDPOpt/oodles.o] Error 1 Thank you again |
Hi Fabian,
On short: volscala
Hi Fabian,
On short: volscalarfield -> volScalarField I don't know why is written in the wrong way all over the thread, because is wrong, and when I put the above example I've just extracted it from a working code. Dragos |
Hi again,
it is possible n
Hi again,
it is possible not to write every timestep, but let us say every 100 timestep? |
Sorry for asking again,
i h
Sorry for asking again,
i hope it is not too much. When compiling int i get oodles.C: In function 'int main(int, char**)': oodles.C:111: error: 'samplingCount' was not declared in this scope make: *** [Make/linuxGccDPOpt/oodles.o] Error 1 I tried to find a library to find an idea how to fix it, but i do not have any guess. Thanks again |
Don't appologise, if I'm getti
Don't appologise, if I'm getting disturbed I won't write http://www.cfd-online.com/OpenFOAM_D...part/happy.gif
The solution: you have to declare this variable somewhere; one place is imediately after the main function. Quote:
|
Hi Dragos,
first hte good t
Hi Dragos,
first hte good thing, it compiles. But when i run my case this happens. Courant Number mean: 0.00138039 max: 0.0242767 DILUPBiCG: Solving for Ux, Initial residual = 0.00148907, Final residual = 3.64592e-09, No Iterations 1 DILUPBiCG: Solving for Uy, Initial residual = 0.00176973, Final residual = 7.19327e-09, No Iterations 1 --> FOAM Warning : From function Foam::cuttingPlane::walkCell in file cuttingPlane/cuttingPlane.C at line 189 Did not find closed walk along surface of cell 1646 starting from edge 9894 in 0 iterations. Collected cutPoints so far:1(88) --> FOAM Warning : From function Foam::cuttingPlane::walkCell in file cuttingPlane/cuttingPlane.C at line 189 Did not find closed walk along surface of cell 1647 starting from edge 9911 in 1 iterations. Collected cutPoints so far:2(89 38) DICPCG: Solving for p, Initial residual = 0.0217737, Final residual = 0.00108258, No Iterations 9 time step continuity errors : sum local = 1.70955e-10, global = -7.82466e-21, cumulative = 4.23193e-20 DICPCG: Solving for p, Initial residual = 0.00648299, Final residual = 8.2598e-07, No Iterations 93 time step continuity errors : sum local = 1.28292e-13, global = -1.27384e-21, cumulative = 4.10454e-20 ExecutionTime = 4.37 s ClockTime = 5 s it generates a solution, but it slowes down the simulation and if i run my real big case, than the list of Collected cutPoints so far:2(89 38) is really long. Any guess? |
It happens the same thing in m
It happens the same thing in my case. Just a wild guess is that some cells have a face exactly in that plane and the solver doesn't know which of the two cells sharing the face should be picked. To speed up the process, I separate the cell set construction from the interpolation and writing. I put the construction part. For instance, if you take the code from cuttingSlice I put everything above scalarFlds.set(0, subsetter.interpolate(c)) outside the time loop, and kept the rest inside. In this way I get only once those warnings.
I hope this is helpful, Dragos |
All times are GMT -4. The time now is 03:12. |