source: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/initialize_kpp_ctrl_template.f90 @ 3298

Last change on this file since 3298 was 3298, checked in by kanani, 6 years ago

Merge chemistry branch at r3297 to trunk

File size: 2.5 KB
Line 
1MODULE initialize_kpp_ctrl_template
2
3  ! HEADER MODULE initialize_kpp_ctrl_template
4
5  ! NOTES:
6  ! - L_VECTOR is automatically defined by kp4
7  ! - VL_DIM is automatically defined by kp4
8  ! - I_LU_DI is automatically defined by kp4
9  ! - WANTED is automatically defined by xmecca
10  ! - ICNTRL RCNTRL are automatically defined by kpp
11  ! - "USE messy_main_tools" is in Module_header of messy_mecca_kpp.f90
12  ! - SAVE will be automatically added by kp4
13
14  IMPLICIT NONE
15  !SAVE
16
17  ! FOR FIXED TIME STEP CONTROL
18  ! ... max. number of fixed time steps (sum must be 1)
19  INTEGER, PARAMETER         :: NMAXFIXSTEPS = 50
20  ! ... switch for fixed time stepping
21  LOGICAL, PUBLIC            :: l_fixed_step = .FALSE.
22  INTEGER, PUBLIC            :: nfsteps = 1
23  ! ... number of kpp control parameters
24  INTEGER, PARAMETER, PUBLIC :: NKPPCTRL = 20
25  !
26  INTEGER,  DIMENSION(NKPPCTRL), PUBLIC     :: icntrl = 0
27  REAL(DP), DIMENSION(NKPPCTRL), PUBLIC     :: rcntrl = 0.0_dp
28  REAL(DP), DIMENSION(NMAXFIXSTEPS), PUBLIC :: t_steps = 0.0_dp
29
30  ! END HEADER MODULE initialize_kpp_ctrl_template
31
32CONTAINS
33
34SUBROUTINE initialize_kpp_ctrl(status)
35
36  IMPLICIT NONE
37
38  ! I/O
39  INTEGER,          INTENT(OUT) :: status
40
41  ! LOCAL
42  REAL(DP) :: tsum
43  INTEGER  :: i
44
45  ! check fixed time steps
46  tsum = 0.0_dp
47  DO i=1, NMAXFIXSTEPS
48     IF (t_steps(i) < TINY(0.0_DP)) EXIT
49     tsum = tsum + t_steps(i)
50  END DO
51
52  nfsteps = i-1
53
54  l_fixed_step = (nfsteps > 0) .AND. ( (tsum -1.0) < TINY(0.0_DP) )
55
56  IF (L_VECTOR) THEN
57     WRITE(*,*) ' MODE             : VECTOR (LENGTH=',VL_DIM,')'
58  ELSE
59     WRITE(*,*) ' MODE             : SCALAR'
60  END IF
61  !
62  WRITE(*,*) ' DE-INDEXING MODE :',I_LU_DI
63  !
64  WRITE(*,*) ' ICNTRL           : ',icntrl
65  WRITE(*,*) ' RCNTRL           : ',rcntrl
66  !
67  ! NOTE: THIS IS ONLY MEANINGFUL FOR VECTORIZED (kp4) ROSENBROCK-METHODS
68  IF (L_VECTOR) THEN
69     IF (l_fixed_step) THEN
70        WRITE(*,*) ' TIME STEPS       : FIXED (',t_steps(1:nfsteps),')'
71     ELSE
72        WRITE(*,*) ' TIME STEPS       : AUTOMATIC'
73     END IF
74  ELSE
75     WRITE(*,*) ' TIME STEPS       : AUTOMATIC '//&
76          &'(t_steps (CTRL_KPP) ignored in SCALAR MODE)'
77  END IF
78  ! mz_pj_20070531-
79
80  status = 0
81
82
83END SUBROUTINE initialize_kpp_ctrl
84
85SUBROUTINE error_output(C,ierr,PE)
86
87  IMPLICIT NONE
88
89  INTEGER, INTENT(IN) :: ierr
90  INTEGER, INTENT(IN) :: PE
91  REAL(dp), DIMENSION(:),INTENT(IN) :: C
92
93  write(6,*) 'ERROR in chem_gasphase_mod ',ierr,C(1)
94
95
96END SUBROUTINE error_output
97
98END MODULE initialize_kpp_ctrl_template
Note: See TracBrowser for help on using the repository browser.