Conversation
Define new variables to track tracer changes due to advection and diffusion. We want to save for now diffusion and advection contribution to the tracer changes. Horizontal and vertical diffusion includes Redi parametrization (if it is set .true.).
Fill __ciso directive to ensure that carbon isotope code works. Medusa interface is added.
Use __coccos in src/CMakeLists.txt to include 2 more phytoplankton classes FESOM2.6-REcoM setup with 4 phytoplankton, 3 zooplankton and 2 detritus functional types. BREAKING CHANGE: FESOM2.6-REcoM setup with 4p3z2d
Correct temperature function for small phytoplankton and diatoms. Previous update for the fouth phytoplankton class and new temperature functions for small phytoplankton and diatoms resulted in very low Phaeocystis biomass. We recognised that this is related to missing code lines in the temperature function which we correct with this update.
…ostics Use namelist.io to activate diagnostics. Sinking velocity of particle (fast and slow) are calculated but not written into a file before. We fix the missing diagnostics for sinking velocity of detritus classes. Besides we Extracted the K0, solubility which is computed in gasx.F90.
…esom2.6_recom_tra_diags
We add __coccos directive to get the correct temperature function in silicate assimilation. In the coccos and Phaeocystis version, it should be dependent on the new temperature function, Temp_diatoms. Use the original Arrhenius function in simpler phytoplankton version. Besides, light limitation diagnostics is corrected. It does affect only the diatoms related output.
Correct reported salt flux bug in oce_ale_tracer.F90. #721
We commented out the linear model where degradation is directly proportional to light intensity and the chlorophyll degradation rate is capped at a maximum of 0.3. Reason for this is the unrealistic air2sea co2 fluxes in the 2p3z2d setup. The reactivated saturation model is more realistic. It accounts for light saturation effects. At low light, degradation increases roughly linearly with PAR At high light, the degradation rate approaches an asymptotic maximum
…tives with namelist parameters Replace preprocessor directives with namelist parameters: * `__3Zoo2Det` → `enable_3zoo2det` * `__coccos` → `enable_coccos` * Enhanced inline comments with ecological significance and biological context *Complete variable/parameter documentation with units and descriptions * Clear sectioning with visual separators and variable definitions * Equation explanations showing mathematical relationships and biological processes * Logic documentation for decision trees and conditional blocks * Comments now explain "why" not just "what" **Sequence Validation** * Generates expected tracer ID list based on configuration * Shows exact ID order and position-by-position comparison **Configuration-Specific Clash Detection** * Full Model (both flags): Don't use IDs 1023-1024 * Coccos-only: Use 1023-1028 (NOT 1029-1034) * 3Zoo2Det-only: Use 1029-1030 for microzoo (NOT 1035-1036) **Validation Checks** * Exact sequence matching against expected IDs * Duplicate ID detection *Forbidden ID detection per configuration BREAKING CHANGE: replace directives with namelist parameter for model configuration
|
CI test for recom is on the way. Any help is welcome @suvarchal |
Still needed @ogurses? |
| !#if defined (__recom) ! not necessarily should belong to recom case | ||
| ! tracers%work%tra_advhoriz = 0.0 ! O:G - tra_diag | ||
| ! tracers%work%tra_advvert = 0.0 | ||
| ttf_rhs_bak = 0.0 |
There was a problem hiding this comment.
Has no impact on CI test, so probably ok. Just flagging to be checked by @patrickscholz
last-minute working on compute time reporting and proposal, can take a look tomorrow |
Problem: Fortran NetCDF library and CDO/NCO tools use different fill value conventions, causing NaN values in tracer initialization. Solution: Make fill value detection more robust: 1. Try _FillValue attribute (Fortran NetCDF standard) 2. Fall back to missing_value attribute (used by CDO/NCO) 3. Use NetCDF default fill value (9.969e+36) if neither exists 4. Broadcast fill value to all MPI ranks This fixes the 'REcoM_DIC: NaN' error during initialization by properly handling land/missing values in input NetCDF files created with different tools. Fixes issue reported by colleague about incompatible fill value conventions between different NetCDF tools.
Added diagnostic output to track where DIC becomes NaN: - Check state(idic) and sms(idic) before DIC calculation - Check DIC after calculation - Print node, depth, lon/lat location when NaN detected - Stop execution immediately to get clean traceback This will help identify whether: 1. The state already contains NaN (initialization issue) 2. The SMS contains NaN (biogeochemistry issue) 3. The addition creates NaN (numerical issue) The error occurs at lon=-43.88, lat=14.55 consistently, so this should pinpoint the exact cause.
Added diagnostic checks at the point where DIC is read from state array and converted for CO2 flux calculation. Since the SMS debug didn't trigger, the NaN must appear between SMS calculation and forcing. This will catch: 1. If state(one,idic) is already NaN when forcing starts 2. If the conversion to REcoM_DIC creates NaN Will print node number, coordinates, and related state values to identify the exact source of NaN.
619ee7c to
c6c21e0
Compare
|
A couple of interesting changes so far. Some of the recom code was missing allocations, that triggered GNU errors. I am left with NANs in one init field that I failed to resolve. @ogurses, @suvarchal: Can you check this out? |
When ballasting is used, vertical sinking is adjusted if the detritus carbon biomass exceeds a treshold value (0.001). This results in large air-sea co2flux uptake. Weremove this constraint.
e5e0fe2 to
075f709
Compare
|
@ogurses, @suvarchal, @patrickscholz |
| if (tracers%data(tr_num)%ltra_diag) then | ||
| do n=1, myDim_nod2D+eDim_nod2D | ||
| nu1 = ulevels_nod2D(n) | ||
| nl1 = nlevels_nod2D(n) | ||
| do nz = nu1, nl1-1 | ||
| ttf_rhs_bak(nz,n) = del_ttf(nz,n) | ||
| end do | ||
| end do | ||
| end if |
There was a problem hiding this comment.
it would be nice if we could encapsulate this in a subroutine not to make our code messy and unreadable! Especially that this pieces repeat itself
| if (tracers%data(tr_num)%ltra_diag) then | ||
| do n=1, myDim_nod2D+eDim_nod2D | ||
| nu1 = ulevels_nod2D(n) | ||
| nl1 = nlevels_nod2D(n) | ||
| do nz = nu1, nl1-1 | ||
| ! horizontal diffusion (w/out Redi) | ||
| tracers%work%tra_diff_part_hor_redi(nz,n,tr_num) = (del_ttf(nz,n) - ttf_rhs_bak(nz,n)) / hnode_new(nz,n) ! Unit [Conc] | ||
| !if (mype==0) print *, tracers%work%tra_diff_part_hor_redi(nz,n,tr_num) | ||
| end do | ||
| end do | ||
| end if |
There was a problem hiding this comment.
Here that same this, this structure repeats itself and could be a re-callable subroutine
|
I talked a while a ago with Sergey about this, and we should try to encapsulate as much of RECOM as we can, To achieve that as much of RECOM lives within the recom_...F90 code files and is only called by function and subroutines (e.g boundary conditions, initialisation, ...). We have been a bit sloppy about this with all the iceberg and transient tracer stuff in the past, which made large part of the FESOM code especially the initialisation, tracer and boundary condition part very crowded and messy and more difficult to maintain. |
|
Perfect task for the AI. I had it search for more cases: Similar repeated-structure cases in REcoM code (candidates for future refactor)
|
Recom refactoring dedup
|
I tried my hands on this, but I was not able to figure out what is wrong with the DIC_PI file. Could your try this out @ogurses ? |
No description provided.