Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
optimizer_factory.f90
1
34
35submodule(optimizer) optimizer_factory_mod
36 use json_utils, only: json_get
37 use utils, only: neko_type_error
38 use mma_optimizer, only: mma_optimizer_t
39
40
41 implicit none
42
44 character(len=25), parameter :: KNOWN_TYPES(1) = [ character(len=25) :: &
45 "mma"]
46
47contains
48
49 ! -------------------------------------------------------------------------- !
50 ! Interfaces for the factory functions
51
61 module subroutine optimizer_factory(object, parameters, problem, design, &
62 simulation)
63 class(optimizer_t), allocatable, intent(inout) :: object
64 type(json_file), intent(inout) :: parameters
65 class(problem_t), intent(inout) :: problem
66 class(design_t), intent(in) :: design
67 type(simulation_t), optional, intent(in) :: simulation
68
69 character(len=:), allocatable :: type
70
71 if (allocated(object)) then
72 call object%free()
73 deallocate(object)
74 end if
75
76 ! Get the type of the optimizer
77 call json_get(parameters, "optimization.solver.type", type)
78
79 ! Select the optimizer type
80 select case (trim(type))
81 case ("mma")
82 allocate(mma_optimizer_t::object)
83 case default
84 call neko_type_error("Optimizer", type, KNOWN_TYPES)
85 end select
86
87 call object%init_from_json(parameters, problem, design, simulation)
88
89 end subroutine optimizer_factory
90
91
92end submodule optimizer_factory_mod
Implements the design_t.
Definition design.f90:36
Module for handling the optimization problem.
Definition problem.f90:41