forked from ahmades/CMCsubPack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PMFDSML.f
executable file
·1848 lines (1703 loc) · 73.7 KB
/
PMFDSML.f
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
C==================================================================================
C==================================================================================
C==================================================================================
C==================================================================================
SUBROUTINE PMFDSML_PDF(ETA,NETA,ETAM,C,MFMEAN,MFVAR,PDF)
C==================================================================================
C PURPOSE: COMPUTES THE PMF PROBABILITY DENSITY FUNCTION
C==================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C ETA MIXTURE FRACTION GRID DOUBLE PRECISION (ARRAY)
C NETA SIZE OF ETA AND PDF INTEGER
C MFMEAN MIXTURE FRACTION MEAN DOUBLE PRECISION
C MFVAR MIXTURE FRACTION VARIANCE DOUBLE PRECISION
C
C OUTPUT:
C
C PDF PROBABILITY DENSITY FUNCTION DOUBLE PRECISION (ARRAY)
C==================================================================================
IMPLICIT NONE
INCLUDE 'formats.h'
INTEGER IETA,NETA
DOUBLE PRECISION MFMEAN,MFVAR,TAU,SIGMA2,PSI(NETA),ETAM,C,C1,C2
DOUBLE PRECISION ETA(NETA),PDF(NETA),E(NETA)
DOUBLE PRECISION G,V,W
DOUBLE PRECISION ETA_TEMP1(NETA-1),PDF_TEMP1(NETA-1)
DOUBLE PRECISION PDF_AREA,PDF_LA,PDF_RA,PDF_SCALEFACT
DOUBLE PRECISION ERFINV,TRAP,CDFNORMDIST
EXTERNAL ERFINV,TRAP,CDFNORMDIST
LOGICAL VERBOSE,PROGRESS
COMMON/LOGICALVARS/VERBOSE,PROGRESS
DOUBLE PRECISION INTEG_ABSERR
COMMON/INTEGRATORABSERR/INTEG_ABSERR
DOUBLE PRECISION INTEG_EPSABS,INTEG_EPSREL
INTEGER INTEG_LIM
COMMON/INTEGRATORVARS1/INTEG_EPSABS,INTEG_EPSREL
COMMON/INTEGRATORVARS2/INTEG_LIM
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE,
$ D_FOUR,D_EIGHT
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS2/D_FOUR,D_EIGHT
INTEGER I_TWO,I_FOUR
COMMON/INTCONSTANTS/I_TWO,I_FOUR
DOUBLE PRECISION ALPHA1,ALPHA2
DOUBLE PRECISION EXP_NUM,EXP_DEN_1,EXP_DEN_2
DOUBLE PRECISION TERM1,TERM2,X
DOUBLE PRECISION INVERSEX
EXTERNAL INVERSEX
C CALL CHECKPARMS(MFMEAN,MFVAR)
C1 = C
C2 = (MFMEAN+C1-D_ONE)/(ETAM-D_ONE)
ALPHA1 = DSQRT(D_TWO)*ERFINV(D_TWO*C1 - D_ONE)
ALPHA2 = DSQRT(D_TWO)*ERFINV(D_TWO*(C1+C2) - D_ONE)
CALL FIND_TAU_DSML(MFMEAN,MFVAR,ETAM,ALPHA1,ALPHA2,TAU)
SIGMA2 = D_ONE - D_TWO*TAU
DO IETA = 2,NETA-1
PSI(IETA) = INVERSEX(ETA(IETA),ETAM,ALPHA1,ALPHA2,TAU)
EXP_NUM = DEXP(-(PSI(IETA)**D_TWO)/(D_TWO*(D_ONE-D_TWO*TAU)))
EXP_DEN_1 = DEXP(-((PSI(IETA)-ALPHA1)**D_TWO)/(D_FOUR*TAU))
EXP_DEN_2 = DEXP(-((PSI(IETA)-ALPHA2)**D_TWO)/(D_FOUR*TAU))
PDF(IETA) = DSQRT(D_TWO*TAU/SIGMA2)
$ * EXP_NUM/(ETAM*EXP_DEN_1 + (D_ONE-ETAM)*EXP_DEN_2)
IF(PROGRESS) CALL PROGRESSPC(IETA,NETA-1)
ENDDO
C DETERMINE THE SHAPE OF THE PDF USING THE FIRST AND LAST TWO INTERIOR POINTS OF THE
C PDF ARRAY IN ORDER TO SET BOUNDARY VALUES. THE PRECEDURE MAKES USE OF THE FACT
C THAT R(PHI) IS THE CUMULATIVE DISTRIBUTION FUNCTION OF P(ETA).
C R(PHI) IS THE CUMULATIVE NORMAL DISTRIBUTION WITH ZERO MEAN AND SIGMA2 VARIANCE
C AND PHI IS RELATED TO ETA BY: PHI = ALPHA + 2*DSQRT(TAU)*ERFINV(2*ETA-1).
C R(PHI) IS USED TO COMPUTE THE AREAS UNDER THE PDF EXTENDING FROM ETA(1) TO ETA(2)
C AND FROM ETA(NETA-1) TO ETA(NETA). THESE AREARS ARE THEN USED TO SET THE BOUNDARY
C VALUES OF THE PDF, PDF(1) AND PDF(NETA).
C
C USE R(PHI) TO FIND THE AREA BETWEEN THE LEFT BOUNADRY AND THE FIRST INTERIOR GRID POINT
PDF_LA = CDFNORMDIST(PSI(2),D_ZERO,SIGMA2)
PDF(1) = D_TWO*PDF_LA/(ETA(2)-ETA(1)) - PDF(2)
PDF(1) = DMAX1(PDF(1),D_ZERO)
C USE R(PHI) TO FIND THE AREA BETWEEN THE LEFT BOUNADRY AND THE LAST INTERIOR GRID POINT
PDF_RA = D_ONE - CDFNORMDIST(PSI(NETA-1),D_ZERO,SIGMA2)
PDF(NETA) = D_TWO*PDF_RA/(ETA(NETA)-ETA(NETA-1)) - PDF(NETA-1)
PDF(NETA) = DMAX1(PDF(NETA),D_ZERO)
C
IF(VERBOSE) THEN
WRITE(*,50)' '
WRITE(*,50)'============================================='
WRITE(*,50) 'PMF-T: PROBABILITY DENSITY FUNCTION:'
WRITE(*,50)'============================================='
WRITE(*,100) 'ALPHA1 =',ALPHA1
WRITE(*,100) 'ALPHA2 =',ALPHA2
WRITE(*,150) 'TAU =',TAU,
$ '-> MOD. OF ABS. ERR. OF INTEGRATION =',INTEG_ABSERR
WRITE(*,100) 'SIGMA^2 =',SIGMA2
WRITE(*,50)'============================================='
WRITE(*,200)'INDEX','ETA','PDF'
WRITE(*,50)'============================================='
DO IETA = 1,NETA
WRITE(*,300) IETA, ETA(IETA), PDF(IETA)
ENDDO
WRITE(*,50)'============================================='
WRITE(*,50)' '
ENDIF
RETURN
END
C==================================================================================
C==================================================================================
C==================================================================================
C==================================================================================
SUBROUTINE PMFDSML_CV(ETA,NETA,ETAM,C,MFMEAN,MFVAR,
$ MFMEANGRAD,MFVARGRAD,DT,VEL,CV)
C==========================================================================================
C PURPOSE: COMPUTES THE CONDITIONAL VELOCITY USING THE PMF-PDF
C==========================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C ETA MIXTURE FRACTION GRID DOUBLE PRECISION (ARRAY,SIZE=NETA)
C NETA SIZE OF ETA INTEGER
C MFMEAN MIXTURE FRACTION MEAN DOUBLE PRECISION
C MFVAR MIXTURE FRACTION VARIANCE DOUBLE PRECISION
C MFMEANGRAD GRAD. OF MIX. FRAC. MEAN DOUBLE PRECISION (ARRAY, SIZE=3)
C MFVARGRAD GRAD. OF MIX. FRAC. VARIANCE DOUBLE PRECISION (ARRAY, SIZE=3)
C DT TURBULENT DIFFUSIVITY DOUBLE PRECISION
C VEL MEAN VELOCITY VECTOR DOUBLE PRECISION (ARRAY, SIZE=3)
C
C OUTPUT:
C
C CV COND. VELOCITY DOUBLE PRECISION (ARRAY, SIZE=NETA)
C==========================================================================================
IMPLICIT NONE
INCLUDE 'formats.h'
INTEGER IETA,NETA,I
DOUBLE PRECISION ETAM,C,MFMEAN,MFVAR,DT
DOUBLE PRECISION MFMEANGRAD(3),MFVARGRAD(3),VEL(3)
DOUBLE PRECISION ETA(NETA),CV(3,NETA)
DOUBLE PRECISION PDF(NETA)
DOUBLE PRECISION DPDM,DPDV,ERR_DPDM,ERR_DPDV
LOGICAL VERBOSE,PROGRESS,VERBOSE_TEMP,PROGRESS_TEMP
COMMON/LOGICALVARS/VERBOSE,PROGRESS
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
INTEGER DIFF_NCHEBCOEFS
COMMON/DIFFERENTIATORVARS1/DIFF_NCHEBCOEFS
DOUBLE PRECISION DIFF_PDFMIN
COMMON/DIFFERENTIATORVARS3/DIFF_PDFMIN
INTEGER DIFF_NCHEBCOEFS_EXTRA
COMMON/DIFFERENTIATORVARS4/DIFF_NCHEBCOEFS_EXTRA
DOUBLE PRECISION MFMEAN_MAX,MFMEAN_MIN,MFVAR_MIN
COMMON/MFMINMAX/MFMEAN_MAX,MFMEAN_MIN,MFVAR_MIN
DOUBLE PRECISION MFVAR_MAX
DOUBLE PRECISION LIMINFM,LIMSUPM
DOUBLE PRECISION LIMINFV,LIMSUPV
DOUBLE PRECISION H_NEW,ERR,ERR_OLD,H_MEAN,H_VAR
DOUBLE PRECISION PMFDSML_PDF_M,PMFDSML_PDF_V
EXTERNAL PMFDSML_PDF_M,PMFDSML_PDF_V
DOUBLE PRECISION PMFCV_ETA,PMFCV_ETAM,PMFCV_C,
$ PMFCV_MEAN,PMFCV_VAR
COMMON/PMFCVETA/PMFCV_ETA
COMMON/PMFCVETAM/PMFCV_ETAM
COMMON/PMFCVC/PMFCV_C
COMMON/PMFCVMEAN/PMFCV_MEAN
COMMON/PMFCVVAR/PMFCV_VAR
INTEGER DIFF_NCHEBCOEFS_TEMP
C FIND THE PDF. TEMPORARILY DISABLE VERBOSITY IF ON.
VERBOSE_TEMP = VERBOSE
PROGRESS_TEMP = PROGRESS
VERBOSE = .FALSE.
PROGRESS = .FALSE.
CALL PMFDSML_PDF(ETA,NETA,ETAM,C,MFMEAN,MFVAR,PDF)
VERBOSE = VERBOSE_TEMP
PROGRESS = PROGRESS_TEMP
CALL FINDDIFFDELTA(MFMEAN,MFVAR,H_MEAN,H_VAR)
MFVAR_MAX = MFMEAN*(D_ONE-MFMEAN)
LIMINFV = DMAX1(MFVAR-H_VAR,MFVAR_MIN)
LIMSUPV = DMIN1(MFVAR+H_VAR,MFVAR_MAX)
LIMINFM = DMAX1(MFMEAN-H_MEAN,MFMEAN_MIN)
LIMSUPM = DMIN1(MFMEAN+H_MEAN,MFMEAN_MAX)
PMFCV_ETAM = ETAM
PMFCV_C = C
PMFCV_MEAN = MFMEAN
PMFCV_VAR = MFVAR
DO IETA = 2,NETA-1
C
PMFCV_ETA = ETA(IETA)
C
C ADJUST NUMBER OF COEFS IF NECESSARY
IF(PDF(IETA).LE.DIFF_PDFMIN) THEN
DIFF_NCHEBCOEFS_TEMP = DIFF_NCHEBCOEFS+DIFF_NCHEBCOEFS_EXTRA
ELSE
DIFF_NCHEBCOEFS_TEMP = DIFF_NCHEBCOEFS
ENDIF
C WRITE(*,*)'PMF-T CV',IETA,PDF(IETA),DIFF_NCHEBCOEFS
C
C DPDV
CALL CHEBDERIV(LIMINFV,LIMSUPV,DIFF_NCHEBCOEFS_TEMP,
$ PMFDSML_PDF_V,MFVAR,1,DPDV)
C
C DPDM
CALL CHEBDERIV(LIMINFM,LIMSUPM,DIFF_NCHEBCOEFS_TEMP,
$ PMFDSML_PDF_M,MFMEAN,1,DPDM)
C
DO I = 1,3
CV(I,IETA) = VEL(I) - (DT/PDF(IETA))
$ *(DPDM*MFMEANGRAD(I) + DPDV*MFVARGRAD(I))
ENDDO
C
IF(PROGRESS) CALL PROGRESSPC(IETA,NETA-1)
C
ENDDO
IF(VERBOSE) THEN
WRITE(*,50)' '
WRITE(*,50)'============================================='
WRITE(*,50) 'PMF-T: CONDITIONAL VELOCITY:'
WRITE(*,400)'INDEX','ETA','CV_X','CV_Y','CV_Z'
DO IETA = 1,NETA
WRITE(*,500) IETA,ETA(IETA),CV(1,IETA),CV(2,IETA),CV(3,IETA)
ENDDO
WRITE(*,50)'============================================='
WRITE(*,50)' '
ENDIF
RETURN
END
C==================================================================================
C==================================================================================
C==================================================================================
C==================================================================================
SUBROUTINE PMFDSML_CSDR_H(ETA,NETA,ETAM,C,MFMEAN,MFVAR,CHI,CSDRH)
C==========================================================================================
C PURPOSE: COMPUTES THE [HOMOGENEOUS] VERSION OF THE CONDITIONAL SCALAR
C DISSIPATION RATE MODEL USING THE PMF-PDF
C==========================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C ETA MIXTURE FRACTION GRID DOUBLE PRECISION (ARRAY,SIZE=NETA)
C NETA SIZE OF ETA AND CSDRI INTEGER
C MFMEAN MIXTURE FRACTION MEAN DOUBLE PRECISION
C MFVAR MIXTURE FRACTION VARIANCE DOUBLE PRECISION
C CHI MEAN SCALAR DISSIPATION RATE DOUBLE PRECISION
C
C OUTPUT:
C
C CSDRH COND. SCALAR DISSIPATION RATE DOUBLE PRECISION (ARRAY, SIZE=NETA)
C==========================================================================================
IMPLICIT NONE
INCLUDE 'formats.h'
INTEGER IETA,NETA,I
DOUBLE PRECISION MFMEAN,MFVAR,CHI,TAU,SIGMA2
DOUBLE PRECISION ETA(NETA),CSDRH(NETA),E,PSI,ETAM,C,C1,C2
DOUBLE PRECISION ERFINV
EXTERNAL ERFINV
DOUBLE PRECISION INTEG_ABSERR
COMMON/INTEGRATORABSERR/INTEG_ABSERR
LOGICAL VERBOSE,PROGRESS
COMMON/LOGICALVARS/VERBOSE,PROGRESS
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE,
$ D_FOUR,D_EIGHT
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS2/D_FOUR,D_EIGHT
DOUBLE PRECISION ALPHA1,ALPHA2
DOUBLE PRECISION EXP_NUM_1,EXP_NUM_2,EXP_DEN_1,
$ EXP_DEN_2,EXP_DEN_3
DOUBLE PRECISION TERM1,TERM2,X
DOUBLE PRECISION INVERSEX
EXTERNAL INVERSEX
C CALL CHECKPARMS(MFMEAN,MFVAR)
C1 = C
C2 = (MFMEAN+C1-D_ONE)/(ETAM-D_ONE)
ALPHA1 = DSQRT(D_TWO)*ERFINV(D_TWO*C1 - D_ONE)
ALPHA2 = DSQRT(D_TWO)*ERFINV(D_TWO*(C1+C2) - D_ONE)
CALL FIND_TAU_DSML(MFMEAN,MFVAR,ETAM,ALPHA1,ALPHA2,TAU)
SIGMA2 = D_ONE - D_TWO*TAU
C BOUNDARY VALUES ARE KNOWN
CSDRH(1) = D_ZERO
CSDRH(NETA) = D_ZERO
C COMPUTE CSDR AT INTERNAL GRID POINTS
DO IETA = 2,NETA-1
C
PSI = INVERSEX(ETA(IETA),ETAM,ALPHA1,ALPHA2,TAU)
C
EXP_NUM_1 = DEXP(-((PSI-ALPHA1)**D_TWO)/(D_FOUR*TAU))
EXP_NUM_2 = DEXP(-((PSI-ALPHA2)**D_TWO)/(D_FOUR*TAU))
EXP_DEN_1 = DEXP((ALPHA1**D_TWO)/(D_TWO*(TAU-D_ONE)))
EXP_DEN_2 = DEXP((ALPHA1**D_TWO + ALPHA2**D_TWO
$ + D_TWO*ALPHA1*ALPHA2*(D_TWO*TAU-D_ONE))
$ /(D_EIGHT*TAU*(TAU-D_ONE)))
EXP_DEN_3 = DEXP((ALPHA2**D_TWO)/(D_TWO*(TAU-D_ONE)))
C
CSDRH(IETA) = CHI * DSQRT((D_ONE-TAU)/TAU)
$ * ((ETAM*EXP_NUM_1 + (D_ONE-ETAM)*EXP_NUM_2)**D_TWO)
$ / ((ETAM**D_TWO)*EXP_DEN_1
$ + D_TWO*ETAM*(D_ONE-ETAM)*EXP_DEN_2
$ + ((D_ONE-ETAM)**D_TWO)*EXP_DEN_3)
C
IF(PROGRESS) CALL PROGRESSPC(IETA,NETA-1)
C
ENDDO
IF(VERBOSE) THEN
WRITE(*,50)' '
WRITE(*,50)'============================================='
WRITE(*,50) 'PMF-T: COND. SCAL. DISS. RATE (HOMOGENEOUS):'
WRITE(*,50)'============================================='
WRITE(*,200)'INDEX','ETA','CSDRH'
DO IETA = 1,NETA
WRITE(*,300) IETA, ETA(IETA), CSDRH(IETA)
ENDDO
WRITE(*,50)'============================================='
WRITE(*,50)' '
ENDIF
RETURN
END
C==================================================================================
C==================================================================================
C==================================================================================
C==================================================================================
SUBROUTINE PMFDSML_CSDR_I(ETA,NETA,ETAM,C,MFMEAN,MFVAR,
$ MFMEANGRAD,MFVARGRAD,DT,CHI,CSDRI)
C==========================================================================================
C PURPOSE: COMPUTES THE [HOMOGENEOUS] VERSION OF THE CONDITIONAL SCALAR
C DISSIPATION RATE MODEL USING THE PMF-PDF
C==========================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C ETA MIXTURE FRACTION GRID DOUBLE PRECISION (ARRAY,SIZE=NETA)
C NETA SIZE OF ETA AND CSDRI INTEGER
C MFMEAN MIXTURE FRACTION MEAN DOUBLE PRECISION
C MFVAR MIXTURE FRACTION VARIANCE DOUBLE PRECISION
C CHI MEAN SCALAR DISSIPATION RATE DOUBLE PRECISION
C
C OUTPUT:
C
C CSDRI COND. SCALAR DISSIPATION RATE DOUBLE PRECISION (ARRAY, SIZE=NETA)
C==========================================================================================
IMPLICIT NONE
INCLUDE 'formats.h'
INTEGER IETA,NETA,I
DOUBLE PRECISION MFMEAN,MFVAR,CHI,TAU,SIGMA2
DOUBLE PRECISION DT,MFMEANGRAD(3),MFVARGRAD(3)
DOUBLE PRECISION ETA(NETA),CSDRH(NETA),CSDRI(NETA),PDF(NETA)
DOUBLE PRECISION E,PSI,ETAM,C,C1,C2,PDFDED,TERM
DOUBLE PRECISION II_MM,II_VV,II_MV,P
DOUBLE PRECISION INTEG_ABSERR
COMMON/INTEGRATORABSERR/INTEG_ABSERR
LOGICAL VERBOSE,PROGRESS,VERBOSE_TEMP,PROGRESS_TEMP
COMMON/LOGICALVARS/VERBOSE,PROGRESS
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE,
$ D_FOUR,D_EIGHT
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS2/D_FOUR,D_EIGHT
DOUBLE PRECISION ALPHA1,ALPHA2
DOUBLE PRECISION EXP_NUM_1,EXP_NUM_2,EXP_DEN_1,
$ EXP_DEN_2,EXP_DEN_3
DOUBLE PRECISION TERM1,TERM2,X
DOUBLE PRECISION INVERSEX,ERFINV
EXTERNAL INVERSEX,ERFINV
DOUBLE PRECISION PRODM,PRODV,PRODMV
DOUBLE PRECISION H,H_NEW,H_MEAN,H_VAR,H_MEAN_NEW,H_VAR_NEW
DOUBLE PRECISION ERR,ERR_OLD
DOUBLE PRECISION DIIDV(NETA)
DOUBLE PRECISION D2IIDV2(NETA)
DOUBLE PRECISION D2IIDM2(NETA)
DOUBLE PRECISION D2IIDMDV(NETA)
INTEGER DIFF_NCHEBCOEFS
COMMON/DIFFERENTIATORVARS1/DIFF_NCHEBCOEFS
DOUBLE PRECISION DIFF_PDFMIN
COMMON/DIFFERENTIATORVARS3/DIFF_PDFMIN
INTEGER DIFF_NCHEBCOEFS_EXTRA
COMMON/DIFFERENTIATORVARS4/DIFF_NCHEBCOEFS_EXTRA
DOUBLE PRECISION MFMEAN_MAX,MFMEAN_MIN,MFVAR_MIN
COMMON/MFMINMAX/MFMEAN_MAX,MFMEAN_MIN,MFVAR_MIN
DOUBLE PRECISION MFVAR_MAX
DOUBLE PRECISION LIMINF,LIMSUP
DOUBLE PRECISION LIMINFM,LIMSUPM
DOUBLE PRECISION LIMINFV,LIMSUPV
DOUBLE PRECISION IIPMFPDF_M,IIPMFPDF_V,IIPMFPDF_MV,IIPMFPDF_VM
EXTERNAL IIPMFPDF_M,IIPMFPDF_V,IIPMFPDF_MV,IIPMFPDF_VM
DOUBLE PRECISION PMFMFMEANPASS
COMMON/MFMEANBLOK/PMFMFMEANPASS
DOUBLE PRECISION PMFMFVARPASS
COMMON/MFVARBLOK/PMFMFVARPASS
DOUBLE PRECISION PMFCPASS
COMMON/C1BLOK/PMFCPASS
DOUBLE PRECISION PMFETAPASS,PMFETAMPASS
COMMON/ETABLOK/PMFETAPASS,PMFETAMPASS
DOUBLE PRECISION PMFPDFPASS
COMMON/PMFPDFBLOK/PMFPDFPASS
INTEGER DIFF_NCHEBCOEFS_TEMP
DOUBLE PRECISION DIFF_MAXERR_TEMP
C CALL CHECKPARMS(MFMEAN,MFVAR)
VERBOSE_TEMP = VERBOSE
PROGRESS_TEMP = PROGRESS
VERBOSE = .FALSE.
PROGRESS = .FALSE.
CALL PMFDSML_PDF(ETA,NETA,ETAM,C,MFMEAN,MFVAR,PDF)
VERBOSE = VERBOSE_TEMP
PROGRESS = PROGRESS_TEMP
C PARTIAL DERIVATIVES OF II(ETA)
CALL FINDDIFFDELTA(MFMEAN,MFVAR,H_MEAN,H_VAR)
MFVAR_MAX = MFMEAN*(D_ONE-MFMEAN)
LIMINFV = DMAX1(MFVAR-H_VAR,MFVAR_MIN)
LIMSUPV = DMIN1(MFVAR+H_VAR,MFVAR_MAX)
LIMINFM = DMAX1(MFMEAN-H_MEAN,MFMEAN_MIN)
LIMSUPM = DMIN1(MFMEAN+H_MEAN,MFMEAN_MAX)
PMFETAMPASS = ETAM
PMFCPASS = C
DO IETA = 2,NETA-1
C
PMFETAPASS = ETA(IETA)
C
C ADJUST NUMBER OF COEFS IF NECESSARY
IF(PDF(IETA).LE.DIFF_PDFMIN) THEN
DIFF_NCHEBCOEFS_TEMP = DIFF_NCHEBCOEFS+DIFF_NCHEBCOEFS_EXTRA
ELSE
DIFF_NCHEBCOEFS_TEMP = DIFF_NCHEBCOEFS
ENDIF
C WRITE(*,*)'PMF-T CSDR-I',IETA,PDF(IETA),DIFF_NCHEBCOEFS_TEMP
C
C D2IIDV2
PMFMFMEANPASS = MFMEAN
CALL CHEBDERIV(LIMINFV,LIMSUPV,DIFF_NCHEBCOEFS_TEMP,IIPMFPDF_V,
$ MFVAR,2,D2IIDV2(IETA))
C
C D2IIDM2
PMFMFVARPASS = MFVAR
CALL CHEBDERIV(LIMINFM,LIMSUPM,DIFF_NCHEBCOEFS_TEMP,IIPMFPDF_M,
$ MFMEAN,2,D2IIDM2(IETA))
C
C D2IIDMDV
PMFMFVARPASS = MFVAR
PMFPDFPASS = PDF(IETA)
CALL CHEBDERIV(LIMINFM,LIMSUPM,DIFF_NCHEBCOEFS_TEMP,
$ IIPMFPDF_MV,MFMEAN,1,D2IIDMDV(IETA))
C
IF(PROGRESS) CALL PROGRESSPC(IETA,NETA-1)
C
ENDDO
C COMPUTE THE SCALAR PRODUCTS
PRODM = D_ZERO ! SCALAR PRODUCT OF THE GRADS OF MIX FRAC. MEAN
PRODV = D_ZERO ! SCALAR PRODUCT OF THE GRADS OF MIX FRAC. VARIANCE
PRODMV = D_ZERO ! SCALAR PRODUCT OF MIX FRAC. MEAN AND MIX FRAC VARIANCE GRADS
DO I = 1,3
PRODM = PRODM + MFMEANGRAD(I)**D_TWO
PRODV = PRODV + MFVARGRAD(I)**D_TWO
PRODMV = PRODMV + MFMEANGRAD(I)*MFVARGRAD(I)
ENDDO
C1 = C
C2 = (MFMEAN+C1-D_ONE)/(ETAM-D_ONE)
ALPHA1 = DSQRT(D_TWO)*ERFINV(D_TWO*C1 - D_ONE)
ALPHA2 = DSQRT(D_TWO)*ERFINV(D_TWO*(C1+C2) - D_ONE)
CALL FIND_TAU_DSML(MFMEAN,MFVAR,ETAM,ALPHA1,ALPHA2,TAU)
SIGMA2 = D_ONE - D_TWO*TAU
C BOUNDARY VALUES ARE KNOWN
CSDRI(1) = D_ZERO
CSDRI(NETA) = D_ZERO
C COMPUTE CSDR AT INTERNAL GRID POINTS
DO IETA = 2,NETA-1
C
PSI = INVERSEX(ETA(IETA),ETAM,ALPHA1,ALPHA2,TAU)
C
EXP_NUM_1 = DEXP(-((PSI-ALPHA1)**D_TWO)/(D_FOUR*TAU))
EXP_NUM_2 = DEXP(-((PSI-ALPHA2)**D_TWO)/(D_FOUR*TAU))
EXP_DEN_1 = DEXP((ALPHA1**D_TWO)/(D_TWO*(TAU-D_ONE)))
EXP_DEN_2 = DEXP((ALPHA1**D_TWO + ALPHA2**D_TWO
$ + D_TWO*ALPHA1*ALPHA2*(D_TWO*TAU-D_ONE))
$ /(D_EIGHT*TAU*(TAU-D_ONE)))
EXP_DEN_3 = DEXP((ALPHA2**D_TWO)/(D_TWO*(TAU-D_ONE)))
C
CSDRI(IETA) = (CHI - D_TWO*DT*PRODM) * DSQRT((D_ONE-TAU)/TAU)
$ * ((ETAM*EXP_NUM_1 + (D_ONE-ETAM)*EXP_NUM_2)**D_TWO)
$ / ((ETAM**D_TWO)*EXP_DEN_1
$ + D_TWO*ETAM*(D_ONE-ETAM)*EXP_DEN_2
$ + ((D_ONE-ETAM)**D_TWO)*EXP_DEN_3)
$ + D_TWO*(DT/PDF(IETA))*(PRODM*D2IIDM2(IETA)
$ + PRODV*D2IIDV2(IETA) + D_TWO*PRODMV*D2IIDMDV(IETA))
C
ENDDO
c$$$ OPEN(1,FILE='res/PMFIIDERIVS.dat',FORM='FORMATTED',
c$$$ $ STATUS='UNKNOWN')
c$$$ DO IETA = 1,NETA
c$$$ WRITE(1,120) D2IIDM2(IETA),D2IIDV2(IETA),D2IIDMDV(IETA)
c$$$ ENDDO
c$$$ CLOSE(1)
IF(VERBOSE) THEN
WRITE(*,50)' '
WRITE(*,50)'============================================='
WRITE(*,50) 'PMF-T: COND. SCAL. DISS. RATE (HOMOGENEOUS):'
WRITE(*,50)'============================================='
WRITE(*,200)'INDEX','ETA','CSDRI'
DO IETA = 1,NETA
WRITE(*,300) IETA, ETA(IETA), CSDRI(IETA)
ENDDO
WRITE(*,50)'============================================='
WRITE(*,50)' '
ENDIF
RETURN
END
C==========================================================================================
C==========================================================================================
C==========================================================================================
C==========================================================================================
DOUBLE PRECISION FUNCTION INVERSEX(ETA,ETAM,ALPHA1,ALPHA2,TAU)
IMPLICIT NONE
DOUBLE PRECISION ETA,ETAM,ALPHA1,ALPHA2,TAU
DOUBLE PRECISION XFUNC
EXTERNAL XFUNC
DOUBLE PRECISION LOW,HIGH
LOGICAL SUCCES
INTEGER IFLAG
DOUBLE PRECISION ROOTF_RE,ROOTF_AE
COMMON/ROOTFINDERVARS/ROOTF_RE,ROOTF_AE
DOUBLE PRECISION ETAPASS,ETAMPASS,ALPHA1PASS,ALPHA2PASS,TAUPASS
COMMON/COMVARSETA/ETAPASS
COMMON/COMVARSETAM/ETAMPASS
COMMON/COMVARSALPHA12/ALPHA1PASS,ALPHA2PASS
COMMON/COMVARSTAU/TAUPASS
ETAPASS = ETA
ETAMPASS = ETAM
ALPHA1PASS = ALPHA1
ALPHA2PASS = ALPHA2
TAUPASS = TAU
C LOW = -1.0D+40
C HIGH = -LOW
LOW = -1.0D0
HIGH = -LOW
CALL BRACKET(XFUNC,LOW,HIGH,5.0D0)
CALL ZEROIN(XFUNC,LOW,HIGH,ROOTF_RE,ROOTF_AE,IFLAG)
INVERSEX = LOW
RETURN
END
DOUBLE PRECISION FUNCTION XFUNC(PSI)
IMPLICIT NONE
DOUBLE PRECISION PSI,TERM1,TERM2
DOUBLE PRECISION ERF
EXTERNAL ERF
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
DOUBLE PRECISION ETAPASS,ETAMPASS,ALPHA1PASS,ALPHA2PASS,TAUPASS
COMMON/COMVARSETA/ETAPASS
COMMON/COMVARSETAM/ETAMPASS
COMMON/COMVARSALPHA12/ALPHA1PASS,ALPHA2PASS
COMMON/COMVARSTAU/TAUPASS
TERM1 = ETAMPASS*ERF((PSI-ALPHA1PASS)/(D_TWO*DSQRT(TAUPASS)))
TERM2 = (D_ONE-ETAMPASS)*ERF((PSI-ALPHA2PASS)
$ /(D_TWO*DSQRT(TAUPASS)))
XFUNC = D_HALF*(D_ONE+TERM1+TERM2) - ETAPASS
RETURN
END
C==========================================================================================
C==========================================================================================
C==========================================================================================
C==========================================================================================
SUBROUTINE FIND_TAU_DSML(MFMEAN,MFVAR,ETAM,ALPHA1,ALPHA2,TAU)
C==================================================================================
C PURPOSE: COMPUTES THE VALUE OF THE PARAMETER TAU
C==================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C MFMEAN MIXTURE FRACTION MEAN DOUBLE PRECISION
C MFVAR MIXTURE FRACTION VARIANCE DOUBLE PRECISION
C
C OUTPUT:
C
C TAU THE PARAMETER TAU DOUBLE PRECISION
C==================================================================================
IMPLICIT NONE
INCLUDE 'formats.h'
DOUBLE PRECISION TAUFUNC_DSML,ERFINV,ZRIDDR,ZBRENT
EXTERNAL TAUFUNC_DSML,ERFINV,ZRIDDR,ZBRENT
DOUBLE PRECISION TAU,MFMEAN,MFVAR,ETAM,ALPHA1,ALPHA2
DOUBLE PRECISION TAU_MIN, TAU_MAX
INTEGER IFLAG
DOUBLE PRECISION ROOTF_RE,ROOTF_AE
COMMON/ROOTFINDERVARS/ROOTF_RE,ROOTF_AE
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
DOUBLE PRECISION MFMEANPASS,MFVARPASS,ETAMPASS,
$ ALPHA1PASS,ALPHA2PASS
COMMON/COMVARSMEANVAR/MFMEANPASS,MFVARPASS
COMMON/COMVARSETAM/ETAMPASS
COMMON/COMVARSALPHA12/ALPHA1PASS,ALPHA2PASS
MFMEANPASS = MFMEAN
MFVARPASS = MFVAR
ETAMPASS = ETAM
ALPHA1PASS = ALPHA1
ALPHA2PASS = ALPHA2
C TAU VARIES BETWEEN 0 AND 0.5
TAU_MIN = D_ZERO
TAU_MAX = D_HALF
CALL ZEROIN(TAUFUNC_DSML,TAU_MIN,TAU_MAX,ROOTF_RE,ROOTF_AE,IFLAG)
TAU = TAU_MIN
RETURN
END
c$$$C==========================================================================================
c$$$C==========================================================================================
c$$$C==========================================================================================
c$$$C==========================================================================================
c$$$
c$$$ DOUBLE PRECISION FUNCTION TAUFUNC_DSML(TAU)
c$$$C==================================================================================
c$$$C PURPOSE: COMPUTES THE RIGHT-HAND SIDE OF EQ.(19) IN [1]
c$$$C==================================================================================
c$$$C VARIABLE DESCRIPTION DATA TYPE
c$$$C -------- ----------- ---------
c$$$C
c$$$C INPUT:
c$$$C
c$$$C TAU THE PARAMETER TAU DOUBLE PRECISION
c$$$C==================================================================================
c$$$ IMPLICIT NONE
c$$$ DOUBLE PRECISION INTEG_EPSABS,INTEG_EPSREL
c$$$ INTEGER INTEG_LIM
c$$$ COMMON/INTEGRATORVARS1/INTEG_EPSABS,INTEG_EPSREL
c$$$ COMMON/INTEGRATORVARS2/INTEG_LIM
c$$$ DOUBLE PRECISION TAU,INTEGRAL
c$$$
c$$$ DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
c$$$ COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
c$$$ INTEGER I_TWO,I_FOUR
c$$$ COMMON/INTCONSTANTS/I_TWO,I_FOUR
c$$$
c$$$ DOUBLE PRECISION TAUFUNC_INT_DSML
c$$$ EXTERNAL TAUFUNC_INT_DSML
c$$$ DOUBLE PRECISION BOUND
c$$$ INTEGER INF,NEVAL,IER,LIMIT,LENW,LAST
c$$$ DOUBLE PRECISION EPSABS,EPSREL,RESULT
c$$$ INTEGER IWORK(INTEG_LIM)
c$$$ DOUBLE PRECISION WORK(I_FOUR*INTEG_LIM)
c$$$ DOUBLE PRECISION INTEG_ABSERR
c$$$ COMMON/INTEGRATORABSERR/INTEG_ABSERR
c$$$
c$$$ DOUBLE PRECISION MFMEANPASS,MFVARPASS,TAUPASS
c$$$ COMMON/COMVARSMEANVAR/MFMEANPASS,MFVARPASS
c$$$ COMMON/COMVARSTAU/TAUPASS
c$$$
c$$$ DOUBLE PRECISION ABSERR,RESABS,RESASC
c$$$
c$$$ INF = I_TWO
c$$$ LENW = I_FOUR*INTEG_LIM
c$$$ EPSABS = INTEG_EPSABS
c$$$ EPSREL = INTEG_EPSREL
c$$$ TAUPASS = TAU
c$$$ INTEG_ABSERR = D_ZERO
c$$$ CALL DQAGI(TAUFUNC_INT_DSML,BOUND,INF,EPSABS,EPSREL,RESULT,
c$$$ $ INTEG_ABSERR,NEVAL,IER,INTEG_LIM,LENW,LAST,IWORK,WORK)
c$$$ INTEGRAL = RESULT
c$$$ TAUFUNC_DSML = MFMEANPASS**D_TWO + MFVARPASS - INTEGRAL
c$$$
c$$$CCCCCCCCCCCCCCCCCCCCCC
c$$$
c$$$c$$$ DOUBLE PRECISION D,P
c$$$c$$$ INF = 1
c$$$c$$$ NEVAL = 50
c$$$c$$$ EPSREL = 1.0D-5
c$$$c$$$ D = PI/4.0D0 !PI !PI/2.0D0
c$$$c$$$ P = 2.0D0 !0.0D0 !1.0D0
c$$$c$$$ TAUPASS = TAU
c$$$c$$$ CALL INTHP(BOUND,BOUND,D,TAUFUNC_INT_DSML,NEVAL,P,
c$$$c$$$ $ EPSREL,INF,RESULT)
c$$$c$$$ IF(INF.GE.10) THEN
c$$$c$$$ WRITE(*,*) 'ERROR, INF =',INF
c$$$c$$$ STOP
c$$$c$$$ ENDIF
c$$$c$$$ INTEGRAL = RESULT
c$$$c$$$ TAUFUNC_DSML = MFMEANPASS**D_TWO + MFVARPASS - INTEGRAL
c$$$
c$$$CCCCCCCCCCCCCCCCCCCCCC
c$$$
c$$$ RETURN
c$$$ END
c$$$
C==========================================================================================
C==========================================================================================
C==========================================================================================
C==========================================================================================
DOUBLE PRECISION FUNCTION TAUFUNC_DSML(TAU)
C==================================================================================
C PURPOSE: COMPUTES THE RIGHT-HAND SIDE OF EQ.(19) IN [1]
C==================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C TAU THE PARAMETER TAU DOUBLE PRECISION
C==================================================================================
IMPLICIT NONE
DOUBLE PRECISION INTEG_EPSABS,INTEG_EPSREL
INTEGER INTEG_LIM,INTEG_METH,INTEG_ORD
COMMON/INTEGRATORVARS1/INTEG_EPSABS,INTEG_EPSREL
COMMON/INTEGRATORVARS2/INTEG_LIM
COMMON/INTEGRATORVARS3/INTEG_METH,INTEG_ORD
DOUBLE PRECISION TAU,SIGMA2,INTEGRAL
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
INTEGER I_TWO,I_FOUR
COMMON/INTCONSTANTS/I_TWO,I_FOUR
DOUBLE PRECISION TAUFUNC_INT_DSML_GH,TAUFUNC_INT_DSML
EXTERNAL TAUFUNC_INT_DSML_GH,TAUFUNC_INT_DSML
DOUBLE PRECISION BOUND
INTEGER INF,NEVAL,IER,LIMIT,LENW,LAST
DOUBLE PRECISION EPSABS,EPSREL,RESULT
INTEGER IWORK(INTEG_LIM)
DOUBLE PRECISION WORK(I_FOUR*INTEG_LIM)
DOUBLE PRECISION INTEG_ABSERR
COMMON/INTEGRATORABSERR/INTEG_ABSERR
DOUBLE PRECISION MFMEANPASS,MFVARPASS,TAUPASS
COMMON/COMVARSMEANVAR/MFMEANPASS,MFVARPASS
COMMON/COMVARSTAU/TAUPASS
c$$$ INTEGER INTEG_METH
c$$$ INTEGER ORD
c$$$ PARAMETER(ORD = 16 INTEG_METH = 1) !20) !30)
c$$$ DOUBLE PRECISION X(ORD),W(ORD)
INTEGER I,ORD
DOUBLE PRECISION A,B,ALPHA,X(INTEG_ORD),W(INTEG_ORD)
IF(INTEG_METH.EQ.1) THEN
C
INF = I_TWO
LENW = I_FOUR*INTEG_LIM
EPSABS = INTEG_EPSABS
EPSREL = INTEG_EPSREL
TAUPASS = TAU
INTEG_ABSERR = D_ZERO
CALL DQAGI(TAUFUNC_INT_DSML,BOUND,INF,EPSABS,EPSREL,INTEGRAL,
$ INTEG_ABSERR,NEVAL,IER,INTEG_LIM,LENW,LAST,IWORK,WORK)
C
ELSEIF(INTEG_METH.EQ.2) THEN
C
SIGMA2 = D_ONE - D_TWO*TAU
A = D_ZERO
B = D_ONE/(D_TWO*SIGMA2)
ALPHA = D_ZERO
ORD = INTEG_ORD
CALL SGHNR(A,B,ALPHA,ORD,X,W)
TAUPASS = TAU
INTEGRAL = 0.0D0
DO I = 1,ORD
INTEGRAL = INTEGRAL + W(I)*TAUFUNC_INT_DSML_GH(X(I))
ENDDO
C
ELSE
C
WRITE(*,*)'INVALID INTEGRATION METHOD'
WRITE(*,*)'CHECK THE VALUE OF INTEG_METH IN INIT.f'
WRITE(*,*)'COMPUTATIONS ABORTED'
STOP
C
ENDIF
C
TAUFUNC_DSML = MFMEANPASS**D_TWO + MFVARPASS - INTEGRAL
RETURN
END
C==================================================================================
C==================================================================================
C==================================================================================
C==================================================================================
DOUBLE PRECISION FUNCTION TAUFUNC_INT_DSML_GH(PSI)
C==================================================================================
C PURPOSE: COMPUTES THE INTEGRAND OF THE SECOND TERM ON THE RIGHT-HAND SIDE
C OF EQ.(19) IN [1]
C==================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C PSI SAMPLE SPACE VARIABLE OF DOUBLE PRECISION
C THE REFERENCE FIELD PSI
C==================================================================================
IMPLICIT NONE
DOUBLE PRECISION PSI,X,R,SIGMA2
DOUBLE PRECISION ERF
EXTERNAL ERF
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
DOUBLE PRECISION TERM1,TERM2
DOUBLE PRECISION ETAMPASS,ALPHA1PASS,ALPHA2PASS,TAUPASS
COMMON/COMVARSETAM/ETAMPASS
COMMON/COMVARSALPHA12/ALPHA1PASS,ALPHA2PASS
COMMON/COMVARSTAU/TAUPASS
TERM1 = ETAMPASS*ERF((PSI-ALPHA1PASS)/(D_TWO*DSQRT(TAUPASS)))
TERM2 = (D_ONE-ETAMPASS)*ERF((PSI-ALPHA2PASS)
$ /(D_TWO*DSQRT(TAUPASS)))
X = D_HALF*(D_ONE+TERM1+TERM2)
TAUFUNC_INT_DSML_GH = X**D_TWO
RETURN
END
C==================================================================================
C==================================================================================
C==================================================================================
C==================================================================================
DOUBLE PRECISION FUNCTION TAUFUNC_INT_DSML(PSI)
C==================================================================================
C PURPOSE: COMPUTES THE INTEGRAND OF THE SECOND TERM ON THE RIGHT-HAND SIDE
C OF EQ.(19) IN [1]
C==================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C PSI SAMPLE SPACE VARIABLE OF DOUBLE PRECISION
C THE REFERENCE FIELD PSI
C==================================================================================
IMPLICIT NONE
DOUBLE PRECISION PSI,X,R,SIGMA2
DOUBLE PRECISION ERF
EXTERNAL ERF
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
DOUBLE PRECISION TERM1,TERM2
DOUBLE PRECISION ETAMPASS,ALPHA1PASS,ALPHA2PASS,TAUPASS
COMMON/COMVARSETAM/ETAMPASS
COMMON/COMVARSALPHA12/ALPHA1PASS,ALPHA2PASS
COMMON/COMVARSTAU/TAUPASS
TERM1 = ETAMPASS*ERF((PSI-ALPHA1PASS)/(D_TWO*DSQRT(TAUPASS)))
TERM2 = (D_ONE-ETAMPASS)*ERF((PSI-ALPHA2PASS)
$ /(D_TWO*DSQRT(TAUPASS)))
X = D_HALF*(D_ONE+TERM1+TERM2)
SIGMA2 = D_ONE-D_TWO*TAUPASS
R = (D_ONE/DSQRT(D_TWO*PI*SIGMA2))
$ * DEXP(-(PSI**D_TWO)/(D_TWO*SIGMA2))
TAUFUNC_INT_DSML = (X**D_TWO)*R
RETURN
END
C==================================================================================
C==================================================================================
C==================================================================================
C==================================================================================
DOUBLE PRECISION FUNCTION IIPMFPDF_V(MFVAR)
C==================================================================================
C PURPOSE: FUNCTION NECESSARY FOR THE COMPUTATION OF THE FIRST- AND
C SECOND-ORDER PARTIAL DERIVATIVES OF II(ETA) WITH RESPECT TO THE
C [MIXTURE FRACTION VARIANCE]
C==================================================================================
C VARIABLE DESCRIPTION DATA TYPE
C -------- ----------- ---------
C
C INPUT:
C
C MFVAR MIXTURE FRACTION VARIANCE DOUBLE PRECISION
C==================================================================================
IMPLICIT NONE
DOUBLE PRECISION MFVAR
DOUBLE PRECISION PMFMFMEANPASS
COMMON/MFMEANBLOK/PMFMFMEANPASS
DOUBLE PRECISION PMFCPASS
COMMON/C1BLOK/PMFCPASS
DOUBLE PRECISION PMFETAPASS,PMFETAMPASS
COMMON/ETABLOK/PMFETAPASS,PMFETAMPASS
DOUBLE PRECISION INT_TAU,INT_ALPHA1,INT_ALPHA2,INT_MFM,INT_MFV,
$ INT_SIGMA2
COMMON/IIINTEGBLOK/INT_TAU,INT_ALPHA1,INT_ALPHA2,INT_MFM,INT_MFV,
$ INT_SIGMA2
DOUBLE PRECISION C1,C2,ALPHA1,ALPHA2,TAU,SIGMA2
DOUBLE PRECISION CDF,PHI,X,TERM1,TERM2
DOUBLE PRECISION ERFINV,ERF,INVERSEX,CDFNORMDIST,IIEXTFUNC
EXTERNAL ERFINV,ERF,INVERSEX,CDFNORMDIST,IIEXTFUNC
DOUBLE PRECISION PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
COMMON/DBLECONSTANTS/PI,D_ZERO,D_ONE,D_HALF,D_TWO,D_THREE
INTEGER I_TWO,I_FOUR
COMMON/INTCONSTANTS/I_TWO,I_FOUR
DOUBLE PRECISION BOUND
INTEGER INF,NEVAL,IER,LIMIT,LENW,LAST
DOUBLE PRECISION EPSABS,EPSREL,RESULT
INTEGER IWORK(INTEG_LIM)
DOUBLE PRECISION WORK(I_FOUR*INTEG_LIM)
DOUBLE PRECISION INTEG_ABSERR
COMMON/INTEGRATORABSERR/INTEG_ABSERR
DOUBLE PRECISION INTEG_EPSABS,INTEG_EPSREL
INTEGER INTEG_LIM
COMMON/INTEGRATORVARS1/INTEG_EPSABS,INTEG_EPSREL
COMMON/INTEGRATORVARS2/INTEG_LIM
C1 = PMFCPASS
C2 = (PMFMFMEANPASS+C1-D_ONE)/(PMFETAMPASS-D_ONE)
ALPHA1 = DSQRT(D_TWO)*ERFINV(D_TWO*C1 - D_ONE)
ALPHA2 = DSQRT(D_TWO)*ERFINV(D_TWO*(C1+C2) - D_ONE)
CALL FIND_TAU_DSML(PMFMFMEANPASS,MFVAR,PMFETAMPASS,
$ ALPHA1,ALPHA2,TAU)
SIGMA2 = D_ONE - D_TWO*TAU
PHI = INVERSEX(PMFETAPASS,PMFETAMPASS,ALPHA1,ALPHA2,TAU)
TERM1 = PMFETAMPASS*ERF((PHI-ALPHA1)/(D_TWO*DSQRT(TAU)))
TERM2 = (D_ONE-PMFETAMPASS)*ERF((PHI-ALPHA2)/(D_TWO*DSQRT(TAU)))
X = D_HALF*(D_ONE+TERM1+TERM2)
CDF = CDFNORMDIST(PHI,D_ZERO,SIGMA2)
INF = -1
LENW = I_FOUR*INTEG_LIM