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

write out nusselt number (gradient of T, respectively) for timesteps

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 12, 2016, 19:33
Default
  #21
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Hi Ram,

The solver was developed in 2009, back then OpenFOAM was at version 1.5 - this is why it does not compile in more recent versions.

I suggest you start from simpleFoam, and add the scalar equations in the same way you can see in simpleScalarFoam. It is not too difficult (the Programmers guide is a very good starting point to understand where and how to start).

Regards,
Jose
Scram_1 likes this.
santos is offline   Reply With Quote

Old   March 12, 2016, 19:50
Default
  #22
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 11
Scram_1 is on a distinguished road
Hello Santos!
I added the temperature field to the icoFoam solver and it's working just fine. I think the problem was with my computer's anti-virus. I re-installed it and now I'm able to compile my solver without any glitches.
Thanks!!
Scram_1 is offline   Reply With Quote

Old   March 12, 2016, 20:45
Default
  #23
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 11
Scram_1 is on a distinguished road
Hey,
There's another roadblock that I've hit I've added temperature in the foamDataToFluentDict file. When I do foamDataToFuent, OpenFOAM reads the temperature field and I can see the temperature in the .dat file along with U and p. (Btw I've executed foamMeshToFluent as well) However, when I open the case file in Fluent and then the .dat file, I'm not able to see the temperature contour. I can select velocity and pressure but not the temperature. I'm stuck and don't know whether this is another bug or if I'm doing something wrong.
Thanks.

Ram
Scram_1 is offline   Reply With Quote

Old   March 27, 2016, 23:27
Default openfoam 2.2.2, not working with this
  #24
New Member
 
Kai
Join Date: Mar 2014
Posts: 5
Rep Power: 12
ssboss is on a distinguished road
Hello guys

I have a modified simpleFoam solver with temperature scalar transport equation implemented. I now want to calculate the temperature gradient at wall surfaces. I followed Santos' codes in post #4 on this thread and included his codes into my solver. I am now getting a compilation error that says:

simpleEnergySourceFoamtest.C:189:17: error: no matching function for call to ‘Foam::dimensioned<Foam::Vector<double> >::dimensioned(const char [6], Foam::dimensionSet, int)’

I am not sure what 189:17 means, it seems to stay the same in the error message even after I make changes to the solver.

Can anyone please help point me to the right direction? I am using openfoam 2.2.2
ssboss is offline   Reply With Quote

Old   March 28, 2016, 16:47
Default
  #25
New Member
 
Fei
Join Date: Oct 2015
Posts: 13
Rep Power: 11
Garfield is on a distinguished road
Hi, Santos
Thanks for your help, and recently, I try to compile a function to calculate local Nusselt Number, in which I need to write a if statement to see whether the local surface flux = 0. As below
if (patchHeatFlux[patchi]==0)
NusseltNumber.boundaryField()[patchi] = 0;

While we I compile it, it report the error:
error: passing ‘const Foam::fvsPatchField<double>’ as ‘this’ argument of ‘void Foam::fvsPatchField<Type>:perator==(const Type&) [with Type = double]’ discards qualifiers [-fpermissive]
if (patchHeatFlux[patchi]==0)
^
NusseltCalc.C:139:39: error: could not convert ‘(&(& patchHeatFlux)->Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricBoundaryField::<anony mous>.Foam::FieldField<Foam::fvsPatchField, double>::<anonymous>.Foam::PtrList<T>:perator[]<Foam::fvsPatchField<double> >(patchi))->Foam::fvsPatchField<Type>:perator==<double>(( * &0.0))’ from ‘void’ to ‘bool’
if (patchHeatFlux[patchi]==0)
^
It seems the patchHeatFlux[patchi] is a special data type, Do you have any suggestion to make that if statement work?
Thanks a lot
Garfield is offline   Reply With Quote

Old   April 28, 2016, 10:19
Post finding nusselt number
  #26
New Member
 
narayana vekamulla
Join Date: Oct 2015
Posts: 15
Rep Power: 11
vnarayana is on a distinguished road
Dear Joes Santos,
i am using ubuntu 15.04, i want to know nusselt number at the wall and mean . i am using buoyantBoussinesqSimpleFoam. i made some changes in WallHeatFlux folder. i dont have any problem with coding.
please tell me while we are running the solver (buoyantBoussinesqSimpleFoam),
Do i change any TRANSPORT PROPERTIES / CONTROL DICT ? to get the Nusselt number ?
if so please tell me !

Thanks and Regards
vnarayana is offline   Reply With Quote

Old   May 7, 2016, 11:48
Default
  #27
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 11
Scram_1 is on a distinguished road
Hey,
Has anyone written a code to calculate the Nusselt Number for laminar forced convection for an incompressible fluid?
I have modified the icoFoam solver to solve the energy equation as well. I want to calculate the Nusselt Number now. Also, to calculate the Nusselt Number, the bulk temperature of the fluid at that cross section has to be found. Can someone guide me in this regard?

Thanks!!
Ram
Scram_1 is offline   Reply With Quote

Old   December 30, 2016, 16:52
Default
  #28
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Quote:
Originally Posted by Scram_1 View Post
Hi Santos,
I tried compiling simpleScalarFoam but its throwing up some errors which I'm not able to correct.
This is the error I'm geting. There is no simpleScalarFoam.o file in the Make directory. I'm using OpenFOAM 2.3x on Windows (Cygwin) if that's of any help

csriram91@SRIRAM-PC /cygdrive/c/Users/csriram91/Desktop/simpleScalarFoam
$ cd /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam
$ wclean

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam
$ wmake
Making dependency files...
In file included from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZoneMesh.H:33:0,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/polyMesh.H:56,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvMesh.H:50,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvCFD.H:7,
from simpleScalarFoam.C:33:
/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZone.H:46:32: fatal error: primitiveFacePatch.H: No such file or directory
#include "primitiveFacePatch.H"
^
compilation terminated.
SOURCE=simpleScalarFoam.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels/RAS -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/simpleScalarFoam.o
In file included from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZoneMesh.H:33:0,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/polyMesh.H:56,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvMesh.H:50,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvCFD.H:7,
from simpleScalarFoam.C:33:
/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZone.H:46:32: fatal error: primitiveFacePatch.H: No such file or directory
#include "primitiveFacePatch.H"
^
compilation terminated.
simpleScalarFoam.dep:3: recipe for target 'Make/cygwin64mingw-w64DPOpt/simpleScalarFoam.o' failed
make: *** [Make/cygwin64mingw-w64DPOpt/simpleScalarFoam.o] Error 1

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam

Thanks!
Ram

Hi ram,

did you solve it?
actually i am facing the same type of problem i am using opefoam4, pls help me to solve it.

thanks
srv537 is offline   Reply With Quote

Old   December 30, 2016, 16:54
Post
  #29
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
i tried to find gradT same as mention in this thread but i am getting error, files are attached.

srv@srv:~/OpenFOAM/srv-4.1/applications/solvers/nicoTempFoam$ wmake
Making dependency list for source file nicoTempFoam.C
g++ -std=c++0x -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam4/src/finiteVolume/lnInclude -I/opt/openfoam4/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam4/src/OpenFOAM/lnInclude -I/opt/openfoam4/src/OSspecific/POSIX/lnInclude -fPIC -c nicoTempFoam.C -o Make/linux64GccDPInt32Opt/nicoTempFoam.o
In file included from nicoTempFoam.C:47:0:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:89:12: error: expected primary-expression before ‘)’ token
);
^
nicoTempFoam.C:136:31: error: passing ‘const Foam::fvPatchField<double>’ as ‘this’ argument discards qualifiers [-fpermissive]
gradT.boundaryField()[patchi] = T.boundaryField()[patchi].snGrad();
^
In file included from /opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.H:592:0,
from /opt/openfoam4/src/finiteVolume/lnInclude/volFields.H:40,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:27,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:304,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvc.H:39,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvCFD.H:8,
from nicoTempFoam.C:33:
/opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.C:395:6: note: in call to ‘void Foam::fvPatchField<Type>:perator=(const Foam::UList<T>&) [with Type = double]’
void Foam::fvPatchField<Type>:perator=
^
/opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/nicoTempFoam.o' failed
make: *** [Make/linux64GccDPInt32Opt/nicoTempFoam.o] Error 1
Attached Files
File Type: c nicoTempFoam.C (5.1 KB, 10 views)
File Type: h createFields.H (1.5 KB, 8 views)
srv537 is offline   Reply With Quote

Old   December 31, 2016, 05:42
Default
  #30
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Quote:
Originally Posted by srv537 View Post
In file included from nicoTempFoam.C:47:0:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:89:12: error: expected primary-expression before ‘)’ token
);
^
Redundant comma.
Code:
        volScalarField gradT
           (
                IOobject
                (
                    "gradT",
                    runTime.timeName(),
                    mesh,
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                mesh,
           );
==>
Code:
        volScalarField gradT
           (
                IOobject
                (
                    "gradT",
                    runTime.timeName(),
                    mesh,
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                mesh
           );
Zeppo is offline   Reply With Quote

Old   December 31, 2016, 08:59
Default
  #31
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Hello Zeppo

i deleted that comma and tried to wmake but still i am getting error

/OpenFOAM/srv-4.1/applications/solvers/nicoTempFoam$ wmake
Making dependency list for source file nicoTempFoam.C
g++ -std=c++0x -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam4/src/finiteVolume/lnInclude -I/opt/openfoam4/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam4/src/OpenFOAM/lnInclude -I/opt/openfoam4/src/OSspecific/POSIX/lnInclude -fPIC -c nicoTempFoam.C -o Make/linux64GccDPInt32Opt/nicoTempFoam.o
nicoTempFoam.C: In function ‘int main(int, char**)’:
nicoTempFoam.C:136:31: error: passing ‘const Foam::fvPatchField<double>’ as ‘this’ argument discards qualifiers [-fpermissive]
gradT.boundaryField()[patchi] = T.boundaryField()[patchi].snGrad();
^
In file included from /opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.H:592:0,
from /opt/openfoam4/src/finiteVolume/lnInclude/volFields.H:40,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:27,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:304,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvc.H:39,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvCFD.H:8,
from nicoTempFoam.C:33:
/opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.C:395:6: note: in call to ‘void Foam::fvPatchField<Type>:perator=(const Foam::UList<T>&) [with Type = double]’
void Foam::fvPatchField<Type>:perator=
^
/opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/nicoTempFoam.o' failed
make: *** [Make/linux64GccDPInt32Opt/nicoTempFoam.o] Error 1
Attached Files
File Type: h createFields.H (1.5 KB, 7 views)
File Type: c nicoTempFoam.C (4.7 KB, 7 views)
srv537 is offline   Reply With Quote

Old   December 31, 2016, 09:08
Default
  #32
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
I am using openfoam4, in my code if i delete

gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();

then wmake works perfectly, so the problem is only in this line execution to calculating gradT.

and if i use to define dimension of gradT

Info<< "Reading field gradT\n" << endl;
volScalarField gradT
(
IOobject
(
"gradT",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
dimensionedScalar
(
"gradT",
DT.dimensions()/dimLength,
0
)

);

then the Error is

srv@srv:~/OpenFOAM/srv-4.1/applications/solvers/nicoTempFoam$ wmake
g++ -std=c++0x -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam4/src/finiteVolume/lnInclude -I/opt/openfoam4/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam4/src/OpenFOAM/lnInclude -I/opt/openfoam4/src/OSspecific/POSIX/lnInclude -fPIC -c nicoTempFoam.C -o Make/linux64GccDPInt32Opt/nicoTempFoam.o
In file included from nicoTempFoam.C:47:0:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:91:5: error: expected ‘)’ before ‘dimensionedScalar’
dimensionedScalar
^
nicoTempFoam.C:136:30: error: passing ‘const Foam::fvPatchField<double>’ as ‘this’ argument discards qualifiers [-fpermissive]
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();
^
In file included from /opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.H:592:0,
from /opt/openfoam4/src/finiteVolume/lnInclude/volFields.H:40,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:27,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:304,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvc.H:39,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvCFD.H:8,
from nicoTempFoam.C:33:
/opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.C:395:6: note: in call to ‘void Foam::fvPatchField<Type>:perator=(const Foam::UList<T>&) [with Type = double]’
void Foam::fvPatchField<Type>:perator=
^
/opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/nicoTempFoam.o' failed
make: *** [Make/linux64GccDPInt32Opt/nicoTempFoam.o] Error 1
srv537 is offline   Reply With Quote

Old   December 31, 2016, 10:30
Default
  #33
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Code:
Info<< "Reading field gradT\n" << endl;
volScalarField gradT
(
IOobject
(
"gradT",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
dimensionedScalar
(
"gradT",
DT.dimensions()/dimLength,
0
)

);
==>
Code:
Info<< "Reading field gradT\n" << endl;
volScalarField gradT
(
IOobject
(
"gradT",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar
(
"gradT",
DT.dimensions()/dimLength,
0
)

);
Zeppo is offline   Reply With Quote

Old   December 31, 2016, 10:50
Default
  #34
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Sir here DT is thermal diffusivity or deltaT?

code

Info<< "Reading field gradT\n" << endl;
volScalarField gradT
(
IOobject
(
"gradT",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar
(
"gradT",
DT.dimensions()/dimLength,
0
)

);


i tried as you suggested but still i am getting error

~/OpenFOAM/srv-4.1/applications/solvers/nicoTempFoam$ wmake
g++ -std=c++0x -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam4/src/finiteVolume/lnInclude -I/opt/openfoam4/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam4/src/OpenFOAM/lnInclude -I/opt/openfoam4/src/OSspecific/POSIX/lnInclude -fPIC -c nicoTempFoam.C -o Make/linux64GccDPInt32Opt/nicoTempFoam.o
nicoTempFoam.C: In function ‘int main(int, char**)’:
nicoTempFoam.C:136:30: error: passing ‘const Foam::fvPatchField<double>’ as ‘this’ argument discards qualifiers [-fpermissive]
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();
^
In file included from /opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.H:592:0,
from /opt/openfoam4/src/finiteVolume/lnInclude/volFields.H:40,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:27,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:304,
from /opt/openfoam4/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvc.H:39,
from /opt/openfoam4/src/finiteVolume/lnInclude/fvCFD.H:8,
from nicoTempFoam.C:33:
/opt/openfoam4/src/finiteVolume/lnInclude/fvPatchField.C:395:6: note: in call to ‘void Foam::fvPatchField<Type>:perator=(const Foam::UList<T>&) [with Type = double]’
void Foam::fvPatchField<Type>:perator=
^
/opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/nicoTempFoam.o' failed
make: *** [Make/linux64GccDPInt32Opt/nicoTempFoam.o] Error 1
srv@srv:~/OpenFOAM/srv-4.1/applications/solvers/nicoTempFoam$
srv537 is offline   Reply With Quote

Old   December 31, 2016, 11:44
Default
  #35
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Code:
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();
==>
Code:
gradT.boundaryFieldRef()[patchi]=T.boundaryFieldRef()[patchi].snGrad();
Zeppo is offline   Reply With Quote

Old   December 31, 2016, 13:34
Default
  #36
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
Quote:
Originally Posted by Zeppo View Post
Code:
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();
==>
Code:
gradT.boundaryFieldRef()[patchi]=T.boundaryFieldRef()[patchi].snGrad();

Thank you so much sir
it is working perfectly .

Sir last question,

label patchi = mesh.boundaryMesh().findPatchID("HEATEDWALL");

if i change the geometry and name of patchi (surface) then i have to go to solver and modify its patchi name and then use wmake everytime.
is there any solution for this so i dont need to change solver everytime.

thanks again sir
srv537 is offline   Reply With Quote

Old   December 31, 2016, 15:10
Default
  #37
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Quote:
Originally Posted by srv537 View Post
label patchi = mesh.boundaryMesh().findPatchID("HEATEDWALL");

if i change the geometry and name of patchi (surface) then i have to go to solver and modify its patchi name and then use wmake everytime.
is there any solution for this so i dont need to change solver everytime.
Yes, you can do it in the FOAM-way: create a dictionary-file somewhere in your case directory with
Code:
patchName yourPatchName;
In your code write:
Code:
const dictionary dic ("ralative/path/to/the/file/with/your/patchName");
if(dic.found("patchName")
{
    const word patchName = dic.lookup("patchName");
    const label patchi = mesh.boundaryMesh().findPatchID(patchName);
}
Zeppo is offline   Reply With Quote

Old   January 2, 2017, 05:02
Default
  #38
Member
 
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10
srv537 is on a distinguished road
i have added in my solver

//specify patch name

const dictionary dic ("/home/saurav/OpenFOAM/srv-4.1/run/icoTempFoam/constant/patchName");
if(dic.found("patchName"))
{
const word patchName = dic.lookup("patchName");
const label patchi = mesh.boundaryMesh().findPatchID(patchName);
}


i have created a file in constant/patchName

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

patchName heatedWall;


// ************************************************** *********************** //



but i am getting error


Calculating gradT
#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigSegv::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 ? at ??:?
#4 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#5 ? at ??:?
Segmentation fault (core dumped)
srv537 is offline   Reply With Quote

Old   January 2, 2017, 05:59
Default
  #39
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Now you have to locate yourself the specific line in the code which causes the error.
Zeppo 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
Problem with decomposePar tool vinz OpenFOAM Pre-Processing 18 January 26, 2011 03:17
UDF for Nusselt Number preibie FLUENT 1 November 16, 2010 22:28
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


All times are GMT -4. The time now is 21:17.