MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
VirtualGweExchange.f90
Go to the documentation of this file.
2  use kindmodule, only: i4b
8  implicit none
9  private
10 
11  public :: add_virtual_gwe_exchange
12 
13  type, public, extends(virtualexchangetype) :: virtualgweexchangetype
14  type(virtualdbl1dtype), pointer :: gwfsimvals => null()
15  contains
16  procedure :: create => vtx_create
17  procedure :: destroy => vtx_destroy
18  procedure :: prepare_stage => vtx_prepare_stage
19  ! private
20  procedure, private :: init_virtual_data
21  procedure, private :: allocate_data
22  procedure, private :: deallocate_data
23  end type virtualgweexchangetype
24 
25 contains
26 
27 !> @brief Add a virtual GWE-GWE exchange to the simulation
28 !<
29  subroutine add_virtual_gwe_exchange(name, exchange_id, model1_id, model2_id)
30  character(len=*) :: name
31  integer(I4B) :: exchange_id
32  integer(I4B) :: model1_id
33  integer(I4B) :: model2_id
34  ! local
35  class(virtualgweexchangetype), pointer :: v_exg
36  class(*), pointer :: obj_ptr
37 
38  allocate (v_exg)
39  call v_exg%create(name, exchange_id, model1_id, model2_id)
40 
41  obj_ptr => v_exg
42  call virtual_exchange_list%Add(obj_ptr)
43 
44  end subroutine add_virtual_gwe_exchange
45 
46 !> @brief Create a virtual GWE-GWE exchange
47 !<
48  subroutine vtx_create(this, name, exg_id, m1_id, m2_id)
49  class(virtualgweexchangetype) :: this
50  character(len=*) :: name
51  integer(I4B) :: exg_id
52  integer(I4B) :: m1_id
53  integer(I4B) :: m2_id
54 
55  ! create base
56  call this%VirtualExchangeType%create(name, exg_id, m1_id, m2_id)
57  this%container_type = vdc_gweexg_type
58 
59  call this%allocate_data()
60  call this%init_virtual_data()
61 
62  end subroutine vtx_create
63 
64  subroutine init_virtual_data(this)
65  class(virtualgweexchangetype) :: this
66 
67  call this%set(this%gwfsimvals%base(), 'GWFSIMVALS', '', map_all_type)
68 
69  end subroutine init_virtual_data
70 
71  subroutine vtx_prepare_stage(this, stage)
72  class(virtualgweexchangetype) :: this
73  integer(I4B) :: stage
74  ! local
75  integer(I4B) :: nexg
76 
77  ! prepare base exchange data items
78  call this%VirtualExchangeType%prepare_stage(stage)
79 
80  if (stage == stg_bfr_con_ar) then
81  nexg = this%nexg%get()
82  call this%map(this%gwfsimvals%base(), nexg, (/stg_bfr_exg_ad/))
83  end if
84 
85  end subroutine vtx_prepare_stage
86 
87  subroutine vtx_destroy(this)
88  class(virtualgweexchangetype) :: this
89 
90  call this%VirtualExchangeType%destroy()
91  call this%deallocate_data()
92 
93  end subroutine vtx_destroy
94 
95  subroutine allocate_data(this)
96  class(virtualgweexchangetype) :: this
97 
98  allocate (this%gwfsimvals)
99 
100  end subroutine allocate_data
101 
102  subroutine deallocate_data(this)
103  class(virtualgweexchangetype) :: this
104 
105  deallocate (this%gwfsimvals)
106 
107  end subroutine deallocate_data
108 
109 end module virtualgweexchangemodule
This module defines variable data types.
Definition: kind.f90:8
integer(i4b), parameter, public stg_bfr_exg_ad
before exchange advance (per solution)
Definition: SimStages.f90:21
integer(i4b), parameter, public stg_bfr_con_ar
before connection allocate read
Definition: SimStages.f90:17
integer(i4b), parameter, public map_all_type
Definition: VirtualBase.f90:13
integer(i4b), parameter, public vdc_gweexg_type
type(listtype), public virtual_exchange_list
subroutine deallocate_data(this)
subroutine init_virtual_data(this)
subroutine allocate_data(this)
subroutine, public add_virtual_gwe_exchange(name, exchange_id, model1_id, model2_id)
Add a virtual GWE-GWE exchange to the simulation.
subroutine vtx_prepare_stage(this, stage)
subroutine vtx_create(this, name, exg_id, m1_id, m2_id)
Create a virtual GWE-GWE exchange.
The Virtual Exchange is based on two Virtual Models and is therefore not always strictly local or rem...