2 small bugs with averages_detide

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
hugobastos
Posts: 15
Joined: Tue May 06, 2008 8:46 pm
Location: FURG

2 small bugs with averages_detide

#1 Unread post by hugobastos »

Hello to all,

I think that i have found 2 little bugs in the code associated with detide options:


First bug

The file set_avg.F has a small bug in the end of file that break the make process for 2d apps; the endif statement is inside the #ifdef SOLVE3D directive , so when building without SOLVE3D the endif is missing (with AVERAGES+AVERAGES_DETIDE).

File: set_avg.F
Routine: set_detide_tile
SVNID: svn $Id: set_avg.F 513 2010-09-22 20:05:50Z arango $

patch:

Code: Select all

2621d2620
<       END IF
2622a2622
>       END IF
Second Bug

There is a missing directive to close the netcdf tidal forcing file after reading the tidal forcing fields. This is need because the nf90_open failed to open the file (because he is already open!). This was tricky because this bug only happens when u use hdf5/netcdf4 files ( :?: :idea: )...

The case:

Recently i change all files to netcdf4, but forgot that the tides generally is created with n3 format. So when u try to run the model with detides plus n3 tidal frcfile, the model returns an error when trying to define a deflate level when writing the first "detide" variable CosWCosW (netcdf-4 operation in a netcdf3 file).

The most basic solution after this problem :
transform the tidal frcfile with nccopy (-k3 or -k4) and run the model again...but, when u do this, the model return an strange error (in def_tides) of not been able to open the file,just after they read the Aplitudes,periods,etc.

So,in the routine get_idata.F,before the call for def_tides we need to close the tidal forcing file to be reopened in the def_tides routine.


file: set_idata.F
routine: get_idata
SVNID: !svn $Id: get_idata.F 462 2010-05-26 17:49:25Z arango $

Patch:

Code: Select all

199a200,202
>      CALL netcdf_close(ng,iNLM,ncFRCid(idTvph,ng))
>       IF (exit_flag.ne.NoError) RETURN
> 
Hope that helps :mrgreen:

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

Re: 2 small bugs with averages_detide

#2 Unread post by arango »

Yes, good catch about the first bug. Thank you. Now, I need to think more about the second bug. There is not need to close the file. The fact that you have to do this indicates to me that the problem is somewhere else. Perhaps, the logic with TIDEname and ncTIDEid is failing. I have to look this in the debugger. Perhaps, I need to initialize in 2D applications from the forcing IDs.

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

Re: 2 small bugs with averages_detide

#3 Unread post by arango »

This is now corrected in the following tack :arrow: ticket. Please update. I will look at the other issued about the tidal forcing NetCDF file later.

Post Reply