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

Need an array with cell height values

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2019, 05:09
Post Need an array with cell height values
  #1
New Member
 
Join Date: Aug 2017
Posts: 4
Rep Power: 8
Mira is on a distinguished road
What is it mean?

4:16: error: request for member 'component' in '((const Foam::dimensioned<double>*)this)->Foam::dimensioned<double>::value_', which is of non-class type 'const double'
value_.component(d)
~~~~~~~^~~~~~~~~

Here is the problem code:

forAll ( mesh.C(), celli)
{
const cell & cc = mesh.cells()[celli];
labelList pLabels(cc.labels(ff));
pointField pLocal(pLabels.size(), vector::zero);

forAll (pLabels, pointi)
pLocal[pointi] = pp[pLabels[pointi]];

scalar y1Dim = Foam::max(pLocal & vector(0,1,0)) - Foam::min(pLocal & vector(0,1,0));
yDim[celli]= y1Dim;

}

This code from the thread Cell size (x,y,z). Thanks for Niels.

I need an array with cell height values. yDim is the dimentioned scalar.

Any help will be greatly appreciated.

Thanks,
Mira is offline   Reply With Quote

Old   July 16, 2019, 05:32
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Mira View Post
What is it mean?

4:16: error: request for member 'component' in '((const Foam::dimensioned<double>*)this)->Foam::dimensioned<double>::value_', which is of non-class type 'const double'
value_.component(d)
~~~~~~~^~~~~~~~~

Here is the problem code:

forAll ( mesh.C(), celli)
{
const cell & cc = mesh.cells()[celli];
labelList pLabels(cc.labels(ff));
pointField pLocal(pLabels.size(), vector::zero);

forAll (pLabels, pointi)
pLocal[pointi] = pp[pLabels[pointi]];

scalar y1Dim = Foam::max(pLocal & vector(0,1,0)) - Foam::min(pLocal & vector(0,1,0));
yDim[celli]= y1Dim;

}

This code from the thread Cell size (x,y,z). Thanks for Niels.

I need an array with cell height values. yDim is the dimentioned scalar.

Any help will be greatly appreciated.

Thanks,



Without the dimensions, you could simply try with the following:


Code:
scalarList yDims(mesh.nCells());

boundBox cellBb;

for (const celli < mesh.nCells(); ++celli)
{
    cellBb.clear();
    cellBb.add(mesh.points(), mesh.cellPoints(celli));
    yDim[celli] = cellBb.span().y();
}
Haven't tested it, but seems to be what you are looking for. Note that I've placed the cell bound box outside of the loop for two reasons: (1) allocation, (2) to avoid implicit parallel reduction. If you want to place it inside of the loop and as a single constructor, you should use the following:

Code:
for (const celli < mesh.nCells(); ++celli)
{
    boundBox cellBb(mesh.points(), mesh.cellPoints(celli), false);
    yDim[celli] = cellBb.span().y();
}
The 'false' is to skip parallel reduction. Your code will otherwise block. If you want the fewest lines of code, the following would be it:

Code:
scalarList yDims(mesh.nCells());

for (const celli < mesh.nCells(); ++celli)
{
    yDim[celli] = boundBox(mesh.points(), mesh.cellPoints(celli), false).span().y();
}
olesen is offline   Reply With Quote

Reply


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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 11:04
Set cell volume integrated field values to preserve integral Diro7 OpenFOAM Pre-Processing 2 June 3, 2018 10:44
Neighboring cells in tetrahedral mesh vishwesh OpenFOAM Programming & Development 9 November 10, 2017 07:06
Ensight - node values -cell values leo FLUENT 1 May 12, 2010 08:47
node values or cell values? aPpA FLUENT 0 November 10, 2006 08:56


All times are GMT -4. The time now is 18:54.