Skip to content
Snippets Groups Projects
sfx_inmcm_ex.f90 1.41 KiB
Newer Older
  • Learn to ignore specific revisions
  • !< @brief an example of using SFX/INMCM interface
    program sfx_inmcm_ex
        
        !> SFX data structures
        use sfx_data, only: meteoDataType, sfxDataType
        !> SFX-INMCM interface
        use sfx_api_inmcm
        !> actual interface of ESM model
        use sfx_esm, only: &
            get_surface_fluxes_esm => get_surface_fluxes, &
            numericsType_esm => numericsType
    
        implicit none
    
        type(meteoDataType) :: meteo_cell
        type(sfxDataType) :: sfx_cell
        type(numericsType_esm) :: numerics
    
        !> INMCM surface layer uses legacy INMCM AR arrays for input/output
        real :: AR1(6), AR2(11)
    
    
        ! --- setting some dummy data
        !   *: the actual values should be supplied by model
        AR1(1) = 10.0       ! wind speed
        AR1(2) = 0.0        ! difference between surface and air temperature
        AR1(3) = 273.15     ! semi-sum of surface and air temperature
        AR1(4) = 0.0        ! difference in surface and air specific humidity
        AR1(5) = 2.0        ! height at which fluxes are evaluated
        AR1(6) = 1.0e-3     ! surface roughness parameter 
    
        ! --- converting AR input to SFX format -> meteo cell
        call inmcm_to_sfx_in_cell(meteo_cell, AR1)
        ! --- calculating fluxes
        call get_surface_fluxes_esm(sfx_cell, meteo_cell, numerics)
        ! --- converting SFX cell output to AR format
        call sfx_to_inmcm_out_cell(AR2, sfx_cell) 
        !   *: now AR can be passed to other parts of INMCM
        
        stop
    end program sfx_inmcm_ex