Bill Bulat
Ansys Employee

As far as I can tell, SPMWRITE will only write state space matrices between structural DOFs. But I think I've managed to find a work around. Please copy the following APDL commands into a text file, then read that file into MAPDL with the /INPUT command. It creates an spm file, though I frankly don't know if it's valid. The "trick": I use CEs to force the values of UZ of each of two MASS21 nodes to the respective values of VOLT on the electrodes on two piezo transducers at opposite ends of a short beam. I then reference the MASS21 UZ DOFs (which equal the electrode voltages) in SPMWRITE. I hope this helps you get to where you're trying to go.

Kind regards,

Bill

HERE'S THE APDL:

fini
/cle
 
/vup,1,z
/view,1,1,1,1
/pnu,mat,1
/num,1
 
 
C*****************************************************
C*** PARAMETERS
C*****************************************************
 
eps0=8.854e-12 ! FREE SPACE PERMITTIVITY
 
a=0.010 ! DIMENSIONS
t_piezo=0.002
s=0.030
t_beam=0.001
 
nmodes=6 ! # OF MODES
 
E_beam=2e11 ! BEAM MATERIAL PROPERTIES
nu_beam=0.3
dnsty_beam=7800
 
dnsty_piezo = 7489
 
C*** PIEZO DIELECTRIC CONSTANTS (PERMITTIVITIES) (F/M)
ep11 = 402.078
                ep22 = 402.078
                                 ep33 = 329.794
 
C*** PIEZOELECTRIC MATRIX VALUES (C/M^2)
e11 = 0         $e12 = 0         $e13 = -4.1
e21 = 0         $e22 = 0         $e23 = -4.1
e31 = 0         $e32 = 0         $e33 = 14.1
e41 = 0         $e42 = 0         $e43 = 0
e51 = 0         $e52 = 10.5      $e53 = 0
e61 = 10.5      $e62 = 0         $e63 = 0
 
C*** PIEZO ELASTIC MATRIX VALUES (N/M^2)
$c11=13.2e10$
$c21=7.1e10 $c22=13.2e10
$c31=7.3e10 $c32=7.3e10 $c33=11.5e10
$c41=0      $c42=0      $c43=0      $c44=3.0e10
$c51=0      $c52=0      $c53=0      $c54=0      $c55=2.6e10
$c61=0      $c62=0      $c63=0      $c64=0      $c65=0      $c66=2.6e10
 
 
C*****************************************************
C*** GEOMETRY
C*****************************************************
/prep7
 
vsel,none
bloc,-a-s/2,-s/2,-a/2,a/2,0,-t_beam
bloc,-s/2,s/2,-a/2,a/2,0,-t_beam
bloc,s/2,s/2+a,-a/2,a/2,0,-t_beam
vatt,1,1,1
 
vsel,none
bloc,-a-s/2,-s/2,-a/2,a/2,0,t_piezo
bloc,s/2,s/2+a,-a/2,a/2,0,t_piezo
vatt,2,2,2
 
alls
numm,kp
 
 
C*****************************************************
C*** ATTRIBUTES, MESH
C*****************************************************
et,1,186
mp,ex,1,E_beam
mp,dens,1,dnsty_beam
mp,nuxy,1,nu_beam
 
et,2,226,1001
 
mp,perx,2,ep11
mp,pery,2,ep22
mp,perz,2,ep33
 
tb,piez,2,,18
tbda,1,e11,e12,e13,e21,e22,e23
tbda,7,e31,e32,e33,e41,e42,e43
tbda,13,e51,e52,e53,e61,e62,e63
 
tb,anel,2,,21
tbda,1,c11,c21,c31,c41,c51,c61
tbda,7,c22,c32,c42,c52,c62,c33
tbda,13,c43,c53,c63,c44,c54,c64
tbda,19,c55,c65,c66
 
mp,dens,2,dnsty_piezo
 
et,21,21,,,2 ! MASS21 ELEMENTS OVER EACH ELECTRODE (UX, UY, UZ)
r,21,1e-8 ! INSIGNIFICANT MASS
n,1,-s/2-a/2,,t_piezo ! NODE 1 AT ELECTRODE 1
n,2,s/2+a/2,,t_piezo ! NODE 2 AT ELECTRODE 2
type,21 $real,21 $e,1 $e,2 ! CREATE MASS21 ELEMENTS
d,all,ux ! CONSTRAIN UX & UY, ALLOW ONLY UZ
d,all,uy
 
 
vmes,all ! MESH VOLUMES
 
eplo
 
 
C*****************************************************
C*** BCs
C*****************************************************
esel,s,mat,,2
 
nsle
nsel,r,loc,z
cm,ground_n,node
d,ground_n,volt
 
nsle
nsel,r,loc,z,t_piezo
nsel,r,loc,x,-s/2-a,-s/2
cm,v1_n,node
*get,nnds,node,,count
nd=0
*do,i,1,nnds
 cmse,s,v1_n
 nd=ndnext(nd)
 nsel,a,node,,1
 ce,next,0,nd,volt,1,1,uz,-1
*enddo
 
nsle
nsel,r,loc,z,t_piezo
nsel,r,loc,x,s/2,s/2+a
cm,v2_n,node
*get,nnds,node,,count
nd=0
*do,i,1,nnds
 cmse,s,v2_n
 nd=ndnext(nd)
 nsel,a,node,,2
 ce,next,0,nd,volt,1,2,uz,-1
*enddo
 
 
fini
 
 
C*****************************************************
C*** SOLVE
C*****************************************************
/solu
anty,modal
modo,lanb,nmodes,100
alls
save
solv
fini
 
 
C*****************************************************
C*** POST PROCESSING
C*****************************************************
/post1
set,1,1
plns,u,z
 
 
C*****************************************************
C*** SPMWRITE
C*****************************************************
C*** input definition
*dim,inputTab,,1,2
*dim,inputLab,CHAR,1
inputTab(1,1) = 1 ! node 1
inputTab(1,2) = 3 ! uz (= VOLT via CEs)
inputLab(1) = 'n1_volt'
 
C*** output definition
*dim,outputTab,,1,2
*dim,outputLab,CHAR,1
outputTab(1,1) = 2 ! node 2
outputTab(1,2) = 3 ! uz (= VOLT via CEs)
outputLab(1) = 'n2_volt'
 
 
spmwrite,modal,nmodes,inputTab,inputLab,outputTab,outputLab,1