Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Matrix Modification by itself

Gaurav_K_2
Beginner
340 Views

Hi, 

I am trying to run UMAT for ABAQUS using intel FORTRAN compiler but I am finding some issue while handling some matrices.

EXAMPLE:

following is the small part of my code in which I am filling values in SS which is a predefined array of length 6. I have STRESS array with length 6     and already have some values.

      HYD=0.D0
      SS=0.D0
      DO I=1,3
          HYD=HYD+STRESS(I)
      END DO
      HYD=HYD/3.0   
      DO K1=1,3
          SS(K1)=STRESS(K1)-HYD
      END DO
      DO K1=4,6
          SS(K1)=STRESS(K1)                                            
      END DO

as a result of this code I should get SS(4)=STRESS(4) , SS(5)=STRESS(5), SS(6)=STRESS(6)

but it is slightly different than values in STRESS array.

Please help me if you know what is causing this issue.

Thanks.

Regards,

Gaurav K

 

0 Kudos
2 Replies
Johannes_Rieke
New Contributor III
340 Views

Hi Gaurav,

it would be better if you provide the whole function/subroutine including the necessary includes/non intrinsic modules, so that the variable declarations can be seen.

So it can be only guessed that a precision loss is the cause of the difference. What do you exactly mean with 'slightly different'? 1.0e-13?

Your code snippet can also be written as:

! better 'use, intrinsic :: ISO_FORTRAN_ENV' -> real64 instead of d0
! d0 is allso OK

HYD=0.0_real64 
SS=0.0_real64

HYD=sum(STRESS(1:3))/3.0_real64

SS(1:3) = STRESS(1:3)-HYD

SS(4:6) = STRESS(4:6)

However, besides extending 3.0 to a double 3.0_real64 the code above should do excatly the same as yours. So the 'difference' between SS(4:6) and STRESS (4:6) should be unchanged.

Regards, Johannes

0 Kudos
Greg_T_
Valued Contributor I
340 Views

Hi Gaurav,

How are you comparing the expected values in the SS array?  Are you looking at stress results in the output data (*.dat) file, or some other output? 

The Abaqus output data file generally writes 5 significant digits for stress or displacement values, so that may not be enough for your comparison.  One possibility is to write intermediate values from the user subroutine to the message (*.msg) file using file unit 7.  The Abaqus Analysis User's Guide section 3.7.1 gives the Fortran file unit numbers that can be used to write information from a user subroutine.  I've found writing values with more digits to the message file very helpful when diagnosing a user subroutine.

Another recommendation is to write a main program that can call the user subroutine to test it outside of an Abaqus analysis.  I've found this approach very useful to be able to run several tests on the user subroutine to confirm that it is working correctly before using it in an Abaqus analysis.

Hopefully more output of intermediate values and a testing program will help uncover the difference in the SS values.

Regards,
Greg

0 Kudos
Reply