Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
topopt.f90
1program topopt
4 use problem, only: problem_t
5 use optimizer, only: optimizer_t, optimizer_factory
6
7 use json_module, only: json_file
8 use utils, only: neko_error
9 use json_utils_ext, only: json_read_file
10 use neko_top, only: neko_top_register_types
11
12 use mpi_f08, only: mpi_init
13 implicit none
14
15 ! JSON related arguments
16 integer :: argc
17 type(json_file) :: parameters
18 character(len=256) :: parameter_file
19
20 ! MPI parameters
21 integer :: ierr
22
24 type(simulation_t) :: sim
26 class(design_t), allocatable :: des
28 type(problem_t) :: prob
30 class(optimizer_t), allocatable :: opt
31
32 ! -------------------------------------------------------------------------- !
33 ! Initialize the MPI environment
34
35 call mpi_init(ierr)
36 call neko_top_register_types()
37
38 ! -------------------------------------------------------------------------- !
39 ! Read the parameters file as the first terminal argument
40
41 argc = command_argument_count()
42 if (argc .lt. 1) call neko_error('Missing parameter file')
43 call get_command_argument(1, parameter_file)
44
45 ! Read the parameters file
46 parameters = json_read_file(trim(parameter_file))
47
48 ! -------------------------------------------------------------------------- !
49 ! Initialization of the components
50
51 call sim%init(parameters)
52 call design_factory(des, parameters, sim)
53 call prob%init(parameters, des, sim)
54 call optimizer_factory(opt, parameters, prob, des, sim)
55
56 ! -------------------------------------------------------------------------- !
57 ! Execute the optimization
58
59 call opt%run(prob, des, sim)
60
61 ! -------------------------------------------------------------------------- !
62 ! Clean up the components
63
64 call opt%free()
65 call prob%free()
66 call des%free()
67 call sim%free()
68
69 if (allocated(des)) deallocate(des)
70 if (allocated(opt)) deallocate(opt)
71
72end program topopt
Factory function for the design object.
Definition design.f90:136
Factory function for the optimizer.
Definition optimizer.f90:85
Implements the design_t.
Definition design.f90:34
Module for handling the optimization problem.
Definition problem.f90:35
Implements the steady_problem_t type.
An abstract design type.
Definition design.f90:50
Abstract optimizer class.
Definition optimizer.f90:18
The abstract problem type.
Definition problem.f90:61