Roms with ice module in Coawst

General scientific issues regarding ROMS

Moderators: arango, robertson

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

Roms with ice module in Coawst

#1 Unread post by cloudy4568 »

Hi Roms users,

I am using Kate's version Roms with ice module, it could run well as Roms. But the same case is not running in coawst.

In Coawst, if define Roms only, with the same cpp files and input files, it has 'trouble in frazil' error in first steps:

Code: Select all

 trouble in ice_frazil          40          31           9   21.255285453705273       -3705.3862141090412        201.20247142612095        0.0000000000000000       -1.6156899011562551       0.93329775871259102     
When turning 'debug=on', then the error is:

Code: Select all

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x2ab17a3cb3af in ???
#0  0x2ba6230c63af in ???
#0  0x2b3198d233af in ???
#1  0x3e44ee5 in __mod_netcdf_MOD_netcdf_get_fvar_1d
	at /mnt/home/cyue/Build/mod_netcdf.f90:1921
#1  0x3e44ee5 in __mod_netcdf_MOD_netcdf_get_fvar_1d
	at /mnt/home/cyue/Build/mod_netcdf.f90:1921
#1  0x3e44ee5 in __mod_netcdf_MOD_netcdf_get_fvar_1d
	at /mnt/home/cyue/Build/mod_netcdf.f90:1921
#2  0x269afee in get_ngfld_
	at /mnt/home/cyue/Build/get_ngfld.f90:212
#2  0x269afee in get_ngfld_
	at /mnt/home/cyue/Build/get_ngfld.f90:212
#2  0x269afee in get_ngfld_
	at /mnt/home/cyue/Build/get_ngfld.f90:212
#3  0x94b86b in get_data_
	at /mnt/home/cyue/Build/get_data.f90:222
#4  0x5df8fb in initial_
	at /mnt/home/cyue/Build/initial.f90:304
#3  0x94b86b in get_data_
	at /mnt/home/cyue/Build/get_data.f90:222
#5  0x40ad40 in __ocean_control_mod_MOD_roms_initialize
	at /mnt/home/cyue/Build/ocean_control.f90:133
#6  0x4052fc in ocean
	at /mnt/home/cyue/Build/master.f90:95
#7  0x405b01 in main
	at /mnt/home/cyue/Build/master.f90:50
#3  0x94b86b in get_data_
	at /mnt/home/cyue/Build/get_data.f90:222
#4  0x5df8fb in initial_
	at /mnt/home/cyue/Build/initial.f90:304
#4  0x5df8fb in initial_
	at /mnt/home/cyue/Build/initial.f90:304
#5  0x40ad40 in __ocean_control_mod_MOD_roms_initialize
	at /mnt/home/cyue/Build/ocean_control.f90:133
#5  0x40ad40 in __ocean_control_mod_MOD_roms_initialize
	at /mnt/home/cyue/Build/ocean_control.f90:133
#6  0x4052fc in ocean
#6  0x4052fc in ocean
	at /mnt/home/cyue/Build/master.f90:95
#7  0x405b01 in main
	at /mnt/home/cyue/Build/master.f90:50
	at /mnt/home/cyue/Build/master.f90:95
#7  0x405b01 in main
	at /mnt/home/cyue/Build/master.f90:50
The inlet_test which is a Roms-swan coupled case could run well, too.

Do you have any idea of how to solve this question? Any help would be appreciated!

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

Re: Roms with ice module in Coawst

#2 Unread post by kate »

trouble in ice_frazil 40 31 9 21.255285453705273 -3705.3862141090412
If you check this print statement, you'll see that it is telling you the i,j,k location of where it thinks there is trouble. Next are the T and S values there. That S value is not good.

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

Re: Roms with ice module in Coawst

#3 Unread post by cloudy4568 »

Thank you, Kate!

I have tried other advection and vertical diffusion schemes, checked input files(boundary, initial and forcing) which are all normal, and the error is still:

Code: Select all

         1 2018-10-02 00:00:30.00  5.450352E-03  1.430441E+02  1.430496E+02  2.326514E+12
                       (74,33,09)  4.527786E-03  2.774973E-04  5.046834E-04  1.229679E+00
         2 2018-10-02 00:01:00.00  5.281121E-03  1.430346E+02  1.430398E+02  2.326419E+12
                       (74,29,11)  2.350540E-03  4.542726E-04  1.975373E-01  1.201683E+00
         3 2018-10-02 00:01:30.00  5.057286E-03  1.430258E+02  1.430308E+02  2.326329E+12
                       (74,29,11)  1.856574E-03  2.504764E-04  1.844494E-01  1.171497E+00
         4 2018-10-02 00:02:00.00  4.911592E-03  1.430143E+02  1.430192E+02  2.326244E+12
                       (74,35,11)  3.554634E-03  5.728571E-05  1.690516E-01  1.143883E+00
         5 2018-10-02 00:02:30.00  4.797565E-03  1.429911E+02  1.429959E+02  2.326163E+12
                       (74,35,11)  3.478377E-03  3.186098E-05  1.626951E-01  1.116276E+00
         6 2018-10-02 00:03:00.00  4.714752E-03  1.431147E+02  1.431194E+02  2.326087E+12
                       (74,35,11)  3.412585E-03  1.098528E-06  1.558444E-01  1.088762E+00
         7 2018-10-02 00:03:30.00  4.662287E-03  1.440373E+02  1.440420E+02  2.326015E+12
                       (74,35,11)  3.359554E-03  3.586020E-05  1.485620E-01  1.061527E+00
         8 2018-10-02 00:04:00.00  4.652594E-03  1.450470E+02  1.450516E+02  2.325946E+12
                       (74,33,11)  3.803087E-03  3.942606E-04  1.442935E-01  1.034718E+00
         9 2018-10-02 00:04:30.00  4.815528E-03  1.457517E+02  1.457565E+02  2.325881E+12
                       (74,33,11)  3.699496E-03  4.686357E-04  1.399743E-01  1.008800E+00
 trouble in ice_frazil          72           7          11   22.070005243975952       -4078.6710790007814        221.47183958974244        0.0000000000000000       -1.5194044519280856       0.61364222579160199     
 trouble in ice_frazil          72           7  -115.03345945961506       -4078.6710790007814                      -Infinity  -1.5194044519280856       0.61364222579160199     
 trouble in ice_frazil          61           8          11   21.046052096823775       -7819.7310525522053        424.61139615358474        0.0000000000000000       -1.2050742279584683       0.50693885322965893     
 trouble in ice_frazil          61           8  -87.076854248563734       -7819.7310525522053                      -Infinity  -1.2050742279584683       0.50693885322965893     
 trouble in ice_frazil          66           8          11   21.266511483964369       -2976.8131244799474        161.64095265926116        0.0000000000000000       -1.9548662218899091       0.63806409554814680     
 trouble in ice_frazil          66           8  -154.34548576843434       -2976.8131244799474                      -Infinity  -1.9548662218899091       0.63806409554814680     
 trouble in ice_frazil          67           8          11   21.335945950920856       -1817.2588246505845        98.677154178526749        0.0000000000000000       -8.7796137285364058       0.61325188670250241     
 trouble in ice_frazil          67           8  -767.67014334017028       -1817.2588246505857                      -Infinity  -8.7796137285364058       0.61325188670250241     
 trouble in ice_frazil          68           8          11   24.163296669671610       -2015.1501260845400        109.42265184639052        0.0000000000000000       -4.6998147110447279       0.57182676983860892     
It is weird that calculating the exact same case, the salinity is calculated well in Roms, but it is not in Coawst.

What do you think I should do if salinity is very abnormal like this? Thank you very much! I really appreciate this. :D

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

Re: Roms with ice module in Coawst

#4 Unread post by kate »

You can attack this with print statements or by doing the big diff between the two codes. At least you know it's going bad very, very quickly. That sort of problem is easier to debug than those which go bad after days or years of run time.

jcwarner
Posts: 1172
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: Roms with ice module in Coawst

#5 Unread post by jcwarner »

can you try and run without ICE_MODEL and see if the T and S are ok?
that may help identify the issue.
-j

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

Re: Roms with ice module in Coawst

#6 Unread post by cloudy4568 »

Dear Kate and John, thank you so much for your replies!

When ICE_MODEL and CCSM_FLUXES are turned off, Coawst run ends at 120th step without any statements:

Code: Select all

       120 2018-10-02 01:00:00.00  1.017956E-02  1.425615E+02  1.425717E+02  2.320034E+12
                       (65,29,11)  2.889733E-03  8.124888E-04  1.192085E-01  8.955182E-01
 SET_FILTER initialize sum           1     iw:           1
And the error file reports this:

Code: Select all

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x2ba4329d13af in ???
#1  0x56994c in ???
#2  0x56cf09 in ???
#3  0x411197 in ???
#4  0x4040b9 in ???
#5  0x403ba7 in ???
#6  0x4038ec in ???
#7  0x2ba4329bd504 in ???
#8  0x40393b in ???
#9  0xffffffffffffffff in ???
Until the end (120 steps) the T and S are good from outputs.

As control subject, Roms still could run well with the same settings.

If turning debug=on, both Coawst and Roms get the same error:

Code: Select all

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x2aafe27f73af in ???
#0  0x2ad07aafc3af in ???
#0  0x2ab6638013af in ???
#1  0x341a52d in __mod_netcdf_MOD_netcdf_get_fvar_1d
	at /mnt/home/cyue/coawst/Build/mod_netcdf.f90:1929
#2  0x20041a1 in get_ngfld_
	at /mnt/home/cyue/coawst/Build/get_ngfld.f90:212
#1  0x341a52d in __mod_netcdf_MOD_netcdf_get_fvar_1d
	at /mnt/home/cyue/coawst/Build/mod_netcdf.f90:1929
#1  0x341a52d in __mod_netcdf_MOD_netcdf_get_fvar_1d
	at /mnt/home/cyue/coawst/Build/mod_netcdf.f90:1929
#3  0x43470e in get_data_
	at /mnt/home/cyue/coawst/Build/get_data.f90:222
#2  0x20041a1 in get_ngfld_
	at /mnt/home/cyue/coawst/Build/get_ngfld.f90:212
#4  0x4157ca in initial_
	at /mnt/home/cyue/coawst/Build/initial.f90:278
#2  0x20041a1 in get_ngfld_
	at /mnt/home/cyue/coawst/Build/get_ngfld.f90:212
#5  0x40b001 in __ocean_control_mod_MOD_roms_initialize
	at /mnt/home/cyue/coawst/Build/ocean_control.f90:133
#6  0x4052fc in ocean
	at /mnt/home/cyue/coawst/Build/master.f90:95
#7  0x405b01 in main
	at /mnt/home/cyue/coawst/Build/master.f90:50
#3  0x43470e in get_data_
	at /mnt/home/cyue/coawst/Build/get_data.f90:222
#3  0x43470e in get_data_
	at /mnt/home/cyue/coawst/Build/get_data.f90:222
#4  0x4157ca in initial_
	at /mnt/home/cyue/coawst/Build/initial.f90:278
#4  0x4157ca in initial_
	at /mnt/home/cyue/coawst/Build/initial.f90:278
#5  0x40b001 in __ocean_control_mod_MOD_roms_initialize
	at /mnt/home/cyue/coawst/Build/ocean_control.f90:133
#5  0x40b001 in __ocean_control_mod_MOD_roms_initialize
	at /mnt/home/cyue/coawst/Build/ocean_control.f90:133
#6  0x4052fc in ocean
	at /mnt/home/cyue/coawst/Build/master.f90:95
#6  0x4052fc in ocean
	at /mnt/home/cyue/coawst/Build/master.f90:95
#7  0x405b01 in main
	at /mnt/home/cyue/coawst/Build/master.f90:50
#7  0x405b01 in main
	at /mnt/home/cyue/coawst/Build/master.f90:50
What could be the reason for this situation? Thank you very much for your help! :D

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

Re: Roms with ice module in Coawst

#7 Unread post by kate »

What is it trying to read at line 222 of your get_data.f90?

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

Re: Roms with ice module in Coawst

#8 Unread post by cloudy4568 »

Thank you, Kate!

The problem of line 222 of get_data.f90 seems to be solved. Then there are other errors:

Code: Select all

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x2b3cdab703af in ???
#0  0x2ae96a6e93af in ???
#1  0x1854904 in bulk_flux_tile
	at /mnt/home/cyue/coawst/Build/bulk_flux.f90:590
#2  0x18751eb in __bulk_flux_mod_MOD_bulk_flux
	at /mnt/home/cyue/coawst/Build/bulk_flux.f90:128
#3  0x50d436 in main3d_
	at /mnt/home/cyue/coawst/Build/main3d.f90:190
#4  0x409555 in __ocean_control_mod_MOD_roms_run
	at /mnt/home/cyue/coawst/Build/ocean_control.f90:180
#5  0x405a3b in ocean
	at /mnt/home/cyue/coawst/Build/master.f90:108
#1  0x1854904 in bulk_flux_tile
	at /mnt/home/cyue/coawst/Build/bulk_flux.f90:590
#2  0x18751eb in __bulk_flux_mod_MOD_bulk_flux
	at /mnt/home/cyue/coawst/Build/bulk_flux.f90:128
#6  0x405b01 in main
	at /mnt/home/cyue/coawst/Build/master.f90:50
#3  0x50d436 in main3d_
	at /mnt/home/cyue/coawst/Build/main3d.f90:190
#4  0x409555 in __ocean_control_mod_MOD_roms_run
	at /mnt/home/cyue/coawst/Build/ocean_control.f90:180
#5  0x405a3b in ocean
	at /mnt/home/cyue/coawst/Build/master.f90:108
#6  0x405b01 in main
	at /mnt/home/cyue/coawst/Build/master.f90:50
Line 590 of bulk_flux.f90 is:

Code: Select all

!
!  Compute sensible heat flux (W/m2) due to rainfall (kg/m2/s), Hsr.
!
          diffw=2.11E-5_r8*(TairK(i)/273.16_r8)**1.94_r8
          diffh=0.02411_r8*(1.0_r8+TairC(i)*                            &
     &                      (3.309E-3_r8-1.44E-6_r8*TairC(i)))/         &
     &          (rhoAir(i)*blk_Cpa)                                                                       line 590 
          cff=Qair(i)*Hlv(i,j)/(blk_Rgas*TairK(i)*TairK(i))
It seems a normal equation, why would this line has problems? :D

jcwarner
Posts: 1172
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: Roms with ice module in Coawst

#9 Unread post by jcwarner »

well, my guess is the '/' sign, it probably has a zero on the bottom.
.../(rhoAir(i)*blk_Cpa)
so now we start to go backwards.
-blk_Cpa is a constant, so no issue there.
-rhoAir(i) is computed in bulk flux as

rhoAir(i)=PairM*100.0_r8/(blk_Rgas*TairK(i)* &
& (1.0_r8+0.61_r8*Q(i)))
PairM = Pair(i,j) : so if that is 0 from your forc file, it will create a problem.
Can you check your Pair?

-j

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

Re: Roms with ice module in Coawst

#10 Unread post by cloudy4568 »

Thank you, John!

Pair seems good, there is no 0 value and the minimum value is 99817 (mb) in data.

But maybe rhoAir does have problems because when CCSM_FLUX was tried (instead of BULK_FLUX), line 468 also has error:

Code: Select all

 rhoAir(i) = Pair(i,j)*100.0_r8/(blk_Rgas*TairK(i)*            &
     &                    (1.0_r8+0.61_r8*Hair(i,j))) !  Moist air density (kg/m3).
          ssq    = 0.98_r8 * qsat(TseaK) / rhoAir(i)    ! sea surf hum (kg/kg)                        line 468

Code: Select all

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x2b6b8375d3af in ???
#0  0x2b50b81f33af in ???
#1  0x5a6869 in ccsm_flux_tile
	at /mnt/home/cyue/coawst/Build/ccsm_flux.f90:468
#2  0x5e63c8 in __ccsm_flux_mod_MOD_ccsm_flux
	at /mnt/home/cyue/coawst/Build/ccsm_flux.f90:110
#3  0x55dbeb in main3d_
	at /mnt/home/cyue/coawst/Build/main3d.f90:191
#4  0x409555 in __ocean_control_mod_MOD_roms_run
	at /mnt/home/cyue/coawst/Build/ocean_control.f90:180
#5  0x405a3b in ocean
	at /mnt/home/cyue/coawst/Build/master.f90:108
#6  0x405b01 in main
	at /mnt/home/cyue/coawst/Build/master.f90:50
#1  0x5a6869 in ccsm_flux_tile
	at /mnt/home/cyue/coawst/Build/ccsm_flux.f90:468
#2  0x5e63c8 in __ccsm_flux_mod_MOD_ccsm_flux
	at /mnt/home/cyue/coawst/Build/ccsm_flux.f90:110
#3  0x55dbeb in main3d_
	at /mnt/home/cyue/coawst/Build/main3d.f90:191
#4  0x409555 in __ocean_control_mod_MOD_roms_run
	at /mnt/home/cyue/coawst/Build/ocean_control.f90:180
#5  0x405a3b in ocean
	at /mnt/home/cyue/coawst/Build/master.f90:108
#6  0x405b01 in main
	at /mnt/home/cyue/coawst/Build/master.f90:50

jcwarner
Posts: 1172
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: Roms with ice module in Coawst

#11 Unread post by jcwarner »

rhoAir(i)=PairM*100.0_r8/(blk_Rgas*TairK(i)* &
& (1.0_r8+0.61_r8*Q(i)))

can you also check Q(i)?

#if defined CORE_FORCING || defined SPECIFIC_HUMIDITY
! Incoming humidity is specific humidity in (kg/kg)
Q(i)=RH
#else
IF (RH.lt.2.0_r8) THEN !RH fraction
cff=cff*RH !Vapor pres (mb)
Q(i)=0.62197_r8*(cff/(PairM-0.378_r8*cff+eps)) !Spec hum (kg/kg)
ELSE !RH input was actually specific humidity in g/kg
Q(i)=RH/1000.0_r8 !Spec Hum (kg/kg)
END IF
#endif

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

Re: Roms with ice module in Coawst

#12 Unread post by cloudy4568 »

Yes, I defined CORE_FORCING so
Q(i)=RH
RH=Hair(i,j)

and Hair(Qair) are from about 0.0001 to 0.01 (kg/kg) in my input data.

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

Re: Roms with ice module in Coawst

#13 Unread post by cloudy4568 »

Hi, the two problems were solved for my case.

1. Extreme salt values using Coawst when ICE_MODEL is defined.
The equation of salt flux in set_vbc.F is different:in Coawst:

Code: Select all

#    if defined ICE_MODEL || defined CICE_MODEL
#     ifdef NO_SCORRECTION_ICE
          fac_ice = 1.0_r8
#      ifdef ICE_MODEL
          IF(ai(i,j,liold).GE.0.1_r8) fac_ice = 0.0_r8
#      else
          IF(ai(i,j).GE.0.1_r8) fac_ice = 0.0_r8
#      endif
#     endif
          stflx(i,j,isalt)=stflx(i,j,isalt) -                           &
in Roms(Kate version):

Code: Select all

#    if defined ICE_MODEL || defined CICE_MODEL
#     ifdef NO_SCORRECTION_ICE
          fac_ice = 1.0_r8
#      ifdef ICE_MODEL
          IF(ai(i,j,liold).GE.0.1_r8) fac_ice = 0.0_r8
#      else
          IF(ai(i,j).GE.0.1_r8) fac_ice = 0.0_r8
#      endif
#     endif
          stflx(i,j,isalt)=EmP -                                        &
I don't understand the difference of the two equations but when the last line in Coawst was replaced with the line in Roms, the equation is changed from:
stflx(i,j,isalt)=stflx(i,j,isalt) - fac_ice*  Tnudg_SSS(ng)*Hz(i,j,N(ng))*  (t(i,j,N(ng),nrhs,isalt)-sss(i,j))
to
stflx(i,j,isalt)=EmP - fac_ice*  Tnudg_SSS(ng)*Hz(i,j,N(ng))*  (t(i,j,N(ng),nrhs,isalt)-sss(i,j))
then the blowing up problem with extreme salt values was gone.

2. Ccoawst will stop running after several steps when FILTERED is defined.

Code: Select all

# if defined AVERAGES && !defined USE_DEBUG
#  undef FILTERED
# endif
It is a setting in NWGOA case in Roms and I don't understand the reason, either. :?: When undefined FILTERED, Coawst could run my case.

So now my case is running well, Thank you for your help Kate and John. Really appreciate it! :D

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

Re: Roms with ice module in Coawst

#14 Unread post by kate »

FILTERED is the five-day running mean tidal filter on AVERAGE output, one way of detiding things.

Post Reply