|
[Sponsors] |
Runtime sampling various variables in Parallel |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 29, 2020, 23:38 |
Runtime sampling various variables in Parallel
|
#1 |
Member
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 35
Rep Power: 11 |
Dear OpenFOAM-Nerds,
I am trying to write a sampling code which basically averages in the homogeneous directions in my simulations domain. I have a serial code which I wanted to port to parallel case. Here is the code which I use to do my computations. I have checked it against other calculations and it gives me the right results. However, since my underlying code is DNS, I would like to port this code to a parallel mode. Could you suggest some pointers, ideas, details on how I can efficiently (to the best of your knowledge) achieve this? Thanks! Code:
//Reading the homogeneous averaging properties file Info<< "Reading averageProperties\n" << endl; IOdictionary averageProperties ( IOobject ( "averageProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); //Number of grid points in X, Y, and Z directions dimensionedVector gridPoints ( "gridPoints", dimensionSet(0, 0, 0, 0, 0, 0, 0), averageProperties ); //Declare the averaging index limit defined as Nx*Ny i.e. scalar avgIndexLimit = (gridPoints.component(0)).value()*(gridPoints.component(1)).value(); scalar cellIndex = 0; scalar indexLimit = 0; Info << "The averaging Index limit is: " << avgIndexLimit << nl << endl; //Create the collapsed profile array List<scalar> collapsedProfileZ((gridPoints.component(2)).value()); Info << "The 1D profile will be of size: " << collapsedProfileZ.size() << nl << endl; //Creating the Uavg vector scalar Uavg = 0; //Loop through all the z points forAll(collapsedProfileZ,zIndex) { while (indexLimit < avgIndexLimit) { Uavg += mag(U[cellIndex]); cellIndex += 1; indexLimit += 1; } if (indexLimit == avgIndexLimit) { //Assign the average velocity at the given z coordinate collapsedProfileZ[zIndex] = Uavg/avgIndexLimit; //Reset the indexLimit to 0 once the averaging over the homogeneous directions is done indexLimit = 0; //Reset the Uavg to 0 Uavg = 0; } } //Reset the cellIndex back to zero so that the next time step starts at cellIndex=0 cellIndex = 0; //Print the velocity profile to screen Info << collapsedProfileZ << nl << endl; Last edited by Akshay_11235; June 29, 2020 at 23:38. Reason: Incomplete question |
|
Tags |
parallel calculation, runtime processing, sampling |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
runtime postprocessing, parallel case with cyclics | Kaffeeknecht | OpenFOAM Post-Processing | 1 | April 20, 2016 11:54 |
Can not run OpenFOAM in parallel in clusters, help! | ripperjack | OpenFOAM Running, Solving & CFD | 5 | May 6, 2014 16:25 |
Runtime sampling of line | alientxtmsgs | OpenFOAM Post-Processing | 1 | April 2, 2014 22:31 |
parallel Grief: BoundaryFields ok in single CPU but NOT in Parallel | JR22 | OpenFOAM Running, Solving & CFD | 2 | April 19, 2013 17:49 |
Parallel Computing Classes at San Diego Supercomputer Center Jan. 20-22 | Amitava Majumdar | Main CFD Forum | 0 | January 5, 1999 13:00 |