Skip to content
Snippets Groups Projects
Commit 6000d7f2 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

*** empty log message ***

parent 563bc4d0
Branches
Tags
No related merge requests found
lc=0.25;
//dimensions sphere_dist = 0.05; // spheres don't touch
// sphere_dist = 0; // spheres touch
lc = 0.5;
xdim = 5; xdim = 5;
ydim = 5; ydim = 5;
zdim = 5; zdim = 5;
//electrodes
a=newp; Point(a) = {-1, -1, -Cos(45),lc}; Point(1) = {-1,-1,-Cos(45),lc};
a=newp; Point(a) = {xdim, -1, -Cos(45),lc}; Point(2) = {xdim,-1,-Cos(45),lc};
a=newp; Point(a) = {xdim, ydim, -Cos(45),lc}; Point(3) = {xdim,ydim,-Cos(45),lc};
a=newp; Point(a) = {-1, ydim, -Cos(45),lc}; Point(4) = {-1,ydim,-Cos(45),lc};
b1=newl; Line (b1) = {a-3,a-2}; Line (1) = {1,2};
b2=newl; Line (b2) = {a-2,a-1}; Line (2) = {2,3};
b3=newl; Line (b3) = {a-1,a}; Line (3) = {3,4};
b4=newl; Line (b4) = {a,a-3}; Line (4) = {4,1};
c=newll; Line Loop(c) = {b1,b2,b3,b4}; Line Loop(1) = {1,2,3,4};
ss=news; Plane Surface(ss) = {c}; Plane Surface(1) = {1};
Extrude {0,0,-1} { Surface{ss}; } //lower electrode Extrude {0, 0, -1} { Surface{1}; } // lower electrode
aa[] = Extrude {0,0,zdim-1+2*Cos(45)} { Surface{ss}; } ; aa[] = Extrude {0, 0, zdim - 1 + 2 * Cos(45)} { Surface{1}; } ;
Extrude {0, 0, 1} { Surface{aa[0]}; } // top electrode Extrude {0, 0, 1} { Surface{aa[0]}; } // top electrode
Delete{ Volume{aa[1]}; } // this volume is wrong: we will be carving holes in it Delete{ Volume{aa[1]}; } // this volume is wrong: we will be carving holes in it
//functions
Function newsphere Function newsphere
rr = Cos(45)-0.05; rr = 0.5-sphere_dist;
a=newp; Point(a) = {i,j,k,lc}; a = newp;
a=newp; Point(a) = {i,j+ rr,k,lc}; b = newl;
a=newp; Point(a) = {i,j- rr,k,lc}; c = newll;
a=newp; Point(a) = {i+rr,j,k,lc}; d = news;
a=newp; Point(a) = {i-rr,j,k,lc}; e = newsl;
a=newp; Point(a) = {i,j,k+rr,lc}; f = newv;
a=newp; Point(a) = {i,j,k-rr,lc}; Point(a) = {i,j,k,lc};
b=newl; Circle(b) = {a-1,a-6,a-3}; Point(a+1) = {i,j+rr,k,lc};
b=newl; Circle(b) = {a-3,a-6,a}; Point(a+2) = {i,j-rr,k,lc};
b=newl; Circle(b) = {a,a-6,a-2}; Point(a+3) = {i+rr,j,k,lc};
b=newl; Circle(b) = {a-2,a-6,a-1}; Point(a+4) = {i-rr,j,k,lc};
b=newl; Circle(b) = {a-5,a-6,a}; Point(a+5) = {i,j,k+rr,lc};
b=newl; Circle(b) = {a,a-6,a-4}; Point(a+6) = {i,j,k-rr,lc};
b=newl; Circle(b) = {a-4,a-6,a-1}; Circle(b) = {a+5,a,a+3};
b=newl; Circle(b) = {a-1,a-6,a-5}; Circle(b+1) = {a+3,a,a+6};
b=newl; Circle(b) = {a-5,a-6,a-3}; Circle(b+2) = {a+6,a,a+4};
b=newl; Circle(b) = {a-3,a-6,a-4}; Circle(b+3) = {a+4,a,a+5};
b=newl; Circle(b) = {a-4,a-6,a-2}; Circle(b+4) = {a+1,a,a+6};
b=newl; Circle(b) = {a-2,a-6,a-5}; Circle(b+5) = {a+6,a,a+2};
c=newll; Line Loop(c) = {b-6,-(b-2),b-10}; Circle(b+6) = {a+2,a,a+5};
d=news; Ruled Surface(d) = {c}; Circle(b+7) = {a+5,a,a+1};
c=newll; Line Loop(c) = {b-2,b-5,(b-11)}; Circle(b+8) = {a+1,a,a+3};
d=news; Ruled Surface(d) = {c}; Circle(b+9) = {a+3,a,a+2};
c=newll; Line Loop(c) = {b-5,-(b-8),-(b-1)}; Circle(b+10) = {a+2,a,a+4};
d=news; Ruled Surface(d) = {c}; Circle(b+11) = {a+4,a,a+1};
c=newll; Line Loop(c) = {b-1,-(b-9),b-6}; Line Loop(c) = {b+5,-(b+9),b+1}; Ruled Surface(d) = {c};
d=news; Ruled Surface(d) = {c}; Line Loop(c+1) = {b+9,b+6,b}; Ruled Surface(d+1) = {c+1};
c=newll; Line Loop(c) = {b,b-7,(b-9)}; Line Loop(c+2) = {b+6,-(b+3),-(b+10)}; Ruled Surface(d+2) = {c+2};
d=news; Ruled Surface(d) = {c}; Line Loop(c+3) = {b+10,-(b+2),b+5}; Ruled Surface(d+3) = {c+3};
c=newll; Line Loop(c) = {b-7,-(b-10),-(b-3)}; Line Loop(c+4) = {b+11,b+4,b+2}; Ruled Surface(d+4) = {c+4};
d=news; Ruled Surface(d) = {c}; Line Loop(c+5) = {b+4,-(b+1),-(b+8)}; Ruled Surface(d+5) = {c+5};
c=newll; Line Loop(c) = {b-3,-(b-11),b-4}; Line Loop(c+6) = {b+8,-b,b+7}; Ruled Surface(d+6) = {c+6};
d=news; Ruled Surface(d) = {c}; Line Loop(c+7) = {b+7,-(b+11),b+3}; Ruled Surface(d+7) = {c+7};
c=newll; Line Loop(c) = {b-4,-b,b-8}; Surface Loop(e) = {d+1,-(d+4),-(d+3),d+2,d,(d+6),-(d+5),-(d+7)};
d=news; Ruled Surface(d) = {c}; Volume(f) = e;
e=newsl; Surface Loop(e) = {(d-14),-(d-8),-(d-10),(d-12),(d-2),(d-4),-(d-6),-d};
vv=newv; Volume(vv)={e};
holes[] += e; holes[] += e;
Return Return
//random distribution //random distribution
...@@ -84,8 +82,7 @@ For i In {1:xdim-2:1} ...@@ -84,8 +82,7 @@ For i In {1:xdim-2:1}
For j In {1:ydim-2:1} For j In {1:ydim-2:1}
For k In {1:zdim-2:1} For k In {1:zdim-2:1}
If (array[i*ydim*zdim + j*zdim + k] == 1) If (array[i*ydim*zdim + j*zdim + k] == 1)
If ( If (array[(i+1)*ydim*zdim + j*zdim + k] == 0 &&
array[(i+1)*ydim*zdim + j*zdim + k]==0 &&
array[(i+1)*ydim*zdim + (j+1)*zdim + k] == 0 && array[(i+1)*ydim*zdim + (j+1)*zdim + k] == 0 &&
array[(i+1)*ydim*zdim + (j-1)*zdim + k] == 0 && array[(i+1)*ydim*zdim + (j-1)*zdim + k] == 0 &&
array[(i-1)*ydim*zdim + j*zdim + k] == 0 && array[(i-1)*ydim*zdim + j*zdim + k] == 0 &&
...@@ -116,12 +113,10 @@ If (array[i*ydim*zdim + j*zdim + k]==1) ...@@ -116,12 +113,10 @@ If (array[i*ydim*zdim + j*zdim + k]==1)
array[i*ydim*zdim + j*zdim + k] = 0; array[i*ydim*zdim + j*zdim + k] = 0;
EndIf EndIf
EndIf EndIf
EndFor EndFor
EndFor EndFor
EndFor EndFor
//check
For i In {0:xdim-1:1} For i In {0:xdim-1:1}
For j In {0:ydim-1:1} For j In {0:ydim-1:1}
For k In {0:zdim-1:1} For k In {0:zdim-1:1}
...@@ -133,6 +128,8 @@ EndFor ...@@ -133,6 +128,8 @@ EndFor
EndFor EndFor
EndFor EndFor
c = newsl; Surface Loop(c) = {45,-6,37,41,50,49}; // volume between electrodes with spheres carved out
c = newsl; Surface Loop(c) = {43,-1,35,39,48,47};
v = newv; Volume(v) = {c, holes[]}; v = newv; Volume(v) = {c, holes[]};
Coherence; // make sure duplicate nodes are removed when sphere_dist=0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment