rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
Phasen_lokal_space.m
1 function [uinc,index_n]=Phasen_lokal_space(u,epsilon,alpha,index,dx,dt)
2 %
3 % Loest mikroskopische Modell u_t+f(u)_x = epsilon u_{xx} + alpha*epsilon^2 u_{xxx}
4 % als increment, wird spaeter mit dt multipliziert
5 %
6 % Input: u Lsg. vor Zeitschritt
7 % epsilon Regularisierungsparameter
8 % alpha Parameter
9 % index Indexmenge, fuer lokale Lsg, [] ergibt globale
10 % dx,dt Ortsschrittweite bzw. Zeitschrittweite
11 %
12 % Output: dt_u diskrete Ableitung fuer u
13 % index_n neue Indexmenge, nimmt von jedem Miniintervall 2
14 % Randpunkte weg
15 
16 
17 beta = 2*epsilon/dx; % Verhaeltnisse
18 gamma = 3*alpha*(epsilon/dx)^2;
19 
20 if isempty(index) % globale Lsg
21  uinc = zeros(size(u));
22  n_x = length(u);
23  uc=u;
24 % uinc(1) = uc(1); % OE: Intervall so gross, dass linker bzw. rechter Rand const. (inflow/outflow)
25  uinc(1) = 0; % OE: Intervall so gross, dass linker bzw. rechter Rand const. (inflow/outflow)
26  uinc(2) = uc(2);
27  for i=3:(n_x-2)
28  uinc(i)= REGULARlok_space(uc,i,beta,gamma,dx,dt);
29  end
30 % u(n_x-1) = uc(n_x-1);
31 % u(n_x) = uc(n_x);
32  uinc(n_x-1) = 0;
33  uinc(n_x) = 0;
34 
35 else % lokale Lsg
36  index = sort(index);
37  U = [];
38  Ie = [];
39  Ia = 1;
40  I = [];
41  for i=1:length(index)-1;
42  if index(i+1)-index(i)==0
43  error('Index kommt doppelt vor');
44  elseif index(i+1)-index(i)>1 % Zusaetzliche Abfrage, dass mind 5 aufeinanderfolgende Werte
45  Ia = [Ia, i+1];
46  Ie = [Ie, i];
47  end
48  end
49  Ie = [Ie,length(index)];
50 
51  for i=1:length(Ie)
52  ni = Ie(i)-Ia(i)+1; % Anzahl aufeinanderfolgender Stuetzstellen
53  if ni<=4
54  error('Zu wenig aufeinanderfolgende Stuetzstellen.')
55  end
56 
57  % Mikroproblem auf Intervall loesen
58  uc = u(index(Ia(i)):index(Ie(i)));
59  u_local = zeros(ni,1);
60  for k=3:(ni-2)
61  u_local(k)=REGULARlok(uc,k,beta,gamma,dx,dt);
62  end
63  u_local(1:2)=[];
64  u_local(end-1:end)=[];
65  U = [U;u_local];
66  I = [I,index(Ia(i)+2):index(Ie(i)-2)];
67 
68  end
69  u = U;
70  index_n = I;
71 
72 end