#2615 closed Bug (fixed)
bug in cpl_define + AGRIF
Reported by: | smasson | Owned by: | smasson |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | SBC | Version: | trunk |
Severity: | minor | Keywords: | |
Cc: |
Description
Context
The bugfix done in cpl_define in cpl_oasis3.F90 [12132] is not working...
#if defined key_agrif IF( agrif_fixed() == Agrif_Nb_Fine_Grids() ) THEN #endif
Analysis
Agrif_Nb_Fine_Grids() is initialized in nemo_gcm when calling
CALL Agrif_Regrid()
but nemo_init -> sbc_init -> cpl_define is called before!
In consequence, for Agrif_Root, Agrif_Nb_Fine_Grids() is not yet defined and is equal to 0, agrif_fixed() == Agrif_Nb_Fine_Grids() is .true. and we call oasis_enddef before chid grids are defined for oasis...
Fix
One solution would be to exclude Agrif_Root() from the test:
#if defined key_agrif IF( agrif_fixed() == Agrif_Nb_Fine_Grids() .and. .not. Agrif_Root() ) THEN #endif
but this won't work if there is no zoom...
We should find a better solution...
Commit History (3)
Changeset | Author | Time | ChangeLog |
---|---|---|---|
14611 | smasson | 2021-03-15T17:00:43+01:00 | |
14434 | smasson | 2021-02-11T09:20:52+01:00 | trunk: fix agrif + coupled model, #2615 |
14429 | smasson | 2021-02-11T08:43:31+01:00 | agrif: add Agrif_Root_Only function, see #2615 |
Change History (6)
comment:1 Changed 4 years ago by smasson
comment:2 Changed 4 years ago by smasson
Ok, it works perfectly... once we fixe the small bugfix in the above code ;-)
Shall we modify ext/AGRIF/AGRIF_FILES/modcurgridfunctions.F90 as suggested?
Or do we prefer to keep AGRIF unchanged and leave a possible error when a user will try to couple the code compiled with AGRIF but used without any zoom?
Changing AGRIF could be done in dev_r14312_MPI_Interface which already uses a modified version of AGRIF...
The bug is also existing in r4.0-HEAD. In this case, I propose to simply add a test on ".not. Agrif_Root()" as proposed in the Fix of the bug, assuming that the user won't try to couple the code compiled with AGRIF without any zoom...
comment:3 Changed 4 years ago by smasson
In 14429:
comment:4 Changed 4 years ago by smasson
In 14434:
comment:5 Changed 4 years ago by smasson
- Resolution set to fixed
- Status changed from new to closed
comment:6 Changed 4 years ago by smasson
In 14611:
Solution proposed by Laurent Debreu to be able to know if the mother grid has children or not: read the first line of AGRIF_FixedGrids.in.
The following function could be added in ext/AGRIF/AGRIF_FILES/modcurgridfunctions.F90: