comparison +scheme/Scheme.m @ 427:a613960a157b feature/quantumTriangles

merged with feature/beams
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 26 Jan 2017 15:59:25 +0100
parents 5df8d20281fe
children a70d5387d2ca
comparison
equal deleted inserted replaced
426:29944ea7674b 427:a613960a157b
1 % Start with all matrix returns. When that works see how we should generalize to non-matrix stuff/nonlinear 1 % Start with all matrix returns. When that works see how we should generalize
2 % to non-matrix stuff/nonlinear
2 classdef Scheme < handle 3 classdef Scheme < handle
3 properties (Abstract) 4 properties (Abstract)
4 m % Number of points in each direction, possibly a vector
5 order % Order accuracy for the approximation 5 order % Order accuracy for the approximation
6 6
7 % vectors u,v,w depending on dim that gives were gridpoints are in each dimension 7 grid
8 % vectors x,y,z containing the x,y,z values corresponding to each grid point
9 % matrices X,Y,Z with point coordinates as multi dimensional vectors
10 8
11 D % non-stabalized scheme operator 9 D % non-stabalized scheme operator
12 H % Discrete norm 10 H % Discrete norm
13
14 % Should also containg:
15 % the grid points used
16 % the grid spacing
17 end 11 end
18 12
19 methods (Abstract) 13 methods (Abstract)
20 % Closure functions return the opertors applied to the own doamin to close the boundary 14 % Closure functions return the opertors applied to the own doamin to
21 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. 15 % close the boundary Penalty functions return the opertors to force
22 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. 16 % the solution. In the case of an interface it returns the operator
23 % type is a string specifying the type of boundary condition if there are several. 17 % applied to the other doamin. In some cases the penalty return value
24 % data is a function returning the data that should be applied at the boundary. 18 % can be ommited and the closure function take care of both parts.
25 % neighbour_scheme is an instance of Scheme that should be interfaced to. 19 % boundary is a string specifying the boundary e.g.
26 % neighbour_boundary is a string specifying which boundary to interface to. 20 % 'l','r' or 'e','w','n','s'.
27 m = boundary_condition(obj,boundary,type,data) 21 % type is a string specifying the type of
28 m = interface(obj,boundary,neighbour_scheme,neighbour_boundary) 22 % boundary condition if there are several.
29 N = size(obj) % Returns the number of degrees of freedom. 23 % neighbour_scheme is an instance of Scheme that should be
24 % interfaced to.
25 % neighbour_boundary is a string specifying which boundary to
26 % interface to.
27 % penalty may be a cell array if there are several penalties with different weights
28 [closure, penalty] = boundary_condition(obj,boundary,type)
29 [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)
30 30
31 % Returns the number of degrees of freedom.
32 N = size(obj)
31 end 33 end
32 34
33 methods(Static) 35 methods(Static)
34 % Calculates the matrcis need for the inteface coupling between boundary bound_u of scheme schm_u 36 % Calculates the matrcis need for the inteface coupling between
35 % and bound_v of scheme schm_v. 37 % boundary bound_u of scheme schm_u and bound_v of scheme schm_v.
36 % [uu, uv, vv, vu] = inteface_couplong(A,'r',B,'l') 38 % [uu, uv, vv, vu] = inteface_coupling(A,'r',B,'l')
37 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v) 39 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v)
38 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v); 40 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v);
39 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u); 41 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u);
40 end 42 end
41 end 43 end