Changeset 26876
- Timestamp:
- 02/10/22 11:46:50 (3 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r26875 r26876 2873 2873 void Penta::MovingFrontalVelocity(void){/*{{{*/ 2874 2874 if(!this->IsOnBase()) return; 2875 int dim,domaintype, calvinglaw, i;2875 int domaintype, calvinglaw, i; 2876 2876 IssmDouble v[3],w[3],c[3],m[3],dlsf[3]; 2877 2877 IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate, groundedice; 2878 2878 IssmDouble migrationmax, calvinghaf, heaviside, haf_eps; 2879 IssmDouble xyz_list[NUMVERTICES][3]; 2880 IssmDouble movingfrontvx[NUMVERTICES]; 2881 IssmDouble movingfrontvy[NUMVERTICES]; 2882 IssmDouble vel; 2879 IssmDouble xyz_list[NUMVERTICES][3]; 2880 IssmDouble movingfrontvx[NUMVERTICES]; 2881 IssmDouble movingfrontvy[NUMVERTICES]; 2882 IssmDouble vel; 2883 int dim=2; 2883 2884 2884 2885 /* Get node coordinates and dof list: */ 2885 2886 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 2886 2887 2887 Input* vx_input = NULL;2888 Input* vy_input = NULL;2889 2888 Input* calvingratex_input = NULL; 2890 2889 Input* calvingratey_input = NULL; 2891 Input* lsf_slopex_input = NULL;2892 Input* lsf_slopey_input = NULL;2893 2890 Input* calvingrate_input = NULL; 2894 2891 Input* meltingrate_input = NULL; 2895 Input* gr_input = NULL; 2892 2893 /*Load levelset function gradients*/ 2894 Input *lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input); 2895 Input *lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input); 2896 Input *vx_input = this->GetInput(VxEnum); _assert_(vx_input); 2897 Input *vy_input = this->GetInput(VyEnum); _assert_(vy_input); 2898 Input *gr_input = this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input); 2896 2899 2897 2900 /*Get problem dimension and whether there is moving front or not*/ 2898 this->FindParam(&domaintype,DomainTypeEnum);2899 2901 this->FindParam(&calvinglaw,CalvingLawEnum); 2900 2901 switch(domaintype){2902 case Domain2DverticalEnum: dim = 1; break;2903 case Domain2DhorizontalEnum: dim = 2; break;2904 case Domain3DEnum: dim = 2; break;2905 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");2906 }2907 /*Load velocities*/2908 switch(domaintype){2909 case Domain2DverticalEnum:2910 vx_input=this->GetInput(VxEnum); _assert_(vx_input);2911 break;2912 case Domain2DhorizontalEnum:2913 vx_input=this->GetInput(VxEnum); _assert_(vx_input);2914 vy_input=this->GetInput(VyEnum); _assert_(vy_input);2915 gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);2916 break;2917 case Domain3DEnum:2918 vx_input=this->GetInput(VxAverageEnum); _assert_(vx_input);2919 vy_input=this->GetInput(VyAverageEnum); _assert_(vy_input);2920 gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);2921 break;2922 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");2923 }2924 2925 2902 switch(calvinglaw){ 2926 2903 case DefaultCalvingEnum: 2927 2904 case CalvingVonmisesEnum: 2928 lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);2929 if(dim==2) lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);2930 2905 calvingrate_input = this->GetInput(CalvingCalvingrateEnum); _assert_(calvingrate_input); 2931 2906 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input); 2932 2907 break; 2933 2908 case CalvingLevermannEnum: 2934 switch(domaintype){ 2935 case Domain2DverticalEnum: 2936 calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input); 2937 break; 2938 case Domain2DhorizontalEnum: 2939 calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input); 2940 calvingratey_input=this->GetInput(CalvingrateyEnum); _assert_(calvingratey_input); 2941 break; 2942 case Domain3DEnum: 2943 calvingratex_input=this->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input); 2944 calvingratey_input=this->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input); 2945 break; 2946 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); 2947 } 2909 calvingratex_input=this->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input); 2910 calvingratey_input=this->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input); 2948 2911 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input); 2949 2912 break; … … 2951 2914 case CalvingHabEnum: 2952 2915 case CalvingCrevasseDepthEnum: 2953 lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);2954 if(dim==2) lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);2955 2916 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input); 2956 2917 break; 2957 2918 case CalvingDev2Enum: 2958 2919 this->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum); 2959 lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);2960 if(dim==2) lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);2961 2920 calvingrate_input = this->GetInput(CalvingCalvingrateEnum); _assert_(calvingrate_input); 2962 2921 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input); … … 2975 2934 vy_input->GetInputValue(&v[1],&gauss); 2976 2935 gr_input->GetInputValue(&groundedice,&gauss); 2936 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss); 2937 lsf_slopey_input->GetInputValue(&dlsf[1],&gauss); 2938 norm_dlsf=sqrt(dlsf[0]*dlsf[0] + dlsf[1]*dlsf[1]); 2977 2939 2978 2940 /*Get calving speed*/ … … 2980 2942 case DefaultCalvingEnum: 2981 2943 case CalvingVonmisesEnum: 2982 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);2983 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);2984 2944 calvingrate_input->GetInputValue(&calvingrate,&gauss); 2985 2945 meltingrate_input->GetInputValue(&meltingrate,&gauss); 2986 2946 2987 2947 if(groundedice<0) meltingrate = 0.; 2988 2989 norm_dlsf=0.;2990 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);2991 norm_dlsf=sqrt(norm_dlsf);2992 2948 2993 2949 if(norm_dlsf>1.e-10) … … 3003 2959 case CalvingLevermannEnum: 3004 2960 calvingratex_input->GetInputValue(&c[0],&gauss); 3005 if(dim==2)calvingratey_input->GetInputValue(&c[1],&gauss);2961 calvingratey_input->GetInputValue(&c[1],&gauss); 3006 2962 meltingrate_input->GetInputValue(&meltingrate,&gauss); 3007 2963 norm_calving=0.; … … 3014 2970 case CalvingHabEnum: 3015 2971 case CalvingCrevasseDepthEnum: 3016 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);3017 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);3018 2972 meltingrate_input->GetInputValue(&meltingrate,&gauss); 3019 2973 if(groundedice<0) meltingrate = 0.; 3020 3021 norm_dlsf=0.;3022 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);3023 norm_dlsf=sqrt(norm_dlsf);3024 2974 3025 2975 if(norm_dlsf>1.e-10) … … 3037 2987 case CalvingDev2Enum: 3038 2988 { 3039 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);3040 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);3041 2989 calvingrate_input->GetInputValue(&calvingrate,&gauss); 3042 2990 meltingrate_input->GetInputValue(&meltingrate,&gauss); … … 3062 3010 meltingrate=heaviside*meltingrate+0.; 3063 3011 } 3064 3065 norm_dlsf=0.;3066 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);3067 norm_dlsf=sqrt(norm_dlsf);3068 3012 3069 3013 if(norm_dlsf>1.e-10) -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r26875 r26876 4320 4320 Input* calvingratex_input = NULL; 4321 4321 Input* calvingratey_input = NULL; 4322 Input* lsf_slopex_input = NULL;4323 4322 Input* lsf_slopey_input = NULL; 4324 4323 Input* calvingrate_input = NULL; 4325 4324 Input* meltingrate_input = NULL; 4326 4325 Input* gr_input = NULL; 4326 4327 4327 4328 4328 /*Get problem dimension and whether there is moving front or not*/ … … 4336 4336 default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet"); 4337 4337 } 4338 4339 /*Load levelset function gradients*/ 4340 Input* lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input); 4341 if(dim==2){lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);} 4342 4338 4343 /*Load velocities*/ 4339 4344 switch(domaintype){ … … 4357 4362 case DefaultCalvingEnum: 4358 4363 case CalvingVonmisesEnum: 4359 lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);4360 if(dim==2) lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);4361 4364 calvingrate_input = this->GetInput(CalvingCalvingrateEnum); _assert_(calvingrate_input); 4362 4365 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input); … … 4382 4385 case CalvingHabEnum: 4383 4386 case CalvingCrevasseDepthEnum: 4384 lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);4385 if(dim==2) lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);4386 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input);4387 4387 break; 4388 4388 case CalvingDev2Enum: 4389 4389 this->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum); 4390 lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);4391 if(dim==2) lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);4392 4390 calvingrate_input = this->GetInput(CalvingCalvingrateEnum); _assert_(calvingrate_input); 4393 4391 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input); … … 4398 4396 break; 4399 4397 case CalvingParameterizationEnum: 4400 lsf_slopex_input = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);4401 if(dim==2) lsf_slopey_input = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);4402 4398 calvingrate_input = this->GetInput(CalvingCalvingrateEnum); _assert_(calvingrate_input); 4403 4399 meltingrate_input = this->GetInput(CalvingMeltingrateEnum); _assert_(meltingrate_input); … … 4416 4412 vy_input->GetInputValue(&v[1],&gauss); 4417 4413 gr_input->GetInputValue(&groundedice,&gauss); 4414 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss); 4415 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss); 4416 4417 norm_dlsf=0.; 4418 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2); 4419 norm_dlsf=sqrt(norm_dlsf); 4418 4420 4419 4421 /*Get calving speed*/ … … 4421 4423 case DefaultCalvingEnum: 4422 4424 case CalvingVonmisesEnum: 4423 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);4424 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);4425 4425 calvingrate_input->GetInputValue(&calvingrate,&gauss); 4426 4426 meltingrate_input->GetInputValue(&meltingrate,&gauss); 4427 4427 if(groundedice<0) meltingrate = 0.; 4428 4429 norm_dlsf=0.;4430 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);4431 norm_dlsf=sqrt(norm_dlsf);4432 4428 4433 4429 if(norm_dlsf>1.e-10) … … 4454 4450 case CalvingHabEnum: 4455 4451 case CalvingCrevasseDepthEnum: 4456 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);4457 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);4458 4452 meltingrate_input->GetInputValue(&meltingrate,&gauss); 4459 4460 norm_dlsf=0.;4461 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);4462 norm_dlsf=sqrt(norm_dlsf);4463 4453 4464 4454 if(norm_dlsf>1.e-10) … … 4476 4466 case CalvingDev2Enum: 4477 4467 { 4478 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);4479 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);4480 4468 calvingrate_input->GetInputValue(&calvingrate,&gauss); 4481 4469 meltingrate_input->GetInputValue(&meltingrate,&gauss); … … 4502 4490 } 4503 4491 4504 norm_dlsf=0.;4505 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);4506 norm_dlsf=sqrt(norm_dlsf);4507 4508 4492 if(norm_dlsf>1.e-10) 4509 4493 for(i=0;i<dim;i++){ … … 4524 4508 break; 4525 4509 case CalvingParameterizationEnum: 4526 lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);4527 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);4528 4510 calvingrate_input->GetInputValue(&calvingrate,&gauss); 4529 4511 meltingrate_input->GetInputValue(&meltingrate,&gauss); 4530 4512 meltingrate = 0.; 4531 4532 norm_dlsf=0.;4533 for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);4534 norm_dlsf=sqrt(norm_dlsf);4535 4513 4536 4514 if(norm_dlsf>1.e-10)
Note:
See TracChangeset
for help on using the changeset viewer.