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

Accessing per-block mesh information in wall-normal direction

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 4, 2020, 15:37
Default Accessing per-block mesh information in wall-normal direction
  #1
jmt
Member
 
Julian
Join Date: Sep 2019
Posts: 32
Rep Power: 7
jmt is on a distinguished road
Hi everyone,

I'm trying to write a small code that creates a mesh grading by manually modifying the location of wall-normal points in the mesh.

The geometry is a backward-facing step with three blocks as shown in the image.



I originally generated the mesh with blockMesh and I can get the points as follows:

Code:
pointField newPoints = mesh.points();
The points list is a 1D array which happens to be listed as all block 0 points, all block 1 points, and then all block 2 points. My method is to loop over all points and based on my a priori knowledge of the number of points per block, I can modify the wall-normal coordinate location appropriately.

The code looks like this for just the 0th block. I hard-code the number of points in pointsBlock0 based on what I know, but I wonder if I can retrieve this from the API. Then, I track a global point index to modify the list.

Code:
    scalar pointIndex = 0;
    // Block 0  
    vector pointsBlock0(119, 32, 129);

    for (label kk = 0; kk < pointsBlock0.z(); kk++)
    {
        for (label jj = 0; jj < pointsBlock0.y(); jj++)
        {
            Info << "kk: " << kk << " jj: " << jj << " y: " << points[pointIndex][1] << nl;
            for (label ii = 0; ii < pointsBlock0.x(); ii++)
            {
                points[pointIndex][1] = ... // some new calculated y-location to satisfy grading
                pointIndex++;
            }
        }
My question is: Is there some ability in the points API to get the dimensions of each block so I don't have to hard-code these point values?

Or is there some more elegant way to only modify the wall-normal portions of each coordinate? All wall-normal points in a given streamwise-spanwise plane need the same adjustment, but this adjustment is different for each streamwise-spanwise plane.

Last edited by jmt; November 4, 2020 at 15:39. Reason: typo in the code
jmt 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
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 09:54
[blockMesh] OpenFoam - Block Mesh - identify a wall when wall is only part of a face of a block michu OpenFOAM Meshing & Mesh Conversion 6 June 26, 2015 14:07
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Radiation interface hinca CFX 15 January 26, 2014 18:11
Multicomponent fluid Andrea CFX 2 October 11, 2004 06:12


All times are GMT -4. The time now is 07:47.