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

integrate several fields

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 31, 2014, 19:35
Default
  #21
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by maalan View Post
At last I got it!! This is an example of the correct expression... I just wanted to call the value of the field on another patch...

Code:
    {
        type swakExpression;
        valueType patch;
        variables (
            "ddtUin{INLET}=(U-oldTime(U))/deltaT();"
            "ddtV{BODY}=(U-oldTime(U))/deltaT();"
        );
        patchName CYLINDER;
        accumulations (
            sum
        );
        expression "(ddtV-ddtUin)&normal()*area()";
        verbose true;
}
Now I have another problem... I know that to set a velocity ramp at the inlet one can do it by using both the uniformFixedValue function in OF and groovyBC. Well, I would like to set a ramp with the freestream BC and it's not possible to do it with 'uniformFixedValue', so is there any way to do it with groovyBC??

Thank you so much, Bernhard!!
Best!
Of course. By using the fractionExpression to switch between gradientExpression and valueExpression you can emulate something like the freestream BC
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   February 7, 2014, 06:21
Default
  #22
Member
 
Join Date: Jun 2011
Posts: 80
Rep Power: 15
maalan is on a distinguished road
Quote:
Of course. By using the fractionExpression to switch between gradientExpression and valueExpression you can emulate something like the freestream BC
Thank you bernhard, but would you mind to explain further about this BC?? I have looked for this everywhere without success!!

Best,
maalan is offline   Reply With Quote

Old   February 13, 2014, 19:54
Default
  #23
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by maalan View Post
Thank you bernhard, but would you mind to explain further about this BC?? I have looked for this everywhere without success!!

Best,
I only help with technical aspects of swak/groovyBC. The physics you've got to work out yourself.

Usually the best way is to sit down with a piece of paper "If the flow goes the BC is a Dirichlet condition with this expression else a Neuman with this gradient expression". Implementing this in groovyBC is then pretty straightforward (if you understand the meaning of the phi-field - but this has been explained numerous times here on the MessageBoard and on the Wiki)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   December 2, 2015, 18:32
Default
  #24
Member
 
Mohammad Reza
Join Date: Sep 2015
Posts: 44
Rep Power: 11
Bana is on a distinguished road
Hello everyone
I'm facing similar problem, I want to calculate surface integral of velocity multiplied by temperature in order to compute bulk temperature at each longitudinal position of a heated pipe and therefore Nusselt number in flow direction.
Do you have any idea how to implement it by swak4foam?
Thanks in advance
Bana is offline   Reply With Quote

Old   December 10, 2016, 10:48
Default
  #25
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 12
cfd@kgp is on a distinguished road
Dear Bernhard,

I am troubling you again...

I want to create a new/derived field and write it at the output time.

lets visualize a new volScalarField of mag(U).

I found out there three ways to do it---

1. edit the application/code (I want to omit this option)

2. using Swak4foam with expressionField. I tried the following in controlDict,

Quote:
velocityMagSquared
{
type expressionField;
//outputControl outputTime;
//outputInterval 1;
fieldName UMag2;
expression "U&U";
autowrite true;
}
I also get the output file written in the corresponding output/time directory.

But problem is paraview do not import thes new field, it do not have this information.

(also how do swak4Foam decide weather to create a volScalarfield or volVectorfield )

the last way is using coded function/dynamic code,

I tried this, by adding the following lines in controlDict

Quote:
compute_ptot
{
functionObjectLibs ( "libutilityFunctionObjects.so" );
type coded;
enabled true;
redirectType ptot;
// outputControl outputTime;
// outputInterval 1;
code
#{

const volVectorField& U = mesh().lookupObject<volVectorField>("U");
volScalarField ptot
(
IOobject
(
"ptot",
mesh().time().timeName(),
U.mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mag(U)
);


#};
}
I neither get any new file in the corresponding output/time directory nor any visualization..

Please give me some suggesions with option 2 or 3.

I am trying this in OF 3.x and using following libraries,
Quote:
libs (
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
"libgroovyBC.so"
"mylibfvOptions.so"

);
Thanks,
cfd@kgp is offline   Reply With Quote

Old   December 13, 2016, 18:24
Default
  #26
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by cfd@kgp View Post
Dear Bernhard,

I am troubling you again...

I want to create a new/derived field and write it at the output time.

lets visualize a new volScalarField of mag(U).

I found out there three ways to do it---

1. edit the application/code (I want to omit this option)

2. using Swak4foam with expressionField. I tried the following in controlDict,

Quote:
velocityMagSquared
{
type expressionField;
//outputControl outputTime;
//outputInterval 1;
fieldName UMag2;
expression "U&U";
autowrite true;
}
It seems I'm currently on a crusade about this: PLEASE people. Use the Code-environment (the #-icon in the message-edit-toolbar) when adding code (and OpenFOAM-dictionaries count as code) to your messages. It makes reading so much easier
Quote:
Originally Posted by cfd@kgp View Post
I also get the output file written in the corresponding output/time directory.

But problem is paraview do not import thes new field, it do not have this information.
Which flavour of paraview: the built-in reader or paraFoam? Are any messages printed to the console about problems with the files or are they just silently ignored?
Quote:
Originally Posted by cfd@kgp View Post

(also how do swak4Foam decide weather to create a volScalarfield or volVectorfield )
By looking at the valid result of a computation: in your case: inner product of two vectors is scalar. Therefor a volScalarField

Quote:
Originally Posted by cfd@kgp View Post

the last way is using coded function/dynamic code,

I tried this, by adding the following lines in controlDict

Quote:
compute_ptot
{
functionObjectLibs ( "libutilityFunctionObjects.so" );
type coded;
enabled true;
redirectType ptot;
// outputControl outputTime;
// outputInterval 1;
code
#{

const volVectorField& U = mesh().lookupObject<volVectorField>("U");
volScalarField ptot
(
IOobject
(
"ptot",
mesh().time().timeName(),
U.mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mag(U)
);


#};
}
I neither get any new file in the corresponding output/time directory nor any visualization..

Please give me some suggesions with option 2 or 3.

I am trying this in OF 3.x and using following libraries,
Quote:
libs (
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
"libgroovyBC.so"
"mylibfvOptions.so"

);
Thanks,
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   July 21, 2017, 17:10
Default
  #27
Member
 
Join Date: Jun 2011
Posts: 80
Rep Power: 15
maalan is on a distinguished road
Hi again Bernhard,

I'd like to integrate a velocity component across an interpolated plane in a 2D, O-grid. I usually dealt with swakExpressions and patch or volumes integrations. In this case, I have to fix the plane where integrating across. Can you tell me how to proceed with your tool?

Thanks in advance!
Best
maalan 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
The mysterious _0 fields stevenvanharen OpenFOAM Running, Solving & CFD 2 January 4, 2011 08:24
Missing fields in reconstructPar flowris OpenFOAM 1 July 9, 2010 03:48
domainIntegrate, dieselFoam and Lagrangian Fields mturcios777 OpenFOAM 0 May 14, 2010 16:16
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 10:15
[OpenFOAM] Integrate Variables using PAraFoam nandiganavishal ParaView 2 April 17, 2009 13:38


All times are GMT -4. The time now is 01:20.