Changeset 1878 for palm/trunk
- Timestamp:
- Apr 19, 2016 12:30:36 PM (9 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/init_3d_model.f90
r1852 r1878 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! The zeroth element of weight_pres removed as unnecessary 22 22 ! 23 23 ! Former revisions: … … 690 690 !-- is done). Further below the values needed within the timestep scheme 691 691 !-- will be set. 692 !-- TO_DO: zeroth element added to weight_pres because in case of nesting693 !-- pres may need to be called outside the RK-substeps. Antti will694 !-- check if this is really required.695 692 ALLOCATE( weight_substep(1:intermediate_timestep_count_max), & 696 weight_pres( 0:intermediate_timestep_count_max) )693 weight_pres(1:intermediate_timestep_count_max) ) 697 694 weight_substep = 1.0_wp 698 695 weight_pres = 1.0_wp … … 1683 1680 !-- Setting weighting factors for calculation of perturbation pressure 1684 1681 !-- and turbulent quantities from the RK substeps 1685 !-- TO_DO: zeroth element is added to weight_pres because in nesting pres1686 !-- may need to be called outside the RK-substeps1687 weight_pres(0) = 1.0_wp1688 1682 IF ( TRIM(timestep_scheme) == 'runge-kutta-3' ) THEN ! for RK3-method 1689 1683 -
palm/trunk/SOURCE/pmc_interface_mod.f90
r1851 r1878 20 20 ! Current revisions: 21 21 ! ------------------ 22 ! 23 ! 22 ! Synchronization rewritten, logc-array index order changed for cache optimization 23 ! 24 24 ! Former revisions: 25 25 ! ----------------- … … 338 338 END INTERFACE 339 339 340 INTERFACE pmci_ client_synchronize341 MODULE PROCEDURE pmci_ client_synchronize340 INTERFACE pmci_synchronize 341 MODULE PROCEDURE pmci_synchronize 342 342 END INTERFACE 343 343 … … 360 360 INTERFACE pmci_server_initialize 361 361 MODULE PROCEDURE pmci_server_initialize 362 END INTERFACE363 364 INTERFACE pmci_server_synchronize365 MODULE PROCEDURE pmci_server_synchronize366 362 END INTERFACE 367 363 … … 376 372 server_to_client 377 373 PUBLIC pmci_client_initialize 378 PUBLIC pmci_client_synchronize379 374 PUBLIC pmci_datatrans 380 375 PUBLIC pmci_ensure_nest_mass_conservation … … 382 377 PUBLIC pmci_modelconfiguration 383 378 PUBLIC pmci_server_initialize 384 PUBLIC pmci_s erver_synchronize379 PUBLIC pmci_synchronize 385 380 PUBLIC pmci_set_swaplevel 386 381 … … 1253 1248 IF ( nest_bound_l ) THEN 1254 1249 1255 ALLOCATE( logc_u_l( nzb:nzt_topo_nestbc_l,nys:nyn,1:2) )1256 ALLOCATE( logc_v_l( nzb:nzt_topo_nestbc_l,nys:nyn,1:2) )1257 ALLOCATE( logc_ratio_u_l( nzb:nzt_topo_nestbc_l,nys:nyn,1:2,0:ncorr-1) )1258 ALLOCATE( logc_ratio_v_l( nzb:nzt_topo_nestbc_l,nys:nyn,1:2,0:ncorr-1) )1250 ALLOCATE( logc_u_l(1:2,nzb:nzt_topo_nestbc_l,nys:nyn) ) 1251 ALLOCATE( logc_v_l(1:2,nzb:nzt_topo_nestbc_l,nys:nyn) ) 1252 ALLOCATE( logc_ratio_u_l(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_l,nys:nyn) ) 1253 ALLOCATE( logc_ratio_v_l(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_l,nys:nyn) ) 1259 1254 logc_u_l = 0 1260 1255 logc_v_l = 0 … … 1273 1268 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1274 1269 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1275 logc_u_l( k,j,1) = lc1276 logc_ratio_u_l( k,j,1,0:ncorr-1) = lcr(0:ncorr-1)1270 logc_u_l(1,k,j) = lc 1271 logc_ratio_u_l(1,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1277 1272 lcr(0:ncorr-1) = 1.0_wp 1278 1273 ! … … 1284 1279 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1285 1280 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1286 logc_v_l( k,j,1) = lc1287 logc_ratio_v_l( k,j,1,0:ncorr-1) = lcr(0:ncorr-1)1281 logc_v_l(1,k,j) = lc 1282 logc_ratio_v_l(1,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1288 1283 lcr(0:ncorr-1) = 1.0_wp 1289 1284 … … 1296 1291 IF ( nest_bound_r ) THEN 1297 1292 1298 ALLOCATE( logc_u_r( nzb:nzt_topo_nestbc_r,nys:nyn,1:2) )1299 ALLOCATE( logc_v_r( nzb:nzt_topo_nestbc_r,nys:nyn,1:2) )1300 ALLOCATE( logc_ratio_u_r( nzb:nzt_topo_nestbc_r,nys:nyn,1:2,0:ncorr-1) )1301 ALLOCATE( logc_ratio_v_r( nzb:nzt_topo_nestbc_r,nys:nyn,1:2,0:ncorr-1) )1293 ALLOCATE( logc_u_r(1:2,nzb:nzt_topo_nestbc_r,nys:nyn) ) 1294 ALLOCATE( logc_v_r(1:2,nzb:nzt_topo_nestbc_r,nys:nyn) ) 1295 ALLOCATE( logc_ratio_u_r(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_r,nys:nyn) ) 1296 ALLOCATE( logc_ratio_v_r(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_r,nys:nyn) ) 1302 1297 logc_u_r = 0 1303 1298 logc_v_r = 0 … … 1315 1310 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1316 1311 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1317 logc_u_r( k,j,1) = lc1318 logc_ratio_u_r( k,j,1,0:ncorr-1) = lcr(0:ncorr-1)1312 logc_u_r(1,k,j) = lc 1313 logc_ratio_u_r(1,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1319 1314 lcr(0:ncorr-1) = 1.0_wp 1320 1315 ! … … 1326 1321 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1327 1322 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1328 logc_v_r( k,j,1) = lc1329 logc_ratio_v_r( k,j,1,0:ncorr-1) = lcr(0:ncorr-1)1323 logc_v_r(1,k,j) = lc 1324 logc_ratio_v_r(1,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1330 1325 lcr(0:ncorr-1) = 1.0_wp 1331 1326 … … 1338 1333 IF ( nest_bound_s ) THEN 1339 1334 1340 ALLOCATE( logc_u_s( nzb:nzt_topo_nestbc_s,nxl:nxr,1:2) )1341 ALLOCATE( logc_v_s( nzb:nzt_topo_nestbc_s,nxl:nxr,1:2) )1342 ALLOCATE( logc_ratio_u_s( nzb:nzt_topo_nestbc_s,nxl:nxr,1:2,0:ncorr-1) )1343 ALLOCATE( logc_ratio_v_s( nzb:nzt_topo_nestbc_s,nxl:nxr,1:2,0:ncorr-1) )1335 ALLOCATE( logc_u_s(1:2,nzb:nzt_topo_nestbc_s,nxl:nxr) ) 1336 ALLOCATE( logc_v_s(1:2,nzb:nzt_topo_nestbc_s,nxl:nxr) ) 1337 ALLOCATE( logc_ratio_u_s(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_s,nxl:nxr) ) 1338 ALLOCATE( logc_ratio_v_s(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_s,nxl:nxr) ) 1344 1339 logc_u_s = 0 1345 1340 logc_v_s = 0 … … 1358 1353 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1359 1354 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1360 logc_u_s( k,i,1) = lc1361 logc_ratio_u_s( k,i,1,0:ncorr-1) = lcr(0:ncorr-1)1355 logc_u_s(1,k,i) = lc 1356 logc_ratio_u_s(1,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1362 1357 lcr(0:ncorr-1) = 1.0_wp 1363 1358 ! … … 1369 1364 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1370 1365 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1371 logc_v_s( k,i,1) = lc1372 logc_ratio_v_s( k,i,1,0:ncorr-1) = lcr(0:ncorr-1)1366 logc_v_s(1,k,i) = lc 1367 logc_ratio_v_s(1,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1373 1368 lcr(0:ncorr-1) = 1.0_wp 1374 1369 … … 1381 1376 IF ( nest_bound_n ) THEN 1382 1377 1383 ALLOCATE( logc_u_n( nzb:nzt_topo_nestbc_n,nxl:nxr,1:2) )1384 ALLOCATE( logc_v_n( nzb:nzt_topo_nestbc_n,nxl:nxr,1:2) )1385 ALLOCATE( logc_ratio_u_n( nzb:nzt_topo_nestbc_n,nxl:nxr,1:2,0:ncorr-1) )1386 ALLOCATE( logc_ratio_v_n( nzb:nzt_topo_nestbc_n,nxl:nxr,1:2,0:ncorr-1) )1378 ALLOCATE( logc_u_n(1:2,nzb:nzt_topo_nestbc_n,nxl:nxr) ) 1379 ALLOCATE( logc_v_n(1:2,nzb:nzt_topo_nestbc_n,nxl:nxr) ) 1380 ALLOCATE( logc_ratio_u_n(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_n,nxl:nxr) ) 1381 ALLOCATE( logc_ratio_v_n(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_n,nxl:nxr) ) 1387 1382 logc_u_n = 0 1388 1383 logc_v_n = 0 … … 1401 1396 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1402 1397 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1403 logc_u_n( k,i,1) = lc1404 logc_ratio_u_n( k,i,1,0:ncorr-1) = lcr(0:ncorr-1)1398 logc_u_n(1,k,i) = lc 1399 logc_ratio_u_n(1,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1405 1400 lcr(0:ncorr-1) = 1.0_wp 1406 1401 ! … … 1412 1407 CALL pmci_define_loglaw_correction_parameters( lc, lcr, k, j, & 1413 1408 inc, wall_index, z0(j,i), kb, direction, ncorr ) 1414 logc_v_n( k,i,1) = lc1415 logc_ratio_v_n( k,i,1,0:ncorr-1) = lcr(0:ncorr-1)1409 logc_v_n(1,k,i) = lc 1410 logc_ratio_v_n(1,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1416 1411 lcr(0:ncorr-1) = 1.0_wp 1417 1412 … … 1429 1424 IF ( nest_bound_l ) THEN 1430 1425 1431 ALLOCATE( logc_w_l(nzb:nzt_topo_nestbc_l,nys:nyn,1:2) ) 1432 ALLOCATE( logc_ratio_w_l(nzb:nzt_topo_nestbc_l,nys:nyn,1:2, & 1433 0:ncorr-1) ) 1426 ALLOCATE( logc_w_l(1:2,nzb:nzt_topo_nestbc_l,nys:nyn) ) 1427 ALLOCATE( logc_ratio_w_l(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_l, & 1428 nys:nyn) ) 1429 1434 1430 logc_w_l = 0 1435 1431 logc_ratio_w_l = 1.0_wp … … 1450 1446 !-- The direction of the wall-normal index is stored as the 1451 1447 !-- sign of the logc-element. 1452 logc_u_l( k,j,2) = inc * lc1453 logc_ratio_u_l( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1448 logc_u_l(2,k,j) = inc * lc 1449 logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1454 1450 lcr(0:ncorr-1) = 1.0_wp 1455 1451 ENDIF … … 1467 1463 !-- The direction of the wall-normal index is stored as the 1468 1464 !-- sign of the logc-element. 1469 logc_u_l( k,j,2) = inc * lc1470 logc_ratio_u_l( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1465 logc_u_l(2,k,j) = inc * lc 1466 logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1471 1467 lcr(0:ncorr-1) = 1.0_wp 1472 1468 ENDIF … … 1484 1480 !-- The direction of the wall-normal index is stored as the 1485 1481 !-- sign of the logc-element. 1486 logc_w_l( k,j,2) = inc * lc1487 logc_ratio_w_l( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1482 logc_w_l(2,k,j) = inc * lc 1483 logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1488 1484 lcr(0:ncorr-1) = 1.0_wp 1489 1485 ENDIF … … 1501 1497 !-- The direction of the wall-normal index is stored as the 1502 1498 !-- sign of the logc-element. 1503 logc_w_l( k,j,2) = inc * lc1504 logc_ratio_w_l( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1499 logc_w_l(2,k,j) = inc * lc 1500 logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1505 1501 lcr(0:ncorr-1) = 1.0_wp 1506 1502 ENDIF … … 1515 1511 IF ( nest_bound_r ) THEN 1516 1512 1517 ALLOCATE( logc_w_r( nzb:nzt_topo_nestbc_r,nys:nyn,1:2) )1518 ALLOCATE( logc_ratio_w_r( nzb:nzt_topo_nestbc_r,nys:nyn,1:2,&1519 0:ncorr-1) )1513 ALLOCATE( logc_w_r(1:2,nzb:nzt_topo_nestbc_r,nys:nyn) ) 1514 ALLOCATE( logc_ratio_w_r(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_r, & 1515 nys:nyn) ) 1520 1516 logc_w_r = 0 1521 1517 logc_ratio_w_r = 1.0_wp … … 1536 1532 !-- The direction of the wall-normal index is stored as the 1537 1533 !-- sign of the logc-element. 1538 logc_u_r( k,j,2) = inc * lc1539 logc_ratio_u_r( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1534 logc_u_r(2,k,j) = inc * lc 1535 logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1540 1536 lcr(0:ncorr-1) = 1.0_wp 1541 1537 ENDIF … … 1552 1548 !-- The direction of the wall-normal index is stored as the 1553 1549 !-- sign of the logc-element. 1554 logc_u_r( k,j,2) = inc * lc1555 logc_ratio_u_r( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1550 logc_u_r(2,k,j) = inc * lc 1551 logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1556 1552 lcr(0:ncorr-1) = 1.0_wp 1557 1553 ENDIF … … 1568 1564 !-- The direction of the wall-normal index is stored as the 1569 1565 !-- sign of the logc-element. 1570 logc_w_r( k,j,2) = inc * lc1571 logc_ratio_w_r( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1566 logc_w_r(2,k,j) = inc * lc 1567 logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1572 1568 lcr(0:ncorr-1) = 1.0_wp 1573 1569 ENDIF … … 1585 1581 !-- The direction of the wall-normal index is stored as the 1586 1582 !-- sign of the logc-element. 1587 logc_w_r( k,j,2) = inc * lc1588 logc_ratio_w_r( k,j,2,0:ncorr-1) = lcr(0:ncorr-1)1583 logc_w_r(2,k,j) = inc * lc 1584 logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1) 1589 1585 lcr(0:ncorr-1) = 1.0_wp 1590 1586 ENDIF … … 1599 1595 IF ( nest_bound_s ) THEN 1600 1596 1601 ALLOCATE( logc_w_s( nzb:nzt_topo_nestbc_s, nxl:nxr, 1:2) )1602 ALLOCATE( logc_ratio_w_s( nzb:nzt_topo_nestbc_s,nxl:nxr,1:2,&1603 0:ncorr-1) )1597 ALLOCATE( logc_w_s(1:2,nzb:nzt_topo_nestbc_s,nxl:nxr) ) 1598 ALLOCATE( logc_ratio_w_s(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_s, & 1599 nxl:nxr) ) 1604 1600 logc_w_s = 0 1605 1601 logc_ratio_w_s = 1.0_wp … … 1620 1616 !-- The direction of the wall-normal index is stored as the 1621 1617 !-- sign of the logc-element. 1622 logc_v_s( k,i,2) = inc * lc1623 logc_ratio_v_s( k,i,2,0:ncorr-1) = lcr(0:ncorr-1)1618 logc_v_s(2,k,i) = inc * lc 1619 logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1624 1620 lcr(0:ncorr-1) = 1.0_wp 1625 1621 ENDIF … … 1637 1633 !-- The direction of the wall-normal index is stored as the 1638 1634 !-- sign of the logc-element. 1639 logc_v_s( k,i,2) = inc * lc1640 logc_ratio_v_s( k,i,2,0:ncorr-1) = lcr(0:ncorr-1)1635 logc_v_s(2,k,i) = inc * lc 1636 logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1641 1637 lcr(0:ncorr-1) = 1.0_wp 1642 1638 ENDIF … … 1654 1650 !-- The direction of the wall-normal index is stored as the 1655 1651 !-- sign of the logc-element. 1656 logc_w_s( k,i,2) = inc * lc1657 logc_ratio_w_s( k,i,2,0:ncorr - 1) = lcr(0:ncorr-1)1652 logc_w_s(2,k,i) = inc * lc 1653 logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1658 1654 lcr(0:ncorr-1) = 1.0_wp 1659 1655 ENDIF … … 1671 1667 !-- The direction of the wall-normal index is stored as the 1672 1668 !-- sign of the logc-element. 1673 logc_w_s( k,i,2) = inc * lc1674 logc_ratio_w_s( k,i,2,0:ncorr-1) = lcr(0:ncorr-1)1669 logc_w_s(2,k,i) = inc * lc 1670 logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1675 1671 lcr(0:ncorr-1) = 1.0_wp 1676 1672 ENDIF … … 1685 1681 IF ( nest_bound_n ) THEN 1686 1682 1687 ALLOCATE( logc_w_n( nzb:nzt_topo_nestbc_n, nxl:nxr, 1:2) )1688 ALLOCATE( logc_ratio_w_n( nzb:nzt_topo_nestbc_n,nxl:nxr,1:2,&1689 0:ncorr-1) )1683 ALLOCATE( logc_w_n(1:2,nzb:nzt_topo_nestbc_n, nxl:nxr) ) 1684 ALLOCATE( logc_ratio_w_n(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_n, & 1685 nxl:nxr) ) 1690 1686 logc_w_n = 0 1691 1687 logc_ratio_w_n = 1.0_wp … … 1706 1702 !-- The direction of the wall-normal index is stored as the 1707 1703 !-- sign of the logc-element. 1708 logc_v_n( k,i,2) = inc * lc1709 logc_ratio_v_n( k,i,2,0:ncorr-1) = lcr(0:ncorr-1)1704 logc_v_n(2,k,i) = inc * lc 1705 logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1710 1706 lcr(0:ncorr-1) = 1.0_wp 1711 1707 ENDIF … … 1722 1718 !-- The direction of the wall-normal index is stored as the 1723 1719 !-- sign of the logc-element. 1724 logc_v_n( k,i,2) = inc * lc1725 logc_ratio_v_n( k,i,2,0:ncorr-1) = lcr(0:ncorr-1)1720 logc_v_n(2,k,i) = inc * lc 1721 logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1726 1722 lcr(0:ncorr-1) = 1.0_wp 1727 1723 ENDIF … … 1738 1734 !-- The direction of the wall-normal index is stored as the 1739 1735 !-- sign of the logc-element. 1740 logc_w_n( k,i,2) = inc * lc1741 logc_ratio_w_n( k,i,2,0:ncorr-1) = lcr(0:ncorr-1)1736 logc_w_n(2,k,i) = inc * lc 1737 logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1742 1738 lcr(0:ncorr-1) = 1.0_wp 1743 1739 ENDIF … … 1754 1750 !-- The direction of the wall-normal index is stored as the 1755 1751 !-- sign of the logc-element. 1756 logc_w_n( k,i,2) = inc * lc1757 logc_ratio_w_n( k,i,2,0:ncorr-1) = lcr(0:ncorr-1)1752 logc_w_n(2,k,i) = inc * lc 1753 logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1) 1758 1754 lcr(0:ncorr-1) = 1.0_wp 1759 1755 ENDIF … … 2975 2971 2976 2972 2977 !-- TO_DO: the timestep sycnchronization could be done easier using 2978 !-- an MPI_ALLREDUCE with MIN over MPI_COMM_WORLD 2979 SUBROUTINE pmci_server_synchronize 2973 2974 SUBROUTINE pmci_synchronize 2980 2975 2981 2976 #if defined( __parallel ) 2982 2977 ! 2983 !-- Unify the time steps for each model and synchronize. This is based on the 2984 !-- assumption that the native time step (original dt_3d) of any server is 2985 !-- always larger than the smallest native time step of it s clients. 2986 IMPLICIT NONE 2987 2988 INTEGER(iwp) :: client_id !: 2989 INTEGER(iwp) :: ierr !: 2990 INTEGER(iwp) :: m !: 2991 2992 REAL(wp), DIMENSION(1) :: dtc !: 2993 REAL(wp), DIMENSION(1) :: dtl !: 2994 2995 2996 CALL cpu_log( log_point_s(70), 'pmc sync', 'start' ) 2997 2998 ! 2999 !-- First find the smallest native time step of all the clients of the current 3000 !-- server. 3001 dtl(1) = 999999.9_wp 3002 DO m = 1, SIZE( PMC_Server_for_Client )-1 3003 client_id = PMC_Server_for_Client(m) 3004 IF ( myid == 0 ) THEN 3005 CALL pmc_recv_from_client( client_id, dtc, SIZE( dtc ), 0, 101, ierr ) 3006 dtl(1) = MIN( dtl(1), dtc(1) ) 3007 dt_3d = dtl(1) 3008 ENDIF 3009 ENDDO 3010 3011 ! 3012 !-- Broadcast the unified time step to all server processes 3013 CALL MPI_BCAST( dt_3d, 1, MPI_REAL, 0, comm2d, ierr ) 3014 3015 ! 3016 !-- Send the new time step to all the clients of the current server 3017 DO m = 1, SIZE( PMC_Server_for_Client ) - 1 3018 client_id = PMC_Server_for_Client(m) 3019 IF ( myid == 0 ) THEN 3020 CALL pmc_send_to_client( client_id, dtl, SIZE( dtl ), 0, 102, ierr ) 3021 ENDIF 3022 ENDDO 3023 3024 CALL cpu_log( log_point_s(70), 'pmc sync', 'stop' ) 3025 3026 #endif 3027 END SUBROUTINE pmci_server_synchronize 3028 3029 3030 3031 SUBROUTINE pmci_client_synchronize 3032 3033 #if defined( __parallel ) 3034 ! 3035 !-- Unify the time steps for each model and synchronize. This is based on the 3036 !-- assumption that the native time step (original dt_3d) of any server is 3037 !-- always larger than the smallest native time step of it s clients. 3038 3039 IMPLICIT NONE 3040 3041 INTEGER(iwp) :: ierr !: 3042 3043 REAL(wp), DIMENSION(1) :: dtl !: 3044 REAL(wp), DIMENSION(1) :: dts !: 3045 3046 3047 dtl(1) = dt_3d 3048 IF ( cpl_id > 1 ) THEN 3049 3050 CALL cpu_log( log_point_s(70), 'pmc sync', 'start' ) 3051 3052 IF ( myid==0 ) THEN 3053 CALL pmc_send_to_server( dtl, SIZE( dtl ), 0, 101, ierr ) 3054 CALL pmc_recv_from_server( dts, SIZE( dts ), 0, 102, ierr ) 3055 dt_3d = dts(1) 3056 ENDIF 3057 3058 ! 3059 !-- Broadcast the unified time step to all server processes 3060 CALL MPI_BCAST( dt_3d, 1, MPI_REAL, 0, comm2d, ierr ) 3061 3062 CALL cpu_log( log_point_s(70), 'pmc sync', 'stop' ) 3063 3064 ENDIF 3065 3066 #endif 3067 END SUBROUTINE pmci_client_synchronize 2978 !-- Unify the time steps for each model and synchronize using 2979 !-- MPI_ALLREDUCE with the MPI_MIN operator over all processes using 2980 !-- the global communicator MPI_COMM_WORLD. 2981 IMPLICIT NONE 2982 2983 INTEGER(iwp) :: ierr !: 2984 REAL(wp), DIMENSION(1) :: dtl !: 2985 REAL(wp), DIMENSION(1) :: dtg !: 2986 2987 2988 dtl(1) = dt_3d 2989 CALL MPI_ALLREDUCE( dtl, dtg, 1, MPI_REAL, MPI_MIN, MPI_COMM_WORLD, ierr ) 2990 dt_3d = dtg(1) 2991 2992 END SUBROUTINE pmci_synchronize 3068 2993 3069 2994 … … 3506 3431 REAL(wp), DIMENSION(0:cg%nz+1,jcs:jcn,icl:icr), & 3507 3432 INTENT(IN) :: fc !: 3508 REAL(wp), DIMENSION( nzb:nzt_topo_nestbc,nys:nyn,1:2,0:ncorr-1), &3433 REAL(wp), DIMENSION(1:2,0:ncorr-1,nzb:nzt_topo_nestbc,nys:nyn), & 3509 3434 INTENT(IN) :: logc_ratio !: 3510 3435 REAL(wp), DIMENSION(nxlg:nxrg), INTENT(IN) :: r1x !: … … 3519 3444 INTEGER(iwp), DIMENSION(nysg:nyng,nxlg:nxrg), INTENT(IN) :: kb !: 3520 3445 INTEGER(iwp), DIMENSION(nzb:nzt+1), INTENT(IN) :: kc !: 3521 INTEGER(iwp), DIMENSION( nzb:nzt_topo_nestbc,nys:nyn,1:2), &3446 INTEGER(iwp), DIMENSION(1:2,nzb:nzt_topo_nestbc,nys:nyn), & 3522 3447 INTENT(IN) :: logc !: 3523 3448 INTEGER(iwp) :: nzt_topo_nestbc !: … … 3589 3514 ! 3590 3515 !-- Generalized log-law-correction algorithm. 3591 !-- Doubly two-dimensional index arrays logc( :,:,1:2) and log-ratio arrays3592 !-- logc_ratio( :,:,1:2,0:ncorr-1) have been precomputed in subroutine3516 !-- Doubly two-dimensional index arrays logc(1:2,:,:) and log-ratio arrays 3517 !-- logc_ratio(1:2,0:ncorr-1,:,:) have been precomputed in subroutine 3593 3518 !-- pmci_init_loglaw_correction. 3594 3519 ! … … 3597 3522 DO j = nys, nyn 3598 3523 k = kb(j,i)+1 3599 IF ( ( logc( k,j,1) /= 0 ) .AND. ( logc(k,j,2) == 0 ) ) THEN3600 k1 = logc( k,j,1)3601 DO kcorr =0,ncorr - 13524 IF ( ( logc(1,k,j) /= 0 ) .AND. ( logc(2,k,j) == 0 ) ) THEN 3525 k1 = logc(1,k,j) 3526 DO kcorr = 0, ncorr - 1 3602 3527 kco = k + kcorr 3603 f(kco,j,i) = logc_ratio( k,j,1,kcorr) * f(k1,j,i)3528 f(kco,j,i) = logc_ratio(1,kcorr,k,j) * f(k1,j,i) 3604 3529 ENDDO 3605 3530 ENDIF … … 3619 3544 DO j = nys, nyn 3620 3545 DO k = kb(j,i)+1, nzt_topo_nestbc 3621 IF ( ( logc( k,j,2) /= 0 ) .AND. ( logc(k,j,1) == 0 ) ) THEN3546 IF ( ( logc(2,k,j) /= 0 ) .AND. ( logc(1,k,j) == 0 ) ) THEN 3622 3547 3623 3548 ! 3624 3549 !-- Direction of the wall-normal index is carried in as the 3625 3550 !-- sign of logc 3626 jinc = SIGN( 1, logc( k,j,2) )3627 j1 = ABS( logc( k,j,2) )3551 jinc = SIGN( 1, logc(2,k,j) ) 3552 j1 = ABS( logc(2,k,j) ) 3628 3553 DO jcorr = 0, ncorr-1 3629 3554 jco = j + jinc * jcorr 3630 f(k,jco,i) = logc_ratio( k,j,2,jcorr) * f(k,j1,i)3555 f(k,jco,i) = logc_ratio(2,jcorr,k,j) * f(k,j1,i) 3631 3556 ENDDO 3632 3557 ENDIF … … 3640 3565 DO j = nys, nyn 3641 3566 k = kb(j,i) + 1 3642 IF ( ( logc( k,j,2) /= 0 ) .AND. ( logc(k,j,1) /= 0 ) ) THEN3643 k1 = logc( k,j,1)3644 jinc = SIGN( 1, logc( k,j,2) )3645 j1 = ABS( logc( k,j,2) )3567 IF ( ( logc(2,k,j) /= 0 ) .AND. ( logc(1,k,j) /= 0 ) ) THEN 3568 k1 = logc(1,k,j) 3569 jinc = SIGN( 1, logc(2,k,j) ) 3570 j1 = ABS( logc(2,k,j) ) 3646 3571 DO jcorr = 0, ncorr-1 3647 3572 jco = j + jinc * jcorr 3648 3573 DO kcorr = 0, ncorr-1 3649 3574 kco = k + kcorr 3650 f(kco,jco,i) = 0.5_wp * ( logc_ratio( k,j,1,kcorr) * &3575 f(kco,jco,i) = 0.5_wp * ( logc_ratio(1,kcorr,k,j) * & 3651 3576 f(k1,j,i) & 3652 + logc_ratio( k,j,2,jcorr) * &3577 + logc_ratio(2,jcorr,k,j) * & 3653 3578 f(k,j1,i) ) 3654 3579 ENDDO … … 3709 3634 REAL(wp), DIMENSION(0:cg%nz+1,jcs:jcn,icl:icr), & 3710 3635 INTENT(IN) :: fc !: 3711 REAL(wp), DIMENSION( nzb:nzt_topo_nestbc,nxl:nxr,1:2,0:ncorr-1), &3636 REAL(wp), DIMENSION(1:2,0:ncorr-1,nzb:nzt_topo_nestbc,nxl:nxr), & 3712 3637 INTENT(IN) :: logc_ratio !: 3713 3638 REAL(wp), DIMENSION(nxlg:nxrg), INTENT(IN) :: r1x !: … … 3722 3647 INTEGER(iwp), DIMENSION(nysg:nyng,nxlg:nxrg), INTENT(IN) :: kb !: 3723 3648 INTEGER(iwp), DIMENSION(nzb:nzt+1), INTENT(IN) :: kc !: 3724 INTEGER(iwp), DIMENSION( nzb:nzt_topo_nestbc,nxl:nxr,1:2), &3649 INTEGER(iwp), DIMENSION(1:2,nzb:nzt_topo_nestbc,nxl:nxr), & 3725 3650 INTENT(IN) :: logc !: 3726 3651 INTEGER(iwp) :: nzt_topo_nestbc !: … … 3789 3714 ! 3790 3715 !-- Generalized log-law-correction algorithm. 3791 !-- Multiply two-dimensional index arrays logc( :,:,1:2) and log-ratio arrays3792 !-- logc_ratio( :,:,1:2,0:ncorr-1) have been precomputed in subroutine3716 !-- Multiply two-dimensional index arrays logc(1:2,:,:) and log-ratio arrays 3717 !-- logc_ratio(1:2,0:ncorr-1,:,:) have been precomputed in subroutine 3793 3718 !-- pmci_init_loglaw_correction. 3794 3719 ! … … 3797 3722 DO i = nxl, nxr 3798 3723 k = kb(j,i) + 1 3799 IF ( ( logc( k,i,1) /= 0 ) .AND. ( logc(k,i,2) == 0 ) ) THEN3800 k1 = logc( k,i,1)3724 IF ( ( logc(1,k,i) /= 0 ) .AND. ( logc(2,k,i) == 0 ) ) THEN 3725 k1 = logc(1,k,i) 3801 3726 DO kcorr = 0, ncorr-1 3802 3727 kco = k + kcorr 3803 f(kco,j,i) = logc_ratio( k,i,1,kcorr) * f(k1,j,i)3728 f(kco,j,i) = logc_ratio(1,kcorr,k,i) * f(k1,j,i) 3804 3729 ENDDO 3805 3730 ENDIF … … 3820 3745 ! 3821 3746 !-- Solid surface only on left/right side of the node 3822 IF ( ( logc( k,i,2) /= 0 ) .AND. ( logc(k,i,1) == 0 ) ) THEN3747 IF ( ( logc(2,k,i) /= 0 ) .AND. ( logc(1,k,i) == 0 ) ) THEN 3823 3748 3824 3749 ! 3825 3750 !-- Direction of the wall-normal index is carried in as the 3826 3751 !-- sign of logc 3827 iinc = SIGN( 1, logc( k,i,2) )3828 i1 = ABS( logc( k,i,2) )3752 iinc = SIGN( 1, logc(2,k,i) ) 3753 i1 = ABS( logc(2,k,i) ) 3829 3754 DO icorr = 0, ncorr-1 3830 3755 ico = i + iinc * icorr 3831 f(k,j,ico) = logc_ratio( k,i,2,icorr) * f(k,j,i1)3756 f(k,j,ico) = logc_ratio(2,icorr,k,i) * f(k,j,i1) 3832 3757 ENDDO 3833 3758 ENDIF … … 3841 3766 DO i = nxl, nxr 3842 3767 k = kb(j,i) + 1 3843 IF ( ( logc( k,i,2) /= 0 ) .AND. ( logc(k,i,1) /= 0 ) ) THEN3844 k1 = logc( k,i,1)3845 iinc = SIGN( 1, logc( k,i,2) )3846 i1 = ABS( logc( k,i,2) )3768 IF ( ( logc(2,k,i) /= 0 ) .AND. ( logc(1,k,i) /= 0 ) ) THEN 3769 k1 = logc(1,k,i) 3770 iinc = SIGN( 1, logc(2,k,i) ) 3771 i1 = ABS( logc(2,k,i) ) 3847 3772 DO icorr = 0, ncorr-1 3848 3773 ico = i + iinc * icorr 3849 3774 DO kcorr = 0, ncorr-1 3850 3775 kco = k + kcorr 3851 f(kco,i,ico) = 0.5_wp * ( logc_ratio( k,i,1,kcorr) * &3776 f(kco,i,ico) = 0.5_wp * ( logc_ratio(1,kcorr,k,i) * & 3852 3777 f(k1,j,i) & 3853 + logc_ratio( k,i,2,icorr) * &3778 + logc_ratio(2,icorr,k,i) * & 3854 3779 f(k,j,i1) ) 3855 3780 ENDDO -
palm/trunk/SOURCE/time_integration.f90
r1854 r1878 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! Synchronization for nested runs rewritten 22 22 ! 23 23 ! Former revisions: … … 282 282 USE pmc_interface, & 283 283 ONLY: client_to_server, nested_run, nesting_mode, & 284 pmci_client_synchronize, pmci_datatrans, & 285 pmci_ensure_nest_mass_conservation, & 286 pmci_server_synchronize, server_to_client 284 pmci_datatrans, pmci_ensure_nest_mass_conservation, & 285 pmci_synchronize, server_to_client 287 286 288 287 USE production_e_mod, & … … 325 324 ! 326 325 !-- Synchronize the timestep in case of nested run. 327 !-- The server side must be called first328 326 IF ( nested_run ) THEN 329 CALL pmci_server_synchronize 330 CALL pmci_client_synchronize 327 ! 328 !-- Synchronization by unifying the time step. 329 !-- Global minimum of all time-steps is used for all. 330 CALL pmci_synchronize 331 331 ENDIF 332 332 … … 368 368 IF ( simulated_time /= 0.0_wp ) THEN 369 369 CALL timestep 370 370 ! 371 !-- Synchronize the timestep in case of nested run. 371 372 IF ( nested_run ) THEN 372 373 ! 373 !-- TO_DO: try to give more detailed and meaningful comments here 374 !-- Server side must be called first 375 CALL pmci_server_synchronize 376 CALL pmci_client_synchronize 377 ENDIF 378 ENDIF 379 374 !-- Synchronize by unifying the time step. 375 !-- Global minimum of all time-steps is used for all. 376 CALL pmci_synchronize 377 ENDIF 378 ENDIF 380 379 381 380 !
Note: See TracChangeset
for help on using the changeset viewer.