summaryrefslogtreecommitdiff
path: root/Dragon/src/XELPSI.f
blob: d69ed50115704a68cf1c566a71bb65ea23d3150e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
*DECK XELPSI
      FUNCTION XELPSI(ITYP,RANN2,XYPOS,XYPOS2,SPXY)
*
*-----------------------------------------------------------------------
*
*Purpose:
* Compute intersection surface between part of annular region to the 
* left of X-plane and either the part of the annular region above 
* Y-plane or the part below the Y-plane.
*
*Copyright:
* Copyright (C) 1997 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): G. Marleau
*
*Parameters: input
* ITYP    type of calculation:
*         =1 above y-plane;
*         =2 below y-plane.
* RANN2   pin radius squared.
* XYPOS   cartesian plane location:
*         (1,1)  left   x-plane;
*         (1,2)  right  x-plane;
*         (2,1)  bottom y-plane;
*         (2,2)  top    y-plane.
* XYPOS2  cartesian mesh squared with same notation as for XYPOS.
* SPXY    annular surface outside of planes with same notation 
*         as for XYPOS.
*
*Parameters: output
* XELPSI  intersection surface.
*
*-----------------------------------------------------------------------
*
      IMPLICIT     NONE
      INTEGER      ITYP
      DOUBLE PRECISION XELPSI,RANN2,XYPOS(2,2),XYPOS2(2,2),SPXY(2,2)
*----
*  LOCAL PARAMETERS
*----
      DOUBLE PRECISION   PI,DZERO
      PARAMETER         (PI=3.14159265358979323846D0,DZERO=0.0D0)
      DOUBLE PRECISION   SQANN,YFC,XFC
*----
*  TEST IF POINT OF INTEREST IS LOCATED INSIDE
*  ANNULAR REGION
*----
      XELPSI=0.0D0
      IF(XYPOS2(2,ITYP)+XYPOS2(1,1).LT.RANN2) THEN
*----
*  FOR POINT INSIDE ANNULAR REGION
*  1) (SUM OF ANNULAR INTERSECTION SURFACES)/2
*     -INTERSECTION SURFACE
*     +(INTERNAL REGION CARTESIAN SURFACE)/4
*     =(ANNULAR SURFACE)/4
*----
        SQANN=0.25D0*PI*RANN2
        YFC=-XYPOS(2,ITYP)
        IF(ITYP.EQ.1) THEN
          XFC=-XYPOS(1,1)
        ELSE
          XFC=XYPOS(1,1)
        ENDIF
        XELPSI=0.5D0*(SPXY(1,1)+SPXY(2,ITYP))+XFC*YFC-SQANN
      ELSE
        IF(ITYP.EQ.1) THEN
          IF(XYPOS(2,ITYP).LT.DZERO.AND.XYPOS(1,1).LT.DZERO) THEN
            XELPSI=DZERO
          ELSE IF(XYPOS(2,ITYP).GT.DZERO.AND.XYPOS(1,1).GT.DZERO) THEN
            XELPSI=SPXY(2,ITYP)+SPXY(1,1)-PI*RANN2
          ELSE IF(XYPOS(2,ITYP).GT.DZERO.AND.XYPOS(1,1).LT.DZERO) THEN
            XELPSI=SPXY(1,1)
          ELSE IF(XYPOS(2,ITYP).LT.DZERO.AND.XYPOS(1,1).GT.DZERO) THEN
            XELPSI=SPXY(2,ITYP)
          ENDIF
        ELSE
          IF(XYPOS(2,ITYP).LT.DZERO.AND.XYPOS(1,1).LT.DZERO) THEN
            XELPSI=SPXY(1,1)
          ELSE IF(XYPOS(2,ITYP).GT.DZERO.AND.XYPOS(1,1).GT.DZERO) THEN
            XELPSI=SPXY(2,ITYP)
          ELSE IF(XYPOS(2,ITYP).GT.DZERO.AND.XYPOS(1,1).LT.DZERO) THEN
            XELPSI=DZERO
          ELSE IF(XYPOS(2,ITYP).LT.DZERO.AND.XYPOS(1,1).GT.DZERO) THEN
            XELPSI=SPXY(2,ITYP)+SPXY(1,1)-PI*RANN2
          ENDIF
        ENDIF
      ENDIF
      RETURN
      END