-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathheatflow.f90
More file actions
109 lines (85 loc) · 5.03 KB
/
heatflow.f90
File metadata and controls
109 lines (85 loc) · 5.03 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
!!!#################################################################################################
!!! This is the main program for HeatFlow
!!! Author: Harry Mclean, Frank Davies, Steven Hepplestone.
!!!#################################################################################################
!!!The program defines variables for timing the execution of the simulation ...
!!!...(cpustart, cpuend, cpustart2) and variables for controlling the simulation...
!!!... (itime, newunit, unit).
!!!The code reads input parameters from files using the read_all_files subroutine.
!!!It sets global variables and arrays using the set_global_variables subroutine.
!!!The program runs an initial evolution step using the initial_evolve subroutine.
!!!It enters a loop that runs the simulation for a specified number of time steps (ntime).
!!!Inside the loop, it checks the verbosity level (iverb) and prints progress...
!!!... information to the console.
!!!It calls the evolve subroutine to perform the time evolution of the system.
!!!It calls the data_write and file_print subroutine to write and show the results.
!!!After the loop, it calculates and prints the total execution time.
!!!Finally, it outputs a message indicating that the simulation is complete.
!!!#################################################################################################
!!!verboisity 0 - no feedback, 1 user needs details, 2, developer needs details, 3 everything
!!!#################################################################################################
program HEATFLOW_V0_3
use constants, only: real12, int12
use constructions, only: heatblock
use output, only: data_write, final_print
use inputs, only: read_all_files, iverb, ntime, LPercentage
use inputs, only: IVERB
use evolution, only: simulate
use setup, only: set_global_variables
use INITIAL, only: initial_evolve
implicit none
real(real12) :: cpustart, cpuend, cpustart2, progress
integer(int12) :: itime
!-------------------------------------------------------------!
! calculate the time to run full simulation !
!-------------------------------------------------------------!
CALL cpu_time(cpustart)
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
! confirm to user that HeatFlow is running
write(*,*) 'HeatFlow is running'
! give feedback to user that code has begun
write(*,*) 'Setup initialising'
!-------------------------------------------------------------!
! Read parameters from input file and set global variables ...!
! ... and arrays !
!-------------------------------------------------------------!
CALL read_all_files()
CALL cpu_time(cpustart2)
CALL set_global_variables()
CALL cpu_time(cpuend)
if (IVERB.ge.1) write(*,'(A,F12.6)') &
' time to complete set_global_variables=', cpuend-cpustart2
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
! give feedback to user that main simulation is begining
write(*,*) 'Setup complete, running simulation'
!-------------------------------------------------------------!
! run simulation for 'ntime' time steps !
!-------------------------------------------------------------!
do itime=1,ntime
if (iverb.eq.0) then
if (Lpercentage) then
progress = real(itime)/real(ntime)*100.0
write(*,'(A,A,F12.4,A)', advance = 'no') achar(13)&
, 'Evolving system, timestep = ', progress, '%'
end if
if ((mod(itime,10000) .eq.0) .and. (.not.Lpercentage)) &
write(*,'(A,A,I12)', advance = 'no') achar(13), 'Evolving system, timestep = ', itime
end if
! CALL initial_evolve to set systems initial Temperature conditions
if (itime .eq. 1) CALL initial_evolve
! run the time evolution
CALL simulate(itime)
! Write results
CALL data_write(itime)
if (IVERB.ge.3) CALL final_print
end do
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
!-------------------------------------------------------------!
! calculate end time and print to user !
!-------------------------------------------------------------!
CALL cpu_time(cpuend)
write(*,'(A,F12.6)') ' time=', cpuend-cpustart
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
! give feedback to user that code has ended
write(*,*) 'all done'
end program HEATFLOW_V0_3