Ignore:
Timestamp:
Apr 24, 2024, 7:45:09 PM (6 months ago)
Author:
sommeria
Message:

tps improved by a cosine window in each subdomain. Default size of subdomains reduced for faster computation in the civ interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/filter_tps.m

    r1135 r1137  
    9595            break %  go to next subdomain
    9696        % if too few selected vectors, increase the subrange for next iteration
    97         elseif numel(ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous);
     97        elseif numel(ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous)
    9898            SubRange(:,1,isub)=SubRange(:,1,isub)-Siz'/4;
    9999            SubRange(:,2,isub)=SubRange(:,2,isub)+Siz'/4;
     
    112112            % if no value exceeds threshold, the result is recorded
    113113            if isequal(numel(ind_ind_sel),numel(ind_sel))
    114                 U_smooth(ind_sel)=U_smooth(ind_sel)+U_smooth_sub;
    115                 V_smooth(ind_sel)=V_smooth(ind_sel)+V_smooth_sub;
     114                x_width=(SubRange(1,2,isub)-SubRange(1,1,isub))/pi;
     115                y_width=(SubRange(2,2,isub)-SubRange(2,1,isub))/pi;
     116                x_dist=(Coord(ind_sel,1)-CentreX(isub))/x_width;% relative x distance to the retangle centre
     117                y_dist=(Coord(ind_sel,2)-CentreY(isub))/y_width;% relative ydistance to the retangle centre
     118                weight=cos(x_dist).*cos(y_dist);%weighting fct =1 at the rectangle center and 0 at edge
     119                U_smooth(ind_sel)=U_smooth(ind_sel)+weight.*U_smooth_sub;
     120                V_smooth(ind_sel)=V_smooth(ind_sel)+weight.*V_smooth_sub;
    116121                NbCentre(isub)=numel(ind_sel);
    117122                Coord_tps(1:NbCentre(isub),:,isub)=Coord(ind_sel,:);
    118123                U_tps(1:NbCentre(isub)+3,isub)=U_tps_sub;
    119124                V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub;
    120                 nb_select(ind_sel)=nb_select(ind_sel)+1;
     125                nb_select(ind_sel)=nb_select(ind_sel)+weight;
    121126                display(['tps done in subdomain # ' num2str(isub)  ' among ' num2str(NbSubDomain)])
    122127                break
    123128            % if too few selected vectors, increase the subrange for next iteration
    124             elseif numel(ind_ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous);
     129            elseif numel(ind_ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous)
    125130                SubRange(:,1,isub)=SubRange(:,1,isub)-Siz'/4;
    126131                SubRange(:,2,isub)=SubRange(:,2,isub)+Siz'/4;
     
    129134                [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),U(ind_sel(ind_ind_sel)),rho);
    130135                [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),V(ind_sel(ind_ind_sel)),rho);
    131                 U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+U_smooth_sub;
    132                 V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+V_smooth_sub;
     136                x_width=(SubRange(1,2,isub)-SubRange(1,1,isub))/pi;
     137                y_width=(SubRange(2,2,isub)-SubRange(2,1,isub))/pi;
     138                x_dist=(Coord(ind_sel(ind_ind_sel),1)-CentreX(isub))/x_width;% relative x distance to the retangle centre
     139                y_dist=(Coord(ind_sel(ind_ind_sel),2)-CentreY(isub))/y_width;% relative ydistance to the retangle centre
     140                weight=cos(x_dist).*cos(y_dist);%weighting fct =1 at the rectangle center and 0 at edge
     141                U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+weight.*U_smooth_sub;
     142                V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+weight.*V_smooth_sub;
    133143                NbCentre(isub)=numel(ind_ind_sel);
    134144                Coord_tps(1:NbCentre(isub),:,isub)=Coord(ind_sel(ind_ind_sel),:);
    135145                U_tps(1:NbCentre(isub)+3,isub)=U_tps_sub;
    136146                V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub;
    137                 nb_select(ind_sel(ind_ind_sel))=nb_select(ind_sel(ind_ind_sel))+1;
     147                nb_select(ind_sel(ind_ind_sel))=nb_select(ind_sel(ind_ind_sel))+weight;
    138148                display(['tps redone after elimination of erratic vectors in subdomain # ' num2str(isub) ' among ' num2str(NbSubDomain)])
    139149                break
Note: See TracChangeset for help on using the changeset viewer.