Kbshariff |
December 14, 2021 07:33 |
lookup 'rho' in scalarcoded source
1 Attachment(s)
Hello foamers,
I want to add a source term to k-epsilon model. I I want to extract the value of 'rho' define by openfoam. My source term for k is of the form
I defined my source term as:
Code:
kSource
{
type scalarCodedSource;
selectionMode all;
fields (k);
name kSource;
codeCorrect
#{
#};
codeConstrain
#{
#};
codeAddSup
#{
scalarField& kSource = eqn.source();
Info<< "Reading density rho\n" << endl;
dimensionedScalar rho (transportProperties.lookup("rho"));
const scalar Io_ = 0.08;
const scalar Kin_ = pow((Io_*2.7),2);
const scalar epsin_ = pow(0.09,0.75)*pow(Kin_,1.5)/3.5;
const labelList& cellIDs = cells();
forAll(cellIDs,i)
{
label cellI = cellIDs[i];
kSource[cellI] -=rho*epsin_;
}
#};
}
I have this error message
Code:
ln: ./lnInclude
dep: codedFvOptionTemplate.C
Ctoo: codedFvOptionTemplate.C
/dlocal/run/8991139/constant/fvOptions.kSource: In member function ‘virtual void Foam::fv::kSourceFvOptionscalarSource::addSup(Foam::fvMatrix<double>&, Foam::label)’:
/dlocal/run/8991139/constant/fvOptions.kSource:61:25: error: ‘transportProperties’ was not declared in this scope
/dlocal/run/8991139/constant/fvOptions.kSource:71:19: error: no match for ‘operator-=’ (operand types are ‘double’ and ‘Foam::dimensionedScalar {aka Foam::dimensioned<double>}’)
/dlocal/run/8991139/constant/fvOptions.kSource: In member function ‘virtual void Foam::fv::kSourceFvOptionscalarSource::addSup(const volScalarField&, Foam::fvMatrix<double>&, Foam::label)’:
/dlocal/run/8991139/constant/fvOptions.kSource:61:25: error: declaration of ‘Foam::dimensionedScalar rho’ shadows a parameter
/dlocal/run/8991139/constant/fvOptions.kSource:61:25: error: ‘transportProperties’ was not declared in this scope
/dlocal/run/8991139/constant/fvOptions.kSource:71:19: error: no match for ‘operator-=’ (operand types are ‘double’ and ‘Foam::dimensionedScalar {aka Foam::dimensioned<double>}’)
make: *** [Make/linux64GccDPInt32Opt/codedFvOptionTemplate.o] Error 1
|