Mercurial > repos > public > sbplib
annotate +parametrization/old/max_h.m @ 1012:1e437c9e5132 feature/advectionRV
Create residual viscosity package +rv and generalize the ResidualViscosity class
- Generalize residual viscosity, by passing user-defined flux and calculating the time derivative outside of the update.
- Create separate RungekuttaRV specifically using interior RV updates
- Separate the artifical dissipation operator from the scheme AdvectionRV1D so that the same scheme can be reused for creating the diff op used by the ResidualViscosity class
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 05 Dec 2018 13:44:10 +0100 |
parents | 3a3cf386bb7e |
children |
rev | line source |
---|---|
0 | 1 function [d_max, i1_max, j1_max, i2_max, j2_max] = max_h(X,Y) |
2 ni = size(X,1); | |
3 nj = size(X,2); | |
4 d_max = 0; | |
5 | |
6 i1_max = 0; | |
7 j1_max = 0; | |
8 i2_max = 0; | |
9 j2_max = 0; | |
10 | |
11 D = {[0,-1],[1,0],[0,1],[-1,0]}; | |
12 | |
13 for i = 1:ni | |
14 for j = 1:nj | |
15 p1 = [X(i,j); Y(i,j)]; | |
16 for k = 1:length(D) | |
17 i2 = i+D{k}(1); | |
18 j2 = j+D{k}(2); | |
19 if i2 >= 1 && i2 <= ni && j2 >= 1 && j2 <= nj | |
20 p2 = [X(i2,j2); Y(i2,j2)]; | |
21 d = norm(p2-p1); | |
22 if d > d_max; | |
23 d_max = d; | |
24 i1_max = i; | |
25 j1_max = j; | |
26 i2_max = i2; | |
27 j2_max = j2; | |
28 end | |
29 end | |
30 end | |
31 end | |
32 end | |
33 end |