Dynamic simulation of a printed circuit board assembly#

This examples shows how to use PyMAPDL to import an existing FE model and to run a modal and PSD analysis. PyDPF modules are also used for post-processing.

The following topics are available:

This example is inspired from the model and analysis defined in Chapter 20 of the Mechanical APDL Technology Showcase Manual.

20.1. Introduction#

20.1.1. Additional Packages Used#

20.1.2. Setting up model#

The original FE model is given in the Ansys Mechanical APDL Technology Showcase Manual. The pcb_mesh_file.cdb contains a FE model of a single circuit board. The model is meshed with SOLID186, SHELL181 and BEAM188 elements. All components of the PCB model is assigned with linear elastic isotropic materials. Bonded and flexible surface-to-surface contact pairs are used to define the contact between the IC packages and the circuit board.

20.1.3. Starting MAPDL as a service#

# sphinx_gallery_thumbnail_path = '_static/tse20_setup.png'

import _.pyplot as plt

from ansys.mapdl.core import launch_mapdl
from ansys.mapdl.core.examples.downloads import download_tech_demo_data

# start MAPDL as a service
mapdl = launch_mapdl()
print(mapdl)
Product:             Ansys Mechanical Enterprise
MAPDL Version:       21.2
ansys.mapdl Version: 0.63.0

20.2. Modeling#

20.2.1. Importing an external model#

# read model of single circuit board
# download the cdb file
pcb_mesh_file = download_tech_demo_data("td-20", "pcb_mesh_file.cdb")

# enter preprocessor and read in cdb
mapdl.prep7()
mapdl.cdread("COMB", pcb_mesh_file)
mapdl.allsel()
mapdl.eplot(background="w")
mapdl.cmsel("all")
20 example technology showcase dynamic simulation PCB

20.2.2. Creating the complete layered model#

The original model will be duplicated to create a layered PCB of three layers that are bound together.

# duplicate single PCB to get three layers
# get the maximum node number for the single layers PCB in the input file
max_nodenum = mapdl.get("max_nodenum", "node", "", "num", "max")

# generate additional PCBs offset by 20 mm in the -y direction
mapdl.egen(3, max_nodenum, "all", dy=-20)


# bind the three layers together
# select components of interest
mapdl.cmsel("s", "N_JOINT_BOARD")
mapdl.cmsel("a", "N_JOINT_LEGS")
mapdl.cmsel("a", "N_BASE")

# get number of currently selected nodes
nb_selected_nodes = mapdl.mesh.n_node
current_node = 0
queries = mapdl.queries

# also select similar nodes for copies of the single PCB
# and couple all dofs at the interface
for node_id in range(1, nb_selected_nodes + 1):
    current_node = queries.ndnext(current_node)
    mapdl.nsel("a", "node", "", current_node + max_nodenum)
    mapdl.nsel("a", "node", "", current_node + 2 * max_nodenum)
mapdl.cpintf("all")

# define fixed support boundary condition
# get max coupled set number
cp_max = mapdl.get("cp_max", "cp", 0, "max")

# unselect nodes scoped in CP equations
mapdl.nsel("u", "cp", "", 1, "cp_max")

# create named selection for base excitation
mapdl.cm("n_base_excite", "node")

# fix displacement for base excitation nodes
mapdl.d("all", "all")

# select all and plot the model using MAPDL's plotter and VTK's
mapdl.allsel("all")
mapdl.cmsel("all")
mapdl.graphics("power")
mapdl.rgb("index", 100, 100, 100, 0)
mapdl.rgb("index", 80, 80, 80, 13)
mapdl.rgb("index", 60, 60, 60, 14)
mapdl.rgb("index", 0, 0, 0, 15)
mapdl.triad("rbot")
mapdl.pnum("type", 1)
mapdl.number(1)
mapdl.hbc(1, "on")
mapdl.pbc("all", "", 1)
mapdl.view(1, 1, 1, 1)
# mapdl.eplot(vtk=False)
mapdl.eplot(vtk=True)
20 example technology showcase dynamic simulation PCB

20.4. PSD analysis#

20.4.1. Run PSD analysis#

The response spectrum analysis is defined, solved and post-processed.

# define PSD analysis with input spectrum
mapdl.slashsolu()
mapdl.antype("spectr")

# power spectral density
mapdl.spopt("psd")

# use input table 1 with acceleration spectrum in terms of acceleration due to gravity
mapdl.psdunit(1, "accg", 9.81 * 1000)

# define the frequency points in the input table 1
mapdl.psdfrq(1, "", 1, 40, 50, 70.71678, 100, 700, 900)

# define the PSD values in the input table 1
mapdl.psdval(1, 0.01, 0.01, 0.1, 1, 10, 10, 1)

# set the damping ratio as 5%
mapdl.dmprat(0.05)

# apply base excitation on the set of nodes N_BASE_EXCITE in the y-direction from table 1
mapdl.d("N_BASE_EXCITE", "uy", 1)

# calculate the participation factor for PSD with base excitation from input table 1
mapdl.pfact(1, "base")

# write the displacent solution relative to the base excitation to the results file from the PSD analysis
mapdl.psdres("disp", "rel")

# write the absolute velocity solution to the results file from the PSD analysis
mapdl.psdres("velo", "abs")

# write the absolute acceleration solution to the results file from the PSD analysis
mapdl.psdres("acel", "abs")

# combine only those modes whose significance level exceeds 0.0001
mapdl.psdcom()
output = mapdl.solve()
print(output)
*** NOTE ***                            CP =      16.328   TIME= 06:53:12
 The automatic domain decomposition logic has selected the MESH domain
 decomposition method with 2 processes per solution.

 *****  ANSYS SOLVE    COMMAND  *****

 Time at start of random vibration closed-form solution CP= 16.328125.


 FREQUENCIES USED FOR RANDOM VIBRATION SOLUTION

  MODE   FREQUENCY

     1    21.6843
     2    21.6902
     3    21.6913
     4    33.8297
     5    33.8380
     6    33.8394
     7    37.0606
     8    37.0709
     9    37.0719
    10    43.8375

 PERFORM INTEGRATION FOR DISPLACEMENT-TYPE QUANTITIES

 PERFORM INTEGRATION FOR VELOCITY-TYPE QUANTITIES

 PERFORM INTEGRATION FOR ACCELERATION-TYPE QUANTITIES

 Modal covariance matrix computed CP= 16.328125.

 Quasi-static modal covariance matrix computed CP= 16.328125.

 Covariant-modal covariance matrix computed CP= 16.328125.

 Psd file file0.psd created. CP= 16.328125.

 Time at start of random vibration mode combinations CP= 16.328125.

  BASE EXCITATION PROBLEM


 ***** SUMMARY OF TERMS INCLUDED IN MODE COMBINATIONS *****
            (MODAL COVARIANCE MATRIX TERMS ONLY)

             *** DISPLACEMENT-TYPE QUANTITY ***

           MAXIMUM TERM = 0.73456E-04

             MODE  MODE   COVARIANCE    COVARIANCE
               I     J       TERM         RATIO

               1       1    0.73456E-04    1.0000
               2       1    0.33327E-04   0.45370
               2       2    0.15120E-04   0.20584
               3       1    0.50316E-04   0.68498
               3       2    0.22828E-04   0.31078
               3       3    0.34466E-04   0.46920
               4       1    0.64485E-05   0.87787E-01
               4       2    0.29267E-05   0.39843E-01
               4       3    0.44189E-05   0.60158E-01
               4       4    0.26183E-05   0.35644E-01
               5       1    0.30932E-05   0.42109E-01
               5       2    0.14039E-05   0.19112E-01
               5       3    0.21196E-05   0.28856E-01
               5       4    0.12558E-05   0.17096E-01
               5       5    0.60234E-06   0.82001E-02
               6       1    0.46985E-05   0.63964E-01
               6       2    0.21325E-05   0.29031E-01
               6       3    0.32198E-05   0.43833E-01
               6       4    0.19076E-05   0.25969E-01
               6       5    0.91495E-06   0.12456E-01
               6       6    0.13898E-05   0.18920E-01
               7       1    0.10933E-04   0.14884
               7       2    0.49619E-05   0.67549E-01
               7       3    0.74918E-05   0.10199
               7       4    0.37206E-05   0.50651E-01
               7       5    0.17855E-05   0.24307E-01
               7       6    0.27124E-05   0.36925E-01
               7       7    0.71392E-05   0.97190E-01
               8       1    0.68895E-05   0.93791E-01
               8       2    0.31268E-05   0.42567E-01
               8       3    0.47210E-05   0.64270E-01
               8       4    0.23433E-05   0.31900E-01
               8       5    0.11245E-05   0.15309E-01
               8       6    0.17083E-05   0.23256E-01
               8       7    0.44986E-05   0.61241E-01
               8       8    0.28346E-05   0.38590E-01
               9       1    0.99875E-05   0.13597
               9       2    0.45329E-05   0.61708E-01
               9       3    0.68440E-05   0.93171E-01
               9       4    0.33968E-05   0.46243E-01
               9       5    0.16301E-05   0.22192E-01
               9       6    0.24763E-05   0.33712E-01
               9       7    0.65214E-05   0.88780E-01
               9       8    0.41093E-05   0.55942E-01
               9       9    0.59571E-05   0.81098E-01
              10       1    0.23871E-04   0.32496
              10       2    0.10834E-04   0.14748
              10       3    0.16357E-04   0.22268
              10       4    0.70587E-05   0.96095E-01
              10       5    0.33864E-05   0.46101E-01
              10       6    0.51441E-05   0.70030E-01
              10       7    0.12750E-04   0.17358
              10       8    0.80366E-05   0.10941
              10       9    0.11651E-04   0.15861
              10      10    0.36571E-04   0.49786

              *** VELOCITY-TYPE QUANTITY ***

           MAXIMUM TERM =  15.547

             MODE  MODE   COVARIANCE    COVARIANCE
               I     J       TERM         RATIO

               1       1     15.547        1.0000
               2       1     7.0557       0.45383
               2       2     3.2021       0.20596
               3       1     10.653       0.68521
               3       2     4.8347       0.31097
               3       3     7.2996       0.46952
               4       1     3.8958       0.25058
               4       2     1.7681       0.11372
               4       3     2.6695       0.17171
               4       4     1.0786       0.69377E-01
               5       1     1.8688       0.12020
               5       2    0.84811       0.54551E-01
               5       3     1.2805       0.82365E-01
               5       4    0.51739       0.33279E-01
               5       5    0.24818       0.15963E-01
               6       1     2.8387       0.18259
               6       2     1.2883       0.82864E-01
               6       3     1.9451       0.12511
               6       4    0.78592       0.50551E-01
               6       5    0.37699       0.24249E-01
               6       6    0.57266       0.36834E-01
               7       1     6.5885       0.42378
               7       2     2.9901       0.19233
               7       3     4.5146       0.29039
               7       4     1.7955       0.11549
               7       5    0.86132       0.55401E-01
               7       6     1.3084       0.84155E-01
               7       7     3.0886       0.19866
               8       1     4.1517       0.26704
               8       2     1.8842       0.12119
               8       3     2.8448       0.18298
               8       4     1.1314       0.72770E-01
               8       5    0.54272       0.34908E-01
               8       6    0.82441       0.53027E-01
               8       7     1.9463       0.12519
               8       8     1.2264       0.78885E-01
               9       1     6.0186       0.38712
               9       2     2.7315       0.17569
               9       3     4.1241       0.26527
               9       4     1.6401       0.10549
               9       5    0.78677       0.50606E-01
               9       6     1.1951       0.76872E-01
               9       7     2.8215       0.18148
               9       8     1.7779       0.11436
               9       9     2.5774       0.16578
              10       1     13.822       0.88902
              10       2     6.2727       0.40347
              10       3     9.4709       0.60918
              10       4     3.7285       0.23982
              10       5     1.7885       0.11504
              10       6     2.7168       0.17475
              10       7     6.3657       0.40945
              10       8     4.0114       0.25802
              10       9     5.8153       0.37404
              10      10     14.121       0.90826

             *** ACCELERATION-TYPE QUANTITY ***

           MAXIMUM TERM = 0.36471E+08

             MODE  MODE   COVARIANCE    COVARIANCE
               I     J       TERM         RATIO

               1       1    0.36471E+08    1.0000
               2       1    0.16552E+08   0.45383
               2       2    0.75116E+07   0.20596
               3       1    0.24990E+08   0.68521
               3       2    0.11341E+08   0.31097
               3       3    0.17124E+08   0.46952
               4       1    0.93868E+07   0.25738
               4       2    0.42600E+07   0.11680
               4       3    0.64320E+07   0.17636
               4       4    0.24200E+07   0.66353E-01
               5       1    0.45026E+07   0.12346
               5       2    0.20434E+07   0.56028E-01
               5       3    0.30852E+07   0.84593E-01
               5       4    0.11608E+07   0.31827E-01
               5       5    0.55679E+06   0.15267E-01
               6       1    0.68394E+07   0.18753
               6       2    0.31039E+07   0.85106E-01
               6       3    0.46865E+07   0.12850
               6       4    0.17632E+07   0.48346E-01
               6       5    0.84577E+06   0.23190E-01
               6       6    0.12847E+07   0.35226E-01
               7       1    0.15678E+08   0.42987
               7       2    0.71150E+07   0.19509
               7       3    0.10743E+08   0.29455
               7       4    0.40413E+07   0.11081
               7       5    0.19385E+07   0.53152E-01
               7       6    0.29446E+07   0.80738E-01
               7       7    0.67544E+07   0.18520
               8       1    0.98787E+07   0.27086
               8       2    0.44832E+07   0.12293
               8       3    0.67690E+07   0.18560
               8       4    0.25465E+07   0.69822E-01
               8       5    0.12215E+07   0.33491E-01
               8       6    0.18554E+07   0.50874E-01
               8       7    0.42560E+07   0.11670
               8       8    0.26818E+07   0.73531E-01
               9       1    0.14321E+08   0.39266
               9       2    0.64992E+07   0.17820
               9       3    0.98129E+07   0.26906
               9       4    0.36916E+07   0.10122
               9       5    0.17707E+07   0.48552E-01
               9       6    0.26898E+07   0.73750E-01
               9       7    0.61698E+07   0.16917
               9       8    0.38877E+07   0.10660
               9       9    0.56359E+07   0.15453
              10       1    0.31765E+08   0.87095
              10       2    0.14416E+08   0.39526
              10       3    0.21766E+08   0.59679
              10       4    0.81902E+07   0.22457
              10       5    0.39286E+07   0.10772
              10       6    0.59676E+07   0.16362
              10       7    0.13688E+08   0.37532
              10       8    0.86252E+07   0.23649
              10       9    0.12504E+08   0.34284
              10      10    0.27823E+08   0.76287


 ***** SUMMARY OF OUTPUT QUANTITIES COMPUTED *****
           AND WRITTEN ON RESULTS FILE

     DISPLACEMENT-TYPE QUANTITIES COMPUTED
      AND WRITTEN ON RESULTS FILE AS LOAD STEP  3
      VALUES ARE RELATIVE TO BASE

      THESE ARE STATISTICAL QUANTITIES WHICH
      CANNOT BE COMBINED OR TRANSFORMED IN ANY
      VECTORIAL SENSE


     VELOCITY-TYPE QUANTITIES COMPUTED
      AND WRITTEN ON RESULTS FILE AS LOAD STEP  4
      VALUES ARE ABSOLUTE

      THESE ARE STATISTICAL QUANTITIES WHICH
      CANNOT BE COMBINED OR TRANSFORMED IN ANY
      VECTORIAL SENSE


     ACCELERATION-TYPE QUANTITIES COMPUTED
      AND WRITTEN ON RESULTS FILE AS LOAD STEP  5
      VALUES ARE ABSOLUTE

      THESE ARE STATISTICAL QUANTITIES WHICH
      CANNOT BE COMBINED OR TRANSFORMED IN ANY
      VECTORIAL SENSE

20.4.2. Post-process PSD analysis#

The response spectrum analysis is post-processed. First, the standard MAPDL POST1 postprocessor is used. Then, the MAPDL time-history POST26 postprocessor is used to generate the response power spectral density.

Note

The graph generated through POST26 is exported as a picture in the working directory. Finally, the results from POST26 are saved to Python variables to be plotted in the Python environment with the use of Matplotlib library.

20.4.2.1. Post-process PSD analysis in POST1#

mapdl.post1()
mapdl.set(1, 1)
mapdl.plnsol("u", "sum")
mapdl.set("last")
mapdl.plnsol("u", "sum")
20 example technology showcase dynamic simulation PCB

20.4.2.2. Post-process PSD analysis in POST26 (time-history post-processing)#

mapdl.post26()

# allow storage for 200 variables
mapdl.numvar(200)
mapdl.cmsel("s", "MY_MONITOR")
monitored_node = mapdl.queries.ndnext(0)
mapdl.store("psd")

# store the psd analysis u_y data for the node MYMONITOR as the reference no 2
mapdl.nsol(2, monitored_node, "u", "y")

# compute the response power spectral density for displacement associated with variable 2
mapdl.rpsd(3, 2)
mapdl.show("png")

# plot the variable 3
mapdl.plvar(3)

# print the variable 3
mapdl.prvar(3)

# x-axis is set for Log X scale
mapdl.gropt("logx", 1)

# y-axis is set for Log X scale
mapdl.gropt("logy", 1)

# plot the variable 3
mapdl.plvar(3)
mapdl.show("close")

20.4.2.3. Post-process PSD analysis using Matplotlib#

# store MAPDL results to python variables
mapdl.dim("frequencies", "array", 4000, 1)
mapdl.dim("response", "array", 4000, 1)
mapdl.vget("frequencies(1)", 1)
mapdl.vget("response(1)", 3)
frequencies = mapdl.parameters["frequencies"]
response = mapdl.parameters["response"]

# use Matplotlib to create graph
fig = plt.figure()
ax = fig.add_subplot(111)
plt.xscale("log")
plt.yscale("log")
ax.plot(frequencies, response)
ax.set_xlabel("Frequencies")
ax.set_ylabel("Response power spectral density")
20 example technology showcase dynamic simulation PCB

20.5. Exit MAPDL#

mapdl.exit()

20.6. Input files#

The following file was used in this problem: pcb_mesh_file.cdb contains a FE model of a single circuit board

  • pcb_mesh_file.cdb – Input file containing the model of a single circuit board.

Download the zipped td-20 file set for this problem

For more information, see Obtaining the input files.

Gallery generated by Sphinx-Gallery