Changeset 18491
- Timestamp:
- 09/10/14 09:12:28 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/m/contrib/gravity/vfsa_mpi.cpp ¶
r18479 r18491 169 169 // Pp->Echo(); 170 170 171 double rhoi = 890; /* ice density */171 double rhoi = 917; /* ice density */ 172 172 double rhow = 1030; /* water density */ 173 173 // double rhos = 2013; /* sediment density */ … … 186 186 187 187 double ctr=1; /* parameter for filtering */ 188 double sd=0. 1;188 double sd=0.5; 189 189 190 190 Matrix *xobs= new Matrix(ny,nx); … … 669 669 Matrix* m1grsm=new Matrix(my,mx); 670 670 Matrix* m1col=new Matrix(mx*my,1); 671 Matrix* m1gr2=new Matrix(my,mx); 672 Matrix* m1grsm2=new Matrix(my,mx); 673 Matrix* m1col2=new Matrix(mx*my,1); 674 Matrix* nptflag= new Matrix(mx*my,1); 671 675 double u=0; 672 676 double y=0; 673 677 m1->MatrixEqual(m0); 678 nptflag->MatrixSum(icethick,bathy); 679 /* first layer: ice */ 674 680 for (int i=0;i<mx*my;i++){ 675 if( icethick->GetValue(i,0)==0){676 u=double (rand())/double(RAND_MAX);681 if(nptflag->GetValue(i,0)==0){ 682 u=double(rand())/double(RAND_MAX); 677 683 y=signe(u-0.5)*T*(pow(1+1/T,fabs(2*u-1))-1); 678 684 m1->SetValue(i,1,m0->GetValue(i,1)+y*ptval); 685 m1->SetValue(i,2,m1->GetValue(i,1)+1e-10); 679 686 if(m1->GetValue(i,1)<=m1->GetValue(i,0)){ 680 687 m1->SetValue(i,1,m1->GetValue(i,0)+1e-10); 688 m1->SetValue(i,2,m1->GetValue(i,1)+1e-10); 681 689 } 682 690 if(m1->GetValue(i,1)>=m1->GetValue(i,0)+mmax){ 683 691 m1->SetValue(i,1,m1->GetValue(i,0)+mmax); 684 } 685 } 686 } 692 m1->SetValue(i,2,m1->GetValue(i,1)+1e-10); 693 } 694 } 695 } 696 687 697 m1->ExtractColumn(m1col,1); 688 698 vec2gridsimple(m1col,m1gr,mx,my); 689 699 filtergrav(m1grsm,m1gr,ctr,sd,mx,my); 690 700 reshape(m1grsm,m1col,mx,my); 701 m1->ExtractColumn(m1col2,2); 702 vec2gridsimple(m1col2,m1gr2,mx,my); 703 filtergrav(m1grsm2,m1gr2,ctr,sd,mx,my); 704 reshape(m1grsm2,m1col2,mx,my); 705 691 706 for (int i=0;i<mx*my;i++){ 692 if( icethick->GetValue(i,0)==0){707 if(nptflag->GetValue(i,0)==0){ 693 708 m1->SetValue(i,1,m1col->GetValue(i,0)); 709 m1->SetValue(i,2,m1col2->GetValue(i,0)); 710 if(m1->GetValue(i,1)<m1->GetValue(i,0)){ 711 m1->SetValue(i,1,m1->GetValue(i,0)+1e-10); 712 m1->SetValue(i,2,m1->GetValue(i,1)+1e-10); 713 } 694 714 } 695 715 else{ 696 716 m1->SetValue(i,1,m0->GetValue(i,1)); 697 }698 if(m1->GetValue(i,1)<=m1->GetValue(i,0)){699 m1->SetValue(i,1,m1->GetValue(i,0)+1e-10);700 }701 }702 703 for (int i=0;i<mx*my;i++){704 if(bathy->GetValue(i,0)==0){705 u=double (rand())/ double(RAND_MAX);706 y=signe(u-0.5)*T*(pow(1+1/T,fabs(2*u-1))-1);707 m1->SetValue(i,2,m0->GetValue(i,2)+y*ptval);708 if(m1->GetValue(i,2)<=m1->GetValue(i,1)){709 m1->SetValue(i,2,m1->GetValue(i,1)+1e-10);710 }711 if(m1->GetValue(i,2)>=m1->GetValue(i,1)+mmax2){712 m1->SetValue(i,2,m1->GetValue(i,1)+mmax2);713 }714 }715 }716 m1->ExtractColumn(m1col,2);717 vec2gridsimple(m1col,m1gr,mx,my);718 filtergrav(m1grsm,m1gr,ctr,sd,mx,my);719 reshape(m1grsm,m1col,mx,my);720 for (int i=0;i<mx*my;i++){721 if(bathy->GetValue(i,0)==0){722 m1->SetValue(i,2,m1col->GetValue(i,0));723 }724 else{725 717 m1->SetValue(i,2,m0->GetValue(i,2)); 726 718 } 727 if(m1->GetValue(i,2)<=m1->GetValue(i,1)){ 728 m1->SetValue(i,2,m1->GetValue(i,1)+1e-10); 729 } 730 } 719 } 720 721 /* second layer: water */ 722 // for (int i=0;i<mx*my;i++){ 723 // if(bathy->GetValue(i,0)==0){ 724 // u=double (rand())/ double(RAND_MAX); 725 // y=signe(u-0.5)*T*(pow(1+1/T,fabs(2*u-1))-1); 726 // m1->SetValue(i,2,m0->GetValue(i,2)+y*ptval); 727 // if(m1->GetValue(i,2)<=m1->GetValue(i,1)){ 728 // m1->SetValue(i,2,m1->GetValue(i,1)+1e-10); 729 // } 730 // if(m1->GetValue(i,2)>=m1->GetValue(i,1)+mmax2){ 731 // m1->SetValue(i,2,m1->GetValue(i,1)+mmax2); 732 // } 733 // } 734 // } 735 // m1->ExtractColumn(m1col,2); 736 // vec2gridsimple(m1col,m1gr,mx,my); 737 // filtergrav(m1grsm,m1gr,ctr,sd,mx,my); 738 // reshape(m1grsm,m1col,mx,my); 739 // for (int i=0;i<mx*my;i++){ 740 // if(bathy->GetValue(i,0)==0){ 741 // m1->SetValue(i,2,m1col->GetValue(i,0)); 742 // } 743 // else{ 744 // m1->SetValue(i,2,m0->GetValue(i,2)); 745 // } 746 // if(m1->GetValue(i,2)<=m1->GetValue(i,1)){ 747 // m1->SetValue(i,2,m1->GetValue(i,1)+1e-10); 748 // } 749 // } 731 750 delete m1gr; 732 751 delete m1grsm; 733 752 delete m1col; 753 delete m1gr2; 754 delete m1grsm2; 755 delete m1col2; 756 delete nptflag; 734 757 }/*}}}*/ 735 758 double signe(double a){/*{{{*/
Note:
See TracChangeset
for help on using the changeset viewer.