# Implementation of PMDL and DRM in OpenSees for Soil-Structure Interaction Analysis
## 2 Perfectly Matched Discrete Layers
### Implementation
From (3) to (5), using the values for the reference wave velocity, denoted \(V_{x}\), and the equivalent length, represented by \(2a=-2 iV_{x}/(\omega cos\theta_{xk})\), the dynamic stiffness of a PMDLXX element may be given by the following expressions:  
\[S_{x}=K_{x}+i\omega C_{x}-\omega^{2}M_{x}+\frac{1}{i\omega}R_{x} \tag{7}\]  
\[K_{x}=\int\limits_{-1}^{1}\int\limits_{-1}^{1}\Big{(}B_{rs}^{T}D_{rs}B_{rs}+B_{ sr}^{T}D_{sr}B_{sr}\Big{)}drds+\alpha\int\limits_{-1}^{1}\int\limits_{-1}^{1} \Big{(}\frac{bV_{x}}{\cos\theta_{xk}}\rho N^{T}N\Big{)}drds+\beta\int\limits_{ -1}^{1}\int\limits_{-1}^{1}\Big{(}\frac{V_{x}}{b\cos\theta_{xk}}B_{ss}^{T}D_{ ss}B_{ss}\Big{)}drds \tag{8}\]  
\[C_{x}=\int\limits_{-1}^{1}\int\limits_{-1}^{1}\Big{(}\frac{b\cos\theta_{xk}}{ V_{x}}B_{rr}^{T}D_{rr}B_{rr}\Big{)}drds+\beta\int\limits_{-1}^{1}\int\limits_{-1} ^{1}\Big{(}B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\Big{)}drds+\int\limits _{-1}^{1}\int\limits_{-1}^{1}\Big{(}\frac{bV_{x}}{\cos\theta_{xk}}\rho N^{T}N \Big{)}drds \tag{9}\]  
\[M_{x}=\int\limits_{-1}^{1}\int\limits_{-1}^{1}\bigg{(}\frac{b\cos\theta_{xk}} {V_{x}}B_{rr}^{T}D_{rr}B_{rr}\bigg{)}drds \tag{10}\]  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]0  
For a PMDLZZ element, using Equations (3)-(5), the values for the reference wave velocity \(V_{z}\) and the equivalent length \(2b=-2 iV_{z}/(\omega cos\theta_{zk})\), the dynamic stiffness of a PMDLZZ element may be given by the following expression:  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]1  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]2  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]3  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]4  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]5  
For a PMDLXX element, should at least one of the dimensions, 2a or 2b, be real, the methodology for determining the dynamic stiffness is analogous to that employed for edge elements (PMDLXX and PMDLZZ). In the event that both dimensions \(2a=-2 iV_{x}/(\omega cos\theta_{xk})\) and \(2b=-2 iV_{z}/(\omega cos\theta_{zk})\) are imaginary, the dynamic stiffness must be revised as follows:  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]6\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]7  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]8  
\[K=\int_{-1}^{1}\int_{-1}^{1}\bigg{(}\frac{b}{a}B_{rr}^{T}D_{rr}B_{rr}+\frac{a}{b} B_{ss}^{T}D_{ss}B_{ss}+B_{rs}^{T}D_{rs}B_{rs}+B_{sr}^{T}D_{sr}B_{sr}\bigg{)}drds \tag{4}\]9  
In Equations (3)-(20), a and b denote the half-width and half-height of the rectangular PMDL element. S, K, M, C, and R represent the dynamic stiffness, stiffness, mass, damping, and auxiliary matrices, respectively, while \(\rho\) represents the material density. PMDLs should be modeled with elastic material, while the interior domain (Figure 2b), along with the substructure and superstructure, can be represented using either elastic or nonlinear materials.