modified: .gitignore

modified:   anasen_fem/paraview_plotter.py
	modified:   anasen_fem/wires2d.sif
	modified:   anasen_fem/wires_gmsh2d_bc.py
This commit is contained in:
Vignesh Sitaraman 2026-04-24 14:31:50 -04:00
parent 6e0100253b
commit 67bb9b6fd9
4 changed files with 27 additions and 28 deletions

3
.gitignore vendored
View File

@ -30,4 +30,5 @@ qqq_gains_det3.dat
qqq_relative_gains.dat qqq_relative_gains.dat
Armory/CorrelateQQQ.h Armory/CorrelateQQQ.h
QQQStage2.C QQQStage2.C
anasen_fem/scalars.dat.names anasen_fem/scalars.dat.names
anasen_fem/He96_CO2_4_260Torr.gas

View File

@ -1,4 +1,4 @@
#!/home/vsitaraman/ParaView-6.1.0-RC1-MPI-Linux-Python3.12-x86_64/bin/pvbatch #!/home/vs19g/ParaView-6.1.0-MPI-Linux-Python3.12-x86_64/bin/pvbatch
import numpy as np import numpy as np
import sys import sys
from paraview.simple import * from paraview.simple import *
@ -35,15 +35,14 @@ contour_display.SetScalarBarVisibility(renderView, True)
view = GetActiveView() view = GetActiveView()
# 2. Define your desired coordinate ranges (x_min, x_max, y_min, y_max, z_min, z_max) # 2. Define your desired coordinate ranges (x_min, x_max, y_min, y_max, z_min, z_max)
# Example: Look at a box from -10 to 10 in all dimensions x_min, x_max = -0.05, 0.05
x_min, x_max = -50.0, 50.0 y_min, y_max = -0.05, 0.05
y_min, y_max = -50.0, 50.0 z_min, z_max = -0.05, 0.05
z_min, z_max = -50.0, 50.0
# 3. Calculate Center, Position, and Parallel Scale # 3. Calculate Center, Position, and Parallel Scale
center = [(x_min + x_max) / 2.0, (y_min + y_max) / 2.0, (z_min + z_max) / 2.0] center = [(x_min + x_max) / 2.0, (y_min + y_max) / 2.0, (z_min + z_max) / 2.0]
# Position the camera far away along Z to look at the center # Position the camera far away along Z to look at the center
position = [center[0], center[1], z_min - 30.0] position = [center[0], center[1], 1.0]
# Parallel scale defines how much of the scene is visible. # Parallel scale defines how much of the scene is visible.
# It is usually half the height of the viewed area. # It is usually half the height of the viewed area.
view.CameraParallelScale = max((x_max - x_min), (y_max - y_min))/1.6 view.CameraParallelScale = max((x_max - x_min), (y_max - y_min))/1.6
@ -69,15 +68,13 @@ contour_display.RenderLinesAsTubes = 0 # Makes lines look smoother at high re
# 1. Get the active view # 1. Get the active view
view = GetActiveView() view = GetActiveView()
# 4. Apply settings # 1. Set the Focal Point to the middle of the quadrant in metres
# 1. Set the Focal Point to the middle of the quadrant zoom_center = [-0.025, 0.025, 0.0]
zoom_center = [-25, 25, 0.0]
# 2. Tighten the Parallel Scale # 2. Tighten the Parallel Scale
view.CameraParallelScale = 15 view.CameraParallelScale = 0.015
# 3. Position the Camera # 3. Position the Camera (0.5m away is fine)
# Keep it 0.5m away looking "down" at the new center
view.CameraPosition = [zoom_center[0], zoom_center[1], 0.5] view.CameraPosition = [zoom_center[0], zoom_center[1], 0.5]
view.CameraFocalPoint = zoom_center view.CameraFocalPoint = zoom_center
view.CameraViewUp = [0.0, 1.0, 0.0] view.CameraViewUp = [0.0, 1.0, 0.0]
@ -94,9 +91,8 @@ glyph = Glyph(Input=contour_filter, GlyphType='Arrow') #
# Orientation Array: Use the 'electric field' vector from Elmer # Orientation Array: Use the 'electric field' vector from Elmer
glyph.OrientationArray = ['POINTS', 'electric field'] glyph.OrientationArray = ['POINTS', 'electric field']
glyph.ScaleArray = ['POINTS', 'No scale array'] glyph.ScaleArray = ['POINTS', 'No scale array']
glyph.ScaleFactor = 1 glyph.ScaleFactor = 0.001
# Sampling: Every nth point (Stride 16)
glyph.GlyphMode = 'Every Nth Point' glyph.GlyphMode = 'Every Nth Point'
glyph.Stride = 24 glyph.Stride = 24

View File

@ -10,6 +10,7 @@ Simulation
Steady State Max Iterations = 1 Steady State Max Iterations = 1
Output File = "elstatics.result" Output File = "elstatics.result"
Post File = "elstatics.ep" Post File = "elstatics.ep"
Coordinate Scaling = 0.001 ! Converts mm from Gmsh to meters for Elmer
End End
Constants Constants
@ -85,7 +86,7 @@ Solver 4
End End
Boundary Condition 1 Boundary Condition 1
Target Boundaries = 1 Target Boundaries = 1
Potential = -200 Potential = -200
Calculate Electric Force = True Calculate Electric Force = True
End End

View File

@ -188,17 +188,17 @@ i2wire_surfs = get_surfs(ic2_wires) if include_ic_wires else []
all_active_wire_surfs = needle_surfs + gwire_surfs + awire_surfs + cwire_surfs + i1wire_surfs + i2wire_surfs all_active_wire_surfs = needle_surfs + gwire_surfs + awire_surfs + cwire_surfs + i1wire_surfs + i2wire_surfs
gmsh.model.mesh.embed(1, all_active_wire_surfs, 2, anasen_barrel) gmsh.model.mesh.embed(1, all_active_wire_surfs, 2, anasen_barrel)
# f1 = gmsh.model.mesh.field.add("Distance") f1 = gmsh.model.mesh.field.add("Distance")
# gmsh.model.mesh.field.setNumbers(f1, "CurvesList", all_active_wire_surfs) gmsh.model.mesh.field.setNumbers(f1, "CurvesList", all_active_wire_surfs)
# f2 = gmsh.model.mesh.field.add("Threshold") f2 = gmsh.model.mesh.field.add("Threshold")
# gmsh.model.mesh.field.setNumber(f2, "InField", f1) gmsh.model.mesh.field.setNumber(f2, "InField", f1)
# gmsh.model.mesh.field.setNumber(f2, "SizeMin", 0.1) # Fine mesh near wires gmsh.model.mesh.field.setNumber(f2, "SizeMin", 0.05) # Fine mesh near wires
# gmsh.model.mesh.field.setNumber(f2, "SizeMax", 10.0) # Large mesh in empty space gmsh.model.mesh.field.setNumber(f2, "SizeMax", 5.0) # Large mesh in empty space
# gmsh.model.mesh.field.setNumber(f2, "DistMin", 1.0) # Apply SizeMin within 1mm gmsh.model.mesh.field.setNumber(f2, "DistMin", 0.5) # Apply SizeMin within 1mm
# gmsh.model.mesh.field.setNumber(f2, "DistMax", 20.0) # Transition to SizeMax by 20mm gmsh.model.mesh.field.setNumber(f2, "DistMax", 15.0) # Transition to SizeMax by 20mm
# gmsh.model.mesh.field.setAsBackgroundMesh(f2) gmsh.model.mesh.field.setAsBackgroundMesh(f2)
# --- Physical Groups --- # --- Physical Groups ---
@ -222,8 +222,9 @@ gmsh.model.addPhysicalGroup(2, [anasen_barrel], tag=13, name="gas")
gmsh.option.setNumber("Mesh.Algorithm", 6) gmsh.option.setNumber("Mesh.Algorithm", 6)
gmsh.model.mesh.generate(dim=2) gmsh.model.mesh.generate(dim=2)
gmsh.model.mesh.refine() # gmsh.model.mesh.refine()
gmsh.model.mesh.refine() # gmsh.model.mesh.refine()
gmsh.write("wires2d.msh") gmsh.write("wires2d.msh")
gmsh.model.mesh.setOrder(1)
#gmsh.fltk.run() #gmsh.fltk.run()
gmsh.finalize() gmsh.finalize()