# 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 ModflowGwtdsp(MFPackage):
    """
    ModflowGwtdsp defines a DSP 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.
    diffc : [double precision]
        effective molecular diffusion coefficient.
    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.

    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`.

    """

    diffc = ArrayTemplateGenerator(("gwt6", "dsp", "griddata", "diffc"))
    alh = ArrayTemplateGenerator(("gwt6", "dsp", "griddata", "alh"))
    alv = ArrayTemplateGenerator(("gwt6", "dsp", "griddata", "alv"))
    ath1 = ArrayTemplateGenerator(("gwt6", "dsp", "griddata", "ath1"))
    ath2 = ArrayTemplateGenerator(("gwt6", "dsp", "griddata", "ath2"))
    atv = ArrayTemplateGenerator(("gwt6", "dsp", "griddata", "atv"))
    package_abbr = "gwtdsp"
    _package_type = "dsp"
    dfn_file_name = "gwt-dsp.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 diffc",
            "type double precision",
            "shape (nodes)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional 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",
        ],
    ]

    def __init__(
        self,
        model,
        loading_package=False,
        xt3d_off=None,
        xt3d_rhs=None,
        export_array_ascii=None,
        export_array_netcdf=None,
        diffc=None,
        alh=None,
        alv=None,
        ath1=None,
        ath2=None,
        atv=None,
        filename=None,
        pname=None,
        **kwargs,
    ):
        """Initialize ModflowGwtdsp."""
        super().__init__(
            parent=model,
            package_type="dsp",
            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.diffc = self.build_mfdata("diffc", diffc)
        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._init_complete = True
