Compiling error - undefined reference to ice routines

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Compiling error - undefined reference to ice routines

#1 Unread post by c.drinkorn »

Hi all,

I recently switched to the COAWST because I want to run both ice and sediments in an Arctic domain but couldn't solve some inconsistencies in the Kate branch code... Howver, now I am unable to solve this compiling error which seems top be about some ice routines:

Code: Select all

/scratch/b/b380636/Arctic20km/obcatmforceriversinisedbulkice/Build/libNLM.a(main3d.o): In function `main3d':
/mnt/lustre01/scratch/b/b380636/Arctic20km/obcatmforceriversinisedbulkice/Build/main3d.f90:206: undefined reference to `ice_flux_mod_mp_ice_flux_rst_'
/mnt/lustre01/scratch/b/b380636/Arctic20km/obcatmforceriversinisedbulkice/Build/main3d.f90:210: undefined reference to `seaice_'
/scratch/b/b380636/Arctic20km/obcatmforceriversinisedbulkice/Build/libNLM.a(ini_fields.o): In function `ini_fields_tile':
/mnt/lustre01/scratch/b/b380636/Arctic20km/obcatmforceriversinisedbulkice/Build/ini_fields.f90:526: undefined reference to `ice_limit_mod_mp_ice_limit_'
make: *** [/scratch/b/b380636/Arctic20km/obcatmforceriversinisedbulkice/coawstG] Error 1
The error about main3d is really strange because in the referenced lines

Code: Select all

            IF (PerfectRST(1).and.iic(1).eq.ntstart(1)) THEN
              DO ig=1,GridsInLayer(nl)
                ng=GridNumber(ig,nl)
                DO tile=first_tile(ng),last_tile(ng),+1
                  CALL ice_flux_rst(ng, tile)
                END DO
              END DO
            ELSE
              CALL seaice
            END IF
the model isn't supposed to call ice_flux_rst at all since I did not set the respective CPP flag.
is this rather a compiler flag problem or is there something inconsistent in the routine wiring?
I tried to solve this the entire day but I just couldn't find the reason.
Any hint will be appreciated very much!

By the way, I also had to fix something in ice_mk.h. The call for caldate doesn't need r_date as an input and caused an error since r_date is not defined at all. I guess this hasn't been fixed after the dateclock changes... So my line 469 looks like this now:

Code: Select all

      CALL caldate(tdays(ng),year,month,yday,hour)
And furthermore, in mod_boundary.F, I had to change the if statement for the definition of XYsize so that it is also run when ICE_MODEL is defined:

Code: Select all

#if defined ADJUST_BOUNDARY || defined ICE_MODEL
      real(r8) :: XYsize
#endif
Otherwhise it will be an unknown variable later in the ICE_MODEL section of the routine...

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: Compiling error - undefined reference to ice routines

#2 Unread post by c.drinkorn »

Hi all,

it seems like I finally solved this one:
In the makefile the link to the SeaIce folder in Nonlinear was (unintentionally?) missing. When I added this one the compiling error vanished. There was a warning that all old commands for the respective targets are being overridden by the new commands.

Could this be considered a bug? Or did I just work around an issue with my set up?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Compiling error - undefined reference to ice routines

#3 Unread post by kate »

There are long-standing disagreements between me and Hernan on a number of things, including where the ice code should live and how to compile. I maintain my own Makefiles which point to the ice code where I put it. Since he's not actually distributing the ice code I feel no pressure to comply. Call it a "community" model breakdown, if you will.

My long-term goal is to be using an actual community model.

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: Compiling error - undefined reference to ice routines

#4 Unread post by arango »

The version of the code that we distribute doesn't have a native sea ice model yet. I am sure that it will be included in the future. It has to be located in a subdirectory inside of the Nonlinear directory, like the biology and sediment models. The reason for it is quite logical and straightforward. We will love to build the tangent linear and adjoint model of such a sea ice model for variational data assimilation (4D-Var). The consensus of the international sea ice modeling community is that such a model needs data assimilation to improve simulations and forecasts.

We will be releasing sometime next year the entire ESMF/NUOPC coupling that allows us to couple the ROMS with atmosphere and a sea ice model. Applications with sea ice modeling need to be inside of a fully coupled system. There are various sea ice models out there. So far, I have coded the NUOPC cap file for CICE. It still needs some testing. Kate gave me access to her favorite sea ice application. We are aware of various groups wanting to add more capabilities for sea ice models to improve the prediction capabilities and address various climate research issues.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: Compiling error - undefined reference to ice routines

#5 Unread post by c.drinkorn »

Thank you Kate and Hernan for your information on the sea ice model status!
I have to clarify (since this was an old post of mine, it probably got lost up there...) that this was about the COAWST branch. But it would be good to hear respective information on this one, too. Is COAWST supposed to have a working (built-in) sea ice model or will I have to couple to CICE instead?
Modelling sea ice is a highly complex thing. I have the greatest respect for everyone who is dealing with it! For my application I really just need the essential effect of sea ice on atmospheric forcing and ice-ocean interaction, i.e. basically the dampening/isolation of atmospheric fluxes and the major processes that affect ocean physics due to ice. To the date I am using an atmospheric forcing mask derived from a Copernicus sea ice data climatology (distinguishing closed and open ice). This is rather crude and not very dynamic (while it at least has a seasonal variability). Still the simulation of the ice doesn't have to be very comprehensive. Basically, I want ROMS to take ice into account at the surface regarding physical fluxes. So I am interested in the most reduced module possible for the ice itself while maybe nudging to observations (so in principle in fact "pseudo-assimilate" real data). Or actually, I would like the model to treat ice as an external forcing like rain or clouds, taking it into account while calculating bulk fluxes at the surface...
What would be your suggestions? :) Thank you!

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Compiling error - undefined reference to ice routines

#6 Unread post by kate »

COAWST has my sea ice in it now, a one-layer dynamic, thermodynamic sea ice model as part of ROMS. This is a rather simpler model than CICE, the community sea ice model. There are several efforts to couple ROMS with CICE, but that may not be what you want now.

There's an effort doing sea ice in a more assimilative fashion: piomas, but not with ROMS.

Cecilia Bitz has taken some small data assimilation steps with CICE and DART.

Actually, for very crude data assimilation, you could use the built-in ROMS nudging feature to nudge ice concentration to satellite values in COAWST.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: Compiling error - undefined reference to ice routines

#7 Unread post by c.drinkorn »

Hi Kate,

thank you! Things are much clearer to me know. I am trying to nudge to a sea ice concentration climatology. I hope I got it right and ROMS will use the M2 nudging time scales for sic?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Compiling error - undefined reference to ice routines

#8 Unread post by kate »

Actually, there is an AInudgcof for nudging to ice concentration climatology. See the Apps_master/Chukchi or the Apps/Beaufort versions of ana_nudgcoef.h.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: Compiling error - undefined reference to ice routines

#9 Unread post by c.drinkorn »

Okay, since I want the same nudging time scales everywhere I just hard coded the number into ana_nudgecoef. Maybe for a more complex nudging time scales field I'd rather provide a file with the coefficients field.

I can see that only switching on ICE_MODEL already takes the ice concentration into account for the surface stress, heat flux and evaporation. Great!
I guess, if I want it to consider the freshwater fluxes from the ice itself I need ICE_THERMO? The way I understand it now, without ICE_THERMO I basically model a rigid ice lid of so and so permeability (due to concentration). And then switching on ICE_THERMO will need more info like which rheology model and so on? I really hesitate to do this. Things seem to get so much more complicated...

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Compiling error - undefined reference to ice routines

#10 Unread post by kate »

Switching on ICE_THERMO should be independent of the ice dynamics (rheology and such). However, you are delving into uncharted territory and should be prepared to look at code to see what is really going on. Perhaps even look at the .f90 files to see what is left without the ice dynamics.

c.drinkorn
Posts: 110
Joined: Thu Mar 08, 2018 2:47 am
Location: German Research Centre for Geosciences

Re: Compiling error - undefined reference to ice routines

#11 Unread post by c.drinkorn »

Okay, looking at the f90 code made it much easier to see what is happening. It also makes it very obvious that the code is not written to work with only ICE_MODEL (and ICE_BULK_FLUXES) switched on, e.g. if it comes to the calculation of the altered heat fluxes due to ice in the bulk_flux routine). This calculation needs the sensible and latent heat over ice which is being calculated inside an ICE_THERMO wrapper only. The way it is written now ROMS should throw an error about qsh_i lacking a value. One could perform this calculation outside of the ICE_THERMO wrapper but it needs a variable called sfc_temp which is depending on tis - the ice surface temperature. There is no way to calculate this temperature without ice thermodynamics. It could be externally provided (satellites can measure this at ease) but I suspect this would make the entire system way too static. I also looked into ice_thermo in order to check whether this calculation could be provided inside bulk_fluxes in a simplified manner but it depends on so many ice internal variables that it makes much more sense to just switch on ICE_THERMO instead. So this is what I'll do know...
On the other hand, one could reduce the formula for SHeat to just take the ice concentration into account without the qsh_i term. I don't have enough insight into ice / heat dynamics to evaluate whether this would make a mess or have a rather small impact. Isn't this more important for the ice dynamics themselves?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Compiling error - undefined reference to ice routines

#12 Unread post by kate »

The code is such that one could make a simpler version of ice_mk.h and include that instead. It's all thermodynamics, not dynamics.

cloudy4568
Posts: 39
Joined: Thu Oct 17, 2019 8:56 pm
Location: Clarkson University

Re: Compiling error - undefined reference to ice routines

#13 Unread post by cloudy4568 »

Hi all,

I encountered the same question, while compiling coawst with ICE_MODEL:

Code: Select all

./Build/libNLM.a(initial.o): In function `initial_':
initial.f90:(.text+0x152b): undefined reference to `__ini_strengthcoef_mod_MOD_ini_strengthcoef'
initial.f90:(.text+0x1547): undefined reference to `__ini_strengthcoef_mod_MOD_ini_strengthcoef'
initial.f90:(.text+0x1562): undefined reference to `__ini_strengthcoef_mod_MOD_ini_strengthcoef'
initial.f90:(.text+0x157d): undefined reference to `__ini_strengthcoef_mod_MOD_ini_strengthcoef'
initial.f90:(.text+0x1598): undefined reference to `__ini_strengthcoef_mod_MOD_ini_strengthcoef'
./Build/libNLM.a(initial.o):initial.f90:(.text+0x15b3): more undefined references to `__ini_strengthcoef_mod_MOD_ini_strengthcoef' follow
./Build/libNLM.a(main3d.o): In function `main3d_':
main3d.f90:(.text+0x8b7): undefined reference to `seaice_'
main3d.f90:(.text+0x195b): undefined reference to `__ice_flux_mod_MOD_ice_flux_rst'
./Build/libNLM.a(ini_fields.o): In function `__ini_fields_mod_MOD_ini_fields_tile':
ini_fields.f90:(.text+0xd8c0): undefined reference to `__ice_limit_mod_MOD_ice_limit'
collect2: error: ld returned 1 exit status
make: *** [coawstM] Error 1
I checked my makefile, and the link seems correct:

Code: Select all

ifdef USE_SEAICE
 modules  +=	ROMS/Nonlinear/SeaIce
endif
***************************************
ifdef USE_SEAICE
 includes +=	ROMS/Nonlinear/SeaIce
endif
Do you have any idea of this? Thanks a lot!

Post Reply