MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gridconnectionmodule::gridconnectiontype Type Reference

This class is used to construct the connections object for the interface model's spatial discretization/grid. More...

Collaboration diagram for gridconnectionmodule::gridconnectiontype:
Collaboration graph

Public Member Functions

procedure, pass(this) construct (this, model, nrofprimaries, connectionname)
 Construct the GridConnection and allocate the data structures for the primary connections.
procedure, pass(this) destroy (this)
 Deallocate grid connection resources.
procedure, pass(this) addtoregionalmodels (this, v_model)
 Add a model to a list of all regional models.
procedure, pass(this) connectprimaryexchange (this, primex)
 Make connections for the primary exchange.
procedure, pass(this) extendconnection (this)
 Extend the connection topology to deal with higher levels of connectivity (neighbors-of-neighbors, etc.).
procedure, pass(this) getdiscretization (this, disu)
 Sets the discretization (DISU) after all preprocessing by this grid connection has been done,.
procedure, pass(this) buildinterfacemap (this)
 Build interface map object for outside use.
procedure, pass(this) isperiodic (this, n, m)
 Test if the connection between nodes within.

Public Attributes

character(len=lenmempath) memorypath
integer(i4b) internalstencildepth
 stencil size for the interior
integer(i4b) exchangestencildepth
 stencil size at the interface
integer(i4b) icondir
 icondir as defined in DIS, but reduced over all models in the interface
class(numericalmodeltype), pointer model => null()
 the model for which this grid connection exists
class(disconnexchangetype), pointer primaryexchange => null()
 pointer to the primary exchange for this interface
integer(i4b), pointer nrofboundarycells => null()
 nr of boundary cells with connection to another model
type(cellwithnbrstype), dimension(:), pointer boundarycells => null()
 cells on our side of the primary connections
type(cellwithnbrstype), dimension(:), pointer connectedcells => null()
 cells on the neighbors side of the primary connection
type(stlvecint), pointer haloexchanges
 all exchanges that are potentially part of this interface
integer(i4b), pointer nrofcells => null()
 the total number of cells in the interface
type(globalcelltype), dimension(:), pointer idxtoglobal => null()
 a map from interface index to global coordinate
integer(i4b), dimension(:), pointer, contiguous idxtoglobalidx => null()
 a (flat) map from interface index to global index, stored in mem. mgr. so can be used for debugging
type(listtype) regionalmodels
 the models participating in the interface
integer(i4b), dimension(:), pointer region_to_iface_map => null()
 (sparse) mapping from regional index to interface ixd
integer(i4b), dimension(:), pointer regionalmodeloffset => null()
 the new offset to compactify the range of indices
integer(i4b), pointer indexcount => null()
 counts the number of cells in the interface
type(connectionstype), pointer connections => null()
 sparse matrix with the connections
integer(i4b), dimension(:), pointer connectionmask => null()
 to mask out connections from the amat coefficient calculation
type(interfacemaptype), pointer interfacemap => null()
 defining map for the interface

Private Member Functions

procedure, pass(this), private allocatescalars (this)
 Allocate scalar data.
procedure, pass(this), private connectcell (this, idx1, v_model1, idx2, v_model2)
 Connect neighboring cells at the interface by storing them in the boundary cell and connected cell arrays.
procedure, pass(this), private buildconnections (this)
 Builds a sparse matrix holding all cell connections,.
procedure, pass(this), private addneighbors (this, cellnbrs, depth, mask, interior)
procedure, pass(this), private addneighborcell (this, cellnbrs, newnbridx, v_nbr_model, mask)
 Add neighboring cell to tree structure.
procedure, pass(this), private addremoteneighbors (this, cellnbrs, mask)
 Add cell neighbors across models using the stored exchange data structures.
procedure, pass(this), private get_regional_offset (this, v_model)
 Get the offset for a regional model.
generic, private getinterfaceindex (this, cell)
 Get interface index from global cell.
generic, private getinterfaceindex (this, index, v_model)
 Get interface index from a model pointer and the local index.
procedure, pass(this), private getinterfaceindexbycell (this, cell)
 Get interface index from global cell.
procedure, pass(this), private getinterfaceindexbyindexmodel (this, index, v_model)
 Get interface index from a model pointer and the local index.
procedure, pass(this), private registerinterfacecells (this, cellwithnbrs)
 Recursively set interface cell indexes and.
procedure, pass(this), private addtoglobalmap (this, ifaceidx, cell)
 Add entry to lookup table, inflating when necessary.
procedure, pass(this), private compressglobalmap (this)
 Compress lookup table to get rid of unused entries.
procedure, pass(this), private sortinterfacegrid (this)
 Soft cell ids in the interface grid such that.
procedure, pass(this), private makeprimaryconnections (this, sparse)
 Add primary connections to the sparse data structure.
procedure, pass(this), private connectneighborcells (this, cell, sparse)
 Recursively add higher order connections (from cells neighboring the primarily connected cells) to the.
procedure, pass(this), private fillconnectiondatainternal (this)
 Fill connection data (ihc, cl1, ...) for.
procedure, pass(this), private fillconnectiondatafromexchanges (this)
 Fill connection data (ihc, cl1, ...) for.
procedure, pass(this), private createconnectionmask (this)
 Create the connection masks.
procedure, pass(this), private maskinternalconnections (this, cell, nbrcell, level)
 Recursively mask connections, increasing the level as we go.
procedure, pass(this), private setmaskonconnection (this, cell, nbrcell, level)
 Set a mask on the connection from a cell to its neighbor, (and not the transposed!) not overwriting the current level.

Detailed Description

It works as follows:

1: construct basic instance, allocate data structures based on nr. of primary connections 2: add primary connections from exchanges 3: add secondary, tertiary, ... MODEL connections, depending on the size of the computational stencil 4: extend the connection, creating the full data structure and relations 5: build the connections object, from which the grid for the interface model can be constructed

A note on the different indices:

We have

  • GLOBAL index, which technically labels the row in the solution matrix
  • REGIONAL index, running over all models that participate in the interface grid
  • LOCAL index, local to each model
  • INTERFACE index, numbering the cells in the interface grid

Definition at line 57 of file GridConnection.f90.

Member Function/Subroutine Documentation

◆ addneighborcell()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::addneighborcell ( class(gridconnectiontype), intent(in) this,
type(cellwithnbrstype), intent(inout) cellnbrs,
integer(i4b), intent(in) newnbridx,
class(virtualmodeltype), pointer v_nbr_model,
type(globalcelltype), optional mask )
private
Parameters
[in]thisthis grid connection instance
[in,out]cellnbrsthe root cell which to add to
[in]newnbridxthe neighboring cell's index
v_nbr_modelthe model where the new neighbor lives
maskdon't add connections to this cell (optional)

Definition at line 105 of file GridConnection.f90.

◆ addneighbors()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::addneighbors ( class(gridconnectiontype), intent(inout) this,
type(cellwithnbrstype), intent(inout), target cellnbrs,
integer(i4b), intent(inout) depth,
type(globalcelltype), optional mask,
logical(lgp) interior )
private
Parameters
[in,out]thisthis grid connection
[in,out]cellnbrscell to add to
[in,out]depthcurrent depth (typically decreases in recursion)
maskmask to excluded back-and-forth connection between cells
interiorwhen true, we are adding from the exchange back into the model

Definition at line 104 of file GridConnection.f90.

◆ addremoteneighbors()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::addremoteneighbors ( class(gridconnectiontype), intent(inout) this,
type(cellwithnbrstype), intent(inout) cellnbrs,
type(globalcelltype), optional mask )
private
Parameters
[in,out]thisthis grid connection instance
[in,out]cellnbrscell to add to
maska mask to exclude back-and-forth connections

Definition at line 106 of file GridConnection.f90.

◆ addtoglobalmap()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::addtoglobalmap ( class(gridconnectiontype), intent(inout) this,
integer(i4b), intent(in) ifaceidx,
type(globalcelltype), intent(in) cell )
private
Parameters
[in,out]thisthis grid connection instance
[in]ifaceidxunique idx in the interface grid
[in]cellthe global cell

Definition at line 113 of file GridConnection.f90.

◆ addtoregionalmodels()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::addtoregionalmodels ( class(gridconnectiontype), intent(inout) this,
class(virtualmodeltype), pointer v_model )
Parameters
[in,out]thisthis grid connection
v_modelthe model to add to the region

Definition at line 92 of file GridConnection.f90.

◆ allocatescalars()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::allocatescalars ( class(gridconnectiontype) this)
private
Parameters
thisthis grid connection instance

Definition at line 90 of file GridConnection.f90.

◆ buildconnections()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::buildconnections ( class(gridconnectiontype), intent(inout) this)
private
Parameters
[in,out]thisthis grid connection instance

Definition at line 103 of file GridConnection.f90.

◆ buildinterfacemap()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::buildinterfacemap ( class(gridconnectiontype) this)
Parameters
thisthis grid connection

Definition at line 96 of file GridConnection.f90.

◆ compressglobalmap()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::compressglobalmap ( class(gridconnectiontype), intent(inout) this)
private
Parameters
[in,out]thisthis grid connection instance

Definition at line 114 of file GridConnection.f90.

◆ connectcell()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::connectcell ( class(gridconnectiontype), intent(in) this,
integer(i4b) idx1,
class(virtualmodeltype), pointer v_model1,
integer(i4b) idx2,
class(virtualmodeltype), pointer v_model2 )
private
Parameters
[in]thisthis grid connection
idx1local index cell 1
v_model1model of cell 1
idx2local index cell 2
v_model2model of cell 2

Definition at line 102 of file GridConnection.f90.

◆ connectneighborcells()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::connectneighborcells ( class(gridconnectiontype), intent(inout) this,
type(cellwithnbrstype) cell,
type(sparsematrix), pointer sparse )
private
Parameters
[in,out]thisthis grid connection instance
cellthe cell whose connections is to be added
sparsethe sparse data structure to hold the connections

Definition at line 117 of file GridConnection.f90.

◆ connectprimaryexchange()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::connectprimaryexchange ( class(gridconnectiontype) this,
class(disconnexchangetype), pointer primex )
Parameters
thisthis grid connection
primexthe primary exchange for this connection

Definition at line 93 of file GridConnection.f90.

◆ construct()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::construct ( class(gridconnectiontype), intent(inout) this,
class(numericalmodeltype), intent(in), pointer model,
integer(i4b) nrofprimaries,
character(len=*) connectionname )

Definition at line 89 of file GridConnection.f90.

◆ createconnectionmask()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::createconnectionmask ( class(gridconnectiontype), intent(inout) this)
private

The level indicates the nr of connections away from the remote neighbor, the diagonal term holds the negated value of their nearest connection. We end with setting

Parameters
[in,out]thisinstance of this grid connection

Definition at line 120 of file GridConnection.f90.

◆ destroy()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::destroy ( class(gridconnectiontype) this)
Parameters
thisthis grid connection instance

Definition at line 91 of file GridConnection.f90.

◆ extendconnection()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::extendconnection ( class(gridconnectiontype), intent(inout) this)

The following steps are taken:

  1. Recursively add interior neighbors (own model) up to the specified depth
  2. Recursively add exterior neighbors
  3. Allocate a (sparse) mapping table for the region
  4. Build connection object for the interface grid, and the mask
    Parameters
    [in,out]thisthis grid connection

Definition at line 94 of file GridConnection.f90.

◆ fillconnectiondatafromexchanges()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::fillconnectiondatafromexchanges ( class(gridconnectiontype), intent(inout) this)
private
Parameters
[in,out]thisthis grid connection instance

Definition at line 119 of file GridConnection.f90.

◆ fillconnectiondatainternal()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::fillconnectiondatainternal ( class(gridconnectiontype), intent(inout) this)
private
Parameters
[in,out]thisthis grid connection instance

Definition at line 118 of file GridConnection.f90.

◆ get_regional_offset()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::get_regional_offset ( class(gridconnectiontype), intent(inout) this,
class(virtualmodeltype), pointer v_model )
private
Parameters
[in,out]thisthis grid connection instance
v_modelthe model to get the offset for
Returns
the index offset in the regional domain

Definition at line 107 of file GridConnection.f90.

◆ getdiscretization()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::getdiscretization ( class(gridconnectiontype) this,
class(disutype), pointer disu )
Parameters
thisthe grid connection
disuthe target disu object

Definition at line 95 of file GridConnection.f90.

◆ getinterfaceindex() [1/2]

generic, private gridconnectionmodule::gridconnectiontype::getinterfaceindex ( class(gridconnectiontype), intent(inout) this,
type(globalcelltype), intent(in) cell )
private
Parameters
[in,out]thisthis grid connection instance
[in]cellthe global cell to get the interface index for
Returns
the index in the interface model

Definition at line 108 of file GridConnection.f90.

Here is the call graph for this function:

◆ getinterfaceindex() [2/2]

generic, private gridconnectionmodule::gridconnectiontype::getinterfaceindex ( class(gridconnectiontype), intent(inout) this,
integer(i4b) index,
class(virtualmodeltype), pointer v_model )
private
Parameters
[in,out]thisthis grid connection instance
indexthe local cell index
v_modelthe cell's model
Returns
the index in the interface model

Definition at line 108 of file GridConnection.f90.

◆ getinterfaceindexbycell()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::getinterfaceindexbycell ( class(gridconnectiontype), intent(inout) this,
type(globalcelltype), intent(in) cell )
private
Parameters
[in,out]thisthis grid connection instance
[in]cellthe global cell to get the interface index for
Returns
the index in the interface model

Definition at line 110 of file GridConnection.f90.

◆ getinterfaceindexbyindexmodel()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::getinterfaceindexbyindexmodel ( class(gridconnectiontype), intent(inout) this,
integer(i4b) index,
class(virtualmodeltype), pointer v_model )
private
Parameters
[in,out]thisthis grid connection instance
indexthe local cell index
v_modelthe cell's model
Returns
the index in the interface model

Definition at line 111 of file GridConnection.f90.

◆ isperiodic()

procedure, pass(this) gridconnectionmodule::gridconnectiontype::isperiodic ( class(gridconnectiontype), intent(in) this,
integer(i4b), intent(in) n,
integer(i4b), intent(in) m )
Parameters
[in]thisthis grid connection instance
[in]nfirst node of the connection
[in]msecond node of the connection
Returns
true when periodic

Definition at line 99 of file GridConnection.f90.

◆ makeprimaryconnections()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::makeprimaryconnections ( class(gridconnectiontype), intent(inout) this,
type(sparsematrix), pointer sparse )
private
Parameters
[in,out]thisthis grid connection instance
sparsethe sparse data structure to hold the connections

Definition at line 116 of file GridConnection.f90.

◆ maskinternalconnections()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::maskinternalconnections ( class(gridconnectiontype), intent(inout) this,
type(cellwithnbrstype), intent(inout) cell,
type(cellwithnbrstype), intent(inout) nbrcell,
integer(i4b), intent(in) level )
private
Parameters
[in,out]thisthis grid connection instance
[in,out]cellcell 1 in the connection to mask
[in,out]nbrcellcell 2 in the connection to mask

Definition at line 121 of file GridConnection.f90.

◆ registerinterfacecells()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::registerinterfacecells ( class(gridconnectiontype), intent(inout) this,
type(cellwithnbrstype) cellwithnbrs )
private
Parameters
[in,out]thisthis grid connection instance
cellwithnbrsthe cell from where to start registering neighbors

Definition at line 112 of file GridConnection.f90.

◆ setmaskonconnection()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::setmaskonconnection ( class(gridconnectiontype), intent(inout) this,
type(cellwithnbrstype), intent(inout) cell,
type(cellwithnbrstype), intent(inout) nbrcell,
integer(i4b), intent(in) level )
private
Parameters
[in,out]thisthis grid connection instance
[in,out]cellcell 1 in the connection
[in,out]nbrcellcell 2 in the connection
[in]levelthe level value to set the mask to

Definition at line 122 of file GridConnection.f90.

◆ sortinterfacegrid()

procedure, pass(this), private gridconnectionmodule::gridconnectiontype::sortinterfacegrid ( class(gridconnectiontype), intent(inout) this)
private
Parameters
[in,out]thisthis grid connection instance

Definition at line 115 of file GridConnection.f90.

Member Data Documentation

◆ boundarycells

type(cellwithnbrstype), dimension(:), pointer gridconnectionmodule::gridconnectiontype::boundarycells => null()

Definition at line 68 of file GridConnection.f90.

◆ connectedcells

type(cellwithnbrstype), dimension(:), pointer gridconnectionmodule::gridconnectiontype::connectedcells => null()

Definition at line 69 of file GridConnection.f90.

◆ connectionmask

integer(i4b), dimension(:), pointer gridconnectionmodule::gridconnectiontype::connectionmask => null()

Definition at line 82 of file GridConnection.f90.

◆ connections

type(connectionstype), pointer gridconnectionmodule::gridconnectiontype::connections => null()

Definition at line 81 of file GridConnection.f90.

◆ exchangestencildepth

integer(i4b) gridconnectionmodule::gridconnectiontype::exchangestencildepth

Definition at line 61 of file GridConnection.f90.

61 integer(I4B) :: exchangeStencilDepth !< stencil size at the interface

◆ haloexchanges

type(stlvecint), pointer gridconnectionmodule::gridconnectiontype::haloexchanges

Definition at line 70 of file GridConnection.f90.

70 type(STLVecInt), pointer :: haloExchanges !< all exchanges that are potentially part of this interface

◆ icondir

integer(i4b) gridconnectionmodule::gridconnectiontype::icondir

Definition at line 62 of file GridConnection.f90.

62 integer(I4B) :: icondir !< icondir as defined in DIS, but reduced over all models in the interface

◆ idxtoglobal

type(globalcelltype), dimension(:), pointer gridconnectionmodule::gridconnectiontype::idxtoglobal => null()

Definition at line 73 of file GridConnection.f90.

◆ idxtoglobalidx

integer(i4b), dimension(:), pointer, contiguous gridconnectionmodule::gridconnectiontype::idxtoglobalidx => null()

Definition at line 74 of file GridConnection.f90.

◆ indexcount

integer(i4b), pointer gridconnectionmodule::gridconnectiontype::indexcount => null()

Definition at line 79 of file GridConnection.f90.

◆ interfacemap

type(interfacemaptype), pointer gridconnectionmodule::gridconnectiontype::interfacemap => null()

Definition at line 84 of file GridConnection.f90.

◆ internalstencildepth

integer(i4b) gridconnectionmodule::gridconnectiontype::internalstencildepth

Definition at line 60 of file GridConnection.f90.

60 integer(I4B) :: internalStencilDepth !< stencil size for the interior

◆ memorypath

character(len=lenmempath) gridconnectionmodule::gridconnectiontype::memorypath

Definition at line 59 of file GridConnection.f90.

59 character(len=LENMEMPATH) :: memoryPath

◆ model

class(numericalmodeltype), pointer gridconnectionmodule::gridconnectiontype::model => null()

Definition at line 64 of file GridConnection.f90.

◆ nrofboundarycells

integer(i4b), pointer gridconnectionmodule::gridconnectiontype::nrofboundarycells => null()

Definition at line 67 of file GridConnection.f90.

◆ nrofcells

integer(i4b), pointer gridconnectionmodule::gridconnectiontype::nrofcells => null()

Definition at line 72 of file GridConnection.f90.

◆ primaryexchange

class(disconnexchangetype), pointer gridconnectionmodule::gridconnectiontype::primaryexchange => null()

Definition at line 65 of file GridConnection.f90.

◆ region_to_iface_map

integer(i4b), dimension(:), pointer gridconnectionmodule::gridconnectiontype::region_to_iface_map => null()

Definition at line 77 of file GridConnection.f90.

◆ regionalmodeloffset

integer(i4b), dimension(:), pointer gridconnectionmodule::gridconnectiontype::regionalmodeloffset => null()

Definition at line 78 of file GridConnection.f90.

◆ regionalmodels

type(listtype) gridconnectionmodule::gridconnectiontype::regionalmodels

Definition at line 76 of file GridConnection.f90.

76 type(ListType) :: regionalModels !< the models participating in the interface

The documentation for this type was generated from the following file: