comparison +grid/lebedev2dCurvilinear.m @ 1331:60c875c18de3 feature/D2_boundary_opt

Merge with feature/poroelastic for Elastic schemes
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 10 Mar 2022 16:54:26 +0100
parents 8aa0909125a4
children
comparison
equal deleted inserted replaced
1330:855871e0b852 1331:60c875c18de3
1 % Creates a curvilinear 2d lebedev2d grid
2 % over the logical domain xi_lim, eta_lim, ...
3 % If all limits are ommited they are set to {0,1}.
4 % Examples:
5 % g = grid.lebedev2dCurvilinear(mapping, [m_xi, m_eta])
6 % g = grid.lebedev2dCurvilinear(mapping, [m_xi, m_eta], xi_lim, eta_lim)
7 % g = grid.lebedev2dCurvilinear(mapping, [10, 15], {0,1}, {0,1})
8 function g = lebedev2dCurvilinear(mapping, m, varargin)
9 if isempty(varargin)
10 varargin = repmat({{0,1}}, [1 length(m)]);
11 end
12
13 if length(m) ~= length(varargin)
14 error('grid:lebedev2d:NonMatchingParameters','The number of provided dimensions do not match.')
15 end
16
17 for i = 1:length(m)
18 if ~iscell(varargin{i}) || numel(varargin{i}) ~= 2
19 error('grid:lebedev2d:InvalidLimits','The limits should be cell arrays with 2 elements.');
20 end
21
22 if varargin{i}{1} > varargin{i}{2}
23 error('grid:lebedev2d:InvalidLimits','The elements of the limit must be increasing.');
24 end
25 end
26
27 g_logic = grid.lebedev2d(m, varargin{:});
28
29 gu1_logic = g_logic.gridGroups{1}{1};
30 gu2_logic = g_logic.gridGroups{1}{2};
31 gs1_logic = g_logic.gridGroups{2}{1};
32 gs2_logic = g_logic.gridGroups{2}{2};
33
34 gu1 = grid.Curvilinear(mapping, gu1_logic.x{1}, gu1_logic.x{2});
35 gu2 = grid.Curvilinear(mapping, gu2_logic.x{1}, gu2_logic.x{2});
36 gs1 = grid.Curvilinear(mapping, gs1_logic.x{1}, gs1_logic.x{2});
37 gs2 = grid.Curvilinear(mapping, gs2_logic.x{1}, gs2_logic.x{2});
38
39 gu = {gu1, gu2};
40 gs = {gs1, gs2};
41
42 dim = 2;
43 g = grid.Staggered(dim, gu, gs);
44
45 g.logic = g_logic;
46 end