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

post-processing to calculate a new tensor variable from results

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 15, 2024, 03:44
Default post-processing to calculate a new tensor variable from results
  #1
New Member
 
HagawaArashi
Join Date: Mar 2023
Posts: 4
Rep Power: 3
HagawaArashi is on a distinguished road
hello everyone! I encounter a problem about post-processing.
I want to use "volTensorField grad(U)" to obtain the viscous dissipation field.
first, I calculate the grad(U), and then use the tensor calculus in OpenFOAM to obtain the volScalarField viscousDissipation.
But the code only can perform in "0/", neglecting the result file at latest time.
As a result, the "viscousDissipation" field can only be found in "0/", others are empty.
So how can I perform the code also in other time named files?
Sincerely wish some advice!Thank you!

And my code is follows, it can be complied successfully without any error:

Quote:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "fvCFD.H"

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

volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);

volScalarField viscousDissipation
(
IOobject
(
"viscousDissipation",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("viscousDissipation", dimensionSet(1,-1,-3,0,0,0,0),0.0)
);

volTensorField Symmetry_ =fvc::grad(U);
forAll(mesh.C(), cellI)
{
Symmetry_[cellI] = symm(Symmetry_[cellI]);
}

forAll(mesh.C(), cellI)
{
viscousDissipation[cellI] = 2 * operator||(Symmetry_[cellI], Symmetry_[cellI]);
}

viscousDissipation.write();
return 0;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
HagawaArashi is offline   Reply With Quote

Old   March 15, 2024, 12:26
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Take a look at various utilities that use the timeSelector and thus have the "-latestTime" (and other time selection methods). You need to place a loop over selected times.



See, for example, applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C as one of the simplest examples that I can think of.
olesen 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
Problem: Cannot get Results to work in post processing mattsarg55 Visualization & Post-Processing 0 August 5, 2019 10:50
Post processing journal - like .cst in CFD Post Jiricbeng FLUENT 0 April 24, 2019 08:08
Post processing alternatives to Paraview? NadineHS Visualization & Post-Processing 2 February 9, 2019 16:43
How to visualize/ calculate applied heat source during post processing lavoz CFX 2 June 1, 2012 04:35
Post Processing in FEM Abhijit Tilak Main CFD Forum 0 April 26, 2004 11:59


All times are GMT -4. The time now is 18:00.