23 use iso_c_binding,
only: c_int, c_char, c_double, c_null_char, c_loc, c_ptr, &
43 bind(C, name="get_component_name")
47 integer(kind=c_int) :: bmi_status
68 integer(kind=c_int) :: bmi_status
94 function bmi_update()
result(bmi_status)
bind(C, name="update")
97 integer(kind=c_int) :: bmi_status
99 logical :: hasconverged
116 integer(kind=c_int) :: bmi_status
132 bind(C, name="get_start_time")
135 real(kind=c_double),
intent(out) :: start_time
136 integer(kind=c_int) :: bmi_status
148 function get_end_time(end_time)
result(bmi_status)
bind(C, name="get_end_time")
153 real(kind=c_double),
intent(out) :: end_time
154 integer(kind=c_int) :: bmi_status
167 bind(C, name="get_current_time")
172 real(kind=c_double),
intent(out) :: current_time
173 integer(kind=c_int) :: bmi_status
186 bind(C, name="get_time_step")
191 real(kind=c_double),
intent(out) :: time_step
192 integer(kind=c_int) :: bmi_status
204 bind(C, name="get_input_item_count")
207 integer(kind=c_int),
intent(out) :: count
208 integer(kind=c_int) :: bmi_status
221 bind(C, name="get_output_item_count")
224 integer(kind=c_int),
intent(out) :: count
225 integer(kind=c_int) :: bmi_status
248 bind(C, name="get_input_var_names")
251 character(kind=c_char, len=1),
intent(inout) :: c_names(*)
252 integer(kind=c_int) :: bmi_status
254 integer(I4B) :: imem, start, i
256 character(len=LENMEMADDRESS) :: var_address
262 do i = 1, len(trim(var_address))
263 c_names(start + i - 1) = var_address(i:i)
265 c_names(start + i) = c_null_char
280 bind(C, name="get_output_var_names")
283 character(kind=c_char, len=1),
intent(inout) :: c_names(*)
284 integer(kind=c_int) :: bmi_status
286 integer(I4B) :: imem, start, i
288 character(len=LENMEMADDRESS) :: var_address
294 do i = 1, len(trim(var_address))
295 c_names(start + i - 1) = var_address(i:i)
297 c_names(start + i) = c_null_char
308 bind(C, name="get_var_itemsize")
311 character(kind=c_char),
intent(in) :: c_var_address(*)
312 integer(kind=c_int),
intent(out) :: var_size
313 integer(kind=c_int) :: bmi_status
315 character(len=LENMEMPATH) :: mem_path
316 character(len=LENVARNAME) :: var_name
317 logical(LGP) :: valid
322 if (.not. valid)
then
335 bind(C, name="get_var_nbytes")
338 character(kind=c_char),
intent(in) :: c_var_address(*)
339 integer(kind=c_int),
intent(out) :: var_nbytes
340 integer(kind=c_int) :: bmi_status
342 integer(I4B) :: var_size, isize
343 character(len=LENMEMPATH) :: mem_path
344 character(len=LENVARNAME) :: var_name
345 logical(LGP) :: valid
350 if (.not. valid)
then
357 call get_isize(var_name, mem_path, isize)
360 var_nbytes = var_size * isize
372 bind(C, name="get_value_double")
377 character(kind=c_char),
intent(in) :: c_var_address(*)
378 type(c_ptr),
intent(in) :: c_arr_ptr
379 integer(kind=c_int) :: bmi_status
381 character(len=LENMEMPATH) :: mem_path
382 character(len=LENVARNAME) :: var_name
383 logical(LGP) :: valid
385 real(dp),
pointer :: src_ptr, tgt_ptr
386 real(dp),
dimension(:),
pointer,
contiguous :: src1d_ptr, tgt1d_ptr
387 real(dp),
dimension(:, :),
pointer,
contiguous :: src2d_ptr, tgt2d_ptr
388 real(dp),
dimension(:, :, :),
pointer,
contiguous :: src3d_ptr, tgt3d_ptr
389 integer(I4B) :: i, j, k
394 if (.not. valid)
then
406 call c_f_pointer(c_arr_ptr, tgt_ptr)
408 else if (rank == 1)
then
409 call mem_setptr(src1d_ptr, var_name, mem_path)
410 call c_f_pointer(c_arr_ptr, tgt1d_ptr, shape(src1d_ptr))
411 do i = 1,
size(tgt1d_ptr)
412 tgt1d_ptr(i) = src1d_ptr(i)
414 else if (rank == 2)
then
415 call mem_setptr(src2d_ptr, var_name, mem_path)
416 call c_f_pointer(c_arr_ptr, tgt2d_ptr, shape(src2d_ptr))
417 do j = 1,
size(tgt2d_ptr, 2)
418 do i = 1,
size(tgt2d_ptr, 1)
419 tgt2d_ptr(i, j) = src2d_ptr(i, j)
422 else if (rank == 3)
then
423 call mem_setptr(src3d_ptr, var_name, mem_path)
424 call c_f_pointer(c_arr_ptr, tgt3d_ptr, shape(src3d_ptr))
425 do k = 1,
size(tgt3d_ptr, 3)
426 do j = 1,
size(tgt3d_ptr, 2)
427 do i = 1,
size(tgt3d_ptr, 1)
428 tgt3d_ptr(i, j, k) = src3d_ptr(i, j, k)
449 bind(C, name="get_value_int")
454 character(kind=c_char),
intent(in) :: c_var_address(*)
455 type(c_ptr),
intent(in) :: c_arr_ptr
456 integer(kind=c_int) :: bmi_status
458 character(len=LENMEMPATH) :: mem_path
459 character(len=LENVARNAME) :: var_name
460 logical(LGP) :: valid
462 integer(I4B),
pointer :: src_ptr, tgt_ptr
463 integer(I4B),
dimension(:),
pointer,
contiguous :: src1d_ptr, tgt1d_ptr
464 integer(I4B),
dimension(:, :),
pointer,
contiguous :: src2d_ptr, tgt2d_ptr
465 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: src3d_ptr, tgt3d_ptr
466 integer(I4B) :: i, j, k
471 if (.not. valid)
then
483 call c_f_pointer(c_arr_ptr, tgt_ptr)
485 else if (rank == 1)
then
486 call mem_setptr(src1d_ptr, var_name, mem_path)
487 call c_f_pointer(c_arr_ptr, tgt1d_ptr, shape(src1d_ptr))
488 do i = 1,
size(tgt1d_ptr)
489 tgt1d_ptr(i) = src1d_ptr(i)
491 else if (rank == 2)
then
492 call mem_setptr(src2d_ptr, var_name, mem_path)
493 call c_f_pointer(c_arr_ptr, tgt2d_ptr, shape(src2d_ptr))
494 do j = 1,
size(tgt2d_ptr, 2)
495 do i = 1,
size(tgt2d_ptr, 1)
496 tgt2d_ptr(i, j) = src2d_ptr(i, j)
499 else if (rank == 3)
then
500 call mem_setptr(src3d_ptr, var_name, mem_path)
501 call c_f_pointer(c_arr_ptr, tgt3d_ptr, shape(src3d_ptr))
502 do k = 1,
size(tgt3d_ptr, 3)
503 do j = 1,
size(tgt3d_ptr, 2)
504 do i = 1,
size(tgt3d_ptr, 1)
505 tgt3d_ptr(i, j, k) = src3d_ptr(i, j, k)
524 bind(C, name="get_value_bool")
529 character(kind=c_char),
intent(in) :: c_var_address(*)
530 type(c_ptr),
intent(in) :: c_arr_ptr
531 integer(kind=c_int) :: bmi_status
533 character(len=LENMEMPATH) :: mem_path
534 character(len=LENVARNAME) :: var_name
535 logical(LGP) :: valid
537 logical(LGP),
pointer :: src_ptr, tgt_ptr
542 if (.not. valid)
then
553 call c_f_pointer(c_arr_ptr, tgt_ptr)
572 bind(C, name="get_value_string")
576 character(kind=c_char),
intent(in) :: c_var_address(*)
577 type(c_ptr),
intent(in) :: c_arr_ptr
578 integer(kind=c_int) :: bmi_status
580 character(len=LENMEMPATH) :: mem_path
581 character(len=LENVARNAME) :: var_name
582 logical(LGP) :: valid
584 character(len=:),
pointer :: srcstr
585 character(kind=c_char),
pointer :: tgtstr(:)
587 character(kind=c_char),
pointer :: tgtstr1d(:, :)
588 character(:),
allocatable :: tempstr
589 integer(I4B) :: i, ilen, isize
594 if (.not. valid)
then
607 call c_f_pointer(c_arr_ptr, tgtstr, shape=[ilen + 1])
610 else if (rank == 1)
then
612 call mem_setptr(srccharstr1d, var_name, mem_path)
613 if (.not.
associated(srccharstr1d))
then
621 call get_isize(var_name, mem_path, isize)
623 call c_f_pointer(c_arr_ptr, tgtstr1d, shape=[ilen + 1, isize])
627 allocate (
character(ilen) :: tempstr)
629 tempstr = srccharstr1d(i)
649 function get_value(c_var_address, c_arr_ptr)
result(bmi_status) &
650 bind(C, name="get_value")
655 character(kind=c_char),
intent(in) :: c_var_address(*)
656 type(c_ptr),
intent(inout) :: c_arr_ptr
657 integer(kind=c_int) :: bmi_status
659 character(len=LENMEMPATH) :: mem_path
660 character(len=LENMEMTYPE) :: mem_type
661 character(len=LENVARNAME) :: var_name
662 logical(LGP) :: valid
667 if (.not. valid)
then
674 if (index(mem_type,
"DOUBLE") /= 0)
then
676 else if (index(mem_type,
"INTEGER") /= 0)
then
678 else if (index(mem_type,
"LOGICAL") /= 0)
then
680 else if (index(mem_type,
"STRING") /= 0)
then
699 bind(C, name="get_value_ptr")
704 character(kind=c_char),
intent(in) :: c_var_address(*)
705 type(c_ptr),
intent(inout) :: c_arr_ptr
706 integer(kind=c_int) :: bmi_status
708 character(len=LENMEMPATH) :: mem_path
709 character(len=LENMEMTYPE) :: mem_type
710 character(len=LENVARNAME) :: var_name
711 logical(LGP) :: valid
716 if (.not. valid)
then
723 if (index(mem_type,
"DOUBLE") /= 0)
then
725 else if (index(mem_type,
"INTEGER") /= 0)
then
727 else if (index(mem_type,
"LOGICAL") /= 0)
then
746 bind(C, name="get_value_ptr_double")
749 character(kind=c_char),
intent(in) :: c_var_address(*)
750 type(c_ptr),
intent(inout) :: c_arr_ptr
751 integer(kind=c_int) :: bmi_status
753 character(len=LENMEMPATH) :: mem_path
754 character(len=LENVARNAME) :: var_name
755 logical(LGP) :: valid
756 real(dp),
pointer :: scalar_ptr
757 real(dp),
dimension(:),
pointer,
contiguous :: array_ptr
758 real(dp),
dimension(:, :),
pointer,
contiguous :: array2d_ptr
759 real(dp),
dimension(:, :, :),
pointer,
contiguous :: array3d_ptr
765 if (.not. valid)
then
773 call mem_setptr(scalar_ptr, var_name, mem_path)
774 c_arr_ptr = c_loc(scalar_ptr)
775 else if (rank == 1)
then
776 call mem_setptr(array_ptr, var_name, mem_path)
777 c_arr_ptr = c_loc(array_ptr)
778 else if (rank == 2)
then
779 call mem_setptr(array2d_ptr, var_name, mem_path)
780 c_arr_ptr = c_loc(array2d_ptr)
781 else if (rank == 3)
then
782 call mem_setptr(array3d_ptr, var_name, mem_path)
783 c_arr_ptr = c_loc(array3d_ptr)
800 bind(C, name="get_value_ptr_int")
803 character(kind=c_char),
intent(in) :: c_var_address(*)
804 type(c_ptr),
intent(inout) :: c_arr_ptr
805 integer(kind=c_int) :: bmi_status
807 character(len=LENMEMPATH) :: mem_path
808 character(len=LENVARNAME) :: var_name
809 logical(LGP) :: valid
811 integer(I4B),
pointer :: scalar_ptr
812 integer(I4B),
dimension(:),
pointer,
contiguous :: array_ptr
813 integer(I4B),
dimension(:, :),
pointer,
contiguous :: array2d_ptr
814 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: array3d_ptr
819 if (.not. valid)
then
828 call mem_setptr(scalar_ptr, var_name, mem_path)
829 c_arr_ptr = c_loc(scalar_ptr)
830 else if (rank == 1)
then
831 call mem_setptr(array_ptr, var_name, mem_path)
832 c_arr_ptr = c_loc(array_ptr)
833 else if (rank == 2)
then
834 call mem_setptr(array2d_ptr, var_name, mem_path)
835 c_arr_ptr = c_loc(array2d_ptr)
836 else if (rank == 3)
then
837 call mem_setptr(array3d_ptr, var_name, mem_path)
838 c_arr_ptr = c_loc(array3d_ptr)
853 bind(C, name="get_value_ptr_bool")
856 character(kind=c_char),
intent(in) :: c_var_address(*)
857 type(c_ptr),
intent(inout) :: c_arr_ptr
858 integer(kind=c_int) :: bmi_status
860 character(len=LENMEMPATH) :: mem_path
861 character(len=LENVARNAME) :: var_name
862 logical(LGP) :: valid
863 logical(LGP),
pointer :: scalar_ptr
869 if (.not. valid)
then
877 call mem_setptr(scalar_ptr, var_name, mem_path)
878 c_arr_ptr = c_loc(scalar_ptr)
894 function set_value(c_var_address, c_arr_ptr)
result(bmi_status) &
895 bind(C, name="set_value")
900 character(kind=c_char),
intent(in) :: c_var_address(*)
901 type(c_ptr),
intent(inout) :: c_arr_ptr
902 integer(kind=c_int) :: bmi_status
904 character(len=LENMEMPATH) :: mem_path
905 character(len=LENMEMTYPE) :: mem_type
906 character(len=LENVARNAME) :: var_name
907 logical(LGP) :: valid
912 if (.not. valid)
then
919 if (index(mem_type,
"DOUBLE") /= 0)
then
921 else if (index(mem_type,
"INTEGER") /= 0)
then
923 else if (index(mem_type,
"LOGICAL") /= 0)
then
941 bind(C, name="set_value_double")
946 character(kind=c_char),
intent(in) :: c_var_address(*)
947 type(c_ptr),
intent(in) :: c_arr_ptr
948 integer(kind=c_int) :: bmi_status
950 character(len=LENMEMPATH) :: mem_path
951 character(len=LENVARNAME) :: var_name
952 logical(LGP) :: valid
954 real(dp),
pointer :: src_ptr, tgt_ptr
955 real(dp),
dimension(:),
pointer,
contiguous :: src1d_ptr, tgt1d_ptr
956 real(dp),
dimension(:, :),
pointer,
contiguous :: src2d_ptr, tgt2d_ptr
958 integer(I4B) :: status
963 if (.not. valid)
then
974 call c_f_pointer(c_arr_ptr, src_ptr)
976 else if (rank == 1)
then
977 call mem_setptr(tgt1d_ptr, var_name, mem_path)
978 call c_f_pointer(c_arr_ptr, src1d_ptr, shape(tgt1d_ptr))
979 do i = 1,
size(tgt1d_ptr)
980 tgt1d_ptr(i) = src1d_ptr(i)
982 else if (rank == 2)
then
983 call mem_setptr(tgt2d_ptr, var_name, mem_path)
984 call c_f_pointer(c_arr_ptr, src2d_ptr, shape(tgt2d_ptr))
985 do j = 1,
size(tgt2d_ptr, 2)
986 do i = 1,
size(tgt2d_ptr, 1)
987 tgt2d_ptr(i, j) = src2d_ptr(i, j)
999 if (status /= 0)
then
1014 bind(C, name="set_value_int")
1019 character(kind=c_char),
intent(in) :: c_var_address(*)
1020 type(c_ptr),
intent(in) :: c_arr_ptr
1021 integer(kind=c_int) :: bmi_status
1023 character(len=LENMEMPATH) :: mem_path
1024 character(len=LENVARNAME) :: var_name
1025 logical(LGP) :: valid
1026 integer(I4B) :: rank
1027 integer(I4B),
pointer :: src_ptr, tgt_ptr
1028 integer(I4B),
dimension(:),
pointer,
contiguous :: src1d_ptr, tgt1d_ptr
1029 integer(I4B),
dimension(:, :),
pointer,
contiguous :: src2d_ptr, tgt2d_ptr
1030 integer(I4B) :: i, j
1031 integer(I4B) :: status
1035 call split_address(c_var_address, mem_path, var_name, valid)
1036 if (.not. valid)
then
1047 call c_f_pointer(c_arr_ptr, src_ptr)
1049 else if (rank == 1)
then
1050 call mem_setptr(tgt1d_ptr, var_name, mem_path)
1051 call c_f_pointer(c_arr_ptr, src1d_ptr, shape(tgt1d_ptr))
1052 do i = 1,
size(tgt1d_ptr)
1053 tgt1d_ptr(i) = src1d_ptr(i)
1055 else if (rank == 2)
then
1056 call mem_setptr(tgt2d_ptr, var_name, mem_path)
1057 call c_f_pointer(c_arr_ptr, src2d_ptr, shape(tgt2d_ptr))
1058 do j = 1,
size(tgt2d_ptr, 2)
1059 do i = 1,
size(tgt2d_ptr, 1)
1060 tgt2d_ptr(i, j) = src2d_ptr(i, j)
1072 if (status /= 0)
then
1087 bind(C, name="set_value_bool")
1092 character(kind=c_char),
intent(in) :: c_var_address(*)
1093 type(c_ptr),
intent(in) :: c_arr_ptr
1094 integer(kind=c_int) :: bmi_status
1096 character(len=LENMEMPATH) :: mem_path
1097 character(len=LENVARNAME) :: var_name
1098 logical(LGP) :: valid
1099 integer(I4B) :: rank
1100 logical(LGP),
pointer :: src_ptr, tgt_ptr
1101 integer(I4B) :: status
1105 call split_address(c_var_address, mem_path, var_name, valid)
1106 if (.not. valid)
then
1117 call c_f_pointer(c_arr_ptr, src_ptr)
1128 if (status /= 0)
then
1144 bind(C, name="get_var_type")
1149 character(kind=c_char),
intent(in) :: c_var_address(*)
1150 character(kind=c_char),
intent(out) :: c_var_type(
bmi_lenvartype)
1151 integer(kind=c_int) :: bmi_status
1153 character(len=LENMEMPATH) :: mem_path
1154 character(len=LENVARNAME) :: var_name
1155 character(len=LENMEMTYPE) :: mem_type
1156 logical(LGP) :: valid
1160 call split_address(c_var_address, mem_path, var_name, valid)
1161 if (.not. valid)
then
1167 c_var_type(1:len(trim(mem_type)) + 1) = &
1170 if (mem_type ==
'UNKNOWN')
then
1184 bind(C, name="get_var_rank")
1187 character(kind=c_char),
intent(in) :: c_var_address(*)
1188 integer(kind=c_int),
intent(out) :: c_var_rank
1189 integer(kind=c_int) :: bmi_status
1191 character(len=LENMEMPATH) :: mem_path
1192 character(len=LENVARNAME) :: var_name
1193 logical(LGP) :: valid
1197 call split_address(c_var_address, mem_path, var_name, valid)
1198 if (.not. valid)
then
1204 if (c_var_rank == -1)
then
1222 bind(C, name="get_var_shape")
1227 character(kind=c_char),
intent(in) :: c_var_address(*)
1228 integer(c_int),
intent(inout) :: c_var_shape(*)
1229 integer(kind=c_int) :: bmi_status
1231 integer(I4B),
dimension(MAXMEMRANK) :: var_shape
1232 integer(I4B) :: var_rank
1233 character(len=LENMEMPATH) :: mem_path
1234 character(len=LENVARNAME) :: var_name
1235 logical(LGP) :: valid
1239 call split_address(c_var_address, mem_path, var_name, valid)
1240 if (.not. valid)
then
1249 if (var_shape(1) == -1 .or. var_rank == -1)
then
1258 c_var_shape(1:var_rank) = var_shape(var_rank:1:-1)
This module contains simulation constants.
integer(i4b), parameter lenvarname
maximum length of a variable name
integer(i4b), parameter, public maxmemrank
maximum memory manager length (up to 3-dimensional arrays)
integer(i4b), parameter, public lenmemtype
maximum length of a memory manager type
integer(i4b), parameter lenmempath
maximum length of the memory path
This module defines variable data types.
character(len=lenmemaddress) function create_mem_address(mem_path, var_name)
returns the address string of the memory object
subroutine, public get_mem_type(name, mem_path, var_type)
@ brief Get the variable memory type
subroutine, public get_mem_shape(name, mem_path, mem_shape)
@ brief Get the variable memory shape
subroutine, public get_from_memorylist(name, mem_path, mt, found, check)
@ brief Get a memory type entry from the memory list
type(memorylisttype), public memorylist
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
subroutine, public get_mem_rank(name, mem_path, rank)
@ brief Get the variable rank
subroutine, public get_mem_elem_size(name, mem_path, size)
@ brief Get the memory size of a single element of the stored variable
subroutine, public on_memory_set(var_name, mem_path, status)
Triggers the calling of the side effect handler for this variable.
This module contains the MODFLOW 6 BMI.
integer(kind=c_int) function get_end_time(end_time)
Get the end time of the simulation.
integer(kind=c_int) function get_input_var_names(c_names)
Returns all input variables in the simulation.
integer(kind=c_int) function get_input_item_count(count)
Get the number of input variables in the simulation.
integer(kind=c_int) function get_value_ptr_double(c_var_address, c_arr_ptr)
Get a pointer to the array of double precision numbers.
integer(kind=c_int) function get_value_ptr_int(c_var_address, c_arr_ptr)
Get a pointer to the array of integer numbers.
integer(kind=c_int) function get_current_time(current_time)
Get the current time of the simulation.
integer(kind=c_int) function get_var_rank(c_var_address, c_var_rank)
Get the variable rank (non-BMI)
integer(kind=c_int) function get_output_item_count(count)
Get the number of output variables in the simulation.
integer(kind=c_int) function get_value_ptr_bool(c_var_address, c_arr_ptr)
Get a pointer to the logical scalar value.
integer(kind=c_int) function set_value(c_var_address, c_arr_ptr)
Set new values for a given variable.
integer(kind=c_int) function get_time_step(time_step)
Get the time step for the simulation.
integer(kind=c_int) function get_var_nbytes(c_var_address, var_nbytes)
Get size of the variable, in bytes.
integer(kind=c_int) function set_value_double(c_var_address, c_arr_ptr)
Set new values for a variable of type double.
integer(kind=c_int) function get_start_time(start_time)
Get the start time of the simulation.
integer(kind=c_int) function set_value_int(c_var_address, c_arr_ptr)
Set new values for a variable of type integer.
integer(kind=c_int) function get_var_itemsize(c_var_address, var_size)
Get the size (in bytes) of a single element of a variable.
integer(kind=c_int) function bmi_get_component_name(name)
integer(kind=c_int) function bmi_update()
Perform a computational time step.
integer(kind=c_int) function get_value_ptr(c_var_address, c_arr_ptr)
Get a pointer to an array.
integer(kind=c_int) function get_var_shape(c_var_address, c_var_shape)
Get the shape of the array for the variable (non-BMI)
integer(kind=c_int) function bmi_initialize()
Initialize the computational core.
integer(kind=c_int) function bmi_finalize()
Clean up the initialized simulation.
integer(kind=c_int) function get_value_int(c_var_address, c_arr_ptr)
Copy the integer values of a variable into the array.
integer(kind=c_int) function get_output_var_names(c_names)
Returns all output variables in the simulation.
integer(kind=c_int) function get_var_type(c_var_address, c_var_type)
Get the variable type as a string.
integer(kind=c_int) function get_value_double(c_var_address, c_arr_ptr)
Copy the double precision values of a variable into the array.
integer(kind=c_int) function set_value_bool(c_var_address, c_arr_ptr)
Set new value for a logical scalar variable.
integer(kind=c_int) function get_value(c_var_address, c_arr_ptr)
Copy the value of a variable into the array.
integer(kind=c_int) function get_value_string(c_var_address, c_arr_ptr)
Copy the string(s) of a variable into the array.
integer(kind=c_int) function get_value_bool(c_var_address, c_arr_ptr)
Copy the logical scalar value into the array.
integer(c_int), bind(C, name="ISTDOUTTOFILE") istdout_to_file
output control: =0 to screen, >0 to file
Detailed error information for the BMI.
character(len= *), parameter fmt_general_err
integer, parameter bmi_failure
BMI status code for failure (taken from bmi.f90, CSDMS)
character(len= *), parameter fmt_unsupported_type
character(len=lenerrmessage) bmi_last_error
module variable containing the last error as a Fortran string
subroutine report_bmi_error(err_msg)
Sets the last BMI error message and copies it to an exported C-string.
character(len= *), parameter fmt_invalid_mem_access
character(len= *), parameter fmt_unsupported_rank
integer, parameter bmi_success
BMI status code for success (taken from bmi.f90, CSDMS)
This module contains helper routines and parameters for the MODFLOW 6 BMI.
integer(c_int), bind(C, name="BMI_LENVARTYPE") bmi_lenvartype
max. length for variable type C-strings
integer(c_int), bind(C, name="BMI_LENCOMPONENTNAME") bmi_lencomponentname
component name length, i.e. 'MODFLOW 6'
subroutine split_address(c_var_address, mem_path, var_name, success)
Split the variable address string.
pure character(kind=c_char, len=1) function, dimension(length+1) string_to_char_array(string, length)
Convert Fortran string to C-style character string.
integer(c_int), bind(C, name="BMI_LENVARADDRESS") bmi_lenvaraddress
max. length for the variable's address C-string
logical(lgp) function mf6update()
Run a time step.
subroutine mf6initialize()
Initialize a simulation.
subroutine mf6finalize()
Finalize the simulation.
This module contains simulation variables.
integer(i4b) iforcestop
forced stop flag (1) forces a call to ustop(..) when the simulation has ended, (0) doesn't
character(len=linelength) simstdout
name of standard out file if screen output is piped to a file
integer(i4b) istdout
unit number for stdout
real(dp), pointer, public totim
time relative to start of simulation
real(dp), pointer, public totalsimtime
time at end of simulation
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
This class is used to store a single deferred-length character string. It was designed to work in an ...