Setting Up a New Case

  • Mohamed Houssem Kasbaoui

Setting Up a New Case

To setup a simulation case, you can modify any of the examples in /path/to/leap/src/cases or create a new one.

To create a new case, start by creating a new file /path/to/leap/src/cases/cdifs_my_new_case.f90. A minimum example will contain the following information

submodule (cdifs_cases) my_new_case_smod
  contains
    module subroutine cdifs_my_new_case(this)
      implicit none
      class(cdifs_case_obj), intent(inout) :: this

      ! Set the block info 
      call cdifs_my_new_case_block(this)
      ! Set the initial fields
      call cdifs_my_new_case_fields(this)
      ! Set boundary conditions
      call cdifs_my_new_case_bcs(this)

      return
    end module subroutine cdifs_my_new_case

    subroutine cdifs_my_new_case_block(this)
      implicit none
      class(cdifs_case_obj), intent(inout) :: this
      ! ...
      return
    end module subroutine cdifs_my_new_case_block
    subroutine cdifs_my_new_case_fields(this)
      implicit none
      class(cdifs_case_obj), intent(inout) :: this
      ! ...
      return
    end module subroutine cdifs_my_new_case_fields
    subroutine cdifs_my_new_case_bcs(this)
      implicit none
      class(cdifs_case_obj), intent(inout) :: this
      ! ...
      return
    end module subroutine cdifs_my_new_case_bcs
end submodule my_new_case_smod

Next, we need to inform the CDIFS solver about this new case. For that, we need to modify the file /path/to/leap/src/cdifs/cdifs_case.f90 to add the case information in the interface section

  module cdifs_cases
  ! ...
  ! ...

    interface
    ! ...
      module subroutine cdifs_my_new_case(this)
       implicit none
       class(cdifs_case_obj), intent(inout) :: this
      end module subroutine cdifs_my_new_case
    ! ...
    end interface

and in the select case section.

  subourtine case_obj_setup(this)
  ! ...
  ! ...

    select case(this%name)
    ! ...
      case ("MY NEW CASE")
        call cdifs_my_new_case(this)
    ! ...
    end select