python - FiPy:如何在两个网格之间的界面处找到节点(顶点)
问题描述
我通过 Gmsh 在 FiPy 中定义了两个网格,并希望在两个网格之间的接口处找到节点。有没有办法在 FiPy 中做到这一点?
siliconGeometry = '''
SetFactory("OpenCASCADE");
//set node spacing
ns = 1e-1;
ns2 = 1e-2;
x1 = 0;
y1 = 0;
x2 = 1;
y2 = 0.5;
Point(1) = {x1, y1, 0, ns};
Point(2) = {x2, y1, 0, ns};
Point(3) = {x2, y2, 0, ns2};
Point(4) = {x1, y2, 0, ns2};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Curve Loop(1) = {1, 2, 3, 4};
Plane Surface(1) = {1};
Physical Surface("Silicon") = {1};
'''
oxideGeometry = '''
SetFactory("OpenCASCADE");
//set node spacing
ns = 1e-1;
ns2 = 1e-2;
x1 = 0;
y1 = 0.5;
x2 = 1;
y2 = 1;
Point(5) = {x1, y1, 0, ns2};
Point(6) = {x2, y1, 0, ns2};
Point(7) = {x2, y2, 0, ns};
Point(8) = {x1, y2, 0, ns};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 5};
Curve Loop(2) = {5, 6, 7, 8};
Plane Surface(2) = {2};
Physical Surface("Oxide") = {2};
m0 = Gmsh2D(siliconGeometry)
m1 = Gmsh2D(oxideGeometry)
我想在网格m0
和m1
.
解决方案
谢谢@wd15。这是我所做的:
m0 = Gmsh2D(siliconGeometry)
m1 = Gmsh2D(oxideGeometry)
m0_faces = m0.exteriorFaces
m0_vertices = numerix.unique(m0.faceVertexIDs[..., m0_faces].flatten()) m0_vertexCoords = m0.vertexCoords[..., m0_vertices ]
m1_faces = m1.exteriorFaces
m1_vertices = numerix.unique(m1.faceVertexIDs[..., m1_faces].flatten()) m1_vertexCoords = m1.vertexCoords[..., m0_vertices ]
surfVertexID = numerix.nearest(m0_vertexCoords , m1_vertexCoords)
推荐阅读
- java - 仅当 ArrayList B 中的对象的组件不存在时才添加到 ArrayList A
- javascript - Firebase 数据库触发器 - onCreate 在删除和更新时触发
- javascript - 无法在 Safari 中运行 Nightwatch 测试
- javascript - 为什么我的 YouTube 链接没有在 Chrome 的 iframe 中自动播放?
- c# - 获取嵌套在 Wrapper 类 C# 中的所有字符串属性
- r - 如何绘制带有列表的列的 data.table
- adobe-illustrator - 如何将 Adobe Illustrator 文件转换为仅一种颜色?
- c# - 串口不读取所有数据
- r - 错误后在 R 中继续循环(使用数字和字母向量的示例)
- android - 尝试注入命名依赖项时出错