defe4.f 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. *DECK DEFE4
  2. SUBROUTINE DEFE4 (COFX, IDMN, USOL, GRHS)
  3. C***BEGIN PROLOGUE DEFE4
  4. C***SUBSIDIARY
  5. C***PURPOSE Subsidiary to SEPX4
  6. C***LIBRARY SLATEC
  7. C***TYPE SINGLE PRECISION (DEFE4-S)
  8. C***AUTHOR (UNKNOWN)
  9. C***DESCRIPTION
  10. C
  11. C This subroutine first approximates the truncation error given by
  12. C TRUN1(X,Y)=DLX**2*TX+DLY**2*TY where
  13. C TX=AFUN(X)*UXXXX/12.0+BFUN(X)*UXXX/6.0 on the interior and
  14. C at the boundaries if periodic (here UXXX,UXXXX are the third
  15. C and fourth partial derivatives of U with respect to X).
  16. C TX is of the form AFUN(X)/3.0*(UXXXX/4.0+UXXX/DLX)
  17. C at X=A or X=B if the boundary condition there is mixed.
  18. C TX=0.0 along specified boundaries. TY has symmetric form
  19. C in Y with X,AFUN(X),BFUN(X) replaced by Y,DFUN(Y),EFUN(Y).
  20. C The second order solution in USOL is used to approximate
  21. C (via second order finite differencing) the truncation error
  22. C and the result is added to the right hand side in GRHS
  23. C and then transferred to USOL to be used as a new right
  24. C hand side when calling BLKTRI for a fourth order solution.
  25. C
  26. C***SEE ALSO SEPX4
  27. C***ROUTINES CALLED DX4, DY4
  28. C***COMMON BLOCKS SPL4
  29. C***REVISION HISTORY (YYMMDD)
  30. C 801001 DATE WRITTEN
  31. C 890531 Changed all specific intrinsics to generic. (WRB)
  32. C 891214 Prologue converted to Version 4.0 format. (BAB)
  33. C 900402 Added TYPE section. (WRB)
  34. C***END PROLOGUE DEFE4
  35. C
  36. COMMON /SPL4/ KSWX ,KSWY ,K ,L ,
  37. 1 AIT ,BIT ,CIT ,DIT ,
  38. 2 MIT ,NIT ,IS ,MS ,
  39. 3 JS ,NS ,DLX ,DLY ,
  40. 4 TDLX3 ,TDLY3 ,DLX4 ,DLY4
  41. DIMENSION GRHS(IDMN,*) ,USOL(IDMN,*)
  42. EXTERNAL COFX
  43. C***FIRST EXECUTABLE STATEMENT DEFE4
  44. DO 30 I=IS,MS
  45. XI = AIT+(I-1)*DLX
  46. CALL COFX (XI,AI,BI,CI)
  47. DO 30 J=JS,NS
  48. C
  49. C COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT (XI,YJ)
  50. C
  51. CALL DX4(USOL,IDMN,I,J,UXXX,UXXXX)
  52. CALL DY4(USOL,IDMN,I,J,UYYY,UYYYY)
  53. TX = AI*UXXXX/12.0+BI*UXXX/6.0
  54. TY=UYYYY/12.0
  55. C
  56. C RESET FORM OF TRUNCATION IF AT BOUNDARY WHICH IS NON-PERIODIC
  57. C
  58. IF (KSWX.EQ.1 .OR. (I.GT.1 .AND. I.LT.K)) GO TO 10
  59. TX = AI/3.0*(UXXXX/4.0+UXXX/DLX)
  60. 10 IF (KSWY.EQ.1 .OR. (J.GT.1 .AND. J.LT.L)) GO TO 20
  61. TY = (UYYYY/4.0+UYYY/DLY)/3.0
  62. 20 GRHS(I,J)=GRHS(I,J)+DLY**2*(DLX**2*TX+DLY**2*TY)
  63. 30 CONTINUE
  64. C
  65. C RESET THE RIGHT HAND SIDE IN USOL
  66. C
  67. DO 60 I=IS,MS
  68. DO 50 J=JS,NS
  69. USOL(I,J) = GRHS(I,J)
  70. 50 CONTINUE
  71. 60 CONTINUE
  72. RETURN
  73. END