CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   operating on a specific cellZone ??? (https://www.cfd-online.com/Forums/openfoam/64377-operating-specific-cellzone.html)

kdarc May 8, 2009 16:59

operating on a specific cellZone ???
 
Hi.
I have been able to create cellZones in my mesh, which as best as I can tell are simply sets of cell indices.

My question is about how-to:

How do I make use of cell zones??
For example, I want to give a value to a field only in a certain cellZone.

I imagine this operation to be akin to defining boundary conditions on only specific patches, but so far I have been unable to find any example code for cellZones.

I found something relevant looking in a file called mixerFvMesh.C, shown below:

const labelList& cellAddr =
cellZones()[cellZones().findZoneID("carboxen")];

forAll (cellAddr, cellI)
{
k_ads[cellI] = k0_ads*Foam::exp(-E_ads/(R_gas*T[cellI])) ; // rate of adsoption of HCHO onto carboxen [1/s]

}

Are there some .H files or other preparations I would need to get this code to compile?? A compile library??

my error output is:

cEqn.H: In function âint main(int, char**)â:
cEqn.H:5: error: no matching function for call to Foam::cellZone::cellZone()â

any help greatly appreciated.

kdarc May 11, 2009 10:47

An in-house colleague kindly sorted this out for me.

The syntax is:

const label cellZoneID = mesh.cellZones().findZoneID("carboxen");
const labelList& cellAddr = mesh.cellZones()[cellZoneID];

etc etc...


All times are GMT -4. The time now is 17:20.