Changeset 28193


Ignore:
Timestamp:
03/29/24 11:39:58 (12 months ago)
Author:
Mathieu Morlighem
Message:

BUG: avoid created NaNs if basin is not present (would divide by 0, which makes CoDiPack trip)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/FloatingiceMeltingRatex/FloatingiceMeltingRatex.cpp

    r28119 r28193  
    193193                ISSM_MPI_Allreduce(areas_summed,areas_summed_cpu,num_basins,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
    194194
     195                /*Make sure Area is not zero to avoid dividing by 0 if a basin is not present in the model*/
     196                for(int k=0;k<num_basins;k++) if(areas_summed_cpu[k]==0.) areas_summed_cpu[k] = 1.;
     197
    195198                /*Compute weighted means and save*/
    196199                for(int k=0;k<num_basins;k++){tf_weighted_avg_cpu[k] = tf_weighted_avg_cpu[k]/areas_summed_cpu[k];}
Note: See TracChangeset for help on using the changeset viewer.