Changeset 1139 for trunk


Ignore:
Timestamp:
Apr 25, 2024, 5:56:32 PM (8 months ago)
Author:
sommeria
Message:

series/test patch added + some bug corrections

Location:
trunk/src
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field_tps.m

    r1137 r1139  
    143143                DataOut.curl(ind_sel)=DataOut.curl(ind_sel)-weight.*EMDY *FieldVar(1:nbvec_sub+3,isub,1)+weight.*EMDX *FieldVar(1:nbvec_sub+3,isub,2);
    144144            case 'div(U,V)'
    145                 DataOut.div(ind_sel)=DataOut.div(ind_sel)+weight.*EMDX*FieldVar(1:nbvec_sub+3,isub,1)+EMDY *FieldVar(1:nbvec_sub+3,isub,2);
     145                DataOut.div(ind_sel)=DataOut.div(ind_sel)+weight.*EMDX*FieldVar(1:nbvec_sub+3,isub,1)+weight.*EMDY*FieldVar(1:nbvec_sub+3,isub,2);
    146146            case 'strain(U,V)'
    147                 DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+weight.*EMDY*FieldVar(1:nbvec_sub+3,isub,1)+EMDX *FieldVar(1:nbvec_sub+3,isub,2);
     147                DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+weight.*EMDY*FieldVar(1:nbvec_sub+3,isub,1)+weight.*EMDX*FieldVar(1:nbvec_sub+3,isub,2);
    148148            case 'DUDX(U,V)'
    149149                DataOut.DUDX(ind_sel)=DataOut.DUDX(ind_sel)+weight.*EMDX *FieldVar(1:nbvec_sub+3,isub,1);
  • trunk/src/filter_tps.m

    r1137 r1139  
    11%'filter_tps': find the thin plate spline coefficients for interpolation-smoothing
    22%------------------------------------------------------------------------
    3 % [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomainSize,Rho,Threshold)
     3% [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomainSize,FieldSmooth,Threshold)
    44%
    55% OUTPUT:
     
    1616% U,V, possibly W: set of velocity components of the initial data
    1717% SubdomainSize: estimated number of data points in each subdomain
    18 % Rho: smoothing parameter
     18% FieldSmooth: smoothing parameter
    1919% Threshold: max diff accepted between smoothed and initial data
    2020
     
    3838%=======================================================================
    3939
    40 function [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomainSize,Rho,Threshold)
     40function [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomainSize,FieldSmooth,Threshold)
    4141
    4242%% adjust subdomain decomposition
     
    6161
    6262%% smoothing parameter
    63 rho=Siz(1)*Siz(2)*Rho/1000;%optimum rho increase as the area of the subdomain (division by 1000 to reach good values with the default GUI input)
     63smoothing=Siz(1)*Siz(2)*FieldSmooth/1000;%optimum smoothing increase as the area of the subdomain (division by 1000 to reach good values with the default GUI input)
    6464
    6565%% default output
     
    100100        % subdomain includes enough vectors, perform tps interpolation
    101101        else
    102             [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel,:),U(ind_sel),rho);
    103             [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel,:),V(ind_sel),rho);
     102            [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel,:),U(ind_sel),smoothing);
     103            [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel,:),V(ind_sel),smoothing);
    104104            UDiff=U_smooth_sub-U(ind_sel);% difference between interpolated U component and initial value
    105105            VDiff=V_smooth_sub-V(ind_sel);% difference between interpolated V component and initial value
     
    132132            % else interpolation-smoothing is done again with the selected vectors
    133133            else
    134                 [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),U(ind_sel(ind_ind_sel)),rho);
    135                 [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),V(ind_sel(ind_ind_sel)),rho);
     134                [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),U(ind_sel(ind_ind_sel)),smoothing);
     135                [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),V(ind_sel(ind_ind_sel)),smoothing);
    136136                x_width=(SubRange(1,2,isub)-SubRange(1,1,isub))/pi;
    137137                y_width=(SubRange(2,2,isub)-SubRange(2,1,isub))/pi;
  • trunk/src/series/civ_input.m

    r1137 r1139  
    424424Param.Patch1.FieldSmooth=10;
    425425Param.Patch1.MaxDiff=1.5000;
    426 Param.Patch1.SubDomainSize=1000;
     426Param.Patch1.SubDomainSize=250;
    427427Param.Patch1.TestPatch1=0;
    428428
     
    451451Param.Patch2.FieldSmooth=2;
    452452Param.Patch2.MaxDiff=1.5000;
    453 Param.Patch2.SubDomainSize=1000;
     453Param.Patch2.SubDomainSize=500;
    454454Param.Patch2.TestPatch2=0;
    455455
  • trunk/src/test_tps.m

    r1127 r1139  
    2121%U=exp(-(x-pi).*(x-pi)-(y-pi).*(y-pi));% gaussian
    2222U=x;
    23 [U_smooth,U_tps]=tps_coeff([x y],U,0);%calculate tps coeff
     23[U_smooth,U_tps]=tps_coeff([x y],U,0);%calculate tps coeff, no smoothing
    2424xI=0:0.1:2*pi;%interpolation grid
    2525yI=0:0.1:2*pi;
     
    3232U_eval=reshape(U_eval,npy,npx);
    3333figure(1)
    34 imagesc(U_eval,[-1 1])
     34imagesc(U_eval,[0 6])
     35title('U matrix')
     36colorbar
    3537[DMX,DMY] = tps_eval_dxy([XI YI],[x y]);
    3638DUX_eval=DMX*U_tps;
  • trunk/src/tps_coeff.m

    r1127 r1139  
    1212%
    1313%------------------------------------------------------------------------
    14 % [U_smooth,U_tps]=tps_coeff(ctrs,U,Smoothing)
     14% [U_smooth,U_tps]=tps_coeff(ctrs,U,smoothing)
    1515%------------------------------------------------------------------------
    1616% OUTPUT:
     
    2121%  ctrs: NxNbDim matrix  representing the positions of the N centers, sources of the tps (NbDim=space dimension)
    2222%  U: Nx1 column vector representing the values of the considered scalar measured at the centres ctrs
    23 Smoothing: smoothing parameter: the result is smoother for larger Smoothing.
     23smoothing: smoothing parameter: the result is smoother for larger smoothing.
    2424%
    2525% RELATED FUNCTIONS:
     
    4545%=======================================================================
    4646
    47 function [U_smooth,U_tps]=tps_coeff(ctrs,U,Smoothing)
     47function [U_smooth,U_tps]=tps_coeff(ctrs,U,smoothing)
    4848%------------------------------------------------------------------------
    4949warning off
     
    5252U = [U; zeros(NbDim+1,1)];
    5353EM = tps_eval(ctrs,ctrs);
    54 SmoothingMat=Smoothing*eye(N,N);%  Smoothing=1/(2*omega) , omega given by fasshauer;
     54SmoothingMat=smoothing*eye(N,N);%  smoothing=1/(2*omega) , omega given by fasshauer;
    5555SmoothingMat=[SmoothingMat zeros(N,NbDim+1)];
    5656PM=[ones(N,1) ctrs];
Note: See TracChangeset for help on using the changeset viewer.