-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrixi_controller_simple.f90
47 lines (38 loc) · 1.34 KB
/
trixi_controller_simple.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
program trixi_controller_simple_f
use LibTrixi
use, intrinsic :: iso_fortran_env, only: error_unit
use, intrinsic :: iso_c_binding, only: c_int
implicit none
integer(c_int) :: handle
character(len=256) :: argument
if (command_argument_count() < 1) then
call get_command_argument(0, argument)
write(error_unit, '(a)') "ERROR: missing arguments: PROJECT_DIR LIBELIXIR_PATH"
write(error_unit, '(a)') ""
write(error_unit, '(3a)') "usage: ", trim(argument), " PROJECT_DIR LIBELIXIR_PATH"
call exit(2)
else if (command_argument_count() < 2) then
call get_command_argument(0, argument)
write(error_unit, '(a)') "ERROR: missing argument: LIBELIXIR_PATH"
write(error_unit, '(a)') ""
write(error_unit, '(3a)') "usage: ", trim(argument), " PROJECT_DIR LIBELIXIR_PATH"
call exit(2)
end if
! Initialize Trixi
call get_command_argument(1, argument)
call trixi_initialize(argument)
! Set up the Trixi simulation
! We get a handle to use subsequently
call get_command_argument(2, argument)
handle = trixi_initialize_simulation(argument)
! Main loop
do
! Exit loop once simulation is completed
if ( trixi_is_finished(handle) ) exit
call trixi_step(handle)
end do
! Finalize Trixi simulation
call trixi_finalize_simulation(handle)
! Finalize Trixi
call trixi_finalize()
end program