Skip to content

Commit

Permalink
Feature/cesm timingtables secsday columns (UW-Hydro#746)
Browse files Browse the repository at this point in the history
* populate nrecs, endyear, endmonth and endday in global_param struct for secs/day columns in timing tables for CESM driver

* ran uncrustify

* add release notes entry

* update PR number in release notes entry
  • Loading branch information
Diana Gergel authored and Joe Hamman committed Sep 5, 2017
1 parent b63a0d9 commit 5317327
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
8 changes: 6 additions & 2 deletions docs/Development/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ To check which release of VIC you are running:

Updates the cesm_put_data.c routine in the CESM driver to include the correct signs for the wind stresses and fixes a bug in calculating friction velocity (previously it was missing a square root).

[GH#744] (https://github.com/UW-Hydro/VIC/pull/744)
[GH#744](https://github.com/UW-Hydro/VIC/pull/744)

Updates the cesm_interface_c.c routine to include missing timers and the VIC RUN timer in the CESM driver.
Updates the cesm_interface_c.c routine to include missing timers and the VIC RUN timer in the CESM driver.

[GH#746](https://github.com/UW-Hydro/VIC/pull/746)

Updates the cesm_interface_c.c routine in the CESM driver to populate the nrecs, endyear, endmonth and endday fields in the global_param struct to make them available to vic_finalize for timing tables (specifically the secs/day columns).

3. Speed up NetCDF operations in the image/CESM drivers ([GH#684](https://github.com/UW-Hydro/VIC/pull/684))

Expand Down
2 changes: 1 addition & 1 deletion vic/drivers/cesm/cpl_mct/lnd_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ SUBROUTINE lnd_final_mct(EClock, cdata, x2l, l2x, cdata_s, x2s, s2x)
CHARACTER(len=*), PARAMETER :: subname = '(lnd_final_mct)'

!--- clean up
errno = vic_cesm_final()
errno = vic_cesm_final(vclock)

IF (errno /= 0) THEN
CALL shr_sys_abort(subname//' ERROR: vic_cesm_final returned a errno /= 0')
Expand Down
3 changes: 2 additions & 1 deletion vic/drivers/cesm/include/vic_driver_cesm.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ typedef struct {

void advance_vic_time(void);
void assert_time_insync(vic_clock *vclock, dmy_struct *dmy);
void finalize_cesm_time(vic_clock *vclock);
void get_global_param(FILE *);
void initialize_cesm_time(void);
void initialize_l2x_data(void);
Expand All @@ -178,7 +179,7 @@ void validate_options(option_struct *options);
void vic_cesm_alloc(void);
int vic_cesm_init_mpi(int MPI_COMM_VIC_F);
int vic_cesm_init(vic_clock *vclock, case_metadata *cmeta);
int vic_cesm_final(void);
int vic_cesm_final(vic_clock *vclock);
void vic_cesm_finalize(void);
int vic_cesm_run(vic_clock *vclock);
void vic_force(void);
Expand Down
5 changes: 4 additions & 1 deletion vic/drivers/cesm/src/cesm_interface_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,16 @@ vic_cesm_run(vic_clock *vclock)
* @brief Finalize function for CESM driver
*****************************************************************************/
int
vic_cesm_final()
vic_cesm_final(vic_clock *vclock)
{
// continue vic all timer
timer_continue(&(global_timers[TIMER_VIC_ALL]));
// start vic final timer
timer_start(&(global_timers[TIMER_VIC_FINAL]));

// finalize time
finalize_cesm_time(vclock);

// clean up
vic_cesm_finalize();

Expand Down
3 changes: 2 additions & 1 deletion vic/drivers/cesm/src/cesm_interface_f.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ END FUNCTION vic_cesm_run
!> @brief Finalize Interface
!--------------------------------------------------------------------------
INTERFACE
INTEGER(C_INT) FUNCTION vic_cesm_final() BIND(C, name='vic_cesm_final')
INTEGER(C_INT) FUNCTION vic_cesm_final(vclock) BIND(C, name='vic_cesm_final')
USE, INTRINSIC :: ISO_C_BINDING
USE vic_cesm_def_mod
IMPLICIT NONE
TYPE(vic_clock), INTENT(in) :: vclock
END FUNCTION vic_cesm_final
END INTERFACE

Expand Down
16 changes: 16 additions & 0 deletions vic/drivers/cesm/src/vic_cesm_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ initialize_cesm_time(void)
global_param.time_units, &dmy_current);
}

/******************************************************************************
* @brief Finalize cesm time
*****************************************************************************/
void
finalize_cesm_time(vic_clock *vclock)
{
extern size_t current;
extern global_param_struct global_param;

// populate fields in global_param needed for timing tables
global_param.nrecs = current;
global_param.endyear = vclock->current_year;
global_param.endmonth = vclock->current_month;
global_param.endday = vclock->current_day;
}

/******************************************************************************
* @brief Advance one timestep
*****************************************************************************/
Expand Down

0 comments on commit 5317327

Please sign in to comment.