55 character(len=:),
allocatable,
public :: model_name
60 type(
property_t),
pointer,
public :: property_set => null()
65 real(kind=
dp),
allocatable,
public :: condensed_data_real(:)
70 integer(kind=i_kind),
allocatable,
public :: condensed_data_int(:)
74 integer(kind=i_kind),
public :: num_env_params = 0
114 integer(kind=c_int) :: sub_model_type
116 integer(kind=c_int) :: sub_model_solver_id = 0
118 integer(kind=c_int) :: cell_id = 1
120 type(c_ptr) :: update_data
154 subroutine initialize(this, aero_rep_set, aero_phase_set, chem_spec_data)
182 integer,
intent(in) :: comm
195 character,
intent(inout) :: buffer(:)
197 integer,
intent(inout) :: pos
199 integer,
intent(in) :: comm
212 character,
intent(inout) :: buffer(:)
214 integer,
intent(inout) :: pos
216 integer,
intent(in) :: comm
249 character(len=:),
allocatable ::
get_name
294 subroutine load(this, json, j_obj)
299 type(json_core),
pointer,
intent(in) :: json
301 type(json_value),
pointer,
intent(in) :: j_obj
303 type(json_value),
pointer :: child, next
304 character(kind=json_ck, len=:),
allocatable :: key, unicode_str_val
305 integer(kind=json_ik) :: var_type
306 logical :: found_name
310 if (.not.
allocated(this%model_name)) this%model_name =
"unknown model"
314 call json%get_child(j_obj, child)
315 do while (
associated(child))
316 call json%info(child, name=key, var_type=var_type)
317 if (key.eq.
"name")
then
318 call assert_msg(241525122, var_type.eq.json_string, &
319 "Received non-string value for sub-model name")
320 call json%get(child, unicode_str_val)
321 this%model_name = unicode_str_val
323 else if (key.ne.
"type")
then
324 call this%property_set%load(json, child, .false., this%model_name)
326 call json%get_next(child, next)
329 call assert_msg(281116577, found_name, &
330 "Received unnamed sub-model.")
332 subroutine load(this)
337 call warn_msg(391981683,
"No support for input files.")
350 integer,
intent(in) :: comm
367 character,
intent(inout) :: buffer(:)
369 integer,
intent(inout) :: pos
371 integer,
intent(in) :: comm
374 integer :: prev_position
380 call assert(924075845, &
381 pos - prev_position <= this%pack_size(comm))
394 character,
intent(inout) :: buffer(:)
396 integer,
intent(inout) :: pos
398 integer,
intent(in) :: comm
401 integer :: prev_position
408 call assert(299381254, &
409 pos - prev_position <= this%pack_size(comm))
422 integer(kind=i_kind),
optional :: file_unit
424 integer(kind=i_kind) :: f_unit
428 if (
present(file_unit)) f_unit = file_unit
429 write(f_unit,*)
"*** Sub Model ***"
430 if (
associated(this%property_set))
call this%property_set%print(f_unit)
431 if (
allocated(this%condensed_data_int)) &
432 write(f_unit,*)
" *** condensed data int: ", this%condensed_data_int(:)
433 if (
allocated(this%condensed_data_real)) &
434 write(f_unit,*)
" *** condensed data real: ", &
435 this%condensed_data_real(:)
459 if (
associated(this%val))
deallocate(this%val)
469 integer(kind=c_int) :: sub_model_type
473 sub_model_type = this%sub_model_type
483 integer(kind=c_int) :: cell_id
487 cell_id = this%cell_id
497 type(c_ptr) :: update_data
501 update_data = this%update_data
514 integer,
intent(in),
optional :: comm
519 if (
present(comm))
then
522 l_comm = mpi_comm_world
530 this%internal_pack_size(l_comm)
545 character,
intent(inout) :: buffer(:)
547 integer,
intent(inout) :: pos
549 integer,
intent(in),
optional :: comm
552 integer :: prev_position, l_comm
554 if (
present(comm))
then
557 l_comm = mpi_comm_world
562 int(this%sub_model_type, kind=i_kind), l_comm)
564 int(this%sub_model_solver_id, kind=i_kind), &
566 call this%internal_bin_pack(buffer, pos, l_comm)
567 call assert(979240230, &
568 pos - prev_position <= this%pack_size(l_comm))
581 character,
intent(inout) :: buffer(:)
583 integer,
intent(inout) :: pos
585 integer,
intent(in),
optional :: comm
588 integer :: prev_position, l_comm
589 integer(kind=i_kind) :: temp_int
591 if (
present(comm))
then
594 l_comm = mpi_comm_world
599 this%sub_model_type = int(temp_int, kind=c_int)
601 this%sub_model_solver_id = int(temp_int, kind=c_int)
602 call this%internal_bin_unpack(buffer, pos, l_comm)
603 call assert(191558576, &
604 pos - prev_position <= this%pack_size(l_comm))
617 integer(kind=i_kind),
optional :: file_unit
619 integer(kind=i_kind) :: f_unit
623 if (
present(file_unit)) f_unit = file_unit
625 write(f_unit,*)
"*** Sub model update data ***"
626 write(f_unit,*)
"Sub model type", this%sub_model_type
627 write(f_unit,*)
"Sub model solver id", this%sub_model_solver_id
Initialize the sub-model data, validating input parameters and loading any required information form ...
Extending-type binary pack function (Internal use only)
Extending-type binary unpack function (Internal use only)
Extending-type binary pack size (internal use only)
Return a real number representing the priority of the sub model calculations. Low priority sub models...
The abstract aero_phase_data_t structure and associated subroutines.
The abstract aero_rep_data_t structure and associated subroutines.
The chem_spec_data_t structure and associated subroutines.
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.
recursive subroutine do_print(this, file_unit)
Print the contents of a property set.
recursive subroutine load(this, json, j_obj, as_object, owner_name, allow_duplicates)
Load a property set from input data.
The abstract sub_model_data_t structure and associated subroutines.
integer(kind=c_int) function sub_model_update_data_get_type(this)
Get the update data sub-model type.
elemental subroutine ptr_finalize(this)
Finalize a pointer to a sub-model.
integer(kind=i_kind) function sub_model_update_data_pack_size(this, comm)
Determine the size of a binary required to pack the reaction data.
integer(kind=i_kind) function pack_size(this, comm)
Determine the size of a binary required to pack the reaction data.
integer(kind=c_int) function sub_model_update_data_get_cell_id(this)
Get the grid cell id to update.
subroutine sub_model_update_data_bin_pack(this, buffer, pos, comm)
Pack the given value to the buffer, advancing position.
subroutine do_sub_model_update_data_print(this, file_unit)
Print the update data.
subroutine sub_model_update_data_bin_unpack(this, buffer, pos, comm)
Unpack the given value from the buffer, advancing position.
elemental subroutine dereference(this)
Dereference a pointer to a sub-model.
type(c_ptr) function sub_model_update_data_get_data(this)
Get the update data.
character(len=:) function, allocatable get_name(this)
Get the name of the sub-model.
subroutine bin_pack(this, buffer, pos, comm)
Pack the given value to the buffer, advancing position.
subroutine bin_unpack(this, buffer, pos, comm)
Unpack the given value from the buffer, advancing position.
Common utility subroutines.
subroutine die_msg(code, error_msg)
Error immediately.
Pointer type for building arrays.
Pointer to aero_rep_data_t extending types.
Pointer to sub_model_data_t extending types.
Abstract sub-model data type.
String type for building arrays of string of various size.