Fix/pism jsbach vegetation coupling#1427
Open
YugengChen wants to merge 5 commits intoesm-tools:releasefrom
Open
Fix/pism jsbach vegetation coupling#1427YugengChen wants to merge 5 commits intoesm-tools:releasefrom
YugengChen wants to merge 5 commits intoesm-tools:releasefrom
Conversation
The DOMAIN_pism variable was not being exported to ECHAM-side coupling scripts, causing the Greenland GLAC mask update conditional to never execute. This fix: - Extracts DOMAIN_pism from various config paths (model2, pism, echam) - Exports it to the ECHAM environment - Defaults to 'greenland' if not found Fixes deglaciation detection always returning zero changed cells.
Add utility scripts to fix restart file inconsistencies during PISM-JSBACH coupling: - fix_jsbach_restart_cover_fract.py: Sync cover_fract in restart with jsbach.nc after deglaciation updates - fix_veg_restart_pot_fpc.py: Sync pot_fpc with cover_fract to prevent dynveg module state mismatch - fix_veg_restart_act_fpc.py: Initialize act_fpc for deglaciated points using pot_fpc values (critical for vegetation growth) - fix_jsbach_tiny_values.py: Remove 1e-10 artifacts from jsbach_init_file - fix_desert_fpc_safe.py: Set desert_fpc=0 for deglaciated areas These fixes prevent 'malloc(): invalid size' crashes and enable vegetation recovery in newly ice-free areas.
This commit includes several interrelated fixes:
1. Fix target_orography file order:
- Check file existence before using target_orography
- Fall back to latest_target_orography.nc from previous iteration
- Prevents 'No such file' errors on first coupling iteration
2. Fix WORK_DIR synchronization:
- Copy modified restart files to WORK_DIR after coupling updates
- esm_runscripts copies files BEFORE coupling runs, so explicit
sync is required
3. Fix monthly restart handling:
- Add ensure_echam_restart_aliases_for_m_streams() function
- Do NOT copy jsbachm.nc/vegm.nc (accumulated monthly means)
- Create correct symlinks: jsbachm.nc -> jsbach.nc
- Prevents 'cover_fract sum = 450' corruption
4. Greenland GLAC mask update:
- Add DOMAIN_pism == 'greenland' conditional (matching nhem)
- Update unit.24 GLAC in multiple locations
- Fix deglaciated area GLAC to use ice_mask directly
5. Integration of Python helper scripts for restart fixes
6. Force lgfw=.false. in namelist.echam to prevent IO errors
…ll chunk When coupling PISM to atmosphere, use the last 100 years of PISM output for time averaging instead of the entire chunk. This provides more relevant boundary conditions for the atmosphere model when running long PISM integrations. - Calculate averaging start year as max(chunk_start, chunk_end - 99) - Add selyear filter before timmean - Handle chunks shorter than 100 years gracefully
- Fix lapse rate comparison: Use 'bc' for floating-point comparison instead of bash integer comparison (-gt), which fails for decimals - Disable some cleanup_list entries to preserve intermediate files for debugging
ackerlar
reviewed
Feb 3, 2026
| # === FINAL FIX: Force lgfw=.false. in namelist.echam === | ||
| # Even with namelist modification files, lgfw sometimes persists as .true. | ||
| # causing IO_read_stream failures for 'gfw'. We patch it directly here. | ||
| if [ -n "${WORK_DIR}" ] && [ -f "${WORK_DIR}/namelist.echam" ]; then |
Collaborator
There was a problem hiding this comment.
why would you want lgfw=.false.?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes multiple issues preventing vegetation recovery in deglaciated areas during PISM-AWI-ESM coupled simulations.
Changes
1. Export DOMAIN_pism to ECHAM environment
DOMAIN_pismvariable was not exported, causing Greenland GLAC mask updates to fail2. Add Python helper scripts for restart synchronization
fix_jsbach_restart_cover_fract.py: Sync cover_fract after deglaciationfix_veg_restart_pot_fpc.py: Sync pot_fpc with cover_fractfix_veg_restart_act_fpc.py: Initialize act_fpc for deglaciated pointsfix_jsbach_tiny_values.py: Remove 1e-10 artifactsfix_desert_fpc_safe.py: Set desert_fpc=0 for deglaciated areas3. Multiple fixes in coupling_ice2echam.functions
4. PISM output averaging
5. Minor fixes
Testing
Tested with PISM-AWI-ESM Greenland simulation (tidal_veg experiment).
Successfully ran 50+ years with active vegetation recovery in deglaciated areas.
Related Issues
Fixes vegetation not growing in newly ice-free Greenland regions.