CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

integral of the gradient of a variable over a face during unsteady simulation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 19, 2017, 23:52
Default integral of the gradient of a variable over a face during unsteady simulation
  #1
New Member
 
Bingchuan
Join Date: Dec 2017
Posts: 16
Rep Power: 8
bingchuan is on a distinguished road
Hi All,

I want to get the integral of the gradient of a variable (e.g. Temperature) over a face during doing an unsteady simulation.

1. First, I computed the gradient of the variable by adding the following code into the main function of the solver, then it is compiled.

Code:
         volVectorField gradT(fvc::grad(T));

 

         volScalarField gradTx

         (

             IOobject

             (

                 "gradTx",

                 runTime.timeName(),

                 mesh,

                 IOobject::NO_READ,

                 IOobject::AUTO_WRITE

             ),

             gradT.component(vector::X)

         );

 

         volScalarField gradTy

         (

             IOobject

             (

                 "gradTy",

                 runTime.timeName(),

                 mesh,

                 IOobject::NO_READ,

                 IOobject::AUTO_WRITE

             ),

             gradT.component(vector::Y)

         );

 

         volScalarField gradTz

         (

             IOobject

             (

                 "gradTz",

                 runTime.timeName(),

                 mesh,

                 IOobject::NO_READ,

                 IOobject::AUTO_WRITE

             ),

             gradT.component(vector::Z)

         );
The gradTx, gradTy and gradTz are wrote in the time series directories. Of course I can get the integral of gradT over a face in the post-process software (e.g. paraView). However, since the computational domain is large, it is inpossilbe to to write gradT in small time interval. So I have to find another way out.

2. I planed to use the function objects. I put the patchIntegrate file in the system directory of my case, which was included by the controlDict file. The item fields in the patchIntegrate file are defined as
Code:
fields (U  gradT)
or
Code:
fields (U gradTx)
However, only integral of U over the patch were outputted successfully. No integral of gradT or gradTx such data was wrote.

3. Then I tried the singleGraph in the same way as patchIntegrate.

No gradT or gradTx such data was wrote along the line I defined neither.

Is there anyone knows how to solve this problem or anyone has better strategy to do this? Thank you very much.

kind regards,
Bingchuan
bingchuan is offline   Reply With Quote

Old   December 20, 2017, 04:46
Default
  #2
New Member
 
Bingchuan
Join Date: Dec 2017
Posts: 16
Rep Power: 8
bingchuan is on a distinguished road
Can anyone bring me a ray of light?
many Thanks.
bingchuan is offline   Reply With Quote

Old   December 20, 2017, 06:06
Default
  #3
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15
agustinvo is on a distinguished road
Hi

can you show us the case folder? At least, the controlDict file.

Quote:
it is inpossilbe to to write gradT in small time interval
what do you mean there?
agustinvo is offline   Reply With Quote

Old   December 21, 2017, 06:19
Default
  #4
New Member
 
Bingchuan
Join Date: Dec 2017
Posts: 16
Rep Power: 8
bingchuan is on a distinguished road
Dear Agustin,

Thanks for your reply.

Below is the information of my transient simulation.
1. Code added into the main function of the solver
Code:
....
  volVectorField gradT(fvc::grad(T));

 

         volScalarField gradTx

         (

             IOobject

             (

                 "gradTx",

                 runTime.timeName(),

                 mesh,

                 IOobject::NO_READ,

                 IOobject::AUTO_WRITE

             ),

             gradT.component(vector::X)

         );
....
2. The controlDict file:
Code:
....

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

adjustTimeStep  no;

maxCo           0.5;

// ************************************************************************* //
functions
{
/#includeFunc patchIntegrate
}
3. The patchIntegrate file
Code:
name   Mypatch;
fields ( U T gradT gradTx);
operation areaIntegrate;

type            surfaceRegion;
libs            ("libfieldFunctionObjects.so");
regionType  patch;

writeControl    timeStep;
writeInterval   1;
...
Goal: output the integral of fields U, T, gradT and gradTx over the given patch at every timestep using the function object patchIntegrate.

Issue: Integrals of fields U and T at every timestep have been outputted successfully. However, It is failed to output the integral of gradT and gradTx.

log information: FOAM warning: From function Foam::label Foam::sampledSets::classifyFields() in file sampledSetsGrouping.C at line 140 cannot find registered field matching gradT. (The same warning for gradTx)

Thanks.

Bests,
Bingchuan
bingchuan 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
[blockMesh] Internal walls of zero thickness anger OpenFOAM Meshing & Mesh Conversion 23 February 6, 2020 18:25
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 03:21
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 07:36
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55
Procedure to run unsteady simulation? STN Main CFD Forum 2 February 16, 2002 04:37


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