diff +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
line wrap: on
line diff
--- a/+scheme/Elastic2dStaggeredAnisotropic.m	Thu Apr 30 20:55:26 2020 -0700
+++ b/+scheme/Elastic2dStaggeredAnisotropic.m	Thu Apr 30 21:19:47 2020 -0700
@@ -296,6 +296,7 @@
 
             Gu1 = cell2mat( {Iu1; sparse(dim*N_u{2}, dim*N_u{1})} );
             Gu2 = cell2mat( {sparse(dim*N_u{1}, dim*N_u{2}); Iu2} );
+
             G = {Gu1; Gu2};
             obj.G = G;
 
@@ -312,9 +313,10 @@
             % e2_s = (e_scalar_s'*E{2}')';
             % e2_n = (e_scalar_n'*E{2}')';
 
+            stencilWidth = order;
             % Differentiation matrix D (without SAT)
             N = dim*(N_u{1} + N_u{2});
-            D = sparse(N, N);
+            D = spalloc(N, N, stencilWidth^2*N);
             for a = 1:nGrids
                 for b = 1:nGrids
                     for c = 1:nGrids