|
[Sponsors] |
How to call function that operates cell-wise on many fields |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 6, 2016, 15:15 |
How to call function that operates cell-wise on many fields
|
#1 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Dear all,
My model transports N chemical species. The distribution of each species in the domain is a volScalarField. These fields are grouped in a PtrList<volScalarField>. Now, I want to call a function foo that, for each cell, takes the amount of all species, calculate a new amount of them, and changes the volScalarFields accordingly. A pseudocode of that could be: Code:
PtrList< volScalarField > species; int numberOfSpecies = species.size(); int numberOfCells = species[0].size(); PtrList< scalar > cellComposition (numberOfSpecies); for (int j=0; j<numberOfCells; j++){ for (int i=0; i<numberOfSpecies; i++) cellComposition.set(i, species[j][i]); foo(cellComposition); } Could you please share your ideas on how you would solve this problem and how one could take advantage of the existing infrastructure in OpenFOAM to run it in parallel? Best regards, Thomas |
|
Tags |
chemical reaction, parallel calculation, volscalarfield list |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] How to define to right point for locationInMesh | Mirage12 | OpenFOAM Meshing & Mesh Conversion | 7 | March 13, 2016 15:07 |
Compiling User Fortran with CFX 14.0 on Win64 | Raijin Thunderkeg | CFX | 29 | March 9, 2016 12:45 |
Journal file error | magicalmarshmallow | FLUENT | 3 | April 4, 2014 13:25 |
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 |