Changeset 28092


Ignore:
Timestamp:
02/05/24 15:23:36 (14 months ago)
Author:
Eric.Larour
Message:

CHG: fixing issues with type casts in love_core capability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/cores/love_core.cpp

    r27738 r28092  
    352352        //}
    353353
    354         if (PW_test==0){ //elastic or fluid response: Love(t) = Love(s), we can do an early return
     354        if (PW_test==0.0){ //elastic or fluid response: Love(t) = Love(s), we can do an early return
    355355                Lovet[t*(sh_nmax+1)+d]=Lovef[indf];
    356356                return;
     
    384384        doubletype dalpha=1.0/(nalpha-1); // alpha table resolution given 0 <= alpha <= 1
    385385        ialpha= static_cast<int>(DownCastVarToDouble(alpha/dalpha));
    386         lincoef=alpha/dalpha-ialpha;//linear fraction in [0;1] for alpha interpolation
     386        lincoef=alpha/dalpha-reCast<doubletype>(ialpha);//linear fraction in [0;1] for alpha interpolation
    387387        iz1=nz;
    388388        for (int i=0;i<nz;i++){
     
    439439               
    440440                //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);
    444444                h11=pow(t,3)-pow(t,2);
    445445
     
    589589        int rheo=matlitho->rheologymodel[layer_index];
    590590
    591         if(vi!=0 && omega!=0.0){ //take into account viscosity in the rigidity if the material isn't a perfect fluid
     591        if(vi!=0.0 && omega!=0.0){ //take into account viscosity in the rigidity if the material isn't a perfect fluid
    592592                doubletype ka=la0 + 2.0/3.0*mu0; //Bulk modulus
    593593                if(rheo==2){//EBM
     
    717717                                xmin=matlitho->radius[layer_index]/ra;
    718718                                xmax=(matlitho->radius[layer_index+1])/ra;
    719                                 dr = (xmax -xmin)/nstep;
     719                                dr = (xmax -xmin)/reCast<doubletype>(nstep);
    720720                                x=xmin;
    721721
    722722                                //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);
    724724
    725725                                for (int n=0;n<nstep;n++){
     
    759759                        xmin=matlitho->radius[layer_index]/ra;
    760760                        xmax=(matlitho->radius[layer_index+1])/ra;
    761                         dr = (xmax -xmin)/nstep;
     761                        dr = (xmax -xmin)/reCast<doubletype>(nstep);
    762762                        x=xmin;
    763763
    764764
    765765                                //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);
    767767
    768768                        for (int n=0;n<nstep;n++){
     
    796796                        xmin=matlitho->radius[layer_index]/ra;
    797797                        xmax=(matlitho->radius[layer_index+1])/ra;
    798                         dr = (xmax -xmin)/nstep;
     798                        dr = (xmax -xmin)/reCast<doubletype>(nstep);
    799799                        x=xmin;
    800800                                //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);
    802802                        for (int n=0;n<nstep;n++){
    803803                                g=GetGravity<doubletype>(x*ra,layer_index,femmodel,matlitho,vars);
     
    923923
    924924        doubletype* dydx=xNewZeroInit<doubletype>(6);
    925         doubletype dr = (xmax -xmin)/nstep;
     925        doubletype dr = (xmax -xmin)/reCast<doubletype>(nstep);
    926926        doubletype x=xmin;
    927927        for(int i = 0;i<nstep;i++){
     
    949949        doubletype y3[6]={0};
    950950
    951         doubletype dr = (xmax -xmin)/nstep;
     951        doubletype dr = (xmax -xmin)/reCast<doubletype>(nstep);
    952952        doubletype x=xmin;
    953953
     
    978978        doubletype y3[6]={0};
    979979
    980         doubletype dr = (xmax -xmin)/nstep;
     980        doubletype dr = (xmax -xmin)/reCast<doubletype>(nstep);
    981981        doubletype x=xmin;
    982982        for(int i = 0;i<nstep/2-1;i++){
     
    10661066
    10671067        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);
    10691069        yi[2+nyi*2]=0.0;
    10701070
    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);
    10731073        yi[3+nyi*2]=0.0;
    10741074
     
    10791079        yi[5+nyi*0]=-cst*r/g0;
    10801080        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);
    10821082
    10831083
     
    13261326                //-- forcings at the Inner Core Boundary
    13271327                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);
    13291329                        yi_righthandside[6*icb+4]=1.0/(ra*g0);
    13301330                        break;
     
    14871487                }
    14881488
    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 numbers
     1489                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
    14901490                        //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
    14911491                        if (loveratio<=underflow_tol || xIsNan(loveratio) || xIsInf(loveratio)) {
Note: See TracChangeset for help on using the changeset viewer.