	  subroutine uweldflux(f,temflu,mibody,welddim,time)
#ifdef _IMPLICITNONE
      implicit none
#else
      implicit logical (a-z)
#endif
c     ** Start of generated type statements **
      include "weld.cmn"
      include "pival.cmn"
      real*8 f
      integer mibody
      real*8 temflu, time, welddim
c     ** End of generated type statements **
      dimension mibody(*),temflu(*),welddim(*)
c* * * * * *
c
c     User subroutine for weld flux input.
c
c     f              weld flux value (to be defined)
c     temflu(1,2,3)  local integration point coordinates
c                    (with respect to weld origin)
c     temflu(4,5,6)  global integration point coordinates
c     mibody(1)      element number
c     mibody(2)      distributed flux type
c     mibody(3)      integration point number
c     mibody(4)      weld flux index
c     welddim(1)     weld width
c     welddim(2)     weld depth
c     welddim(3)     weld forward length
c     welddim(4)     weld rear length
c     welddim(5)     power
c     time           time at end of increment
c     INPUT:          temflu,mibody,welddim,time
c     OUTPUT:         f
c* * * * * * * * * * * * * * *
c     These variables are provided by the DAT-file
      real*8 LENG, WID, DEP      ! Distance from the origin of the source
c     These variables are provided by the DAT-file but can also be
c     set or changed inside this file ignoring the DAT-file
      real*8 QV                  ! Heat source power
      real*8 QR, B, T, A, REAR, FORW, ACONST, TE, SETTEMP, TDIFF
      real*8 CONST, V, D, TM, CORD, XY, XY1, TM1, MAXI, DHF
      real*8 EFFCY, AREA, FAKT, TCRIT, ZFAKT, ZFAKT1, ZFAKT2
      real*8 E, DMAXV, TPY, VSTMAX, DV, ELNUM, INUM
      real*8 OFFX, OFFY, MX1, MX2, MY1, MY2, CX1, CX2, CY1, CY2
      real*8 DIFF
c     Those are to be set or calculated here
c-------------------------------
c Input of power parameters
c-------------------------------
      QV = welddim(5) ! Power [W] (calculated from process file, considers acceleration voltage and current strength as well as efficiency)

c    ! * * * * * * * * * * * * * * *
c    !      temflu 1       Position perpendicular to the welding line (= width)
c    !      temflu 2       Position in depth
c    !      temflu 3       Position in welding direction
c    !      Read the position of the node with respect to the local
c    !      coordinate system of the heat source
c    !      LENG: Position along the weld line (can be negative!)
c    !      WID: Position perpendicular to the weld line (can be negative!)
c    !      DEP: Position in depth
      LENG = temflu(3)
      WID = temflu(1)
      DEP = temflu(2)
      ELNUM = mibody(1)
      INUM = mibody(3)
c    !      Heat source geometry read from DAT-File
c    !      WELD FLUX 5th Block, entries 4, 5, 6, 7

c    !      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
c    !      !!! Own values must always be entered here !!!
c    !      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      B = welddim(1) ! Half field width (== welddim(1))
      T = welddim(2) ! Absorption depth / depth of heat input (== welddim(2))
      REAR = welddim(3) ! Rear field length (== welddim(4))
      FORW = welddim(4)
      DHF = 0.0000
      SETTEMP = 1405

      OFFX = 0.005 ! OFFset WQ from the center of the plate *(-1)
      OFFY = 0.000
      MX1 = 0.000+OFFX
      MX2 = -0.010+OFFX
      MY1 = 0.000+OFFY
      MY2 = -0.000+OFFY

      CX1 = 0.010+OFFX
      CX2 =-0.000+OFFX
      CY1 = 0.000+OFFY
      CY2 = -0.002+OFFY

      TM = time
c    !      Field length
      A = REAR + FORW

c    !      Effcy factor
      EFFCY = 1.0

c    !      Critical depth [m] (must be negative)
c    !      Used to perform internal treatments without affecting the opposite side
      TCRIT = -1.0E-3

      QR = 0.0 ! Setting the initial value for the calculated partial heat flow
      F = 0 ! Initial value of the total heat flow
      FAKT = 1.000
c    !      Tests if integration points
      if((DEP.GT.T).OR.(DEP.LT.(TCRIT))) return ! are within the absorption depth
      if(abs(WID).GT.(abs(B)+DHF)) return ! are within the field width
c    !   !     ! CAUTION: The front and rear field lengths must be equal here, otherwise points will be "forgotten"
      if((abs(LENG).GT.(REAR+DHF)).OR.(abs(LENG).GT.(FORW+DHF))) return ! are within the field length

      if((WID-MX1)*(WID-MX1)+(LENG-MY1)*(LENG-MY1).LE.9.0E-6)then ! circle at 0;0
        FAKT=0.0
      endif

      if((WID-MX2)*(WID-MX2)+(LENG-MY1)*(LENG-MY1).LE.9.0E-6)then ! circle at x=-10;0
        FAKT=0.0
      endif

      if((WID-CX1)*(WID-CX1)+(LENG-CY1)*(LENG-CY1).LE.9.0E-6)then ! circle at x=10;0
        FAKT=0.0
      endif

      AREA = A * (2*B)
      QR = ((QV * FAKT) / AREA) * EFFCY
      f = QR ! Output of the respective heat flow to the calculation

      END