Changeset 27905
- Timestamp:
- 09/19/23 12:09:44 (18 months ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r27861 r27905 29 29 #define NUMVERTICES 3 30 30 #define NUMVERTICES1D 2 31 //#define MICI 1 //1 = DeConto & Pollard, 2 =DOMINOS31 #define MICI 2 //1 = DeConto & Pollard, 2 = Anna Crawford DOMINOS 32 32 33 33 /*Constructors/destructor/copy*/ … … 2772 2772 IssmDouble Tria::GetIcefrontArea(){/*{{{*/ 2773 2773 2774 IssmDouble bed[NUMVERTICES]; //basinId[NUMVERTICES];2774 IssmDouble bed[NUMVERTICES]; 2775 2775 IssmDouble Haverage,frontarea; 2776 2776 IssmDouble x1,y1,x2,y2,distance; 2777 2777 IssmDouble lsf[NUMVERTICES], Haux[NUMVERTICES], surfaces[NUMVERTICES], bases[NUMVERTICES]; 2778 2778 int* indices=NULL; 2779 IssmDouble* H=NULL;; 2780 int nrfrontbed,numiceverts; 2781 2782 if(!IsZeroLevelset(MaskIceLevelsetEnum)) return 0; 2779 2780 /*Return if no ice front present*/ 2781 if(!this->IsIcefront()) return 0.; 2783 2782 2784 2783 /*Retrieve all inputs and parameters*/ … … 2788 2787 Element::GetInputListOnVertices(&lsf[0],MaskIceLevelsetEnum); 2789 2788 2790 nrfrontbed=0; 2791 for(int i=0;i<NUMVERTICES;i++){ 2792 /*Find if bed<0*/ 2793 if(bed[i]<0.) nrfrontbed++; 2794 } 2795 2796 if(nrfrontbed==3){ 2797 /*2. Find coordinates of where levelset crosses 0*/ 2798 int numiceverts; 2799 IssmDouble s[2],x[2],y[2]; 2800 this->GetLevelsetIntersection(&indices, &numiceverts,&s[0],MaskIceLevelsetEnum,0.); 2801 _assert_(numiceverts); 2802 2803 /*3 Write coordinates*/ 2804 IssmDouble xyz_list[NUMVERTICES][3]; 2805 ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES); 2806 int counter = 0; 2807 if((numiceverts>0) && (numiceverts<NUMVERTICES)){ 2808 for(int i=0;i<numiceverts;i++){ 2809 for(int n=numiceverts;n<NUMVERTICES;n++){ // iterate over no-ice vertices 2810 x[counter] = xyz_list[indices[i]][0]+s[counter]*(xyz_list[indices[n]][0]-xyz_list[indices[i]][0]); 2811 y[counter] = xyz_list[indices[i]][1]+s[counter]*(xyz_list[indices[n]][1]-xyz_list[indices[i]][1]); 2812 counter++; 2789 /*Only continue if all 3 vertices are below sea level*/ 2790 for(int i=0;i<NUMVERTICES;i++) if(bed[i]>=0.) return 0.; 2791 2792 /*2. Find coordinates of where levelset crosses 0*/ 2793 int numiceverts; 2794 IssmDouble s[2],x[2],y[2]; 2795 this->GetLevelsetIntersection(&indices, &numiceverts, &s[0],MaskIceLevelsetEnum,0.); 2796 _assert_(numiceverts); 2797 if(numiceverts>2){ 2798 Input* ls_input = this->GetInput(MaskIceLevelsetEnum); 2799 ls_input->Echo(); 2800 } 2801 2802 /*3 Write coordinates*/ 2803 IssmDouble xyz_list[NUMVERTICES][3]; 2804 ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES); 2805 int counter = 0; 2806 if((numiceverts>0) && (numiceverts<NUMVERTICES)){ 2807 for(int i=0;i<numiceverts;i++){ 2808 for(int n=numiceverts;n<NUMVERTICES;n++){ // iterate over no-ice vertices 2809 x[counter] = xyz_list[indices[i]][0]+s[counter]*(xyz_list[indices[n]][0]-xyz_list[indices[i]][0]); 2810 y[counter] = xyz_list[indices[i]][1]+s[counter]*(xyz_list[indices[n]][1]-xyz_list[indices[i]][1]); 2811 counter++; 2812 } 2813 } 2814 } 2815 else if(numiceverts==NUMVERTICES){ //NUMVERTICES ice vertices: calving front lies on element edge 2816 2817 for(int i=0;i<NUMVERTICES;i++){ 2818 if(lsf[indices[i]]==0.){ 2819 x[counter]=xyz_list[indices[i]][0]; 2820 y[counter]=xyz_list[indices[i]][1]; 2821 counter++; 2822 } 2823 if(counter==2) break; 2824 } 2825 if(counter==1){ 2826 /*We actually have only 1 vertex on levelset, write a single point as a segment*/ 2827 x[counter]=x[0]; 2828 y[counter]=y[0]; 2829 counter++; 2830 } 2831 } 2832 else{ 2833 _error_("not sure what's going on here..."); 2834 } 2835 x1=x[0]; y1=y[0]; x2=x[1]; y2=y[1]; 2836 distance=sqrt(pow((x1-x2),2)+pow((y1-y2),2)); 2837 if(distance<1e-3) return 0.; 2838 2839 IssmDouble H[4]; 2840 for(int iv=0;iv<NUMVERTICES;iv++) Haux[iv]=-bed[indices[iv]]; //sort bed in ice/noice 2841 xDelete<int>(indices); 2842 2843 switch(numiceverts){ 2844 case 1: // average over triangle 2845 H[0]=Haux[0]; 2846 H[1]=Haux[0]+s[0]*(Haux[1]-Haux[0]); 2847 H[2]=Haux[0]+s[1]*(Haux[2]-Haux[0]); 2848 Haverage=(H[1]+H[2])/2; 2849 break; 2850 case 2: // average over quadrangle 2851 H[0]=Haux[0]; 2852 H[1]=Haux[1]; 2853 H[2]=Haux[0]+s[0]*(Haux[2]-Haux[0]); 2854 H[3]=Haux[1]+s[1]*(Haux[2]-Haux[1]); 2855 Haverage=(H[2]+H[3])/2; 2856 break; 2857 case 3: 2858 if(counter==1) distance = 0; //front has 0 width on this element because levelset is 0 at a single vertex 2859 else if(counter==2){ //two vertices with levelset=0: averaging ice front depth over both 2860 Haverage = 0; 2861 for(int i=0;i<NUMVERTICES;i++){ 2862 if(lsf[indices[i]]==0.) Haverage -= Haux[indices[i]]/2; 2863 if(Haverage<Haux[indices[i]]/2-1e-3) break; //done with the two vertices 2813 2864 } 2814 2865 } 2815 } 2816 else if(numiceverts==NUMVERTICES){ //NUMVERTICES ice vertices: calving front lies on element edge 2817 2818 for(int i=0;i<NUMVERTICES;i++){ 2819 if(lsf[indices[i]]==0.){ 2820 x[counter]=xyz_list[indices[i]][0]; 2821 y[counter]=xyz_list[indices[i]][1]; 2822 counter++; 2823 } 2824 if(counter==2) break; 2825 } 2826 if(counter==1){ 2827 /*We actually have only 1 vertex on levelset, write a single point as a segment*/ 2828 x[counter]=x[0]; 2829 y[counter]=y[0]; 2830 counter++; 2831 } 2832 } 2833 else{ 2834 _error_("not sure what's going on here..."); 2835 } 2836 x1=x[0]; y1=y[0]; x2=x[1]; y2=y[1]; 2837 distance=sqrt(pow((x1-x2),2)+pow((y1-y2),2)); 2838 2839 int numthk=numiceverts+2; 2840 H=xNew<IssmDouble>(numthk); 2841 for(int iv=0;iv<NUMVERTICES;iv++) Haux[iv]=-bed[indices[iv]]; //sort bed in ice/noice 2842 2843 switch(numiceverts){ 2844 case 1: // average over triangle 2845 H[0]=Haux[0]; 2846 H[1]=Haux[0]+s[0]*(Haux[1]-Haux[0]); 2847 H[2]=Haux[0]+s[1]*(Haux[2]-Haux[0]); 2848 Haverage=(H[1]+H[2])/2; 2849 break; 2850 case 2: // average over quadrangle 2851 H[0]=Haux[0]; 2852 H[1]=Haux[1]; 2853 H[2]=Haux[0]+s[0]*(Haux[2]-Haux[0]); 2854 H[3]=Haux[1]+s[1]*(Haux[2]-Haux[1]); 2855 Haverage=(H[2]+H[3])/2; 2856 break; 2857 case 3: 2858 if(counter==1) distance = 0; //front has 0 width on this element because levelset is 0 at a single vertex 2859 else if(counter==2){ //two vertices with levelset=0: averaging ice front depth over both 2860 Haverage = 0; 2861 for(int i=0;i<NUMVERTICES;i++){ 2862 if(lsf[indices[i]]==0.) Haverage -= Haux[indices[i]]/2; 2863 if(Haverage<Haux[indices[i]]/2-1e-3) break; //done with the two vertices 2864 } 2865 } 2866 break; 2867 default: 2868 _error_("Number of ice covered vertices wrong in Tria::GetIceFrontArea(void)"); 2869 break; 2870 } 2871 frontarea=distance*Haverage; 2872 } 2873 else return 0; 2874 2875 xDelete<int>(indices); 2876 xDelete<IssmDouble>(H); 2866 break; 2867 default: 2868 _error_("Number of ice covered vertices wrong in Tria::GetIceFrontArea(void)"); 2869 break; 2870 } 2871 frontarea=distance*Haverage; 2877 2872 2878 2873 _assert_(frontarea>0); … … 4733 4728 4734 4729 /*Do we assume that the calving front does not move if MICI is not engaged?*/ 4735 movingfrontvx[iv] = 0.; 4736 movingfrontvy[iv] = 0.; 4730 bool regrowth = false; 4731 bool apply_as_retreat = true; 4732 if(!regrowth){ 4733 movingfrontvx[iv] = 0.; 4734 movingfrontvy[iv] = 0.; 4735 } 4736 4737 4737 //movingfrontvx[iv] = -2000./(365*24*3600.)*dlsf[0]/norm_dlsf; 4738 4738 //movingfrontvy[iv] = -2000./(365*24*3600.)*dlsf[1]/norm_dlsf; … … 4746 4746 } 4747 4747 else if (MICI==2 && Hc>135. && bed<0. && fabs(ls)<100.e3){ // Crawford et all 4748 4749 /*if 1: RETREAT rate 4750 *if 0: calving rate*/ 4751 if(0) v[0]=0.; v[1]=0.; 4748 4752 4749 4753 /*5C Bn (worst case scenario)*/ … … 4755 4759 movingfrontvx[iv] = v[0] -C*dlsf[0]/norm_dlsf; 4756 4760 movingfrontvy[iv] = v[1] -C*dlsf[1]/norm_dlsf; 4761 4762 /*disable regrowth if calving rate is too low*/ 4763 if(!regrowth && C<vel){ 4764 movingfrontvx[iv] = 0.; 4765 movingfrontvy[iv] = 0.; 4766 } 4757 4767 } 4758 4768 } -
issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp
r27904 r27905 30 30 /*retrieve mat_type option: */ 31 31 #if PETSC_VERSION_LT(3,7,0) 32 PetscOptionsGetString(PETSC_NULL,"-mat_type",&option[0],100,&flag); 33 #elif PETSC_VERSION_LT(3,19,0) 32 34 PetscOptionsGetString(NULL,PETSC_NULL,"-mat_type",&option[0],100,&flag); 33 #elif PETSC_VERSION_LT(3,19,0) 34 PetscOptionsGetString(PETSC_NULL,"-mat_type",&option[0],100,&flag); 35 #else 35 #else /*newest version*/ 36 36 PetscOptionsGetString(NULL,PETSC_NULLPTR,"-mat_type",&option[0],100,&flag); 37 37 #endif
Note:
See TracChangeset
for help on using the changeset viewer.