comparison +scheme/bcSetup.m @ 795:1f6b2fb69225 feature/poroelastic

Revert bcSetup and update bc functions in elastic schemes to be compatible.
author Martin Almquist <malmquist@stanford.edu>
date Wed, 25 Jul 2018 18:33:03 -0700
parents eac5fb4b63db
children 5cf9fdf4c98f
comparison
equal deleted inserted replaced
794:0cac17097c37 795:1f6b2fb69225
23 closure = closure + localClosure; 23 closure = closure + localClosure;
24 24
25 if isempty(bc{i}.data) 25 if isempty(bc{i}.data)
26 continue 26 continue
27 end 27 end
28 assertType(bc{i}.data, 'function_handle');
28 29
29 coord = diffOp.grid.getBoundary(bc{i}.boundary); 30 coord = diffOp.grid.getBoundary(bc{i}.boundary);
30 if iscell(bc{i}.data) 31 assertNumberOfArguments(bc{i}.data, 1+size(coord,2));
31 for j = 1:length(bc{i}.data)
32 assertType(bc{i}.data{j}, 'function_handle');
33 assertNumberOfArguments(bc{i}.data{j}, 1+size(coord,2));
34 end
35 else
36 assertType(bc{i}.data, 'function_handle');
37 assertNumberOfArguments(bc{i}.data, 1+size(coord,2));
38 end
39 32
40 penalties{end+1} = penalty; 33 penalties{end+1} = penalty;
41 dataFunctions{end+1} = bc{i}.data; 34 dataFunctions{end+1} = bc{i}.data;
42 dataParams{end+1} = num2cell(coord ,1); 35 dataParams{end+1} = num2cell(coord ,1);
43 end 36 end
44 37
45 O = spzeros(size(diffOp),1); 38 O = spzeros(size(diffOp),1);
46 function v = S_fun(t) 39 function v = S_fun(t)
47 v = O; 40 v = O;
48 for i = 1:length(dataFunctions) 41 for i = 1:length(dataFunctions)
49 if iscell(penalties{i}) 42 v = v + penalties{i}*dataFunctions{i}(t, dataParams{i}{:});
50 for j = 1:length(penalties{i})
51 v = v + penalties{i}{j}*dataFunctions{i}{j}(t, dataParams{i}{:});
52 end
53 else
54 v = v + penalties{i}*dataFunctions{i}(t, dataParams{i}{:});
55 end
56 end 43 end
57 44
58 v = S_sign * v; 45 v = S_sign * v;
59 end 46 end
60 S = @S_fun; 47 S = @S_fun;