comparison +scheme/Elastic2dStaggeredAnisotropic.m @ 1267:e61083f178be feature/poroelastic

Add preallocation for D in StaggeredAnisotropic
author Martin Almquist <malmquist@stanford.edu>
date Thu, 30 Apr 2020 21:19:47 -0700
parents ad31d9c4cec2
children 546ee16760d5
comparison
equal deleted inserted replaced
1266:ad31d9c4cec2 1267:e61083f178be
294 Iu1 = speye(dim*N_u{1}, dim*N_u{1}); 294 Iu1 = speye(dim*N_u{1}, dim*N_u{1});
295 Iu2 = speye(dim*N_u{2}, dim*N_u{2}); 295 Iu2 = speye(dim*N_u{2}, dim*N_u{2});
296 296
297 Gu1 = cell2mat( {Iu1; sparse(dim*N_u{2}, dim*N_u{1})} ); 297 Gu1 = cell2mat( {Iu1; sparse(dim*N_u{2}, dim*N_u{1})} );
298 Gu2 = cell2mat( {sparse(dim*N_u{1}, dim*N_u{2}); Iu2} ); 298 Gu2 = cell2mat( {sparse(dim*N_u{1}, dim*N_u{2}); Iu2} );
299
299 G = {Gu1; Gu2}; 300 G = {Gu1; Gu2};
300 obj.G = G; 301 obj.G = G;
301 302
302 obj.H = G{1}*(U{1}{1}*obj.H_u{1}*U{1}{1}' + U{1}{2}*obj.H_u{1}*U{1}{2}')*G{1}'... 303 obj.H = G{1}*(U{1}{1}*obj.H_u{1}*U{1}{1}' + U{1}{2}*obj.H_u{1}*U{1}{2}')*G{1}'...
303 + G{2}*(U{2}{1}*obj.H_u{2}*U{2}{1}' + U{2}{2}*obj.H_u{2}*U{2}{2}')*G{2}'; 304 + G{2}*(U{2}{1}*obj.H_u{2}*U{2}{1}' + U{2}{2}*obj.H_u{2}*U{2}{2}')*G{2}';
310 % e2_w = (e_scalar_w'*E{2}')'; 311 % e2_w = (e_scalar_w'*E{2}')';
311 % e2_e = (e_scalar_e'*E{2}')'; 312 % e2_e = (e_scalar_e'*E{2}')';
312 % e2_s = (e_scalar_s'*E{2}')'; 313 % e2_s = (e_scalar_s'*E{2}')';
313 % e2_n = (e_scalar_n'*E{2}')'; 314 % e2_n = (e_scalar_n'*E{2}')';
314 315
316 stencilWidth = order;
315 % Differentiation matrix D (without SAT) 317 % Differentiation matrix D (without SAT)
316 N = dim*(N_u{1} + N_u{2}); 318 N = dim*(N_u{1} + N_u{2});
317 D = sparse(N, N); 319 D = spalloc(N, N, stencilWidth^2*N);
318 for a = 1:nGrids 320 for a = 1:nGrids
319 for b = 1:nGrids 321 for b = 1:nGrids
320 for c = 1:nGrids 322 for c = 1:nGrids
321 for i = 1:dim 323 for i = 1:dim
322 for j = 1:dim 324 for j = 1:dim