Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
topopt-user.f90
1program topopt_user
3 use problem, only: problem_t
4 use optimizer, only: optimizer_t, optimizer_factory
5 use json_module, only: json_file
6 use utils, only: neko_error
7 use json_utils_ext, only: json_read_file
8 use user, only: user_setup
10
11 use mpi_f08, only: mpi_init
12
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 type(problem_t) :: prob
28 class(design_t), allocatable :: des
30 class(optimizer_t), allocatable :: opt
31
32 ! -------------------------------------------------------------------------- !
33 ! Initialize the MPI environment
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 ! initialize the user additions for the forward (through the neko interface)
50 call user_setup(sim%neko_case%usr)
51
52 ! initialize the simulation
53 call sim%init(parameters)
54
55 ! initialize the design
56 call design_factory(des, parameters, sim)
57
58 ! initialize the problem
59 call prob%init(parameters, des, sim)
60
61 ! initialize the optimizer
62 call optimizer_factory(opt, parameters, prob, des, sim)
63
64 ! -------------------------------------------------------------------------- !
65 ! Execute the optimization
66
67 call opt%run(prob, des, sim)
68
69 ! -------------------------------------------------------------------------- !
70 ! Clean up the components
71
72 call opt%free()
73 if (allocated(opt)) deallocate(opt)
74
75 call prob%free()
76 call des%free()
77 call sim%free()
78
79end program topopt_user
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