| 1 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 2 | ! Program metgrid |
|---|
| 3 | ! |
|---|
| 4 | ! First version: Michael Duda -- January 2006 |
|---|
| 5 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 6 | program metgrid |
|---|
| 7 | |
|---|
| 8 | use gridinfo_module |
|---|
| 9 | use interp_option_module |
|---|
| 10 | use module_debug |
|---|
| 11 | use parallel_module |
|---|
| 12 | use process_domain_module |
|---|
| 13 | |
|---|
| 14 | implicit none |
|---|
| 15 | |
|---|
| 16 | ! Local variables |
|---|
| 17 | integer :: n |
|---|
| 18 | logical :: extra_row, extra_col |
|---|
| 19 | |
|---|
| 20 | ! |
|---|
| 21 | ! Do general setup |
|---|
| 22 | ! |
|---|
| 23 | |
|---|
| 24 | ! Initialize parallel stuff |
|---|
| 25 | call parallel_start() |
|---|
| 26 | |
|---|
| 27 | call mprintf(.true.,LOGFILE,' *** Starting program metgrid.exe *** ') |
|---|
| 28 | |
|---|
| 29 | ! Get info about how many nests there are to process, etc. |
|---|
| 30 | call get_namelist_params() |
|---|
| 31 | |
|---|
| 32 | ! Having determined which processor we are, which grid type we are, and where |
|---|
| 33 | ! our patch is located in the domain, we can determine if U or V staggered |
|---|
| 34 | ! fields will have one more row or column than the M staggered fields |
|---|
| 35 | if (gridtype == 'C') then |
|---|
| 36 | if (my_x == nproc_x-1) then |
|---|
| 37 | extra_col = .true. |
|---|
| 38 | else |
|---|
| 39 | extra_col = .false. |
|---|
| 40 | end if |
|---|
| 41 | |
|---|
| 42 | if (my_y == nproc_y-1) then |
|---|
| 43 | extra_row = .true. |
|---|
| 44 | else |
|---|
| 45 | extra_row = .false. |
|---|
| 46 | end if |
|---|
| 47 | else if (gridtype == 'E') then |
|---|
| 48 | extra_col = .false. |
|---|
| 49 | extra_row = .false. |
|---|
| 50 | end if |
|---|
| 51 | |
|---|
| 52 | ! Get info about which interpolators should be used with each field |
|---|
| 53 | call read_interp_table() |
|---|
| 54 | |
|---|
| 55 | ! |
|---|
| 56 | ! Now begin the processing work, looping over all domains to be processed |
|---|
| 57 | ! |
|---|
| 58 | |
|---|
| 59 | if (gridtype == 'C') then |
|---|
| 60 | |
|---|
| 61 | do n=1,max_dom |
|---|
| 62 | |
|---|
| 63 | call mprintf(.true.,STDOUT,'Processing domain %i of %i', i1=n, i2=max_dom) |
|---|
| 64 | call mprintf(.true.,LOGFILE,'Processing domain %i of %i', i1=n, i2=max_dom) |
|---|
| 65 | |
|---|
| 66 | call process_domain(n, extra_row, extra_col) |
|---|
| 67 | |
|---|
| 68 | end do ! Loop over max_dom |
|---|
| 69 | |
|---|
| 70 | else if (gridtype == 'E') then |
|---|
| 71 | |
|---|
| 72 | call mprintf(.true.,STDOUT,'Processing coarse domain only for NMM.') |
|---|
| 73 | call mprintf(.true.,LOGFILE,'Processing coarse domain only for NMM.') |
|---|
| 74 | |
|---|
| 75 | call process_domain(1, extra_row, extra_col) |
|---|
| 76 | |
|---|
| 77 | end if |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | ! |
|---|
| 81 | ! Clean up and quit. |
|---|
| 82 | ! |
|---|
| 83 | |
|---|
| 84 | call interp_option_destroy() |
|---|
| 85 | |
|---|
| 86 | call parallel_finish() |
|---|
| 87 | |
|---|
| 88 | call mprintf(.true.,STDOUT,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') |
|---|
| 89 | call mprintf(.true.,STDOUT,'! Successful completion of metgrid. !') |
|---|
| 90 | call mprintf(.true.,STDOUT,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') |
|---|
| 91 | |
|---|
| 92 | call mprintf(.true.,LOGFILE,' *** Successful completion of program metgrid.exe *** ') |
|---|
| 93 | |
|---|
| 94 | stop |
|---|
| 95 | |
|---|
| 96 | end program metgrid |
|---|