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

Fill a volScalarField

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   November 17, 2010, 13:44
Default Fill a volScalarField
  #1
Member
 
Diego Villa
Join Date: Mar 2010
Location: Genova Italy
Posts: 37
Rep Power: 16
DiegoNaval is on a distinguished road
Hi All,
I start to try to programming in OF only in the last month, so sorry if I ask some stupid things.
I have created a volScalarField and with a boolList I want fill the value inside each cells. In particular if the bool is equal true, the cell value should be 1 otherwise should be 0.

I post the volScalarField costructor:
volScalarField alfa
(
IOobject
(
"alfa",
fileName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_
);

and the costructor of the boolList:

boolList zoneCell(mesh_.nCells(), false);
const labelList& cellLabels = mesh_.cellZones()[cellZoneID_];
forAll(cellLabels, i)
{
zoneCell[cellLabels[i]] = true;
}

obviously mesh_ is a reference to the fvMesh.

If someone can help me I'll be very great-full.

Diego
DiegoNaval is offline   Reply With Quote

 

Tags
boollabel, volscalarfield


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
How to create initiate a volScalarField p without reading from disk NO_READ does not seem to work dbxmcf OpenFOAM Running, Solving & CFD 14 March 25, 2022 06:08
if-loop, volScalarField comparison volker OpenFOAM 7 March 6, 2020 20:03
Problems with creating a volScalarField georlade OpenFOAM Programming & Development 4 December 4, 2016 12:31
Confused about how OF handles operation between volScalarField and dimensionedScalar Edy OpenFOAM 3 September 30, 2010 10:07
dimensioned volScalarField lions85 OpenFOAM 1 November 12, 2009 02:41


All times are GMT -4. The time now is 12:39.