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)

Goutam March 1, 2012 05:32

my_SimpleFoam solver problem
 
I am using OpenFOAM-2.1.0. I have tried to use my_simpleFoam. I did wclean and wmake and got 1 error.
readSIMPLEControls.H: no such file or directory.

I checked in src/finitevloume/lnInclude/...

There is no such file.

Could you please tell me how to solve this problem ...

Thanks

akidess March 1, 2012 05:53

Goutam, I think your question has already been answered. See post #22 and onward in this thread.

Goutam March 1, 2012 06:05

Quote:

Originally Posted by akidess (Post 347051)
Goutam, I think your question has already been answered. See post #22 and onward in this thread.


Thanks Akidess...

I have seen this after I reply to the post. Sorry.

Thanks again.

libia87 June 19, 2012 04:13

Hi!
I'm trying to add concentration following the tutorial "how to add temperature to icoFoam", but I'm using buoyantboussinesqPimpleFoam and it doesn't work, anyone knows why??
when I do the WMAKE appears that error:

Making dependency list for source file my_buoyantBoussinesqPimpleFoam.C
could not open file readTransportProperties.H for source file my_buoyantBoussinesqPimpleFoam.C
SOURCE=my_buoyantBoussinesqPimpleFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I../buoyantBoussinesqSimpleFoam -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/turbulenceModels -I/opt/openfoam210/src/turbulenceModels/incompressible/RAS/lnInclude -I/opt/openfoam210/src/transportModels -I/opt/openfoam210/src/transportModels/incompressible/singlePhaseTransportModel -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/my_buoyantBoussinesqPimpleFoam.o
In file included from my_buoyantBoussinesqPimpleFoam.C:61:
createFields.H:47:41: error: readTransportProperties.H: No existe el fichero o el directorio
In file included from my_buoyantBoussinesqPimpleFoam.C:61:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:52: error: ‘laminarTransport’ was not declared in this scope
createFields.H:64: error: ‘beta’ was not declared in this scope
createFields.H:64: error: ‘TRef’ was not declared in this scope
In file included from my_buoyantBoussinesqPimpleFoam.C:86:
TEqn.H:2: error: ‘Prt’ was not declared in this scope
TEqn.H:5: error: ‘Pr’ was not declared in this scope
/opt/openfoam210/src/finiteVolume/lnInclude/readTimeControls.H:38: warning: unused variable ‘maxDeltaT’
make: *** [Make/linux64GccDPOpt/my_buoyantBoussinesqPimpleFoam.o] Error 1

msrinath80 August 7, 2012 14:27

Hello Martin,

Thanks very much for the clear explanation and the modified sources. Your mySimpleFoam solver is indeed very useful. I wonder however, if you can point me in the right direction for my task (described below):

Basically your solver is a steady-state conjugate heat transfer solver, in that it solved for the flow field first, then advects temperature using that flow field. The energy equation has a diffusion term and a source term (viscous dissipation).

Is it possible to modify the solver to do the following instead. I want to make the viscosity of the flowing material a function of the scalar T. Basically, if the scalar T is within a certain range, I want the material to have viscosity X, and if it is within another range, I want it to have viscosity Y. I of course assume that X will be roughly the same order as Y (i.e. no sharp discontinuities).

I look forward to your response.

Thanks in advance for your help!

Best Regards,
Srinath

Quote:

Originally Posted by MartinB (Post 329943)
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


MartinB August 7, 2012 14:41

Hi Srinath,

you should modify the viscosity model to be dependent on your scalar T. You can find the viscosity models here:
OpenFOAM-2.1.x/src/transportModels/incompressible/viscosityModels/
If your scalar T is temperature, then there is Arrhenius shift or WLF shift to describe temperature dependent viscosities and which can be easily implemented in OpenFOAM.
Can you post your specific function for nu(T) or nu(T, shear rate)?

Martin

msrinath80 August 7, 2012 14:47

Hello again Martin,

Thanks very much for the really prompt reply. Here is my exact situation. I need the viscosity in the flow problem to change depending on my value of my scalar T. Think of 'T' as being some kind of species concentration as opposed to temperature.

If a<=T<=b, then nu = X

else if

b<=T<=c then nu = Y

Is this feasible?

Thanks once again for your help!

Best Regards,
Srinath

Quote:

Originally Posted by MartinB (Post 375879)
Hi Srinath,

you should modify the viscosity model to be dependent on your scalar T. You can find the viscosity models here:
OpenFOAM-2.1.x/src/transportModels/incompressible/viscosityModels/
If your scalar T is temperature, then there is Arrhenius shift or WLF shift to describe temperature dependent viscosities and which can be easily implemented in OpenFOAM.
Can you post your specific function for nu(T) or nu(T, shear rate)?

Martin


MartinB August 7, 2012 16:46

2 Attachment(s)
Hi Srinath,

here is a template for fine tuning.

In srinathSimpleFoam.tar.gz you find a solver based on simpleFoam with scalar transport of T. Furthermore there is a viscosity model with name "scalarDependentViscosity" which must be compiled with "wmake libso" (or use the Allwmake script). The results are a user library for your new viscosity model and the solver itself. The srinathSimpleFoam solver already links against the viscosity model. To use it in other solvers or utilities you can include it in the controlDict with
Code:

libs ("libuserscalarDependentViscosity.so" "libOpenFOAM.so");
There is a test case attached, too. Run it with the standard sequence
Code:

blockMesh
srinathSimpleFoam

Right now only nu1 and nu2, as well as b in constant/transportProperties are used for the viscosity model. You should customize the formula in "srinathSimpleFoam/scalarDependentViscosity/scalarDependentViscosity.C" line 57ff.

To keep the solvers convergence stable you might want to change the viscosity law a bit, so that the transition from nu1 to nu2 is a bit smoother, and not "binary" as it is now.

Have fun

Martin

msrinath80 August 7, 2012 17:40

Wow Martin! That's awesome. Let me look into the code and understand it and modify it (ultimately I want this to work with BirdCarreau). I will follow up with you on this thread with my developments. Thanks once again for the really quick response!

And yes, I will use some kind of a smoothed heaviside transition between the values :-)

Thanks again for your help!

Best Regards,
Srinath

Quote:

Originally Posted by MartinB (Post 375899)
Hi Srinath,

here is a template for fine tuning.

In srinathSimpleFoam.tar.gz you find a solver based on simpleFoam with scalar transport of T. Furthermore there is a viscosity model with name "scalarDependentViscosity" which must be compiled with "wmake libso" (or use the Allwmake script). The results are a user library for your new viscosity model and the solver itself. The srinathSimpleFoam solver already links against the viscosity model. To use it in other solvers or utilities you can include it in the controlDict with
Code:

libs ("libuserscalarDependentViscosity.so" "libOpenFOAM.so");
There is a test case attached, too. Run it with the standard sequence
Code:

blockMesh
srinathSimpleFoam

Right now only nu1 and nu2, as well as b in constant/transportProperties are used for the viscosity model. You should customize the formula in "srinathSimpleFoam/scalarDependentViscosity/scalarDependentViscosity.C" line 57ff.

To keep the solvers convergence stable you might want to change the viscosity law a bit, so that the transition from nu1 to nu2 is a bit smoother, and not "binary" as it is now.

Have fun

Martin


sdharmar October 21, 2012 04:50

Hi Martin,
Thank you for sharing your mySimpleFom solver and the case. I tried to run in one of my cases but I keep on getting error massage

keyword SIMPLE is undefined in dictionary "/home/naren/OpenFOAM/naren-2.1.1/run/filmCoolingCourse1/system/fvSolution"

Any suggestion to get rid of this.

Best regards,
Suranga.

MartinB October 21, 2012 04:58

Hi Suranga,

in your fvSolution the dictionary entry for "SIMPLE" is missing. I think you run your case with a PIMPLE or PISO algorithm otherwise, so to use the mySimpleFoam solver you must add parameters for the SIMPLE algorithm.

You can have a look at the attached fvSolution file at the case attached to the mySimpleFoam solvers.

You might need to edit your fvSchemes, too: you must switch the ddtSchemes to steadyState, and probably you might want to change controlDict to use delta 1 as an iteration counter.

Martin

sdharmar October 21, 2012 09:47

Hi Martin,

Thank you for the reply. I think I have SIMPLE written in my fvSolution dictionary. Please be kind enough to go through the listing.

solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.1;
}
T
{
solver BICCG;
preconditioner DILU;
tolerance 1e-07;
relTol 0.01

U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

k
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

epsilon
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

R
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

nuTilda
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}
}

SIMPLE
{
nNonOrthogonalCorrectors 0;

residualControl
{
p 1e-5;
U 1e-5;
T 1e-5;
"(k|epsilon|omega)" 1e-3;
}
}

relaxationFactors
{
fields
{
p 0.3;
T 0.7;
}
equations
{
U 0.7;
k 0.7;
epsilon 0.7;
R 0.7;
nuTilda 0.7;
}
}


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

Still trying to figure out what's wrong with this. Thanks for your time in advance.

MartinB October 21, 2012 09:56

I can't see any obvious mistake... can you upload the case?
Or at least: 0/*, system/*, constant/transportProperties, altogether in tar.gz archive...

Martin

sdharmar October 21, 2012 10:35

2 Attachment(s)
Thanks Martin,

Herewith I have attached 0 and system directories.

Thanks.

sdharmar October 21, 2012 10:41

Sorry I couldn't attach the transportProperties to the previous reply. Here it is.


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

transportModel Newtonian;

nu nu [ 0 2 -1 0 0 0 0 ] 1e-05;
DT DT [ 0 2 -1 0 0 0 0 ] 2e-05;

CrossPowerLawCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
m m [ 0 0 1 0 0 0 0 ] 1;
n n [ 0 0 0 0 0 0 0 ] 1;
}

BirdCarreauCoeffs
{
nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06;
nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06;
k k [ 0 0 1 0 0 0 0 ] 0;
n n [ 0 0 0 0 0 0 0 ] 1;
}


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

MartinB October 21, 2012 12:47

I can't find any problem in your files... they seem to be fine for me.

You can send me your case, if you like, so I can try to run it here... I'll send you my eMail adress via boardmail...

Martin

maddalena October 23, 2012 02:48

Hello,
may a } be missing??

Quote:

Originally Posted by sdharmar (Post 387758)
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.1;
}
T
{
solver BICCG;
preconditioner DILU;
tolerance 1e-07;
relTol 0.01
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

k
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

epsilon
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

R
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}

nuTilda
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0.01;
}
}

SIMPLE
{
nNonOrthogonalCorrectors 0;

residualControl
{
p 1e-5;
U 1e-5;
T 1e-5;
"(k|epsilon|omega)" 1e-3;
}
}

relaxationFactors
{
fields
{
p 0.3;
T 0.7;
}
equations
{
U 0.7;
k 0.7;
epsilon 0.7;
R 0.7;
nuTilda 0.7;
}
}


MartinB October 23, 2012 03:53

Hi Maddalena,

you are right, the bracket is missing ;-)
oh, and a semicolon directly before the missing bracket...

Thanks

Martin

sdharmar October 24, 2012 23:17

Hi Maddalena,

Yes it worked. Thank you very much for your concern.

Best regards,
Suranga.

wlamont November 7, 2012 15:40

Hey Martin B,

I want to implement a simpler version of your srinathSimpleFoam example. I want nu to be a function of T and p (T for me is temperature) and I want to implement something like 0.0000171*pow(T/273,0.7)/(p/(8314/28.96*T). Can you modify your code to do this? I tried modifying your code but I get errors. I think it is my lack of familiarity.

Thanks,

Warren

norkistar March 13, 2013 02:57

HI, Martin, how to realize that the transport properties like nu and DT is a function of temperature in the OpenFOAM? Best regards. Can you help to send a revised solver and simple case as you revised in this topic?

Mirage12 July 18, 2013 04:07

I am using OpenFoam 2.2.0.

I downloaded the case and solver of Martin ( post 31) but i could not run the case.

Output:
Code:

abm5kor@BMH301562:~/Downloads/case_of2$ mySimpleFoam
mySimpleFoam: command not found

any idea ? :confused:

andrea.pasquali July 18, 2013 04:12

You should first compile it.
enter in the mySimpleFoam directory and run wmake.

Best
Andrea

Mirage12 July 18, 2013 04:30

As you could not the case, i copied the the simpleFoam-solver in my Home (i followed the tutorial How to add temperature to icoFoam ) and i copied the data content of mySimpleFoam.C in my my_simpleFoam.C.

The case is now working but i got same this warning for every timestep :

Code:

Time = 0.03
--> FOAM Warning :
    From function gaussConvectionScheme
    in file finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H at line 123
    Reading "/home/abm5kor/Desktop/validation/my/phi90/simp/system/fvSchemes.divSchemes.div(phi,U)" at line 33
    Unbounded 'Gauss' div scheme used in steady-state solver, use 'bounded Gauss' to ensure boundedness.
    To remove this warning switch off 'boundedGauss' in "/opt/openfoam220/etc/controlDict"
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 0.00563413, No Iterations 6
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 0.00681572, No Iterations 6
GAMGPCG:  Solving for p, Initial residual = 1, Final residual = 0.0997764, No Iterations 17
time step continuity errors : sum local = 1.07194e-05, global = -1.74168e-07, cumulative = -1.74168e-07
ExecutionTime = 2.72 s  ClockTime = 3 s

Time = 0.06

--> FOAM Warning :
    From function gaussConvectionScheme
    in file finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H at line 123
    Reading "/home/abm5kor/Desktop/validation/my/phi90/simp/system/fvSchemes.divSchemes.div(phi,U)" at line 33
    Unbounded 'Gauss' div scheme used in steady-state solver, use 'bounded Gauss' to ensure boundedness.
    To remove this warning switch off 'boundedGauss' in "/opt/openfoam220/etc/controlDict"
smoothSolver:  Solving for Ux, Initial residual = 0.282954, Final residual = 0.00049519, No Iterations 9
smoothSolver:  Solving for Uy, Initial residual = 0.500867, Final residual = 0.00099807, No Iterations 9
GAMGPCG:  Solving for p, Initial residual = 0.164892, Final residual = 0.0134685, No Iterations 8
time step continuity errors : sum local = 2.1845e-05, global = -1.18233e-07, cumulative = -2.92401e-07
ExecutionTime = 3.6 s  ClockTime = 4 s


how can fix the warning?


Thx :)

Mirage12 July 18, 2013 04:34

Quote:

Originally Posted by andrea.pasquali (Post 440474)
You should first compile it.
enter in the mySimpleFoam directory and run wmake.

Best
Andrea

Thx for your answer :)

i cannot compil it :

Code:

abm5kor@BMH301562:~/OpenFOAM/abm5kor-2.2.0/applications/solvers/my_SimpleFoam$ wmake
make: *** No rule to make target `my_SimpleFoam.dep', needed by `Make/linux64GccDPOpt/dependencies'.  Stop.

:confused:

andrea.pasquali July 18, 2013 04:34

I guess you should update the fvSchemes and fvSolutions files to the latest version you are using.
You can find these files into one of the tutorial case in your openfoam installation.
Best
Andrea

Mirage12 July 18, 2013 04:44

Do you think, that i could not compile the new solver, because i did not used the latest version of fvSchemes and fvSolutions?

Mirage12 July 18, 2013 23:34

i understood , what i mean Andrea :)
i need the latest version of fvSchemes and fvSolutions, only for running the case :)

haze_1986 August 6, 2013 23:27

Quote:

Originally Posted by libia87 (Post 367161)
Hi!
I'm trying to add concentration following the tutorial "how to add temperature to icoFoam", but I'm using buoyantboussinesqPimpleFoam and it doesn't work, anyone knows why??
when I do the WMAKE appears that error:

Making dependency list for source file my_buoyantBoussinesqPimpleFoam.C
could not open file readTransportProperties.H for source file my_buoyantBoussinesqPimpleFoam.C
SOURCE=my_buoyantBoussinesqPimpleFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I../buoyantBoussinesqSimpleFoam -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/turbulenceModels -I/opt/openfoam210/src/turbulenceModels/incompressible/RAS/lnInclude -I/opt/openfoam210/src/transportModels -I/opt/openfoam210/src/transportModels/incompressible/singlePhaseTransportModel -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/my_buoyantBoussinesqPimpleFoam.o
In file included from my_buoyantBoussinesqPimpleFoam.C:61:
createFields.H:47:41: error: readTransportProperties.H: No existe el fichero o el directorio
In file included from my_buoyantBoussinesqPimpleFoam.C:61:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:52: error: ‘laminarTransport’ was not declared in this scope
createFields.H:64: error: ‘beta’ was not declared in this scope
createFields.H:64: error: ‘TRef’ was not declared in this scope
In file included from my_buoyantBoussinesqPimpleFoam.C:86:
TEqn.H:2: error: ‘Prt’ was not declared in this scope
TEqn.H:5: error: ‘Pr’ was not declared in this scope
/opt/openfoam210/src/finiteVolume/lnInclude/readTimeControls.H:38: warning: unused variable ‘maxDeltaT’
make: *** [Make/linux64GccDPOpt/my_buoyantBoussinesqPimpleFoam.o] Error 1

add in #include readTransportProperties.H

jvd.mechanic September 24, 2013 16:43

rasInterFoam problem
 
hi every one
i have a problem with solution "damBreak" tutorial in OpenFoam with rasInterFoam solver.when i type " rasInterFoam " in terminal , it seid " rasInterFoam: command not found " !! do every one how can i solve my problem ?
version of my OpenFoam is 2.2.1 ; it hasn't rasInterFoam but in folder of interFoam ( or many of other solvers) it has "ras" and "les" folder . and my damBreak folder has " RASProperties " .:confused:

AndreasG September 25, 2013 03:50

Hey jvd.mechanic,

there is no rasInterFoam in 2.2.1. Just use interFoam as it is supports generic turbulence modeling like RAS, LES or laminar. Just set the constant/transportProperties and RAS/LESProperties according to the model you want to use.
See here:
$FOAM_SOLVERS/multiphase/interFoam line 34:
Quote:

Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.

yash.aesi April 21, 2014 07:48

Regarding adding the equation in simpleFoam solver
 
Greeting Martin and all ,
i am using OF-2.2 and i need to find scaler dissipation rate (chi) of the cold flow for that i have to add mixture fraction variance (Zvar) equation into the existing solver, as
chi= Cx * epsilon/k * Zvar
so now i had made separate my_simpleFoam solver but not getting idea how to proceed further. so can somebody guide me through this problem:)

Thank You,
Regards,
Sonu

flowAlways October 21, 2014 15:34

Hello,
Can someone please explain me.
What does adding temperature to simpleFoam solver essentially means?

Does it mean

1. That we want to obtain both the flow field and the temperature(not coupled) distribution
and if so why not use scalarTransportFoam after obtaining the flow field using simpleFoam ?

or

2. If we want to consider a strong coupling of the flow field with the temperature distribution(which effects the density and viscosity) why not use rhoSimpleFoam ?

or.

3. we consider small variations in temperature and thus density in which case we can use buoyantBoussinesqSimpleFoam.

Please if someone could illustrate. I am confused.
I want to model a burner with turbulent reacting flows and I started with laminar flow, isothermal turbulent flow and next I want to learn non-isothermal turbulent flow. But I dont understand which model will be the best suited for the last case?

pgiannatselis March 16, 2015 10:37

Quote:

Originally Posted by flowAlways (Post 515416)
Hello,
Can someone please explain me.
What does adding temperature to simpleFoam solver essentially means?

Does it mean

1. That we want to obtain both the flow field and the temperature(not coupled) distribution
and if so why not use scalarTransportFoam after obtaining the flow field using simpleFoam ?

or

2. If we want to consider a strong coupling of the flow field with the temperature distribution(which effects the density and viscosity) why not use rhoSimpleFoam ?

or.

3. we consider small variations in temperature and thus density in which case we can use buoyantBoussinesqSimpleFoam.

Please if someone could illustrate. I am confused.
I want to model a burner with turbulent reacting flows and I started with laminar flow, isothermal turbulent flow and next I want to learn non-isothermal turbulent flow. But I dont understand which model will be the best suited for the last case?

I am having trouble finding a way to modify simpleFOAM to solve for T because both DT and viscosity change with Temperature. I think that I am answering your question.

The reason why in a non-Newtonian (non-Newtonian means that viscosity changes) incompressible flow we must add T is that, like in my case, the viscosity depends to the T field. Not solving for T we do not know the viscosity and therefore we solve fore a fluid that has different properties.

I would be very thankful if somebody shared with me his experience solving a problem as complex as mine. I feel I am in a bucket with glue.

flowAlways March 19, 2015 03:41

Both effective diffusivity(DTEff) and viscosity can be updated at each step of the simulation by reading the previous temperature field and re-calculating these quantities.

I myself have done for DTEff but not for viscosity. for DTEff follow
https://openfoamwiki.net/index.php/C...mpleScalarFoam

For viscosity you can refer to
http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf

Note that what you are looking for is a very basic functionality and is available in all complex OpenFOAM solvers for instance reactingFoam calculates laminar viscosity using Sutherlands Law. However its difficult to understand these complex solvers at the first place.

Quote:

Originally Posted by pgiannatselis (Post 536531)
I am having trouble finding a way to modify simpleFOAM to solve for T because both DT and viscosity change with Temperature. I think that I am answering your question.

The reason why in a non-Newtonian (non-Newtonian means that viscosity changes) incompressible flow we must add T is that, like in my case, the viscosity depends to the T field. Not solving for T we do not know the viscosity and therefore we solve fore a fluid that has different properties.

I would be very thankful if somebody shared with me his experience solving a problem as complex as mine. I feel I am in a bucket with glue.


slashss4 December 3, 2015 01:58

Hello everyone,

Does anybody know how the wall heat flux is used with mySimpleFoam?

Best,

agustinvo December 3, 2015 05:28

Quote:

Originally Posted by slashss4 (Post 576022)
Hello everyone,

Does anybody know how the wall heat flux is used with mySimpleFoam?

Best,

Hello

there are two ways to specify it:
- with turbulentHeatFluxTemperature as a BC (you can check the code, it is easy to read)
- with groovyBC, you give the definition of the gradient of temperature as a function of the heat flux
- you give a fixedGradient (if the thermal conductivity dos not change, you will have the same heat flux along the wall)

slashss4 December 4, 2015 02:00

Dear Agustin,

Thank you for your answer. When I use turbulentHeatFluxTemperature BC, I am getting

request for volScalarField kappaEff from objectRegistry region0 failed
available objects of type volScalarField are

8
(
nut
pPrevIter
TPrevIter
k
nu
p
T
epsilon
)
error

Also, I tried to use fixedGradient BC, and heat flux value is 400 W/m^2 however, when I compared the results between Fluent and OF, walls heated the system just 1 Kelvin in OF and roughly 50 K in Fluent. I dont know what the problem is.

Best,

agustinvo December 4, 2015 04:56

Quote:

Originally Posted by slashss4 (Post 576172)
Dear Agustin,

Thank you for your answer. When I use turbulentHeatFluxTemperature BC, I am getting

request for volScalarField kappaEff from objectRegistry region0 failed
available objects of type volScalarField are

8
(
nut
pPrevIter
TPrevIter
k
nu
p
T
epsilon
)
error

Also, I tried to use fixedGradient BC, and heat flux value is 400 W/m^2 however, when I compared the results between Fluent and OF, walls heated the system just 1 Kelvin in OF and roughly 50 K in Fluent. I dont know what the problem is.

Best,

Hello

the BC works like this:
  • the heat flux is defined as
    Quote:

    q=k\nabla T={\kappa_{eff}}{\rho C_p}\nabla T
    so the BC is looking for that variable, kappaEff
  • you have to tell to the BC how it is called your kappaEff. In your solver you should have this term in your temperature equation, defined as
    Quote:

    \kappa_{eff}=\kappa+\kappa_t=\frac{k}{\rho Cp}+\frac{\nu_t}{Pr_t}=\frac{\nu}{Pr}+\frac{\nu_t}{Pr_t}
  • in your transportProperties you have to provide your rhoCp value
In case of the fixedGradient, you should give the value
Quote:

\nabla T=\frac{q}{k}=\frac{q}{{\kappa_{eff}}{\rho C_p}}

Sugajen May 30, 2017 17:28

scalar transport not working
 
Hi all,

I am relatively new to OpenFOAM. I am using OpenFOAM 4. I tried to add concentration, a scalar field, in the ways mentioned in the previous posts but unable to find it implemented in my test case. When I run the case file the entire region is filled with initial conditions of the concentrations that I specified. I have attached the codes below.
Any directions will be very helpful.
Thank you!

createfields.h
Code:

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
);

// Initializing c

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

#include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name());


singlePhaseTransportModel laminarTransport(U, phi);

// reading transport properties

Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
 IOobject
 (
 "transportProperties",
 runTime.constant(),
 mesh,
 IOobject::MUST_READ,
 IOobject::NO_WRITE
 )
);

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


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

#include "createMRF.H"

solver
Code:


#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "simpleControl.H"
#include "fvOptions.H"

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

int main(int argc, char *argv[])
{
    #include "postProcess.H"

    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createControl.H"
    #include "createFields.H"
    #include "createFvOptions.H"
    #include "initContinuityErrs.H"

    turbulence->validate();

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

    Info<< "\nStarting time loop\n" << endl;

    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;

        // --- Pressure-velocity SIMPLE corrector
        {
            #include "UEqn.H"
            #include "cEqn.H"
            #include "pEqn.H"

        }

        laminarTransport.correct();
        turbulence->correct();



        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }

    Info<< "End\n" << endl;

    return 0;
}


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

cEqn:
Code:



fvScalarMatrix cEqn
(
 //  fvm::ddt(c)
  fvm::div(phi, c)
 - fvm::laplacian(Ds, c)
);

cEqn.relax();
cEqn.solve().initialResidual();



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