Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
state_recover_fctry.f90
1
34!
36submodule(state_recover) state_recover_fctry
37 use json_utils, only: json_get_or_default
39 use utils, only: neko_error
40 implicit none
41
42contains
43
48 module subroutine state_recover_factory(recover, neko_case, params)
49 class(state_recover_t), allocatable, intent(inout) :: recover
50 class(case_t), target, intent(inout) :: neko_case
51 type(json_file), intent(inout) :: params
52 character(len=:), allocatable :: recover_type
53
54 call json_get_or_default(params, "type", recover_type, "checkpoint")
55 call state_recover_allocator(recover, recover_type)
56 call recover%init(neko_case, params)
57 end subroutine state_recover_factory
58
62 subroutine state_recover_allocator(recover, recover_type)
63 class(state_recover_t), allocatable, intent(inout) :: recover
64 character(len=*), intent(in) :: recover_type
65
66 if (allocated(recover)) then
67 call recover%free()
68 deallocate(recover)
69 end if
70
71 select case (trim(recover_type))
72 case ("checkpoint", "simulation_checkpoint")
73 allocate(state_recover_checkpoint_t :: recover)
74 case default
75 call neko_error("Unknown state recover type: " // trim(recover_type))
76 end select
77
78 end subroutine state_recover_allocator
79
80end submodule state_recover_fctry
Checkpoint-based state recovery for adjoint runs.
Abstract interface for state recovery strategies.