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

integrate multiplication of fields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 31, 2020, 10:26
Default integrate multiplication of fields
  #1
New Member
 
Nikita
Join Date: Oct 2019
Posts: 20
Rep Power: 7
Chikiton is on a distinguished road
Hi foamers,
I'm doing a multhiphase task with 3 phases using multiphaseInterFoam and i want to get volume integral of the some variables and of their multiplication, for example, mass of one phase.
in the controlDict file, I want to use a function to calculate the integral for the quantity ( rho*alpha.water) during the whole calculation.
I has found this topic - integrate several fields , but in last version OpenFOAM some functions of swak4foam was included in the OpenFOAM.
I want use smth like this (code from link above)
Code:
functions
{
    makeMagU {
       type expressionField;
         functionObjectLibs
        (
            "libswakFunctionObjects.so"
        );      autowrite false;
       fieldName magU;
       expression "mag(U)";
    }
    temp_average
    {
        type volumeAverage;
        functionObjectLibs
        (
            "libsimpleFunctionObjects.so"
        );
        verbose true;
        fields (magU);
    }
}
but I don't know how to implement this in version 1912. Maybe anybody knows. Please help. Thanks.
Chikiton is offline   Reply With Quote

Old   May 31, 2020, 17:47
Default
  #2
New Member
 
Nikita
Join Date: Oct 2019
Posts: 20
Rep Power: 7
Chikiton is on a distinguished road
Update:
I saw this topic : New Documentation: OpenFOAM Expressions (reImpl of swak4Foam of Bernhard Gschaider)
But don't know how to use this documentation.
And further. saw this code to determine the field:
Code:
compute_ptot
            {
                type expressionField;
                outputControl timeStep;
                outputInterval 1;
                fieldName ptot;
                expression "p + 0.5*magSqr(U)";
                autowrite false;        
            }
but again , this function from swak4foam, and how it use in new versions OF?
Chikiton is offline   Reply With Quote

Old   June 2, 2020, 05:13
Default
  #3
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Hi,

If you need to compute the above expression only, OpenFOAM has derivedFields function object with which you can compute "pTotal".

Hope this helps.
HPE is offline   Reply With Quote

Old   June 2, 2020, 06:20
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
This is indeed one of the open points but the emphasis would actually be more on supporting expressions for surfaceFieldValue since this is where people might need to define some "weird" definition to evaluate. However, one of the constraints would is access to arbitrary fields. For patch types this is reasonably straight-forward, for faceZones it can mostly work, but also gets a bit hit-and-miss due to the face orientations, for sampled surfaces and registered surfaces it seems to be out-of-scope since it is just trying to do far too much.


For simple volume field generation, using one of the predefined one (as another poster suggested), or whip up a tiny coded function object to do the same probably makes the most sense.
olesen is offline   Reply With Quote

Old   June 2, 2020, 10:35
Default
  #5
New Member
 
Nikita
Join Date: Oct 2019
Posts: 20
Rep Power: 7
Chikiton is on a distinguished road
thanks for replies!!! I found answers in this thread - integrate multiplication of fields
Chikiton 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
surface and volume fields multiplication Zato_Ichi OpenFOAM Programming & Development 9 May 27, 2022 03:48
integrate multiplication of fields Chikiton OpenFOAM Programming & Development 16 April 15, 2022 03:48
a reconstructPar issue immortality OpenFOAM Post-Processing 8 June 16, 2013 12:25
an odd(at least for me!) reconstructPar error on a field immortality OpenFOAM Running, Solving & CFD 3 June 3, 2013 23:36
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 10:15


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