comparison +sbp/+implementations/d2_variable_4.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 43d02533bea3
children e54c2f54dbfe
comparison
equal deleted inserted replaced
859:4c7532db42cd 860:b758d1cf4c8e
47 47
48 D1 = HI*(Q - 1/2*e_l*e_l' + 1/2*e_r*e_r'); 48 D1 = HI*(Q - 1/2*e_l*e_l' + 1/2*e_r*e_r');
49 49
50 50
51 N = m; 51 N = m;
52 function D2 = D2_fun(c) 52 function [D2, B] = D2_fun(c)
53 M = 78+(N-12)*5; 53 M = 78+(N-12)*5;
54 %h = 1/(N-1); 54 %h = 1/(N-1);
55 55
56 56
57 U = [ 57 U = [
129 cols(M-38:M-24) = [(N-7:N)';(N-6:N)']; 129 cols(M-38:M-24) = [(N-7:N)';(N-6:N)'];
130 for i=7:N-6 130 for i=7:N-6
131 cols(40+(i-7)*5:44+(i-7)*5) = [i-2;i-1;i;i+1;i+2]; 131 cols(40+(i-7)*5:44+(i-7)*5) = [i-2;i-1;i;i+1;i+2];
132 end 132 end
133 D2 = sparse(rows,cols,D2); 133 D2 = sparse(rows,cols,D2);
134
135 B = HI*( c(end)*e_r*d1_r' - c(1)*e_l*d1_l') - D2;
134 end 136 end
135 D2 = @D2_fun; 137 D2 = @D2_fun;
136 end 138 end