1 | include(dom.inc)
2 |
3 | SUBROUTINE master_control(itask)
4 |
5 | ! ================================================================!
6 | ! !
7 | ! master_control.F : Main control of the MASTER side of the code. !
8 | ! !
9 | ! out : !
10 | ! !
11 | ! author : J. AMAYA (september 2007) !
12 | ! !
13 | ! ================================================================!
14 |
15 | USE mod_pmm
16 | USE mod_prissma
17 |
18 | IMPLICIT NONE
19 |
20 | DOM_INT :: itask
21 |
22 | INCLUDE 'pmm_constants.h'
23 |
24 | IF (itask.eq.MASTER_INIT) THEN
25 |
26 | ! ----------------!
27 | ! Read input files!
28 | ! ----------------!
29 |
30 | CALL read_data
31 | #ifdef USEPALM
32 | CALL read_domcoor
33 | #endif
34 |
35 | ! ------------------------------!
36 | ! Result vectors initialization !
37 | ! ------------------------------!
38 |
39 | IF (ALLOCATED(Gtot)) DEALLOCATE(Gtot)
40 | IF (ALLOCATED(Lbtot)) DEALLOCATE(Lbtot)
41 | IF (ALLOCATED(Htot)) DEALLOCATE(Htot)
42 | IF (ALLOCATED(Srtot)) DEALLOCATE(Srtot)
43 | IF (ALLOCATED(Q_rtot)) DEALLOCATE(Q_rtot)
44 | IF (ALLOCATED(Qw)) DEALLOCATE(Qw)
45 |
46 | ALLOCATE(Gtot(i_dom_nnodes))
47 | ALLOCATE(Lbtot(i_dom_nnodes))
48 | ALLOCATE(Htot(i_dom_nbfaces))
49 | ALLOCATE(Qw(i_dom_nbfaces))
50 | ALLOCATE(Srtot(i_dom_nnodes))
51 | ALLOCATE(Q_rtot(3,i_dom_nnodes))
52 |
53 |
54 | Gtot = 0.
55 | Lbtot = 0.
56 | Htot = 0.
57 | Qw = 0.
58 | Srtot = 0.
59 | Q_rtot(:,:) = 0.
60 |
61 | #ifdef USEPALM
62 | ! -------------------------------------------------------!
63 | ! PALM: send node coordinates and dummy radiative fields !
64 | ! -------------------------------------------------------!
65 |
66 | CALL interf_nodescoor
67 | CALL interf_bfacecoor
68 | CALL interf_sendfields
69 | #endif
70 |
71 | ! -----------------------------------------------!
72 | ! Calculate partitioning in bands and directions !
73 | ! -----------------------------------------------!
74 |
75 | WRITE(*,*) " >> MASTER: Creating partition"
76 | CALL partition
77 |
78 | ! ----------------------!
79 | ! Send arrays to slaves !
80 | ! ----------------------!
81 |
82 | WRITE(*,*) " >> MASTER: Communicating run params to all procs"
83 | CALL sendtoslaves
84 |
85 | ELSEIF (itask.eq.MASTER_OUTPROC) THEN
86 | WRITE(*,*) " >> MASTER: Receiving result vectors"
87 | CALL pmm_returnvectors(i_dom_nfaces, i_dom_nfacesmax, &
88 | & i_dom_nbfaces)
89 | Srtot = Lbtot - Gtot
90 | WRITE(*,*) " >> MASTER: Outprocessing results"
91 | CALL outprocessing
92 |
93 | #ifdef USEPALM
94 | CALL interf_sendfields
95 | Gtot = 0.
96 | Lbtot = 0.
97 | Htot = 0.
98 | Srtot = 0.
99 | Q_rtot = 0.
100 |
101 | ELSEIF (itask.eq.MASTER_COUPLING) THEN
102 |
103 | ! -------------------------------------------------!
104 | ! PALM: Receiving data from slaves to send to palm !
105 | ! -------------------------------------------------!
106 |
107 | WRITE(*,*) " >> MASTER: Preparing result vectors for coupling"
108 | CALL pmm_returnvectors(i_dom_nfaces, i_dom_nfacesmax, &
109 | & i_dom_nbfaces)
110 | Srtot = Lbtot - Gtot
111 | ! CALL outprocessing_coupling
112 | CALL interf_sendfields
113 | Gtot = 0.
114 | Lbtot = 0.
115 | Htot = 0.
116 | Srtot = 0.
117 | Q_rtot = 0.
118 | #endif
119 |
120 | ENDIF
121 |
122 | END SUBROUTINE master_control
master_control.F could be called by: