On Fri, Mar 3, 2017 at 5:12 PM, Fangbo Wang <[email protected]> wrote:
> I am doing analysis on wave propagation through a linear solid media using > finite element method. The PDE from the system can be discretized to a > system of linear equations. > Newmark method is used to solve this problem with changing waves along > time. > > Here, the A, B, C, D mean stiffness matrix, mass matrix, damping matrix, > effective stiffness matrix of the system, respectively. The scalars are > just some random numbers I put. > Since this is explicit, you should just be assembling the entire system directly in to one matrix, rather than making several matrices and doing algebra. Matt > On Fri, Mar 3, 2017 at 4:55 PM, Barry Smith <[email protected]> wrote: > >> >> > On Mar 3, 2017, at 3:31 PM, Fangbo Wang <[email protected]> wrote: >> > >> > Hi, >> > >> > I am a little bit confused on how to appropriately do matrix addition >> with different nonzeros patterns. >> > >> > Suppose I want to do D=2*A+3*B+4*C, A, B and C all have different >> nonzero patterns. >> > I know I can use MatDuplicate, MatCopy, MatConvert to create a matrix >> D, which way is the right way? >> >> There is no particular "right way". You could use a MatDuplicate() >> then a MatScale and then two MatAXPY() >> >> D=2*A+3*B+4*C looks like a MATLAB thing, not something you would need >> to do when solving PDEs, where do you get this need? Perhaps there is an >> alternative way to get what you want. >> >> > >> > What's the difference between MatDuplicate and MatCopy? >> >> MatDuplicate() CREATES a new matrix while MatCopy() copies values from >> an already existing matrix to another already existing matrix. >> >> >> > >> > Thank you very much! >> > >> > Best regards, >> > >> > Fangbo >> > >> > >> > -- >> > Fangbo Wang, PhD student >> > Stochastic Geomechanics Research Group >> > Department of Civil, Structural and Environmental Engineering >> > University at Buffalo >> > Email: [email protected] >> >> > > > -- > Fangbo Wang, PhD student > Stochastic Geomechanics Research Group > Department of Civil, Structural and Environmental Engineering > University at Buffalo > Email: *[email protected] <[email protected]>* > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
