Returns a m+2 by m+1 one-dimensional non-uniform mimetic divergence operator Parameters: k : Order of accuracy ticks : Edges' ticks e.g. [0 0.1 0.15 0.2 0.3 0.4 0.45] ---------------------------------------------------------------------------- SPDX-License-Identifier: GPL-3.0-or-later © 2008-2024 San Diego State University Research Foundation (SDSURF). See LICENSE file or https://www.gnu.org/licenses/gpl-3.0.html for details. ----------------------------------------------------------------------------
0001 function D = divNonUniform(k, ticks) 0002 % Returns a m+2 by m+1 one-dimensional non-uniform mimetic divergence 0003 % operator 0004 % 0005 % Parameters: 0006 % k : Order of accuracy 0007 % ticks : Edges' ticks e.g. [0 0.1 0.15 0.2 0.3 0.4 0.45] 0008 % ---------------------------------------------------------------------------- 0009 % SPDX-License-Identifier: GPL-3.0-or-later 0010 % © 2008-2024 San Diego State University Research Foundation (SDSURF). 0011 % See LICENSE file or https://www.gnu.org/licenses/gpl-3.0.html for details. 0012 % ---------------------------------------------------------------------------- 0013 0014 % Get uniform operator without scaling 0015 D = div(k, length(ticks)-1, 1); 0016 0017 [m, ~] = size(D); 0018 0019 % Compute the Jacobian using the uniform operator and the ticks 0020 if size(ticks, 1) == 1 0021 J = spdiags((D*ticks').^-1, 0, m, m); 0022 else 0023 J = spdiags((D*ticks).^-1, 0, m, m); 0024 end 0025 0026 % This is the non-uniform operator 0027 D = J*D; 0028 end