How to create isoSurface in the solver itself
I am interested in coputation of Nu number on some internal surface (let say surface with the same radius, and I already have computed volScalarField R ). I want to interpolate my velocity and temperatue field in the solver (without usoin sample libriary).
Any suggestions how to do it?
I tried this constructor
Foam:: isosurface mysurf(mesh, U, R) but it does not pass compilation.
Have a look to sampledIsoSurface
The class you are looking for is sampledIsoSurface or sampledIsoSurfaceCell (they are define in the following directory $FOAM_SRC/sampling/sampledSurface/isoSurface/)
You have to construct it from a dictionary (I advice you to create your own dictionary) like this
Thank you so much for a such comprehensive explanation. I have already started to implement it and faced with several problems.
1. I created my own dictionary. I called it sDict and put into the "system" directory of the case:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Iso surface for interpolated values only
type isoSurface; // always triangulated
//zone ABC; // Optional: zone only
//exposedPatchName fixedWalls; // Optional: zone only
// regularise false; // Optional: do not simplify
now in my new solver I added two lines to create the dictionary ;
const fileName sDict("/raid0/yurifeld/OpenFoam/run/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/SpherGap/Gap0714/Ra510e4/system/sDict");
const dictionary SampleDict(sDict);
and then I create the sampling surface by
sampledIsoSurface midSphere("midSphere", mesh, SampleDict);
tmp<vectorField> interpolatedU = midSphere.sample(U);
tmp<scalarField> interpolatedT = midSphere.sample(T);
for some reason the program does not recognize the file so I am gettin a runtime error :
-> FOAM FATAL IO ERROR:
keyword isoField is undefined in dictionary "/raid0/yurifeld/OpenFoam/run/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/SpherGap/Gap0714/Ra510e4/system/sDict"
From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 395.
2. As far as I understand if I sample volScalarField or volVectorField on the isosurface I already get an interpolated values. In this case this is not clear for me why separate interpolation functions are necessray. And how can I sample now surface field of temperature gradient:
surfaceScalarField heatFlux =fvc::snGrad(T);
if I just write
tmp<scalarField> dTdn= midSphere.interpolate(Foam::interpolation<scalar>( T));
I get a compilation error.
3. How can I write out the interpolated/sampled fields for visualizing/debugging. I saw that there is a function print(IOstream) bu it is not clear how to work with it.
Many many thanks,
Answers to your questions
1. The dictionary should contain only the sub-entries of midSphere because by calling directly the class sampleIsoSurface you do a part of the job of sample: meaning you already specify that it is a surface and you give a name, so the only information missing are the parameters for the isoSurface.
To put it in a nutshell, your dictionary should look like
N.B. Your code won't work if used in parallel... if this is mandatory I advice you to understand exactly the function sampleAndWrite of sampledSurfacesTemplates.C
I hope it will work.
I am trying similar thing, but I have some more basic problem.
Namely, my solver does not want to compile after I add line:
I guess I need it to define:
sampledIsoSurface midSphere("midSphere", mesh, SampleDict);
I have strange error, which seems to point on some OpenFOAM files:
SOURCE=cuette_spr.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -I/opt/openfoam210/src/surfMesh/lnInclude -I/opt/openfoam210/src/triSurface/lnInclude -I/opt/openfoam210/src/conversion/lnInclude -I/opt/openfoam210/src/sampling/lnInclude -I/opt/openfoam210/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/cuette_spr.o
In file included from /opt/openfoam210/src/OpenFOAM/lnInclude/triangle.H:42:0,
/opt/openfoam210/src/OpenFOAM/lnInclude/Random.H: In function ‘int main(int, char**)’:
/opt/openfoam210/src/OpenFOAM/lnInclude/Random.H:43:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam210/src/OpenFOAM/lnInclude/triPointRef.H:35:0,
/opt/openfoam210/src/OpenFOAM/lnInclude/triangle.H:48:1: error: ‘namespace’ definition is not allowed here
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:32:1: error: a template declaration cannot appear at block scope
In file included from /opt/openfoam210/src/OpenFOAM/lnInclude/triangle.H:248:0,
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:46:1: error: expected ‘;’ before ‘template’
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:60:1: error: a template declaration cannot appear at block scope
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:69:1: error: expected ‘;’ before ‘template’
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:75:1: error: a template declaration cannot appear at block scope
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:81:1: error: expected ‘;’ before ‘template’
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:88:1: error: a template declaration cannot appear at block scope
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:95:1: error: expected ‘;’ before ‘template’
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:102:1: error: a template declaration cannot appear at block scope
/opt/openfoam210/src/OpenFOAM/lnInclude/triangleI.H:109:1: error: expected ‘;’ before ‘template’
createFields.H:192:11: warning: unused variable ‘pRefCell’ [-Wunused-variable]
createFields.H:193:12: warning: unused variable ‘pRefValue’ [-Wunused-variable]
cuette_spr.C:180:1: error: expected ‘}’ at end of input
make: *** [Make/linux64GccDPOpt/cuette_spr.o] Błąd 1
I hope you can help me with this...
Please ignore my previous post. I fixed this problem.
I did everything like suggested in yours thread, but I still have this runtime error:
Best and thanks
When we calculate the other quantities on this iso-surface, can we also calculate the normal and tangential gradients at the points on that iso-surface? This correspond to the local coordinates maybe not the original coordinates. Thank you.
I know the topic is old but I have the same error.
Remember how you solved this problem ?
i am trying to extract normal vectors from the constructed iso-surface. To do this i have to loop over the faces of the iso-surface and then loop over the points that belong to a particular face. If the points are arranged in the right way (i.e, clockwise or anticlockwise) the face area vectors should always point in the same direction (i.e inward or outward). This does not seem to be the case here. I printed the area vectors to check the orientation and they are not pointing in the same direction, some vectors point inward and some vectors point outward. Does this mean that the point labels in the face list are arranged randomly?..sounds weird
|All times are GMT -4. The time now is 02:54.|