84 REAL*8 :: dt_old , dt_old_old
86 LOGICAL :: stop_flag_old
98 CALL init_problem_param
100 CALL allocate_solver_variables
114 IF( riemann_flag )
THEN 123 IF ( radial_source_flag )
CALL init_source
127 IF ( topo_change_flag )
CALL topography_reconstruction
132 WRITE(*,*)
'******** START COMPUTATION *********' 135 IF ( verbose_level .GE. 1 )
THEN 137 WRITE(*,*)
'Min q(1,:,:)=',minval(q(1,:,:))
138 WRITE(*,*)
'Max q(1,:,:)=',maxval(q(1,:,:))
140 WRITE(*,*)
'Min B(:,:)=',minval(b_cent(:,:))
141 WRITE(*,*)
'Max B(:,:)=',maxval(b_cent(:,:))
144 WRITE(*,*)
'size B_cent',
size(b_cent,1),
size(b_cent,2)
146 WRITE(*,*)
'SUM(q(1,:,:)=',sum(q(1,:,:))
147 WRITE(*,*)
'SUM(B_cent(:,:)=',sum(b_cent(:,:))
151 q1max(:,:) = q(1,:,:)
162 CALL qc_to_qp(q(1:n_vars,j,k) , qp(1:n_vars,j,k) )
168 IF ( output_runout_flag )
CALL output_runout(t,stop_flag)
170 CALL output_solution(t)
172 IF ( sum(q(1,:,:)) .EQ. 0.d0 ) t_steady = t_output
174 WRITE(*,fmt=
"(A3,F10.4,A5,F9.5,A9,ES11.3E3,A11,ES11.3E3,A9,ES11.3E3,A15,ES11.3E3)") &
175 't =',t,
'dt =',dt0, &
176 ' mass = ',dx*dy*sum(q(1,:,:)) , &
177 ' volume = ',dx*dy*sum(qp(1,:,:)) , &
178 ' area = ',dx*dy*count(q(1,:,:).GT.1.d-5) , &
179 ' solid mass = ',dx*dy*sum(q(5:4+n_solid,:,:))
181 DO WHILE ( ( t .LT. t_end ) .AND. ( t .LT. t_steady ) )
187 IF ( verbose_level .GE. 1 )
THEN 189 WRITE(*,*)
'cells to solve and reconstruct:' , count(
solve_mask)
195 IF ( t+dt .GT. t_end ) dt = t_end - t
196 IF ( t+dt .GT. t_output ) dt = t_output - t
198 IF ( output_runout_flag )
THEN 200 IF ( t+dt .GT. t_runout ) dt = t_runout - t
204 dt = min(dt,1.1d0*0.5d0*(dt_old+dt_old_old))
211 CALL update_erosion_deposition_cell(dt)
213 IF ( topo_change_flag )
CALL topography_reconstruction
215 q1max(:,:) = max( q1max(:,:) , q(1,:,:) )
224 CALL qc_to_qp(q(1:n_vars,j,k) , qp(1:n_vars,j,k) )
231 WRITE(*,fmt=
"(A3,F10.4,A5,F9.5,A9,ES11.3E3,A11,ES11.3E3,A9,ES11.3E3,A15,ES11.3E3)")&
233 ' mass = ',dx*dy*sum(q(1,:,:)) , &
234 ' volume = ',dx*dy*sum(qp(1,:,:)) , &
235 ' area = ',dx*dy*count(q(1,:,:).GT.1.d-7) , &
236 ' solid mass = ',dx*dy*sum(q(5:4+n_solid,:,:))
238 IF ( output_runout_flag )
THEN 240 IF ( ( t .GE. t_runout ) .OR. ( t .GE. t_steady ) )
THEN 242 stop_flag_old = stop_flag
244 IF ( output_runout_flag )
CALL output_runout(t,stop_flag)
246 IF ( ( stop_flag ) .AND. (.NOT.stop_flag_old) )
THEN 248 t_steady = min(t_end,t_output)
259 IF ( ( t .GE. t_output ) .OR. ( t .GE. t_end ) )
THEN 261 CALL output_solution(t)
265 WRITE(*,*)
'Time taken by the code is',t2-t1,
'seconds' 271 CALL deallocate_solver_variables
277 WRITE(*,*)
'Time taken by the code is',t2-t1,
'seconds' real *8 dy
Control volumes size.
real *8 t_steady
end time when reached steady solution
subroutine topography_reconstruction
Linear reconstruction.
real *8, dimension(:,:), allocatable b_cent
Topography at the centers of the control volumes.
integer comp_cells_x
Number of control volumes x in the comp. domain.
subroutine read_solution
Read the solution from the restart unit.
real *8 dx
Control volumes size.
real *8 t_end
end time for the run
integer comp_cells_y
Number of control volumes y in the comp. domain.
subroutine deallocate_solver_variables
Memory deallocation.
subroutine update_param
Read the input file.
integer n_vars
Number of conservative variables.
real *8 dt0
Initial time step.
subroutine update_erosion_deposition_cell(dt)
Evaluate the eroion/deposition terms.
subroutine init_grid
Finite volume grid initialization.
logical restart
Flag to start a run from a previous output: .
subroutine output_runout(time, stop_flag)
Write runout on file.
subroutine output_solution(time)
Write the solution on the output unit.
subroutine init_problem_param
Initialization of relaxation flags.
logical riemann_flag
Flag to choose the sort of problem to solve.
subroutine check_solve
Masking of cells to solve.
program sw_var_dens_model
Main Program.
real *8 t_output
time of the next output
subroutine read_param
Read the input file.
subroutine timestep
Time-step computation.
subroutine qc_to_qp(qc, qp)
Conservative to physical variables.
subroutine collapsing_volume
Collapsing volume initialization.
real *8 t_runout
time of the next runout output
subroutine riemann_problem
Riemann problem initialization.
subroutine init_param
Initialization of the variables read from the input file.
subroutine imex_rk_solver
Runge-Kutta integration.
logical, dimension(:,:), allocatable solve_mask
real *8, dimension(:,:), allocatable q1max
Maximum over time of thickness.
logical radial_source_flag
subroutine allocate_solver_variables
Memory allocation.
logical collapsing_volume_flag
integer n_solid
Number of solid classes.
real *8, dimension(:,:,:), allocatable qp
Physical variables ( )
logical output_runout_flag
Flag to save the max runout at ouput times.
real *8 t_start
initial time for the run
real *8, dimension(:,:,:), allocatable q
Conservative variables.