From 330b5f704196cf8dc5d25574c2aea6a8254bec07 Mon Sep 17 00:00:00 2001 From: Quinn Thomas Date: Thu, 23 Oct 2025 11:26:30 -0400 Subject: [PATCH 1/2] Refactor particle BGC logic and light update Refactor particle BGC handling and update light calls. --- src/aed_api.F90 | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/aed_api.F90 b/src/aed_api.F90 index cf7ca0f..905e22a 100644 --- a/src/aed_api.F90 +++ b/src/aed_api.F90 @@ -1405,6 +1405,15 @@ SUBROUTINE aed_run_model(nCols, nLevs, doSurface) !# Pre flux integration tasks CALL pre_kinetics(all_cols(:,col), col, nLevs) + !---------------------------------------------------------------------- + !# Particle BGC is needed BEFORE aed_run_column so bioshade works + IF (do_particle_bgc) THEN + CALL Particles(nLevs) + IF (.NOT. data(col)%active) CYCLE !# skip this column if dry + CALL aed_calculate_particles(all_cols(:,col), col, nLevs) + ENDIF + + !---------------------------------------------------------------------- !# Main time-step tasks CALL aed_run_column(all_cols(:,col), col, nLevs, doSurface) @@ -1413,14 +1422,14 @@ SUBROUTINE aed_run_model(nCols, nLevs, doSurface) !---------------------------------------------------------------------------- !# Particle tracking tasks - IF (do_particle_bgc) THEN + !IF (do_particle_bgc) THEN ! print *,'Particle BGC', call_count, nLevs - CALL Particles(nLevs) - DO col=1, nCols - IF (.NOT. data(col)%active) CYCLE !# skip this column if dry - CALL aed_calculate_particles(all_cols(:,col), col, nLevs) - ENDDO - ENDIF + ! CALL Particles(nLevs) + ! DO col=1, nCols + ! IF (.NOT. data(col)%active) CYCLE !# skip this column if dry + ! CALL aed_calculate_particles(all_cols(:,col), col, nLevs) + ! ENDDO + !ENDIF !------------------------------------------------------------------------------- CONTAINS @@ -1526,6 +1535,10 @@ SUBROUTINE aed_run_column(icolm, col, nlev, doSurface) !# Time-integrate one biological time step CALL calculate_fluxes(icolm, col, nlev, doSurface) + !# Update light needs to be called again so that any diagnostics that + !# influence like (e.g., cdom) have values from calculate_fluxes. + CALL update_light(icolm, col, nlev) + !# Update the water column layers data(col)%cc(:, bot:top) = data(col)%cc(:, bot:top) + dt_eff*flux_pel(:, bot:top) From 14f1a280597ddfe848267e078567567f42e6f877 Mon Sep 17 00:00:00 2001 From: rqthomas Date: Thu, 23 Oct 2025 11:36:01 -0400 Subject: [PATCH 2/2] minor formating --- src/aed_api.F90 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/aed_api.F90 b/src/aed_api.F90 index 905e22a..9bf01d0 100644 --- a/src/aed_api.F90 +++ b/src/aed_api.F90 @@ -1404,14 +1404,13 @@ SUBROUTINE aed_run_model(nCols, nLevs, doSurface) !---------------------------------------------------------------------- !# Pre flux integration tasks CALL pre_kinetics(all_cols(:,col), col, nLevs) - - !---------------------------------------------------------------------- - !# Particle BGC is needed BEFORE aed_run_column so bioshade works - IF (do_particle_bgc) THEN - CALL Particles(nLevs) - IF (.NOT. data(col)%active) CYCLE !# skip this column if dry - CALL aed_calculate_particles(all_cols(:,col), col, nLevs) - ENDIF + + !---------------------------------------------------------------------- + !# Particle BGC is needed BEFORE aed_run_column so bioshade works + IF (do_particle_bgc) THEN + CALL Particles(nLevs) + CALL aed_calculate_particles(all_cols(:,col), col, nLevs) + ENDIF !----------------------------------------------------------------------