[963] | 1 | SUBROUTINE cv3_inicp() |
---|
[879] | 2 | * |
---|
| 3 | *************************************************************** |
---|
| 4 | * * |
---|
| 5 | * CV3_INIP Lecture des choix de lois de probabilité de mélange* |
---|
| 6 | * et calcul de leurs coefficients normalisés. * |
---|
| 7 | * * |
---|
| 8 | * written by : Jean-Yves Grandpeix, 06/06/2006, 19.39.27 * |
---|
| 9 | * modified by : * |
---|
| 10 | *************************************************************** |
---|
| 11 | * |
---|
| 12 | #include "YOMCST2.h" |
---|
| 13 | c |
---|
[966] | 14 | INTEGER iflag_clos |
---|
[1299] | 15 | CHARACTER (LEN=20) :: modname='cv3_inicp' |
---|
| 16 | CHARACTER (LEN=80) :: abort_message |
---|
[879] | 17 | c |
---|
| 18 | c -- Mixing probability distribution functions |
---|
| 19 | c |
---|
| 20 | real Qcoef1,Qcoef2,QFF,QFFF,Qmix,Rmix,Qmix1,Rmix1,Qmix2,Rmix2,F |
---|
| 21 | Qcoef1(F) = tanh(F/gammas) |
---|
| 22 | Qcoef2(F) = ( tanh(F/gammas) + gammas * |
---|
| 23 | $ log(cosh((1.- F)/gammas)/cosh(F/gammas))) |
---|
| 24 | QFF(F) = Max(Min(F,1.),0.) |
---|
| 25 | QFFF(F) = Min(QFF(F),scut) |
---|
| 26 | Qmix1(F) = ( tanh((QFF(F) - Fmax)/gammas)+Qcoef1max )/ |
---|
| 27 | $ Qcoef2max |
---|
| 28 | Rmix1(F) = ( gammas*log(cosh((QFF(F)-Fmax)/gammas)) |
---|
| 29 | 1 +QFF(F)*Qcoef1max ) / Qcoef2max |
---|
| 30 | Qmix2(F) = -Log(1.-QFFF(F))/scut |
---|
| 31 | Rmix2(F) = (QFFF(F)+(1.-QFF(F))*Log(1.-QFFF(F)))/scut |
---|
| 32 | Qmix(F) = qqa1*Qmix1(F) + qqa2*Qmix2(F) |
---|
| 33 | Rmix(F) = qqa1*Rmix1(F) + qqa2*Rmix2(F) |
---|
| 34 | C |
---|
| 35 | ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 36 | c |
---|
| 37 | C |
---|
| 38 | C=========================================================================== |
---|
| 39 | C READ IN PARAMETERS FOR THE MIXING DISTRIBUTION |
---|
| 40 | C AND PASS THESE THROUGH A COMMON BLOCK TO SUBROUTINE CONVECT etc. |
---|
| 41 | C (Written by V.T.J. Phillips, 20-30/Jan/99) |
---|
| 42 | C=========================================================================== |
---|
| 43 | C |
---|
| 44 | C line 1: a flag (0 or 1) to decide whether P(F) = 1 or the general P(F) is to be |
---|
| 45 | C used, followed by SCUT, which is the cut-off value of F in CONVECT |
---|
| 46 | C line 2: blank |
---|
| 47 | C line 3: the coefficients for the linear combination of P(F)s to |
---|
| 48 | C make the general P(F) |
---|
| 49 | C line 4: blank |
---|
| 50 | C line 5: gammas, Fmax for the cosh^2 component of P(F) |
---|
| 51 | C line 6: blank |
---|
| 52 | C line 7: alphas for the 1st irrational P(F) |
---|
| 53 | C line 8: blank |
---|
| 54 | C line 9: betas for the 2nd irrational P(F) |
---|
| 55 | C |
---|
| 56 | |
---|
[966] | 57 | c open(57,file='parameter_mix.data') |
---|
[879] | 58 | |
---|
[966] | 59 | c read(57,*) iflag_clos |
---|
| 60 | c read(57,*) iflag_mix, scut |
---|
| 61 | c read(57,*) |
---|
| 62 | c if(iflag_mix .gt. 0) then |
---|
| 63 | c read(57,*) qqa1, qqa2 |
---|
| 64 | c read(57,*) |
---|
| 65 | c read(57,*) gammas, Fmax |
---|
| 66 | c read(57,*) |
---|
| 67 | c read(57,*) alphas |
---|
| 68 | c endif |
---|
| 69 | c close(57) |
---|
[879] | 70 | c |
---|
| 71 | if(iflag_mix .gt. 0) then |
---|
| 72 | c |
---|
| 73 | c-- Normalize Pdf weights |
---|
| 74 | c |
---|
| 75 | sumcoef=qqa1+qqa2 |
---|
| 76 | qqa1=qqa1/sumcoef |
---|
| 77 | qqa2=qqa2/sumcoef |
---|
| 78 | c |
---|
| 79 | Qcoef1max = Qcoef1(Fmax) |
---|
| 80 | Qcoef2max = Qcoef2(Fmax) |
---|
| 81 | c |
---|
| 82 | sigma = 0. |
---|
| 83 | aire=0.0 |
---|
| 84 | pdf=0.0 |
---|
| 85 | mu=0.0 |
---|
| 86 | df = 0.0001 |
---|
| 87 | c |
---|
| 88 | c do ff = 0.0 + df, 1.0 - 2.*df, df |
---|
| 89 | ff=df |
---|
| 90 | dowhile ( ff .le. 1.0 - 2.*df ) |
---|
| 91 | pdf = (Qmix(ff+df) - Qmix(ff)) * (1.-ff) / df |
---|
| 92 | aire=aire+(Qmix(ff+df) - Qmix(ff)) * (1.-ff) |
---|
| 93 | mu = mu + pdf * ff * df |
---|
| 94 | cc write(*,*) pdf, Qmix(ff), aire, ff |
---|
| 95 | ff=ff+df |
---|
| 96 | enddo |
---|
| 97 | c |
---|
| 98 | c do ff=0.0+df,1.0 - 2.*df,df |
---|
| 99 | ff=df |
---|
| 100 | dowhile ( ff .le. 1.0 - 2.*df ) |
---|
| 101 | pdf = (Qmix(ff+df)- Qmix(ff)) * (1.-ff) / df |
---|
| 102 | sigma = sigma+pdf*(ff - mu)*(ff - mu)*df |
---|
| 103 | ff=ff+df |
---|
| 104 | enddo |
---|
| 105 | sigma = sqrt(sigma) |
---|
| 106 | c |
---|
| 107 | if (abs(aire-1.0) .gt. 0.02) then |
---|
| 108 | print *,'WARNING:: AREA OF MIXING PDF IS::', aire |
---|
[1299] | 109 | abort_message = '' |
---|
| 110 | CALL abort_gcm (modname,abort_message,1) |
---|
[879] | 111 | else |
---|
| 112 | print *,'Area, mean & std deviation are ::', aire,mu,sigma |
---|
| 113 | endif |
---|
| 114 | endif ! (iflag_mix .gt. 0) |
---|
| 115 | |
---|
| 116 | RETURN |
---|
| 117 | END |
---|