技术标签: OpenFOAM基础开发 openfoam utilities
OpenFoam中有很多自带的小工具,方便实用。有需要的小伙伴可以自己去下面查找,方法如下:
hty@ubuntu:~$ util
hty@ubuntu:/opt/openfoam4/applications/utilities$ ls
mesh parallelProcessing preProcessing thermophysical
miscellaneous postProcessing surface
hty@ubuntu:/opt/openfoam4/applications/utilities$
已经有博主分类整理了OpenFOAM 工具列表,并给出了每个小工具的简单介绍,需要的请自行查看。
下面将几种常用的工具初步整理如下,后续会陆续更新。有整理好的小伙伴可以call我,将不胜感激。
C o = δ t ∣ U ∣ δ x Co=\frac{\delta t|\mathbf U|}{\delta x} Co=δxδt∣U∣
y+
值非常重要,因为它可以反映网格网格正确解析边界层。通常,你也可以使用壁函数,否则在粘性子层处使用y+<5。yPlus计算并报告所有近壁单元格的y+墙修补程序,用于层流、LES和RAS的指定时间。对于应用墙功能的墙,墙函数提供y+值,否则直接获得从近壁速度梯度和有效层流粘度学。
system/simpleDict
文件。sample-help
获取可选的flag。对场进行操作:
foamCalc <calcType> <fieldName1 ... fieldnameN>
calcType 包括:
system/simpleDict
文件;fields//声明采样场
(
p
):
probeLocations//声明采样点
(
0.2 0.2 0.2
);
通过字典文件对网格序列(点、面、网格)进行操作;
需要 topoSetDict 文件;
actions
(
{
name c0;
type cellSet;
action new;
source boxTocell;
sourceInfo
{
box (0.3 0.3 0.3) (0.6 0.6 0);
}
}
);
action
种类:
源的操作类型:
主要用于多相流模型,重新定义场量信息。
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.air 1
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (0 0 0) (0.01 0.05 0.01);//对体中心在该范围的网格单元
fieldValues
(
volScalarFieldValue alpha.air 0
volScalarFieldValue alpha.water 0
);
}
);
// ************************************************************************* //
用于检查网格质量,输出信息如下:
[stu cavity]$ checkMesh
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 4.1
Exec : checkMesh
Date : Sep 28 2020
Time : 21:37:29
Host : "node01"
PID : 151764
Case : /home/student2/OpenFOAM/student2-4.1/run/cavity
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Create polyMesh for time = 0
Time = 0
Mesh stats
points: 882
internal points: 0
faces: 1640
internal faces: 760
cells: 400
faces per cell: 6
boundary patches: 3
point zones: 0
face zones: 0
cell zones: 0
Overall number of cells of each type:
hexahedra: 400
prisms: 0
wedges: 0
pyramids: 0
tet wedges: 0
tetrahedra: 0
polyhedra: 0
Checking topology...
Boundary definition OK.
Cell to face addressing OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).
Checking patch topology for multiply connected surfaces...
Patch Faces Points Surface topology
movingWall 20 42 ok (non-closed singly connected)
fixedWalls 60 122 ok (non-closed singly connected)
frontAndBack 800 882 ok (non-closed singly connected)
Checking geometry...
Overall domain bounding box (0 0 0) (0.1 0.1 0.01)
Mesh has 2 geometric (non-empty/wedge) directions (1 1 0)
Mesh has 2 solution (non-empty) directions (1 1 0)
All edges aligned with or perpendicular to non-empty directions.
Boundary openness (8.47033e-18 -8.47033e-18 -4.51751e-17) OK.
Max cell openness = 1.35525e-16 OK.
Max aspect ratio = 1 OK.//长宽比
Minimum face area = 2.5e-05. Maximum face area = 5e-05. Face area magnitudes OK.
Min volume = 2.5e-07. Max volume = 2.5e-07. Total volume = 0.0001. Cell volumes OK.
Mesh non-orthogonality Max: 0 average: 0//非正交网格数
Non-orthogonality check OK.
Face pyramids OK.
Max skewness = 1.66533e-14 OK.//网格偏斜情况
Coupled point location match (average 0) OK.
Mesh OK.
End
用于网格的移动、比例放大及旋转。
[stu run]$ ls
cavity
[stu run]$ cp -r cavity cavityTranslate
[stu run]$ touch cavityTranslate/cavityTranslate.OpenFAOM //创建一个可供paraview打开的文件
[stu run]$ transformPoints -case cavityTranslate/ -translate "(0.2 0.2 0.2)" //对网格单元进行平移
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 4.1
Exec : transformPoints -case cavityTranslate/ -translate (0.2 0.2 0.2)
Date : Sep 28 2020
Time : 22:03:41
Host : "node01"
PID : 152372
Case : ./cavityTranslate
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Translating points by (0.2 0.2 0.2)
Writing points into directory "./cavityTranslate/constant/polyMesh"
End
[stu run]$ paraview //打开paraview,比较两者差距
createBafflesDict
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object createBafflesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Sample for creating baffles:
// - usually converting internal faces into two boundary faces
// - or converting boundary faces into a boundary face
// (internalFacesOnly=false)(though should use really createPatch
// to do this)
//
// - selection of faces (and orientation) to 'baffle' through:
// faceZone:
// type faceZone;
// zoneName f0;
// searchableSurface:
// type searchableSurface;
// surface triSurfaceMesh;
// name baffle1D.stl;
//
// - specification of patches for baffle sides in one of two modes:
// - patchPairs : create two patches of same type, same input
// - patches : create patches separately, full control over what
// to create on what side
// (this mode can also create duplicate (overlapping)
// sets of baffles:
// - internalFacesOnly = false
// - have 4 entries in patches:
// - master
// - slave
// - additional master
// - additional slave)
// Whether to convert internal faces only (so leave boundary faces intact).
// This is only relevant if your face selection type can pick up boundary
// faces.
internalFacesOnly true;
// Optionally do not read/convert/write any fields.
//noFields true;
// Baffles to create.
baffles
{
baffle1
{
//- Use surface to select faces and orientation.
type searchableSurface;
surface triSurfaceMesh;
name baffle1D.stl;
//- Optional flip
//flip false;
// Generate patchGroup baffle1 with two patches:
// - baffle1_master
// - baffle1_slave
patchPairs
{
type wall;
//- Optional override of added patchfields. If not specified
// any added patchfields are of type calculated.
patchFields
{
U
{
type fixedValue;
value uniform (0 0 0);
}
}
}
}
cyclicFaces//cyclic:周期性条件
{
//- Select faces and orientation through a searchableSurface
type searchableSurface;
surface searchablePlate;
origin (0.099 -0.006 0.004);
span (0 0.012 0.012);
// Generate patches explicitly
patches
{
master
{
//- Master side patch
name fan_half0;
type cyclic;
neighbourPatch fan_half1;
patchFields
{
p
{
type fan;
patchType cyclic;
jump uniform 0;
value uniform 0;
jumpTable polynomial 1((100 0));
}
}
}
slave
{
//- Slave side patch
name fan_half1;
type cyclic;
neighbourPatch fan_half0;
patchFields
{
p
{
type fan;
patchType cyclic;
value uniform 0;
}
}
}
}
}
}
// ************************************************************************* //
加密网格
refineMesh -overwrite//对原网格进行覆盖、重写加密,这样就不会生成新的文件夹
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Cells to refine; name of cell set
set c0;// 涉及到 topoSet
// Type of coordinate system:
// - global : coordinate system same for every cell. Usually aligned with
// x,y,z axis. Specify in globalCoeffs section below.
// - patchLocal : coordinate system different for every cell. Specify in
// patchLocalCoeffs section below.
// - fieldBased : uses the list of field names from the directions list for
// selecting the directions to cut. Meant to be used with geometricCut, but
// can also be used with useHexTopology.
coordinateSystem global;
//coordinateSystem patchLocal;
//coordinateSystem fieldBased;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
}
// List of directions to refine, if global or patchLocal
directions
(
tan1
tan2
normal
);
// List of directions to refine, if "fieldBased". Keep in mind that these
// fields must be of type "vectorField", not "volVectorField".
//directions
//(
// radialDirectionFieldName
// angularDirectionFieldName
// heightDirectionFieldName
//);
// Whether to use hex topology. This will
// - if patchLocal: all cells on selected patch should be hex
// - split all hexes in 2x2x2 through the middle of edges.
useHexTopology true;
// Cut purely geometric (will cut hexes through vertices) or take topology
// into account. Incompatible with useHexTopology
geometricCut false;
// Write meshes from intermediate steps
writeMesh false;
// ************************************************************************* //
mapFields 指令可以把一个给定几何的场信息,映射到另一个几何的对应场。它通过读取被映射场(target
)算例 controlDict
文件startFrom/startTime
中指定的时间步文件夹,对原始场(source
)进行映射。详情可参考mapFields–场映射指令
文章浏览阅读3.2k次。本文研究全球与中国市场分布式光纤传感器的发展现状及未来发展趋势,分别从生产和消费的角度分析分布式光纤传感器的主要生产地区、主要消费地区以及主要的生产商。重点分析全球与中国市场的主要厂商产品特点、产品规格、不同规格产品的价格、产量、产值及全球和中国市场主要生产商的市场份额。主要生产商包括:FISO TechnologiesBrugg KabelSensor HighwayOmnisensAFL GlobalQinetiQ GroupLockheed MartinOSENSA Innovati_预计2026年中国分布式传感器市场规模有多大
文章浏览阅读1.1k次,点赞2次,收藏12次。常用组合逻辑电路结构——为IC设计的延时估计铺垫学习目的:估计模块间的delay,确保写的代码的timing 综合能给到多少HZ,以满足需求!_基4布斯算法代码
文章浏览阅读3.3k次,点赞3次,收藏5次。OpenAI Manager助手(基于SpringBoot和Vue)_chatgpt网页版
文章浏览阅读2.2k次。USACO自1992年举办,到目前为止已经举办了27届,目的是为了帮助美国信息学国家队选拔IOI的队员,目前逐渐发展为全球热门的线上赛事,成为美国大学申请条件下,含金量相当高的官方竞赛。USACO的比赛成绩可以助力计算机专业留学,越来越多的学生进入了康奈尔,麻省理工,普林斯顿,哈佛和耶鲁等大学,这些同学的共同点是他们都参加了美国计算机科学竞赛(USACO),并且取得过非常好的成绩。适合参赛人群USACO适合国内在读学生有意向申请美国大学的或者想锻炼自己编程能力的同学,高三学生也可以参加12月的第_usaco可以多次提交吗
文章浏览阅读394次。1.1 存储程序1.2 创建存储过程1.3 创建自定义函数1.3.1 示例1.4 自定义函数和存储过程的区别1.5 变量的使用1.6 定义条件和处理程序1.6.1 定义条件1.6.1.1 示例1.6.2 定义处理程序1.6.2.1 示例1.7 光标的使用1.7.1 声明光标1.7.2 打开光标1.7.3 使用光标1.7.4 关闭光标1.8 流程控制的使用1.8.1 IF语句1.8.2 CASE语句1.8.3 LOOP语句1.8.4 LEAVE语句1.8.5 ITERATE语句1.8.6 REPEAT语句。_mysql自定义函数和存储过程
文章浏览阅读188次。半导体二极管——集成电路最小组成单元。_本征半导体电流为0
文章浏览阅读2.8k次,点赞3次,收藏18次。游戏水面特效实现方式太多。咱们这边介绍的是一最简单的UV动画(无顶点位移),整个mesh由4个顶点构成。实现了水面效果(左图),不动代码稍微修改下参数和贴图可以实现岩浆效果(右图)。有要思路是1,uv按时间去做正弦波移动2,在1的基础上加个凹凸图混合uv3,在1、2的基础上加个水流方向4,加上对雾效的支持,如没必要请自行删除雾效代码(把包含fog的几行代码删除)S..._unity 岩浆shader
文章浏览阅读5k次。广义线性模型是线性模型的扩展,它通过连接函数建立响应变量的数学期望值与线性组合的预测变量之间的关系。广义线性模型拟合的形式为:其中g(μY)是条件均值的函数(称为连接函数)。另外,你可放松Y为正态分布的假设,改为Y 服从指数分布族中的一种分布即可。设定好连接函数和概率分布后,便可以通过最大似然估计的多次迭代推导出各参数值。在大部分情况下,线性模型就可以通过一系列连续型或类别型预测变量来预测正态分布的响应变量的工作。但是,有时候我们要进行非正态因变量的分析,例如:(1)类别型.._广义线性回归模型
文章浏览阅读69次。环境保护、 保护地球、 校园环保、垃圾分类、绿色家园、等网站的设计与制作。 总结了一些学生网页制作的经验:一般的网页需要融入以下知识点:div+css布局、浮动、定位、高级css、表格、表单及验证、js轮播图、音频 视频 Flash的应用、ul li、下拉导航栏、鼠标划过效果等知识点,网页的风格主题也很全面:如爱好、风景、校园、美食、动漫、游戏、咖啡、音乐、家乡、电影、名人、商城以及个人主页等主题,学生、新手可参考下方页面的布局和设计和HTML源码(有用点赞△) 一套A+的网_垃圾分类网页设计目标怎么写
文章浏览阅读614次,点赞7次,收藏11次。之前找到一个修改 exe 中 DLL地址 的方法, 不太好使,虽然能正确启动, 但无法改变 exe 的工作目录,这就影响了.Net 中很多获取 exe 执行目录来拼接的地址 ( 相对路径 ),比如 wwwroot 和 代码中相对目录还有一些复制到目录的普通文件 等等,它们的地址都会指向原来 exe 的目录, 而不是自定义的 “lib” 目录,根本原因就是没有修改 exe 的工作目录这次来搞一个启动程序,把 .net 的所有东西都放在一个文件夹,在文件夹同级的目录制作一个 exe._.net dll 全局目录
文章浏览阅读1.5k次。本文为转载,原博客地址:http://blog.csdn.net/hujingshuang/article/details/46910259简介 BRIEF是2010年的一篇名为《BRIEF:Binary Robust Independent Elementary Features》的文章中提出,BRIEF是对已检测到的特征点进行描述,它是一种二进制编码的描述子,摈弃了利用区域灰度..._breif description calculation 特征点
文章浏览阅读4.1k次,点赞21次,收藏79次。本文是《基于SpringBoot的房屋租赁管理系统》的配套原创说明文档,可以给应届毕业生提供格式撰写参考,也可以给开发类似系统的朋友们提供功能业务设计思路。_基于spring boot的房屋租赁系统论文