@@ -517,19 +517,21 @@ def _apply_all_xmlchanges(self, do_exec):
517517 xmlchange ("NTASKS_OCN" ,cores , do_exec , self ._is_non_local (), self ._out )
518518
519519 @staticmethod
520- def _calc_cores_based_on_grid ( num_points , min_points_per_core = 32 , max_points_per_core = 800 , ideal_multiple_of_cores_used = 128 ):
520+ def _calc_cores_based_on_grid ( num_points , min_points_per_core = 32 , max_points_per_core = 300 , ideal_multiple_of_cores_used = 128 ):
521521 """Calculate the number of cores based on the grid size."""
522522
523523
524524 min_cores = math .ceil (num_points / max_points_per_core )
525- max_cores = math .ceil (num_points / min_points_per_core )
525+ max_cores = math .ceil (num_points / min_points_per_core )
526+
527+ # If min_cores is less than the first multiple of ideal cores, just return the min_cores
528+ if min_cores < ideal_multiple_of_cores_used :
529+ return min_cores
526530
527531 # Request a multiple of the entire core (ideal_multiple_of_cores_used) starting from the min
528532 ideal_cores = ((min_cores + ideal_multiple_of_cores_used - 1 ) // ideal_multiple_of_cores_used ) * ideal_multiple_of_cores_used
529- if ideal_cores <= max_cores :
530- return ideal_cores
531- else :
532- return (max_cores + min_cores )// 2
533+ return ideal_cores
534+
533535
534536 def _apply_user_nl_changes (self , model , var_val_pairs , do_exec , comment = None , log_title = True ):
535537 """Apply changes to a given user_nl file."""
@@ -586,7 +588,7 @@ def _apply_mom_namelist_changes(self, do_exec):
586588 # Determine timesteps based on the grid resolution (assuming coupling frequency of 1800.0 sec):
587589 res_x = float (cvars ['OCN_LENX' ].value ) / int (cvars ["OCN_NX" ].value )
588590 res_y = float (cvars ['OCN_LENY' ].value ) / int (cvars ["OCN_NY" ].value )
589- dt = 600 .0 * min (res_x ,res_y ) # A 1-deg grid should have ~600 sec tstep (a safe value)
591+ dt = 7200 .0 * min (res_x ,res_y ) # A 1-deg grid should have ~600 sec tstep (a safe value)
590592 # Make sure 1800.0 is a multiple of dt and dt is a power of 2 and/or 3:
591593 dt = min ((1800.0 / n for n in [2 ** i * 3 ** j for i in range (10 ) for j in range (6 )] if 1800.0 % n == 0 ), key = lambda x : abs (dt - x ))
592594 # Try setting dt_therm to dt*4, or dt*3, or dt*3, depending on whether 1800.0 becomes a multiple of dt:
0 commit comments