Hi Christoph,
Thanks very much for the prompt and helpful reply! I tried your solution #1 and it works very well like this:
boundaryconditionname p_M1_0_1 p_M1_0_1 e1;
In general I think I would prefer to keep everything in python, since I use python in calculate.py anyway and as far as I understood this is you preferred way of doing things, please correct me if I'm wrong. So if this all can be made to work in python, it does seem like a somewhat cleaner solution.
To answer your question about the structure I am trying to set up and simulate I attached a more complete set of files. The application is on-chip interconnect (capacitance) simulation for small cells such as memory (SRAM), image sensors, etc. The conductors (aluminum, copper or highly doped polysilicon) are defined as polygons on a number of layers. Each layer is planar with a defined thickness, there are a number of polygons on each layer. Some polygons are simple rectangles, some are more complex like p_M1_0_11 in the attached export.geo file. This works well in .geo but I have not been able to implement this type of extruded polygons in NGSpy.
In reality some of the polygons may need to be optionally represented by a much larger number of nodes. In this case the layout patterns (polygons) are obtained from a lithography simulation of the layout, I attached an example image (two layers of an SRAM cell). In this case a layout polygon would need typically 60-100 nodes for an adequate representation. So far this level of complexity seemed to stress Netgen a bit far, I attached an example to go with the above screenshot in export_large.geo. If you think it should be still doable in Netgen, perhaps with some simplification of the polygon, removing some nodes or similar, I would appreciate your advice on this.
I wonder if you may be able to help with another related question. The goal here is calculation of the capacitance matrix, i.e. the coupling capacitances between all electrodes in the structure. I attached an example matrix calculated by calculate.py. Capacitance is calculated as C = dQ/dV after applying a voltage (Dirichlet BC) to one electrode and 0V to all others. To calculate dQ I need a surface integral of -grad(u)*normal_vector on a closed surface around the electrode. However I cannot simple do:
charge = (Integrate(gfE*bfv2), mesh, definedon=mesh.Boundaries("e"+str(i+1))))
This is because it turns out that bfv2 has some normal vectors pointing into and some out of the electrode surface:
func_domain2 = -CoefficientFunction (specialcf.normal(3))
bfv2 = BoundaryFromVolumeCF(func_domain2)
So as a workaround I use the absolute value of the scalar product instead:
charge = (Integrate(sqrt((gfE*bfv2)**2), mesh, definedon=mesh.Boundaries("e"+str(i+1))))
This works because all normal field on the electrode surface must have the same sign (you can show this using the mean value theorem). Is there a better (cleaner) way to do this?
Thanks again for your help!
Best,
Valery
Attachment not found
Attachment not found
Attachment not found
Attachment not found
Attachment not found
Attachment not found
[attachment=undefined]Screenshot_20210428_115219.png[/attachment] [attachment=undefined]Screenshot_20210428_115219.png[/attachment]