Skip to content

Commit 6e4b97d

Browse files
committed
python formatting: autopep8 . --select E12,E101
1 parent dd10bf4 commit 6e4b97d

File tree

13 files changed

+2541
-2541
lines changed

13 files changed

+2541
-2541
lines changed

dg_common.py

Lines changed: 233 additions & 233 deletions
Large diffs are not rendered by default.

dg_physics.py

Lines changed: 502 additions & 502 deletions
Large diffs are not rendered by default.

model_create.py

Lines changed: 113 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -15,93 +15,93 @@
1515
from devsim import *
1616
debug = False
1717
def CreateSolution(device, region, name):
18-
'''
19-
Creates solution variables
20-
As well as their entries on each edge
21-
'''
22-
node_solution(name=name, device=device, region=region)
23-
edge_from_node_model(node_model=name, device=device, region=region)
18+
'''
19+
Creates solution variables
20+
As well as their entries on each edge
21+
'''
22+
node_solution(name=name, device=device, region=region)
23+
edge_from_node_model(node_model=name, device=device, region=region)
2424

2525
def CreateNodeModel(device, region, model, expression):
26-
'''
27-
Creates a node model
28-
'''
29-
result=node_model(device=device, region=region, name=model, equation=expression)
30-
if debug:
31-
print(("NODEMODEL {d} {r} {m} \"{re}\"".format(d=device, r=region, m=model, re=result)))
26+
'''
27+
Creates a node model
28+
'''
29+
result=node_model(device=device, region=region, name=model, equation=expression)
30+
if debug:
31+
print(("NODEMODEL {d} {r} {m} \"{re}\"".format(d=device, r=region, m=model, re=result)))
3232

3333
def CreateNodeModelDerivative(device, region, model, expression, *vars):
34-
'''
35-
Create a node model derivative
36-
'''
37-
for v in vars:
38-
CreateNodeModel(device, region,
39-
"{m}:{v}".format(m=model, v=v),
40-
"diff({e},{v})".format(e=expression, v=v))
41-
#"simplify(diff({e},{v}))".format(e=expression, v=v))
34+
'''
35+
Create a node model derivative
36+
'''
37+
for v in vars:
38+
CreateNodeModel(device, region,
39+
"{m}:{v}".format(m=model, v=v),
40+
"diff({e},{v})".format(e=expression, v=v))
41+
#"simplify(diff({e},{v}))".format(e=expression, v=v))
4242

4343

4444
def CreateContactNodeModel(device, contact, model, expression):
45-
'''
46-
Creates a contact node model
47-
'''
48-
result=contact_node_model(device=device, contact=contact, name=model, equation=expression)
49-
if debug:
50-
print(("CONTACTNODEMODEL {d} {c} {m} \"{re}\"".format(d=device, c=contact, m=model, re=result)))
45+
'''
46+
Creates a contact node model
47+
'''
48+
result=contact_node_model(device=device, contact=contact, name=model, equation=expression)
49+
if debug:
50+
print(("CONTACTNODEMODEL {d} {c} {m} \"{re}\"".format(d=device, c=contact, m=model, re=result)))
5151

5252

5353
def CreateContactNodeModelDerivative(device, contact, model, expression, variable):
54-
'''
55-
Creates a contact node model derivative
56-
'''
57-
CreateContactNodeModel(device, contact,
58-
"{m}:{v}".format(m=model, v=variable),
59-
"diff({e}, {v})".format(e=expression, v=variable))
60-
#"simplify(diff({e}, {v}))".format(e=expression, v=variable))
54+
'''
55+
Creates a contact node model derivative
56+
'''
57+
CreateContactNodeModel(device, contact,
58+
"{m}:{v}".format(m=model, v=variable),
59+
"diff({e}, {v})".format(e=expression, v=variable))
60+
#"simplify(diff({e}, {v}))".format(e=expression, v=variable))
6161

6262
def CreateEdgeModel (device, region, model, expression):
63-
'''
64-
Creates an edge model
65-
'''
66-
result=edge_model(device=device, region=region, name=model, equation=expression)
67-
if debug:
68-
print("EDGEMODEL {d} {r} {m} \"{re}\"".format(d=device, r=region, m=model, re=result));
63+
'''
64+
Creates an edge model
65+
'''
66+
result=edge_model(device=device, region=region, name=model, equation=expression)
67+
if debug:
68+
print("EDGEMODEL {d} {r} {m} \"{re}\"".format(d=device, r=region, m=model, re=result));
6969

7070
def CreateEdgeModelDerivatives(device, region, model, expression, variable):
71-
'''
72-
Creates edge model derivatives
73-
'''
74-
CreateEdgeModel(device, region,
75-
"{m}:{v}@n0".format(m=model, v=variable),
76-
"diff({e}, {v}@n0)".format(e=expression, v=variable))
77-
#"simplify(diff({e}, {v}@n0))".format(e=expression, v=variable))
78-
CreateEdgeModel(device, region,
79-
"{m}:{v}@n1".format(m=model, v=variable),
80-
"diff({e}, {v}@n1)".format(e=expression, v=variable))
81-
#"simplify(diff({e}, {v}@n1))".format(e=expression, v=variable))
71+
'''
72+
Creates edge model derivatives
73+
'''
74+
CreateEdgeModel(device, region,
75+
"{m}:{v}@n0".format(m=model, v=variable),
76+
"diff({e}, {v}@n0)".format(e=expression, v=variable))
77+
#"simplify(diff({e}, {v}@n0))".format(e=expression, v=variable))
78+
CreateEdgeModel(device, region,
79+
"{m}:{v}@n1".format(m=model, v=variable),
80+
"diff({e}, {v}@n1)".format(e=expression, v=variable))
81+
#"simplify(diff({e}, {v}@n1))".format(e=expression, v=variable))
8282

8383
def CreateContactEdgeModel(device, contact, model, expression):
84-
'''
85-
Creates a contact edge model
86-
'''
87-
result=contact_edge_model(device=device, contact=contact, name=model, equation=expression)
88-
if debug:
89-
print(("CONTACTEDGEMODEL {d} {c} {m} \"{re}\"".format(d=device, c=contact, m=model, re=result)))
84+
'''
85+
Creates a contact edge model
86+
'''
87+
result=contact_edge_model(device=device, contact=contact, name=model, equation=expression)
88+
if debug:
89+
print(("CONTACTEDGEMODEL {d} {c} {m} \"{re}\"".format(d=device, c=contact, m=model, re=result)))
9090

9191
def CreateContactEdgeModelDerivative(device, contact, model, expression, variable):
92-
'''
93-
Creates contact edge model derivatives with respect to variable on node
94-
'''
95-
CreateContactEdgeModel(device, contact, "{m}:{v}".format(m=model, v=variable), "diff({e}, {v})".format(e=expression, v=variable))
96-
#CreateContactEdgeModel(device, contact, "{m}:{v}".format(m=model, v=variable), "simplify(diff({e}, {v}))".format(e=expression, v=variable))
92+
'''
93+
Creates contact edge model derivatives with respect to variable on node
94+
'''
95+
CreateContactEdgeModel(device, contact, "{m}:{v}".format(m=model, v=variable), "diff({e}, {v})".format(e=expression, v=variable))
96+
#CreateContactEdgeModel(device, contact, "{m}:{v}".format(m=model, v=variable), "simplify(diff({e}, {v}))".format(e=expression, v=variable))
9797

9898
def CreateInterfaceModel(device, interface, model, expression):
99-
'''
100-
Creates a interface node model
101-
'''
102-
result=interface_model(device=device, interface=interface, name=model, equation=expression)
103-
if debug:
104-
print(("INTERFACEMODEL {d} {i} {m} \"{re}\"".format(d=device, i=interface, m=model, re=result)))
99+
'''
100+
Creates a interface node model
101+
'''
102+
result=interface_model(device=device, interface=interface, name=model, equation=expression)
103+
if debug:
104+
print(("INTERFACEMODEL {d} {i} {m} \"{re}\"".format(d=device, i=interface, m=model, re=result)))
105105

106106
#def CreateInterfaceModelDerivative(device, interface, model, expression, variable):
107107
# '''
@@ -110,74 +110,74 @@ def CreateInterfaceModel(device, interface, model, expression):
110110
# CreateInterfaceModel(device, interface, "{m}:{v}".format(m=model, v=variable), "simplify(diff({e}, {v}))".format(e=expression, v=variable))
111111

112112
def CreateContinuousInterfaceModel(device, interface, variable):
113-
mname = "continuous{0}".format(variable)
114-
meq = "{0}@r0 - {0}@r1".format(variable)
115-
mname0 = "{0}:{1}@r0".format(mname, variable)
116-
mname1 = "{0}:{1}@r1".format(mname, variable)
117-
CreateInterfaceModel(device, interface, mname, meq)
118-
CreateInterfaceModel(device, interface, mname0, "1")
119-
CreateInterfaceModel(device, interface, mname1, "-1")
120-
return mname
113+
mname = "continuous{0}".format(variable)
114+
meq = "{0}@r0 - {0}@r1".format(variable)
115+
mname0 = "{0}:{1}@r0".format(mname, variable)
116+
mname1 = "{0}:{1}@r1".format(mname, variable)
117+
CreateInterfaceModel(device, interface, mname, meq)
118+
CreateInterfaceModel(device, interface, mname0, "1")
119+
CreateInterfaceModel(device, interface, mname1, "-1")
120+
return mname
121121

122122

123123
def InEdgeModelList(device, region, model):
124-
'''
125-
Checks to see if this edge model is available on device and region
126-
'''
127-
return model in get_edge_model_list(device=device, region=region)
124+
'''
125+
Checks to see if this edge model is available on device and region
126+
'''
127+
return model in get_edge_model_list(device=device, region=region)
128128

129129
def InNodeModelList(device, region, model):
130-
'''
131-
Checks to see if this node model is available on device and region
132-
'''
133-
return model in get_node_model_list(device=device, region=region)
130+
'''
131+
Checks to see if this node model is available on device and region
132+
'''
133+
return model in get_node_model_list(device=device, region=region)
134134

135135
#### Make sure that the model exists, as well as it's node model
136136
def EnsureEdgeFromNodeModelExists(device, region, nodemodel):
137-
'''
138-
Checks if the edge models exists
139-
'''
140-
if not InNodeModelList(device, region, nodemodel):
141-
raise "{} must exist"
142-
143-
emlist = get_edge_model_list(device=device, region=region)
144-
emtest = ("{0}@n0".format(nodemodel) and "{0}@n1".format(nodemodel))
145-
if not emtest:
146-
if debug:
147-
print("INFO: Creating ${0}@n0 and ${0}@n1".format(nodemodel))
148-
edge_from_node_model(device=device, region=region, node_model=nodemodel)
137+
'''
138+
Checks if the edge models exists
139+
'''
140+
if not InNodeModelList(device, region, nodemodel):
141+
raise "{} must exist"
142+
143+
emlist = get_edge_model_list(device=device, region=region)
144+
emtest = ("{0}@n0".format(nodemodel) and "{0}@n1".format(nodemodel))
145+
if not emtest:
146+
if debug:
147+
print("INFO: Creating ${0}@n0 and ${0}@n1".format(nodemodel))
148+
edge_from_node_model(device=device, region=region, node_model=nodemodel)
149149

150150
def CreateElementModel2d(device, region, model, expression):
151-
result=element_model(device=device, region=region, name=model, equation=expression)
152-
if debug:
153-
print(("ELEMENTMODEL {d} {r} {m} \"{re}\"".format(d=device, r=region, m=model, re=result)))
151+
result=element_model(device=device, region=region, name=model, equation=expression)
152+
if debug:
153+
print(("ELEMENTMODEL {d} {r} {m} \"{re}\"".format(d=device, r=region, m=model, re=result)))
154154

155155

156156
def CreateElementModelDerivative2d(device, region, model_name, expression, *args):
157-
if len(args) == 0:
158-
raise ValueError("Must specify a list of variable names")
159-
for i in args:
160-
for j in ("@en0", "@en1", "@en2"):
161-
CreateElementModel2d(device, region, "{0}:{1}{2}".format(model_name, i, j), "diff({0}, {1}{2})".format(expression, i, j))
157+
if len(args) == 0:
158+
raise ValueError("Must specify a list of variable names")
159+
for i in args:
160+
for j in ("@en0", "@en1", "@en2"):
161+
CreateElementModel2d(device, region, "{0}:{1}{2}".format(model_name, i, j), "diff({0}, {1}{2})".format(expression, i, j))
162162

163163
### edge_model is the name of the edge model to be created
164164
def CreateGeometricMean(device, region, nmodel, emodel):
165165
edge_average_model(device=device, region=region, edge_model=emodel, node_model=nmodel, average_type="geometric")
166166

167167
def CreateGeometricMeanDerivative(device, region, nmodel, emodel, *args):
168-
if len(args) == 0:
169-
raise ValueError("Must specify a list of variable names")
170-
for i in args:
171-
edge_average_model(device=device, region=region, edge_model=emodel, node_model=nmodel,
172-
derivative=i, average_type="geometric")
168+
if len(args) == 0:
169+
raise ValueError("Must specify a list of variable names")
170+
for i in args:
171+
edge_average_model(device=device, region=region, edge_model=emodel, node_model=nmodel,
172+
derivative=i, average_type="geometric")
173173

174174
def CreateArithmeticMean(device, region, nmodel, emodel):
175175
edge_average_model(device=device, region=region, edge_model=emodel, node_model=nmodel, average_type="arithmetic")
176176

177177
def CreateArithmeticMeanDerivative(device, region, nmodel, emodel, *args):
178-
if len(args) == 0:
179-
raise ValueError("Must specify a list of variable names")
180-
for i in args:
181-
edge_average_model(device=device, region=region, edge_model=emodel, node_model=nmodel,
182-
derivative=i, average_type="arithmetic")
178+
if len(args) == 0:
179+
raise ValueError("Must specify a list of variable names")
180+
for i in args:
181+
edge_average_model(device=device, region=region, edge_model=emodel, node_model=nmodel,
182+
derivative=i, average_type="arithmetic")
183183

moscap.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,34 @@
1818
####
1919
from devsim import *
2020
def make_moscap(device, interface_siox, region_ox, region_si, contact_ox, contact_si, tox, tsi, ox_material, si_material):
21-
'''
22-
need to generalize, but good enough for our examples
23-
'''
24-
create_1d_mesh(mesh="moscap")
25-
if False:
26-
add_1d_mesh_line(mesh="moscap", pos=tox, ps=1e-7, tag="d0")
27-
add_1d_mesh_line(mesh="moscap", pos=0.0, ns=1e-9, ps=1e-7, tag="d1")
28-
if tsi > 1e-6:
29-
add_1d_mesh_line(mesh="moscap", pos=-1e-6, ps=5e-9)
30-
add_1d_mesh_line(mesh="moscap", pos=-tsi, ps=1e-7, tag="d2")
31-
add_1d_contact (mesh="moscap", name=contact_ox, tag="d0", material="metal")
32-
add_1d_contact (mesh="moscap", name=contact_si, tag="d2", material="metal")
33-
add_1d_interface(mesh="moscap", name=interface_siox, tag="d1")
34-
add_1d_region (mesh="moscap", material=ox_material, region=region_ox, tag1="d0", tag2="d1")
35-
add_1d_region (mesh="moscap", material=si_material, region=region_si, tag1="d1", tag2="d2")
36-
else:
37-
add_1d_mesh_line(mesh="moscap", pos=-tox, ps=1e-7, tag="d0")
38-
add_1d_mesh_line(mesh="moscap", pos=0.0, ps=1e-9, ns=1e-7, tag="d1")
39-
if tsi > 1e-6:
40-
add_1d_mesh_line(mesh="moscap", pos=1e-6, ps=5e-9)
41-
add_1d_mesh_line(mesh="moscap", pos=tsi, ps=1e-7, tag="d2")
42-
add_1d_contact (mesh="moscap", name=contact_ox, tag="d0", material="metal")
43-
add_1d_contact (mesh="moscap", name=contact_si, tag="d2", material="metal")
44-
add_1d_interface(mesh="moscap", name=interface_siox, tag="d1")
45-
add_1d_region (mesh="moscap", material=ox_material, region=region_ox, tag1="d0", tag2="d1")
46-
add_1d_region (mesh="moscap", material=si_material, region=region_si, tag1="d1", tag2="d2")
47-
finalize_mesh(mesh="moscap")
48-
create_device(mesh="moscap", device=device)
21+
'''
22+
need to generalize, but good enough for our examples
23+
'''
24+
create_1d_mesh(mesh="moscap")
25+
if False:
26+
add_1d_mesh_line(mesh="moscap", pos=tox, ps=1e-7, tag="d0")
27+
add_1d_mesh_line(mesh="moscap", pos=0.0, ns=1e-9, ps=1e-7, tag="d1")
28+
if tsi > 1e-6:
29+
add_1d_mesh_line(mesh="moscap", pos=-1e-6, ps=5e-9)
30+
add_1d_mesh_line(mesh="moscap", pos=-tsi, ps=1e-7, tag="d2")
31+
add_1d_contact (mesh="moscap", name=contact_ox, tag="d0", material="metal")
32+
add_1d_contact (mesh="moscap", name=contact_si, tag="d2", material="metal")
33+
add_1d_interface(mesh="moscap", name=interface_siox, tag="d1")
34+
add_1d_region (mesh="moscap", material=ox_material, region=region_ox, tag1="d0", tag2="d1")
35+
add_1d_region (mesh="moscap", material=si_material, region=region_si, tag1="d1", tag2="d2")
36+
else:
37+
add_1d_mesh_line(mesh="moscap", pos=-tox, ps=1e-7, tag="d0")
38+
add_1d_mesh_line(mesh="moscap", pos=0.0, ps=1e-9, ns=1e-7, tag="d1")
39+
if tsi > 1e-6:
40+
add_1d_mesh_line(mesh="moscap", pos=1e-6, ps=5e-9)
41+
add_1d_mesh_line(mesh="moscap", pos=tsi, ps=1e-7, tag="d2")
42+
add_1d_contact (mesh="moscap", name=contact_ox, tag="d0", material="metal")
43+
add_1d_contact (mesh="moscap", name=contact_si, tag="d2", material="metal")
44+
add_1d_interface(mesh="moscap", name=interface_siox, tag="d1")
45+
add_1d_region (mesh="moscap", material=ox_material, region=region_ox, tag1="d0", tag2="d1")
46+
add_1d_region (mesh="moscap", material=si_material, region=region_si, tag1="d1", tag2="d2")
47+
finalize_mesh(mesh="moscap")
48+
create_device(mesh="moscap", device=device)
4949

5050
#create_contact_from_interface(name="mid", material="metal", device=device, region="MySiRegion", interface=interface)
5151
#print [x for x in get_node_model_values(device=device, region="MySiRegion", name="AtContactNode") if x > 0]

moscap2d.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
from devsim import *
22
def instantiate(filename, device, interface_siox, region_ox, region_si, contact_ox, contact_si, ox_material, si_material):
3-
create_gmsh_mesh (mesh=device, file=filename)
4-
add_gmsh_region (mesh=device, gmsh_name="oxide", region=region_ox, material=ox_material)
5-
add_gmsh_region (mesh=device, gmsh_name="silicon", region=region_si, material=si_material)
6-
add_gmsh_contact (mesh=device, gmsh_name="gate", region=region_ox, material="metal", name=contact_ox)
7-
add_gmsh_contact (mesh=device, gmsh_name="sub", region=region_si, material="metal", name=contact_si)
8-
add_gmsh_interface (mesh=device, gmsh_name="interface", region0=region_ox, region1=region_si, name=interface_siox)
9-
finalize_mesh (mesh=device)
10-
create_device (mesh=device, device=device)
3+
create_gmsh_mesh (mesh=device, file=filename)
4+
add_gmsh_region (mesh=device, gmsh_name="oxide", region=region_ox, material=ox_material)
5+
add_gmsh_region (mesh=device, gmsh_name="silicon", region=region_si, material=si_material)
6+
add_gmsh_contact (mesh=device, gmsh_name="gate", region=region_ox, material="metal", name=contact_ox)
7+
add_gmsh_contact (mesh=device, gmsh_name="sub", region=region_si, material="metal", name=contact_si)
8+
add_gmsh_interface (mesh=device, gmsh_name="interface", region0=region_ox, region1=region_si, name=interface_siox)
9+
finalize_mesh (mesh=device)
10+
create_device (mesh=device, device=device)
1111

1212
def run():
13-
test_opts = {
14-
"filename" : "moscap2d.msh",
15-
"device" : "MyDevice",
16-
"region_ox" : "MyOxRegion",
17-
"region_si" : "MySiRegion",
18-
"interface_siox" : "MySiOx",
19-
"contact_ox" : "top",
20-
"contact_si" : "bot",
21-
"ox_material" : "Ox",
22-
"si_material" : "Si"
23-
}
24-
instantiate(**test_opts)
25-
write_devices(file="moscap2d_devsim.msh", type="devsim")
26-
write_devices(file="moscap2d.tec", type="tecplot")
13+
test_opts = {
14+
"filename" : "moscap2d.msh",
15+
"device" : "MyDevice",
16+
"region_ox" : "MyOxRegion",
17+
"region_si" : "MySiRegion",
18+
"interface_siox" : "MySiOx",
19+
"contact_ox" : "top",
20+
"contact_si" : "bot",
21+
"ox_material" : "Ox",
22+
"si_material" : "Si"
23+
}
24+
instantiate(**test_opts)
25+
write_devices(file="moscap2d_devsim.msh", type="devsim")
26+
write_devices(file="moscap2d.tec", type="tecplot")
2727

2828
#write_devices(file="moscap.dsm", type="devsim")
2929
if __name__ == '__main__':
30-
run()
30+
run()
3131

0 commit comments

Comments
 (0)