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

Last change on this file since 3833 was 3833, checked in by forkel, 2 years ago

removed USE chem_gasphase_mod from chem_modules, apply USE chem_gasphase for nvar, nspec, cs_mech and spc_names instead

File size: 2.6 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  ! Steering parameters for chemistry solver (see KPP domumentation)
27  INTEGER, DIMENSION(NKPPCTRL), PUBLIC      :: icntrl = 0
28  REAL(DP), DIMENSION(NKPPCTRL), PUBLIC     :: rcntrl = 0.0_dp
29  ! t_steps: fixed time steps in vector mode
30  REAL(DP), DIMENSION(NMAXFIXSTEPS), PUBLIC :: t_steps = 0.0_dp
31
32  ! END HEADER MODULE initialize_kpp_ctrl_template
33
34CONTAINS
35
36SUBROUTINE initialize_kpp_ctrl(status)
37
38  IMPLICIT NONE
39
40  ! I/O
41  INTEGER,          INTENT(OUT) :: status
42
43  ! LOCAL
44  REAL(DP) :: tsum
45  INTEGER  :: i
46
47  ! check fixed time steps
48  tsum = 0.0_dp
49  DO i=1, NMAXFIXSTEPS
50     IF (t_steps(i) < TINY(0.0_DP)) EXIT
51     tsum = tsum + t_steps(i)
52  END DO
53
54  nfsteps = i-1
55
56  l_fixed_step = (nfsteps > 0) .AND. ( (tsum -1.0) < TINY(0.0_DP) )
57
58  IF (L_VECTOR) THEN
59     WRITE(*,*) ' MODE             : VECTOR (LENGTH=',VL_DIM,')'
60  ELSE
61     WRITE(*,*) ' MODE             : SCALAR'
62  END IF
63  !
64  WRITE(*,*) ' DE-INDEXING MODE :',I_LU_DI
65  !
66  WRITE(*,*) ' ICNTRL           : ',icntrl
67  WRITE(*,*) ' RCNTRL           : ',rcntrl
68  !
69  ! NOTE: THIS IS ONLY MEANINGFUL FOR VECTORIZED (kp4) ROSENBROCK-METHODS
70  IF (L_VECTOR) THEN
71     IF (l_fixed_step) THEN
72        WRITE(*,*) ' TIME STEPS       : FIXED (',t_steps(1:nfsteps),')'
73     ELSE
74        WRITE(*,*) ' TIME STEPS       : AUTOMATIC'
75     END IF
76  ELSE
77     WRITE(*,*) ' TIME STEPS       : AUTOMATIC '//&
78          &'(t_steps (CTRL_KPP) ignored in SCALAR MODE)'
79  END IF
80  ! mz_pj_20070531-
81
82  status = 0
83
84
85END SUBROUTINE initialize_kpp_ctrl
86
87SUBROUTINE error_output(C,ierr,PE)
88
89  IMPLICIT NONE
90
91  INTEGER, INTENT(IN) :: ierr
92  INTEGER, INTENT(IN) :: PE
93  REAL(dp), DIMENSION(:),INTENT(IN) :: C
94
95  write(6,*) 'ERROR in chem_gasphase_mod ',ierr,C(1),PE
96
97
98END SUBROUTINE error_output
99
100END MODULE initialize_kpp_ctrl_template
Note: See TracBrowser for help on using the repository browser.