![]() |
MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
|
This module contains the MODFLOW 6 BMI. More...
Functions/Subroutines | |
| integer(kind=c_int) function | bmi_get_component_name (name) |
| integer(kind=c_int) function | bmi_initialize () |
| Initialize the computational core. | |
| integer(kind=c_int) function | bmi_update () |
| Perform a computational time step. | |
| integer(kind=c_int) function | bmi_update_until (time) |
Perform time steps until the current time reaches time. | |
| integer(kind=c_int) function | bmi_finalize () |
| Clean up the initialized simulation. | |
| integer(kind=c_int) function | get_start_time (start_time) |
| Get the start time of the simulation. | |
| integer(kind=c_int) function | get_end_time (end_time) |
| Get the end time of the simulation. | |
| integer(kind=c_int) function | get_current_time (current_time) |
| Get the current time of the simulation. | |
| integer(kind=c_int) function | get_time_step (time_step) |
| Get the time step for the simulation. | |
| integer(kind=c_int) function | get_time_units (c_time_units) |
| Get the time units of 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_output_item_count (count) |
| Get the number of output variables in 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_output_var_names (c_names) |
| Returns all output variables in the simulation. | |
| 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 | get_var_nbytes (c_var_address, var_nbytes) |
| Get size of the variable, in bytes. | |
| 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 | 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_value_bool (c_var_address, c_arr_ptr) |
| Copy the logical scalar value 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 (c_var_address, c_arr_ptr) |
| Copy the value of a variable into the array. | |
| 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_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_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 | set_value_double (c_var_address, c_arr_ptr) |
| Set new values for a variable of type double. | |
| 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 | set_value_bool (c_var_address, c_arr_ptr) |
| Set new value for a logical scalar variable. | |
| integer(kind=c_int) function | get_value_at_indices (c_var_address, c_arr_ptr, c_inds, count) |
| Copy the values of a variable at the given indices into the array. | |
| integer(kind=c_int) function | set_value_at_indices (c_var_address, c_inds, count, c_arr_ptr) |
| Set the values of a variable at the given indices. | |
| logical(lgp) function | valid_indices (mem_path, var_name, c_inds, count, nvalues) |
| Check that every index is within the variable, and count its values. | |
| 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_var_units (c_var_address, c_var_units) |
| Get the units of a variable. | |
| integer(kind=c_int) function | get_var_location (c_var_address, c_var_location) |
| Get the grid location of a variable. | |
| 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_var_shape (c_var_address, c_var_shape) |
| Get the shape of the array for the variable (non-BMI). | |
Variables | |
| integer(c_int), bind(C, name="ISTDOUTTOFILE") | istdout_to_file = 1 |
| output control: =0 to screen, >0 to file | |
This BMI interface matches the CSDMS standard, with a few modifications:
Note on style: BMI apparently uses underscores, we use underscores in some places but camelcase in other. Since this is a dedicated BMI interface module, we'll use underscores here as well.
| integer(kind=c_int) function mf6bmi::bmi_finalize |
Performs teardown tasks for the initialized simulation, this call should match the call to bmi_initialize()
Definition at line 157 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::bmi_get_component_name | ( | character(kind=c_char), dimension(bmi_lencomponentname), intent(inout) | name | ) |
Definition at line 43 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::bmi_initialize |
It is required to have the MODFLOW 6 configuration file 'mfsim.nam' available in the current working directory when calling this routine.
NOTE: initialization should always be matched with a call to bmi_finalize(). However, we currently do not support the reinitialization of a model in the same memory space... You would have to create a new process for that.
Definition at line 68 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::bmi_update |
It will prepare the timestep, call the calculation routine on all the solution groups in the simulation, and finalize the timestep by printing out diagnostics and writing output. It can be called in succession to perform multiple steps up to the simulation's end time is reached.
Definition at line 97 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::bmi_update_until | ( | real(kind=c_double), intent(in), value | time | ) |
Time steps are not split, so the current time can pass time. A time before the current time or after the end time is an error.
| [in] | time | time to advance the simulation to |
Definition at line 114 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_current_time | ( | real(kind=c_double), intent(out) | current_time | ) |
As MODFLOW currently does not have internal time, this will be equal to the time passed w.r.t. the start time of the simulation.
| [out] | current_time | current time |
Definition at line 212 of file mf6bmi.f90.
| integer(kind=c_int) function mf6bmi::get_end_time | ( | real(kind=c_double), intent(out) | end_time | ) |
As MODFLOW does currently does not have internal time, this will be equal to the total runtime.
| [out] | end_time | end time |
Definition at line 194 of file mf6bmi.f90.
| integer(kind=c_int) function mf6bmi::get_input_item_count | ( | integer(kind=c_int), intent(out) | count | ) |
This concerns all variables stored in the memory manager
| [out] | count | the number of input variables |
Definition at line 285 of file mf6bmi.f90.
| integer(kind=c_int) function mf6bmi::get_input_var_names | ( | character(kind=c_char, len=1), dimension(*), intent(inout) | c_names | ) |
This functions returns the full address for all variables in the memory manager
The array c_names should be pre-allocated of proper size:
size = BMI_LENVARADDRESS * get_input_item_count()
The strings will be written contiguously with stride equal to BMI_LENVARADDRESS and nul-terminated where the trailing spaces start:
c_names = 'variable_address_1\0 ... variable_address_2\0 ... ' etc.
| [in,out] | c_names | array with memory paths for input variables |
Definition at line 329 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_output_item_count | ( | integer(kind=c_int), intent(out) | count | ) |
This concerns all variables stored in the memory manager
| [out] | count | the number of output variables |
Definition at line 302 of file mf6bmi.f90.
| integer(kind=c_int) function mf6bmi::get_output_var_names | ( | character(kind=c_char, len=1), dimension(*), intent(inout) | c_names | ) |
This function works analogously to get_input_var_names(), and currently returns the same set of memory variables, which is all of them!
| [in,out] | c_names | array with memory paths for output variables |
Definition at line 364 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_start_time | ( | real(kind=c_double), intent(out) | start_time | ) |
As MODFLOW currently does not have internal time, this will be returning 0.0 for now. New version...
| [out] | start_time | start time |
Definition at line 177 of file mf6bmi.f90.
| integer(kind=c_int) function mf6bmi::get_time_step | ( | real(kind=c_double), intent(out) | time_step | ) |
Note that the returned value may vary between and within stress periods, depending on your time discretization settings in the TDIS package.
| [out] | time_step | current time step |
Definition at line 231 of file mf6bmi.f90.
| integer(kind=c_int) function mf6bmi::get_time_units | ( | character(kind=c_char), dimension(bmi_lenunits), intent(out) | c_time_units | ) |
The units are those of TIME_UNITS in the TDIS Package, as UDUNITS symbols, or 'unknown' when TIME_UNITS is not given.
| [out] | c_time_units | time units as a string |
Definition at line 250 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_value | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(inout) | c_arr_ptr ) |
The copied variable is located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). Multi-dimensional arrays are supported.
| [in] | c_var_address | memory address string of the variable |
| [in,out] | c_arr_ptr | pointer to the array |
Definition at line 738 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_value_at_indices | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr, | ||
| integer(kind=c_int), dimension(*), intent(in) | c_inds, | ||
| integer(kind=c_int), intent(in) | count ) |
The indices are zero-based positions in the variable's values in C-style (row-major) order of the shape returned by get_var_shape(), so a variable of rank > 1 is indexed as if flattened. The caller should provide c_arr_ptr pointing to an array of size count. Double precision and integer variables are supported.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the array to copy into |
| [in] | c_inds | zero-based indices of the values |
| [in] | count | number of indices |
Definition at line 1234 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_value_bool | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr ) |
The copied variable us located at c_var_address. The caller should provide c_arr_ptr pointing to a scalar array with rank=0.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the logical array |
Definition at line 611 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::get_value_double | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr ) |
The copied variable us located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). Multi-dimensional arrays are supported.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the double precision array |
Definition at line 459 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::get_value_int | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr ) |
The copied variable is located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). Multi-dimensional arrays are supported.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the integer array |
Definition at line 536 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::get_value_ptr | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(inout) | c_arr_ptr ) |
The array is located at c_var_address. There is no copying of data involved. Multi-dimensional arrays are supported and the get_var_rank() function can be used to get the variable's dimensionality, and get_var_shape() for its shape.
| [in] | c_var_address | memory address string of the variable |
| [in,out] | c_arr_ptr | pointer to the array |
Definition at line 787 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_value_ptr_bool | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(inout) | c_arr_ptr ) |
Only scalar values (with rank=0) are supported.
| [in] | c_var_address | memory address string of the variable |
| [in,out] | c_arr_ptr | pointer to the array |
Definition at line 941 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::get_value_ptr_double | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(inout) | c_arr_ptr ) |
The array is located at c_var_address. There is no copying of data involved. Multi-dimensional arrays are supported and the get_var_rank() function can be used to get the variable's dimensionality, and get_var_shape() for its shape.
| [in] | c_var_address | memory address string of the variable |
| [in,out] | c_arr_ptr | pointer to the array |
Definition at line 834 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::get_value_ptr_int | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(inout) | c_arr_ptr ) |
The array is located at c_var_address. There is no copying of data involved. Multi-dimensional arrays are supported and the get_var_rank() function can be used to get the variable's dimensionality.
| [in] | c_var_address | memory address string of the variable |
| [in,out] | c_arr_ptr | pointer to the array |
Definition at line 888 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::get_value_string | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr ) |
The copied variable is located at c_var_address. The caller should provide c_arr_ptr pointing to an array of the proper shape (the BMI function get_var_shape() can be used to create it). For strings currently scalars and 1d arrays (of CharacterStringType) are
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the string array |
Definition at line 659 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::get_var_itemsize | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| integer(kind=c_int), intent(out) | var_size ) |
| [in] | c_var_address | memory address string of the variable |
| [out] | var_size | size of the element in bytes |
Definition at line 395 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_var_location | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| character(kind=c_char), dimension(bmi_lenvarlocation), intent(out) | c_var_location ) |
Every variable is reported at the grid nodes.
| [in] | c_var_address | memory address string of the variable |
| [out] | c_var_location | variable location as a string |
Definition at line 1471 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_var_nbytes | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| integer(kind=c_int), intent(out) | var_nbytes ) |
| [in] | c_var_address | memory address string of the variable |
| [out] | var_nbytes | size in bytes |
Definition at line 422 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_var_rank | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| integer(kind=c_int), intent(out) | c_var_rank ) |
In order to support multi-dimensional arrays, this function gives access to the rank of the array.
| [in] | c_var_address | memory address string of the variable |
| [out] | c_var_rank | variable rank |
Definition at line 1500 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_var_shape | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| integer(c_int), dimension(*), intent(inout) | c_var_shape ) |
The shape is an integer array with size equal to the rank of the variable (see get_var_rank()) and values that give the length of the array in each dimension. The target shape array c_var_shape should be allocated before calling this routine.
Note that the returned shape representation will has been converted to C-style.
| [in] | c_var_address | memory address string of the variable |
| [in,out] | c_var_shape | 1D array with the variable's shape |
Definition at line 1538 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_var_type | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| character(kind=c_char), dimension(bmi_lenvartype), intent(out) | c_var_type ) |
The type returned is that of a single element. When the variable cannot be found, the string
| [in] | c_var_address | memory address string of the variable |
| [out] | c_var_type | variable type as a string |
Definition at line 1403 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::get_var_units | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| character(kind=c_char), dimension(bmi_lenunits), intent(out) | c_var_units ) |
The memory manager does not store units, so 'unknown' is returned for every variable.
| [in] | c_var_address | memory address string of the variable |
| [out] | c_var_units | variable units as a string |
Definition at line 1443 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::set_value | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(inout) | c_arr_ptr ) |
The array pointed to by c_arr_ptr can have rank equal to 0, 1, or 2 and should have a C-style layout, which is particularly important for rank > 1.
| [in] | c_var_address | memory address string of the variable |
| [in,out] | c_arr_ptr | pointer to the array |
Definition at line 983 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::set_value_at_indices | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| integer(kind=c_int), dimension(*), intent(in) | c_inds, | ||
| integer(kind=c_int), intent(in) | count, | ||
| type(c_ptr), intent(in) | c_arr_ptr ) |
The indices are zero-based positions in the variable's values in C-style (row-major) order of the shape returned by get_var_shape(), as in get_value_at_indices(). The array pointed to by c_arr_ptr holds count values. Double precision and integer variables are supported. A new hydraulic conductivity does not change the saturated conductance until NPF recalculates it, as it does for TVK.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_inds | zero-based indices of the values |
| [in] | count | number of indices |
| [in] | c_arr_ptr | pointer to the array with the new values |
Definition at line 1296 of file mf6bmi.f90.

| integer(kind=c_int) function mf6bmi::set_value_bool | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr ) |
The array pointed to by c_arr_ptr must have a rank equal to 0.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the logical array |
Definition at line 1175 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::set_value_double | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr ) |
The array pointed to by c_arr_ptr can have rank equal to 0, 1, or 2 and should have a C-style layout, which is particularly important for rank > 1.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the double precision array |
Definition at line 1029 of file mf6bmi.f90.


| integer(kind=c_int) function mf6bmi::set_value_int | ( | character(kind=c_char), dimension(*), intent(in) | c_var_address, |
| type(c_ptr), intent(in) | c_arr_ptr ) |
The array pointed to by c_arr_ptr can have rank equal to 0, 1, or 2.
| [in] | c_var_address | memory address string of the variable |
| [in] | c_arr_ptr | pointer to the integer array |
Definition at line 1102 of file mf6bmi.f90.


| logical(lgp) function mf6bmi::valid_indices | ( | character(len=*), intent(in) | mem_path, |
| character(len=*), intent(in) | var_name, | ||
| integer(kind=c_int), dimension(*), intent(in) | c_inds, | ||
| integer(kind=c_int), intent(in) | count, | ||
| integer(i4b), intent(out) | nvalues ) |
| [in] | mem_path | memory path of the variable |
| [in] | var_name | name of the variable |
| [in] | c_inds | zero-based indices |
| [in] | count | number of indices |
| [out] | nvalues | number of values in the variable |
Definition at line 1360 of file mf6bmi.f90.


| integer(c_int), bind(C, name="ISTDOUTTOFILE") mf6bmi::istdout_to_file = 1 |
Definition at line 38 of file mf6bmi.f90.