Changeset 247 for trunk


Ignore:
Timestamp:
Apr 29, 2011, 6:44:35 PM (13 years ago)
Author:
sommeria
Message:

thin plate shell corrected for spatial derivatives

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field.m

    r246 r247  
    105105                        EM = tps_eval(epoints,ctrs);
    106106                    case{'vort','div'}
    107                         EMDXY = tps_eval_dxy(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs
     107                        [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs
    108108     
    109109                end
     
    132132%                         DataIn.V_tps(nbvec_sub+2,isub)=0;% X coefficient suppressed for x wise derivatives
    133133%                         DataIn.U_tps(nbvec_sub+3,isub)=0;% Y coefficient suppressed for x wise derivatives
    134                         DataOut.vort(ind_sel)=DataOut.vort(ind_sel)+EMDXY(:,:,2) *DataIn.U_tps(1:nbvec_sub+3,isub)-EMDXY(:,:,1) *DataIn.V_tps(1:nbvec_sub+3,isub);
     134                        DataOut.vort(ind_sel)=DataOut.vort(ind_sel)+EMDY *DataIn.U_tps(1:nbvec_sub+3,isub)-EMDX *DataIn.V_tps(1:nbvec_sub+3,isub);
    135135                    case 'div'
    136136                        ListFields={'div'};
     
    142142%                         DataIn.V_tps(nbvec_sub+2,isub)=0;% X coefficient suppressed for x wise derivatives
    143143%                         DataIn.U_tps(nbvec_sub+3,isub)=0;% Y coefficient suppressed for x wise derivatives
    144                         DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDXY(:,:,1)*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDXY(:,:,2) *DataIn.V_tps(1:nbvec_sub+3,isub);
     144                        DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDX*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDY *DataIn.V_tps(1:nbvec_sub+3,isub);
    145145                end
    146146        end
  • trunk/src/plot_field.m

    r238 r247  
    106106% introduce PlotParam.Hold: 'on' or 'off' (for curves)
    107107%default output
     108
    108109if ~exist('PlotParam','var'),PlotParam=[];end;
    109110if ~exist('PosColorbar','var'),PosColorbar=[];end;
  • trunk/src/read_civxdata.m

    r236 r247  
    5050errormsg='';
    5151DataTest=nc2struct(filename,'ListGlobalAttribute','Conventions');
    52 if isequal(DataTest.Conventions,'uvmat/civdata')%test for new civ format
     52if isfield(DataTest,'Txt')
     53    errormsg=DataTest.Txt;   
     54elseif isequal(DataTest.Conventions,'uvmat/civdata')%test for new civ format
    5355     [Field,VelTypeOut]=read_civdata(filename,FieldNames,VelType);
    5456     return
  • trunk/src/tps_eval_dxy.m

    r246 r247  
    1111%            N centres, with s=space dimension, DMXY(:,:,k) gives the derivatives
    1212%            along dimension k (=x, y,z) after multiplication by the N+1+s tps sources.
    13   function DMXY = tps_eval_dxy(dsites,ctrs)
     13  function [DMX,DMY] = tps_eval_dxy(dsites,ctrs)
    1414  %%  matrix declarations
    1515  [M,s] = size(dsites); [N,s] = size(ctrs);
    16   Dsites=zeros(M,N,s);
     16  Dsites=zeros(M,N);
    1717  DM = zeros(M,N);
    18   DMXY = zeros(M,N+1+s,s);
     18 % DMXY = zeros(M,N+1+s);
    1919 
    2020  %% Accumulate sum of squares of coordinate differences
     
    2424  %  Ctrs, consisting of M identical rows (each containing
    2525  %       the d-th coordinate of the N centers)
    26   for d=1:s
    27      [Dsites(:,:,d),Ctrs] = ndgrid(dsites(:,d),ctrs(:,d));%d coordinates of interpolation points (Dsites) and initial points (Ctrs)
    28      DM = DM + (Dsites(:,:,d)-Ctrs).^2;% add d component squared
    29   end
    3026 
    31   %% calculate mtrix of tps derivatives
    32   DM(DM~=0) = log(DM)+1; %=2 log(r)+1 derivative of the tps r^2 log(r)
    33   for d=1:s
    34     DMXY(:,1:N,d)=Dsites(:,:,d).*DM;
    35     DMXY(:,N+1+d,d)=1;% effect of mean gradient
    36   end
     27[Dsites,Ctrs] = ndgrid(dsites(:,1),ctrs(:,1));%d coordinates of interpolation points (Dsites) and initial points (Ctrs)
     28DX=Dsites-Ctrs;
     29[Dsites,Ctrs] = ndgrid(dsites(:,2),ctrs(:,2));%d coordinates of interpolation points (Dsites) and initial points (Ctrs)
     30DY=Dsites-Ctrs;
     31DM = DX.*DX + DY.*DY;% add d component squared
     32
     33 %% calculate matrix of tps derivatives
     34DM(DM~=0) = log(DM(DM~=0))+1; %=2 log(r)+1 derivative of the tps r^2 log(r)
     35
     36DMX=[DX.*DM zeros(M,1)  ones(M,1) zeros(M,1)];% effect of mean gradient
     37DMY=[DY.*DM zeros(M,1)  ones(M,1) zeros(M,1)];% effect of mean gradient
     38
  • trunk/src/uvmat.m

    r246 r247  
    21472147    ParamIn.GUIName='get_field';
    21482148    [Field{1},ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn,num_i1);
     2149    Field{1}
    21492150    if ~isempty(errormsg)
    21502151        errormsg=['error in reading ' filename ': ' errormsg];
     
    24622463    end
    24632464else
    2464     errormsg='input field coordinates not defined';
    2465     return
     2465%     errormsg='input field coordinates not defined';
     2466%     return
    24662467end
    24672468if NbDim==3
     
    25932594
    25942595%% Plot the projections on the selected  projection objects
    2595 
     2596'PLOT'
    25962597% main projection object (uvmat display)
    25972598list_object=get(handles.list_object_1,'String');
Note: See TracChangeset for help on using the changeset viewer.