CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   adding temperature field to icofoam (https://www.cfd-online.com/Forums/openfoam/107390-adding-temperature-field-icofoam.html)

houkensjtu September 26, 2012 04:21

adding temperature field to icofoam
 
hi foamers!

I have followed the instruction on openfoam wiki to add a temperature field calculation to my icofoam.
I found that in my newest openfoam-2.1.1 installation, T and DT has already included in createFields.H, which means needs no change I think.
However in icoFoam.C, I found that there is no code to solve for temperature. This seems strange because temperature variables is now included in createFields.H.

And finally I wmake my icoFoam solver according to openfoam wiki and I got errors like this:

houken@ubuntu:~/OpenFOAM/houken-2.1.x/applications/solvers/my_icoFoam$ wmake
SOURCE=my_icoFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O0 -fdefault-inline -ggdb3 -DFULLDEBUG -DNoRepository -ftemplate-depth-100 -I/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude -I/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPDebug/my_icoFoam.o
my_icoFoam.C: In function ‘int main(int, char**)’:
my_icoFoam.C:104:23: error: no matching function for call to ‘ddt(<unresolved overloaded function type>)’
my_icoFoam.C:104:23: note: candidates are:
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDdt.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDdt.C:60:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const Foam::one&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDdt.C:72:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const dimensionedScalar&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDdt.C:88:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::ddt(const volScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
my_icoFoam.C:105:30: error: no matching function for call to ‘div(Foam::surfaceScalarField&, <unresolved overloaded function type>)’
my_icoFoam.C:105:30: note: candidates are:
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDiv.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDiv.C:62:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDiv.C:77:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvmDiv.C:88:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
my_icoFoam.C:106:30: error: ‘DT’ was not declared in this scope
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable]
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/readPISOControls.H:12:16: warning: unused variable ‘momentumPredictor’ [-Wunused-variable]
/home/houken/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable]
make: *** [Make/linux64GccDPDebug/my_icoFoam.o] Error 1

Sorry to paste long code here, plz help me!

Bernhard September 26, 2012 04:45

It sounds a bit unlikely to me that T and DT are created in the default icoFoam solver. In my 2.1.0 installation, these are not defined in createFields.H.

You get an errormessage at line 104, can you give the relevant part of the code that you implemented there?

houkensjtu September 26, 2012 06:12

Quote:

Originally Posted by Bernhard (Post 383671)
It sounds a bit unlikely to me that T and DT are created in the default icoFoam solver. In my 2.1.0 installation, these are not defined in createFields.H.

You get an errormessage at line 104, can you give the relevant part of the code that you implemented there?


here is the piece of code i add to icofoam.C

//add these lines...
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
);

TEqn.solve();
//done adding lines...

I just copied this from openfoam wiki...

Bernhard September 26, 2012 06:30

Then please check your createFields.H again, because I think T and DT are not properly defined.

houkensjtu September 26, 2012 06:36

Quote:

Originally Posted by Bernhard (Post 383690)
Then please check your createFields.H again, because I think T and DT are not properly defined.

Here is my creatFields.H, which I have not modified anything.
Obviously T and DT is defined here.
Only the order is different from wiki's one...


Info<< "Reading field T\n" << endl;

volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);


Info<< "Reading diffusivity DT\n" << endl;

dimensionedScalar DT
(
transportProperties.lookup("DT")
);

houkensjtu September 26, 2012 22:20

Quote:

Originally Posted by Bernhard (Post 383690)
Then please check your createFields.H again, because I think T and DT are not properly defined.

I got it.
There are many createFields.H in OF with different contents. I thought there is only one common "createFields.H" and the one I checkup is in applications/solvers/basic/laplacianFoam/ !


All times are GMT -4. The time now is 22:08.