58 character(len=:),
allocatable,
public :: rep_name
67 type(
property_t),
pointer,
public :: property_set => null()
72 real(kind=
dp),
allocatable,
public :: condensed_data_real(:)
77 integer(kind=i_kind),
allocatable,
public :: condensed_data_int(:)
81 logical,
allocatable,
public :: aero_phase_is_at_surface(:)
85 integer(kind=i_kind),
public :: num_env_params = 0
155 integer(kind=c_int) :: aero_rep_type
157 integer(kind=c_int) :: aero_rep_solver_id = 0
159 integer(kind=c_int) :: cell_id = 1
161 type(c_ptr) :: update_data
187 integer :: first_ = -9999
188 integer :: second_ = -9999
213 integer(kind=i_kind),
intent(in) :: spec_state_id
227 integer,
intent(in) :: comm
240 character,
intent(inout) :: buffer(:)
242 integer,
intent(inout) :: pos
244 integer,
intent(in) :: comm
257 character,
intent(inout) :: buffer(:)
259 integer,
intent(inout) :: pos
261 integer,
intent(in) :: comm
275 integer(kind=i_kind) :: state_size
296 character(len=*),
optional,
intent(in) :: phase_name
298 integer(kind=i_kind),
optional,
intent(in) :: tracer_type
300 character(len=*),
optional,
intent(in) ::
spec_name
302 logical,
optional,
intent(in) :: phase_is_at_surface
328 integer(kind=i_kind) :: spec_id
332 character(len=*),
intent(in) :: unique_name
344 character(len=:),
allocatable ::
spec_name
348 character(len=*),
intent(in) :: unique_name
364 character(len=*),
intent(in) :: phase_name
366 logical,
intent(in),
optional :: is_at_surface
383 integer(kind=i_kind),
intent(in) :: phase_id
433 subroutine load(this, json, j_obj)
438 type(json_core),
pointer,
intent(in) :: json
440 type(json_value),
pointer,
intent(in) :: j_obj
442 type(json_value),
pointer :: child, next
443 character(kind=json_ck, len=:),
allocatable :: key, unicode_str_val
444 integer(kind=json_ik) :: var_type
445 logical :: found_name
450 if (.not.
allocated(this%rep_name)) &
451 this%rep_name =
"unknown aerosol representation"
457 call json%get_child(j_obj, child)
458 do while (
associated(child))
459 call json%info(child, name=key, var_type=var_type)
462 if (key.eq.
"name")
then
463 call assert_msg(196193896, var_type.eq.json_string, &
464 "Received non-string value for aerosol rep name")
465 call json%get(child, unicode_str_val)
466 this%rep_name = unicode_str_val
470 else if (key.ne.
"type")
then
471 call this%property_set%load(json, child, .false., this%rep_name)
474 call json%get_next(child, next)
477 call assert_msg(420903951, found_name, &
478 "Received unnamed aerosol representation.")
480 subroutine load(this)
485 call warn_msg(433045149,
"No support for input files")
496 character(len=:),
allocatable ::
get_name
511 integer(kind=i_kind),
allocatable ::
phase_ids(:)
515 character(len=*),
intent(in) :: phase_name
517 logical,
intent(in),
optional :: is_at_surface
519 integer(kind=i_kind) :: num_instances, i_instance, i_phase
521 num_instances = this%num_phase_instances(phase_name, is_at_surface)
523 if (
present(is_at_surface))
then
524 if (is_at_surface)
then
526 do i_phase = 1,
size(this%aero_phase)
527 if (this%aero_phase(i_phase)%val%name().eq. phase_name .and. &
528 this%aero_phase_is_at_surface(i_phase))
then
530 i_instance = i_instance + 1
535 do i_phase = 1,
size(this%aero_phase)
536 if (this%aero_phase(i_phase)%val%name().eq. phase_name .and. &
537 .not. this%aero_phase_is_at_surface(i_phase))
then
539 i_instance = i_instance + 1
545 do i_phase = 1,
size(this%aero_phase)
546 if (this%aero_phase(i_phase)%val%name().eq.phase_name)
then
548 i_instance = i_instance + 1
552 call assert(642387392, num_instances == i_instance-1)
565 integer,
intent(in) :: comm
582 character,
intent(inout) :: buffer(:)
584 integer,
intent(inout) :: pos
586 integer,
intent(in) :: comm
589 integer :: prev_position
595 call assert(257024095, &
596 pos - prev_position <= this%pack_size(comm))
609 character,
intent(inout) :: buffer(:)
611 integer,
intent(inout) :: pos
613 integer,
intent(in) :: comm
616 integer :: prev_position
623 call assert(954732699, &
624 pos - prev_position <= this%pack_size(comm))
637 integer(kind=i_kind),
optional :: file_unit
639 integer(kind=i_kind) :: f_unit
643 if (
present(file_unit)) f_unit = file_unit
644 write(f_unit,*)
"*** Aerosol Representation: ",trim(this%rep_name),
" ***"
645 if (
associated(this%property_set))
call this%property_set%print(f_unit)
646 if (
allocated(this%condensed_data_int)) &
647 write(f_unit,*)
" *** condensed data int: ",this%condensed_data_int(:)
648 if (
allocated(this%condensed_data_real)) &
649 write(f_unit,*)
" *** condensed data real: ",this%condensed_data_real(:)
673 if (
associated(this%val))
deallocate(this%val)
685 integer(kind=i_kind) :: i
699 integer(kind=c_int) :: aero_rep_type
703 aero_rep_type = this%aero_rep_type
713 integer(kind=c_int) :: cell_id
717 cell_id = this%cell_id
727 type(c_ptr) :: update_data
731 update_data = this%update_data
744 integer,
intent(in),
optional :: comm
749 if (
present(comm))
then
752 l_comm = mpi_comm_world
760 this%internal_pack_size(l_comm)
775 character,
intent(inout) :: buffer(:)
777 integer,
intent(inout) :: pos
779 integer,
intent(in),
optional :: comm
782 integer :: prev_position, l_comm
784 if (
present(comm))
then
787 l_comm = mpi_comm_world
792 int(this%aero_rep_type, kind=
i_kind), l_comm)
794 int(this%aero_rep_solver_id, kind=
i_kind), &
796 call this%internal_bin_pack(buffer, pos, l_comm)
797 call assert(538137635, &
798 pos - prev_position <= this%pack_size(l_comm))
811 character,
intent(inout) :: buffer(:)
813 integer,
intent(inout) :: pos
815 integer,
intent(in),
optional :: comm
818 integer :: prev_position, l_comm
819 integer(kind=i_kind) :: temp_int
821 if (
present(comm))
then
824 l_comm = mpi_comm_world
829 this%aero_rep_type = int(temp_int, kind=c_int)
831 this%aero_rep_solver_id = int(temp_int, kind=c_int)
832 call this%internal_bin_unpack(buffer, pos, l_comm)
833 call assert(257567920, &
834 pos - prev_position <= this%pack_size(l_comm))
847 integer(kind=i_kind),
optional :: file_unit
849 integer(kind=i_kind) :: f_unit
853 if (
present(file_unit)) f_unit = file_unit
855 write(f_unit,*)
"*** Aerosol representation update data ***"
856 write(f_unit,*)
"Aerosol representation type", this%aero_rep_type
857 write(f_unit,*)
"Aerosol representation solver id", this%aero_rep_solver_id
Get the size of the section of the camp_camp_state::camp_state_t::state_var array required for this a...
Initialize the aerosol representation data, validating component data and loading any required inform...
Extending-type binary pack function (Internal use only)
Extending-type binary unpack function (Internal use only)
Extending-type binary pack size (internal use only)
Get the number of Jacobian elements used in calculations of aerosol mass, volume, number,...
Get the number of instances of a specified aerosol phase.
Get the non-unique name of a chemical species by its unique name.
Get a species id on the camp_camp_state::camp_state_t::state_var array by unique name....
Get a list of unique names for each element on the camp_camp_state::camp_state_t::state_var array for...
The abstract aero_phase_data_t structure and associated subroutines.
subroutine bin_unpack(this, buffer, pos, comm)
Unpack the given value from the buffer, advancing position.
character(len=:) function, allocatable get_name(this)
Get the aerosol phase name.
subroutine ptr_finalize_array(this)
Finalize an array of pointers to aerosol phase data.
subroutine bin_pack(this, buffer, pos, comm)
Pack the given value to the buffer, advancing position.
subroutine load(this, json, j_obj)
Load species from an input file.
integer(kind=i_kind) function pack_size(this, comm)
Determine the size of a binary required to pack the aerosol representation data.
subroutine ptr_finalize(this)
Finalize a pointer to aerosol phase data.
subroutine do_print(this, file_unit)
Print out the aerosol phase data.
elemental subroutine dereference(this)
Dereference a pointer to aerosol phase data.
The abstract aero_rep_data_t structure and associated subroutines.
subroutine do_aero_rep_update_data_print(this, file_unit)
Print the update data.
integer(kind=i_kind) function, dimension(:), allocatable phase_ids(this, phase_name, is_at_surface)
Get a set of ids for all instances of a phase in this aerosol representation for use during solving.
type(c_ptr) function aero_rep_update_data_get_data(this)
Get the update data.
integer(kind=i_kind) function aero_rep_update_data_pack_size(this, comm)
Determine the size of a binary required to pack the reaction data.
subroutine do_print(this, file_unit)
Print the aerosol representation data.
subroutine aero_rep_update_data_bin_pack(this, buffer, pos, comm)
Pack the given value to the buffer, advancing position.
subroutine ptr_finalize(this)
Finalize a pointer to an aerosol representation.
integer(kind=i_kind) function pack_size(this, comm)
Determine the size of a binary required to pack the aerosol representation data.
subroutine load(this, json, j_obj)
Load an aerosol representation from an input file.
subroutine aero_rep_update_data_bin_unpack(this, buffer, pos, comm)
Unpack the given value from the buffer, advancing position.
subroutine bin_unpack(this, buffer, pos, comm)
Unpack the given value from the buffer, advancing position.
elemental subroutine dereference(this)
Deference a pointer to an aerosol representation.
integer(kind=c_int) function aero_rep_update_data_get_type(this)
Get the update data aerosol representation type.
subroutine bin_pack(this, buffer, pos, comm)
Pack the given value to the buffer, advancing position.
character(len=:) function, allocatable get_name(this)
Get the name of the aerosol representation.
subroutine ptr_finalize_array(this)
Finalize an array of pointers to aerosol representations.
integer(kind=c_int) function aero_rep_update_data_get_cell_id(this)
Get the grid cell id to update.
The camp_state_t structure and associated subroutines.
The chem_spec_data_t structure and associated subroutines.
logical function get_type(this, spec_name, spec_type)
Get a species type by species name. Returns true if the species is found or false otherwise.
integer, parameter dp
Kind of a double precision real number.
integer, parameter i_kind
Kind of an integer.
Wrapper functions for MPI.
subroutine camp_mpi_pack_integer_array(buffer, position, val, comm)
Packs the given value into the buffer, advancing position.
subroutine camp_mpi_pack_real_array(buffer, position, val, comm)
Packs the given value into the buffer, advancing position.
subroutine camp_mpi_unpack_integer_array(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
subroutine camp_mpi_unpack_integer(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
integer function camp_mpi_pack_size_real_array(val, comm)
Determines the number of bytes required to pack the given value.
integer function camp_mpi_pack_size_integer_array(val, comm)
Determines the number of bytes required to pack the given value.
subroutine camp_mpi_pack_integer(buffer, position, val, comm)
Packs the given value into the buffer, advancing position.
integer function camp_mpi_pack_size_integer(val, comm)
Determines the number of bytes required to pack the given value.
subroutine camp_mpi_unpack_real_array(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
The property_t structure and associated subroutines.
Common utility subroutines.
subroutine die_msg(code, error_msg)
Error immediately.
Pointer type for building arrays.
Pointer to aero_rep_data_t extending types.
Abstract aerosol representation data type.
Define index_pair array for adjacent_phases functions.
String type for building arrays of string of various size.