Skip to content

Commit 31e0d76

Browse files
committed
include debug folder
1 parent 9c63be2 commit 31e0d76

2 files changed

Lines changed: 124 additions & 1 deletion

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
.DS_Store
33

4-
debug/
54

65
*.msh

debug/main_debug.jl

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
2+
include("../src/RVEs.jl")
3+
using Main.RVEs: RVEs
4+
5+
RVEs.startGmsh()
6+
RVEs.ShowInfo(0)
7+
myRVE = RVEs.RVE( [1.0, 1.0, 1.0], [0,0,0], [0.0, 0.0, 0.0], 0.1)
8+
myInclusions = RVEs.Sphere([0.5, 0.5, 0.5], 0.2, 2)
9+
model, tagvol=RVEs.createGmshModel(myRVE,myInclusions,"Test1")
10+
RVEs.createMesh!(model,myRVE,myInclusions,tagvol)
11+
RVEs.visualizeMesh()
12+
RVEs.stopGmsh()
13+
14+
15+
16+
rve = RVE( [1.0, 1.0, 1.0], [0,0,0], [0.0, 0.0, 0.0], 0.1)
17+
dx=0.05
18+
a=[0.0,0.0,0.0]+[-dx,-dx,-dx]
19+
b=[1.0,1.0,1.0]+[dx,dx,dx]
20+
d=sqrt(sum((b-a).^2))
21+
geo1=Cylinder(a,2*(b-a)/d, 0.05, 2)
22+
a=[0.0,1.0,0.0]+[-dx,dx,-dx]
23+
b=[1.0,0.0,1.0]+[dx,-dx,dx]
24+
d=sqrt(sum((b-a).^2))
25+
geo2=Cylinder(a,2*(b-a)/d, 0.05, 2)
26+
a=[1.0,0.0,0.0]+[dx,-dx,-dx]
27+
b=[0.0,1.0,1.0]+[-dx,dx,dx]
28+
d=sqrt(sum((b-a).^2))
29+
geo3=Cylinder(a,2*(b-a)/d, 0.05, 2)
30+
a=[1.0,1.0,0.0]+[dx,dx,-dx]
31+
b=[0.0,0.0,1.0]+[-dx,-dx,dx]
32+
d=sqrt(sum((b-a).^2))
33+
geo4=Cylinder(a,2*(b-a)/d, 0.05, 2)
34+
geo5=Sphere([0.5, 0.5, 0.5], 0.2, 2)
35+
36+
geo6=Sphere([0.0, 0.0, 0.0], 0.2, 2)
37+
geo7=Sphere([1.0, 0.0, 0.0], 0.2, 2)
38+
geo8=Sphere([1.0, 1.0, 0.0], 0.2, 2)
39+
geo9=Sphere([0.0,1.0,0.0], 0.2, 2)
40+
41+
geo10=Sphere([0.0, 0.0, 1.0], 0.2, 2)
42+
geo11=Sphere([1.0, 0.0, 1.0], 0.2, 2)
43+
geo12=Sphere([1.0, 1.0, 1.0], 0.2, 2)
44+
geo13=Sphere([0.0,1.0,1.0], 0.2, 2)
45+
46+
geo14=Fuse([geo1, geo2, geo3, geo4, geo5, geo6,geo7,geo8,geo9, geo10,geo11,geo12,geo13],2)
47+
48+
inclusions=(geo14,)
49+
50+
51+
52+
53+
gmsh.model.add("test")
54+
xmin, ymin, zmin, xmax, ymax, zmax = _getBoundingBox(rve)
55+
_addBoundingBox!(gmsh.model, rve)
56+
57+
dim3::Int32 = 3
58+
numinc = length(inclusions)
59+
_tags = Vector{Vector{Tuple{Int32,Int32}}}()
60+
push!(_tags, [(3, 1)])
61+
62+
_numinc = zeros(Int32, numinc)
63+
64+
# tag = _addInclusion!(gmsh.model, inclusions[1])
65+
66+
# gmsh.model.occ.synchronize()
67+
# visualizeMesh()
68+
69+
70+
for i in 1:numinc
71+
tag = _addInclusion!(gmsh.model, inclusions[i])
72+
inc_boundingbox = gmsh.model.occ.getBoundingBox(dim3, tag)
73+
isinboundary, boundarytype = _isinboundary(rve, inc_boundingbox)
74+
if isinboundary
75+
println("Inclusion $i is in the boundary!")
76+
__tags = _addPeriodicInclusions!(gmsh.model, rve, [(dim3, tag)], boundarytype)
77+
_numinc[i] = length(__tags)
78+
push!(_tags, __tags)
79+
else
80+
push!(_tags, [(dim3, tag)])
81+
_numinc[i] = 1
82+
end
83+
end
84+
85+
out_ = []
86+
_, out__ = gmsh.model.occ.fragment(_tags[1], vcat(_tags[2]...))
87+
out_matrix, out_inc= _findMatrixVolume(out__)
88+
push!(out_, out_inc)
89+
90+
for i in 2:numinc
91+
_, out__ = gmsh.model.occ.fragment(out_matrix, vcat(_tags[i+1]...))
92+
out_matrix, out_inc= _findMatrixVolume(out__)
93+
@show out_inc
94+
if length(out__[1])>1
95+
push!(out_, out_inc)
96+
end
97+
end
98+
push!(out_, out_matrix)
99+
100+
gmsh.model.occ.synchronize()
101+
removol = gmsh.model.getEntities(3)
102+
103+
gmsh.option.setNumber("Geometry.OCCBoundsUseStl", 1)
104+
eps = 1e-3
105+
vin = gmsh.model.getEntitiesInBoundingBox(xmin - eps, ymin - eps, zmin - eps, xmax + eps, ymax + eps, zmax + eps, 3)
106+
for v in vin
107+
deleteat!(removol, findall(x -> x == v, removol))
108+
end
109+
gmsh.model.removeEntities(removol, true)
110+
111+
_addPhysicalGroups!(gmsh.model, out_, rve)
112+
113+
createMesh!(gmsh.model,rve,inclusions,out_)
114+
115+
visualizeMesh()
116+
117+
118+
119+
120+
121+
122+
123+
124+

0 commit comments

Comments
 (0)