1 |
cnh |
1.1 |
function [Q]=rescale_coordinate(q,varargin) |
2 |
|
|
% [Q]=rescale_coordinate(q) |
3 |
|
|
% [Q]=rescale_coordinate(q,'conf') |
4 |
|
|
% [Q]=rescale_coordinate(q,'q=1') |
5 |
|
|
% [Q]=rescale_coordinate(q,'q=0') |
6 |
|
|
% [Q]=rescale_coordinate(q,'tan') |
7 |
|
|
% [Q]=rescale_coordinate(q,'tan2') |
8 |
|
|
|
9 |
|
|
nxf=prod(size(q)); |
10 |
|
|
nx=round((nxf-1)/2)+1; |
11 |
|
|
|
12 |
|
|
% Generate gridded face using pure conformal mapping |
13 |
|
|
%q=-min(q):2/(nxf-1):max(q); %q=sign(q).*(abs(q).^(1.2)); |
14 |
|
|
|
15 |
|
|
% Calculate dxg along edge for original (unscaled) conformal cube |
16 |
|
|
dxg=conf_dx(q); |
17 |
|
|
|
18 |
|
|
if nargin > 1 |
19 |
|
|
switch varargin{1} |
20 |
|
|
case 'q=0' |
21 |
|
|
D=max(dxg,[],2); |
22 |
|
|
case 'q=1/2' |
23 |
|
|
D=dxg(:,round(nx/2)); |
24 |
|
|
case 'q=78' |
25 |
|
|
D=dxg(:,round(nx/8)); |
26 |
|
|
case 'q=1' |
27 |
|
|
D=min(dxg,[],2); |
28 |
|
|
case 'q=i3' |
29 |
|
|
D=dxg(:,3); |
30 |
|
|
otherwise |
31 |
|
|
D=dxg(:,1); |
32 |
|
|
end |
33 |
|
|
s=cumsum([0 D']); |
34 |
|
|
dS=max(s)/(nxf-1)+0*D; |
35 |
|
|
S=cumsum([0 dS']); |
36 |
|
|
end |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
if nargin > 1 |
40 |
|
|
switch varargin{1} |
41 |
|
|
case 'conf' |
42 |
|
|
Q=q; |
43 |
|
|
case {'q=0','q=1','q=1/2','q=7/8','q=i3'} |
44 |
|
|
Q=interp1(s,q,S); |
45 |
|
|
case 'tan' |
46 |
|
|
Q=tan(2/3*q)/tan(2/3*max(abs(q))); |
47 |
|
|
case 'tan2' |
48 |
|
|
Q=tan(1/5*q)/tan(1/5*max(abs(q))); |
49 |
|
|
case 'new' |
50 |
|
|
dq=ones(1,nxf); |
51 |
|
|
dq(1)=0; |
52 |
|
|
dq(2)=1.5; |
53 |
|
|
dq=dq/sum(dq)*(q(end)-q(1)); |
54 |
|
|
Q=q(1)+cumsum(dq); |
55 |
|
|
otherwise |
56 |
|
|
disp('Unknown method') |
57 |
|
|
end |
58 |
|
|
else |
59 |
|
|
Q=q; |
60 |
|
|
end |