[mpas-developers] Commit Check
Michael Duda
duda at ucar.edu
Fri Aug 27 14:02:31 MDT 2010
Hi, Doug.
Thanks for taking up the suggestion!
The only change that I'd make to the mpas_interface.F file is to
split apart the test
if (config_stats_interval > 0 .and. mod(itimestep, config_stats_interval) == 0) then
into two separate tests
if (config_stats_interval > 0) then
if (mod(itimestep, config_stats_interval) == 0) then
as in the attached mpas_interface.F. The reason for this is a bit
subtle: according to the Fortran standard, a processor is not
required to perform short-cirtuit evaluation. So, in the single
if-test above, a processor could opt to first evaluate the mod()
intrinsic, which would cause a fault if config_stats_interval == 0.
I've actually hit this problem in another code, where I had a test
similar to
if (present(dx) .and. dx > 0.0) then
which was failing (depending on compiler) if dx was not present.
Otherwise, your change works for me with config_stats_interval=0!
Cheers,
Michael
On Fri, Aug 27, 2010 at 02:14:43PM -0400, Doug Jacobsen wrote:
> Hi Michael,
>
> Thanks for the comment. Here is a proposed mpas_interface.F to satisfy your
> suggestion for config_stats_interval=0 disabling the output. This also fixes
> an issue, because config_stats_interval=0 causes the code to not run. Let me
> know if anyone has any issues with this amendment to my previous commit
> check.
>
> Doug
>
> On Fri, Aug 27, 2010 at 1:33 PM, Michael Duda <duda at ucar.edu> wrote:
>
> > Hi, Doug.
> >
> > I gave a quick test to the new files, and everything
> > looks good; I have no objection to committing these
> > to the trunk. Just as a suggestion, it would be
> > nice if one could set config_stats_interval=0 to
> > disable diagnostics computation and output; however,
> > as we do with config_output_interval and
> > config_restart_interval, setting the stats interval
> > beyond the length of the simulation also seems to do
> > the job.
> >
> > Cheers,
> > Michael
> >
> >
> > On Fri, Aug 27, 2010 at 09:11:49AM -0400, Doug Jacobsen wrote:
> > > Hi Developers,
> > >
> > > Here is an updated module_global_diagnostics.F that I am proposing to
> > > replace the current one in core_sw. I have checked it on my laptop, as
> > well
> > > as coyote, lobo, and the fsu hpc. Todd has also checked it, but if anyone
> > > else would like to check it I would appreciate the time. I also propose a
> > > change to namelist.input.sw to add an option to control the output
> > frequency
> > > of these diagnostics.
> > >
> > > If you want to just put it in your trunk/branch to test it, the currently
> > > output variables are as follows.
> > >
> > > iteration #, simulation time, Mass, PV, PE, Total Energy, Coriolis Force
> > > Energy Tendency, Kinetic energy and Potential Energy Tendency, Kinetic
> > > Energy, Potential Energy.
> > >
> > > Thanks!
> > >
> > > Doug
> >
> >
> >
> > > _______________________________________________
> > > mpas-developers mailing list
> > > mpas-developers at mailman.ucar.edu
> > > http://mailman.ucar.edu/mailman/listinfo/mpas-developers
> >
> > _______________________________________________
> > mpas-developers mailing list
> > mpas-developers at mailman.ucar.edu
> > http://mailman.ucar.edu/mailman/listinfo/mpas-developers
> >
-------------- next part --------------
subroutine mpas_setup_test_case(domain)
use grid_types
use test_cases
implicit none
type (domain_type), intent(inout) :: domain
call setup_sw_test_case(domain)
end subroutine mpas_setup_test_case
subroutine mpas_init(block, mesh, dt)
use grid_types
use time_integration
use RBF_interpolation
use vector_reconstruction
implicit none
type (block_type), intent(inout) :: block
type (grid_meta), intent(inout) :: mesh
real (kind=RKIND), intent(in) :: dt
call compute_solve_diagnostics(dt, block % time_levs(1) % state, mesh)
call rbfInterp_initialize(mesh)
call init_reconstruct(mesh)
call reconstruct(block % time_levs(1) % state, mesh)
end subroutine mpas_init
subroutine mpas_query(key, ivalue)
implicit none
character (len=256), intent(in) :: key
integer, intent(out) :: ivalue
if (index(key,'STORAGE_FACTOR') /= 0) then
ivalue = 2
end if
end subroutine mpas_query
subroutine mpas_timestep(domain, itimestep, dt)
use grid_types
use time_integration
use timer
use global_diagnostics
implicit none
type (domain_type), intent(inout) :: domain
integer, intent(in) :: itimestep
real (kind=RKIND), intent(in) :: dt
type (block_type), pointer :: block_ptr
call timestep(domain, dt)
if (config_stats_interval > 0) then
if (mod(itimestep, config_stats_interval) == 0) then
block_ptr => domain % blocklist
if(associated(block_ptr % next)) then
write(0,*) 'Error: computeGlobalDiagnostics assumes ',&
'that there is only one block per processor.'
end if
call timer_start("global_diagnostics")
call computeGlobalDiagnostics(domain % dminfo, &
block_ptr % time_levs(2) % state, block_ptr % mesh, &
itimestep, dt)
call timer_stop("global_diagnostics")
end if
end if
end subroutine mpas_timestep
subroutine mpas_finalize()
implicit none
end subroutine mpas_finalize
More information about the mpas-developers
mailing list