CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to create isoSurface in the solver itself

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 5 Post By fcollonv
  • 1 Post By fcollonv
  • 1 Post By Andrea_85
  • 2 Post By raunakbardia

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2011, 20:51
Default How to create isoSurface in the solver itself
  #1
Member
 
Yuri Feldman
Join Date: Mar 2011
Posts: 30
Rep Power: 15
feldy77 is on a distinguished road
Dear forum,
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.
many thanks,
Yuri
feldy77 is offline   Reply With Quote

Old   December 14, 2011, 09:02
Default Have a look to sampledIsoSurface
  #2
Member
 
Frederic Collonval
Join Date: Apr 2009
Location: Technische Universitaet Munich - Lehrstuhl fuer Thermodynamik
Posts: 53
Rep Power: 17
fcollonv is on a distinguished road
Dear Yuri,

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
Code:
Foam::sampledIsoSurface myIsoSurf("myIsoSurface", mesh, mydict);
Where your dictionary should look like the sub-entry required in sample dict:
Code:
        // Iso surface for interpolated values only
        type            isoSurface;    // always triangulated
        isoField        R;
        isoValue        0.005;
        interpolate     true;

        //zone            ABC;          // Optional: zone only
        //exposedPatchName fixedWalls;  // Optional: zone only

        // regularise      false;    // Optional: do not simplify
Then to generate the surface, call the method "update". And to sample other fields on the surface use the function "sample".
Code:
myIsoSurf.update();
tmp<vectorField> interpolatedU = myIsoSurf.sample(U);
tmp<scalarField> interpolatedT = myIsoSurf.sample(T);
If you want to interpolate the value to the surface, it is a bit more complex. But I think the following code should do the trick.
Code:
myIsoSurf.update();
tmp<vectorField> interpolatedU = myIsoSurf.interpolate(Foam::interpolation<vector>(U));
tmp<scalarField> interpolatedT = myIsoSurf.interpolate(Foam::interpolation<scalar>(T));
Best regards,

Frederic
hz283, kk415, Aaron_L and 2 others like this.
__________________
Frederic Collonval
Technische Universität München
Thermodynamics Dpt.

Last edited by fcollonv; December 14, 2011 at 09:10. Reason: Sample read only the value of the cells intersecting with the surface. Interpolate do a real interpolation.
fcollonv is offline   Reply With Quote

Old   December 14, 2011, 17:46
Default
  #3
Member
 
Yuri Feldman
Join Date: Mar 2011
Posts: 30
Rep Power: 15
feldy77 is on a distinguished road
Dear Frederic,
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:

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Iso surface for interpolated values only
interpolationScheme cellPointFace;
surfaces
(
midSphere
{
type isoSurface; // always triangulated
isoField R;
isoValue 0.4285;
interpolate true;
//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);
midSphere.update();
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"
file: /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,
Yuri
feldy77 is offline   Reply With Quote

Old   December 15, 2011, 03:42
Default Answers to your questions
  #4
Member
 
Frederic Collonval
Join Date: Apr 2009
Location: Technische Universitaet Munich - Lehrstuhl fuer Thermodynamik
Posts: 53
Rep Power: 17
fcollonv is on a distinguished road
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
Code:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

type isoSurface; // always triangulated
isoField R;
isoValue 0.4285;
interpolate true;
//zone ABC; // Optional: zone only
//exposedPatchName fixedWalls; // Optional: zone only
// regularise false; // Optional: do not simplify
2.
Quote:
As far as I understand if I sample volScalarField or volVectorField on the isosurface I already get an interpolated values.
No, if you look at the code in "sampledIsoSurfaceTemplates.C", you can clearly read that it is just returning the value of the field in the cells cut by the iso-surface.
Code:
00033 template <class Type> 
00034 Foam::tmp<Foam::Field<Type> > 
00035 Foam::sampledIsoSurface::sampleField 
00036 ( 
00037     const GeometricField<Type, fvPatchField, volMesh>& vField 
00038 ) const 
00039 { 
00040     // Recreate geometry if time has changed 
00041     updateGeometry(); 
00042  
00043     return tmp<Field<Type> >(new Field<Type>(vField, surface().meshCells())); 
00044 }
Quote:
And how can I sample now surface field of temperature gradient
It is just a guess. But I think, it will do the job (N.B. doing an interpolation is more complicated as I said before, it looks like (see sampleSurfacesTemplates.C) that the following code should do the trick):
Code:
volVectorField gradT =fvc::grad(T);
autoPtr<Foam::interpolation<vector> > interpolator;

// The interpolator need two entries: the interpolation scheme (names possible in the sample dict) and the field to be interpolated
interpolator = Foam::interpolation<vector>::New(word("cellPointFace"), gradT);
tmp<vectorField> dTdn = midSphere.interpolate(interpolator());
// Project the gradT on the normal of the surface
tmp<scalarField> heatFlux = midSphere.project(dTdn);
3.
Quote:
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.
That also very tricky, another guess by looking again in sampleSurfacesTemplates.C and presuming you want to write it in VTK format
Code:
vtkSurfaceWriter writer();
writer.write(outputDir, midSphere.name(), midSphere.points(), midSphere.faces(), fieldName, field, interpolateBoolean);
interpolateBoolean is a flag true if the value are interpolated, false otherwise.

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.

Kindly,

Frederic
kk415 likes this.
__________________
Frederic Collonval
Technische Universität München
Thermodynamics Dpt.

Last edited by fcollonv; December 15, 2011 at 03:45. Reason: Typo mistake
fcollonv is offline   Reply With Quote

Old   January 30, 2013, 14:00
Default
  #5
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17
ziemowitzima is on a distinguished road
Hi,
I am trying similar thing, but I have some more basic problem.
Namely, my solver does not want to compile after I add line:
#include "sampledIsoSurface.H"

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,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triPointRef.H:35,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triFace.H:48,
from /opt/openfoam210/src/triSurface/lnInclude/labelledTri.H:38,
from /opt/openfoam210/src/triSurface/lnInclude/triSurface.H:40,
from /opt/openfoam210/src/sampling/lnInclude/isoSurface.H:66,
from cuette_spr.C:49:
/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,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triFace.H:48,
from /opt/openfoam210/src/triSurface/lnInclude/labelledTri.H:38,
from /opt/openfoam210/src/triSurface/lnInclude/triSurface.H:40,
from /opt/openfoam210/src/sampling/lnInclude/isoSurface.H:66,
from cuette_spr.C:49:
/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,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triPointRef.H:35,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triFace.H:48,
from /opt/openfoam210/src/triSurface/lnInclude/labelledTri.H:38,
from /opt/openfoam210/src/triSurface/lnInclude/triSurface.H:40,
from /opt/openfoam210/src/sampling/lnInclude/isoSurface.H:66,
from cuette_spr.C:49:
/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...
Best
MM

Last edited by ziemowitzima; January 30, 2013 at 15:04.
ziemowitzima is offline   Reply With Quote

Old   January 30, 2013, 15:46
Default
  #6
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17
ziemowitzima is on a distinguished road
Dear Frederic,
Dear Yuri,
Please ignore my previous post. I fixed this problem.

I did everything like suggested in yours thread, but I still have this runtime error:
HTML Code:
--> FOAM FATAL IO ERROR: 
keyword isoField is undefined in dictionary "/home/zima/OpenFOAM/zima-2.1.0/run/tutorials/cuette_flow/cuette_spr/system/sDict"

file: /home/zima/OpenFOAM/zima-2.1.0/run/tutorials/cuette_flow/cuette_spr/system/sDict

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

FOAM exiting
Do you know maybe how to fix this problem ?

Best and thanks
ZMM
ziemowitzima is offline   Reply With Quote

Old   October 13, 2013, 09:22
Question
  #7
Senior Member
 
Join Date: Nov 2012
Posts: 171
Rep Power: 13
hz283 is on a distinguished road
Hi fcollonv,

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.


Quote:
Originally Posted by fcollonv View Post
Dear Yuri,

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
Code:
Foam::sampledIsoSurface myIsoSurf("myIsoSurface", mesh, mydict);
Where your dictionary should look like the sub-entry required in sample dict:
Code:
        // Iso surface for interpolated values only
        type            isoSurface;    // always triangulated
        isoField        R;
        isoValue        0.005;
        interpolate     true;

        //zone            ABC;          // Optional: zone only
        //exposedPatchName fixedWalls;  // Optional: zone only

        // regularise      false;    // Optional: do not simplify
Then to generate the surface, call the method "update". And to sample other fields on the surface use the function "sample".
Code:
myIsoSurf.update();
tmp<vectorField> interpolatedU = myIsoSurf.sample(U);
tmp<scalarField> interpolatedT = myIsoSurf.sample(T);
If you want to interpolate the value to the surface, it is a bit more complex. But I think the following code should do the trick.
Code:
myIsoSurf.update();
tmp<vectorField> interpolatedU = myIsoSurf.interpolate(Foam::interpolation<vector>(U));
tmp<scalarField> interpolatedT = myIsoSurf.interpolate(Foam::interpolation<scalar>(T));
Best regards,

Frederic
hz283 is offline   Reply With Quote

Old   September 8, 2014, 10:07
Default
  #8
New Member
 
Y.LANCE
Join Date: Feb 2013
Posts: 7
Rep Power: 13
Yoann is on a distinguished road
Quote:
Originally Posted by ziemowitzima View Post
Hi,
I am trying similar thing, but I have some more basic problem.
Namely, my solver does not want to compile after I add line:
#include "sampledIsoSurface.H"

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,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triPointRef.H:35,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triFace.H:48,
from /opt/openfoam210/src/triSurface/lnInclude/labelledTri.H:38,
from /opt/openfoam210/src/triSurface/lnInclude/triSurface.H:40,
from /opt/openfoam210/src/sampling/lnInclude/isoSurface.H:66,
from cuette_spr.C:49:
/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,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triFace.H:48,
from /opt/openfoam210/src/triSurface/lnInclude/labelledTri.H:38,
from /opt/openfoam210/src/triSurface/lnInclude/triSurface.H:40,
from /opt/openfoam210/src/sampling/lnInclude/isoSurface.H:66,
from cuette_spr.C:49:
/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,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triPointRef.H:35,
from /opt/openfoam210/src/OpenFOAM/lnInclude/triFace.H:48,
from /opt/openfoam210/src/triSurface/lnInclude/labelledTri.H:38,
from /opt/openfoam210/src/triSurface/lnInclude/triSurface.H:40,
from /opt/openfoam210/src/sampling/lnInclude/isoSurface.H:66,
from cuette_spr.C:49:
/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...
Best
MM
Dear Mieszkor,

I know the topic is old but I have the same error.

Remember how you solved this problem ?

Thanks.
Yoann is offline   Reply With Quote

Old   October 7, 2015, 11:44
Default
  #9
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 16
Andrea_85 is on a distinguished road
Hi All,

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

Best,
Andrea
Andrea_85 is offline   Reply With Quote

Old   July 2, 2017, 18:56
Default
  #10
Member
 
Raunak Bardia
Join Date: Jan 2015
Posts: 32
Rep Power: 11
raunakbardia is on a distinguished road
Hello everyone,

I am relatively new to OpenFoam.

I am trying to use the sampledIsoSurface function in my solver like this:

const fileName sdict(runTime.path()/"system/SurfDict");
const dictionary surf(sdict);
Foam::sampledIsoSurface iso("iso",mesh,surf);


But when compiling the solver I get the following error:

IsointerFoam.C:75: error: ‘sampledIsoSurface’ is not a member of ‘Foam’
IsointerFoam.C:75: error: expected ‘;’ before ‘iso’

I looked through all the files but was unable to find the solution to this problem myself. Can someone please point out what am I doing wrong in this addition to the code?
raunakbardia is offline   Reply With Quote

Old   July 3, 2017, 02:48
Default
  #11
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
Quote:
Originally Posted by raunakbardia View Post
const fileName sdict(runTime.path()/"system/SurfDict");
This is not valid C++.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   July 3, 2017, 04:51
Default
  #12
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi all,

@akidess

Why? runTime.path() is fileName instance with overloaded / operator.

@raunakbardia

Do you include sampledIsoSurface.H header?
alexeym is offline   Reply With Quote

Old   July 3, 2017, 04:58
Default
  #13
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
Quote:
Originally Posted by alexeym View Post
Hi all,

@akidess

Why? runTime.path() is fileName instance with overloaded / operator.

@raunakbardia

Do you include sampledIsoSurface.H header?
Because you can't just concatenate a string without an operator. I'm not aware of an overloaded "/"-operator to concatenate strings.

Edit: Operator is indeed overloaded here: https://github.com/OpenFOAM/OpenFOAM...ame/fileName.C
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   July 3, 2017, 10:00
Default
  #14
Member
 
Raunak Bardia
Join Date: Jan 2015
Posts: 32
Rep Power: 11
raunakbardia is on a distinguished road
Thanks for your replies!

@Anton: I came across the use of this forward slash operator on some online forum and it seems to be working fine here. When I tried to output the file name stored in the variable sdict, it gave me the correct output.
As you rightly mentioned in the link, there is a friend operator on line # 431 which might be defining this functionality. Also, the compilation does not show any error on this statement when I run it separately as well.

@Alexey: I had tried adding that header file earlier but I got this error.

"could not open file sampledIsoSurface.H for source file IsointerFoam.C"

I assumed that the source files are added in the dependency list on their own so I should not be including it separately. Please correct me if I am wrong.

If indeed, I have to add this header file separately, then I am not sure why I am getting the aforementioned error.

Thanks again for your help!
raunakbardia is offline   Reply With Quote

Old   July 3, 2017, 10:11
Default
  #15
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 16
Andrea_85 is on a distinguished road
Try to remove Foam:: and just use

Code:
sampledIsoSurface iso("iso",mesh,surf);
add

Code:
#include "sampledIsoSurface.H"
in IsointerFoam.C, and add

Code:
EXE_INC = \
        ....
       -I$(LIB_SRC)/sampling/lnInclude \
       .....

EXE_LIBS = \
        .....
        -lsampling \
        .....
in Make/option.
In my case it works just fine in this way
kk415 likes this.
Andrea_85 is offline   Reply With Quote

Old   July 3, 2017, 12:12
Default
  #16
Member
 
Raunak Bardia
Join Date: Jan 2015
Posts: 32
Rep Power: 11
raunakbardia is on a distinguished road
Soon after I wrote my last question, I realized I should be looking at the library dependencies.

Thanks for your reply Andrea. That definitely solved the problem. My two cents to that addition is that the compilation also requires two other libraries if they are not already added in your solver

EXE_INC = \
...
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude

EXE_LIBS = \
...
-lsampling \
-lmeshTools \
-ltriSurface


However, the compiled solver still doesn't work. I am facing the same error as mentioned in the posts above:

Code:
--> FOAM FATAL IO ERROR: 
keyword isoField is undefined in dictionary "/home/rbardia/OpenFOAM/rbardia-2.1.1/run/Testing/IsoSurfaceTesting/Isointerfoam/system/SurfDict"

file: /home/rbardia/OpenFOAM/rbardia-2.1.1/run/Testing/IsoSurfaceTesting/Isointerfoam/system/SurfDict

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

FOAM exiting
but no one mentioned how they solved the problem. This is how my dictionary looks like:

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

// Iso surface for interpolated values only
type            isoSurface;    // always triangulated
isoField        alpha1;
isoValue        0.5;
interpolate     true;

//zone            ABC;          // Optional: zone only
//exposedPatchName fixedWalls;  // Optional: zone only
regularise      false;    // Optional: do not simplify
// mergeTol        1e-10;    // Optional: fraction of mesh bounding box
                                     // to merge points (default=1e-6)
I am clearly mentioning the isoField in the dictionary but the solver fails to recognize it?
raunakbardia is offline   Reply With Quote

Old   July 4, 2017, 03:56
Default
  #17
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 16
Andrea_85 is on a distinguished road
sounds weird, there is probably something wrong in the way you read the dictionary. It is difficult to say more than this without seeing your source code.

best,

andrea
Andrea_85 is offline   Reply With Quote

Old   July 4, 2017, 11:55
Default
  #18
Member
 
Raunak Bardia
Join Date: Jan 2015
Posts: 32
Rep Power: 11
raunakbardia is on a distinguished road
Thanks Andrea.

I was able to solve the issue.

Instead of reading the dictionary directly I created an IOdictionary object in the createFields.H and obtained the inputs from that dictionary to create the isosurface. This idea was from one of your other posts: isoSurface normal

I am not sure why this method worked while the other didn't but I will stick with this for now.
guin and kk415 like this.
raunakbardia is offline   Reply With Quote

Old   May 8, 2020, 05:41
Default
  #19
Senior Member
 
krishna kant
Join Date: Feb 2016
Location: Hyderabad, India
Posts: 133
Rep Power: 10
kk415 is on a distinguished road
Hello All, Does this idea works on parallel run? I am facing problems in parallel run but not in serial run.
kk415 is offline   Reply With Quote

Reply


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
Meshing a Sphere Ajay FLUENT 10 September 3, 2016 14:18
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 11:34
Working directory via command line Luiz CFX 4 March 6, 2011 20:02
how to combine parts of MRFSimpleFoam and TurbFoam to create a new solver? renyun0511 OpenFOAM Running, Solving & CFD 0 May 3, 2010 22:10
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 14:08


All times are GMT -4. The time now is 16:34.