|
[Sponsors] |
Perform calculations using neighbouring cell data |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Elliott Sutton
Join Date: Dec 2019
Posts: 5
Rep Power: 7 ![]() |
Hi everyone,
I'm quite new to programming with OpenFOAM and need some help. I am trying to create a new scalar field that calculates the total difference in viscosity between a given cell and all of its neighbouring cells. What is the syntax I need to get the value of a variable in a given cell and the value in all cells directly adjacent? I'm hoping to get this to work for an AMR method and to work in parallel. Thanks, Elliott |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#3 | |
New Member
Elliott Sutton
Join Date: Dec 2019
Posts: 5
Rep Power: 7 ![]() |
Quote:
I've performed the calculation as shown below, but receive the error that " 'celli' was not declared in this scope". I'm not sure how to properly declare 'celli' as any cell in the mesh. Any help would be appreciated. Declaration of the variable in the .C file, initialised based on a viscosity field: Code:
etaGrad_ ( IOobject ( "etaGrad" + name, U.time().timeName(), U.mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), eta_ ), Code:
const objectRegistry& db(); const volVectorField& U = db().lookupObject<volVectorField>("U"); const fvMesh& mesh = U.mesh(); const labelList& neighbour = mesh.cellCells[celli](); forAll(neighbour,celli) { etaGrad_[celli] += mag(eta_[celli] - eta_[neighbour[celli]]); } Code:
//- Viscosity gradient field volScalarField etaGrad_; |
||
![]() |
![]() |
![]() |
Tags |
neighbouring cells, parallel calculation, scalar field |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] what is difference between point data and cell data? | kyurinPark | ParaView | 1 | June 19, 2018 19:49 |
Run OpenFoam in 2 nodes of a cluster | WhiteW | OpenFOAM Running, Solving & CFD | 16 | December 20, 2016 01:51 |
paraview - cell data or point data on plot over line | bye bye my blue | OpenFOAM | 0 | December 13, 2016 07:07 |
Copy the data vector from a reference cell | heksel8i | OpenFOAM Programming & Development | 0 | December 2, 2016 17:51 |
[General] Creating 2D contour with Cell Data | mutto233 | ParaView | 0 | August 2, 2016 18:54 |