Mercurial > repos > public > sbplib
annotate +scheme/Utux.m @ 1345:14f44e81e1e3 feature/poroelastic
Add scheme for Elastic2dVariable, not fully compatible.
| author | Martin Almquist <martin.almquist@it.uu.se> |
|---|---|
| date | Tue, 30 Apr 2024 13:33:39 +0200 |
| parents | 6d2167719557 |
| children | 2b1b944deae1 d6ab5ceba496 c12b84fe9b00 |
| rev | line source |
|---|---|
| 270 | 1 classdef Utux < scheme.Scheme |
| 2 properties | |
| 3 m % Number of points in each direction, possibly a vector | |
| 4 h % Grid spacing | |
|
571
38c3da9675a5
Bug fixes in scheme.Utux
Martin Almquist <martin.almquist@it.uu.se>
parents:
367
diff
changeset
|
5 grid % Grid |
| 270 | 6 order % Order accuracy for the approximation |
| 7 | |
| 8 H % Discrete norm | |
| 9 D | |
| 10 | |
| 11 D1 | |
| 12 Hi | |
| 13 e_l | |
| 14 e_r | |
| 15 v0 | |
| 16 end | |
| 17 | |
| 18 | |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
19 methods |
|
949
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
20 function obj = Utux(g, order, opSet) |
|
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
21 default_arg('opSet',@sbp.D2Standard); |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
22 |
|
949
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
23 m = g.size(); |
|
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
24 xl = g.getBoundary('l'); |
|
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
25 xr = g.getBoundary('r'); |
|
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
26 xlim = {xl, xr}; |
|
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
27 |
|
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
28 ops = opSet(m, xlim, order); |
|
6d2167719557
Remove half-commented switch in Utux.
Martin Almquist <malmquist@stanford.edu>
parents:
946
diff
changeset
|
29 obj.D1 = ops.D1; |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
30 |
|
572
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
31 obj.grid = g; |
| 270 | 32 |
|
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
33 obj.H = ops.H; |
|
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
34 obj.Hi = ops.HI; |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
35 |
|
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
36 obj.e_l = ops.e_l; |
|
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
37 obj.e_r = ops.e_r; |
|
571
38c3da9675a5
Bug fixes in scheme.Utux
Martin Almquist <martin.almquist@it.uu.se>
parents:
367
diff
changeset
|
38 obj.D = -obj.D1; |
| 270 | 39 |
| 40 obj.m = m; | |
|
290
d32f674bcbe5
A first attempt to make a general scheme fo hyperbolic systems
Ylva Rydin <ylva.rydin@telia.com>
parents:
270
diff
changeset
|
41 obj.h = ops.h; |
| 270 | 42 obj.order = order; |
| 43 | |
| 44 end | |
| 45 % Closure functions return the opertors applied to the own doamin to close the boundary | |
| 46 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. | |
| 47 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. | |
| 48 % type is a string specifying the type of boundary condition if there are several. | |
| 49 % data is a function returning the data that should be applied at the boundary. | |
| 50 % neighbour_scheme is an instance of Scheme that should be interfaced to. | |
| 51 % neighbour_boundary is a string specifying which boundary to interface to. | |
|
573
efe2dbf9796e
Remove data input from boundary condition function
Martin Almquist <martin.almquist@it.uu.se>
parents:
572
diff
changeset
|
52 function [closure, penalty] = boundary_condition(obj,boundary,type) |
|
572
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
53 default_arg('type','dirichlet'); |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
54 tau =-1*obj.e_l; |
|
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
55 closure = obj.Hi*tau*obj.e_l'; |
|
573
efe2dbf9796e
Remove data input from boundary condition function
Martin Almquist <martin.almquist@it.uu.se>
parents:
572
diff
changeset
|
56 penalty = -obj.Hi*tau; |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
57 |
| 270 | 58 end |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
59 |
|
946
706d1c2b4199
Raname opts to type in a bunch of interface methods
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
60 function [closure, penalty] = interface(obj, boundary, neighbour_scheme, neighbour_boundary, type) |
|
572
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
61 switch boundary |
|
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
62 % Upwind coupling |
|
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
63 case {'l','left'} |
|
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
64 tau = -1*obj.e_l; |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
65 closure = obj.Hi*tau*obj.e_l'; |
|
572
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
66 penalty = -obj.Hi*tau*neighbour_scheme.e_r'; |
|
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
67 case {'r','right'} |
|
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
68 tau = 0*obj.e_r; |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
69 closure = obj.Hi*tau*obj.e_r'; |
|
572
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
70 penalty = -obj.Hi*tau*neighbour_scheme.e_l'; |
|
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
71 end |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
72 |
| 270 | 73 end |
|
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
573
diff
changeset
|
74 |
| 270 | 75 function N = size(obj) |
| 76 N = obj.m; | |
| 77 end | |
| 78 | |
| 79 end | |
| 80 | |
| 81 methods(Static) | |
|
573
efe2dbf9796e
Remove data input from boundary condition function
Martin Almquist <martin.almquist@it.uu.se>
parents:
572
diff
changeset
|
82 % Calculates the matrices needed for the inteface coupling between boundary bound_u of scheme schm_u |
| 270 | 83 % and bound_v of scheme schm_v. |
|
572
4a73b2aab91f
Edit scheme.Utux: Add interface function. Compatible with new grids. Works with Utux_1D_interface.
Martin Almquist <martin.almquist@it.uu.se>
parents:
571
diff
changeset
|
84 % [uu, uv, vv, vu] = inteface_coupling(A,'r',B,'l') |
| 270 | 85 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v) |
| 86 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v); | |
| 87 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u); | |
| 88 end | |
| 89 end | |
| 90 end |
