************************************************************************ ************************************************************************ ************************************************************************ DOUBLE PRECISION FUNCTION ETAZ(Z) C Calculates ETA as a function of Z. If desired, this value of ETA C can be used by ANGSIZ instead of a constant value. C This routine can be modified by the user to suit his or her needs. C Neither INICOS, ANGSIZ nor BNGSIZ need be modified. C C Declaring the same COMMON block WHICH in the routine which calls C ANGSIZ makes it possible to investigate different behavior C of ETA(Z) without modifying the code. C C This file in its original version is intended as an example. C Code written by Phillip Helbig, Hamburg Observatory, Sep 1995. ************************************************************************ ************************************************************************ C declarations ************************************************************************ C input variable from the calling routine DOUBLE PRECISION Z ************************************************************************ C variables in common blocks C communication between here and INICOS (q. v.) INTEGER IERROR, WMTYPE DOUBLE PRECISION ZMAX LOGICAL NOTYET, DEBUG, VARETA, MAXZ, BOUNCE COMMON /ANGINI/ ZMAX, IERROR, WMTYPE, $ NOTYET, VARETA, DEBUG, MAXZ, BOUNCE C This can also be declared in the routine which calls ANGSIZ, thus C making a decision about which z-dependence for ETA to use in this C calling routine. USE NEGATIVE CHOICE VALUES IF THE VALUE OF ETA C FOR THE SAME REDSHIFT CAN BE DIFFERENT IN THE CONTRACTING AND C EXPANDING PHASES OF A BOUNCE MODEL. (See VALUE2 below.) INTEGER CHOICE COMMON /WHICH/ CHOICE LOGICAL VALUE2 C This can be used to find out if the integration is being done C in the contracting phase of a bounce model, in which case this C could lead to a different value for ETAZ than in the expanding C phase. ZMAX from the previous ANGINI COMMON block might be C useful in this case as well. C VALUE2 is .TRUE. during the contracting phase of a bounce model. COMMON /CNTRCT/ VALUE2 C save until the next call SAVE /ANGINI/, /WHICH/, /CNTRCT/ ************************************************************************ C internally used variable C just to keep things neat DOUBLE PRECISION Y ************************************************************************ ************************************************************************ C calculations Y = 1.0D0/(1.0D0 + Z) IF (CHOICE .EQ. 0) THEN ETAZ = 0.0D0 C Different ETA values before and after the bounce; C the negative value of CHOICE is necessary for ANGSIZ, since C some degeneracy is cancelled if ETAZ depends on VALUE2. ELSE IF (CHOICE .EQ. -1) THEN IF (VALUE2) THEN ETAZ = 1.0D0 ELSE ETAZ = 0.0D0 END IF C different ETA values before and after the bounce, continuous at C ZMAX ELSE IF (CHOICE .EQ. -2) THEN IF (VALUE2) THEN ETAZ = 1.0D0/(1.0D0 + ZMAX) ELSE ETAZ = Y END IF ELSE IF (CHOICE .EQ. 3) THEN ETAZ = 1.0D0 - Y ELSE IF (CHOICE .EQ. 4) THEN ETAZ = Y**2 ELSE IF (CHOICE .EQ. 5) THEN ETAZ = 1.0D0 - Y**2 ELSE IF (CHOICE .EQ. 6) THEN IF (Z .LE. 9) THEN ETAZ = LOG10(1.0D0 + Z) ELSE ETAZ = 1.0D0 END IF ELSE IF (CHOICE .EQ. 9) THEN ETAZ = SQRT(Y)*(1.0D0 - Y)**2 ELSE ETAZ = SQRT(1.0D0 - Y)*Y**2 END IF C take care of roundoff error IF (ETAZ .GT. 1.0D0) THEN ETAZ = ETAZ - 0.0001D0 ELSE IF (ETAZ .LT. 0.0D0) THEN ETAZ = ETAZ + 0.0001D0 END IF IF ( (ETAZ .LT. 0.0D0) .OR. (ETAZ .GT. 1.0D0) ) THEN C if programmed correctly, one can't get here, not even with C roundoff error PRINT*, 'SOMETHING''S WRONG!!!!!!' C just to make sure one is careful in the definition of ETAZ STOP END IF ************************************************************************ ************************************************************************ END