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 |
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!! |
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 |
openfoam 2.2.2, not working with this
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 |
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>::operator==(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>::operator[]<Foam::fvsPatchField<double> >(patchi))->Foam::fvsPatchField<Type>::operator==<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 |
finding nusselt number
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 |
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 |
Quote:
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 |
2 Attachment(s)
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>::operator=(const Foam::UList<T>&) [with Type = double]’ void Foam::fvPatchField<Type>::operator= ^ /opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/nicoTempFoam.o' failed make: *** [Make/linux64GccDPInt32Opt/nicoTempFoam.o] Error 1 |
Quote:
Code:
volScalarField gradT Code:
volScalarField gradT |
2 Attachment(s)
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>::operator=(const Foam::UList<T>&) [with Type = double]’ void Foam::fvPatchField<Type>::operator= ^ /opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/nicoTempFoam.o' failed make: *** [Make/linux64GccDPInt32Opt/nicoTempFoam.o] Error 1 |
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>::operator=(const Foam::UList<T>&) [with Type = double]’ void Foam::fvPatchField<Type>::operator= ^ /opt/openfoam4/wmake/rules/General/transform:8: recipe for target 'Make/linux64GccDPInt32Opt/nicoTempFoam.o' failed make: *** [Make/linux64GccDPInt32Opt/nicoTempFoam.o] Error 1 |
Code:
Info<< "Reading field gradT\n" << endl; Code:
Info<< "Reading field gradT\n" << endl; |
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>::operator=(const Foam::UList<T>&) [with Type = double]’ void Foam::fvPatchField<Type>::operator= ^ /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$ |
Code:
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad(); Code:
gradT.boundaryFieldRef()[patchi]=T.boundaryFieldRef()[patchi].snGrad(); |
Quote:
Thank you so much sir it is working perfectly :) :D. 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 |
Quote:
Code:
patchName yourPatchName; Code:
const dictionary dic ("ralative/path/to/the/file/with/your/patchName"); |
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::printStack(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) |
Now you have to locate yourself the specific line in the code which causes the error.
|
All times are GMT -4. The time now is 02:32. |