技术标签: 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–场映射指令
文章浏览阅读1.9w次,点赞13次,收藏78次。最近在移植linux,用到kernel版本为3.14.28,在高版本的内核源码中用到了设备树(device-tree),设备树中用到pinctrl的配置,记录一下。1、普通设置在配置串口时,pinctrl的配置信息如下所示:[cpp] view plain copy"font-size:14px;"_imx6ull pinctrl内核怎么用
文章浏览阅读1.3w次。直接使用24dp;getDimensionPixelSize;利用反射。方法一在android6.0系统源码中,可以查到status_bar_height只有一个定值24dp, 因为可以直接使用24dp 源码参见文件./frameworks/base/core/res/res/values/dimens.xml方法二获取系统中”status_bar_height”的值,方法如下private int g..._statusbarheight
文章浏览阅读3.5k次,点赞7次,收藏37次。在wamp、PhpStorm成功安装后如何导入已有的PHP项目文件并运行。据作者近日查阅资料发现,网络上关于phpstorm导入项目方面教程甚少且相对零散,故作此教程。过程由作者综合网络上教程得来,某些地方不知原理,只知如何操作。如有知道原理的朋友欢迎提出~教程内容如有错误或不准确欢迎指正。第一步,配置.PHP运行环境先将项目中的代码文件、资源文件放到一个目录下,这里我是把它们放到了..._phpstorm2024怎么导入setting
文章浏览阅读1.6k次。本文由LeftNotEasy所有,发布于http://leftnoteasy.cnblogs.com。如果转载,请注明出处,在未经作者同意下将本文用于商业用途,将追究其法律责任。(1)-回归(regression)、梯度下降(gradient descent)前言: 上次写过一篇关于贝叶斯概率论的数学,最近时间比较紧,coding的任务比较重,不过还是抽空看了一_机器学习为什么是数学模型
文章浏览阅读531次,点赞7次,收藏8次。在实际应用中,需要注意一些问题,如避免在Checkpoint期间发生故障、确保Checkpoint和Savepoint的一致性、处理失败的Checkpoint或Savepoint等。
文章浏览阅读727次。文章目录前言0x01 修改支付价格0x02 修改支付状态0x03 修改购买数量0x04 修改附属值0x05 修改支付接口0x06 多重替换支付0x07 重复支付0x08 最小额支付0x09 值为最大值支付问题0x10 越权支付0x11 无限制试用0x12 修改优惠价前言支付漏洞一直以来就是高风险,对企业来说危害很大,对用户来说同样危害也大。就比如我用他人账户进行消费,这也属于支付漏洞中的越权问题。那么支付漏洞一般存在在哪些方面呢,根据名字就知道,凡是涉及购买、资金等方面的功能处就_支付功能点的漏洞有哪些
文章浏览阅读2.7k次,点赞16次,收藏13次。Python使用numpy包编写自定义函数计算平均绝对误差(MAE、Mean Absolute Error)、评估回归模型和时间序列模型、解读MAE_numpy mae
文章浏览阅读1.7w次,点赞6次,收藏32次。 消息生产者p将消息放入队列消费者监听队列,如果队列中有消息,就消费掉,消息被拿走后,自动从队列删除(隐患,消息可能没有被消费者正确处理,已经消失了,无法恢复)应用场景:聊天室 案例:1>.首先准备依赖<dependency> <groupId>org.springframework.boot</groupId> <artif..._rabbit设计模式
文章浏览阅读2.3k次。Nuget 安装以下程序包1.SqlSugarCore2.Microsoft.Data.Sqlite.Core3.SQLitePCLRaw.bundle_e_sqlcipherusing Microsoft.Data.Sqlite;using Microsoft.VisualStudio.TestTools.UnitTesting;using SqlSugar;using System;using System.Collections.Generic;using System_sqlsugar怎么给sqlite数据库加密
文章浏览阅读906次,点赞20次,收藏21次。对于web前端学习小白来说,html+css基础尤为重要,可以说是编程小白的必经之路,学完后能写出你看到的静态页面。1)PC端网站布局包含知识点: HTML基础,CSS基础,CSS核心属性;CSS样式层叠,继承,盒模型;容器,溢出及元素类型;浏览器兼容与宽高自适应……2)HTML5+CSS3基础包含知识点: HTML5新增的元素与属性;表单域增强元素;CSS3选择器;文字字体相关样式;CSS3位移与变形处理……3)WebApp页面布局包含知识点: 移动端页面设计规范;移动端切图;_web应用开发基础
文章浏览阅读626次,点赞15次,收藏14次。std库中的string是一个类,对string的模拟实现,既可以复习类的特性,也可以加深对std::string的理解。
文章浏览阅读1.7k次,点赞2次,收藏3次。洛必达法则是在一定条件下通过分子分母分别求导再求极限来确定未定式值的方法[1]。众所周知,两个无穷小之比或两个无穷大之比的极限可能存在,也可能不存在。因此,求这类极限时往往需要适当的变形,转化成可利用极限运算法则或重要极限的形式进行计算。洛必达法则便是应用于这类极限计算的通用方法零比零型若函数和满足下列条件:⑴,;⑵ 在点的某去心邻域内两者都可导,且;..._洛必达法则0/0求导