<p><b>duda</b> 2010-02-24 14:06:01 -0700 (Wed, 24 Feb 2010)</p><p>When printing domain mass and tracer mass diagnostics, print out global<br>
sums, rather than sums local to the processor. The tracer mass in any <br>
given block can change as tracers are advected through the block, so<br>
global sums are more helpful when checking conservation.<br>
<br>
M src/module_time_integration.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/hyd_model/src/module_time_integration.F
===================================================================
--- branches/hyd_model/src/module_time_integration.F        2010-02-24 20:40:38 UTC (rev 118)
+++ branches/hyd_model/src/module_time_integration.F        2010-02-24 21:06:01 UTC (rev 119)
@@ -71,8 +71,10 @@
integer, dimension(3) :: number_sub_steps
integer :: small_step
logical, parameter :: debug = .false.
+ logical, parameter :: debug_mass_conservation = .true.
real (kind=RKIND) :: domain_mass, tracer_mass, tracer_min, tracer_max
+ real (kind=RKIND) :: global_domain_mass, global_tracer_mass, global_tracer_min, global_tracer_max
!
! Initialize time_levs(2) with state at current time
@@ -302,19 +304,19 @@
if(debug) write(0,*) ' rk step complete - mass diagnostics '
- if(debug) then
+ if(debug .or. debug_mass_conservation) then
domain_mass = 0.
tracer_mass = 0.
block => domain % blocklist
tracer_min = block % time_levs(2) % state % tracers % array (2,1,1)
tracer_max = block % time_levs(2) % state % tracers % array (2,1,1)
do while(associated(block))
- do iCell = 1, block % mesh % nCells
+ do iCell = 1, block % mesh % nCellsSolve
domain_mass = domain_mass + block % time_levs(2) % state % surface_pressure % array (iCell) * &
block % mesh % areaCell % array (iCell) &
- block % time_levs(2) % state % pressure % array (block % mesh % nVertLevels + 1, 1) * &
block % mesh % areaCell % array (iCell)
- do k=1, block % mesh % nVertLevels
+ do k=1, block % mesh % nVertLevelsSolve
tracer_mass = tracer_mass - block % time_levs(2) % state % tracers % array (2,k,iCell) * &
block % time_levs(2) % state % h % array (k,iCell) * &
block % mesh % dnw % array (k) * &
@@ -325,9 +327,13 @@
end do
block => block % next
end do
- write(0,*) ' mass in the domain = ',domain_mass
- write(0,*) ' tracer mass in the domain = ',tracer_mass
- write(0,*) ' tracer_min, tracer_max ',tracer_min, tracer_max
+ call dmpar_sum_real(domain % dminfo, domain_mass, global_domain_mass)
+ call dmpar_sum_real(domain % dminfo, tracer_mass, global_tracer_mass)
+ call dmpar_min_real(domain % dminfo, tracer_min, global_tracer_min)
+ call dmpar_max_real(domain % dminfo, tracer_max, global_tracer_max)
+ write(0,*) ' mass in the domain = ',global_domain_mass
+ write(0,*) ' tracer mass in the domain = ',global_tracer_mass
+ write(0,*) ' tracer_min, tracer_max ',global_tracer_min, global_tracer_max
end if
</font>
</pre>