Mercurial > repos > public > sbplib
diff +sbp/+implementations/d2_variable_2.m @ 860:b758d1cf4c8e feature/poroelastic
Add computation of HI*M to D2Variable to make adjoint gradient computation easier.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Wed, 24 Oct 2018 16:16:43 -0700 |
parents | ded4156e53e2 |
children | e54c2f54dbfe |
line wrap: on
line diff
--- a/+sbp/+implementations/d2_variable_2.m Wed Oct 03 10:43:24 2018 -0700 +++ b/+sbp/+implementations/d2_variable_2.m Wed Oct 24 16:16:43 2018 -0700 @@ -27,7 +27,7 @@ diags = -1:1; stencil = [-1/2 0 1/2]; D1 = stripeMatrix(stencil, diags, m); - + D1(1,1)=-1;D1(1,2)=1;D1(m,m-1)=-1;D1(m,m)=1; D1(m,m-1)=-1;D1(m,m)=1; D1=D1/h; @@ -40,7 +40,7 @@ scheme_radius = (scheme_width-1)/2; r = (1+scheme_radius):(m-scheme_radius); - function D2 = D2_fun(c) + function [D2, B] = D2_fun(c) Mm1 = -c(r-1)/2 - c(r)/2; M0 = c(r-1)/2 + c(r) + c(r+1)/2; @@ -54,6 +54,8 @@ M=M/h; D2=HI*(-M-c(1)*e_l*d1_l'+c(m)*e_r*d1_r'); + B = HI*M; end D2 = @D2_fun; + end \ No newline at end of file