|
[Sponsors] |
Accessing local cell index with global cell index in functionObject |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 16, 2021, 16:53 |
Accessing local cell index with global cell index in functionObject
|
#1 |
Member
Join Date: Feb 2020
Posts: 90
Rep Power: 6 |
Hello to all,
In a functionObject I am coding, I need to access the values of pressure of cellID {20, 70, 30, 50, 90}, in this order. I using a 2D square domain with 10x10 cells for testing decomposed in 2 processors. I have the following code. Code:
List<scalar> cellIds{20, 70, 30, 50, 90}; List<scalar> pValues(cellIds.size() ); const volScalarField& sField = lookupObject<volScalarField>("p"); forAll(cellIds, cellI) { pValues[cellI] = sField [ cellIds [cellI] ]; } sField[70], it will give me the following error: Code:
[1] [1] [1] --> FOAM FATAL ERROR: (openfoam-2012) [1] index 70 out of range [0,50] [1] [1] From void Foam::UList<T>::checkIndex(Foam::label) const [with T = double; Foam::label = int] [1] in file /home/pc/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/UListI.H at line 138. [1] FOAM parallel run aborting [1] [0] [0] [0] --> FOAM FATAL ERROR: (openfoam-2012) [0] index 70 out of range [0,50] [0] [0] From void Foam::UList<T>::checkIndex(Foam::label) const [with T = double; Foam::label = int] [0] in file /home/pc/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/UListI.H at line 138. [0] FOAM parallel run aborting Is it possible of access the local cellID on each processor based on the global cellID? Any builtin function to do this? Best Regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
time step continuity problem in VAWT simulation | lpz_michele | OpenFOAM Running, Solving & CFD | 5 | February 22, 2018 19:50 |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 05:28 |
dynamic Mesh is faster than MRF???? | sharonyue | OpenFOAM Running, Solving & CFD | 14 | August 26, 2013 07:47 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 07:36 |
Convergence moving mesh | lr103476 | OpenFOAM Running, Solving & CFD | 30 | November 19, 2007 14:09 |