Skip to content

Commit 0e2a2f9

Browse files
author
garrelt
committed
Edits for Doxygen
1 parent d9f4e36 commit 0e2a2f9

File tree

4 files changed

+95
-28
lines changed

4 files changed

+95
-28
lines changed

clocks.f90

+48-11
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,59 @@
1+
!>
2+
!! \brief This module contains variables and routines for dealing with
3+
!! cpu and wall clocks
4+
!!
5+
!! This module uses calls to the Fortran 2003 internal routines cpu_time
6+
!! and system_clock. To get the time passed between two events, one has
7+
!! to call these twice, once at the start and once at the end.
8+
!! To avoid overflowing the variable (which can happen for codes that run
9+
!! for many hours or days), this module provides "update" routines that
10+
!! update hour and minute counters. These should be called at regular
11+
!! intervals. The module also comes with its own reporting routines.
12+
!!
13+
!! General module
14+
!!
15+
!! Dependencies:
16+
!! - file_admin module (for the unit of the log file where to write the report)
17+
!! - my_mpi (for the value of rank, the MPI id of the current processor, reporting is only done for the rank 0 processor)
18+
!!
19+
!! Author: Garrelt Mellema
20+
!!
21+
!! Date: 2010-03-08
22+
!!
23+
!! Version: 1.0
24+
!!
25+
!<
26+
127
module clocks
228

3-
use precision, only: dp
429
use file_admin, only: logf
530
use my_mpi, only: rank
631

732
implicit none
833

934
! Start and end time for CPU report
10-
real :: cputime1 !< Start time for CPU report
11-
real :: cputime2 !< End time for CPU report
12-
real(kind=dp) :: cpu_seconds=0.0
13-
integer :: cpu_hours=0
14-
integer :: cpu_minutes=0
35+
real :: cputime1 !< Start time for call to CPU routine
36+
real :: cputime2 !< End time for call to CPU routine
37+
38+
integer :: cpu_hours=0 !< accumulates the CPU hours
39+
integer :: cpu_minutes=0 !< accumulates the CPU minutes
40+
real :: cpu_seconds=0.0 !< accumulates the CPU seconds
1541

1642
! Wall clock time variables
17-
integer :: cntr1 !< Start time wall clock
18-
integer :: cntr2 !< End time wall clock
43+
integer :: cntr1 !< Start time for call to wall clock routine
44+
integer :: cntr2 !< End time for call to wall clock routine
45+
1946
integer :: countspersec !< counts per second (for wall clock time)
20-
real(kind=dp) :: clock_seconds=0.0
21-
integer :: clock_hours=0
22-
integer :: clock_minutes=0
47+
48+
integer :: clock_hours=0 !< accumulates the wall clock hours
49+
integer :: clock_minutes=0 !< accumulates the wall clock minutes
50+
real :: clock_seconds=0.0 !< accumulates the wall clock seconds
2351

2452
contains
2553

2654
!=======================================================================
2755

56+
!> Sets up all the clocks (initialization routine)
2857
subroutine setup_clocks
2958

3059
call setup_cpuclock()
@@ -34,6 +63,7 @@ end subroutine setup_clocks
3463

3564
!=======================================================================
3665

66+
!> Sets up cpu clock (initialization routine)
3767
subroutine setup_cpuclock
3868

3969
! Initialize cpu timer
@@ -43,6 +73,7 @@ end subroutine setup_cpuclock
4373

4474
!=======================================================================
4575

76+
!> Sets up wall clock (initialization routine)
4677
subroutine setup_wallclock
4778

4879
! Initialize wall cock timer
@@ -52,6 +83,7 @@ end subroutine setup_wallclock
5283

5384
!=======================================================================
5485

86+
!> Updates all the clocks
5587
subroutine update_clocks
5688

5789
call update_cpuclock
@@ -61,6 +93,7 @@ end subroutine update_clocks
6193

6294
!=======================================================================
6395

96+
!> Updates CPU clock
6497
subroutine update_cpuclock
6598

6699
! Find out intermediate CPU time (to avoid overflowing the counter)
@@ -76,6 +109,7 @@ end subroutine update_cpuclock
76109

77110
!=======================================================================
78111

112+
!> Updates wall clock
79113
subroutine update_wallclock
80114

81115
call system_clock(cntr2,countspersec)
@@ -90,6 +124,7 @@ end subroutine update_wallclock
90124

91125
!=======================================================================
92126

127+
!> Reports all the clocks
93128
subroutine report_clocks
94129

95130
call report_cpuclock
@@ -99,6 +134,7 @@ end subroutine report_clocks
99134

100135
!=======================================================================
101136

137+
!> Reports CPU clock to log file (unit logf)
102138
subroutine report_cpuclock
103139

104140
call update_cpuclock ()
@@ -111,6 +147,7 @@ end subroutine report_cpuclock
111147

112148
!=======================================================================
113149

150+
!> Reports wall clock to log file (unit logf)
114151
subroutine report_wallclock
115152

116153
call update_wallclock ()

cosmological_evolution.f90

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88
!! \b Date: 04-Mar-2006
99
!!
1010
!! The density and lengths and volumes evolve due to the expansion
11-
!! of the Universe
11+
!! of the Universe. The cosmo_evol routines evolves the geometrical
12+
!! variables (r, dr, vol) and the material density variables (ndens)
13+
!! according to the current redshift (zfactor from the cosmology module).
1214
!!
15+
!! \b Programming \b note: this is probably a separate module from the cosmology
16+
!! module because of
17+
!! dependency problems. For the cosmo_evol routines, the grid and material
18+
!! variables have to be available, but for those the cosmology module has
19+
!! to be available. As cosmo_evol really belongs within the cosmology module
20+
!! a different solution would be desirable (GM, 20100308).
1321

1422
module cosmological_evolution
1523

@@ -19,7 +27,7 @@ module cosmological_evolution
1927
! - cosmo_evol: cosmological evolution of space, density
2028

2129
use precision, only: dp
22-
use cosmology
30+
use cosmology, only: zfactor
2331
use grid, only: r,dr,vol
2432
use material, only: ndens
2533

cosmology.F90

+23-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
!>
22
!! \brief This module contains data and routines for cosmological problems
33
!!
4-
!! Module for Capreole / C2-Ray (f90)
4+
!! Module for Capreole / C2-Ray (F90)
55
!!
66
!! \b Author: Garrelt Mellema
77
!!
8-
!! \b Date:
8+
!! \b Date: 2010-03-08 (but older than that)
99
!!
10-
!! This module keeps track of the current redshift
10+
!! This module initializes the cosmology and contains functions for changing
11+
!! redshift to time and vice versa. It also contains cosmological cooling
12+
!! routines. Note that it does not evolve the proper lengths, volumes and
13+
!! densities. This is done in the cosmological_evolution module.
14+
!!
15+
!! List of routines:
16+
!! - cosmology_init: initializes cosmological time and sets lengths
17+
!! and volumes from comoving to proper scaling.
18+
!! - time2zred: convert time to redshift
19+
!! - zred2time: convert redshift to time
20+
!! - cosmo_cool: cosmological adiabatic cooling rate
21+
!! - compton_cool: Compton cooling wrt the CMB.
22+
!!
23+
!! This module keeps track of the current redshift (zred) and the flag
24+
!! for cosmological calculations (cosmological).
1125
!!
1226

1327
module cosmology
1428

15-
! This module contains routines having to do with the cosmological
16-
! evolution
17-
18-
! - cosmology_init: initializes cosmological time and sets lengths
19-
! and volumes from comoving to proper scaling.
20-
! - time2zred: convert time to redshift
21-
! - zred2time: convert redshift to time
22-
! - cosmo_cool: cosmological adiabatic cooling rate
23-
! - compton_cool: Compton cooling wrt the CMB.
2429

2530
use precision, only: dp
2631
use my_mpi
@@ -51,7 +56,7 @@ subroutine cosmology_init (cosmo_switch)
5156

5257
use astroconstants, only: Mpc
5358

54-
logical, intent(in) :: cosmo_switch
59+
logical, intent(in) :: cosmo_switch !< cosmological problem or not?
5560

5661
real(kind=dp) :: zred0
5762

@@ -83,7 +88,11 @@ subroutine cosmology_init (cosmo_switch)
8388

8489
! Initialize redshift
8590
zred_t0=zred0 ! keep initial redshift
86-
zred=0.0 ! needs to be zero, so comoving will be changed to proper
91+
! zred is the master redshift variable, but
92+
! needs to be zero so that grid and material variables will be
93+
! initialized as comoving (z=0) and then changed to proper
94+
! (z=zred_t0).
95+
zred=0.0
8796

8897
endif
8998

radiation.F90

+14-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,22 @@
1212
!!
1313
!! \b Author: Garrelt Mellema
1414
!!
15-
!! \b Date:
15+
!! \b Date: 2010-Mar-08 (but older)
1616
!!
1717
!! \b Version: 1D version similar to the 3D version.
18+
!!
19+
!! <b>Programming note:</b> This version for the 1D code also sets and
20+
!! contains the source properties. In the 3Dm version there is a separate
21+
!! sourceprops module for that. It would be nice to be consistent and also
22+
!! have a source properties module for the 1D version. However, for the 1D
23+
!! version the effective temperature is a real input variable and the
24+
!! photo-ionization rates cannot be calculated before the this variable is
25+
!! set. This means that sourceprops would have to be called before rad_ini
26+
!! (unlike in the 3Dm version where it has to be called after). Also, both
27+
!! sourceprops and radiation would use the romberg integrator, so it should
28+
!! be clear who initializes it (unless the romberg module checks for this
29+
!! itself).
30+
!!
1831

1932
module radiation
2033

0 commit comments

Comments
 (0)