Skip to content

Commit b3a0285

Browse files
author
zeptodoctor
committed
build based on dd9eae3
1 parent 7d6fcf3 commit b3a0285

156 files changed

Lines changed: 649205 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

stable

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.18.0
1+
v0.18.1

v0.18

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.18.0
1+
v0.18.1
134 KB
Loading
28.2 KB
Loading
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
using Gmsh
2+
import Gmsh: gmsh
3+
4+
struct RecCirGeometry
5+
L::Float64 # Length of the normal region
6+
h1::Float64 # Height of normal region
7+
h2::Float64 # Height of the region above source
8+
rt::Float64 # Radius of the target location
9+
rd::Float64 # Radius of design domain
10+
rs::Float64 # Radius of smallest distance circle
11+
dpml::Float64 # Thickness of the PML
12+
# Characteristic length (controls the resolution, smaller the finer)
13+
l1::Float64 # Normal region
14+
l2::Float64 # Design domain
15+
end
16+
17+
18+
function MeshGenerator(geo_param::RecCirGeometry, meshfile_name::String)
19+
gmsh.initialize()
20+
gmsh.option.setNumber("General.Terminal", 1)
21+
gmsh.option.setNumber("Mesh.Algorithm", 6)
22+
gmsh.clear()
23+
gmsh.model.add("geometry")
24+
25+
# Add points
26+
gmsh.model.geo.addPoint(-geo_param.L/2-geo_param.dpml, -geo_param.dpml, 0, geo_param.l1, 1)
27+
gmsh.model.geo.addPoint( geo_param.L/2+geo_param.dpml, -geo_param.dpml, 0, geo_param.l1, 2)
28+
gmsh.model.geo.addPoint( geo_param.L/2+geo_param.dpml, geo_param.h1, 0, geo_param.l1, 3)
29+
gmsh.model.geo.addPoint( geo_param.L/2+geo_param.dpml, geo_param.h1+geo_param.h2+geo_param.dpml, 0, geo_param.l1, 4)
30+
gmsh.model.geo.addPoint(-geo_param.L/2-geo_param.dpml, geo_param.h1+geo_param.h2+geo_param.dpml, 0, geo_param.l1, 5)
31+
gmsh.model.geo.addPoint(-geo_param.L/2-geo_param.dpml, geo_param.h1, 0, geo_param.l1, 6)
32+
gmsh.model.geo.addPoint(0, geo_param.h1/2, 0, geo_param.l2, 7)
33+
gmsh.model.geo.addPoint(-geo_param.rs, geo_param.h1/2, 0, geo_param.l2, 8)
34+
gmsh.model.geo.addPoint( geo_param.rs, geo_param.h1/2, 0, geo_param.l2, 9)
35+
gmsh.model.geo.addPoint(-geo_param.rd, geo_param.h1/2, 0, geo_param.l2, 10)
36+
gmsh.model.geo.addPoint( geo_param.rd, geo_param.h1/2, 0, geo_param.l2, 11)
37+
# Add lines
38+
gmsh.model.geo.addLine( 1, 2, 1)
39+
gmsh.model.geo.addLine( 2, 3, 2)
40+
gmsh.model.geo.addLine( 3, 4, 3)
41+
gmsh.model.geo.addLine( 4, 5, 4)
42+
gmsh.model.geo.addLine( 6, 5, 5)
43+
gmsh.model.geo.addLine( 1, 6, 6)
44+
gmsh.model.geo.addLine( 6, 3, 7)
45+
gmsh.model.geo.addCircleArc( 8, 7, 9, 8)
46+
gmsh.model.geo.addCircleArc( 9, 7, 8, 9)
47+
gmsh.model.geo.addCircleArc(10, 7,11,10)
48+
gmsh.model.geo.addCircleArc(11, 7,10,11)
49+
# Construct curve loops and surfaces
50+
gmsh.model.geo.addCurveLoop([8, 9], 1)
51+
gmsh.model.geo.addPlaneSurface([1], 1)
52+
gmsh.model.geo.addCurveLoop([10, 11], 2)
53+
gmsh.model.geo.addPlaneSurface([2, 1], 2)
54+
gmsh.model.geo.addCurveLoop([1, 2, -7,-6], 4)
55+
gmsh.model.geo.addPlaneSurface([4, 2], 4)
56+
gmsh.model.geo.addCurveLoop([3, 4,-5, 7], 5)
57+
gmsh.model.geo.addPlaneSurface([5], 5)
58+
# Physical groups
59+
gmsh.model.addPhysicalGroup(0, [1, 2, 4, 5], 1)
60+
gmsh.model.setPhysicalName(0, 1, "DirichletNodes")
61+
gmsh.model.addPhysicalGroup(1, [1, 4], 2)
62+
gmsh.model.setPhysicalName(1, 2, "DirichletEdges")
63+
gmsh.model.addPhysicalGroup(0, [8, 9, 10, 11], 3)
64+
gmsh.model.setPhysicalName(0, 3, "DesignNodes")
65+
gmsh.model.addPhysicalGroup(1, [8, 9, 10, 11], 4)
66+
gmsh.model.setPhysicalName(1, 4, "DesignEdges")
67+
gmsh.model.addPhysicalGroup(2, [2], 5)
68+
gmsh.model.setPhysicalName(2, 5, "Design")
69+
gmsh.model.addPhysicalGroup(2, [1], 6)
70+
gmsh.model.setPhysicalName(2, 6, "Center")
71+
gmsh.model.addPhysicalGroup(2, [3,4,5], 7)
72+
gmsh.model.setPhysicalName(2, 7, "Air")
73+
gmsh.model.addPhysicalGroup(1, [7], 9)
74+
gmsh.model.setPhysicalName(1, 9, "Source")
75+
gmsh.model.geo.synchronize()
76+
77+
# Set periodic mesh on the left and right side
78+
gmsh.model.mesh.setPeriodic(1, [2], [6],
79+
[1, 0, 0, geo_param.L+2*geo_param.dpml, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
80+
gmsh.model.mesh.setPeriodic(1, [3], [5],
81+
[1, 0, 0, geo_param.L+2*geo_param.dpml, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
82+
# We can then generate a 2D mesh...
83+
gmsh.model.mesh.generate(2)
84+
85+
86+
87+
# ... and save it to disk
88+
gmsh.write(meshfile_name)
89+
gmsh.finalize()
90+
end
91+
92+
L = 600
93+
h1 = 600
94+
h2 = 200
95+
rt = 150
96+
rd = 100
97+
rs = 10
98+
99+
dpml = 300
100+
101+
l1 = 20
102+
l2 = 1
103+
104+
meshfile = "RecCirGeometry.msh"
105+
geo_param = RecCirGeometry(L, h1, h2, rt, rd, rs, dpml, l1, l2)
106+
MeshGenerator(geo_param, meshfile)
45.8 KB
Loading
442 KB
Loading
377 KB
Loading
396 KB
Loading

v0.18.1/assets/amr/result.png

42.1 KB
Loading

0 commit comments

Comments
 (0)