首页 > 解决方案 > 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)

我想在网格m0m1.

标签: pythonprocesssimulationfipy

解决方案


谢谢@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)

推荐阅读