diff --git a/python/Tutorials/CRLH_Extraction.py b/python/Tutorials/CRLH_Extraction.py index cdd35b7..e550442 100644 --- a/python/Tutorials/CRLH_Extraction.py +++ b/python/Tutorials/CRLH_Extraction.py @@ -18,6 +18,7 @@ from pylab import * from CSXCAD import ContinuousStructure from openEMS import openEMS from openEMS.physical_constants import * +from openEMS.automesh import mesh_hint_from_box ### Class to represent single CRLH unit cells class CRLH_Cells: @@ -42,39 +43,29 @@ class CRLH_Cells: self.edge_resolution = res def createCell(self, translate = [0,0,0]): - mesh = [[],[],None] + mesh = [None,None,None] third_res = self.edge_resolution/3 translate = array(translate) start = [-self.LL/2 , -self.LW/2, self.Top] + translate stop = [-self.GLT/2, self.LW/2, self.Top] + translate box = self.props['metal_top'].AddBox(start, stop, priority=10) - # create edge mesh at +x and -+y - mesh[0] += [stop[0]-third_res, stop[0]+2*third_res] - mesh[1] += [stop[1]-third_res, stop[1]+2*third_res] - mesh[1] += [start[1]-2*third_res, start[1]+third_res] - + mesh = mesh_hint_from_box(box, 'x', metal_edge_res=self.edge_resolution, down_dir=False, mesh=mesh) + mesh = mesh_hint_from_box(box, 'y', metal_edge_res=self.edge_resolution, mesh=mesh) start = [+self.LL/2 , -self.LW/2, self.Top] + translate stop = [+self.GLT/2, self.LW/2, self.Top] + translate box = self.props['metal_top'].AddBox(start, stop, priority=10) - # create edge mesh at -x - mesh[0] += [stop[0]-2*third_res, stop[0]+third_res] + mesh = mesh_hint_from_box(box, 'x', metal_edge_res=self.edge_resolution, up_dir=False, mesh=mesh) start = [-(self.LL-self.GLB)/2, -self.LW/2, self.Bot] + translate stop = [+(self.LL-self.GLB)/2, self.LW/2, self.Bot] + translate box = self.props['metal_bot'].AddBox(start, stop, priority=10) - # create edge mesh at -+x - mesh[0] += [start[0]+third_res, start[0]-2*third_res] - mesh[0] += [stop[0]-third_res, stop[0]+2*third_res] + mesh = mesh_hint_from_box(box, 'x', metal_edge_res=self.edge_resolution, mesh=mesh) start = [-self.SW/2, -self.LW/2-self.SL, self.Bot] + translate stop = [+self.SW/2, self.LW/2+self.SL, self.Bot] + translate box = self.props['metal_bot'].AddBox(start, stop, priority=10) - # create edge mesh at -+x and -+y - mesh[0] += [start[0]+third_res, start[0]-2*third_res] - mesh[0] += [stop[0]-third_res, stop[0]+2*third_res] - mesh[1] += [start[1]+third_res, start[1]-2*third_res] - mesh[1] += [stop[1]-third_res, stop[1]+2*third_res] + mesh = mesh_hint_from_box(box, 'xy', metal_edge_res=self.edge_resolution, mesh=mesh) start = [0, -self.LW/2-self.SL+self.SW/2, 0 ] + translate stop = [0, -self.LW/2-self.SL+self.SW/2, self.Bot] + translate