CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to creat a new volScalarField?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2017, 10:01
Default How to creat a new volScalarField?
  #1
New Member
 
Join Date: Jan 2016
Posts: 15
Rep Power: 10
SH_Zhong is on a distinguished road
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
SH_Zhong is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 06:28
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
make a dimensionedScalar to be volScalarField sharonyue OpenFOAM Programming & Development 4 April 2, 2014 05:44
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 06:16


All times are GMT -4. The time now is 23:10.