Hello,
See my comments and corrections in the code below,
With best regards,
Jean-Michel Hervouet
TYPE(BIEF_OBJ) :: MASKEL
DATA ALREADY/.FALSE./
SAVE ! to store MASKEL for further calls
IF(.NOT.ALREADY) THEN
CALL BIEF_ALLVEC(1,MASKEL,'MASKEL',40,1,1,MESH)
ALREADY=.TRUE.
ENDIF
!!!!!!!! YOU SHOULD DEFINE MASKEL HERE BEFORE THE CALL TO MATMAS !!!!!!!!!!!
OR EVEN WITHIN THE IF(.NOT.ALREADY)... ENDIF
initialisation of MASKEL outside NPLAN-17 NPLAN-14 ?
I suggest :
CALL OS('X=C ',X=MASKEL,C=1.D0)
then maskel is defined per element, so NELEM2 instead of NPOIN2
DO IPLAN = NPLAN-17,NPLAN-14
DO I=1,NELEM2
I3D = I+NELEM2*(IPLAN-1)
IF (IPLAN==NPLAN-17)THEN
MASKEL%R(I3D) = PHI1 ! here I suppose that PHI1 is a double precision number, not an array.
ELSE IF (IPLAN==NPLAN-16)THEN
MASKEL%R(I3D) = PHI2
ELSE IF (IPLAN==NPLAN-15) THEN
MASKEL%R(I3D) = PHI3
ELSE IF (IPLAN==NPLAN-14) THEN
MASKEL%R(I3D) = PHI4
ENDIF
ENDDO
ENDDO
SL1= ?????? coefficient to multiply the result, if not SL1=1.D0, but depending on what you do it could be 1.D0/DT as well
FORMUL=MATMAS
CALL MATRIX(AM1,'M=N ',FORMUL,41,41,SL1,S,S,S,S,S,S,MESH,MSK=.TRUE.,MASKEL)