Changeset 709 for palm/trunk/SOURCE/surface_coupler.f90
- Timestamp:
- Mar 30, 2011 9:31:40 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/surface_coupler.f90
r668 r709 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! formatting adjustments 6 7 ! 7 8 ! Former revisions: … … 10 11 ! 11 12 ! 667 2010-12-23 12:06:00Z suehring/gryschka 12 ! additional case for nonequivalent processor and grid topopolgy in ocean and13 ! atmosphere added (coupling_topology = 1) 13 ! Additional case for nonequivalent processor and grid topopolgy in ocean and 14 ! atmosphere added (coupling_topology = 1). 14 15 ! Added exchange of u and v from Ocean to Atmosphere 15 16 ! … … 60 61 61 62 IF ( coupling_topology == 0 ) THEN 62 CALL MPI_SENDRECV( terminate_coupled, 1, MPI_INTEGER, target_id, 63 0, 64 terminate_coupled_remote, 1, MPI_INTEGER, target_id, 63 CALL MPI_SENDRECV( terminate_coupled, 1, MPI_INTEGER, target_id, & 64 0, & 65 terminate_coupled_remote, 1, MPI_INTEGER, target_id, & 65 66 0, comm_inter, status, ierr ) 66 67 ELSE … … 72 73 comm_inter, status, ierr ) 73 74 ENDIF 74 CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d, ierr) 75 CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d, & 76 ierr ) 75 77 76 78 ALLOCATE( total_2d_a(-nbgp:ny_a+nbgp,-nbgp:nx_a+nbgp), & … … 97 99 !-- Exchange the current simulated time between the models, 98 100 !-- currently just for total_2ding 99 IF ( coupling_topology == 0 ) THEN 100 CALL MPI_SEND( time_since_reference_point, 1, MPI_REAL, & 101 target_id, 11, comm_inter, ierr ) 102 CALL MPI_RECV( time_since_reference_point_rem, 1, MPI_REAL, & 103 target_id, 11, comm_inter, status, ierr ) 101 IF ( coupling_topology == 0 ) THEN 102 103 CALL MPI_SEND( time_since_reference_point, 1, MPI_REAL, target_id, 11, & 104 comm_inter, ierr ) 105 CALL MPI_RECV( time_since_reference_point_rem, 1, MPI_REAL, target_id, & 106 11, comm_inter, status, ierr ) 104 107 ELSE 108 105 109 IF ( myid == 0 ) THEN 106 CALL MPI_SEND( time_since_reference_point, 1, MPI_REAL, & 107 target_id, 11, comm_inter, ierr ) 108 CALL MPI_RECV( time_since_reference_point_rem, 1, MPI_REAL, & 110 111 CALL MPI_SEND( time_since_reference_point, 1, MPI_REAL, target_id, & 112 11, comm_inter, ierr ) 113 CALL MPI_RECV( time_since_reference_point_rem, 1, MPI_REAL, & 109 114 target_id, 11, comm_inter, status, ierr ) 115 110 116 ENDIF 111 CALL MPI_BCAST( time_since_reference_point_rem, 1, MPI_REAL, & 112 0, comm2d, ierr ) 113 ENDIF 114 WRITE ( 9, * ) 'simulated time: ', simulated_time 115 WRITE ( 9, * ) 'time since start of coupling: ', & 116 time_since_reference_point, ' remote: ', & 117 time_since_reference_point_rem 118 CALL local_flush( 9 ) 119 117 118 CALL MPI_BCAST( time_since_reference_point_rem, 1, MPI_REAL, 0, comm2d, & 119 ierr ) 120 121 ENDIF 120 122 121 123 ! … … 124 126 125 127 ! 126 !-- Horizontal grid size and number of processors is equal 127 !-- in ocean and atmosphere 128 IF ( coupling_topology == 0 ) THEN 129 130 ! 131 !-- Send heat flux at bottom surface to the ocean model 132 CALL MPI_SEND( shf(nysg,nxlg), ngp_xy, MPI_REAL, & 133 target_id, 12, comm_inter, ierr ) 134 135 ! 136 !-- Send humidity flux at bottom surface to the ocean model 128 !-- Horizontal grid size and number of processors is equal in ocean and 129 !-- atmosphere 130 IF ( coupling_topology == 0 ) THEN 131 132 ! 133 !-- Send heat flux at bottom surface to the ocean 134 CALL MPI_SEND( shf(nysg,nxlg), ngp_xy, MPI_REAL, target_id, 12, & 135 comm_inter, ierr ) 136 ! 137 !-- Send humidity flux at bottom surface to the ocean 137 138 IF ( humidity ) THEN 138 CALL MPI_SEND( qsws(nysg,nxlg), ngp_xy, MPI_REAL, & 139 target_id, 13, comm_inter, ierr ) 140 ENDIF 141 142 ! 143 !-- Receive temperature at the bottom surface from the ocean model 144 WRITE ( 9, * ) '*** receive pt from ocean' 145 CALL local_flush( 9 ) 146 CALL MPI_RECV( pt(0,nysg,nxlg), 1, type_xy, & 147 target_id, 14, comm_inter, status, ierr ) 148 149 ! 150 !-- Send the momentum flux (u) at bottom surface to the ocean model 151 CALL MPI_SEND( usws(nysg,nxlg), ngp_xy, MPI_REAL, & 152 target_id, 15, comm_inter, ierr ) 153 154 ! 155 !-- Send the momentum flux (v) at bottom surface to the ocean model 156 CALL MPI_SEND( vsws(nysg,nxlg), ngp_xy, MPI_REAL, & 157 target_id, 16, comm_inter, ierr ) 158 159 ! 160 !-- Receive u at the bottom surface from the ocean model 161 CALL MPI_RECV( u(0,nysg,nxlg), 1, type_xy, & 162 target_id, 17, comm_inter, status, ierr ) 163 164 ! 165 !-- Receive v at the bottom surface from the ocean model 166 CALL MPI_RECV( v(0,nysg,nxlg), 1, type_xy, & 167 target_id, 18, comm_inter, status, ierr ) 168 139 CALL MPI_SEND( qsws(nysg,nxlg), ngp_xy, MPI_REAL, target_id, 13, & 140 comm_inter, ierr ) 141 ENDIF 142 ! 143 !-- Receive temperature at the bottom surface from the ocean 144 CALL MPI_RECV( pt(0,nysg,nxlg), 1, type_xy, target_id, 14, & 145 comm_inter, status, ierr ) 146 ! 147 !-- Send the momentum flux (u) at bottom surface to the ocean 148 CALL MPI_SEND( usws(nysg,nxlg), ngp_xy, MPI_REAL, target_id, 15, & 149 comm_inter, ierr ) 150 ! 151 !-- Send the momentum flux (v) at bottom surface to the ocean 152 CALL MPI_SEND( vsws(nysg,nxlg), ngp_xy, MPI_REAL, target_id, 16, & 153 comm_inter, ierr ) 154 ! 155 !-- Receive u at the bottom surface from the ocean 156 CALL MPI_RECV( u(0,nysg,nxlg), 1, type_xy, target_id, 17, & 157 comm_inter, status, ierr ) 158 ! 159 !-- Receive v at the bottom surface from the ocean 160 CALL MPI_RECV( v(0,nysg,nxlg), 1, type_xy, target_id, 18, & 161 comm_inter, status, ierr ) 169 162 ! 170 163 !-- Horizontal grid size or number of processors differs between … … 173 166 174 167 ! 175 !-- Send heat flux at bottom surface to the ocean model168 !-- Send heat flux at bottom surface to the ocean 176 169 total_2d_a = 0.0 177 total_2d = 0.0170 total_2d = 0.0 178 171 total_2d(nys:nyn,nxl:nxr) = shf(nys:nyn,nxl:nxr) 179 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, & 180 MPI_SUM, 0, comm2d, ierr )181 CALL interpolate_to_ocean(12)182 183 ! 184 !-- Send humidity flux at bottom surface to the ocean model185 IF ( humidity ) THEN172 173 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0, & 174 comm2d, ierr ) 175 CALL interpolate_to_ocean( 12 ) 176 ! 177 !-- Send humidity flux at bottom surface to the ocean 178 IF ( humidity ) THEN 186 179 total_2d_a = 0.0 187 total_2d = 0.0180 total_2d = 0.0 188 181 total_2d(nys:nyn,nxl:nxr) = qsws(nys:nyn,nxl:nxr) 189 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, & 190 MPI_SUM, 0, comm2d, ierr )191 CALL interpolate_to_ocean(13)192 ENDIF193 194 ! 195 !-- Receive temperature at the bottom surface from the ocean model196 IF ( myid == 0 ) THEN182 183 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, & 184 0, comm2d, ierr ) 185 CALL interpolate_to_ocean( 13 ) 186 ENDIF 187 ! 188 !-- Receive temperature at the bottom surface from the ocean 189 IF ( myid == 0 ) THEN 197 190 CALL MPI_RECV( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, & 198 191 target_id, 14, comm_inter, status, ierr ) 199 192 ENDIF 200 193 CALL MPI_BARRIER( comm2d, ierr ) 201 CALL MPI_BCAST( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, &202 0, comm2d,ierr )194 CALL MPI_BCAST( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, 0, comm2d, & 195 ierr ) 203 196 pt(0,nysg:nyng,nxlg:nxrg) = total_2d_a(nysg:nyng,nxlg:nxrg) 204 205 ! 206 !-- Send momentum flux (u) at bottom surface to the ocean model 197 ! 198 !-- Send momentum flux (u) at bottom surface to the ocean 207 199 total_2d_a = 0.0 208 total_2d = 0.0200 total_2d = 0.0 209 201 total_2d(nys:nyn,nxl:nxr) = usws(nys:nyn,nxl:nxr) 210 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, & 211 MPI_SUM, 0, comm2d, ierr ) 212 CALL interpolate_to_ocean(15) 213 214 ! 215 !-- Send momentum flux (v) at bottom surface to the ocean model 202 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0, & 203 comm2d, ierr ) 204 CALL interpolate_to_ocean( 15 ) 205 ! 206 !-- Send momentum flux (v) at bottom surface to the ocean 216 207 total_2d_a = 0.0 217 total_2d = 0.0208 total_2d = 0.0 218 209 total_2d(nys:nyn,nxl:nxr) = vsws(nys:nyn,nxl:nxr) 219 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, & 220 MPI_SUM, 0, comm2d, ierr ) 221 CALL interpolate_to_ocean(16) 222 223 ! 224 !-- Receive u at the bottom surface from the ocean model 225 IF ( myid == 0 ) THEN 210 CALL MPI_REDUCE( total_2d, total_2d_a, ngp_a, MPI_REAL, MPI_SUM, 0, & 211 comm2d, ierr ) 212 CALL interpolate_to_ocean( 16 ) 213 ! 214 !-- Receive u at the bottom surface from the ocean 215 IF ( myid == 0 ) THEN 226 216 CALL MPI_RECV( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, & 227 target_id, 17, comm_inter, status, ierr ) 217 target_id, 17, comm_inter, status, ierr ) 228 218 ENDIF 229 219 CALL MPI_BARRIER( comm2d, ierr ) 230 CALL MPI_BCAST( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, &231 0, comm2d,ierr )220 CALL MPI_BCAST( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, 0, comm2d, & 221 ierr ) 232 222 u(0,nysg:nyng,nxlg:nxrg) = total_2d_a(nysg:nyng,nxlg:nxrg) 233 234 ! 235 !-- Receive v at the bottom surface from the ocean model 236 IF ( myid == 0 ) THEN 223 ! 224 !-- Receive v at the bottom surface from the ocean 225 IF ( myid == 0 ) THEN 237 226 CALL MPI_RECV( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, & 238 target_id, 18, comm_inter, status, ierr ) 227 target_id, 18, comm_inter, status, ierr ) 239 228 ENDIF 240 229 CALL MPI_BARRIER( comm2d, ierr ) 241 CALL MPI_BCAST( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, &242 0, comm2d,ierr )230 CALL MPI_BCAST( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, 0, comm2d, & 231 ierr ) 243 232 v(0,nysg:nyng,nxlg:nxrg) = total_2d_a(nysg:nyng,nxlg:nxrg) 244 233 … … 252 241 IF ( coupling_topology == 0 ) THEN 253 242 ! 254 !-- Receive heat flux at the sea surface (top) from the atmosphere model 255 CALL MPI_RECV( tswst(nysg,nxlg), ngp_xy, MPI_REAL, & 256 target_id, 12, comm_inter, status, ierr ) 257 258 259 ! 260 !-- Receive humidity flux from the atmosphere model (bottom) 243 !-- Receive heat flux at the sea surface (top) from the atmosphere 244 CALL MPI_RECV( tswst(nysg,nxlg), ngp_xy, MPI_REAL, target_id, 12, & 245 comm_inter, status, ierr ) 246 ! 247 !-- Receive humidity flux from the atmosphere (bottom) 261 248 !-- and add it to the heat flux at the sea surface (top)... 262 249 IF ( humidity_remote ) THEN 263 250 CALL MPI_RECV( qswst_remote(nysg,nxlg), ngp_xy, MPI_REAL, & 264 251 target_id, 13, comm_inter, status, ierr ) 265 266 ENDIF 267 252 ENDIF 268 253 ! 269 254 !-- Send sea surface temperature to the atmosphere model 270 CALL MPI_SEND( pt(nzt,nysg,nxlg), 1, type_xy, & 271 target_id, 14, comm_inter, ierr ) 272 255 CALL MPI_SEND( pt(nzt,nysg,nxlg), 1, type_xy, target_id, 14, & 256 comm_inter, ierr ) 273 257 ! 274 258 !-- Receive momentum flux (u) at the sea surface (top) from the atmosphere 275 !-- model 276 WRITE ( 9, * ) '*** receive uswst from atmosphere' 277 CALL local_flush( 9 ) 278 CALL MPI_RECV( uswst(nysg,nxlg), ngp_xy, MPI_REAL, & 279 target_id, 15, comm_inter, status, ierr ) 280 259 CALL MPI_RECV( uswst(nysg,nxlg), ngp_xy, MPI_REAL, target_id, 15, & 260 comm_inter, status, ierr ) 281 261 ! 282 262 !-- Receive momentum flux (v) at the sea surface (top) from the atmosphere 283 !-- model 284 CALL MPI_RECV( vswst(nysg,nxlg), ngp_xy, MPI_REAL, & 285 target_id, 16, comm_inter, status, ierr ) 286 287 !-- Send u to the atmosphere model 288 CALL MPI_SEND( u(nzt,nysg,nxlg), 1, type_xy, & 289 target_id, 17, comm_inter, ierr ) 290 291 ! 292 !-- Send v to the atmosphere model 293 CALL MPI_SEND( v(nzt,nysg,nxlg), 1, type_xy, & 294 target_id, 18, comm_inter, ierr ) 295 263 CALL MPI_RECV( vswst(nysg,nxlg), ngp_xy, MPI_REAL, target_id, 16, & 264 comm_inter, status, ierr ) 265 ! 266 !-- Send u to the atmosphere 267 CALL MPI_SEND( u(nzt,nysg,nxlg), 1, type_xy, target_id, 17, & 268 comm_inter, ierr ) 269 ! 270 !-- Send v to the atmosphere 271 CALL MPI_SEND( v(nzt,nysg,nxlg), 1, type_xy, target_id, 18, & 272 comm_inter, ierr ) 296 273 ! 297 274 !-- Horizontal gridsize or number of processors differs between 298 275 !-- ocean and atmosphere 299 276 ELSE 300 301 ! 302 !-- Receive heat flux at the sea surface (top) from the atmosphere model 303 IF ( myid == 0 ) THEN 277 ! 278 !-- Receive heat flux at the sea surface (top) from the atmosphere 279 IF ( myid == 0 ) THEN 304 280 CALL MPI_RECV( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 305 target_id, 12, comm_inter, status, ierr ) 281 target_id, 12, comm_inter, status, ierr ) 282 ENDIF 283 CALL MPI_BARRIER( comm2d, ierr ) 284 CALL MPI_BCAST( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, 0, comm2d, & 285 ierr ) 286 tswst(nysg:nyng,nxlg:nxrg) = total_2d_o(nysg:nyng,nxlg:nxrg) 287 ! 288 !-- Receive humidity flux at the sea surface (top) from the atmosphere 289 IF ( humidity_remote ) THEN 290 IF ( myid == 0 ) THEN 291 CALL MPI_RECV( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 292 target_id, 13, comm_inter, status, ierr ) 293 ENDIF 294 CALL MPI_BARRIER( comm2d, ierr ) 295 CALL MPI_BCAST( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, 0, & 296 comm2d, ierr) 297 qswst_remote(nysg:nyng,nxlg:nxrg) = total_2d_o(nysg:nyng,nxlg:nxrg) 298 ENDIF 299 ! 300 !-- Send surface temperature to atmosphere 301 total_2d_o = 0.0 302 total_2d = 0.0 303 total_2d(nys:nyn,nxl:nxr) = pt(nzt,nys:nyn,nxl:nxr) 304 305 CALL MPI_REDUCE( total_2d, total_2d_o, ngp_o, MPI_REAL, MPI_SUM, 0, & 306 comm2d, ierr) 307 CALL interpolate_to_atmos( 14 ) 308 ! 309 !-- Receive momentum flux (u) at the sea surface (top) from the atmosphere 310 IF ( myid == 0 ) THEN 311 CALL MPI_RECV( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 312 target_id, 15, comm_inter, status, ierr ) 306 313 ENDIF 307 314 CALL MPI_BARRIER( comm2d, ierr ) 308 315 CALL MPI_BCAST( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 309 0, comm2d, ierr) 310 tswst(nysg:nyng,nxlg:nxrg) = total_2d_o(nysg:nyng,nxlg:nxrg) 311 312 ! 313 !-- Receive humidity flux at the sea surface (top) from the 314 !-- atmosphere model 315 IF ( humidity_remote ) THEN 316 IF ( myid == 0 ) THEN 317 CALL MPI_RECV( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 318 target_id, 13, comm_inter, status, ierr ) 319 ENDIF 320 CALL MPI_BARRIER( comm2d, ierr ) 321 CALL MPI_BCAST( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 322 0, comm2d, ierr) 323 qswst_remote(nysg:nyng,nxlg:nxrg) = total_2d_o(nysg:nyng,nxlg:nxrg) 324 ENDIF 325 326 ! 327 !-- Send surface temperature to atmosphere 328 total_2d_o = 0.0 329 total_2d = 0.0 330 total_2d(nys:nyn,nxl:nxr) = pt(nzt,nys:nyn,nxl:nxr) 331 332 CALL MPI_REDUCE(total_2d, total_2d_o, ngp_o, & 333 MPI_REAL, MPI_SUM, 0, comm2d, ierr) 334 335 CALL interpolate_to_atmos(14) 336 337 ! 338 !-- Receive momentum flux (u) at the sea surface (top) from the 339 !-- atmosphere model 340 IF ( myid == 0 ) THEN 316 0, comm2d, ierr ) 317 uswst(nysg:nyng,nxlg:nxrg) = total_2d_o(nysg:nyng,nxlg:nxrg) 318 ! 319 !-- Receive momentum flux (v) at the sea surface (top) from the atmosphere 320 IF ( myid == 0 ) THEN 341 321 CALL MPI_RECV( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 342 target_id, 1 5, comm_inter, status, ierr )322 target_id, 16, comm_inter, status, ierr ) 343 323 ENDIF 344 324 CALL MPI_BARRIER( comm2d, ierr ) 345 CALL MPI_BCAST( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 346 0, comm2d, ierr) 347 uswst(nysg:nyng,nxlg:nxrg) = total_2d_o(nysg:nyng,nxlg:nxrg) 348 349 ! 350 !-- Receive momentum flux (v) at the sea surface (top) from the 351 !-- atmosphere model 352 IF ( myid == 0 ) THEN 353 CALL MPI_RECV( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 354 target_id, 16, comm_inter, status, ierr ) 355 ENDIF 356 CALL MPI_BARRIER( comm2d, ierr ) 357 CALL MPI_BCAST( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, & 358 0, comm2d, ierr) 325 CALL MPI_BCAST( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, 0, comm2d, & 326 ierr ) 359 327 vswst(nysg:nyng,nxlg:nxrg) = total_2d_o(nysg:nyng,nxlg:nxrg) 360 361 328 ! 362 329 !-- Send u to atmosphere 363 330 total_2d_o = 0.0 364 total_2d = 0.0331 total_2d = 0.0 365 332 total_2d(nys:nyn,nxl:nxr) = u(nzt,nys:nyn,nxl:nxr) 366 CALL MPI_REDUCE(total_2d, total_2d_o, ngp_o, MPI_REAL, & 367 MPI_SUM, 0, comm2d, ierr) 368 CALL interpolate_to_atmos(17) 369 333 CALL MPI_REDUCE( total_2d, total_2d_o, ngp_o, MPI_REAL, MPI_SUM, 0, & 334 comm2d, ierr ) 335 CALL interpolate_to_atmos( 17 ) 370 336 ! 371 337 !-- Send v to atmosphere 372 338 total_2d_o = 0.0 373 total_2d = 0.0339 total_2d = 0.0 374 340 total_2d(nys:nyn,nxl:nxr) = v(nzt,nys:nyn,nxl:nxr) 375 CALL MPI_REDUCE( total_2d, total_2d_o, ngp_o, MPI_REAL, &376 MPI_SUM, 0, comm2d, ierr)377 CALL interpolate_to_atmos( 18)341 CALL MPI_REDUCE( total_2d, total_2d_o, ngp_o, MPI_REAL, MPI_SUM, 0, & 342 comm2d, ierr ) 343 CALL interpolate_to_atmos( 18 ) 378 344 379 345 ENDIF … … 382 348 !-- Conversions of fluxes received from atmosphere 383 349 IF ( humidity_remote ) THEN 384 !here tswst is still the sum of atmospheric bottom heat fluxes 385 tswst = tswst + qswst_remote * 2.2626108e6 / 1005.0 386 !*latent heat of vaporization in m2/s2, or 540 cal/g, or 40.65 kJ/mol 387 !/(rho_atm(=1.0)*c_p) 350 ! 351 !-- Here tswst is still the sum of atmospheric bottom heat fluxes, 352 !-- * latent heat of vaporization in m2/s2, or 540 cal/g, or 40.65 kJ/mol 353 !-- /(rho_atm(=1.0)*c_p) 354 tswst = tswst + qswst_remote * 2.2626108E6 / 1005.0 388 355 ! 389 356 !-- ...and convert it to a salinity flux at the sea surface (top) … … 405 372 vswst = vswst / rho(nzt,:,:) 406 373 407 408 ENDIF 409 410 IF ( coupling_topology == 1 ) THEN 374 ENDIF 375 376 IF ( coupling_topology == 1 ) THEN 411 377 DEALLOCATE( total_2d_o, total_2d_a ) 412 378 ENDIF … … 420 386 421 387 422 SUBROUTINE interpolate_to_atmos( tag)388 SUBROUTINE interpolate_to_atmos( tag ) 423 389 424 390 USE arrays_3d … … 430 396 IMPLICIT NONE 431 397 432 433 398 INTEGER :: dnx, dnx2, dny, dny2, i, ii, j, jj 434 399 INTEGER, intent(in) :: tag … … 436 401 CALL MPI_BARRIER( comm2d, ierr ) 437 402 438 IF ( myid == 0 ) THEN 439 440 ! 441 !-- cyclic boundary conditions for the total 2D-grid 403 IF ( myid == 0 ) THEN 404 ! 405 !-- Cyclic boundary conditions for the total 2D-grid 442 406 total_2d_o(-nbgp:-1,:) = total_2d_o(ny+1-nbgp:ny,:) 443 407 total_2d_o(:,-nbgp:-1) = total_2d_o(:,nx+1-nbgp:nx) … … 452 416 453 417 ! 454 !-- Distance for interpolation around coarse grid points within the fine grid455 !-- (note: 2*dnx2 must not be equal with dnx)418 !-- Distance for interpolation around coarse grid points within the fine 419 !-- grid (note: 2*dnx2 must not be equal with dnx) 456 420 dnx2 = 2 * ( dnx / 2 ) 457 421 dny2 = 2 * ( dny / 2 ) … … 472 436 ENDDO 473 437 ! 474 !-- cyclic boundary conditions for atmosphere grid438 !-- Cyclic boundary conditions for atmosphere grid 475 439 total_2d_a(-nbgp:-1,:) = total_2d_a(ny_a+1-nbgp:ny_a,:) 476 440 total_2d_a(:,-nbgp:-1) = total_2d_a(:,nx_a+1-nbgp:nx_a) … … 480 444 ! 481 445 !-- Transfer of the atmosphere-grid-layer to the atmosphere 482 CALL MPI_SEND( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, &483 ta rget_id, tag, comm_inter, ierr )446 CALL MPI_SEND( total_2d_a(-nbgp,-nbgp), ngp_a, MPI_REAL, target_id, & 447 tag, comm_inter, ierr ) 484 448 485 449 ENDIF … … 490 454 491 455 492 SUBROUTINE interpolate_to_ocean( tag)456 SUBROUTINE interpolate_to_ocean( tag ) 493 457 494 458 USE arrays_3d … … 500 464 IMPLICIT NONE 501 465 502 REAL :: fl, fr, myl, myr503 466 INTEGER :: dnx, dny, i, ii, j, jj 504 467 INTEGER, intent(in) :: tag 468 REAL :: fl, fr, myl, myr 469 505 470 506 471 CALL MPI_BARRIER( comm2d, ierr ) 507 472 508 IF ( myid == 0 ) THEN509 510 ! 511 ! 473 IF ( myid == 0 ) THEN 474 475 ! 476 !-- Number of gridpoints of the fine grid within one mesh of the coarse grid 512 477 dnx = ( nx_o + 1 ) / ( nx_a + 1 ) 513 478 dny = ( ny_o + 1 ) / ( ny_a + 1 ) 514 479 515 480 ! 516 !-- cyclic boundary conditions for atmosphere grid481 !-- Cyclic boundary conditions for atmosphere grid 517 482 total_2d_a(-nbgp:-1,:) = total_2d_a(ny+1-nbgp:ny,:) 518 483 total_2d_a(:,-nbgp:-1) = total_2d_a(:,nx+1-nbgp:nx) … … 521 486 total_2d_a(:,nx+1:nx+nbgp) = total_2d_a(:,0:nbgp-1) 522 487 ! 523 !-- Bilinear Interpolation from atmosphere -grid-layer to ocean-grid-layer488 !-- Bilinear Interpolation from atmosphere grid-layer to ocean grid-layer 524 489 DO j = 0, ny 525 490 DO i = 0, nx … … 527 492 myr = ( total_2d_a(j+1,i+1) - total_2d_a(j,i+1) ) / dny 528 493 DO jj = 0, dny-1 529 fl = myl*jj 530 fr = myr*jj 494 fl = myl*jj + total_2d_a(j,i) 495 fr = myr*jj + total_2d_a(j,i+1) 531 496 DO ii = 0, dnx-1 532 497 total_2d_o(j*dny+jj,i*dnx+ii) = ( fr - fl ) / dnx * ii + fl … … 536 501 ENDDO 537 502 ! 538 !-- cyclic boundary conditions for ocean grid503 !-- Cyclic boundary conditions for ocean grid 539 504 total_2d_o(-nbgp:-1,:) = total_2d_o(ny_o+1-nbgp:ny_o,:) 540 505 total_2d_o(:,-nbgp:-1) = total_2d_o(:,nx_o+1-nbgp:nx_o) … … 542 507 total_2d_o(ny_o+1:ny_o+nbgp,:) = total_2d_o(0:nbgp-1,:) 543 508 total_2d_o(:,nx_o+1:nx_o+nbgp) = total_2d_o(:,0:nbgp-1) 544 545 509 546 510 CALL MPI_SEND( total_2d_o(-nbgp,-nbgp), ngp_o, MPI_REAL, &
Note: See TracChangeset
for help on using the changeset viewer.