# autogenerated file, do not modify

from os import PathLike, curdir
from typing import Union

from flopy.mf6.data.mfdatautil import ArrayTemplateGenerator, ListTemplateGenerator
from flopy.mf6.mfpackage import MFChildPackages, MFPackage


class ModflowGwecnd(MFPackage):
    """
    ModflowGwecnd defines a CND package.

    Parameters
    ----------
    model
        Model that this package is a part of. Package is automatically
        added to model when it is initialized.
    loading_package : bool, default False
        Do not set this parameter. It is intended for debugging and internal
        processing purposes only.
    xt3d_off : keyword
        deactivate the xt3d method and use the faster and less accurate approximation.
        this option may provide a fast and accurate solution under some circumstances,
        such as when flow aligns with the model grid, there is no mechanical
        dispersion, or when the longitudinal and transverse dispersivities are equal.
        this option may also be used to assess the computational demand of the xt3d
        approach by noting the run time differences with and without this option on.
    xt3d_rhs : keyword
        add xt3d terms to right-hand side, when possible.  this option uses less
        memory, but may require more iterations.
    export_array_ascii : keyword
        keyword that specifies input griddata arrays should be written to layered ascii
        output files.
    export_array_netcdf : keyword
        keyword that specifies input griddata arrays should be written to the model
        output netcdf file.
    alh : [double precision]
        longitudinal dispersivity in horizontal direction.  if flow is strictly
        horizontal, then this is the longitudinal dispersivity that will be used.  if
        flow is not strictly horizontal or strictly vertical, then the longitudinal
        dispersivity is a function of both alh and alv.  if mechanical dispersion is
        represented (by specifying any dispersivity values) then this array is
        required.
    alv : [double precision]
        longitudinal dispersivity in vertical direction.  if flow is strictly vertical,
        then this is the longitudinal dispsersivity value that will be used.  if flow
        is not strictly horizontal or strictly vertical, then the longitudinal
        dispersivity is a function of both alh and alv.  if this value is not specified
        and mechanical dispersion is represented, then this array is set equal to alh.
    ath1 : [double precision]
        transverse dispersivity in horizontal direction.  this is the transverse
        dispersivity value for the second ellipsoid axis.  if flow is strictly
        horizontal and directed in the x direction (along a row for a regular grid),
        then this value controls spreading in the y direction.  if mechanical
        dispersion is represented (by specifying any dispersivity values) then this
        array is required.
    ath2 : [double precision]
        transverse dispersivity in horizontal direction.  this is the transverse
        dispersivity value for the third ellipsoid axis.  if flow is strictly
        horizontal and directed in the x direction (along a row for a regular grid),
        then this value controls spreading in the z direction.  if this value is not
        specified and mechanical dispersion is represented, then this array is set
        equal to ath1.
    atv : [double precision]
        transverse dispersivity when flow is in vertical direction.  if flow is
        strictly vertical and directed in the z direction, then this value controls
        spreading in the x and y directions.  if this value is not specified and
        mechanical dispersion is represented, then this array is set equal to ath2.
    ktw : [double precision]
        thermal conductivity of the simulated fluid.   note that the cnd package does
        not account for the tortuosity of the flow paths when solving for the
        conductive spread of heat.  if tortuosity plays an important role in the
        thermal conductivity calculation, its effect should be reflected in the value
        specified for ktw.
    kts : [double precision]
        thermal conductivity of the solid aquifer material

    filename : str or PathLike, optional
        Name or path of file where this package is stored.
    pname : str, optional
        Package name.
    **kwargs
        Extra keywords for :class:`flopy.mf6.mfpackage.MFPackage`.

    """

    alh = ArrayTemplateGenerator(("gwe6", "cnd", "griddata", "alh"))
    alv = ArrayTemplateGenerator(("gwe6", "cnd", "griddata", "alv"))
    ath1 = ArrayTemplateGenerator(("gwe6", "cnd", "griddata", "ath1"))
    ath2 = ArrayTemplateGenerator(("gwe6", "cnd", "griddata", "ath2"))
    atv = ArrayTemplateGenerator(("gwe6", "cnd", "griddata", "atv"))
    ktw = ArrayTemplateGenerator(("gwe6", "cnd", "griddata", "ktw"))
    kts = ArrayTemplateGenerator(("gwe6", "cnd", "griddata", "kts"))
    package_abbr = "gwecnd"
    _package_type = "cnd"
    dfn_file_name = "gwe-cnd.dfn"
    dfn = [
        ["header"],
        [
            "block options",
            "name xt3d_off",
            "type keyword",
            "shape",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name xt3d_rhs",
            "type keyword",
            "shape",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name export_array_ascii",
            "type keyword",
            "reader urword",
            "optional true",
            "mf6internal export_ascii",
        ],
        [
            "block options",
            "name export_array_netcdf",
            "type keyword",
            "reader urword",
            "optional true",
            "mf6internal export_nc",
            "extended true",
        ],
        [
            "block griddata",
            "name alh",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
        [
            "block griddata",
            "name alv",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
        [
            "block griddata",
            "name ath1",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
        [
            "block griddata",
            "name ath2",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
        [
            "block griddata",
            "name atv",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
        [
            "block griddata",
            "name ktw",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
        [
            "block griddata",
            "name kts",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
    ]

    def __init__(
        self,
        model,
        loading_package=False,
        xt3d_off=None,
        xt3d_rhs=None,
        export_array_ascii=None,
        export_array_netcdf=None,
        alh=None,
        alv=None,
        ath1=None,
        ath2=None,
        atv=None,
        ktw=None,
        kts=None,
        filename=None,
        pname=None,
        **kwargs,
    ):
        """Initialize ModflowGwecnd."""
        super().__init__(
            parent=model,
            package_type="cnd",
            filename=filename,
            pname=pname,
            loading_package=loading_package,
            **kwargs,
        )

        self.xt3d_off = self.build_mfdata("xt3d_off", xt3d_off)
        self.xt3d_rhs = self.build_mfdata("xt3d_rhs", xt3d_rhs)
        self.export_array_ascii = self.build_mfdata(
            "export_array_ascii", export_array_ascii
        )
        self.export_array_netcdf = self.build_mfdata(
            "export_array_netcdf", export_array_netcdf
        )
        self.alh = self.build_mfdata("alh", alh)
        self.alv = self.build_mfdata("alv", alv)
        self.ath1 = self.build_mfdata("ath1", ath1)
        self.ath2 = self.build_mfdata("ath2", ath2)
        self.atv = self.build_mfdata("atv", atv)
        self.ktw = self.build_mfdata("ktw", ktw)
        self.kts = self.build_mfdata("kts", kts)

        self._init_complete = True
