Hi all,
I'm trying to modify the decay processes in TELEMAC but am having trouble with a formulation which relates decay to the depth of water. I've tried to base this on the example modification in difsou.f and although it compiles without error the model crashes on the first timestep and returns the error:
Program received signal SIGSEGV : Segmentation fault - invalid memory reference
I'm pretty sure this is due to the way in which I modify the implicit source term in difsou.f (extract below)
CALL OS('X=Y ',X=TIMP%ADR(ITRAC)%P)
DO I=1,HPROP%DIM1
DKi = ALFA*IRR*(1.D0-EXP(EXT*HPROP%R(I)))/(EXT*HPROP%R(I))
DEK = DKi + DKt
TIMP%ADR(ITRAC)%P%R(I)=-DEK*86400.D0*HPROP%R(I)
ENDDO
The error does not occur when lines 1 and 5 are commented out however I'm not sure of the correct way to allocate the implicit source term. I've looked through the guide for programming but can't work out what I need to do (I'm relatively new to Fortran). I want to do something like this (below) but this also does not work.
DO I=1,HPROP%DIM1
DKi = ALFA*IRR*(1.D0-EXP(EXT*HPROP%R(I)))/(EXT*HPROP%R(I))
DEK = DKi + DKt
CALL OS('X=CY ',X=TIMP%ADR(ITRAC)%P%R(I), Y=HPROP%R(I),
& C=-DEK*86400.D0)
ENDDO
Any help would be really appreciated.
Thanks
Jonathan