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
40
41
42 implicit none
43
45 character(len=25), parameter :: KNOWN_TYPES(2) = [ character(len=25) :: &
46 "mma", &
47 "steepest_descent"]
48
49contains
50
51 ! -------------------------------------------------------------------------- !
52 ! Interfaces for the factory functions
53
63 module subroutine optimizer_factory(object, parameters, problem, design, &
64 simulation)
65 class(optimizer_t), allocatable, intent(inout) :: object
66 type(json_file), intent(inout) :: parameters
67 class(problem_t), intent(inout) :: problem
68 class(design_t), intent(in) :: design
69 type(simulation_t), optional, intent(in) :: simulation
70
71 character(len=:), allocatable :: type
72
73 if (allocated(object)) then
74 call object%free()
75 deallocate(object)
76 end if
77
78 ! Get the type of the optimizer
79 call json_get(parameters, "optimization.solver.type", type)
80
81 ! Select the optimizer type
82 select case (trim(type))
83 case ("mma")
84 allocate(mma_optimizer_t::object)
85 case ("steepest_descent")
86 allocate(steepest_descent_optimizer_t::object)
87 case default
88 call neko_type_error("Optimizer", type, KNOWN_TYPES)
89 end select
90
91 call object%init_from_json(parameters, problem, design, simulation)
92
93 end subroutine optimizer_factory
94
95
96end submodule optimizer_factory_mod
Implements the design_t.
Definition design.f90:36
Defines the abstract type optimizer.
Definition optimizer.f90:40
Module for handling the optimization problem.
Definition problem.f90:41
Steepest descent optimizer with move limits.