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, neko_job_info
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 use continuation_scheduler, only: nekotop_continuation
48
49 implicit none
50
51 ! JSON related arguments
52 integer :: argc
53 character(len=256) :: parameter_file
54 type(json_file) :: parameters, design_parameters
55 character(10) :: time
56 character(8) :: date
57
59 type(simulation_t) :: sim
61 class(design_t), allocatable :: des
63 type(problem_t) :: prob
65 class(optimizer_t), allocatable :: opt
66
67 ! -------------------------------------------------------------------------- !
68 ! Initialize the Neko environment
69
70 call date_and_time(time = time, date = date)
71 call neko_init()
72 call neko_job_info(date, time)
74
75 ! -------------------------------------------------------------------------- !
76 ! Read the parameters file as the first terminal argument
77
78 argc = command_argument_count()
79 if (argc .lt. 1) call neko_error('Missing parameter file')
80 call get_command_argument(1, parameter_file)
81
82 ! Read the parameters file
83 parameters = json_read_file(trim(parameter_file))
84 call json_get(parameters, 'optimization.design', design_parameters)
85
86 ! -------------------------------------------------------------------------- !
87 ! Initialization of the components
88
89 ! initialize the global continuation_scheduler object (nekotop_continuation)
90 call nekotop_continuation%init(parameters)
91
92 ! initialize the simulation
93 call sim%init(parameters)
94
95 ! initialize the design
96 call design_factory(des, design_parameters, sim)
97
98 ! initialize the problem
99 call prob%init(parameters, des, sim)
100
101 ! initialize the optimizer
102 call optimizer_factory(opt, parameters, prob, des, sim)
103
104 ! -------------------------------------------------------------------------- !
105 ! Execute the optimization
106
107 call opt%run(prob, des, sim)
108
109 ! -------------------------------------------------------------------------- !
110 ! Clean up the components
111
112 call opt%free()
113 call prob%free()
114 call des%free()
115 call sim%free()
116 call nekotop_continuation%free()
117
118 if (allocated(des)) deallocate(des)
119 if (allocated(opt)) deallocate(opt)
120
121 ! Finalize the Neko environment
122 call neko_finalize()
123
124end program topopt
Factory function for the design object.
Definition design.f90:167
Factory function for the optimizer.
Continuation scheduler for the optimization loop.
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.
Definition optimizer.f90:40
Module for handling the optimization problem.
Definition problem.f90:41
Implements the steady_problem_t type.
An abstract design type.
Definition design.f90:53
Abstract optimizer class.
Definition optimizer.f90:60
The abstract problem type.
Definition problem.f90:67