|
[Sponsors] |
October 27, 2020, 04:48 |
use of pointers in openfoam
|
#1 |
New Member
kenan
Join Date: Sep 2012
Posts: 9
Rep Power: 14 |
Hi all,
Because I am new to C++ programming and the OpenFOAM templates and tools, I have a rather simple question. I need to collect extra data for postprocessing (via fieldAverage) in every time step. Code:
//Calculate gradU and distribute to scalar Fields gradU = fvc::grad(U); gradux = gradU.component(tensor::XX); graduy = gradU.component(tensor::XY); graduz = gradU.component(tensor::XZ); gradvx = gradU.component(tensor::YX); gradvy = gradU.component(tensor::YY); gradvz = gradU.component(tensor::YZ); gradwx = gradU.component(tensor::ZX); gradwy = gradU.component(tensor::ZY); gradwz = gradU.component(tensor::ZZ); Code:
volScalarField gradux ( IOobject ( "gradux", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("gradux", dimensionSet(0,0,-1,0,0,0,0), 0.0) ); Thanks for the help! |
|
October 29, 2020, 17:30 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
Later, when you want to use any of these fields as a volField, they should be wrapped with a std::move() to get move semantics on construction. Of course you need to do that yourself, the compiler and class definitions won't do it for you. |
||
Tags |
field average, pointers, postprocessing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Frequently Asked Questions about Installing OpenFOAM | wyldckat | OpenFOAM Installation | 3 | November 14, 2023 12:58 |
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 | cfd.direct | OpenFOAM Announcements from Other Sources | 2 | August 31, 2015 14:36 |
OpenFOAM Foundation Releases OpenFOAM v2.3.0 | opencfd | OpenFOAM Announcements from OpenFOAM Foundation | 3 | December 23, 2014 04:43 |
Suggestion for a new sub-forum at OpenFOAM's Forum | wyldckat | Site Help, Feedback & Discussions | 20 | October 28, 2014 10:04 |
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 | wyldckat | OpenFOAM Announcements from Other Sources | 3 | September 8, 2010 07:25 |