Welcome, Guest
Username: Password: Remember me

TOPIC: calling subroutine from BORD3d

calling subroutine from BORD3d 10 years 1 week ago #14778

  • Gaeta
  • Gaeta's Avatar
Hello all.
I actually have a problem with declaration of variables in BORD3d.
I'm implementing this subroutine in order to account for heat exchange with air and I'm interested in giving to subroutine SHORTRAD the sea surface temperature (i.e. TEMP_SW) obtained in the calculation.
I added in the code the following lines:
DOUBLE PRECISION, DIMENSION(:),ALLOCATABLE::TEMP_SW
SAVE
...
ALLOCATE TEMP_SW(NPOIN2)
DO IPOIN2=1,NPOIN2
        TEMP_SW(IPOIN2)=TA%ADR(ITEMP)%P%R(NPOIN3-NPOIN2+IPOIN2)

CALL SHORTRAD
&(TEMP_SW(IPOIN2),...)

ENDDO

I also tried to comment the call to the subroutine, but I always obtained Segmentation Fault -invalid memory reference error :S .


Any help will be very grateful and precious.
Regards

G
The administrator has disabled public write access.

calling subroutine from BORD3d 10 years 1 week ago #14779

  • jmhervouet
  • jmhervouet's Avatar
Hello,

I am not really sure of what you intend to do. I suppose that SHORTRAD will change TEMP_SW(IPOIN2) and that TEMP_SW is used after as an array (if not TEMP_SW needs not be an array and it would simplify the implementation).

An obvious problem in what you do is that TEMP_SW will be allocated at every call. To avoid this use the following trick :

LOGICAL ALREADY
DATA ALREADY/.FALSE./
IF(.NOT.ALREADY) THEN
ALLOCATE TEMP_SW(NPOIN2)
ALREADY=.TRUE.
ENDIF

This problem may cause a memory error.

With best regards,

Jean-Michel Hervouet
The administrator has disabled public write access.
Moderators: pham

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