CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   adding temperature to simpleFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/84480-adding-temperature-simplefoam.html)

waters January 31, 2011 09:27

adding temperature to simpleFoam
 
Hello,

Has any of you foamers added temperature to simpleFoam successfully?

Regards,

Carlos

elvis February 1, 2011 11:23

Hi,

maybe this link helps you http://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam

waters February 5, 2011 09:07

Thanks Elvis, I'm building it. It is taking me a while to understand how to implement the Temperature equation for a "steady state" for simpleFoam. I am making analogies with the buoyantBoussinesqSimpleFoam solver in a first step, but I am not sure.

Anyway, up to the 12th iteration I get an error message. If I make a step forward implementing simpleTempFoam, i'll post it here.

Thanks again,

Carlos

bhh February 6, 2011 00:51

Hi,
Instead of implementing temperature yourself you could use rhoSimpleFoam. This solver has already the solution of the enthalpy equation included.
rgds
Bjorn

waters February 6, 2011 02:35

Hi Bjorn,

Is it possible to use water as heat transfer media in rhoSimpleFoam? I haven't been able to change perfectGas in the thermophysicalproperties file.

bhh February 6, 2011 03:28

Ok, I did not realize that your problem had water as medium. So, you probably need to implement the temperature equation after all.

Have you by the way checked the thermomodel:
icoPolynomial Incompressible polynomial equation of state, e.g. for liquids
as indicated in the User Manual?

rgds
Bjorn

NickolasPl June 1, 2011 10:19

Hello everyone,

I m a relatively new foamer and I mostly work with simpleFoam. I wanted as well to add temperature calculation for my flow as Carlos, so I followed as Bjorn suggested the rhosimpleFoam solver and the instructions from OpenFoam Wiki on how to add temperature to IcoFoam. A lot of erros appeared at the first place but I managed to overcome them, builded the new solver with the temperature and no errors appear. I use Paraview for postprocessing and the problem is that U,p, nu (I work with non - Newtonian flow) is printed normally but I cannot see anywhere the T variable to select to view the results. Did anybody had that problem?I would appreciate any comments.

Kindly,

Nickolas

NickolasPl June 1, 2011 10:21

Also, in the past I have succesfully carried out the addition of temperature to icoFoam and Paraview gave me the results as suggested from OpenFoam Wiki about that subject.

Thanx

MartinB June 1, 2011 10:43

Hi Nickolas,

just a guess, but have you defined the scalarField for T with option "IOobject::AUTO_WRITE"?
Code:

Info << "Reading field T\n" << endl;
    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE // <---- T should be written out
        ),
        mesh
    );

Beside of that you can force T to be written out with:
Code:

T.write()
near the end of your code.

Martin

NickolasPl June 1, 2011 10:48

Yes that is correct. Below I m sending the createFields.H file of my created solver:

Info << "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info << "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

//adding from here
Info<< "Reading field T\n" <<endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
//to here

# include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);


singlePhaseTransportModel laminarTransport(U, phi);


dimensionedScalar DT
(
mesh.solutionDict().subDict("SIMPLE").lookup("DT")
);


autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)




So besides that I can add at the end the line you suggested and leave the option IOobject::AUTO_WRITE the same?

MartinB June 1, 2011 10:57

The AUTO_WRITE option is fine, don't know why it doesn't work.

You can add the T.write() additionally, for example in your runTime loop:
Code:

while (runTime.loop())
    {
        . . .
        . . .
        if (runTime.outputTime())
            T.write();
    }

or at the very end of your solver:
Code:

    . . .
    }
    T.write();
    Info<< "End\n" << endl;

Martin

NickolasPl June 1, 2011 13:35

4 Attachment(s)
Martin,

First of all thanks a lot for the useful information.
I tried the method you told me but the problem still remains the same. So I found a similar solver to see if things work out, the solver is the buoyantBoussinesqSimpleFoam. I modified my simpleFoam solver to match with the Boussinesq one. Actually at Boussinesq there is already the code on how to add the temperature but I think in my case I dont implement it correct.

I'm attaching some of the files of the solver to check if I have done anything wrong. Please, I m open to any thoughts, comments!

Kindly,

Nickolas

MartinB June 1, 2011 16:54

2 Attachment(s)
Hi Nickolas,

in the attachment you find the reviewed solver and a test case.

I made two minor changes to your solver in createFields.H and TEqn.H, have a look at comments with "@ Nickolas:".

To run the test case use:
blockMesh
my_simpleFoam

You can run it in parallel, too. It's configured for 4 cpu cores.

Have fun

Martin

NickolasPl June 2, 2011 13:13

Hi Martin,

With your suggestions I was able to perform the simulations and the temperature was calculated! Thank you very much. I am now able to understand the code better. Nontheless, I need to validate my results with the theory to check if everythhing works ok, but for the time being the temperature field is plotted.

I have another question concerning the "relaxation factors" that I see in the "fvsolution" file. How these factors affect the results of the simulation and I would like to know if there any standard values. Does it have to do with the flow field (meaning Newtonian approximation, non - Newtonian approximation) or the mesh? Or is it just a short of numerical technique? I found OpenFOAM very interesting and I would like to learn as much as possible although I m not very strong at c++. Do you happen to know any books or internet sites for me to study regarding these matter?

Again thanks a lot for your comments!

Kindly,

Nickolas

greel September 12, 2011 11:21

Quote:

Originally Posted by MartinB (Post 310195)
Hi Nickolas,

in the attachment you find the reviewed solver and a test case.

I made two minor changes to your solver in createFields.H and TEqn.H, have a look at comments with "@ Nickolas:".

To run the test case use:
blockMesh
my_simpleFoam

You can run it in parallel, too. It's configured for 4 cpu cores.

Have fun

Martin

Hi
I have taken this file to add Temperature to the simpleFoam solver, I have followed the the instructions in the openfom wiki, but I'm having an error.
Cheers.

Quote:

usuarioubuntu@SAN1496UBU:/opt/openfoam200/applications/solvers/incompressible/my_simpleFoam$ wmake
Making dependency list for source file my_simpleFoam.C
/opt/openfoam200/wmake/scripts/addCompile: 53: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 57: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 59: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 60: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 61: cannot create my_simpleFoam.dep: Permission denied
/opt/openfoam200/wmake/scripts/addCompile: 62: cannot create my_simpleFoam.dep: Permission denied
make: *** [my_simpleFoam.dep] Error 2

akidess September 13, 2011 02:22

Andres, /opt/ is a directory that can only be written to with administrator rights. If you compile the solver in your home directory all should be well.

greel September 13, 2011 10:44

Quote:

Originally Posted by akidess (Post 323867)
Andres, /opt/ is a directory that can only be written to with administrator rights. If you compile the solver in your home directory all should be well.

Hi Anton, thanks for your answer. I have tried to compile the solver in home directory, but I get a new error. Sorry but I don´t have to much experience working with linux, so some instructions are dificult to follow.
Quote:

usuarioubuntu@SAN1496UBU:~/myfoam$ wmake
SOURCE=my_simpleFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/turbulenceModels -I/opt/openfoam200/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/my_simpleFoam.o
my_simpleFoam.C:54:40: fatal error: readSIMPLEControls.H: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Error 1

akidess September 13, 2011 11:15

Did you execute wclean before you tried to wmake again?

greel September 13, 2011 11:19

Quote:

Originally Posted by akidess (Post 323976)
Did you execute wclean before you tried to wmake again?

No, i haven´t executed wclean.

Quote:

usuarioubuntu@SAN1496UBU:~/myfoam$ wclean
usuarioubuntu@SAN1496UBU:~/myfoam$ wmake
Making dependency list for source file my_simpleFoam.C
could not open file readSIMPLEControls.H for source file my_simpleFoam.C
SOURCE=my_simpleFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/turbulenceModels -I/opt/openfoam200/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/my_simpleFoam.o
my_simpleFoam.C:54:40: fatal error: readSIMPLEControls.H: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Error 1
thanks!

akidess September 13, 2011 11:24

Does readSIMPLEcontrols.H exist in "/opt/openfoam200/src/finiteVolume/lnInclude/"?

greel September 13, 2011 11:30

readSIMPLEcontrols.H doesn´t exist !

akidess September 13, 2011 11:41

Ah, of course not! You are trying to compile a solver made for OpenFoam 1.6! In version 2.0, readSIMPLEcontrols.H has been replaced by simpleControl.H. Try replacing the include in my_simpleFoam.C. I can't guarantee you it will work, but it's worth a try. If it doesn't work, take simpleFoam from version 2.0 and add the modifications from this thread to it.

greel September 13, 2011 12:47

I have change the line, re-compile but a new error appear.
I will try to rewrite the new "solver" from 0, because this is for an older version of foam.
thanks for all!
Quote:

Making dependency list for source file my_simpleFoam.C
SOURCE=my_simpleFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/turbulenceModels -I/opt/openfoam200/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/my_simpleFoam.o
In file included from /opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:36:0,
from my_simpleFoam.C:54:
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControl.H: In function ‘int main(int, char**)’:
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControl.H:39:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam200/src/finiteVolume/lnInclude/solutionControl.H:149:0,
from /opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:36,
from my_simpleFoam.C:54:
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:28:38: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:29:1: error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:34:26: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:35:1: error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:40:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:41:1: error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:46:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/solutionControlI.H:47:1: error: a function-definition is not allowed here before ‘{’ token
In file included from my_simpleFoam.C:54:0:
/opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:40:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam200/src/finiteVolume/lnInclude/simpleControl.H:109:0,
from my_simpleFoam.C:54:
/opt/openfoam200/src/finiteVolume/lnInclude/simpleControlI.H:30:19: error: ‘Foam::simpleControl’ has not been declared
/opt/openfoam200/src/finiteVolume/lnInclude/simpleControlI.H:31:1: error: a function-definition is not allowed here before ‘{’ token
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
/opt/openfoam200/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘cumulativeContErr’
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Error 1

greel September 13, 2011 13:49

I have copied the simpleFoam from /opt/openfoam200/applications/solvers/incompressible, to /home/usuarioubuntu/myfoam directory, then I rename the simpleFoam.C to mysimpleFoam.C, also I have changed the "files" in the Make subdirectory.
Quote:

mysimpleFoam.C

EXE = $(FOAM_APPBIN)/mysimpleFoam
But when I try to compile the solver I´m getting a new error :(
Quote:

usuarioubuntu@SAN1496UBU:~/myfoam/simpleFoam$ wclean
usuarioubuntu@SAN1496UBU:~/myfoam/simpleFoam$ wmake
Making dependency list for source file mysimpleFoam.C
SOURCE=mysimpleFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/turbulenceModels -I/opt/openfoam200/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/mysimpleFoam.o
g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/turbulenceModels -I/opt/openfoam200/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam200/src/transportModels -I/opt/openfoam200/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam200/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed Make/linuxGccDPOpt/mysimpleFoam.o -L/opt/openfoam200/platforms/linuxGccDPOpt/lib \
-lincompressibleTurbulenceModel -lincompressibleRASModels -lincompressibleTransportModels -lfiniteVolume -lOpenFOAM -ldl -lm -o /opt/openfoam200/platforms/linuxGccDPOpt/bin/mysimpleFoam
/usr/bin/ld: cannot open output file /opt/openfoam200/platforms/linuxGccDPOpt/bin/mysimpleFoam: Permission denied
collect2: ld returned 1 exit status
make: *** [/opt/openfoam200/platforms/linuxGccDPOpt/bin/mysimpleFoam] Error 1

Bernhard September 14, 2011 01:51

Try to replace FOAM_APPBIN in Make/files with FOAM_USER_APPBIN

The error message says that you don't have write permission in the default appbin.

greel September 14, 2011 13:19

amazing!! I was able to compile and run a test case of the icofoam+temperature solver.
Thanks Anton!!!

robbirobocop September 22, 2011 05:37

Quote:

Originally Posted by MartinB (Post 310195)
Hi Nickolas,

in the attachment you find the reviewed solver and a test case.

I made two minor changes to your solver in createFields.H and TEqn.H, have a look at comments with "@ Nickolas:".

To run the test case use:
blockMesh
my_simpleFoam

You can run it in parallel, too. It's configured for 4 cpu cores.

Have fun

Martin

I downloaded those files and when I try to run the case you attached it is always telling me:

--> FOAM FATAL IO ERROR:
keyword div((nuEff*dev(T(grad(U))))) is undefined in dictionary "/home/.../incompressible/my_simpleFoam/case/system/fvSchemes::divSchemes"

file: /home/.../incompressible/my_simpleFoam/case/system/fvSchemes::divSchemes from line 32 to line 40.

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

FOAM exiting

Any suggestions?

MartinB September 22, 2011 09:39

1 Attachment(s)
Hi Rob,

as the error message says you must add an entry for div((nuEff*dev(T(grad(U))))) in the fvSchemes file.

Attached is a fvSchemes file for OpenFOAM 2.0.x.

Good luck

Martin

robbirobocop September 22, 2011 11:31

Wow, that was quite simple. Sometimes you won't see the wood for trees.
The case is running now. Thank you very much.

I have yet another question. Is it possible to add two internalField scalars for the temperature?
I have 2 pipes connected to each other which swap heat directly. I need that kind of option, a nonuniform list of scalars did not work out.

robbirobocop September 23, 2011 03:28

Still won't work.
 
1 Attachment(s)
Yeah, actually the solver was working ( I did not get an error message ).
But unfortunately the temperature was not solved with the p and U equation. It was not even read. When I performed the 'wmake' command in the console, I got this error message:

Code:

SOURCE=my_simpleFoam.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra  -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository  -ftemplate-depth-100 -I/opt/openfoam201/src/turbulenceModels  -I/opt/openfoam201/src/turbulenceModels/incompressible/RAS/RASModel  -I/opt/openfoam201/src/transportModels  -I/opt/openfoam201/src/transportModels/incompressible/singlePhaseTransportModel  -I/opt/openfoam201/src/finiteVolume/lnInclude -IlnInclude -I.  -I/opt/openfoam201/src/OpenFOAM/lnInclude  -I/opt/openfoam201/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o  Make/linuxGccDPOpt/my_simpleFoam.o
In file included from /opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:36:0,
                from my_simpleFoam.C:54:
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControl.H: In function ‘int main(int, char**)’:
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControl.H:39:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam201/src/finiteVolume/lnInclude/solutionControl.H:149:0,
                from /opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:36,
                from my_simpleFoam.C:54:
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:28:38: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:29:1:  error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:34:26: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:35:1:  error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:40:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:41:1:  error: a function-definition is not allowed here before ‘{’ token
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:46:19: error: ‘Foam::solutionControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/solutionControlI.H:47:1:  error: a function-definition is not allowed here before ‘{’ token
In file included from my_simpleFoam.C:54:0:
/opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:40:1: error: ‘namespace’ definition is not allowed here
In file included from /opt/openfoam201/src/finiteVolume/lnInclude/simpleControl.H:109:0,
                from my_simpleFoam.C:54:
/opt/openfoam201/src/finiteVolume/lnInclude/simpleControlI.H:30:19: error: ‘Foam::simpleControl’ has not been declared
/opt/openfoam201/src/finiteVolume/lnInclude/simpleControlI.H:31:1:  error: a function-definition is not allowed here before ‘{’ token
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
/opt/openfoam201/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘cumulativeContErr’
my_simpleFoam.C:80:1: error: expected ‘}’ at end of input
make: *** [Make/linuxGccDPOpt/my_simpleFoam.o] Fehler 1

Any kind of help would be very appreciated.
I tried to figure it out myself with no outcome.

MartinB September 23, 2011 04:52

2 Attachment(s)
Hi Rob,

here is the solver and a case for OpenFOAM 2.0.x. Please be aware, that the name of the solver is mySimpleFoam.

Martin

maddalena September 30, 2011 05:34

Thank you Martin for sharing!

Toorop October 3, 2011 08:21

1 Attachment(s)
Hi,

I have recently pegged away at simpleScalarFoam as well and came up with this:
Code:

// --- Scalar Transport
    T.storePrevIter();
    for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
    {
        volScalarField DTEff = DT+turbulence->nut()/0.7;
        fvScalarMatrix TEqn
        (
        fvm::div(phi, T) - fvm::laplacian(DTEff, T)
        );
        TEqn.relax();
        TEqn.solve();
    }

The attached version is basically the wiki contribution with all the unnecessary stuff ripped off. Here's a great discussion about the issue (scalar transport) and I would draw your attention to Daniel's comment about the turbulent diffusivity.

I use these schemes for the scalar transport:
Code:

grad(T)        Gauss linear;
div(phi,T)    Gauss Gamma 1.0;
laplacian((DT+(nut|0.7)),T)    Gauss linear limited 1.0;

I'm not an expert, so feel free to correct me if I'm wrong and share your ideas! ;)

This is quite a basic implementation, so it would be nice to add some cool feature like residence time calculation, source terms, ... If I have any progress on this, I will post it as well.

NickolasPl October 27, 2011 11:16

Viscous Dissipation
 
Hello everybody,

I m studying polymer rheology under different types of geometry. To do that I work in simpleFoam switching off the turbulent part as the flow is creeping laminar with Re<<1. In the past I sucessfully added the temperature equation on simpleFoam by the help of Martin. However, this equation lacks of the viscous dissipation part that contributes for the frictional loss which at the moment I need to study. In the created file TEqn.H I declared the heat equation as below but I dont know how to insert the viscosity (I use a Newtonian fluid so this is actually the laminar viscosity). The file is:


fvScalarMatrix TEqn
(

fvm::div(phi, T)
- fvm::laplacian(alpha, T)
== (1/rho*Cp)*(2*(VISCOSITY??)*symm(fvc::grad(U)) && fvc::grad(U))

);

TEqn.relax();

eqnResidual = TEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);


Hoping that I ve written the equation correctly....can anybody help me out on how to insert the viscosity??I have tried to insert it as: nu(), nuEff() but it didnt work out (in each case it was reported that....'nu'or 'nuEff' is not declared in this scope).

Thanks in advance!

Nickolas

MartinB October 28, 2011 19:22

2 Attachment(s)
Hi Nickolas,

you can try the attached solver (for OpenFOAM 2.0.x) and case.

Comments are added to the code and the case.

Increase of temperature is calculated via controlDict (4.585 K) and nearly matches to the appropriate formula for high viscous newtonian fluids (4.73 K).

Ah, and you can access the viscosity for your formula with "laminarTransport.nu()".

Martin

Alhasan January 1, 2012 09:34

hey,
thanks for sharing the solver .. it works really fine, the only problem I'm having is I'm not getting any T on the paraView .. when i try to view it but I'm getting the results in the folder, any suggestions... to what i could do to get the T in the paraView along with P and U which I'm getting :)
regards,
hasan.

Alhasan January 1, 2012 09:35

hey,
thanks for sharing the solver .. it works really fine, the only problem I'm having is I'm not getting any T on the paraView .. when i try to view it but I'm getting the results in the folder, any suggestions... to what i could do to get the T in the paraView along with P and U which I'm getting :)
regards,
hasan.

MartinB January 1, 2012 10:04

1 Attachment(s)
Hi Hasan,

have you selected T in the "Volume Fields" list of the Object Inspector? See attached image...

Martin

Alhasan January 1, 2012 10:06

Thank you .. I'm so sorry i found... it. another doubt abt boundry conditions, can i post it here..? coz there is no reply from the foundry condition forums..?

andrea.pasquali January 25, 2012 08:39

Hi All,
I started to use the solver buoyanSimpleFoam to simulate incompressible liquid water (or "incompressible" vapour water) with temperature field.
For this I used the basicRhoThermo type in buoyanSimpleFoam where is possible to choose the incompressible thermo type. But I found some problems I posted here:
http://www.cfd-online.com/Forums/ope...implefoam.html
My model has also a porous medium.
Surfing on the forum I found this post where TEqn is added for simpleFoam solver.
I downloaded the last Martin's solvers (thanks to share it!).
Hi have two question:
1) Is it correct to use this solver for my case (liquid water or vapour water), or is it better switch off the viscous dissipation?
2) I'd like to add a thermal prop. for the porous zones. I known in OF2.0.x there is a fixedTemperature thermo prop. that add a term in the hEqn. How can "fix" this for TEqn?

Thanks for any help

Andrea


All times are GMT -4. The time now is 01:10.