1 function model_data = ellipt_compliant_gen_model_data(model);
2 %
function model_data = ellipt_compliant_gen_model_data(model)
4 % computation of mu independet data
8 % model_data.grid: contains p,e,t
9 % call model_data.grid.p etc
10 % model_data.dl: decomposed domain
13 % B. Haasdonk 8.3.2010
17 % alles was geometrie generiert
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 def=repmat([3;4], 1, model.B1*model.B2);
34 X=repmat(X,1,model.B2);
39 y1=repmat(y1,1,model.B1);
43 y2=repmat(y2,1,model.B1);
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
52 %%%mesh and boundary creation
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 while not <= model.number_of_triangles_overall
62 [p,e,t]=refinemesh(dl, p, e, t);
66 wert=1/(sqrt(model.B1*model.B2*model.number_of_triangles_block/3));
67 [p,e,t]=initmesh(dl,
'hmax',wert);
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 %%%%%%%%%%%%%%%%%%%%%%ATTENTION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 %following section will be moved to ellipt_compliant_detailed_simulation.m
76 %because of the parameter dependency of the boundary matrix
80 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 % %%%%%create boundary matrix
83 % %set boundary condition
84 % %bottom+top: from left to right
85 % %left+right: from bottom to top
88 % noc_bm=length(dl); %number of columns
90 % check_left_region = dl(6,:); %number of block left hand side
91 % check_right_region = dl(7,:);
92 % check_region = dl(6:7,:);
94 % zeros_left=find(check_left_region == 0); %find 0
's. this edge is an outer
95 % zeros_right=find(check_right_region == 0); %boundary
97 % nonzeros_left=find(check_left_region);
98 % nonzeros_right=find(check_right_region);
100 % inner_boundary_index=intersect(nonzeros_left, nonzeros_right); %index of non zero columns in dl
102 % zero_index=find(check_region==0);
103 % outer_boundary_index=ceil(zero_index/2);
104 % outer_boundary_index=outer_boundary_index';
106 % check_max_length = zeros(4,max(model.B1,model.B2));
108 % check_max_length(1,i)=length(model.gamma_bottom{i}{1})+length(model.gamma_bottom{i}{2})+4; %bottom
109 % check_max_length(2,i)=length(model.gamma_top{i}{3})+length(model.gamma_top{i}{4})+8; %top
112 % check_max_length(3,l)=length(model.gamma_left{l}{1})+length(model.gamma_left{l}{2})+4; %left
113 % check_max_length(4,l)=length(model.gamma_right{l}{1})+length(model.gamma_right{l}{2})+4; %right
116 % nor_bm=max(max(check_max_length)); %number of rows BM
119 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 % BM=zeros(nor_bm, noc_bm); %zeros BM Matrix
125 % %%%%% x1/x2, y1/y2 values
132 % %find indices of gamma top
133 % one_y1_index=find(check_y1 == 1);
134 % one_y2_index=find(check_y1 == 1);
136 % one_y_index = intersect(one_y1_index, one_y2_index);
138 % check_x1_one = check_x1(one_y_index);
141 % [tmp, top_tmp]=sort(check_x1_one);
147 % top_index(k)=one_y_index(l); %top_index: top indices from left to right
150 % %find indices of gamma bottom
152 % zero_y1_index=find(check_y1 == 0);
153 % zero_y2_index=find(check_y2 == 0);
155 % zero_y_index= intersect(zero_y1_index, zero_y2_index);
157 % check_x1_zero=check_x1(zero_y_index);
160 % [tmp, bottom_tmp]=sort(check_x1_zero);
165 % bottom_index(k)=zero_y_index(l); %bottom index: bottom indices from left to right
170 % zero_x1_index=find(check_x1 == 0);
171 % zero_x2_index=find(check_x2 == 0);
173 % zero_x_index=intersect(zero_x1_index, zero_x2_index);
175 % check_y1_zero=check_y1(zero_x_index); %
178 % [tmp, left_tmp]=sort(check_y1_zero);
183 % left_index(k)=zero_x_index(l); %left index: left indices from left to right
188 % one_x1_index=find(check_x1 == 1);
189 % one_x2_index=find(check_x2 == 1);
191 % one_x_index=intersect(one_x1_index, one_x2_index);
193 % check_y1_one=check_y1(one_x_index); %
196 % [tmp, right_tmp]=sort(check_y1_one);
201 % right_index(k)=one_x_index(l); %right index: right indices from left to right
205 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206 % %%%%%%
final creation of boundaries
208 % %outer bound indices
209 % outer_bound=[top_index, bottom_index, right_index, left_index];
210 % outer_bound=sort(outer_bound);
212 % %inner bound indices
213 % tmp_noc_vec=1:noc_bm;
217 % inner_bound=find(tmp_noc_vec >=0);
221 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
222 % %%%inner boundaries
223 % std_inner_boundary_char=[
'0',
'0',
'1',
'0']; %double(...) -> 48 48 49 48
224 % std_inner_boundary_num=[0,repmat(1,1,5)];
226 % std_inner_boundary=[std_inner_boundary_num,double(std_inner_boundary_char)];
228 %
if length(std_inner_boundary) < nor_bm %fill up with zeros
229 % std_inner_boundary(nor_bm);
232 % %positioning of inner boundary condition
234 % BM(:,i)=std_inner_boundary(:);
238 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
239 % %%%outer boundaries
244 % %l_top_bound=max(check_max_length(2,:));
246 % %TOP=zeros(l_top_bound, model.B1);
248 % fronttail=repmat(1,1,4); %definition of dim, diri, lq, lg
251 % lh=length(model.gamma_top{i}{3}); %number of chars
for h
252 % lr=length(model.gamma_top{i}{4}); %number of chars
for r
253 % outer_topboundary_num(i,:)=[fronttail,lh, lr, 48, 48];
256 % outer_topboundary_num=outer_topboundary_num
';
260 % tmp_char3=model.gamma_top{i}{3};
261 % tmp_char4=model.gamma_top{i}{4};
263 % tmp_char{i}=[tmp_char3,tmp_char4]; %
267 % outer_topboundary(:,i)=[outer_topboundary_num(:,i);double(tmp_char{i})'];
268 %
if length(outer_topboundary(:,i)) < nor_bm
269 % outer_topboundary(nor_bm,i) = 0;
274 % %positioning of top boundary conditions
275 % outer_topbound_loop=outer_topboundary;
277 % BM(:,i)=outer_topbound_loop(:,1);
278 % outer_topbound_loop(:,1)=[];
281 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282 % %%%bottom boundaries
285 % fronttail=[1,0]; %definition of dim, diri, lq, lg
288 % lq=length(model.gamma_bottom{i}{1}); %number of chars
for
289 % lg=length(model.gamma_bottom{i}{2}); %number of chars
for
290 % outer_bottomboundary_num(i,:)=[fronttail,lq, lg];
293 % outer_bottomboundary_num=outer_bottomboundary_num
';
297 % tmp_char1=model.gamma_bottom{i}{1};
298 % tmp_char2=model.gamma_bottom{i}{2};
300 % tmp_char{i}=[tmp_char1,tmp_char2]; %
306 % a=[outer_bottomboundary_num(:,i);double(tmp_char{i})'];
307 %
if length(a) < nor_bm
310 % outer_bottomboundary(:,i)=a;
312 % % outer_bottomboundary(:,i)=[outer_bottomboundary_num(:,i);double(tmp_char{i})
'];
313 % % if length(outer_bottomboundary(:,i)) < nor_bm
314 % % outer_bottomboundary(nor_bm,i) = 0;
318 % %positioning of bottom boundary conditions
319 % outer_bottombound_loop=outer_bottomboundary;
321 % BM(:,i)=outer_bottombound_loop(:,1);
322 % outer_bottombound_loop(:,1)=[];
326 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327 % %%%%%%left boundaries
329 % fronttail=[1,0]; %definition of dim, diri, lq, lg
332 % lq=length(model.gamma_left{i}{1}); %number of chars for
333 % lg=length(model.gamma_left{i}{2}); %number of chars for
334 % outer_leftboundary_num(i,:)=[fronttail,lq, lg];
337 % outer_leftboundary_num=outer_leftboundary_num';
341 % tmp_char1=model.gamma_left{i}{1};
342 % tmp_char2=model.gamma_left{i}{2};
344 % tmp_char{i}=[tmp_char1,tmp_char2]; %
350 % a=[outer_leftboundary_num(:,i);double(tmp_char{i})
'];
351 % if length(a) < nor_bm
354 % outer_leftboundary(:,i)=a;
356 % % outer_bottomboundary(:,i)=[outer_bottomboundary_num(:,i);double(tmp_char{i})'];
357 % %
if length(outer_bottomboundary(:,i)) < nor_bm
358 % % outer_bottomboundary(nor_bm,i) = 0;
362 % %positioning of left boundary conditions
363 % outer_leftbound_loop=outer_leftboundary;
365 % BM(:,i)=outer_leftbound_loop(:,1);
366 % outer_leftbound_loop(:,1)=[];
369 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370 % %%%%%%right boundaries
372 % fronttail=[1,0]; %definition of dim, diri, lq, lg
375 % lq=length(model.gamma_right{i}{1}); %number of chars
for
376 % lg=length(model.gamma_right{i}{2}); %number of chars
for
377 % outer_rightboundary_num(i,:)=[fronttail,lq, lg];
380 % outer_rightboundary_num=outer_rightboundary_num
';
384 % tmp_char1=model.gamma_right{i}{1};
385 % tmp_char2=model.gamma_right{i}{2};
387 % tmp_char{i}=[tmp_char1,tmp_char2]; %
393 % a=[outer_rightboundary_num(:,i);double(tmp_char{i})'];
394 %
if length(a) < nor_bm
397 % outer_rightboundary(:,i)=a;
399 % % outer_bottomboundary(:,i)=[outer_bottomboundary_num(:,i);double(tmp_char{i})
'];
400 % % if length(outer_bottomboundary(:,i)) < nor_bm
401 % % outer_bottomboundary(nor_bm,i) = 0;
405 % %positioning of left boundary conditions
406 % outer_rightbound_loop=outer_rightboundary;
408 % BM(:,i)=outer_rightbound_loop(:,1);
409 % outer_rightbound_loop(:,1)=[];
418 model_data.grid = grid;
422 %model_data.boundary_matrix=BM;
428 % inner = [3, 7, 2, 9];
431 % b = zeros(1,length(all));
433 % outer = find(b==0);