|
[Sponsors] |
February 4, 2011, 02:47 |
nut values
|
#1 |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
Hi Foamers,
I've noticed something unusal in my pisoFoam turbulent simluation, i've been though a couple of other threads regarding relevance of nut and nutilda values, however still not clear in its implementation with the RAS models. I'm currently using the standard k-epsilon model, and the wiki article mentions on how the nut values are modeled. Looking through the code:- Code:
00117 nut_ 00118 ( 00119 IOobject 00120 ( 00121 "nut", 00122 runTime_.timeName(), 00123 mesh_, 00124 IOobject::NO_READ, 00125 IOobject::AUTO_WRITE 00126 ), 00127 autoCreateNut("nut", mesh_) 00128 ) 00129 { 00130 nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); 00131 nut_.correctBoundaryConditions(); 00132 00133 printCoeffs(); 00134 } thank you in advance, Regards, Abhinav |
|
February 4, 2011, 13:55 |
|
#2 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
I assume that this code is from the turbulence models int he src directory. What you need to do is to add another field in the createFields.H that takes the values of the nut_ field. Creating the field is simple enough:
Code:
volScalarField nuTwrite ( IOobject ( "nuTwrite", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), turbulence->nut() ); You'll probably have to update the field every time step, after the turbulence correction: Code:
turbulence->correct(); nuTwrite = turbulence->nut(); Code:
turbulence->nut(); |
|
February 7, 2011, 02:56 |
|
#3 | |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
Hello Marco,
Thanks for the prompt reply. As suggested i included another field in the createfields.h file, but when i try to compile it, it gives me the following error... Quote:
Regrads, Abhinav |
||
February 7, 2011, 09:29 |
|
#4 |
Senior Member
David Boger
Join Date: Mar 2009
Location: Penn State Applied Research Laboratory
Posts: 146
Rep Power: 17 |
Maybe you should look at something like simpleFoam as an example, which defines "turbulence" as a variable in createFields.H. Note that simpleFoam does not refer to nut explicitly but leaves its management up to the particular turbulence model instead.
__________________
David A. Boger |
|
February 7, 2011, 18:49 |
|
#5 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
boger is quite right. Are you basing this custom solver on a previous one, and if so which one. The error you are describing means that the turbulence model has not been created yet, or at all.
alphaEff is a member function of variables of the class turbulenceModel. It may also be that the turbulence model is named differently in your solver. In pisoFoam for example. the declaration is: Code:
autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); whereas in the post-processing utility wallHeatFlux it is declared Code:
autoPtr<compressible::RASModel> RASModel ( compressible::RASModel::New ( rho, U, phi, thermo() ) ); Code:
myTurbulence->nut() |
|
February 7, 2011, 18:52 |
|
#6 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
And as far as updating the turbulence model, yes that happens in the main solver loop. That way at every time step the entire turbulence model is updated, including nut.
|
|
February 8, 2011, 02:26 |
|
#7 | |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
I've based my modified solver on pisofoam, to incorporate scaler transport equation. I had a look through my createfields.H file again and like you said, turbulence is declared as:
Code:
autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); // part added volScalarField nuTwrite ( IOobject ( "nuTwrite", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), turbulence->nut() ); Code:
turbulence->correct(); nuTwrite = turbulence->nut(); When i tried running my simulation it gave me the following error: Quote:
thanks, Regards, Abhinav |
||
February 8, 2011, 06:02 |
|
#8 |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
i re-complied my files but this time i omitted the updation statement to nuTwrite ie:
Code:
turbulence->correct(); //nuTwrite = turbulence->nut(); Code:
myTurbulence->nut() Thanks in advance.... Regards, Abhinav |
|
February 8, 2011, 13:57 |
|
#9 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Creating the nutWrite field as an IOobject allows you to have a copy of the fields being written out at every timestep so that you are able to analyze it later in post-processing. In each time directory, you will end up with a nutWrite file that stores all the values of nut for your simulation.
I don't think that the write call is causing the crash, perhaps its symptomatic of it. The stack trace that is printed shows that a segFault occurred when adding who fields (likely nu and nut, since nuEff was called), and following the function calls shows that nuEff was called by divDevRhoeff. (for more information on how to read traces, check http://openfoamwiki.net/index.php/HowTo_debugging) On the surface it seems like there is a problem with the turbulence model. kEpsilon based model can have stuff like this happen if the k or epsilon values go wild. Does your solver crash immediately, or does it run for a while before it does? If it crashed immediately, check the boundary conditions for your turbulence related quantities. If it manages to run for a few timesteps, then reduce your writeInterval (in controlDict) and look at what the turbulence fields (k, epsilon, etc) look like, and if any are going to 0, infinity, or anything else odd (you can do this with paraFoam). Good luck! |
|
February 8, 2011, 14:23 |
|
#10 |
Senior Member
David Boger
Join Date: Mar 2009
Location: Penn State Applied Research Laboratory
Posts: 146
Rep Power: 17 |
Abhinav,
If changes to your nut input file are not effecting your solution, and the nut field is not being written out automatically, then I have to wonder whether the turbulence model is turned on at all. Have you checked the values in the constant/turbulenceProperties and constant/RASproperties files? Does the solver output to the screen/log file show that the turbulence equation(s) are being solved?
__________________
David A. Boger |
|
February 9, 2011, 07:06 |
|
#11 |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
Code:
nuTwrite = turbulence->nut(); My run crashes and the 2nd time step, so I checked my k and epsilon values, they seemed fine. I did notice that i now have my nuTwrite file writen to my time directory now ( just the one time step) showing me the nut values. I have values shooting up to 16 here!... is this something i should look into? I also verified the constant/turbulenceProperties Code:
FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object turbulenceProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // simulationType RASModel; Code:
RASModel kEpsilon; turbulence on; printCoeffs on; Code:
Create time Create mesh for time = 0 Reading field p Reading field U Reading field nut Reading field T Reading field source Reading transportProperties Reading diffusivity DT Reading/calculating face flux field phi Selecting incompressible transport model Newtonian Selecting turbulence model type RASModel Selecting RAS turbulence model kEpsilon kEpsilonCoeffs { Cmu 0.09; C1 1.44; C2 1.92; sigmaEps 1.3; } Thank you Marco and David for your time, your help is much appreciated! Regards, Abhinav |
|
February 9, 2011, 09:03 |
|
#12 |
Senior Member
David Boger
Join Date: Mar 2009
Location: Penn State Applied Research Laboratory
Posts: 146
Rep Power: 17 |
Frankly, since nut is calculated from k and epsilon, it's always been my feeling that it shouldn't be provided as an input file anyway. Try changing the values of k and epsilon in 0/ -- these should certainly affect your solution.
__________________
David A. Boger |
|
February 9, 2011, 13:46 |
|
#13 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
I looked at the tutorial case for pisoFoam, and noticed that it writes nut by default, so there may be something off with your turbulence model that is only being caught when we try copy its nut values to another field.
Besides looking at the initial conditions, there might be something in the way you initialize the turbulence model. Would you be able to post your createFields.H file here for us to look at? I have a hunch about something, but can't be sure until I see. |
|
February 10, 2011, 01:14 |
|
#14 |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
Here's my createfields.H file on my modified pisofoam model:-
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 ); Info<< "Reading field nut" << endl; volScalarField nut ( IOobject ( "nut", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field T\n" << endl; volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<< "Reading field source\n" << endl; volScalarField source ( IOobject ( "source", 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, IOobject::NO_WRITE ) ); Info<< "Reading diffusivity DT\n" << endl; dimensionedScalar DT ( transportProperties.lookup("DT") ); # include "createPhi.H" label pRefCell = 0; scalar pRefValue = 0.0; setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); volScalarField nuTwrite ( IOobject ( "nuTwrite", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), turbulence->nut() ); |
|
February 10, 2011, 13:34 |
|
#15 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Hmmmm, looks pretty standard here. I'm guessing the nut field that is read is similar to the one given in pisoFoam. Are you using the same boundary conditions? Initial values of nut are irrelevant, as nut is calculated from k and epsilon fields. What the 0/nut file does do is specify the boundary conditions. If you look at the cavity tutorial for pisoFoam (which is what I'm guessing where you got your 0/ directory before making modifications) the nut values everywhere are 0, but the boundary conditions show that all the walls are nutWallFunctions.
As one final resort, try changing Code:
nuTWrite = turbulence->nut(); Code:
turbulence->nut(); Code:
turbulence->nut() Code:
mesh, dimensionedScalar("nuTWrite",turbulence->nut().dimensions(),0.0) |
|
February 11, 2011, 01:40 |
|
#16 |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
Yes i've been using the same boundary conditions, except for my inlet which i calculate using groovyBC to account for parabolic profile. Well it worked!! i changed
Code:
nuTWrite = turbulence->nut(); Code:
turbulence->nut(); Thanks a ton Marco and David... really helped me get this up and running! Regards, Abhinav |
|
February 11, 2011, 13:22 |
|
#17 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
No problem. You can comment out the
Code:
turbulence->nut() Does the nut field that gets written change over time, or does it remain constant? Also, could you post a sample nuTWrite? I'm curious as to the types of fields shown. |
|
February 14, 2011, 00:31 |
|
#18 |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
Hmm my nut values dont seem to be changing with time.. here's my nuTwrite file 100 sec into my simulation....
Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.7.x | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "100"; object nuTwrite; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -1 0 0 0 0]; internalField uniform 16.6734; boundaryField { canyon { type nutWallFunction; Cmu 0.09; kappa 0.41; E 9.8; value nonuniform List<scalar> 150 ( 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.00227466 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.0026869 0.00227466 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 0.00350831 ) ; } inlet { type fixedValue; value uniform 0.0001; } outlet { type nutWallFunction; Cmu 0.09; kappa 0.41; E 9.8; value nonuniform List<scalar> 30 ( 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 ) ; } atmosphere { type symmetryPlane; } frontAndback { type empty; } } // ************************************************************************* // Code:
30 ( 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 0.0081488 ) ; Regards, Abhinav |
|
February 15, 2011, 14:18 |
|
#19 | |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Quote:
As far as the constant nut values in time, I'm not sure what to make of it without knowing more about what you are simulating, and even then I may not be able to help. If you have any data to validate against (experimental or other reliable numerical simulation) that would be best. To me it still seems odd that you are specifying nut at the inlet. Is there a physical reason for this? |
||
February 17, 2011, 02:29 |
|
#20 |
New Member
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 16 |
Yes the value turns into uniform after about 1200 sec into the simulation. I realized there was no point is actually specifying the nut values at the inlet , and as I anyway specify my u,k and epsilon values in terms of a parabolic profile(groovy BC). Nut would then be calculated from these profiles. I will be getting my results validated experimentally, planning on carrying out a monitoring exercise in my city to get data, in the meanwhile I've been looking through a couple of papers to establish my model, including the pollutant dispersion part.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
TimeVaryingMappedFixedValue | irishdave | OpenFOAM Running, Solving & CFD | 32 | June 16, 2021 07:55 |
Wrong calculation of nut in the kOmegaSST turbulence model | FelixL | OpenFOAM Bugs | 27 | March 27, 2012 10:02 |
max node values exceed max element values in contour plot | jason_t | FLUENT | 0 | August 19, 2009 12:32 |
exact face values | RubenG | Main CFD Forum | 0 | June 22, 2009 12:09 |
strange node values @ solid/fluid interface - help | JB | FLUENT | 2 | November 1, 2008 13:04 |