Changeset 28092
- Timestamp:
- 02/05/24 15:23:36 (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/love_core.cpp
r27738 r28092 352 352 //} 353 353 354 if (PW_test==0 ){ //elastic or fluid response: Love(t) = Love(s), we can do an early return354 if (PW_test==0.0){ //elastic or fluid response: Love(t) = Love(s), we can do an early return 355 355 Lovet[t*(sh_nmax+1)+d]=Lovef[indf]; 356 356 return; … … 384 384 doubletype dalpha=1.0/(nalpha-1); // alpha table resolution given 0 <= alpha <= 1 385 385 ialpha= static_cast<int>(DownCastVarToDouble(alpha/dalpha)); 386 lincoef=alpha/dalpha- ialpha;//linear fraction in [0;1] for alpha interpolation386 lincoef=alpha/dalpha-reCast<doubletype>(ialpha);//linear fraction in [0;1] for alpha interpolation 387 387 iz1=nz; 388 388 for (int i=0;i<nz;i++){ … … 439 439 440 440 //cubic spline functions 441 h00=2 *pow(t,3)-3*pow(t,2)+1;442 h10=pow(t,3)-2 *pow(t,2)+t;443 h01=-2 *pow(t,3)+3*pow(t,2);441 h00=2.0*pow(t,3)-3.0*pow(t,2)+1.0; 442 h10=pow(t,3)-2.0*pow(t,2)+t; 443 h01=-2.0*pow(t,3)+3.0*pow(t,2); 444 444 h11=pow(t,3)-pow(t,2); 445 445 … … 589 589 int rheo=matlitho->rheologymodel[layer_index]; 590 590 591 if(vi!=0 && omega!=0.0){ //take into account viscosity in the rigidity if the material isn't a perfect fluid591 if(vi!=0.0 && omega!=0.0){ //take into account viscosity in the rigidity if the material isn't a perfect fluid 592 592 doubletype ka=la0 + 2.0/3.0*mu0; //Bulk modulus 593 593 if(rheo==2){//EBM … … 717 717 xmin=matlitho->radius[layer_index]/ra; 718 718 xmax=(matlitho->radius[layer_index+1])/ra; 719 dr = (xmax -xmin)/ nstep;719 dr = (xmax -xmin)/reCast<doubletype>(nstep); 720 720 x=xmin; 721 721 722 722 //fixme 723 g=GetGravity<doubletype>((xmin+xmax)/2 *ra,layer_index,femmodel,matlitho,vars);723 g=GetGravity<doubletype>((xmin+xmax)/2.0*ra,layer_index,femmodel,matlitho,vars); 724 724 725 725 for (int n=0;n<nstep;n++){ … … 759 759 xmin=matlitho->radius[layer_index]/ra; 760 760 xmax=(matlitho->radius[layer_index+1])/ra; 761 dr = (xmax -xmin)/ nstep;761 dr = (xmax -xmin)/reCast<doubletype>(nstep); 762 762 x=xmin; 763 763 764 764 765 765 //fixme 766 g=GetGravity<doubletype>((xmin+xmax)/2 *ra,layer_index,femmodel,matlitho,vars);766 g=GetGravity<doubletype>((xmin+xmax)/2.0*ra,layer_index,femmodel,matlitho,vars); 767 767 768 768 for (int n=0;n<nstep;n++){ … … 796 796 xmin=matlitho->radius[layer_index]/ra; 797 797 xmax=(matlitho->radius[layer_index+1])/ra; 798 dr = (xmax -xmin)/ nstep;798 dr = (xmax -xmin)/reCast<doubletype>(nstep); 799 799 x=xmin; 800 800 //fixme 801 g=GetGravity<doubletype>((xmin+xmax)/2 *ra,layer_index,femmodel,matlitho,vars);801 g=GetGravity<doubletype>((xmin+xmax)/2.0*ra,layer_index,femmodel,matlitho,vars); 802 802 for (int n=0;n<nstep;n++){ 803 803 g=GetGravity<doubletype>(x*ra,layer_index,femmodel,matlitho,vars); … … 923 923 924 924 doubletype* dydx=xNewZeroInit<doubletype>(6); 925 doubletype dr = (xmax -xmin)/ nstep;925 doubletype dr = (xmax -xmin)/reCast<doubletype>(nstep); 926 926 doubletype x=xmin; 927 927 for(int i = 0;i<nstep;i++){ … … 949 949 doubletype y3[6]={0}; 950 950 951 doubletype dr = (xmax -xmin)/ nstep;951 doubletype dr = (xmax -xmin)/reCast<doubletype>(nstep); 952 952 doubletype x=xmin; 953 953 … … 978 978 doubletype y3[6]={0}; 979 979 980 doubletype dr = (xmax -xmin)/ nstep;980 doubletype dr = (xmax -xmin)/reCast<doubletype>(nstep); 981 981 doubletype x=xmin; 982 982 for(int i = 0;i<nstep/2-1;i++){ … … 1066 1066 1067 1067 yi[2+nyi*0]=(deg+3.0)/(deg*(deg+1.0))*r/ra; 1068 yi[2+nyi*1]=1.0/( deg*r*ra);1068 yi[2+nyi*1]=1.0/(reCast<doubletype>(deg)*r*ra); 1069 1069 yi[2+nyi*2]=0.0; 1070 1070 1071 yi[3+nyi*0]=2.0*mu*( deg+2.0)/((deg+1.0)*mu0);1072 yi[3+nyi*1]=2.0*mu*(deg-1.0)/( deg*r2*mu0);1071 yi[3+nyi*0]=2.0*mu*(reCast<doubletype>(deg)+2.0)/((deg+1.0)*mu0); 1072 yi[3+nyi*1]=2.0*mu*(deg-1.0)/(reCast<doubletype>(deg)*r2*mu0); 1073 1073 yi[3+nyi*2]=0.0; 1074 1074 … … 1079 1079 yi[5+nyi*0]=-cst*r/g0; 1080 1080 yi[5+nyi*1]=-cst/(r*g0); 1081 yi[5+nyi*2]= deg/(r*g0);1081 yi[5+nyi*2]=reCast<doubletype>(deg)/(r*g0); 1082 1082 1083 1083 … … 1326 1326 //-- forcings at the Inner Core Boundary 1327 1327 case 1: //'ICB --Volumetric Potential' 1328 yi_righthandside[6*icb+5]= (deg)/(rc*g0);1328 yi_righthandside[6*icb+5]=reCast<doubletype>(deg)/(rc*g0); 1329 1329 yi_righthandside[6*icb+4]=1.0/(ra*g0); 1330 1330 break; … … 1487 1487 } 1488 1488 1489 if (omega==0 ){ // if running elastic love_numbers, record at which degree we must delete layers, this way we synch layer deletion between cpus next time we calculate love numbers1489 if (omega==0.0){ // if running elastic love_numbers, record at which degree we must delete layers, this way we synch layer deletion between cpus next time we calculate love numbers 1490 1490 //We need to delete a layer and try again if the ratio between deepest love number to surface love number is too low (risk of underflow) or garbage 1491 1491 if (loveratio<=underflow_tol || xIsNan(loveratio) || xIsInf(loveratio)) {
Note:
See TracChangeset
for help on using the changeset viewer.