Bren,
You probably would not gain a lot of run time efficiency, but the program flow may be more understandable with the following program example. This would definately lead to significant programming and debugging efficiency!
You would probably be advised to similarly structure 'DO_SOME_USEFUL_MATHS' as I would expect there are a number of numerical phases to this computation also.
Regards John
Module experiment_data
( declare most useful variables)
end Module experiment_data
Program test_options
use experiment_data
!
logical use_this_option
external use_this_option
call initialise_all data
DO experiment=1,10
DO velocity=v1, v2, dv
if ( .not. use_this_option (experiment, velocity) ) cycle
call run_this_model (experiment, velocity)
call report_this_run
ENDDO !velocity loop
ENDDO !experiment loop
call summarise_all_runs
end Program test_options
subroutine run_this_model (experiment, velocity)
!
! note : experiment and velocity are not in the module.
! putting key do loop variables in modules can be a risky programing approach
!
use experiment_data
DO I=1,200 !this loop switches between rows of my domain
DO J=1,200 !switches between columns of the domain
DO_SOME_USEFUL_MATHS
ENDDO !J-loop
ENDDO !I=loop
end subroutine run_this_model
logical function use_this_option (experiment, velocity)
use experiment_data
!
! you can use this area to test for un-necessary run options and probably
! save a lot of run time
!
...
end logical function use_this_option
I gave an example above of declaring an external function. You could possibly declare them in the MODULE, and then possibly use CONTAINS and include the function code as well. Unfortunately, I am yet to use these constructs in my programming approach, as I am yet to identify the benefits this approach provides. I continue to develop libraries of routines, typical of a pre-f90 approach.
I hope the above programming example helps. If anyone disagrees I would look forward to learning from their different approach.