Ignore:
Timestamp:
Jun 21, 2019 9:00:21 PM (2 years ago)
Author:
knoop
Message:

Moved turbulence_closure_mod calls into module_interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/turbulence_closure_mod.f90

    r3776 r4048  
    274274    PUBLIC c_0, rans_const_c, rans_const_sigma
    275275
     276    SAVE
     277
     278    PRIVATE
     279
     280
     281    PUBLIC &
     282       tcm_check_parameters, &
     283       tcm_check_data_output, &
     284       tcm_define_netcdf_grid, &
     285       tcm_init_arrays, &
     286       tcm_init, &
     287       tcm_actions, &
     288       tcm_prognostic_equations, &
     289       tcm_swap_timelevel, &
     290       tcm_3d_data_averaging, &
     291       tcm_data_output_2d, &
     292       tcm_data_output_3d, &
     293       tcm_diffusivities
     294
    276295!
    277296!-- PALM interfaces:
     
    294313
    295314!
    296 !-- Averaging of 3D data for output
    297     INTERFACE tcm_3d_data_averaging
    298        MODULE PROCEDURE tcm_3d_data_averaging
    299     END INTERFACE tcm_3d_data_averaging
    300 
    301 !
    302 !-- Data output of 2D quantities
    303     INTERFACE tcm_data_output_2d
    304        MODULE PROCEDURE tcm_data_output_2d
    305     END INTERFACE tcm_data_output_2d
    306 
    307 !
    308 !-- Data output of 3D data
    309     INTERFACE tcm_data_output_3d
    310        MODULE PROCEDURE tcm_data_output_3d
    311     END INTERFACE tcm_data_output_3d
     315!-- Initialization of arrays
     316    INTERFACE tcm_init_arrays
     317       MODULE PROCEDURE tcm_init_arrays
     318    END INTERFACE tcm_init_arrays
    312319
    313320!
     
    318325
    319326!
    320 !-- Initialization of arrays
    321     INTERFACE tcm_init_arrays
    322        MODULE PROCEDURE tcm_init_arrays
    323     END INTERFACE tcm_init_arrays
    324 
    325 !
    326 !-- Initialization of TKE production term
    327     INTERFACE production_e_init
    328        MODULE PROCEDURE production_e_init
    329     END INTERFACE production_e_init
     327!-- Location specific actions
     328    INTERFACE tcm_actions
     329       MODULE PROCEDURE tcm_actions
     330       MODULE PROCEDURE tcm_actions_ij
     331    END INTERFACE tcm_actions
    330332
    331333!
     
    337339
    338340!
    339 !-- Production term for TKE
    340     INTERFACE production_e
    341        MODULE PROCEDURE production_e
    342        MODULE PROCEDURE production_e_ij
    343     END INTERFACE production_e
    344 
    345 !
    346 !-- Diffusion term for TKE
    347     INTERFACE diffusion_e
    348        MODULE PROCEDURE diffusion_e
    349        MODULE PROCEDURE diffusion_e_ij
    350     END INTERFACE diffusion_e
    351 
    352 !
    353 !-- Diffusion term for TKE dissipation rate
    354     INTERFACE diffusion_diss
    355        MODULE PROCEDURE diffusion_diss
    356        MODULE PROCEDURE diffusion_diss_ij
    357     END INTERFACE diffusion_diss
    358 
    359 !
    360 !-- Mixing length for LES case
    361     INTERFACE mixing_length_les
    362        MODULE PROCEDURE mixing_length_les
    363     END INTERFACE mixing_length_les
    364 
    365 !
    366 !-- Mixing length for RANS case
    367     INTERFACE mixing_length_rans
    368        MODULE PROCEDURE mixing_length_rans
    369     END INTERFACE mixing_length_rans
     341!-- Swapping of time levels (required for prognostic variables)
     342    INTERFACE tcm_swap_timelevel
     343       MODULE PROCEDURE tcm_swap_timelevel
     344    END INTERFACE tcm_swap_timelevel
     345
     346!
     347!-- Averaging of 3D data for output
     348    INTERFACE tcm_3d_data_averaging
     349       MODULE PROCEDURE tcm_3d_data_averaging
     350    END INTERFACE tcm_3d_data_averaging
     351
     352!
     353!-- Data output of 2D quantities
     354    INTERFACE tcm_data_output_2d
     355       MODULE PROCEDURE tcm_data_output_2d
     356    END INTERFACE tcm_data_output_2d
     357
     358!
     359!-- Data output of 3D data
     360    INTERFACE tcm_data_output_3d
     361       MODULE PROCEDURE tcm_data_output_3d
     362    END INTERFACE tcm_data_output_3d
    370363
    371364!
     
    374367       MODULE PROCEDURE tcm_diffusivities
    375368    END INTERFACE tcm_diffusivities
    376 
    377 !
    378 !-- Calculate diffusivities
    379     INTERFACE tcm_diffusivities_default
    380        MODULE PROCEDURE tcm_diffusivities_default
    381     END INTERFACE tcm_diffusivities_default
    382 
    383 !
    384 !-- Calculate diffusivities according to dynamic sgs model
    385     INTERFACE tcm_diffusivities_dynamic
    386        MODULE PROCEDURE tcm_diffusivities_dynamic
    387     END INTERFACE tcm_diffusivities_dynamic
    388 
    389 !
    390 !-- Box-filter method for dynamic sgs model
    391     INTERFACE tcm_box_filter_2d
    392        MODULE PROCEDURE tcm_box_filter_2d_single
    393        MODULE PROCEDURE tcm_box_filter_2d_array
    394     END INTERFACE tcm_box_filter_2d
    395 
    396 !
    397 !-- Swapping of time levels (required for prognostic variables)
    398     INTERFACE tcm_swap_timelevel
    399        MODULE PROCEDURE tcm_swap_timelevel
    400     END INTERFACE tcm_swap_timelevel
    401 
    402     SAVE
    403 
    404     PRIVATE
    405 !
    406 !-- Add INTERFACES that must be available to other modules (alphabetical order)
    407     PUBLIC production_e_init, tcm_3d_data_averaging, tcm_check_data_output,    &
    408            tcm_check_parameters, tcm_data_output_2d, tcm_data_output_3d,       &
    409            tcm_define_netcdf_grid, tcm_diffusivities, tcm_init,                &
    410            tcm_init_arrays, tcm_prognostic_equations, tcm_swap_timelevel
    411369
    412370
     
    19231881
    19241882
     1883!--------------------------------------------------------------------------------------------------!
     1884! Description:
     1885! ------------
     1886!> Execute module-specific actions for all grid points
     1887!--------------------------------------------------------------------------------------------------!
     1888 SUBROUTINE tcm_actions( location )
     1889
     1890
     1891    CHARACTER (LEN=*) ::  location !<
     1892
     1893!    INTEGER(iwp) ::  i !<
     1894!    INTEGER(iwp) ::  j !<
     1895!    INTEGER(iwp) ::  k !<
     1896
     1897!
     1898!-- Here the module-specific actions follow
     1899!-- No calls for single grid points are allowed at locations before and
     1900!-- after the timestep, since these calls are not within an i,j-loop
     1901    SELECT CASE ( location )
     1902
     1903       CASE ( 'before_timestep' )
     1904
     1905
     1906       CASE ( 'before_prognostic_equations' )
     1907
     1908          IF ( .NOT. constant_diffusion )  CALL production_e_init
     1909
     1910
     1911       CASE ( 'after_integration' )
     1912
     1913
     1914       CASE ( 'after_timestep' )
     1915
     1916
     1917       CASE ( 'u-tendency' )
     1918
     1919
     1920       CASE ( 'v-tendency' )
     1921
     1922
     1923       CASE ( 'w-tendency' )
     1924
     1925
     1926       CASE ( 'pt-tendency' )
     1927
     1928
     1929       CASE ( 'sa-tendency' )
     1930
     1931
     1932       CASE ( 'e-tendency' )
     1933
     1934
     1935       CASE ( 'q-tendency' )
     1936
     1937
     1938       CASE ( 's-tendency' )
     1939
     1940
     1941       CASE DEFAULT
     1942          CONTINUE
     1943
     1944    END SELECT
     1945
     1946 END SUBROUTINE tcm_actions
     1947
     1948
     1949!--------------------------------------------------------------------------------------------------!
     1950! Description:
     1951! ------------
     1952!> Execute module-specific actions for grid point i,j
     1953!--------------------------------------------------------------------------------------------------!
     1954 SUBROUTINE tcm_actions_ij( i, j, location )
     1955
     1956
     1957    CHARACTER (LEN=*) ::  location
     1958
     1959    INTEGER(iwp) ::  i
     1960    INTEGER(iwp) ::  j
     1961
     1962!
     1963!-- Here the module-specific actions follow
     1964    SELECT CASE ( location )
     1965
     1966       CASE ( 'u-tendency' )
     1967
     1968!--       Next line is to avoid compiler warning about unused variables. Please remove.
     1969          IF ( i +  j < 0 )  CONTINUE
     1970
     1971       CASE ( 'v-tendency' )
     1972
     1973
     1974       CASE ( 'w-tendency' )
     1975
     1976
     1977       CASE ( 'pt-tendency' )
     1978
     1979
     1980       CASE ( 'sa-tendency' )
     1981
     1982
     1983       CASE ( 'e-tendency' )
     1984
     1985
     1986       CASE ( 'q-tendency' )
     1987
     1988
     1989       CASE ( 's-tendency' )
     1990
     1991
     1992       CASE DEFAULT
     1993          CONTINUE
     1994
     1995    END SELECT
     1996
     1997 END SUBROUTINE tcm_actions_ij
     1998
     1999
    19252000!------------------------------------------------------------------------------!
    19262001! Description:
     
    22052280       ENDIF
    22062281
    2207        CALL production_e( i, j, .FALSE. )
     2282       CALL production_e_ij( i, j, .FALSE. )
    22082283
    22092284       IF ( .NOT. humidity )  THEN
    22102285          IF ( ocean_mode )  THEN
    2211              CALL diffusion_e( i, j, prho, prho_reference )
     2286             CALL diffusion_e_ij( i, j, prho, prho_reference )
    22122287          ELSE
    2213              CALL diffusion_e( i, j, pt, pt_reference )
     2288             CALL diffusion_e_ij( i, j, pt, pt_reference )
    22142289          ENDIF
    22152290       ELSE
    2216           CALL diffusion_e( i, j, vpt, pt_reference )
     2291          CALL diffusion_e_ij( i, j, vpt, pt_reference )
    22172292       ENDIF
    22182293
     
    22752350!
    22762351!--    Production of TKE dissipation rate
    2277        CALL production_e( i, j, .TRUE. )
     2352       CALL production_e_ij( i, j, .TRUE. )
    22782353!
    22792354!--    Diffusion term of TKE dissipation rate
    2280        CALL diffusion_diss( i, j )
     2355       CALL diffusion_diss_ij( i, j )
    22812356!
    22822357!--    Additional sink term for flows through plant canopies
     
    40124087!> Vector-optimized version
    40134088!------------------------------------------------------------------------------!
    4014  SUBROUTINE diffusion_diss()
     4089 SUBROUTINE diffusion_diss
    40154090    USE arrays_3d,                                                             &
    40164091        ONLY:  ddzu, ddzw, drho_air, rho_air_zw
     
    47024777!
    47034778!-- velocities on grid centers:
    4704     CALL tcm_box_filter_2d( u, ut )
    4705     CALL tcm_box_filter_2d( v, vt )
    4706     CALL tcm_box_filter_2d( w, wt )
     4779    CALL tcm_box_filter_2d_array( u, ut )
     4780    CALL tcm_box_filter_2d_array( v, vt )
     4781    CALL tcm_box_filter_2d_array( w, wt )
    47074782
    47084783    DO  i = nxl, nxr
     
    47874862             ENDDO
    47884863
    4789              CALL tcm_box_filter_2d( uc, uct )
    4790              CALL tcm_box_filter_2d( vc, vct )
    4791              CALL tcm_box_filter_2d( wc, wct )
    4792              CALL tcm_box_filter_2d( uc**2, u2t )
    4793              CALL tcm_box_filter_2d( vc**2, v2t )
    4794              CALL tcm_box_filter_2d( wc**2, w2t )
    4795              CALL tcm_box_filter_2d( uc*vc, uvt )
    4796              CALL tcm_box_filter_2d( uc*wc, uwt )
    4797              CALL tcm_box_filter_2d( vc*wc, vwt )
     4864             CALL tcm_box_filter_2d_single( uc, uct )
     4865             CALL tcm_box_filter_2d_single( vc, vct )
     4866             CALL tcm_box_filter_2d_single( wc, wct )
     4867             CALL tcm_box_filter_2d_single( uc**2, u2t )
     4868             CALL tcm_box_filter_2d_single( vc**2, v2t )
     4869             CALL tcm_box_filter_2d_single( wc**2, w2t )
     4870             CALL tcm_box_filter_2d_single( uc*vc, uvt )
     4871             CALL tcm_box_filter_2d_single( uc*wc, uwt )
     4872             CALL tcm_box_filter_2d_single( vc*wc, vwt )
    47984873
    47994874             ld11 = u2t - uct*uct
Note: See TracChangeset for help on using the changeset viewer.