Adding write statements to source code that is using multiple processors can produce unexpected results if not done correctly. Generally, diagnostic write statements should be done only by the controlling processor, called the master_task. The task number for the master processor is always zero and is set in setup_mpi. The master task is the only processor that can write to the log file. If other tasks are allowed to write to the log file, output from the master task will most likely be overwritten. Write statements should be surrounded by an 'if' block:
if (my_task == master_task) then write (nu_diag,*) 'istep1:',istep1 endif
Without the 'if' statement, all processors will write out the information. Output from other processors will be written to the standard output file.
Errors that cause the ice model to stop do not always occur in the master task subdomain, so there may not be information about the error in the log file. When the model stops, look for error messages in the log files, standard output, standard error, fort.*, and core files. Since multiple processors are writing to the standard output file, the error that caused the model to stop is not always right at the bottom of the file.