|
[Sponsors] |
February 2, 2022, 07:46 |
Operations on volScalarField
|
#1 |
Member
Join Date: Jun 2020
Posts: 49
Rep Power: 5 |
Hello,
I am looking for a way to perform elementwise operations on a volScalarField. Specifically I want to add/ subtract a constant scalar from every point in the Field. Do I have to define another volScalarField that contains the scalar at every point, or is it possible to directly perform the operation between the volScalarField and the scalar? Thanks for your help! |
|
February 2, 2022, 12:11 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40 |
Quote:
I assume that you have seen the https://www.openfoam.com/documentati...api/index.html docs? Not sure why you cannot simply change the primitive field. Eg (may contain errors)... Code:
volScalarField field( ....); field.primitiveFieldRef() += 100.0; field.correctBoundaryConditions(); |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error message | Bruno_Jorge | Main CFD Forum | 1 | February 5, 2019 11:12 |
namespace Foam | Argen | OpenFOAM | 4 | February 5, 2019 08:55 |
execFlowFunctionObjects - unknown field problem | Toorop | OpenFOAM Post-Processing | 16 | March 14, 2016 03:25 |
using chemkin | JMDag2004 | OpenFOAM Pre-Processing | 2 | March 8, 2016 22:38 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 06:16 |