|
[Sponsors] |
July 13, 2017, 10:21 |
scalarCodedSource and cellZones in OF 4.x
|
#1 |
New Member
Xavier Lamboley
Join Date: Jan 2015
Location: Bordeaux, France
Posts: 13
Rep Power: 11 |
Hi everyone,
I am currently setting up a case with a time-varying volumetric energy source in OpenFOAM 4.x; I use scalarCodedSource fvOptions to achieve that, and after some research (in particular here…), I have managed to write this fvOptions file : Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // heatSource { type scalarCodedSource; active true; name sourceTime; scalarCodedSourceCoeffs { selectionMode cellSet; cellSet heaterCellSet; fields (e); codeInclude #{ #}; codeCorrect #{ Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ const Time& time = mesh().time(); const scalarField& V = mesh_.V(); scalarField& heSource = eqn.source(); const labelList& cellIDs = cells(); forAll(cellIDs, i) { label cellI = cellIDs[i]; heSource[cellI] -= 0.0001*sqr(time.value())*V[cellI]; } #}; codeSetValue #{ Pout<< "**codeSetValue**" << endl; #}; // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { $scalarCodedSourceCoeffs; } } // ************************************************************************* // Code:
const labelList& cellIDs = cells(); However, I get the following error : Code:
.../fvOptions.heatSource.scalarCodedSourceCoeffs:45:40: error: use of undeclared identifier 'cells' I also tried to replace cells() by mesh_.cells(), which does not work any better since it returns a cellList instead of a labelList. If anyone knows about this please share it with me Regards, X. Lamboley |
|
|
|