Changeset 3568 for palm/trunk
- Timestamp:
- Nov 27, 2018 4:07:59 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/ocean_mod.f90
r3421 r3568 25 25 ! ----------------- 26 26 ! $Id$ 27 ! bugifx: calculate equation of state for seawater even if salinity is switched 28 ! off 29 ! 30 ! 3421 2018-10-24 18:39:32Z gronemeier 27 31 ! Renamed output variables 28 32 ! … … 1541 1545 !-- Compute prognostic equations for the ocean mode 1542 1546 !-- First, start with salinity 1543 IF ( .NOT. salinity ) RETURN 1544 1545 CALL cpu_log( log_point(37), 'sa-equation', 'start' ) 1546 1547 ! 1548 !-- sa-tendency terms with communication 1549 sbt = tsc(2) 1550 IF ( scalar_advec == 'bc-scheme' ) THEN 1551 1552 IF ( timestep_scheme(1:5) /= 'runge' ) THEN 1553 ! 1554 !-- Bott-Chlond scheme always uses Euler time step. Thus: 1555 sbt = 1.0_wp 1547 IF ( salinity ) THEN 1548 1549 CALL cpu_log( log_point(37), 'sa-equation', 'start' ) 1550 1551 ! 1552 !-- sa-tendency terms with communication 1553 sbt = tsc(2) 1554 IF ( scalar_advec == 'bc-scheme' ) THEN 1555 1556 IF ( timestep_scheme(1:5) /= 'runge' ) THEN 1557 ! 1558 !-- Bott-Chlond scheme always uses Euler time step. Thus: 1559 sbt = 1.0_wp 1560 ENDIF 1561 tend = 0.0_wp 1562 CALL advec_s_bc( sa, 'sa' ) 1563 1556 1564 ENDIF 1557 tend = 0.0_wp 1558 CALL advec_s_bc( sa, 'sa' ) 1559 1560 ENDIF 1561 1562 ! 1563 !-- sa-tendency terms with no communication 1564 IF ( scalar_advec /= 'bc-scheme' ) THEN 1565 tend = 0.0_wp 1566 IF ( timestep_scheme(1:5) == 'runge' ) THEN 1567 IF ( ws_scheme_sca ) THEN 1568 CALL advec_s_ws( sa, 'sa' ) 1565 1566 ! 1567 !-- sa-tendency terms with no communication 1568 IF ( scalar_advec /= 'bc-scheme' ) THEN 1569 tend = 0.0_wp 1570 IF ( timestep_scheme(1:5) == 'runge' ) THEN 1571 IF ( ws_scheme_sca ) THEN 1572 CALL advec_s_ws( sa, 'sa' ) 1573 ELSE 1574 CALL advec_s_pw( sa ) 1575 ENDIF 1569 1576 ELSE 1570 CALL advec_s_ pw( sa )1577 CALL advec_s_up( sa ) 1571 1578 ENDIF 1572 ELSE1573 CALL advec_s_up( sa )1574 1579 ENDIF 1575 ENDIF 1576 1577 CALL diffusion_s( sa, & 1578 surf_def_h(0)%sasws, surf_def_h(1)%sasws, & 1579 surf_def_h(2)%sasws, & 1580 surf_lsm_h%sasws, surf_usm_h%sasws, & 1581 surf_def_v(0)%sasws, surf_def_v(1)%sasws, & 1582 surf_def_v(2)%sasws, surf_def_v(3)%sasws, & 1583 surf_lsm_v(0)%sasws, surf_lsm_v(1)%sasws, & 1584 surf_lsm_v(2)%sasws, surf_lsm_v(3)%sasws, & 1585 surf_usm_v(0)%sasws, surf_usm_v(1)%sasws, & 1586 surf_usm_v(2)%sasws, surf_usm_v(3)%sasws ) 1587 1588 CALL user_actions( 'sa-tendency' ) 1589 1590 ! 1591 !-- Prognostic equation for salinity 1592 DO i = nxl, nxr 1593 DO j = nys, nyn 1594 DO k = nzb+1, nzt 1595 sa_p(k,j,i) = sa(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) + & 1596 tsc(3) * tsa_m(k,j,i) ) & 1597 - tsc(5) * rdf_sc(k) * & 1598 ( sa(k,j,i) - sa_init(k) ) & 1599 ) & 1600 * MERGE( 1.0_wp, 0.0_wp, & 1580 1581 CALL diffusion_s( sa, & 1582 surf_def_h(0)%sasws, surf_def_h(1)%sasws, & 1583 surf_def_h(2)%sasws, & 1584 surf_lsm_h%sasws, surf_usm_h%sasws, & 1585 surf_def_v(0)%sasws, surf_def_v(1)%sasws, & 1586 surf_def_v(2)%sasws, surf_def_v(3)%sasws, & 1587 surf_lsm_v(0)%sasws, surf_lsm_v(1)%sasws, & 1588 surf_lsm_v(2)%sasws, surf_lsm_v(3)%sasws, & 1589 surf_usm_v(0)%sasws, surf_usm_v(1)%sasws, & 1590 surf_usm_v(2)%sasws, surf_usm_v(3)%sasws ) 1591 1592 CALL user_actions( 'sa-tendency' ) 1593 1594 ! 1595 !-- Prognostic equation for salinity 1596 DO i = nxl, nxr 1597 DO j = nys, nyn 1598 DO k = nzb+1, nzt 1599 sa_p(k,j,i) = sa(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) + & 1600 tsc(3) * tsa_m(k,j,i) ) & 1601 - tsc(5) * rdf_sc(k) * & 1602 ( sa(k,j,i) - sa_init(k) ) & 1603 ) & 1604 * MERGE( 1.0_wp, 0.0_wp, & 1601 1605 BTEST( wall_flags_0(k,j,i), 0 ) & 1602 ) 1603 IF ( sa_p(k,j,i) < 0.0_wp ) sa_p(k,j,i) = 0.1_wp * sa(k,j,i) 1606 ) 1607 IF ( sa_p(k,j,i) < 0.0_wp ) sa_p(k,j,i) = 0.1_wp * sa(k,j,i) 1608 ENDDO 1604 1609 ENDDO 1605 1610 ENDDO 1606 ENDDO 1607 1608 ! 1609 !-- Calculate tendencies for the next Runge-Kutta step 1610 IF ( timestep_scheme(1:5) == 'runge') THEN1611 IF ( intermediate_timestep_count == 1 ) THEN1612 DO i = nxl, nxr1613 DO j = nys, nyn1614 DO k = nzb+1, nzt1615 tsa_m(k,j,i) = tend(k,j,i)1611 1612 ! 1613 !-- Calculate tendencies for the next Runge-Kutta step 1614 IF ( timestep_scheme(1:5) == 'runge' ) THEN 1615 IF ( intermediate_timestep_count == 1 ) THEN 1616 DO i = nxl, nxr 1617 DO j = nys, nyn 1618 DO k = nzb+1, nzt 1619 tsa_m(k,j,i) = tend(k,j,i) 1620 ENDDO 1616 1621 ENDDO 1617 1622 ENDDO 1618 E NDDO1619 ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )&1620 THEN1621 DO i = nxl, nxr1622 DO j = nys, nyn1623 DO k = nzb+1, nzt1624 tsa_m(k,j,i) = -9.5625_wp * tend(k,j,i) + &1625 5.3125_wp * tsa_m(k,j,i)1623 ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max ) & 1624 THEN 1625 DO i = nxl, nxr 1626 DO j = nys, nyn 1627 DO k = nzb+1, nzt 1628 tsa_m(k,j,i) = -9.5625_wp * tend(k,j,i) + & 1629 5.3125_wp * tsa_m(k,j,i) 1630 ENDDO 1626 1631 ENDDO 1627 1632 ENDDO 1628 ENDDO1633 ENDIF 1629 1634 ENDIF 1630 ENDIF 1631 1632 CALL cpu_log( log_point(37), 'sa-equation', 'stop' ) 1635 1636 CALL cpu_log( log_point(37), 'sa-equation', 'stop' ) 1637 1638 ENDIF 1633 1639 1634 1640 ! … … 1704 1710 !-- Compute prognostic equations for the ocean mode 1705 1711 !-- First, start with tendency-terms for salinity 1706 IF ( .NOT. salinity ) RETURN 1707 1708 tend(:,j,i) = 0.0_wp 1709 IF ( timestep_scheme(1:5) == 'runge' ) & 1710 THEN 1711 IF ( ws_scheme_sca ) THEN 1712 CALL advec_s_ws( i, j, sa, 'sa', flux_s_sa, diss_s_sa, flux_l_sa, & 1713 diss_l_sa, i_omp_start, tn ) 1712 IF ( salinity ) THEN 1713 1714 tend(:,j,i) = 0.0_wp 1715 IF ( timestep_scheme(1:5) == 'runge' ) & 1716 THEN 1717 IF ( ws_scheme_sca ) THEN 1718 CALL advec_s_ws( i, j, sa, 'sa', flux_s_sa, diss_s_sa, flux_l_sa,& 1719 diss_l_sa, i_omp_start, tn ) 1720 ELSE 1721 CALL advec_s_pw( i, j, sa ) 1722 ENDIF 1714 1723 ELSE 1715 CALL advec_s_ pw( i, j, sa )1724 CALL advec_s_up( i, j, sa ) 1716 1725 ENDIF 1717 ELSE 1718 CALL advec_s_up( i, j, sa ) 1719 ENDIF 1720 CALL diffusion_s( i, j, sa, & 1721 surf_def_h(0)%sasws, surf_def_h(1)%sasws, & 1722 surf_def_h(2)%sasws, & 1723 surf_lsm_h%sasws, surf_usm_h%sasws, & 1724 surf_def_v(0)%sasws, surf_def_v(1)%sasws, & 1725 surf_def_v(2)%sasws, surf_def_v(3)%sasws, & 1726 surf_lsm_v(0)%sasws, surf_lsm_v(1)%sasws, & 1727 surf_lsm_v(2)%sasws, surf_lsm_v(3)%sasws, & 1728 surf_usm_v(0)%sasws, surf_usm_v(1)%sasws, & 1729 surf_usm_v(2)%sasws, surf_usm_v(3)%sasws ) 1730 1731 CALL user_actions( i, j, 'sa-tendency' ) 1732 1733 ! 1734 !-- Prognostic equation for salinity 1735 DO k = nzb+1, nzt 1736 1737 sa_p(k,j,i) = sa(k,j,i) + ( dt_3d * & 1738 ( tsc(2) * tend(k,j,i) + & 1739 tsc(3) * tsa_m(k,j,i) ) & 1740 - tsc(5) * rdf_sc(k) & 1741 * ( sa(k,j,i) - sa_init(k) ) & 1742 ) * MERGE( 1.0_wp, 0.0_wp, & 1743 BTEST( wall_flags_0(k,j,i), 0 ) ) 1744 1745 IF ( sa_p(k,j,i) < 0.0_wp ) sa_p(k,j,i) = 0.1_wp * sa(k,j,i) 1746 1747 ENDDO 1748 1749 ! 1750 !-- Calculate tendencies for the next Runge-Kutta step 1751 IF ( timestep_scheme(1:5) == 'runge' ) THEN 1752 IF ( intermediate_timestep_count == 1 ) THEN 1753 DO k = nzb+1, nzt 1754 tsa_m(k,j,i) = tend(k,j,i) 1755 ENDDO 1756 ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max )& 1757 THEN 1758 DO k = nzb+1, nzt 1759 tsa_m(k,j,i) = -9.5625_wp * tend(k,j,i) + & 1760 5.3125_wp * tsa_m(k,j,i) 1761 ENDDO 1726 CALL diffusion_s( i, j, sa, & 1727 surf_def_h(0)%sasws, surf_def_h(1)%sasws, & 1728 surf_def_h(2)%sasws, & 1729 surf_lsm_h%sasws, surf_usm_h%sasws, & 1730 surf_def_v(0)%sasws, surf_def_v(1)%sasws, & 1731 surf_def_v(2)%sasws, surf_def_v(3)%sasws, & 1732 surf_lsm_v(0)%sasws, surf_lsm_v(1)%sasws, & 1733 surf_lsm_v(2)%sasws, surf_lsm_v(3)%sasws, & 1734 surf_usm_v(0)%sasws, surf_usm_v(1)%sasws, & 1735 surf_usm_v(2)%sasws, surf_usm_v(3)%sasws ) 1736 1737 CALL user_actions( i, j, 'sa-tendency' ) 1738 1739 ! 1740 !-- Prognostic equation for salinity 1741 DO k = nzb+1, nzt 1742 1743 sa_p(k,j,i) = sa(k,j,i) + ( dt_3d * & 1744 ( tsc(2) * tend(k,j,i) + & 1745 tsc(3) * tsa_m(k,j,i) ) & 1746 - tsc(5) * rdf_sc(k) & 1747 * ( sa(k,j,i) - sa_init(k) ) & 1748 ) * MERGE( 1.0_wp, 0.0_wp, & 1749 BTEST( wall_flags_0(k,j,i), 0 ) ) 1750 1751 IF ( sa_p(k,j,i) < 0.0_wp ) sa_p(k,j,i) = 0.1_wp * sa(k,j,i) 1752 1753 ENDDO 1754 1755 ! 1756 !-- Calculate tendencies for the next Runge-Kutta step 1757 IF ( timestep_scheme(1:5) == 'runge' ) THEN 1758 IF ( intermediate_timestep_count == 1 ) THEN 1759 DO k = nzb+1, nzt 1760 tsa_m(k,j,i) = tend(k,j,i) 1761 ENDDO 1762 ELSEIF ( intermediate_timestep_count < intermediate_timestep_count_max ) & 1763 THEN 1764 DO k = nzb+1, nzt 1765 tsa_m(k,j,i) = -9.5625_wp * tend(k,j,i) + & 1766 5.3125_wp * tsa_m(k,j,i) 1767 ENDDO 1768 ENDIF 1762 1769 ENDIF 1770 1763 1771 ENDIF 1764 1772
Note: See TracChangeset
for help on using the changeset viewer.