# Diff of /trunk/doc/cookbook/twodswp001.tex

revision 2860 by ahallam, Thu Sep 10 02:58:44 2009 UTC revision 2861 by gross, Wed Jan 20 02:47:42 2010 UTC
# Line 25  where $\sigma$ represents stress and is Line 25  where $\sigma$ represents stress and is
25   \label{eqn:sigw}   \label{eqn:sigw}
26   \sigma \hackscore{ij} = \lambda u\hackscore{k,k} \delta\hackscore{ij} + \mu ( u\hackscore{i,j} + u\hackscore{j,i})   \sigma \hackscore{ij} = \lambda u\hackscore{k,k} \delta\hackscore{ij} + \mu ( u\hackscore{i,j} + u\hackscore{j,i})
27
28  $\lambda$ and $\mu$ are the Lame Coefficients. Specifically $\mu$ is the bulk modulus. Equation \ref{eqn:wav} can be written with the Einstein summation convention as:  $\lambda$ and $\mu$ are the Lame Coefficients. Specifically $\mu$ is the bulk modulus. The \refEq{eqn:wav} can be written with the Einstein summation convention as:
29
30   \rho u\hackscore{i,tt} = \sigma\hackscore{ij,j}   \rho u\hackscore{i,tt} = \sigma\hackscore{ij,j}
31
# Line 94  This places the receivers on the surface Line 94  This places the receivers on the surface
94  u_pc_data=open(os.path.join(savepath,'U_pc.out'),'w')  u_pc_data=open(os.path.join(savepath,'U_pc.out'),'w')
95  u_pc_data.write("%f %f %f %f %f %f %f\n"%(t,u_pc_x1,u_pc_y1,u_pc_x2,u_pc_y2,u_pc_x3,u_pc_y3))  u_pc_data.write("%f %f %f %f %f %f %f\n"%(t,u_pc_x1,u_pc_y1,u_pc_x2,u_pc_y2,u_pc_x3,u_pc_y3))
96  \end{verbatim}  \end{verbatim}
97  Convieniently this saves the time, x direction displacement and y direction displacement values for these locations. Now that the initial conditions have been defined we can tackle the task of solving the wave equation for the number of required time steps. To do this we require a while loop and form of the wave equation which fits our general linear PDE form. We start with the form of the equation for stress \ref{eqn:sigw}. We can define the kronecker matrix using the domain and take the derivative of \verb u  via the function \verb|grad(u)|  . As $\lambda$ and $\mu$ are constants we can now define $\sigma$;  Convieniently this saves the time, x direction displacement and y direction displacement values for these locations. Now that the initial conditions have been defined we can tackle the task of solving the wave equation for the number of required time steps. To do this we require a while loop and form of the wave equation which fits our general linear PDE form. We start with the form of the equation for stress \refEq{eqn:sigw}. We can define the kronecker matrix using the domain and take the derivative of \verb u  via the function \verb|grad(u)|  . As $\lambda$ and $\mu$ are constants we can now define $\sigma$;
98  \begin{verbatim}  \begin{verbatim}
99  g=grad(u)  g=grad(u)
100  stress=lam*trace(g)*kmat+mu*(g+transpose(g))  stress=lam*trace(g)*kmat+mu*(g+transpose(g))
101  \end{verbatim}  \end{verbatim}
102  Solving for the double time derivative of u on the LHS of \ref{eqn:wav} required us to use the centred difference forumlua which returns;  Solving for the double time derivative of u on the LHS of \refEq{eqn:wav} required us to use the centred difference forumlua which returns;
103
104  u^n = 2u^{n-1}-u^{n-2}+h^2 \biggl(\frac{\partial ^2 u}{\partial t^2}\biggr)^n  u^n = 2u^{n-1}-u^{n-2}+h^2 \biggl(\frac{\partial ^2 u}{\partial t^2}\biggr)^n
105

Legend:
 Removed from v.2860 changed lines Added in v.2861

 ViewVC Help Powered by ViewVC 1.1.26