Skip to content

Commit

Permalink
Merge branch 'loroberge/add-component-concentration-tracker-for-space…
Browse files Browse the repository at this point in the history
…' of https://github.com/loroberge/landlab into loroberge/add-component-concentration-tracker-for-space
  • Loading branch information
loroberge committed Oct 23, 2024
2 parents a63ec57 + 45ca59f commit a1a9f78
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class ConcentrationTrackerForSpace(Component):
:class:`~.SpaceLargeScaleEroder` step and a stop_tracking(dt) method
immediately after every :class:`~.SpaceLargeScaleEroder` step.
See the docstring examples below.
The required inputs "phi", "fraction_fines", and "settling_velocity"
The required inputs "phi", "fraction_fines", and "settling_velocity"
must have the same value as those used for the instance of
:class:`~.SpaceLargeScaleEroder`.
Expand Down Expand Up @@ -297,13 +297,12 @@ class ConcentrationTrackerForSpace(Component):
def __init__(
self,
grid,
phi: float|None=None,
fraction_fines: float|None=None,
settling_velocity: float|None=None,
phi: float | None = None,
fraction_fines: float | None = None,
settling_velocity: float | None = None,
concentration_initial=0,
concentration_in_bedrock=0,
):

"""
Parameters
----------
Expand All @@ -320,31 +319,34 @@ def __init__(
concentration_in_bedrock: positive float, array, or field name (optional)
Concentration in bedrock, [-/L^3]
"""

if phi is None:
raise ValueError("`phi` is a required input parameter. "
"It must have the same value as the `phi` input "
"parameter used for the `SpaceLargeScaleEroder` "
"instance to which this component is coupled. "
"See the docstring in each component for details."
)
raise ValueError(
"`phi` is a required input parameter. "
"It must have the same value as the `phi` input "
"parameter used for the `SpaceLargeScaleEroder` "
"instance to which this component is coupled. "
"See the docstring in each component for details."
)
if fraction_fines is None:
raise ValueError("`fraction_fines` is a required input parameter. "
"It must have the same value as the same input "
"parameter used for the `SpaceLargeScaleEroder` "
"instance to which this component is coupled. "
"The parameter is named `F_f` in SpaceLargeScaleEroder. "
"See the docstring in each component for details."
)
raise ValueError(
"`fraction_fines` is a required input parameter. "
"It must have the same value as the same input "
"parameter used for the `SpaceLargeScaleEroder` "
"instance to which this component is coupled. "
"The parameter is named `F_f` in SpaceLargeScaleEroder. "
"See the docstring in each component for details."
)
if settling_velocity is None:
raise ValueError("`settling_velocity` is a required input parameter. "
"It must have the same value as the same input "
"parameter used for the `SpaceLargeScaleEroder` "
"instance to which this component is coupled. "
"It is named `v_s` in SpaceLargeScaleEroder. "
"See the docstring in each component for details."
)

raise ValueError(
"`settling_velocity` is a required input parameter. "
"It must have the same value as the same input "
"parameter used for the `SpaceLargeScaleEroder` "
"instance to which this component is coupled. "
"It is named `v_s` in SpaceLargeScaleEroder. "
"See the docstring in each component for details."
)

super().__init__(grid)
# Store grid and parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,30 +219,36 @@ def setup_method(self):

# Add forced flow router and flux fields to grid and apply values.
flow_us_node_order = [5, 6, 7, 8, 3, 2, 1, 0, 4, 9, 10, 11, 12, 13, 14]
flow_receiver_ids = [[0, 1, 2, 3, 4],
[5, 5, 6, 7, 8],
[10, 11, 12, 13, 14],
]
discharge = [[0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Qs_out = [[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Er = [[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Es = [[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Dsw = [[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
flow_receiver_ids = [
[0, 1, 2, 3, 4],
[5, 5, 6, 7, 8],
[10, 11, 12, 13, 14],
]
discharge = [
[0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 1.0, 1.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Qs_out = [
[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Er = [
[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Es = [
[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]
Dsw = [
[0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0],
]

self.mg.add_field("flow__receiver_node", flow_receiver_ids, at="node")
self.mg.add_field("flow__upstream_node_order", flow_us_node_order, at="node")
Expand Down

0 comments on commit a1a9f78

Please sign in to comment.