|
[Sponsors] |
February 4, 2016, 09:00 |
openfoam define a zero value volscalarfield
|
#1 |
New Member
Luis Lencina
Join Date: May 2010
Posts: 12
Rep Power: 16 |
Hi everyone,
I'm trying to program a solver and its need a volscalarfield that initially must be zero everywhere in the mesh and I don't want to read it from any initial condition or to write it down. Anyone know how to do it? thanks in advance Luis |
|
February 4, 2016, 11:26 |
|
#2 |
Senior Member
|
Hi,
Just an example: Code:
$ sol $ grep -r volScalarField * ...lots of output... stressAnalysis/solidDisplacementFoam/readThermalProperties.H ... $ less stressAnalysis/solidDisplacementFoam/readThermalProperties.H Another: Code:
$ src $ cd turbulenceModels/incompressible/turbulenceModel/laminar $ less laminar.C |
|
February 4, 2016, 11:57 |
|
#3 |
New Member
Luis Lencina
Join Date: May 2010
Posts: 12
Rep Power: 16 |
Thanks alexeym,
I was wondering if there were some way to avoid to create the IOobject, or at least dont have to write it down. |
|
February 4, 2016, 11:58 |
|
#4 |
Senior Member
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11 |
Hi Luis,
For example for vol scalar field alpha volScalarField Temp ( IOobject ( runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), dimensionedScalar("Temp",dimensionSet(0,0,0,0,0,0, 0),0) ); |
|
February 4, 2016, 12:22 |
|
#5 |
Senior Member
|
@LUIS1717
If you take a look at GeometricField class documentation (http://foam.sourceforge.net/docs/cpp/a00912.html, volScalarField is just a typedef GeometricField<scalar, fvPatchField, volMesh>), it can be created either as a copy of another GeometricField, or on the base of IOobject. So in brief, no, you can not avoid IOobject constructor. Surely if you really-really-really hate IOobject constructor, you can create wrapper taking field name, dimensions, and mesh as parameters and returning autoPtr. |
|
April 16, 2016, 16:16 |
|
#6 | |
Senior Member
Join Date: Mar 2009
Location: My oyster
Posts: 124
Rep Power: 17 |
Quote:
Code:
volScalarField toto ("use any combination of variables with correct dimensions"); toto *= scalar(0); |
||
Tags |
openfoam, volscalarfield, zero value |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hydrogen storage by metal hydride | longbk | FLUENT | 12 | August 1, 2023 21:13 |
HELP----Surface Reaction UDF | Ashi | Fluent UDF and Scheme Programming | 1 | May 19, 2020 22:13 |
[OpenFOAM.org] A Mac OS X of23x Development Environment Using Docker | rt08 | OpenFOAM Installation | 1 | February 28, 2016 20:00 |
OpenFOAM Training: Programming CFD Course 12-13 and 19-20 April 2016 | cfd.direct | OpenFOAM Announcements from Other Sources | 0 | January 14, 2016 11:19 |
Different define of psi uesd in pEqn.H | zqlhzx | OpenFOAM Running, Solving & CFD | 0 | December 24, 2013 09:45 |