Coverage for C:\src\imod-python\imod\wq\vdf.py: 35%
20 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-08 10:26 +0200
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-08 10:26 +0200
1from imod.wq.pkgbase import Package
4class VariableDensityFlow(Package):
5 """
6 Variable Density Flow package.
8 Parameters
9 ----------
10 density_species: int
11 is the MT3DMS species number that will be used in the equation of state
12 to compute fluid density (mtdnconc).
13 If density_species = 0, fluid density is specified using items 6 and 7,
14 and flow will be uncoupled with transport if the IMT Process is active.
15 If density_species > 0, fluid density is calculated using the MT3DMS
16 species number that corresponds with density_species. A value for
17 density_species greater than zero indicates that flow will be coupled
18 with transport.
19 If density_species = -1, fluid density is calculated using one or more
20 MT3DMS species. Items 4a, 4b, and 4c will be read instead of item 4.
21 density_min: float
22 is the minimum fluid density (DENSEMIN). If the resulting density value
23 calculated with the equation of state is less than density_min, the
24 density value is set to density_min.
25 If density_min = 0, the computed fluid density is not limited by
26 density_min (this is the option to use for most simulations).
27 If density_min > 0, a computed fluid density less than density_min is
28 automatically reset to density_min.
29 density_max: float
30 is the maximum fluid density (DENSEMAX). If the resulting density value
31 calculated with the equation of state is greater than density_max, the
32 density value is set to density_max.
33 If density_max = 0, the computed fluid density is not limited by
34 density_max (this is the option to use for most simulations).
35 If density_max > 0, a computed fluid density larger than density_max is
36 automatically reset to density_max.
37 density_ref: float
38 is the fluid density at the reference concentration, temperature, and
39 pressure (DENSEREF). For most simulations, density_ref is specified as
40 the density of freshwater at 25 °C and at a reference pressure of zero.
41 Value of 1000 is often used.
42 density_concentration_slope: float
43 is the slope d(rho)/d(C) of the linear equation of state that relates
44 fluid density to solute concentration (denseslp). Value of 0.7143 is
45 often used.
46 density_criterion: float
47 is the convergence parameter for the coupling between flow and transport
48 and has units of fluid density (DNSCRIT). If the maximum density
49 difference between two consecutive coupling iterations is not less than
50 density_criterion, the program will continue to iterate on the flow and
51 transport equations or will terminate if 'coupling' is exceeded.
52 coupling: int
53 is a flag used to determine the flow and transport coupling procedure
54 (nswtcpl).
55 If coupling = 0 or 1, flow and transport will be explicitly coupled
56 using a one-timestep lag. The explicit coupling option is normally much
57 faster than the iterative option and is recommended for most
58 applications.
59 If coupling > 1, coupling is the maximum number of non-linear coupling
60 iterations for the flow and transport solutions. SEAWAT-2000 will stop
61 execution after coupling iterations if convergence between flow and
62 transport has not occurred.
63 If coupling = -1, the flow solution will be recalculated only for: The
64 first transport step of the simulation, or The last transport step of
65 the MODFLOW timestep, or The maximum density change at a cell is greater
66 than density_criterion.
67 correct_water_table: bool
68 is a flag used to activate the variable-density water-table corrections
69 (IWTABLE).
70 If correct_water_table = False, the water-table correction will not be
71 applied.
72 If correct_water_table = True, the water-table correction will be
73 applied.
74 internodal: str, {"upstream", "central"}
75 is a flag that determines the method for calculating the internodal
76 density values used to conserve fluid mass (MFNADVFD).
77 If internodal = "central", internodal conductance values used to
78 conserve fluid mass are calculated using a central-in-space algorithm.
79 If internodal = "upstream", internodal conductance values used to
80 conserve fluid mass are calculated using an upstream-weighted algorithm.
81 """
83 _pkg_id = "vdf"
85 _template = (
86 "[vdf]\n"
87 " mtdnconc = {density_species}\n"
88 " densemin = {density_min}\n"
89 " densemax = {density_max}\n"
90 " denseref = {density_ref}\n"
91 " denseslp = {density_concentration_slope}\n"
92 " dnscrit = {density_criterion}\n"
93 " nswtcpl = {coupling}\n"
94 " iwtable = {correct_water_table}\n"
95 " mfnadvfd = {internodal}\n"
96 )
98 _keywords = {
99 "internodal": {"central": 2, "upstream": 1},
100 "correct_water_table": {False: 0, True: 1},
101 }
103 def __init__(
104 self,
105 density_concentration_slope,
106 density_species=1,
107 density_min=1000.0,
108 density_max=1025.0,
109 density_ref=1000.0,
110 density_criterion=0.01,
111 read_density=False,
112 internodal="central",
113 coupling=1,
114 correct_water_table=False,
115 ):
116 super().__init__()
117 self["density_species"] = density_species
118 self["density_min"] = density_min
119 self["density_max"] = density_max
120 self["density_ref"] = density_ref
121 self["density_concentration_slope"] = density_concentration_slope
122 self["density_criterion"] = density_criterion
123 self["read_density"] = read_density
124 self["internodal"] = internodal
125 self["coupling"] = coupling
126 self["correct_water_table"] = correct_water_table
128 def _pkgcheck(self, ibound=None):
129 to_check = [
130 "density_species",
131 "density_min",
132 "density_max",
133 "density_ref",
134 "density_concentration_slope",
135 "density_criterion",
136 ]
137 self._check_positive(to_check)