pycomus.ComusDis package

Submodules

pycomus.ComusDis.CONSTANTS module

pycomus.ComusDis.CmsDis module

class pycomus.ComusDis.CmsDis.ComusDis(model, num_lyr: int = 1, num_row: int = 1, num_col: int = 1, x_coord: float | int = 0, y_coord: float | int = 0, row_space: float | int | List[float] = 1, col_space: float | int | List[float] = 1)[source]

Bases: object

Base Class

write_file(folder_path)[source]
class pycomus.ComusDis.CmsDis.ComusDisBcf(model, num_lyr: int = 1, num_row: int = 1, num_col: int = 1, row_space: float | int | List[float] = 1, col_space: float | int | List[float] = 1, x_coord: float = 0, y_coord: float = 0, lyr_type: List[int] | None = None, lyr_trpy: List[float] | None = None, lyr_ibs: List[int] | None = None)[source]

Bases: ComusDis

COMUS Grid And Layer Property Flow Package Class(BCF).

Attributes:

model: pycomus.ComusModel

COMUS model object

num_lyr: int

Number of layers

num_row: int

Number of rows

num_col: int

Number of cols

row_space: Union[float, int, List[float]]

A float or List data that represents row spacing

col_space: Union[float, int, List[float]]

A float or List data that represents col spacing

x_coord: float, optional

Top left corner X coordinate, by default 0

y_coord: float, optional

Top left corner Y coordinate, by default 0

lyr_type: List[int]

The data in lyr_type should be in [0:Confined,1:Unconfined,2:Limited Convertible,3:Full Convertible]

lyr_trpy: List[float], optional

ky/kx, by default None

lyr_ibs: List[int], optional

The data in lyr_ibs should be in [0:IBS-Disable,1:IBS-Enable]!, by default None

Methods:

__init__(self, model, num_lyr: int = 1, num_row: int = 1, num_col: int = 1,

row_space: Union[float, int, List[float]] = 1, col_space: Union[float, int, List[float]] = 1, x_coord: float = 0, y_coord: float = 0, lyr_type: List[int] = None, lyr_trpy: List[float] = None, lyr_ibs: List[int] = None)

Instantiate an instance of ComusDisBcf.

load(cls, model, ctrl_params_file: str, grd_space_file: str, bcf_lyr_file: str)

Load parameters from a LpfLyr.in file and create a ComusDisLpf instance.

write_file(self, folder_path: str)

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusDisBcf module to the specified path as <BcfLyr.in>.

Returns:

instance: pycomus.ComusDisBcf

COMUS BCF Layer Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> modelDis = pycomus.ComusDisBcf(model1, 1, 20, 20, row_space=1, col_space=1, lyr_type=[1 for _ in range(1)], y_coord=1)
classmethod load(model, ctrl_params_file: str, grd_space_file: str, bcf_lyr_file: str)[source]

Load parameters from a BcfLyr.in file and create a ComusDisBcf instance.

Parameters:

model: pycomus.ComusModel

COMUS Model Object.

ctrl_params_file: str

Control Params File(CtrlPar.in)

grd_space_file: str

Grid Space File(GrdSpace.in)

bcf_lyr_file: str

Bcf Layer Attribute File(BcfLyr.in)

Returns:

instance: pycomus.ComusDisLpf

COMUS Bcf Layer Attribute Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> modelDis = pycomus.ComusDisBcf.load(model1, "./InputFiles/CtrlPar.in", "./InputFiles/GrdSpace.in", "./InputFiles/BcfLyr.in")
write_file(folder_path: str)[source]

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusDisBcf module to the specified path as <BcfLyr.in>.

Parameters:

folder_path – Output folder path.

class pycomus.ComusDis.CmsDis.ComusDisLpf(model, num_lyr: int = 1, num_row: int = 1, num_col: int = 1, row_space: float | int | List[float] = 1, col_space: float | int | List[float] = 1, x_coord: float = 0, y_coord: float = 0, lyr_type: List[int] | None = None, lyr_cbd: List[int] | None = None, lyr_ibs: List[int] | None = None)[source]

Bases: ComusDis

COMUS Layer Property Flow Package Class(LPF).

Attributes:

modelpycomus.ComusModel

COMUS Model Object

num_lyrint

Number of layers

num_rowint

Number of rows

num_colint

Number of columns

row_spaceUnion[float, int, List[float]]

A float, int, or List representing row spacing

col_spaceUnion[float, int, List[float]]

A float, int, or List representing column spacing

x_coordfloat

Top left corner X coordinate

y_coordfloat

Top left corner Y coordinate

lyr_typeList[int]

The data in lyr_type should be in [0: Confined, 1: Convertible]

lyr_cbdList[int]

The data in lyr_cbd should be in [0: Quasi Three Dimensions-Disable, 1: Quasi Three Dimensions-Enable]

lyr_ibsList[int]

The data in lyr_ibs should be in [0: IBS-Disable, 1: IBS-Enable]

Methods:

__init__(self, model, num_lyr: int = 1, num_row: int = 1, num_col: int = 1,

row_space: Union[float, int, List[float]] = 1, col_space: Union[float, int, List[float]] = 1, x_coord: float = 0, y_coord: float = 0, lyr_type: List[int] = None, lyr_cbd: List[int] = None, lyr_ibs: List[int] = None)

Instantiate an instance of ComusDisLpf.

load(cls, model, ctrl_params_file: str, grd_space_file: str, lpf_lyr_file: str)

Load parameters from a LpfLyr.in file and create a ComusDisLpf instance.

write_file(self, folder_path: str)

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusDisLpf module to the specified path as <LpfLyr.in>.

Returns:

instance: pycomus.ComusDisLpf

COMUS LPF Layer Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> modelDis = pycomus.ComusDisLpf(model1, 1, 20, 20, row_space=1, col_space=1, lyr_type=[1 for _ in range(1)], y_coord=1)
classmethod load(model, ctrl_params_file: str, grd_space_file: str, lpf_lyr_file: str)[source]

Load parameters from a LpfLyr.in file and create a ComusDisLpf instance.

Parameters:

model: pycomus.ComusModel

COMUS Model Object.

ctrl_params_file: str

Control Params File(CtrlPar.in)

grd_space_file: str

Grid Space File(GrdSpace.in)

lpf_lyr_file: str

Lpf Layer Attribute File(LpfLyr.in)

Returns:

instance: pycomus.ComusDisLpf

COMUS Lpf Layer Attribute Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> modelDis = pycomus.ComusDisLpf.load(model1, "./InputFiles/CtrlPar.in", "./InputFiles/GrdSpace.in", "./InputFiles/LpfLyr.in")
write_file(folder_path: str)[source]

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusDisLpf module to the specified path as <LpfLyr.in>.

Parameters:

folder_path – Output folder path.

pycomus.ComusDis.CmsGridPars module

class pycomus.ComusDis.CmsGridPars.ComusGridPars(model, top: float | int | ndarray | None = None, bot: float | int | ndarray | None = None, ibound: int | ndarray | None = None, shead: float | int | ndarray | None = None, kx: float | int | ndarray | None = None, transm: float | int | ndarray | None = None, vcont: float | int | ndarray | None = None, sc1: float | int | ndarray | None = None, sc2: float | int | ndarray | None = None, wet_dry: float | int | ndarray | None = None, ky: float | int | ndarray | None = None, kz: float | int | ndarray | None = None, vkcb: float | int | ndarray | None = None, tkcb: float | int | ndarray | None = None)[source]

Bases: object

Set COMUS Model GridCell Parameter Attributes.

Attributes:

model:

COMUS Model Object.

top:

A value of 0 indicates an inactive cell; 1 indicates a variable head cell; -1 indicates a constant head cell.

bot:

Represents the elevation of the bottom boundary of the grid cell (in length units).

ibound:

Represents the elevation of the top boundary of the grid cell (in length units).

shead:

The initial head value for the grid cell (L).

kx:

Permeability coefficient kx in the X-direction.

transm:

This represents the transmissivity of the grid cell in the row direction.

vcont:

The vertical hydraulic conductivity of the grid cell (1/T), also known as the leakage coefficient.

sc1:

Grid cell type 1 storage coefficient (-).

sc2:

Grid cell type 2 storage coefficient (-).

wet_dry:

The absolute value is the threshold by which the head in the adjacent cell must exceed the bottom elevation of the current cell to trigger wetting.

ky:

Permeability coefficient ky in the Y-direction.

kz:

Permeability coefficient kz in the Z-direction.

vkcb:

It represents the vertical hydraulic conductivity of the low-permeability medium at the bottom of the grid cell (L/T).

tkcb:

It denotes the thickness of the low-permeability medium at the bottom of the grid cell (L).

Methods:

__init__(self, model, top: Union[float, int, np.ndarray] = None, bot: Union[float, int, np.ndarray] = None,

ibound: Union[int, np.ndarray] = None, shead: Union[float, int, np.ndarray] = None, kx: Union[float, int, np.ndarray] = None, transm: Union[float, int, np.ndarray] = None, vcont: Union[float, int, np.ndarray] = None, sc1: Union[float, int, np.ndarray] = None, sc2: Union[float, int, np.ndarray] = None, wet_dry: Union[float, int, np.ndarray] = None, ky: Union[float, int, np.ndarray] = None, kz: Union[float, int, np.ndarray] = None, vkcb: Union[float, int, np.ndarray] = None, tkcb: Union[float, int, np.ndarray] = None) Set COMUS Model GridCell Parameter Attributes.

load(cls, model, grid_params_file: str)

Load parameters from a BcfGrd.in or LpfGrd.in file and create a ComusGridPars instance.

write_file(self, folder_path: str)

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusGridPars module to the specified path as <BcfGrd.in> or <LpfGrd.in>.

Returns:

controlParams: pycomus.ComusGridPars

COMUS Grid Attribute Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="OneDimFlowSim")
>>> modelGridPar = pycomus.ComusGridPars(model1, top=50, bot=0, ibound=1, kx=1, shead=20)
classmethod load(model, grid_params_file: str)[source]

Load parameters from a BcfGrd.in or LpfGrd.in file and create a ComusGridPars instance.

Parameters:

model: pycomus.ComusModel

COMUS Model Object.

grid_params_file: str

Grid Attribute Params File Path.

Returns:

instance: pycomus.ComusGridPars

COMUS Grid Attribute Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="OneDimFlowSim(File-Input)")
>>> modelGridPar = pycomus.ComusGridPars.load(model1, "./InputFiles/BcfGrd.in")
write_file(folder_path: str)[source]

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusGridPars module to the specified path as <BcfGrd.in> or <LpfGrd.in>.

Parameters:

folder_path – Output folder path.

pycomus.ComusDis.CmsMd module

class pycomus.ComusDis.CmsMd.ComusModel(model_name: str = 'ComusTest')[source]

Bases: object

Create a COMUS Model object.

Attributes:

model_namestr

COMUS Model Name

Methods:

__init__(self, model_name: str = “ComusTest”)

Instantiate an instance of ComusModel.

write_files(self)

Compile the input data and save it in the <Data.in> directory located at runtime.

run(self)

Run COMUS Model.

Returns:

instance: pycomus.ComusModel

COMUS Model object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
run() None[source]

Run COMUS Model.

write_files() None[source]

Compile the input data and save it in the <Data.in> directory located at runtime.

pycomus.ComusDis.CmsOutPars module

class pycomus.ComusDis.CmsOutPars.ComusOutputPars(model, gdw_bd: int = 1, lyr_bd: int = 1, cell_bd: int = 1, cell_hh: int = 1, cell_dd: int = 1, cell_flo: int = 1, lak_bd: int = 1, segm_bd: int = 1, rech_bd: int = 1, ibs: int = 1, sub: int = 1, ndb: int = 1, db: int = 1, reg_bd: int = 1)[source]

Bases: object

Set COMUS Model Output Params Attributes.

0: No output;

1: Output for each simulation time step within a period;

2: Output for each period.

Attributes:

model: pycomus.ComusModel

COMUS Model Object

gdw_bd: int

Groundwater system balance output control option.

lyr_bd: int

Layer balance output control option.

cell_bd: int

Grid cell balance output control option.

cell_hh: int

Grid cell head output control option.

cell_dd: int

Grid cell draw down output control option.

cell_flo: int

Inter-cell flow output control option.

lak_bd: int

Lake balance output control option.

segm_bd: int

Stream channel balance output control option.

rech_bd: int

Stream segment balance output control option.

ibs: int

Interbed simulation results output control option.

sub: int

Grid cell land subsidence simulation results output control option.

ndb: int

For no-delay interbed simulation results output control option.

db: int

For delayed interbed simulation results output control option.

reg_bd: int

Regional water balance output control option.

Methods:

__init__(self, model, gdw_bd: int = 1, lyr_bd: int = 1, cell_bd: int = 1, cell_hh: int = 1,

cell_dd: int = 1, cell_flo: int = 1, lak_bd: int = 1, segm_bd: int = 1, rech_bd: int = 1, ibs: int = 1, sub: int = 1, ndb: int = 1, db: int = 1, reg_bd: int = 1)

Set COMUS Model Output Params Attributes.

load(cls, model, output_params_file: str)

Load parameters from a load OutOpt.in file and create a ComusOutputPars instance.

write_file(self, folder_path: str)

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusOutputPars module to the specified path as <OutOpt.in>.

Returns:

instance: pycomus.ComusConPars

COMUS Control Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="OneDimFlowSim")
>>> outParams = pycomus.ComusOutputPars(model1, 2, 2, 2, 2, 2, 2)
classmethod load(model, output_params_file: str)[source]

Load parameters from a load OutOpt.in file and create a ComusOutputPars instance.

Parameters:

model: pycomus.ComusModel

COMUS Model Object.

output_params_file: str

Output Params file path.

Returns:

instance: pycomus.ComusConPars

COMUS Control Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="OneDimFlowSim(File-Input)")
>>> outParams = pycomus.ComusOutputPars.load(model1, "./InputFiles/OutOpt.in")
write_file(folder_path: str)[source]

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusOutputPars module to the specified path as <OutOpt.in>.

Parameters:

folder_path – Output folder path.

pycomus.ComusDis.CmsPars module

class pycomus.ComusDis.CmsPars.ComusConPars(model, dim_unit: str = 'm', time_unit: str = 'day', sim_mtd: int = 1, sim_type: int = 2, acc_lambda: float = -1, intblkm: int = 1, solve: int = 2, max_iter: int = 200, damp: float = 1, h_close: float = 0.0001, r_close: float = 0.001, relax: int = 0, theta: float = 0.7, gamma: float = 3, akappa: float = 0.001, n_iter: int = 5, hno_flo: float = -1e+30, ch_flg: int = 0, wd_flg: int = 0, wet_fct: float = 0.1, newt_iter: int = 1, hd_wet: int = 1, reg_sta: int = 0, mul_td: int = 0, num_td: int = -1)[source]

Bases: object

Set COMUS Model Control Params Attributes.

Attributes:

model:

COMUS Model Object

dim_unit: str

The unit of spatial measurement (Length)

time_unit: str

The unit of spatial measurement (Time)

sim_mtd: int

The simulation method option. 1 for the ACC method; 2 for the original MODFLOW method.

sim_type: int

The simulation type option. 1 for steady-flow simulation; 2 for transient-flow simulation.

acc_lambda: float

It is the resistance coefficient in the additional term on the right side of the grid cell differential equation.

intblkm: int

Option for the input format of layer type and grid cell data. 1 for BCF format; 2 for LPF format.

solve: int

The option for the method of solving the matrix equation (1 for SIP; 2 for PCG).

max_iter: int

The maximum number of iterations for matrix solving.

damp: float

Iterative calculation damping factor (-), usually set to 1.0 (valid range: 0.0001~1.0).

h_close: float

The accuracy threshold for water level calculation (L).

r_close: float

Valid only when solve=2 (Preconditioned Conjugate Gradient Method).

relax: int

Option to enable the deep relaxation iterative algorithm.

theta: float

It is the reduction coefficient for the dynamic relaxation factor when oscillations occur during iterative calculations (-).

gamma: float

It is the increase coefficient for the dynamic relaxation factor.

akappa: float

It is the unit increase value for the dynamic relaxation factor.

n_iter: int

It is the number of consecutive non-oscillatory iterations required to increase the dynamic relaxation factor.

hno_flo: float

The water head value for invalid computational cells (L).

ch_flg: int

Option to calculate the flow between two adjacent fixed head cells.

wd_flg: int

An option indicating whether to simulate the conversion between dry and wet cells.

wet_fct: float

A multiplier for the trial thickness of the aquifer layer when a cell is reWetted.

newt_iter: int

The number of iterations between attempts to convert a cell from dry to wet.

hd_wet: int

An option for the algorithm to calculate the trial aquifer thickness when a cell is reWetted.

reg_sta: int

An option to enable the functionality for sub-regional water balance statistics.

mul_td: int

An option to enable multi-threaded parallel computation.

num_td: int

This parameter specifies the number of threads to use for parallel computation.

Methods:

__init__(self, model, dim_unit: str = “m”, time_unit: str = “day”, sim_mtd: int = 1,

sim_type: int = 2, acc_lambda: float = -1, intblkm: int = 1, solve: int = 2, max_iter: int = 200, damp: float = 1, h_close: float = 0.0001, r_close: float = 0.001, relax: int = 0, theta: float = 0.7, gamma: float = 3, akappa: float = 0.001, n_iter: int = 5, hno_flo: float = -1E+30, ch_flg: int = 0, wd_flg: int = 0, wet_fct: float = 0.1, newt_iter: int = 1, hd_wet: int = 1, reg_sta: int = 0, mul_td: int = 0, num_td: int = -1)

Set COMUS Model Control Params Attributes.

load(cls, model, ctrl_params_file: str)

Load parameters from a CtrlPar.in file and create a ComusConPars instance.

write_file(self, folder_path: str)

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusConPars module to the specified path as <CtrlPar.in>.

Returns:

controlParams: pycomus.ComusConPars

COMUS Control Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> controlParams = pycomus.ComusConPars(model=model1, sim_type=1, max_iter=10000)
classmethod load(model, ctrl_params_file: str)[source]

Load parameters from a CtrlPar.in file and create a ComusConPars instance.

Parameters:

model: pycomus.ComusModel

COMUS Model Object.

ctrl_params_file: str

Control Params file path.

Returns:

instance: pycomus.ComusConPars

COMUS Control Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> controlParams = pycomus.ComusConPars.load(model1,"./InputFiles/CtrlPar.in")
write_file(folder_path: str)[source]

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusConPars module to the specified path as <CtrlPar.in>.

Parameters:

folder_path – Output folder path.

pycomus.ComusDis.CmsTime module

class pycomus.ComusDis.CmsTime.ComusPeriod(model, period: Tuple | List[Tuple])[source]

Bases: object

Set COMUS Model Period Attributes.

Attributes:

model: pycomus.ComusModel

COMUS Model Object.

period: Union[Tuple, List[Tuple]]
It can be a Tuple or a List[Tuple], and each Tuple should contain three elements, which are PERLEN, NSTEP

and MULTR, and each element should be greater than 0.

Methods:

__init__(self, model, period: Union[Tuple, List[Tuple]])

Set COMUS Model Period Attributes.

load(cls, model, period_file: str)

Load parameters from a PerAttr.in file and create a ComusPeriod instance.

write_file(self, folder_path: str)

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusPeriod module to the specified path as <PerAttr.in>.

Returns:

controlParams: pycomus.ComusPeriod

COMUS Period Attributes Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> period1 = pycomus.ComusPeriod(model1, [(1, 1, 1)])
classmethod load(model, period_file: str)[source]

Load parameters from a PerAttr.in file and create a ComusPeriod instance.

Parameters:

model: pycomus.ComusModel

COMUS Model Object.

period_file: str

Period Params file path.

Returns:

instance: pycomus.ComusPeriod

COMUS Period Params Object.

Example:

>>> import pycomus
>>> model1 = pycomus.ComusModel(model_name="test")
>>> modelPeriod = pycomus.ComusPeriod.load(model1,"./InputFiles/PerAttr.in")
write_file(folder_path: str)[source]

Typically used as an internal function but can also be called directly, it outputs the pycomus.ComusPeriod module to the specified path as <PerAttr.in>.

Parameters:

folder_path – Output folder path.

pycomus.ComusDis.GridCell module

class pycomus.ComusDis.GridCell.GridCell[source]

Bases: object

pycomus.ComusDis.GridLyr module

class pycomus.ComusDis.GridLyr.BcfLayers(lyr_id: int, lyr_type: int, lyr_trpy: float, lyr_ibs: int, grid_cells: List[List[GridCell]])[source]

Bases: object

class pycomus.ComusDis.GridLyr.LpfLayers(lyr_id: int, lyr_type: int, lyr_cbd: int, lyr_ibs: int, grid_cells: List[List[GridCell]])[source]

Bases: object

Module contents