26 integer(kind=i_kind) :: idx_o3, idx_no, idx_no2, idx_o2
29 character(len=*),
parameter :: fmt_hdr =
"(A10,',',A10,',',A10,',',A10,',',A10)"
30 character(len=*),
parameter :: fmt_dat =
"(ES10.4,',',ES10.4,',',ES10.4,',',ES10.4,',',ES10.4)"
32 integer(kind=i_kind) :: i_time
35 integer(kind=i_kind) :: i_rxn
36 character(len=:),
allocatable :: photo_label
50 call camp_core%initialize( )
52 if( .not.camp_core%get_chem_spec_data( chem_spec_data ) )
then
53 write(*,*)
"Something's gone wrong!"
57 idx_o3 = chem_spec_data%gas_state_id(
"O3" )
58 idx_no = chem_spec_data%gas_state_id(
"NO" )
59 idx_no2 = chem_spec_data%gas_state_id(
"NO2" )
60 idx_o2 = chem_spec_data%gas_state_id(
"O2" )
61 if( idx_o3.eq.0 .or. idx_no2.eq.0 .or.idx_o2.eq.0 )
then
62 write(*,*)
"Missing species!"
67 if( .not.camp_core%get_mechanism(
"my simple mechanism", mechanism ) )
then
68 write(*,*)
"Missing mechanism!"
72 do i_rxn = 1, mechanism%size( )
73 photo_rxn => mechanism%get_rxn( i_rxn )
74 select type( photo_rxn )
76 if( photo_rxn%property_set%get_string(
"my photo label", photo_label ) )
then
77 if( photo_label .eq.
"NO2 photolysis" )
then
78 call camp_core%initialize_update_object( photo_rxn, no2_photolysis )
85 call camp_core%solver_initialize( )
86 camp_state => camp_core%new_state( )
88 call camp_state%env_states(1)%set_temperature_K( 275.4_dp )
89 call camp_state%env_states(1)%set_pressure_Pa( 101532.2_dp )
91 camp_state%state_var( idx_o3 ) = 0.13
92 camp_state%state_var( idx_no ) = 0.02
93 camp_state%state_var( idx_no2 ) = 0.053
94 camp_state%state_var( idx_o2 ) = 2.1e5
97 call no2_photolysis%set_rate( 12.2d0 )
98 call camp_core%update_data( no2_photolysis )
101 write(*,fmt_hdr)
"time",
"O3",
"NO",
"NO2",
"O2"
103 call camp_core%solve( camp_state, 1.0d-15 )
104 write(*,fmt_dat) i_time*1.0e-15, &
105 camp_state%state_var( idx_o3 ), &
106 camp_state%state_var( idx_no ), &
107 camp_state%state_var( idx_no2 ), &
108 camp_state%state_var( idx_o2 )
111 deallocate( camp_core )
112 deallocate( camp_state )
The camp_core_t structure and associated subroutines.
The camp_state_t structure and associated subroutines.
The chem_spec_data_t structure and associated subroutines.
The mechanism_data_t structure and associated subroutines.
Wrapper functions for MPI.
subroutine camp_mpi_init()
Initialize MPI.
subroutine camp_mpi_finalize()
Shut down MPI.
The rxn_data_t structure and associated subroutines.
The abstract rxn_factory_t structure and associated subroutines.
The rxn_photolysis_t type and associated functions.
Abstract reaction data type.
Factory type for chemical reactions.
Generic test reaction data type.
Photolysis rate update object.