首页/文章/ 详情

Gmsh 生成二维非结构网格实例(1)

2年前浏览1083

例一:基本元素实体构建

example.geo

//////////////////////////////////////////////////////////////////////////////////////

//定义变量(参考长度)

lc = 0.1;

ld = 0.025;

//定义二维节点:节点位置 该节点处网格特征长度

Point(1) = {0.0, 0.0, 0.0, lc};

Point(2) = {2.0, 0.0, 0.0, lc};

Point(3) = {2.0, 2.0, 0.0, lc};

Point(4) = {0.0, 2.0, 0.0, lc};

Point(5) = {0.5, 0.5, 0.0, ld};

Point(6) = {1.5, 0.5, 0.0, ld};

Point(7) = {1.5, 1.5, 0.0, ld};

Point(8) = {0.5, 1.5, 0.0, ld};

//定义线单元

Line(1) = {1,2};

Line(2) = {2,3};

Line(3) = {3,4};

Line(4) = {4,1};

Line(5) = {5,6};

Line(6) = {6,7};

Line(7) = {7,8};

Line(8) = {8,5};

//定义每条线单元的上剖分节点个数,默认为等距剖分

Transfinite Line{1} = 21;

Transfinite Line{2} = 21;

Transfinite Line{3} = 21;

Transfinite Line{4} = 21;

Transfinite Line{5} = 41;

Transfinite Line{6} = 41;

Transfinite Line{7} = 41;

Transfinite Line{8} = 41;

//定义封闭曲线

Line Loop(5) = {1,2,3,4};

Line Loop(6) = {8,7,6,5};

//定义封闭曲线构成的面

Plane Surface(8) = {6,5};

///////////////////////////////////////////////////////////////////////////////////

Gmsh 生成的二维非结构网格如图所示:(Gmsh 提供三种算法:delaunay, frontal, meshadapt)

using Frontal



using Delaunay


例二:

//////////////////////////////////////////////////////////////////////////////

lc = 0.1;

Point(1) = {-2.0, -2.0, 0.0, lc};

Point(2) = { 2.0, -2.0, 0.0, lc};

Point(3) = { 2.0,  2.0, 0.0, lc};

Point(4) = {-2.0,  2.0, 0.0, lc};

Point(5) = {0.0, 0.0, 0.0, lc};

Point(6) = {1.0, 0.0, 0.0, lc};

Point(7) = {0.0, 1.0, 0.0, lc};

Point(8) = {-1.0, 0.0, 0.0, lc};

Point(9) = {0.0, -1.0, 0.0, lc};

Line(1) = {1,2};

Line(2) = {2,3};

Line(3) = {3,4};

Line(4) = {4,1};

Transfinite Line{1} = 41;

Transfinite Line{2} = 41;

Transfinite Line{3} = 41;

Transfinite Line{4} = 41;

Circle(5) = {6,5,7};

Circle(6) = {7,5,8};

Circle(7) = {8,5,9};

Circle(8) = {9,5,6};

Transfinite Line{5} = 31;

Transfinite Line{6} = 31;

Transfinite Line{7} = 31;

Transfinite Line{8} = 31;

Line Loop(11) = {1,2,3,4};

Line Loop(12) = {5,6,7,8};

Plane Surface(13) = {11,12};

////////////////////////////////////////////////////////////////////////////////////

网格示意图


来源:风流知音
网格处理科普
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2022-09-02
最近编辑:2年前
风流知音
博士 专注空气动力学、流体力学、固体...
获赞 123粉丝 83文章 255课程 2
点赞
收藏
未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈