modified: .gitignore
modified: anasen_fem/paraview_plotter.py included code to make and save field plots modified: anasen_fem/run.py included changes for parapview plotter and also save all outputs for mesh and elmer in folders modified: anasen_fem/scalars.dat.names modified: anasen_fem/wires_gmsh2d_bc.py
This commit is contained in:
parent
5b34251638
commit
74dfc46d8c
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -30,3 +30,4 @@ qqq_gains_det3.dat
|
|||
qqq_relative_gains.dat
|
||||
Armory/CorrelateQQQ.h
|
||||
QQQStage2.C
|
||||
anasen_fem/scalars.dat.names
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from paraview.simple import *
|
|||
reader = XMLUnstructuredGridReader(FileName=["wires2d/elfield_anasen_t0001.vtu"])
|
||||
|
||||
contour_filter = Contour(Input=reader,ContourBy = 'potential')
|
||||
contour_filter.Isosurfaces = [i for i in np.arange(0,660,650/24.)]
|
||||
contour_filter.Isosurfaces = [i for i in np.arange(0,660,650/32.)]
|
||||
|
||||
renderView = GetActiveViewOrCreate('RenderView')
|
||||
renderView.ViewSize = [2000,2000]
|
||||
|
|
@ -61,3 +61,59 @@ view.CameraParallelProjection = 1
|
|||
Render()
|
||||
|
||||
SaveScreenshot("contour_output.png")
|
||||
|
||||
#make glyps for field lines
|
||||
contour_display.LineWidth = 1.0 # Increase this for thicker lines
|
||||
contour_display.RenderLinesAsTubes = 0 # Makes lines look smoother at high res
|
||||
|
||||
# 1. Get the active view
|
||||
view = GetActiveView()
|
||||
|
||||
# 4. Apply settings
|
||||
# 1. Set the Focal Point to the middle of the quadrant
|
||||
zoom_center = [-25, 25, 0.0]
|
||||
|
||||
# 2. Tighten the Parallel Scale
|
||||
view.CameraParallelScale = 15
|
||||
|
||||
# 3. Position the Camera
|
||||
# Keep it 0.5m away looking "down" at the new center
|
||||
view.CameraPosition = [zoom_center[0], zoom_center[1], 0.5]
|
||||
view.CameraFocalPoint = zoom_center
|
||||
view.CameraViewUp = [0.0, 1.0, 0.0]
|
||||
# pot_threshold = Threshold(Input=reader)
|
||||
# pot_threshold.Scalars = ['POINTS', 'potential']
|
||||
# pot_threshold.ThresholdMethod = 'Above Upper Threshold'
|
||||
# pot_threshold.UpperThreshold = 100.0
|
||||
|
||||
# --- 2. Create the Glyph Filter (The Arrows) ---
|
||||
# IMPORTANT: Use 'pot_threshold' as the Input, not the 'reader'
|
||||
glyph = Glyph(Input=reader, GlyphType='Arrow')
|
||||
|
||||
# Orientation Array: Use the 'electric field' vector from Elmer
|
||||
glyph.OrientationArray = ['POINTS', 'electric field']
|
||||
glyph.ScaleArray = ['POINTS', 'No scale array']
|
||||
glyph.ScaleFactor = 1
|
||||
|
||||
# Sampling: Every nth point (Stride 16)
|
||||
glyph.GlyphMode = 'Every Nth Point'
|
||||
glyph.Stride = 96
|
||||
|
||||
# --- 3. Display the Glyphs ---
|
||||
glyph_display = Show(glyph, renderView)
|
||||
|
||||
# Set the representation to Surface so we see the full arrow colors
|
||||
glyph_display.Representation = 'Surface'
|
||||
|
||||
# This is the critical line: Color the arrows by the 'potential' scalar
|
||||
ColorBy(glyph_display, ('POINTS', 'potential'))
|
||||
contour_display_potentialLUT.RescaleTransferFunction(0.0, 660.0)
|
||||
glyph_display.LookupTable = contour_display_potentialLUT
|
||||
|
||||
# Optional: Disable the scalar bar for the arrows to avoid cluttering
|
||||
# the existing 'potential' scalar bar.
|
||||
glyph_display.SetScalarBarVisibility(renderView, False)
|
||||
|
||||
# --- 4. Final Render ---
|
||||
Render()
|
||||
SaveScreenshot("Field_output.png")
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
import code
|
||||
import os
|
||||
|
||||
val=-178.3
|
||||
# val=17.83
|
||||
count=0
|
||||
while val<17.83+0.1:
|
||||
# val=-178.3
|
||||
val=17.83
|
||||
count=11
|
||||
while val<178.3+0.1:
|
||||
print(val)
|
||||
os.system("python3 wires_gmsh2d_bc.py "+str(val))
|
||||
os.system("cp wires2d/mesh_files/wires2d.msh wires2d/mesh_files/%02d_%1.4f.msh"%(count,val))
|
||||
os.system("ElmerGrid 14 2 wires2d/mesh_files/wires2d_%02d_%1.4f.msh"%(count,val))
|
||||
os.system("cp wires2d.sif wires2d/sif_files/wires2d_%02d_%1.4f.sif"%(count,val))
|
||||
os.system("ElmerSolver wires2d/sif_files/wires2d_%02d_%1.4f.sif"%(count,val))
|
||||
os.system("cp wires2d/elfield_anasen_t0001.vtu wires2d/vtu_files/elfield_anasen_%02d_%1.4f.vtu"%(count,val))
|
||||
os.system("./paraview_plotter.py")
|
||||
os.system("cp contour_output.png png/contour_output_z_%02d_%1.4f.png"%(count,val))
|
||||
# os.system("cp field_output.png field_ouput_z_%02d_%1.4f.png"%(count,val))
|
||||
os.system("cp contour_output.png png/Contour_output_z_%02d_%1.4f.png"%(count,val))
|
||||
os.system("cp Field_output.png png/Field_ouput_z_%02d_%1.4f.png"%(count,val))
|
||||
|
||||
val=val+17.83
|
||||
count = count + 1
|
||||
break
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
Metadata for SaveScalars file: ./scalars.dat
|
||||
Elmer version: 26.1
|
||||
Elmer compilation date: 2026-03-15
|
||||
Solver input file: wires2d/sif_files/wires2d_00_-178.3000.sif
|
||||
File started at: 2026/03/31 10:12:11
|
||||
Solver input file: wires2d/sif_files/wires2d_11_17.8300.sif
|
||||
File started at: 2026/03/31 13:26:51
|
||||
|
||||
Variables in columns of matrix:
|
||||
1: res: potential difference
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ gmsh.model.setPhysicalName(1,30,"cathode_wires")
|
|||
gmsh.model.addPhysicalGroup(2,[anasen_barrel],tag=13)
|
||||
gmsh.model.setPhysicalName(1,13,"gas")
|
||||
|
||||
gmsh.option.setNumber("Mesh.Algorithm", 5)
|
||||
gmsh.option.setNumber("Mesh.Algorithm", 6)
|
||||
|
||||
gmsh.model.mesh.generate(dim=2)
|
||||
gmsh.model.mesh.refine()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user