Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
topopt.f90
Go to the documentation of this file.
1
34
35program topopt
36 use neko, only: neko_init, neko_finalize
37 use simulation_m, only: simulation_t
39 use problem, only: problem_t
41
42 use json_module, only: json_file
43 use json_utils, only: json_get
44 use utils, only: neko_error
45 use json_utils_ext, only: json_read_file
47
48 implicit none
49
50 ! JSON related arguments
51 integer :: argc
52 character(len=256) :: parameter_file
53 type(json_file) :: parameters, design_parameters
54
56 type(simulation_t) :: sim
58 class(design_t), allocatable :: des
60 type(problem_t) :: prob
62 class(optimizer_t), allocatable :: opt
63
64 ! -------------------------------------------------------------------------- !
65 ! Initialize the Neko environment
66
67 call neko_init()
69
70 ! -------------------------------------------------------------------------- !
71 ! Read the parameters file as the first terminal argument
72
73 argc = command_argument_count()
74 if (argc .lt. 1) call neko_error('Missing parameter file')
75 call get_command_argument(1, parameter_file)
76
77 ! Read the parameters file
78 parameters = json_read_file(trim(parameter_file))
79 call json_get(parameters, 'optimization.design', design_parameters)
80
81 ! -------------------------------------------------------------------------- !
82 ! Initialization of the components
83
84 ! initialize the simulation
85 call sim%init(parameters)
86
87 ! initialize the design
88 call design_factory(des, design_parameters, sim)
89
90 ! initialize the problem
91 call prob%init(parameters, des, sim)
92
93 ! initialize the optimizer
94 call optimizer_factory(opt, parameters, prob, des, sim)
95
96 ! -------------------------------------------------------------------------- !
97 ! Execute the optimization
98
99 call opt%run(prob, des, sim)
100
101 ! -------------------------------------------------------------------------- !
102 ! Clean up the components
103
104 call opt%free()
105 call prob%free()
106 call des%free()
107 call sim%free()
108
109 if (allocated(des)) deallocate(des)
110 if (allocated(opt)) deallocate(opt)
111
112 ! Finalize the Neko environment
113 call neko_finalize()
114
115end program topopt
Factory function for the design object.
Definition design.f90:166
Factory function for the optimizer.
Implements the design_t.
Definition design.f90:36
Neko-TOP module.
Definition neko_top.f90:41
subroutine neko_top_register_types()
Add all known types to the Neko registries.
Definition neko_top.f90:62
Defines the abstract type optimizer The optimizer type is defined to provide a generic interface to u...
Definition optimizer.f90:39
Module for handling the optimization problem.
Definition problem.f90:41
Implements the steady_problem_t type.
An abstract design type.
Definition design.f90:54
Abstract optimizer class.
Definition optimizer.f90:54
The abstract problem type.
Definition problem.f90:67