comparison +scheme/Scheme.m @ 820:501750fbbfdb

Merge with feature/grids
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Sep 2018 14:40:58 +0200
parents 12ee11893453
children 459eeb99130f
comparison
equal deleted inserted replaced
819:fdf0ef9150f4 820:501750fbbfdb
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) % TODO: Change name to boundaryCondition
29 [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)
30 30
31 % TODO: op = getBoundaryOperator()??
32 % makes sense to have it available through a method instead of random properties
33
34 % Returns the number of degrees of freedom.
35 N = size(obj)
31 end 36 end
32 37
33 methods(Static) 38 methods(Static)
34 % Calculates the matrcis need for the inteface coupling between boundary bound_u of scheme schm_u 39 % Calculates the matrcis need for the inteface coupling between
35 % and bound_v of scheme schm_v. 40 % 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') 41 % [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) 42 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); 43 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v);
39 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u); 44 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u);
40 end 45 end
41 end 46 end