70 function create(this, type_name)
result (new_obj)
77 character(len=*),
intent(in) :: type_name
81 select case (type_name)
82 case (
"SUB_MODEL_PDFITE")
84 case (
"SUB_MODEL_UNIFAC")
86 case (
"SUB_MODEL_ZSR_AEROSOL_WATER")
89 call die_msg(293855421,
"Unknown sub-model type: "//type_name)
98 function load(this, json, j_obj)
result (new_obj)
105 type(json_core),
pointer,
intent(in) :: json
107 type(json_value),
pointer,
intent(in) :: j_obj
109 character(kind=json_ck, len=:),
allocatable :: unicode_type_name
110 character(len=:),
allocatable :: type_name
111 logical(kind=json_lk) :: found
116 call json%get(j_obj,
"type", unicode_type_name, found)
117 call assert_msg(447218460, found,
'Missing sub-model type.')
118 type_name = unicode_type_name
121 new_obj => this%create(type_name)
124 call new_obj%load(json, j_obj)
128 function load(this)
result (new_obj)
137 call warn_msg(545649418,
"No support for input files.")
144 integer(kind=i_kind) function get_type(this, sub_model) &
145 result(sub_model_data_type)
152 select type (sub_model)
160 call die_msg(695653684,
"Unknown sub-model type")
177 select type (update_data)
179 call die_msg(245232793,
"Internal error - update data type missing")
187 integer(kind=i_kind) function pack_size(this, sub_model, comm)
194 integer,
intent(in) :: comm
197 sub_model%pack_size(comm)
204 subroutine bin_pack(this, sub_model, buffer, pos, comm)
211 character,
intent(inout) :: buffer(:)
213 integer,
intent(inout) :: pos
215 integer,
intent(in) :: comm
218 integer :: sub_model_data_type, i_sub_model, prev_position
221 select type (sub_model)
229 call die_msg(850922257,
"Trying to pack sub-model of unknown type.")
232 call sub_model%bin_pack(buffer, pos, comm)
234 pos - prev_position <= this%pack_size(sub_model, comm))
242 function bin_unpack(this, buffer, pos, comm)
result (sub_model)
249 character,
intent(inout) :: buffer(:)
251 integer,
intent(inout) :: pos
253 integer,
intent(in) :: comm
256 integer :: sub_model_data_type, i_sub_model, prev_position
260 select case (sub_model_data_type)
268 call die_msg(786366152,
"Trying to unpack sub-model of unknown "// &
269 "type: "//trim(
to_string(sub_model_data_type)))
271 call sub_model%bin_unpack(buffer, pos, comm)
273 pos - prev_position <= this%pack_size(sub_model, comm))
Interface for to_string functions.
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_unpack_integer(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
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.
The abstract sub_model_data_t structure and associated subroutines.
subroutine load(this, json, j_obj)
Load a sub-model from an input file.
integer(kind=i_kind) function pack_size(this, comm)
Determine the size of a binary required to pack the reaction data.
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.
The sub_model_factory_t type and associated subroutines.
integer(kind=i_kind) function get_type(this, sub_model)
Get the sub-model type as a constant.
class(sub_model_data_t) function, pointer create(this, type_name)
Create a new sub-model by type name.
integer(kind=i_kind), parameter, public sub_model_zsr_aerosol_water
subroutine initialize_update_data(this, sub_model, update_data)
Initialize an update data object.
integer(kind=i_kind), parameter, public sub_model_unifac
Identifiers for sub-models - used by binary packing/unpacking functions.
integer(kind=i_kind), parameter, public sub_model_pdfite
The sub_model_PDFiTE_t type and associated functions.
The sub_model_UNIFAC_t type and assocatiated subroutines.
The sub_model_ZSR_aerosol_water_t type and associated functions.
Common utility subroutines.
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
subroutine die_msg(code, error_msg)
Error immediately.
subroutine assert_msg(code, condition_ok, error_msg)
Errors unless condition_ok is true.
subroutine warn_msg(code, warning_msg, already_warned)
Prints a warning message.
Abstract sub-model data type.
Factory type for sub-models.
Generic test reaction data type.
UNIFAC activity coefficient calculation.
Generic test reaction data type.
String type for building arrays of string of various size.