Hello, I am trying to model a simple 3D electrostatics problem. A metallic object at 1 Volt is surrounded by air and is positioned above a ground plane. The upper part of the dome is a "distant surface" air boundary. My objective is to obtain a result containing the surface charge density at each mesh node on the surface of the energized object. A .step CAD file is attached (dome.step). Since I don't care about anything internal to the cuboid, the volume consists of a dome with a cuboid void.
File Attachment:
File Name:
dome.zip
File Size:3 KB
I normally use the netgen gui to mesh and export to Elmer Format. However, I learned that this could be done in ngsolve with scripting.
I have been able to get as far importing the .step file and meshing the object (code below). The imported step file has surfaces: 1 = air boundary, 2 = ground plane, 3 through 8 = cuboid.
Could someone point me in the right direction or give example scripts that show:
- How to name boundaries (I would like to set the air boundary to bc 1, ground plane to bc 2, and energized surfaces to bc 3.
- How to assign potentials to a bc
- How to assign a Nuemann boundary condition to the air boundary
- How to solve and get an output with the charge density at the surface nodes of the energized cuboid
I'm really stuck on the first item. I might be able to find the other three if I can get that one figured out, but if the others are quick for someone to point out, I would really appreciate the assistance. Thanks!
.
.
Code:
from netgen.occ import *
geo = OCCGeometry('C:/Temp/dome.step') #import step file
for x in range(2,8): #iterate through surfaces of cuboid
geo.SetFaceMeshsize(x,25) #set mesh size for cuboid surfaces
geo.SetFaceMeshsize(0,100) #set mesh size for air boundary
geo.SetFaceMeshsize(1,25) #set mesh size for ground plane
mesh = geo.GenerateMesh(maxh = 100,grading = 0.75) #mesh the volume with prescribed size and grading
mesh.Save('C:/Temp/dome.vol') #save mesh out