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
11 use mpi_f08, only: mpi_init
12 implicit none
13
14 ! JSON related arguments
15 integer :: argc
16 type(json_file) :: parameters
17 character(len=256) :: parameter_file
18
19 ! MPI parameters
20 integer :: ierr
21
23 type(simulation_t) :: sim
25 class(design_t), allocatable :: des
27 type(problem_t) :: prob
29 class(optimizer_t), allocatable :: opt
30
31 ! -------------------------------------------------------------------------- !
32 ! Initialize the MPI environment
33
34 call mpi_init(ierr)
35
36 ! -------------------------------------------------------------------------- !
37 ! Read the parameters file as the first terminal argument
38
39 argc = command_argument_count()
40 if (argc .lt. 1) call neko_error('Missing parameter file')
41 call get_command_argument(1, parameter_file)
42
43 ! Read the parameters file
44 parameters = json_read_file(trim(parameter_file))
45
46 ! -------------------------------------------------------------------------- !
47 ! Initialization of the components
48
49 call sim%init(parameters)
50 call design_factory(des, parameters, sim)
51 call prob%init(parameters, des, sim)
52 call optimizer_factory(opt, parameters, prob, des, sim)
53
54 ! -------------------------------------------------------------------------- !
55 ! Execute the optimization
56
57 call opt%run(prob, des, sim)
58
59 ! -------------------------------------------------------------------------- !
60 ! Clean up the components
61
62 call opt%free()
63 call prob%free()
64 call des%free()
65 call sim%free()
66
67 if (allocated(des)) deallocate(des)
68 if (allocated(opt)) deallocate(opt)
69
70end 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