|
[Sponsors] |
how to do calculation for a variable when solver runs in parallel |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 9, 2022, 15:51 |
how to do calculation for a variable when solver runs in parallel
|
#1 |
New Member
Ujjwal Chetan
Join Date: Oct 2018
Posts: 2
Rep Power: 0 |
Hello Foamers,
I wanted to get the volume integral of y-component of vorticity and print it on the terminal at run time. The code for the same is as follows; Code:
//vorticity calculation ---------------------------------------------------- volVectorField omega = fvc::curl(U); // volume integrals calculation --------------------------------------- scalar vort_volume_integral = 0; forAll(omega, cellI) { vort_volume_integral += omega[cellI][1]*mesh.V()[cellI]; } // printing data to the terminal at runtime ------------------------- Info<< "\nvorticity_y_component_volume_integral = " << vort_volume_integral << nl << endl; So, my question is, how to reassemble vorticity-volume-integral data from all the processors and add it up to print in the terminal. Thanks |
|
May 10, 2022, 05:52 |
|
#2 | |
Member
Lorenzo
Join Date: Apr 2020
Location: Italy
Posts: 46
Rep Power: 6 |
Hi,
You should add a code that collects the variable calculated by every single processor and sum it. In fact, Quote:
There are many snippets that you can find in your OpenFOAM directory regarding coding for simulations in parallel, for example in v2112 you can find them in "applications/test", just look for parallel, parallel communicators etc. In order to collect the overall vorticity, you should add something like: Code:
reduce(vort_volume_integral, sumOp<scalar>()); Hope this helps. Regards, Lorenzo |
||
Tags |
collect data, parallel calculation |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A function can only be used in serial calculation not parallel calculation | chenghui62000 | OpenFOAM Programming & Development | 1 | January 7, 2020 13:18 |
Error in gradient calculation only while parallel processing | Pavithra | OpenFOAM Running, Solving & CFD | 0 | December 23, 2019 05:32 |
Explicitly filtered LES | saeedi | Main CFD Forum | 16 | October 14, 2015 12:58 |
simpleFoam parallel | AndrewMortimer | OpenFOAM Running, Solving & CFD | 12 | August 7, 2015 19:45 |
Star cd es-ice solver error | ernarasimman | STAR-CD | 2 | September 12, 2014 01:01 |