rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
Phasen_lokal_old.m
1 function [u,index_n]=Phasen_lokal_old(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 % fuer einen Zeitschritt.
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: u Lsg nach Zeitschritt dt
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  n_x = length(u);
22  uc=u;
23  u(1) = uc(1); % OE: Intervall so gross, dass linker bzw. rechter Rand const. (inflow/outflow)
24  u(2) = uc(2);
25  for i=3:(n_x-2)
26  u(i)=REGULARlok(uc,i,beta,gamma,dx,dt);
27  end
28  u(n_x-1) = uc(n_x-1);
29  u(n_x) = uc(n_x);
30 
31 else % lokale Lsg
32  index = sort(index);
33  U = [];
34  Ie = [];
35  Ia = 1;
36  I = [];
37  for i=1:length(index)-1;
38  if index(i+1)-index(i)==0
39  error('Index kommt doppelt vor');
40  elseif index(i+1)-index(i)>1 % Zusaetzliche Abfrage, dass mind 5 aufeinanderfolgende Werte
41  Ia = [Ia, i+1];
42  Ie = [Ie, i];
43  end
44  end
45  Ie = [Ie,length(index)];
46 
47  for i=1:length(Ie)
48  ni = Ie(i)-Ia(i)+1; % Anzahl aufeinanderfolgender Stuetzstellen
49  if ni<=4
50  error('Zu wenig aufeinanderfolgende Stuetzstellen.')
51  end
52 
53  % Mikroproblem auf Intervall loesen
54  uc = u(index(Ia(i)):index(Ie(i)));
55  u_local = zeros(ni,1);
56  for k=3:(ni-2)
57  u_local(k)=REGULARlok(uc,k,beta,gamma,dx,dt);
58  end
59  u_local(1:2)=[];
60  u_local(end-1:end)=[];
61  U = [U;u_local];
62  I = [I,index(Ia(i)+2):index(Ie(i)-2)];
63 
64  end
65  u = U;
66  index_n = I;
67 
68 end