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
159 integer(kind=c_int) :: aero_rep_type
161 integer(kind=c_int) :: aero_rep_solver_id = 0
163 integer(kind=c_int) :: cell_id = 1
165 type(c_ptr) :: update_data
191 integer :: first_ = -9999
192 integer :: second_ = -9999
217 integer(kind=i_kind),
intent(in) :: spec_state_id
231 integer,
intent(in) :: comm
244 character,
intent(inout) :: buffer(:)
246 integer,
intent(inout) :: pos
248 integer,
intent(in) :: comm
261 character,
intent(inout) :: buffer(:)
263 integer,
intent(inout) :: pos
265 integer,
intent(in) :: comm
279 integer(kind=i_kind) :: state_size
300 character(len=*),
optional,
intent(in) :: phase_name
302 integer(kind=i_kind),
optional,
intent(in) :: tracer_type
304 character(len=*),
optional,
intent(in) ::
spec_name
306 logical,
optional,
intent(in) :: phase_is_at_surface
332 integer(kind=i_kind) :: spec_id
336 character(len=*),
intent(in) :: unique_name
348 character(len=:),
allocatable ::
spec_name
352 character(len=*),
intent(in) :: unique_name
368 character(len=*),
intent(in) :: phase_name
370 logical,
intent(in),
optional :: is_at_surface
387 integer(kind=i_kind),
intent(in) :: phase_id
397 phase_name_second)
result (index_pairs)
405 character(len=*),
intent(in) :: phase_name_first
407 character(len=*),
intent(in) :: phase_name_second
419 integer(kind=i_kind) :: spec_id
423 integer(kind=i_kind),
intent(in) :: phase_id
425 character(len=*),
intent(in) ::
spec_name
475 subroutine load(this, json, j_obj)
480 type(json_core),
pointer,
intent(in) :: json
482 type(json_value),
pointer,
intent(in) :: j_obj
484 type(json_value),
pointer :: child, next
485 character(kind=json_ck, len=:),
allocatable :: key, unicode_str_val
486 integer(kind=json_ik) :: var_type
487 logical :: found_name
492 if (.not.
allocated(this%rep_name)) &
493 this%rep_name =
"unknown aerosol representation"
499 call json%get_child(j_obj, child)
500 do while (
associated(child))
501 call json%info(child, name=key, var_type=var_type)
504 if (key.eq.
"name")
then
505 call assert_msg(196193896, var_type.eq.json_string, &
506 "Received non-string value for aerosol rep name")
507 call json%get(child, unicode_str_val)
508 this%rep_name = unicode_str_val
512 else if (key.ne.
"type")
then
513 call this%property_set%load(json, child, .false., this%rep_name)
516 call json%get_next(child, next)
519 call assert_msg(420903951, found_name, &
520 "Received unnamed aerosol representation.")
522 subroutine load(this)
527 call warn_msg(433045149,
"No support for input files")
538 character(len=:),
allocatable ::
get_name
553 integer(kind=i_kind),
allocatable ::
phase_ids(:)
557 character(len=*),
intent(in) :: phase_name
559 logical,
intent(in),
optional :: is_at_surface
561 integer(kind=i_kind) :: num_instances, i_instance, i_phase
563 num_instances = this%num_phase_instances(phase_name, is_at_surface)
565 if (
present(is_at_surface))
then
566 if (is_at_surface)
then
568 do i_phase = 1,
size(this%aero_phase)
569 if (this%aero_phase(i_phase)%val%name().eq. phase_name .and. &
570 this%aero_phase_is_at_surface(i_phase))
then
572 i_instance = i_instance + 1
577 do i_phase = 1,
size(this%aero_phase)
578 if (this%aero_phase(i_phase)%val%name().eq. phase_name .and. &
579 .not. this%aero_phase_is_at_surface(i_phase))
then
581 i_instance = i_instance + 1
587 do i_phase = 1,
size(this%aero_phase)
588 if (this%aero_phase(i_phase)%val%name().eq.phase_name)
then
590 i_instance = i_instance + 1
594 call assert(642387392, num_instances == i_instance-1)
607 integer,
intent(in) :: comm
624 character,
intent(inout) :: buffer(:)
626 integer,
intent(inout) :: pos
628 integer,
intent(in) :: comm
631 integer :: prev_position
637 call assert(257024095, &
638 pos - prev_position <= this%pack_size(comm))
651 character,
intent(inout) :: buffer(:)
653 integer,
intent(inout) :: pos
655 integer,
intent(in) :: comm
658 integer :: prev_position
665 call assert(954732699, &
666 pos - prev_position <= this%pack_size(comm))
679 integer(kind=i_kind),
optional :: file_unit
681 integer(kind=i_kind) :: f_unit
685 if (
present(file_unit)) f_unit = file_unit
686 write(f_unit,*)
"*** Aerosol Representation: ",trim(this%rep_name),
" ***"
687 if (
associated(this%property_set))
call this%property_set%print(f_unit)
688 if (
allocated(this%condensed_data_int)) &
689 write(f_unit,*)
" *** condensed data int: ",this%condensed_data_int(:)
690 if (
allocated(this%condensed_data_real)) &
691 write(f_unit,*)
" *** condensed data real: ",this%condensed_data_real(:)
715 if (
associated(this%val))
deallocate(this%val)
727 integer(kind=i_kind) :: i
741 integer(kind=c_int) :: aero_rep_type
745 aero_rep_type = this%aero_rep_type
755 integer(kind=c_int) :: cell_id
759 cell_id = this%cell_id
769 type(c_ptr) :: update_data
773 update_data = this%update_data
786 integer,
intent(in),
optional :: comm
791 if (
present(comm))
then
794 l_comm = mpi_comm_world
802 this%internal_pack_size(l_comm)
817 character,
intent(inout) :: buffer(:)
819 integer,
intent(inout) :: pos
821 integer,
intent(in),
optional :: comm
824 integer :: prev_position, l_comm
826 if (
present(comm))
then
829 l_comm = mpi_comm_world
834 int(this%aero_rep_type, kind=
i_kind), l_comm)
836 int(this%aero_rep_solver_id, kind=
i_kind), &
838 call this%internal_bin_pack(buffer, pos, l_comm)
839 call assert(538137635, &
840 pos - prev_position <= this%pack_size(l_comm))
853 character,
intent(inout) :: buffer(:)
855 integer,
intent(inout) :: pos
857 integer,
intent(in),
optional :: comm
860 integer :: prev_position, l_comm
861 integer(kind=i_kind) :: temp_int
863 if (
present(comm))
then
866 l_comm = mpi_comm_world
871 this%aero_rep_type = int(temp_int, kind=c_int)
873 this%aero_rep_solver_id = int(temp_int, kind=c_int)
874 call this%internal_bin_unpack(buffer, pos, l_comm)
875 call assert(257567920, &
876 pos - prev_position <= this%pack_size(l_comm))
889 integer(kind=i_kind),
optional :: file_unit
891 integer(kind=i_kind) :: f_unit
895 if (
present(file_unit)) f_unit = file_unit
897 write(f_unit,*)
"*** Aerosol representation update data ***"
898 write(f_unit,*)
"Aerosol representation type", this%aero_rep_type
899 write(f_unit,*)
"Aerosol representation solver id", this%aero_rep_solver_id
Determine if specified phase(s) exist in adjacent layers. Returns array of phase_ids for adjacent pha...
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 the species id on the state array by phase_id and species 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.
character(len=camp_util_convert_string_len) function integer_to_string(val)
Convert an integer to a string format.
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.