Outputting Simulation Results 回答済み


I'm new to the analyst workspace, and I was going through this pzt disk tutorial. First of all, the images there weren't visible (the files were moved?), so I couldn't see any screenshots they may have posted there. I copy-pasted all the code from the tutorial and ran the simulation (after removing some 'term' functions that were stopping it from completing). However, none of the simulation results I downloaded were readable by the post-processor. What am I doing wrong?



Here's the script in case you wanted to see it:

c designer: onscale
c model description: pzt 2d axisymmetric disc
c date: 7/9/2020
c version: 1.0

c set model title
titl training pzt 2d disc example

c use all cores
mp omp * *

c do not save restart file
rest no

c geometry
symb water_size = 4e-3/* dimension of water around transducer
symb pzt_rad = 10e-3 /* pzt radius
symb pzt_thk = 2e-3/* pzt thickness

c frequency and mesh
symb freqint = 1e6 /* frequency of interest
symb freqdamp = $freqint /* set damping frequency to frequency of interest
symb vel = 1500 /* minimum material velocity in model
symb wavelength = $vel / $freqint /* calculate smallest wavelength to disctretise
symb nepw = 15 /* number of elements per wavelength
symb box = $wavelength / $nepw /* calculate element size for meshing

c create x-y-z keypoints to accurately model dimensions
symb #keycord x 1 0.0 $pzt_rad $water_size
symb #get { idx } rootmax x /* store last keypoint indice in variable 'idx'

symb #keycord y 1 0.0 $water_size $pzt_thk $water_size
symb #get { jdx } rootmax y /* store last keypoint indice in variable 'jdx'

c create i-j-k keypoints
symb #keyindx i 1 $idx 1 $box 1 /* calculate number of nodes required in i direction
symb #keyindx j 1 $jdx 1 $box 1 /* calculate number of nodes required in j direction

symb indgrd = $i$idx /* last node number in i direction
symb jndgrd = $j$jdx /* last node number in j direction

c create grid
grid $indgrd $jndgrd axiy /* generate grid of nodes and apply axisymmetric condition to model grid

c map physical geometry to grid of nodes
geom keypnt $idx $jdx /* tie in all xy keypoints (physical dimensions) to ij keypoints(nodes)

c material defintions
symb #read training.prjmat /* materials stored in .prjmat file and read into flex model

c allocate materials to grid
regn watr /* assign watr to full grid
regn pmt3 $i1 $i2 $j2 $j3 /* assign material 'pmt3' to grid defined by nodal range end

c plot model
nvew 2 2 /* set up 2 views
plot matr /* plot model
mirr x on /* apply visual symmetry
plot matr /* replot model

c boundary conditions & loading

c external boundary conditions
side xmin symm /* assign symmetry condition xmin side of model
side xmax absr /* assign absorbing boundary condition (infinite medium)
side ymin absr /* to xmax ymin and ymax side
side ymax absr

c define time varying function
func wvlt $freqint 1. /* wavelet impulse function

c piezoelectric loads
symb ascale = 1 /* area scaling for electrode area - required for accurate simulation of impedance amplitude - '1' for axiy model

wndo $i1 $i2 $j2 $j3 /* define electric window to pzt material - minimise for faster model run time

defn top $ascale /* define electrode - name 'top'
node $i1 $i2 $j3 $j3 /* assign nodes for top electrode

defn bot $ascale /* define electrode - name 'bot'
node $i1 $i2 $j2 $j2 /* assign nodes for bottom electrode

/* electrical boundary condition
bc top volt func /* apply voltage condition to 'top' electrode and assign driving signal 'func'
bc bot grnd /* apply ground condition to 'bot' electrode

slvr pard /* use pardiso solver - our new faster electrostatic solver for piezo simulations

pres aprs /* calculate pressure and acoustic pressure
disp /* calculate displacement
max aprs pmin pmax /* capture minimum & maximum acoustic pressure and store in 'pmin' & 'pmax' array

hist func /* time function - array '1'
histname electrode vq all /* voltage and charge data for all electrodes - array '2-5'
hist ydsp $i1 $i1 1 $j3 $j3 1 /* y-displacement at node on the top electrode - array '6'

data xdsp /* x displacement data to be extracted with mode shape
data ydsp /* y displacement data to be extracted with mode shape
freq $freqint /* mode shape '1'

defn kirc /* define type extrapolation boundary type - kirchoff
ref in $x1 $y2 /* reference point to determine extrapolation vector
node $i1 $indgrd-1 $j3+5 $j3+5 /* extrapolation boundary at the defined nodal indices
driv func /* storing time function to allow tvr calculation in toolkit


prcs /* check models, sets up required data arrays, calculates stable timestep for solver to run model

nvew 2 1
line on /* turn on mesh lines
arrow pole /* turn on poling arrows
plot piez /* plot created electrode
plot matr piez /* plot created electrode on top of model
term /* pause model to allow check


c running the model
exec $nexec /* execute model for 'nexec' timesteps

c plot outputs
nvew 3 1 /* set up 3 views for data plots
plot ydsp /* plot calculated data array
plot pmax /* plot max pressure data array
plot 2 /* plot time history 2 - pressure signal at front of defect
c term /* pause model to view results

c runtime calculations
symb #get { step } timestep /* extract calculated timestep from prcs command
symb simtime = 40 / $freqint /* simulation time - 40 cycles @ 1 mhz
symb nexec = $simtime / $step /* determine how many timesteps to run full model
symb nloops = 40 /* plotting snapshots during model execution
symb nexec2 = $nexec / $nloops /* partition full simulation into smaller segments for plotting

c setting up output plots
arrow off /* turn off arrows
line off /* turn off mesh lines
set imag avi /* set image capture for movie file generation
nvew 3 1 /* set up 3 plotting windows in layout number 1

c create procedure - code that can be executed 'x' number of times
proc plot save /* name procedure 'plot' and save the code

exec $nexec2 /* run model partially

plot ydsp /* plot calculated data array
plot 1 /* plot time history 1 - drive function
plot 3 /* plot time history 3 - charge on top electrode
imag /* snapshot of graphics window for movie generation
end$ proc /* end of procedure

c run model by calling 'plot' procedure 'nloops' times
proc plot $nloops

c term /* pause model to view results

file out pzt2d.flxdato
out modl /* outputs model geometry
out pres /* outputs pressure data field at the final simulated timestep
out shap/all /* output all requested mode shape data

c save symbols to file for later use
symb #get { label } jobname /* get model job name
symb #save '$label.symb' /* save symbol file

c end of input file