Welcome, Guest
Username: Password: Remember me

TOPIC: spatially varying degradation law

spatially varying degradation law 1 year 3 months ago #43069

  • DHaverson
  • DHaverson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 68
  • Thank you received: 4
Hi,

I'm trying to implement a user defined tracer degradation routine using USER_CALCS2D_DEGRADATION but am running into segmentation faults. Currently using v8p4r0.

The degradation law is dependant on spatially and temporally varying salinity and temperature fields as well as irradiance defined in the atmospheric file. Am currently running the Telemac2d model coupled with waqtel number 11 for thermic successfully and also successfully coupled with waqtel number 187 (11 for thermic and 17 for degradation) using a simpler constant degradation law that varies with time of day only) so am confident it's not related to combining waqtel thermic and degradation.

Am confident the equation is producing the numbers I'm expecting but maybe I'm going wrong somewhere in defining TIMP%ADR(ITRAC)%P%R(I).

DO J = 1,NWAQ_DEGRA
ITRAC = RANK_DEGRA(J)
IF(LOITRAC(ITRAC).EQ.4) THEN
DO I = 1,NPOIN
RADSOL=RAY3%R(I)*EXP((1.7D0/0.9D0)*H%R(I))
PRIVE%ADR(1)%P%R(I)=((0.8D0+0.017D0*TN%ADR(IND_S)%P%R(I))*
& 1.07D0**(TN%ADR(IND_T)%P%R(I)-20.D0)+(RADSOL*0.086D0))*
& (-1/86400.D0)
TIMP%ADR(ITRAC)%P%R(I)=TIMP%ADR(3)%P%R(I)+
& (HPROP%R(I)*PRIVE%ADR(1)%P%R(I))
ENDDO
ENDIF
ENDDO


So far all I can deduce is the segmentation fault occurs in the bilant subroutine which is to do with tracer mass balance.

Any pointers would be greatly appreciated. Find attached the user subroutine.

Cheers

David

File Attachment:

File Name: user_calcs2d_degradation.f
File Size: 3 KB
The administrator has disabled public write access.

spatially varying degradation law 1 year 3 months ago #43071

  • DHaverson
  • DHaverson's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 68
  • Thank you received: 4
Solved my problem!

Nothing wrong with the code, solution was I hadn't included the keyword NUMBER OF PRIVATE ARRAYS = 1 in the steering file.

Cheers

David
The administrator has disabled public write access.
The following user(s) said Thank You: Renault

spatially varying degradation law 1 year 3 months ago #43080

  • pham
  • pham's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1559
  • Thank you received: 602
Hello David,

For next time, if segmentation fault issues occur, you should do as if you get NaN (Not a Number) and told in other posts: you should use a debug configuration with debug options to investigate.
See e.g. the S10.gfortran.debug configuration in the $HOMETEL/configs/systel.edf.cfg configuration file, in particular the flag fflags_debug_gfo for gfortran compiler.
fflags_debug_gfo: -g -Wall -fcheck=all -fbacktrace -fbounds-check -finit-integer=-1 -finit-real=nan -ffpe-trap=invalid,zero,overflow

It will show in which subroutine the issue/nan/segfault occurs, the first suspicious line and may help you to change something in your computation.

Hope this helps,

Chi-Tuan
The administrator has disabled public write access.
The following user(s) said Thank You: DHaverson
Moderators: pham

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.