57 character(len=:),
allocatable,
public :: rep_name
66 type(
property_t),
pointer,
public :: property_set => null()
71 real(kind=
dp),
allocatable,
public :: condensed_data_real(:)
76 integer(kind=i_kind),
allocatable,
public :: condensed_data_int(:)
80 logical,
allocatable,
public :: aero_phase_is_at_surface(:)
84 integer(kind=i_kind),
public :: num_env_params = 0
154 integer(kind=c_int) :: aero_rep_type
156 integer(kind=c_int) :: aero_rep_solver_id = 0
158 integer(kind=c_int) :: cell_id = 1
160 type(c_ptr) :: update_data
206 integer(kind=i_kind),
intent(in) :: spec_state_id
220 integer,
intent(in) :: comm
233 character,
intent(inout) :: buffer(:)
235 integer,
intent(inout) :: pos
237 integer,
intent(in) :: comm
250 character,
intent(inout) :: buffer(:)
252 integer,
intent(inout) :: pos
254 integer,
intent(in) :: comm
268 integer(kind=i_kind) :: state_size
288 character(len=*),
optional,
intent(in) :: phase_name
290 integer(kind=i_kind),
optional,
intent(in) :: tracer_type
292 character(len=*),
optional,
intent(in) ::
spec_name
318 integer(kind=i_kind) :: spec_id
322 character(len=*),
intent(in) :: unique_name
334 character(len=:),
allocatable ::
spec_name
338 character(len=*),
intent(in) :: unique_name
354 character(len=*),
intent(in) :: phase_name
371 integer(kind=i_kind),
intent(in) :: phase_id
421 subroutine load(this, json, j_obj)
426 type(json_core),
pointer,
intent(in) :: json
428 type(json_value),
pointer,
intent(in) :: j_obj
430 type(json_value),
pointer :: child, next
431 character(kind=json_ck, len=:),
allocatable :: key, unicode_str_val
432 integer(kind=json_ik) :: var_type
433 logical :: found_name
438 if (.not.
allocated(this%rep_name)) &
439 this%rep_name =
"unknown aerosol representation"
445 call json%get_child(j_obj, child)
446 do while (
associated(child))
447 call json%info(child, name=key, var_type=var_type)
450 if (key.eq.
"name")
then
451 call assert_msg(196193896, var_type.eq.json_string, &
452 "Received non-string value for aerosol rep name")
453 call json%get(child, unicode_str_val)
454 this%rep_name = unicode_str_val
458 else if (key.ne.
"type")
then
459 call this%property_set%load(json, child, .false., this%rep_name)
462 call json%get_next(child, next)
465 call assert_msg(420903951, found_name, &
466 "Received unnamed aerosol representation.")
468 subroutine load(this)
473 call warn_msg(433045149,
"No support for input files")
484 character(len=:),
allocatable ::
get_name
499 integer(kind=i_kind),
allocatable ::
phase_ids(:)
503 character(len=*),
intent(in) :: phase_name
505 logical,
intent(in),
optional :: is_at_surface
507 integer(kind=i_kind) :: num_instances, i_instance, i_phase
509 num_instances = this%num_phase_instances(phase_name)
511 if (
present(is_at_surface))
then
512 if (is_at_surface)
then
514 do i_phase = 1,
size(this%aero_phase)
515 if (this%aero_phase(i_phase)%val%name().eq. phase_name .and. &
516 this%aero_phase_is_at_surface(i_phase))
then
518 i_instance = i_instance + 1
523 do i_phase = 1,
size(this%aero_phase)
524 if (this%aero_phase(i_phase)%val%name().eq. phase_name .and. &
525 .not. this%aero_phase_is_at_surface(i_phase))
then
527 i_instance = i_instance + 1
533 do i_phase = 1,
size(this%aero_phase)
534 if (this%aero_phase(i_phase)%val%name().eq.phase_name)
then
536 i_instance = i_instance + 1
552 integer,
intent(in) :: comm
569 character,
intent(inout) :: buffer(:)
571 integer,
intent(inout) :: pos
573 integer,
intent(in) :: comm
576 integer :: prev_position
582 call assert(257024095, &
583 pos - prev_position <= this%pack_size(comm))
596 character,
intent(inout) :: buffer(:)
598 integer,
intent(inout) :: pos
600 integer,
intent(in) :: comm
603 integer :: prev_position
610 call assert(954732699, &
611 pos - prev_position <= this%pack_size(comm))
624 integer(kind=i_kind),
optional :: file_unit
626 integer(kind=i_kind) :: f_unit
630 if (
present(file_unit)) f_unit = file_unit
631 write(f_unit,*)
"*** Aerosol Representation: ",trim(this%rep_name),
" ***"
632 if (
associated(this%property_set))
call this%property_set%print(f_unit)
633 if (
allocated(this%condensed_data_int)) &
634 write(f_unit,*)
" *** condensed data int: ",this%condensed_data_int(:)
635 if (
allocated(this%condensed_data_real)) &
636 write(f_unit,*)
" *** condensed data real: ",this%condensed_data_real(:)
660 if (
associated(this%val))
deallocate(this%val)
670 integer(kind=c_int) :: aero_rep_type
674 aero_rep_type = this%aero_rep_type
684 integer(kind=c_int) :: cell_id
688 cell_id = this%cell_id
698 type(c_ptr) :: update_data
702 update_data = this%update_data
715 integer,
intent(in),
optional :: comm
720 if (
present(comm))
then
723 l_comm = mpi_comm_world
731 this%internal_pack_size(l_comm)
746 character,
intent(inout) :: buffer(:)
748 integer,
intent(inout) :: pos
750 integer,
intent(in),
optional :: comm
753 integer :: prev_position, l_comm
755 if (
present(comm))
then
758 l_comm = mpi_comm_world
763 int(this%aero_rep_type, kind=
i_kind), l_comm)
765 int(this%aero_rep_solver_id, kind=
i_kind), &
767 call this%internal_bin_pack(buffer, pos, l_comm)
768 call assert(538137635, &
769 pos - prev_position <= this%pack_size(l_comm))
782 character,
intent(inout) :: buffer(:)
784 integer,
intent(inout) :: pos
786 integer,
intent(in),
optional :: comm
789 integer :: prev_position, l_comm
790 integer(kind=i_kind) :: temp_int
792 if (
present(comm))
then
795 l_comm = mpi_comm_world
800 this%aero_rep_type = int(temp_int, kind=c_int)
802 this%aero_rep_solver_id = int(temp_int, kind=c_int)
803 call this%internal_bin_unpack(buffer, pos, l_comm)
804 call assert(257567920, &
805 pos - prev_position <= this%pack_size(l_comm))
818 integer(kind=i_kind),
optional :: file_unit
820 integer(kind=i_kind) :: f_unit
824 if (
present(file_unit)) f_unit = file_unit
826 write(f_unit,*)
"*** Aerosol representation update data ***"
827 write(f_unit,*)
"Aerosol representation type", this%aero_rep_type
828 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 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.
elemental 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.
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.
elemental subroutine ptr_finalize(this)
Finalize a pointer to an aerosol representation.
character(len=:) function, allocatable get_name(this)
Get the name of the aerosol representation.
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.
String type for building arrays of string of various size.