Changeset 4562 for palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
- Timestamp:
- Jun 12, 2020 8:38:47 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
r4559 r4562 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Parts of r4559 re-formatted 28 ! 29 ! 4559 2020-06-11 08:51:48Z raasch 27 30 ! File re-formatted to follow the PALM coding standard 28 31 ! … … 1375 1378 !-- Lund rotation following Eq. 17 in Xie and Castro (2008). 1376 1379 !-- Additional factors are added to improve the variance of v and w 1377 dist_yz(k,j,1) = MIN( a11(k) * fu_yz(k,j), 3.0_wp ) * MERGE( 1.0_wp, 0.0_wp,&1378 BTEST( wall_flags_total_0(k,j,i), 1 ) )1380 dist_yz(k,j,1) = MIN( a11(k) * fu_yz(k,j), 3.0_wp ) * & 1381 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 1 ) ) 1379 1382 ENDDO 1380 1383 ENDDO … … 1393 1396 dist_yz(k,j,3) = MIN( ( SQRT( a33(k) / MAXVAL( a33 ) ) * 1.3_wp ) * & 1394 1397 ( a31(k) * fu_yz(k,j) + a32(k) * fv_yz(k,j) + a33(k) & 1395 * fw_yz(k,j) ), 3.0_wp ) * MERGE( 1.0_wp, 0.0_wp,&1396 1398 * fw_yz(k,j) ), 3.0_wp ) * & 1399 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 3 ) ) 1397 1400 ENDDO 1398 1401 ENDDO … … 1412 1415 IF ( myidx == id_stg_right ) i = nxr+1 1413 1416 1414 mc_factor_l(1) = SUM( dist_yz(nzb:nzt,nys:nyn,1) * MERGE( 1.0_wp, 0.0_wp,&1415 1417 mc_factor_l(1) = SUM( dist_yz(nzb:nzt,nys:nyn,1) * & 1418 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(nzb:nzt,nys:nyn,i), 1 ) ) ) 1416 1419 1417 1420 IF ( myidx == id_stg_left ) i = nxl-1 1418 1421 IF ( myidx == id_stg_right ) i = nxr+1 1419 1422 1420 mc_factor_l(2) = SUM( dist_yz(nzb:nzt,nysv:nyn,2) * MERGE( 1.0_wp, 0.0_wp,&1421 1422 mc_factor_l(3) = SUM( dist_yz(nzb:nzt,nys:nyn,3) * MERGE( 1.0_wp, 0.0_wp,&1423 1423 mc_factor_l(2) = SUM( dist_yz(nzb:nzt,nysv:nyn,2) * & 1424 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(nzb:nzt,nysv:nyn,i), 2 ) ) ) 1425 mc_factor_l(3) = SUM( dist_yz(nzb:nzt,nys:nyn,3) * & 1426 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(nzb:nzt,nys:nyn,i), 3 ) ) ) 1424 1427 1425 1428 #if defined( __parallel ) … … 1435 1438 IF ( myidx == id_stg_right ) i = nxr+1 1436 1439 1437 dist_yz(:,nys:nyn,1) = ( dist_yz(:,nys:nyn,1) - mc_factor(1) ) * MERGE( 1.0_wp, 0.0_wp,&1438 BTEST( wall_flags_total_0(:,nys:nyn,i), 1 ) )1440 dist_yz(:,nys:nyn,1) = ( dist_yz(:,nys:nyn,1) - mc_factor(1) ) * & 1441 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(:,nys:nyn,i), 1 ) ) 1439 1442 1440 1443 … … 1442 1445 IF ( myidx == id_stg_right ) i = nxr+1 1443 1446 1444 dist_yz(:,nys:nyn,2) = ( dist_yz(:,nys:nyn,2) - mc_factor(2) ) * MERGE( 1.0_wp, 0.0_wp,&1445 BTEST( wall_flags_total_0(:,nys:nyn,i), 2 ) )1446 1447 dist_yz(:,nys:nyn,3) = ( dist_yz(:,nys:nyn,3) - mc_factor(3) ) * MERGE( 1.0_wp, 0.0_wp,&1448 BTEST( wall_flags_total_0(:,nys:nyn,i), 3 ) )1447 dist_yz(:,nys:nyn,2) = ( dist_yz(:,nys:nyn,2) - mc_factor(2) ) * & 1448 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(:,nys:nyn,i), 2 ) ) 1449 1450 dist_yz(:,nys:nyn,3) = ( dist_yz(:,nys:nyn,3) - mc_factor(3) ) * & 1451 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(:,nys:nyn,i), 3 ) ) 1449 1452 ! 1450 1453 !-- Add disturbances … … 1459 1462 DO j = nys, nyn 1460 1463 DO k = nzb, nzt+1 1461 u(k,j,-nbgp+1:0) = ( mean_inflow_profiles(k,1) + dist_yz(k,j,1) ) 1462 *MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,0), 1 ) )1463 v(k,j,-nbgp:-1) = ( mean_inflow_profiles(k,2) + dist_yz(k,j,2) )&1464 *MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,-1), 2 ) )1465 w(k,j,-nbgp:-1) = dist_yz(k,j,3) * MERGE( 1.0_wp, 0.0_wp,&1466 1464 u(k,j,-nbgp+1:0) = ( mean_inflow_profiles(k,1) + dist_yz(k,j,1) ) * & 1465 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,0), 1 ) ) 1466 v(k,j,-nbgp:-1) = ( mean_inflow_profiles(k,2) + dist_yz(k,j,2) ) * & 1467 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,-1), 2 ) ) 1468 w(k,j,-nbgp:-1) = dist_yz(k,j,3) * & 1469 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,-1), 3 ) ) 1467 1470 ENDDO 1468 1471 ENDDO … … 1471 1474 DO j = nys, nyn 1472 1475 DO k = nzb+1, nzt 1473 u(k,j,0) = ( u(k,j,0) + dist_yz(k,j,1) ) * MERGE( 1.0_wp, 0.0_wp,&1474 BTEST( wall_flags_total_0(k,j,0), 1 ) )1476 u(k,j,0) = ( u(k,j,0) + dist_yz(k,j,1) ) * & 1477 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,0), 1 ) ) 1475 1478 u(k,j,-1) = u(k,j,0) 1476 v(k,j,-1) = ( v(k,j,-1) + dist_yz(k,j,2) ) * MERGE( 1.0_wp, 0.0_wp,&1477 BTEST( wall_flags_total_0(k,j,-1), 2 ) )1478 w(k,j,-1) = ( w(k,j,-1) + dist_yz(k,j,3) ) * MERGE( 1.0_wp, 0.0_wp,&1479 BTEST( wall_flags_total_0(k,j,-1), 3 ) )1479 v(k,j,-1) = ( v(k,j,-1) + dist_yz(k,j,2) ) * & 1480 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,-1), 2 ) ) 1481 w(k,j,-1) = ( w(k,j,-1) + dist_yz(k,j,3) ) * & 1482 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,-1), 3 ) ) 1480 1483 ENDDO 1481 1484 ENDDO … … 1485 1488 DO j = nys, nyn 1486 1489 DO k = nzb+1, nzt 1487 u(k,j,nxr+1) = ( u(k,j,nxr+1) + dist_yz(k,j,1) ) * MERGE( 1.0_wp, 0.0_wp,&1488 BTEST( wall_flags_total_0(k,j,nxr+1), 1 ) )1489 v(k,j,nxr+1) = ( v(k,j,nxr+1) + dist_yz(k,j,2) ) * MERGE( 1.0_wp, 0.0_wp,&1490 1491 w(k,j,nxr+1) = ( w(k,j,nxr+1) + dist_yz(k,j,3) ) * MERGE( 1.0_wp, 0.0_wp,&1492 BTEST( wall_flags_total_0(k,j,nxr+1), 3 ) )1490 u(k,j,nxr+1) = ( u(k,j,nxr+1) + dist_yz(k,j,1) ) * & 1491 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,nxr+1), 1 ) ) 1492 v(k,j,nxr+1) = ( v(k,j,nxr+1) + dist_yz(k,j,2) ) * & 1493 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,nxr+1), 2 ) ) 1494 w(k,j,nxr+1) = ( w(k,j,nxr+1) + dist_yz(k,j,3) ) * & 1495 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,nxr+1), 3 ) ) 1493 1496 ENDDO 1494 1497 ENDDO … … 1556 1559 !-- Lund rotation following Eq. 17 in Xie and Castro (2008). 1557 1560 !-- Additional factors are added to improve the variance of v and w 1558 dist_xz(k,i,1) = MIN( a11(k) * fu_xz(k,i), 3.0_wp ) * MERGE( 1.0_wp, 0.0_wp,&1559 BTEST( wall_flags_total_0(k,j,i), 1 ) )1561 dist_xz(k,i,1) = MIN( a11(k) * fu_xz(k,i), 3.0_wp ) * & 1562 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 1 ) ) 1560 1563 1561 1564 dist_xz(k,i,3) = MIN( ( SQRT(a33(k) / MAXVAL( a33 ) ) * 1.3_wp ) & 1562 1565 * ( a31(k) * fu_xz(k,i) + a32(k) * fv_xz(k,i) + a33(k) & 1563 * fw_xz(k,i) ), 3.0_wp ) * MERGE( 1.0_wp, 0.0_wp,&1564 BTEST( wall_flags_total_0(k,j,i), 3 ) )1566 * fw_xz(k,i) ), 3.0_wp ) * & 1567 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 3 ) ) 1565 1568 ENDDO 1566 1569 ENDDO … … 1579 1582 IF ( myidy == id_stg_north ) j = nyn+1 1580 1583 1581 mc_factor_l(2) = SUM( dist_xz(nzb:nzt,nxl:nxr,2) * MERGE( 1.0_wp, 0.0_wp,&1582 1584 mc_factor_l(2) = SUM( dist_xz(nzb:nzt,nxl:nxr,2) * & 1585 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(nzb:nzt,j,nxl:nxr), 2 ) ) ) 1583 1586 1584 1587 IF ( myidy == id_stg_south ) j = nys-1 1585 1588 IF ( myidy == id_stg_north ) j = nyn+1 1586 1589 1587 mc_factor_l(1) = SUM( dist_xz(nzb:nzt,nxlu:nxr,1) * MERGE( 1.0_wp, 0.0_wp,&1588 1589 mc_factor_l(3) = SUM( dist_xz(nzb:nzt,nxl:nxr,3) * MERGE( 1.0_wp, 0.0_wp,&1590 1590 mc_factor_l(1) = SUM( dist_xz(nzb:nzt,nxlu:nxr,1) * & 1591 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(nzb:nzt,j,nxlu:nxr), 1 ) ) ) 1592 mc_factor_l(3) = SUM( dist_xz(nzb:nzt,nxl:nxr,3) * & 1593 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(nzb:nzt,j,nxl:nxr), 3 ) ) ) 1591 1594 1592 1595 #if defined( __parallel ) … … 1601 1604 IF ( myidy == id_stg_north ) j = nyn+1 1602 1605 1603 dist_xz(:,nxl:nxr,2) = ( dist_xz(:,nxl:nxr,2) - mc_factor(2) ) * MERGE( 1.0_wp, 0.0_wp,&1604 BTEST( wall_flags_total_0(:,j,nxl:nxr), 2 ) )1606 dist_xz(:,nxl:nxr,2) = ( dist_xz(:,nxl:nxr,2) - mc_factor(2) ) * & 1607 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(:,j,nxl:nxr), 2 ) ) 1605 1608 1606 1609 … … 1608 1611 IF ( myidy == id_stg_north ) j = nyn+1 1609 1612 1610 dist_xz(:,nxl:nxr,1) = ( dist_xz(:,nxl:nxr,1) - mc_factor(1) ) * MERGE( 1.0_wp, 0.0_wp,&1611 BTEST( wall_flags_total_0(:,j,nxl:nxr), 1 ) )1612 1613 dist_xz(:,nxl:nxr,3) = ( dist_xz(:,nxl:nxr,3) - mc_factor(3) ) * MERGE( 1.0_wp, 0.0_wp,&1614 BTEST( wall_flags_total_0(:,j,nxl:nxr), 3 ) )1613 dist_xz(:,nxl:nxr,1) = ( dist_xz(:,nxl:nxr,1) - mc_factor(1) ) * & 1614 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(:,j,nxl:nxr), 1 ) ) 1615 1616 dist_xz(:,nxl:nxr,3) = ( dist_xz(:,nxl:nxr,3) - mc_factor(3) ) * & 1617 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(:,j,nxl:nxr), 3 ) ) 1615 1618 ! 1616 1619 !-- Add disturbances … … 1632 1635 DO i = nxl, nxr 1633 1636 DO k = nzb+1, nzt 1634 u(k,nyn+1,i) = ( u(k,nyn+1,i) + dist_xz(k,i,1) ) * MERGE( 1.0_wp, 0.0_wp,&1635 BTEST( wall_flags_total_0(k,nyn+1,i), 1 ) )1636 v(k,nyn+1,i) = ( v(k,nyn+1,i) + dist_xz(k,i,2) ) * MERGE( 1.0_wp, 0.0_wp,&1637 BTEST( wall_flags_total_0(k,nyn+1,i), 2 ) )1638 w(k,nyn+1,i) = ( w(k,nyn+1,i) + dist_xz(k,i,3) ) * MERGE( 1.0_wp, 0.0_wp,&1639 BTEST( wall_flags_total_0(k,nyn+1,i), 3 ) )1637 u(k,nyn+1,i) = ( u(k,nyn+1,i) + dist_xz(k,i,1) ) * & 1638 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,nyn+1,i), 1 ) ) 1639 v(k,nyn+1,i) = ( v(k,nyn+1,i) + dist_xz(k,i,2) ) * & 1640 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,nyn+1,i), 2 ) ) 1641 w(k,nyn+1,i) = ( w(k,nyn+1,i) + dist_xz(k,i,3) ) * & 1642 MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,nyn+1,i), 3 ) ) 1640 1643 ENDDO 1641 1644 ENDDO … … 2022 2025 !-- u'u' and v'v'. Assume isotropy. Note, add a small negative number to the denominator, else 2023 2026 !-- the mergpe-function can crash if scale_l is zero. 2024 r11(k) = scale_us**2 * ( MERGE( 0.35_wp & 2025 * ABS( - zi_ribulk / ( kappa * scale_l - 10E-4_wp ) )**( 2.0_wp / 3.0_wp ), & 2026 0.0_wp, scale_l < 0.0_wp ) + 5.0_wp - 4.0_wp * zzi ) * blend 2027 r11(k) = scale_us**2 * ( MERGE( 0.35_wp * & 2028 ABS( - zi_ribulk / ( kappa * scale_l - 10E-4_wp ) )**( 2.0_wp / 3.0_wp ), & 2029 0.0_wp, scale_l < 0.0_wp ) + 5.0_wp - 4.0_wp * zzi & 2030 ) * blend 2027 2031 2028 2032 r22(k) = r11(k)
Note: See TracChangeset
for help on using the changeset viewer.