Hi everyone,
I am modifying
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 |
Hi Gijsbert
Wish you a HAPP
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 |
Hi Jaswi,
Many thanks and a
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 |
Hi Gijsbert
Its a self writ
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 |
Hi Jaswi,
Excellent! Thank
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 |
Hi Jaswi,
When I compile th
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 |
Hi Gijsbert
The snippet pos
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 |
All times are GMT -4. The time now is 08:11. |