Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
topopt-user.f90
Go to the documentation of this file.
1
34
35program topopt_user
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 user, only: user_setup
48 use continuation_scheduler, only: nekotop_continuation
49
50 implicit none
51
52 ! JSON related arguments
53 integer :: argc
54 character(len=256) :: parameter_file
55 type(json_file) :: parameters, design_parameters
56 character(10) :: time
57 character(8) :: date
58
60 type(simulation_t) :: sim
62 class(design_t), allocatable :: des
64 type(problem_t) :: prob
66 class(optimizer_t), allocatable :: opt
67
68 ! -------------------------------------------------------------------------- !
69 ! Initialize the Neko environment
70
71 call date_and_time(time = time, date = date)
72 call neko_init()
73 call neko_job_info(date, time)
75
76 ! -------------------------------------------------------------------------- !
77 ! Read the parameters file as the first terminal argument
78
79 argc = command_argument_count()
80 if (argc .lt. 1) call neko_error('Missing parameter file')
81 call get_command_argument(1, parameter_file)
82
83 ! Read the parameters file
84 parameters = json_read_file(trim(parameter_file))
85 call json_get(parameters, 'optimization.design', design_parameters)
86
87 ! -------------------------------------------------------------------------- !
88 ! Initialization of the components
89
90 ! initialize the global continuation_scheduler object (nekotop_continuation)
91 call nekotop_continuation%init(parameters)
92
93 ! initialize the user additions for the forward (through the neko interface)
94 call user_setup(sim%neko_case%user)
95
96 ! initialize the simulation
97 call sim%init(parameters)
98
99 ! initialize the design
100 call design_factory(des, design_parameters, sim)
101
102 ! initialize the problem
103 call prob%init(parameters, des, sim)
104
105 ! initialize the optimizer
106 call optimizer_factory(opt, parameters, prob, des, sim)
107
108 ! -------------------------------------------------------------------------- !
109 ! Execute the optimization
110
111 call opt%run(prob, des, sim)
112
113 ! -------------------------------------------------------------------------- !
114 ! Clean up the components
115
116 call opt%free()
117 call prob%free()
118 call des%free()
119 call sim%free()
120 call nekotop_continuation%free()
121
122 if (allocated(des)) deallocate(des)
123 if (allocated(opt)) deallocate(opt)
124
125 ! Finalize the Neko environment
126 call neko_finalize()
127
128end program topopt_user
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