CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to call ub from current and previous times step in Oodles

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 19, 2009, 03:04
Default Hi everyone, I am modifying
  #1
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi everyone,

I am modifying the oodles solver to plot dissipation rate from the shear rate. In order to calculate the shear rate I need to call the fluctuating velocity tensor, usually something like u', during the current and from the previous time step. I have been fishing around in several solvers and source code, but have not found the right syntax yet. Can anyone point out what the syntax is or where I can (likely) find it to
1. call u'
2. call u' (or anything for that matter) from the previous time step

Many thanks in advance!

Regards, Gijsbert
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   January 19, 2009, 04:18
Default Hi Gijsbert Wish you a HAPP
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Gijsbert

Wish you a HAPPY NEW YEAR.

Now coming to your problem of calculating dissipation rate, please take a look at this snippet. It might of some help to you:

<pre>
// calculate the velocity gradient

volTensorField gradU = fvc::grad(U);

// print dimensions to log

Info << "gradU : Dimensions = " << gradU.dimensions() << endl;

// calculate the strain function

volScalarField strainFunction
(
IOobject
(
"strainFunction",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
scalar(2.0)* (
sqr(gradU.component(tensor::XX))
+ sqr(gradU.component(tensor::YY))
+ sqr(gradU.component(tensor::ZZ))
)
+ sqr( gradU.component(tensor::XY) + gradU.component(tensor::YX))
+ sqr( gradU.component(tensor::YZ) + gradU.component(tensor::ZY))
+ sqr( gradU.component(tensor::XZ) + gradU.component(tensor::ZX))
);

Info << "Strain function : Dimension = " << strainFunction.dimensions() << endl;

volScalarField nuEff = turbulence->nuEff();

Info << "Kinematic Viscosity - nuEff : Dimensions = : " << nuEff.dimensions() << endl;

volScalarField muEff = rho*nuEff;

Info << "Dynamic Viscosity - muEff :
Dimensions = : " << muEff.dimensions() << endl;

volScalarField dissipation
(
IOobject
(
"dissipation",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
muEff*strainFunction
);
</pre>

Hope it might be of some use to you...

Please let me know if you have any difficulty in adopting it to your case.

Kind Regards
Jaswi
jaswi is offline   Reply With Quote

Old   January 19, 2009, 05:10
Default Hi Jaswi, Many thanks and a
  #3
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi Jaswi,

Many thanks and a happy new year to you too!

Did you write this code snippet or did you find it from the OpenFOAM code (regarding looking for it myself and referencing)? And do you just paste this snippet in a sensible place in the solver or as a separate header file? Because usually I have things like

volScalarField dissipation
(
IOobject
(
"dissipation",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
muEff*strainFunction
);

in a separate header file like createMyFields.H or something like that. What do you advise?

Best regards,

Gijsbert
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   January 19, 2009, 05:23
Default Hi Gijsbert Its a self writ
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Gijsbert

Its a self written snippet.

Regarding where to put it , i would suggest that you place it so that it fits algorithmically .

Once the final solver works , you can then distribute the respective parts to standard headers to have a more clear structure. For now just put all this into a separate header file (name irrelevant) and include it into your solver.

Kind Regards
Jaswi
jaswi is offline   Reply With Quote

Old   January 19, 2009, 05:55
Default Hi Jaswi, Excellent! Thank
  #5
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi Jaswi,

Excellent! Thank you very much. I will try some compiling and running tomorrow and will let you know how it goes. Many thanks for your kind help!

Regards,
Gijsbert
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   January 20, 2009, 02:51
Default Hi Jaswi, When I compile th
  #6
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi Jaswi,

When I compile the solver I get the error messages that 'turbulence' and 'rho' are not declared in this scope. I added some libraries here and there, but that didn't solve it. Do I need to include some turbulence header or something?

Regards, Gijsbert
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   January 20, 2009, 08:49
Default Hi Gijsbert The snippet pos
  #7
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Gijsbert

The snippet posted above was used in a modified interfoam solver which uses a RANS solver. In your case you use a LES model. Take a look at your createFields.H , it has the following at its end:

<pre>

autoPtr<lesmodel> sgsModel
(
LESmodel::New(U, phi, laminarTransport)
);

</pre>

In my case it was :

<pre>
// Construct RANS model
autoPtr<turbulencemodel> turbulence
(
turbulenceModel::New(U, phi, twoPhaseProperties)
);

</pre>

If you change the keyword "turbulence" to "sgsModel" it should work. Also ensure that LESModel.h has the nuEff() function. check that out and let me know if that works.

Regarding the rho field, please not that oodles is a solver for incompressible flow and density is constant. its a dimensionedScalar instead of the volScalarField , which is the case for interFoam solver. (check out the creatFields.H of interFoam and you will find rho declared as volScalarField). In your case you can define rho as dimensionedScalar in createFields and then the error must go away as then in the statement:

<pre>

volScalarField muEff = rho*nuEff;

</pre>

you are just scaling the kinematic viscosity.

Let me know if you have any further doubts.

Kind Regards
Jaswi
jaswi is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF and previous time step macros Aleex FLUENT 2 January 23, 2011 09:39
Auto save at "flow times" in "adapt.time step" HANA FLUENT 0 October 2, 2008 03:15
diff. beetwen current time and current time step Tomik FLUENT 0 March 3, 2008 07:00
autosave dat.file at flow times -w.adapt.time step jsn FLUENT 1 January 11, 2008 19:30
previous time step macros Bryan FLUENT 0 January 12, 2006 15:02


All times are GMT -4. The time now is 06:44.