|
[Sponsors] |
April 25, 2017, 11:01 |
How to creat a new volScalarField?
|
#1 |
New Member
Join Date: Jan 2016
Posts: 15
Rep Power: 10 |
Hello foamers,
I want to create a volScalarField about the sensibly enthalpy of one specie based on virtual scalar Hs ( const label speciei, const scalar p, const scalar T ) const = 0; OK, the return type is scalar, So I try to make scalar into a volScalarField. First, forAll(Hsi,celli) { Hsi[celli] = composition.Hs(i, p[celli], T[celli]); } It works fine. And for the boundaryField, volScalarField::Boundary& pBf = p.boundaryFieldRef(); volScalarField::Boundary& TBf = T.boundaryFieldRef(); volScalarField::Boundary& HsiBf = Hsi.boundaryFieldRef(); forAll(Hsi.boundaryField(), patchi) { fvPatchScalarField& TPatch = pBf.boundaryFieldRef()[patchi]; fvPatchScalarField& pPatch = TBf.boundaryFieldRef()[patchi]; fvPatchScalarField& HsiPatch = HsiBf.boundaryFieldRef()[patchi]; forAll(HsiPatch,facei) { HsiPatch[facei] = composition.Hs(i, pPatch[facei], TPatch[facei]); } } I get a lot of probelms. YEqn.H: In function ‘int main(int, char**)’: YEqn.H:54:65: error: passing ‘const volScalarField {aka const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ as ‘this’ argument of ‘Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary& Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryFieldRef() [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]’ discards qualifiers [-fpermissive] volScalarField::Boundary& TBf = T.boundaryFieldRef(); ^ YEqn.H:59:48: error: ‘class Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::Boundary’ has no member named ‘boundaryFieldRef’ fvPatchScalarField& TPatch = pBf.boundaryFieldRef()[patchi]; ^ YEqn.H:60:48: error: ‘class Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::Boundary’ has no member named ‘boundaryFieldRef’ fvPatchScalarField& pPatch = TBf.boundaryFieldRef()[patchi]; ^ YEqn.H:61:52: error: ‘class Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::Boundary’ has no member named ‘boundaryFieldRef’ fvPatchScalarField& HsiPatch = HsiBf.boundaryFieldRef()[patchi]; ^ make: *** [Make/linux64GccDPInt64Opt/reactingPolynomialDi.o] Error 1 Any advice will be appreciated! Zhong |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compressible 2D airfoil rhoSimpleFoam fatal error volScalarField none | jfournier | OpenFOAM Running, Solving & CFD | 4 | September 28, 2017 07:28 |
execFlowFunctionObjects - unknown field problem | Toorop | OpenFOAM Post-Processing | 16 | March 14, 2016 04:25 |
using chemkin | JMDag2004 | OpenFOAM Pre-Processing | 2 | March 8, 2016 23:38 |
make a dimensionedScalar to be volScalarField | sharonyue | OpenFOAM Programming & Development | 4 | April 2, 2014 06:44 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 07:16 |