CAMP 1.0.0
Chemistry Across Multiple Phases
camp_box_model.F90
Go to the documentation of this file.
1! Copyright (C) 2021 Barcelona Supercomputing Center and University of
2! Illinois at Urbana-Champaign
3! SPDX-License-Identifier: MIT
4
5!> \file
6!> The camp_camp_box_model program
7
8!> Driver for the \ref index "CAMP" box model
10
12 use camp_util
13
14 implicit none
15
16 ! New-line character
17 character(len=*), parameter :: new_line = char(10)
18 ! Output file unit
19 integer(kind=i_kind), parameter :: output_file_unit = 7
20
21 ! Config file list path
22 character(len=300) :: config_file_arg
23 character(len=:), allocatable :: config_file
24 ! Output file name
25 character(len=300) :: output_file_arg
26 character(len=:), allocatable :: output_file_prefix, output_file
27
28 ! The box model data
29 type(camp_box_model_data_t), pointer :: box_model
30
31 ! Get the configuration and output file names
32 if ( command_argument_count( ) /= 2 ) then
33 write(*,*) "Usage: camp_box_model box_model_config.json "// &
34 "output_file_prefix"
35 write(*,*) "Output files created"
36 write(*,*) " output_file_prefix_results.txt: Box model results"
37 write(*,*) " output_file_prefix.conf: GNU Plot configuration file "// &
38 "for plotting results"
39 call die_msg( 695622653, "Incorrect number of command line arguments" )
40 end if
41 call get_command_argument( 1, config_file_arg )
42 call get_command_argument( 2, output_file_arg )
43 config_file = trim( config_file_arg )
44 output_file_prefix = trim( output_file_arg )
45
46 ! Create a new box model
47 box_model => camp_box_model_data_t( config_file )
48
49 call box_model%print( )
50
51 ! Open the output file
52 output_file = output_file_prefix//"_results.txt"
53 open( unit = output_file_unit, file = output_file, status = "replace", &
54 action = "write" )
55
56 ! Run the camp-chem box model
57 call box_model%run( output_file_unit )
58
59 ! Close the output file
60 close( output_file_unit )
61
62 ! Create the GNU Plot config file
63 call box_model%create_gnuplot_config_file( output_file_prefix )
64
65 ! Free the box model and local variables
66 deallocate( box_model )
67 deallocate( config_file )
68 deallocate( output_file_prefix )
69 deallocate( output_file )
70
71end program camp_camp_box_model
program camp_camp_box_model
Driver for the CAMP box model.
A simple box model for CAMP mechanisms.
character(len= *), parameter new_line
Common utility subroutines.
Definition util.F90:9
subroutine die_msg(code, error_msg)
Error immediately.
Definition util.F90:196
program box_model