|
[Sponsors] |
Looping in parallel in template class chemistryModel |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 5, 2024, 18:39 |
Looping in parallel in template class chemistryModel
|
#1 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Hello all,
I have been updating some old OpenFOAM code (originally in v2, now in v10/11) based on the chemistryModel library where I do a calculation over all cells. I have added the virtual function to basicChemistryModel and the implementation in chemistryModel/chemistryModel.C. I am trying to just do a loop over all cells with a forAll loop, but I only get the first processor to work. I can't post the full code so I need to create a stub case, but basically (assuming a private member A_ that is a volScalarField that is registered and read in): Code:
template<class ThermoType> void Foam::chemistryModel<ThermoType>::someFunction() { tmp<volScalarField> trho(this->thermo().rho(); const volScalarField rho = trho(); scalar AVolAve = 0; scalar totalVol = 0; forAll(rho,celli) { A_[celli] = rho[celli]; //AVolAve = A_[celli]*this->mesh().V()[celli]; //totalVol = this->mesh().V()[celli]; } //reduce(AVolAve, sumOp<scalar>()); //reduce(totalVol, sumOp<scalar>()); //AVolAve /= totalVol; //Info << "Volume averaged A is: " << AVolAve << endl; } Any assistance would be welcome. Last edited by mturcios777; March 6, 2024 at 17:36. Reason: Further context on parallel issues |
|
March 16, 2024, 06:52 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
Quote:
If you replace the "Info" statement with "Pout" you will print the values on each rank, which will presumably contradict your conclusion. |
||
March 16, 2024, 06:59 |
|
#3 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fvc::div for surfaceVectorField | ARTem | OpenFOAM Programming & Development | 4 | November 2, 2018 12:41 |
[snappyHexMesh] OpenFoam in parallel with sHM and sFE | pradyumnsingh | OpenFOAM Meshing & Mesh Conversion | 4 | October 26, 2018 16:25 |
Error running openfoam in parallel | fede32 | OpenFOAM Programming & Development | 5 | October 4, 2018 16:38 |
The udf.h headers are unable to open- in VISUAL STUDIO 13 | sanjeetlimbu | Fluent UDF and Scheme Programming | 4 | May 2, 2016 05:38 |
Parallel Computing Classes at San Diego Supercomputer Center Jan. 20-22 | Amitava Majumdar | Main CFD Forum | 0 | January 5, 1999 12:00 |