转载自: https://jibranhaider.weebly.com/blog/mesh-information-in-openfoam。

Updated: 29/04/2019
When developing your own code in OpenFOAM, it is almost certain that access to mesh information will be required in order to evaluate various parameters. In this post, I have provided a short description on how to access some of this information which could come in handy while programming. These have been characterized into mesh connectivities, mesh coordinates and some other useful mesh data.

Connectivities

// CELLS
const labelListList& cellPoints = mesh.cellPoints();        // Cell to point connectivity
const labelListList& cellEdges =  mesh.cellEdges();         // Cell to edge connectivity
const cellList& cells = mesh.cells();                       // Cell to face connectivity
const labelListList& cellCells =  mesh.cellCells();         // Cell to cell connectivity
// FACES
const faceList& faces = mesh.faces();                       // Face to node connectivity
const labelListList& faceEdges = mesh.faceEdges();          // Face to edge connectivity
const labelList& faceOwner = mesh.faceOwner();              // Face to owner cell
const labelList& faceNeighbour = mesh.faceNeighbour();      // Face to neighbour cell
// POINTS
const labelListList& pointPoints = mesh.pointPoints();      // Point to point connectivity
const labelListList& pointEdges = mesh.pointEdges();        // Point to edge connectivity
const labelListList& pointFaces = mesh.pointFaces();        // Point to face connectivity
const labelListList& pointCells = mesh.pointCells();        // Point to cell connectivity
// EDGES
const edgeList& edges = mesh.edges();                       // Edge to point connectivity
const labelListList& edgeFaces = mesh.edgeFaces();          // Edge to face connectivity
const labelListList& edgeCells = mesh.edgeCells();          // Edge to cell connectivity

Coordinates

const volVectorField& C = mesh.C();                         // Cell center coordinates
const surfaceVectorField& Cf = mesh.Cf();                   // Face center coordinates
const pointField& points = mesh.points();                   // Point coordinates// EXAMPLE: COMPUTE EDGE CENTRE COORDINATES
#include "vectorList.H"
vectorList Ce(edges.size(), vector::zero);                  // Edge centre coordinates
forAll(edges, edge)
{const label& own = edges[edge][0];                      // Label of owner pointconst label& nei = edges[edge][1];                      // Label of neighbour pointCe[edge] = 0.5*(points[own] + points[nei]);             // Compute edge centre coordinates
}

Boundaries

const polyBoundaryMesh& boundaryMesh = mesh.boundaryMesh();           // Boundary mesh// EXAMPLE: LOOP OVER ALL FACES
forAll(faces, face)
{if (mesh.isInternalFace(face))                                     // Check for an internal face{// Do your calculations}else                                                               // Boundary face{const label& patch = boundaryMesh.whichPatch(face);            // Boundary patchIDconst label& facei = boundaryMesh[patch].whichFace(face);      // Local boundary faceID// Do your calculations}
}// EXAMPLE: LOOP OVER FACES OF BOUNDARY PATCHES
forAll(mesh.boundary(), patch)
{const word& patchName = mesh.boundary()[patch].name();             // Boundary patch nameforAll(mesh.boundary()[patch], facei){const label& bCell = boundaryMesh[patch].faceCells()[facei];   // Boundary cellIDconst label& face = boundaryMesh[patch].start() + facei;       // FaceID// Do your calculations// U.boundaryField()[patch][facei] = vector::zero;}
}// EXAMPLE: LOOP OVER POINTS OF BOUNDARY PATCHES
forAll(mesh.boundary(), patch)
{forAll(boundaryMesh[patch].meshPoints(), pointi){const label& point = boundaryMesh[patch].meshPoints()[pointi];  // PointID// Do your calculations}
}

Other useful parameters

const scalarField& V = mesh.V();                            // Cell volumes
const surfaceVectorField& Sf = mesh.Sf();                   // Face area normal vectors
const surfaceScalarField& magSf = mesh.magSf();             // Face areas
const surfaceVectorField& N = Sf/magSf;                     // Face normal vectors
const label& nCells = mesh.nCells();                        // Total number of cells in the mesh
const label& nPoints = mesh.nPoints();                      // Total number of points in the mesh
const label& nInternalFaces = mesh.nInternalFaces();        // Number of internal faces in the mesh
const label& nInternalPoints = mesh.nInternalPoints();      // Number of internal points in

在OpenFOAM中获取网格详细信息相关推荐

  1. PHP 获取服务器详细信息

    PHP 获取系统信息,PHP 获取服务器详细信息 获取系统类型及版本号:    php_uname()                                   (例:Windows NT ...

  2. 淘宝/天猫API接口,item_sku - 淘宝商品SKU详细信息查询,淘宝/天猫获取sku详细信息 API 返回值说明

    欢迎使用淘宝API接口(item_sku - 淘宝商品SKU详细信息查询 ) 你好! 这是你使用我们的淘宝API接口获取商品详细接口说明. 测试地址:获取Key和secret 测试结果: Reques ...

  3. 淘宝/天猫如何获取sku API接口,item_sku - 获取sku详细信息

    一.接口参数说明: 通过淘宝/天猫app中分享至PC端的短链接商品ID,通过调用item_sku - 获得sku接口,可以得到接口要的商品sku详情数据. 点击获取测试key和secret 请求地址: ...

  4. Android获取歌曲详细信息

    Android获取歌曲详细信息 一.目标 二.实现方案 三.HTML方案 四.JSON方案 五.接下来 六.Finally 在<Android实现歌词笔记构思>时,构思了如何在笔记中添加歌 ...

  5. Python3 | 通过百度地图API获取商家详细信息(包括店名,地址,经纬度,电话)

    一.打开百度地图开放平台,选择Web服务API . ​​​​​​官方文档对API接口的调用描述的比较详细,在调用之前先要申请百度地图的账号,然后申请密钥,获取密钥的步骤官方也有说明. 二.通过百度地图 ...

  6. Lucene学习-深入Lucene分词器,TokenStream获取分词详细信息

    Lucene学习-深入Lucene分词器,TokenStream获取分词详细信息 在此回复牛妞的关于程序中分词器的问题,其实可以直接很简单的在词库中配置就好了,Lucene中分词的所有信息我们都可以从 ...

  7. python查看系统进程_在Python中获取操作系统的进程信息

    本文主要介绍在 Python 中使用 psutil 获取系统的进程信息. 1 概述 psutil 是 Python 的一个进程和系统工具集模块,通过使用 psutil,我们可以在 Python 中获取 ...

  8. 淘宝API接口:获取sku详细信息

    今天分享的是淘宝平台API,item_sku - 获取sku详细信息 点击注册测试地址(获取Key和secret) { "item": { "num_iid": ...

  9. 微信小程序控制台 报错 对应的服务器证书无效 控制台输入 showRequestInfo() 可以获取更详细信息 原因是ssl证书过期 重新申请即可

    微信小程序控制台 报错 对应的服务器证书无效.控制台输入 showRequestInfo() 可以获取更详细信息 报错原因:域名下的SSL证书过期 我这边报错的原因是ssl证书过期 重新申请后就好了, ...

  10. NX二次开发-UFUN获取工程图详细信息UF_DRAW_ask_drawing_info

    NX二次开发-UFUN获取工程图详细信息UF_DRAW_ask_drawing_info NX9+VS2012#include <uf.h> #include <uf_draw.h& ...

最新文章

  1. 高效办公,如何利用Python自动发送邮件
  2. 皮一皮:爸爸的地位...
  3. 【Swing编写图形用户界面】操作系统之磁盘调度算法图形界面和性能比较
  4. ASP.NET MVC 1.0 + spring.net 1.2.0.20288 + NHibernate 2.0.1.4000整合笔记(三)——NHibernate配置...
  5. [小技巧]ASP.NET Core中如何预压缩静态文件
  6. 测试常用——linux 基础命令
  7. lstm中look_back的大小选择_使用PyTorch手写代码从头构建LSTM,更深度的理解其工作原理
  8. 一位准程序员对软件行业的8个问题
  9. php size(),PHP filesize() 函数
  10. SpringMVC_1
  11. Yii 多表关联relations,需要与with()方法联合使用
  12. 1.4.PHP7.1 狐教程-环境(Mac下 PHP开发环境 配置及安装 php7.1.x nginx mysql)
  13. 8数据提供什么掩膜产品_喜茶、茶百道、书亦、古茗8月外卖热销产品数据全解析...
  14. CodeBlocks下载安装的坑,无法编译成功
  15. 照片墙 php源码,分享一个心型照片墙源码
  16. java爬虫爬取豆瓣电影_小爬虫之爬取豆瓣电影排行榜
  17. 路由器与交换机的区别?
  18. python 运行报错 Process finished with exit code -1073740791 (0xC0000409)
  19. JSP隐式对象——out对象、pageContext对象、exception对象
  20. php 二维码在线识别api

热门文章

  1. codejock suite pro 20.2 for ActiveX
  2. 备份及恢复计算机名及tcp-ip配置,tcp,ip协议,修复.docx
  3. java 视频播放_java创建简易视频播放器
  4. javascript教程
  5. 详细推导波特图增益和相位曲线
  6. 模式识别人工神经网络BP算法
  7. Reinforcement Learning[论文合集]
  8. 计算机管理用户u,discuz+uclient 手动提升普通用户至管理员权限网站安全 -电脑资料...
  9. Java排序算法——猴子排序(Bogo Sort)
  10. java集合框架实验心得_关于Java集合框架的总结