|
[Sponsors] |
December 14, 2021, 08:33 |
lookup 'rho' in scalarcoded source
|
#1 |
Member
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10 |
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 Code:
Ksource = rho*eps; 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 |
|
December 14, 2021, 10:05 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
You will likely need codeInclude and codeLibs etc to do what are want. You will need to read some docs.
|
|
Tags |
dimensioned scalars, fvoptions, kepsilon, scalarcodedsource |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.com] swak4foam compiling issues on a cluster | saj216 | OpenFOAM Installation | 5 | January 17, 2023 17:05 |
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 | tlcoons | OpenFOAM Installation | 13 | April 20, 2016 18:34 |
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 | Seroga | OpenFOAM Community Contributions | 9 | June 12, 2015 18:18 |
[swak4Foam] swak4Foam-groovyBC build problem | zxj160 | OpenFOAM Community Contributions | 18 | July 30, 2013 14:14 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 06:18 |