-
Notifications
You must be signed in to change notification settings - Fork 3
Issue #765 gwt gwt exchanges #800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
luitjansl
merged 64 commits into
model_splitting_transport_feature
from
issue_#765_gwt_gwt_exchanges
Feb 5, 2024
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
10a8555
Merge branch 'master' into issue_#764_modelsplit_auxiliary_variables
luitjansl fdade86
work started
luitjansl fb61e4d
now works with well
luitjansl c70e696
formatting
luitjansl 2193d3c
formatting
luitjansl bf3d5f2
Merge branch 'master' into issue_#764_modelsplit_auxiliary_variables
luitjansl feef11a
formatting and fixing tests
luitjansl 385f312
expanded test
luitjansl 707aad8
formatting
luitjansl 1327e0f
ruff checks
luitjansl 70df416
review comments
luitjansl 40e4f7a
review comments
luitjansl 4bd7f4b
formatting
luitjansl fb9d94e
Merge branch 'master' into issue_#764_modelsplit_auxiliary_variables
luitjansl 0827789
review comments
luitjansl 2ebe1e5
Merge branch 'imod_#746_slice_model_transport' into issue_#765_add_gw…
luitjansl f2731dc
started adding test
luitjansl f6d3892
Merge branch 'imod_#746_slice_model_transport' into issue_#765_add_gw…
luitjansl f5f682a
started adding test
luitjansl accc041
Merge branch 'issue_#764_modelsplit_auxiliary_variables' into issue_#…
luitjansl 48fcb58
split method now doesn't crash on transport model
luitjansl 866f6a2
adding package and template for gwtgwt
luitjansl b007ada
work in progress
luitjansl 855bb05
Merge branch 'master' into issue_#765_add_gwtgwt
luitjansl 3f43218
Merge branch 'master' into issue_#765_add_gwtgwt
luitjansl 9bfa03e
work in progress
luitjansl ed98bd7
Merge branch 'imod_#746_slice_model_transport' into model_splitting_t…
luitjansl b86aea7
Merge branch 'model_splitting_transport_feature' into issue_#765_add_…
luitjansl eef6081
adding gwfgwt packages
luitjansl b024376
Merge branch 'issue_#765_add_gwtgwt' into issue_#788_gwf-gwt_exchanges
luitjansl b64b59b
fixed tests
luitjansl a4743e0
now can write the model
luitjansl 32455cc
adding tests
luitjansl bfce7a9
formatting
luitjansl 7b3ebef
cleanup
luitjansl 3bb9a2c
type hints
luitjansl 61e0091
Merge branch 'model_splitting_transport_feature' into issue_#788_gwf-…
luitjansl ff13c9f
cleanup
luitjansl bbdfb23
cleanup
luitjansl 1028866
Merge branch 'issue_#788_gwf-gwt_exchanges' into issue_#765_gwt_gwt_e…
luitjansl 6267c03
Update imod/tests/test_mf6/test_mf6_simulation.py
luitjansl 580ed42
started work
luitjansl 7b20d02
Update imod/mf6/simulation.py
luitjansl 74b1b6f
review comment
luitjansl 18f2998
review comment
luitjansl c92df59
skips gwfgwt exchanges when setting options
luitjansl a6cbd18
Merge branch 'issue_#788_gwf-gwt_exchanges' into issue_#765_gwt_gwt_e…
luitjansl 2410958
first model runs
luitjansl 8ae078c
added test for output check
luitjansl 10bcc8c
formatting
luitjansl 929a17c
Merge branch 'model_splitting_transport_feature' into issue_#765_gwt_…
luitjansl 616802e
Merge branch 'model_splitting_transport_feature' into issue_#765_gwt_…
luitjansl 41dc3bf
fix build error
luitjansl 181d7d8
function for geometric dataframe
luitjansl 74ba292
type hints
luitjansl df50f22
cleanup
luitjansl 9410c30
Update imod/mf6/gwtgwt.py
luitjansl 3481c6d
review comments
luitjansl 5139fff
Update imod/mf6/simulation.py
luitjansl 4f17342
review comments
luitjansl e3cfe8d
fix failing tests
luitjansl d3021a1
Merge branch 'model_splitting_transport_feature' into issue_#765_gwt_…
luitjansl 71d55e4
cleanup
luitjansl 2df1dc5
formatting
luitjansl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
from typing import Optional | ||
|
||
import cftime | ||
import numpy as np | ||
import xarray as xr | ||
|
||
from imod.mf6.auxiliary_variables import expand_transient_auxiliary_variables | ||
from imod.mf6.exchangebase import ExchangeBase | ||
from imod.mf6.package import Package | ||
from imod.typing import GridDataArray | ||
|
||
|
||
class GWTGWT(ExchangeBase): | ||
""" | ||
This package is for writing an exchange file, used for splitting up a model | ||
into different submodels (that can be solved in parallel). It (usually) | ||
is not instantiated by users, but created by the "split" method of the | ||
simulation class. | ||
""" | ||
|
||
_auxiliary_data = {"auxiliary_data": "variable"} | ||
_pkg_id = "gwtgwt" | ||
_template = Package._initialize_template(_pkg_id) | ||
|
||
def __init__( | ||
self, | ||
transport_model_id1: str, | ||
transport_model_id2: str, | ||
flow_model_id1: str, | ||
flow_model_id2: str, | ||
cell_id1: xr.DataArray, | ||
cell_id2: xr.DataArray, | ||
layer: xr.DataArray, | ||
cl1: xr.DataArray, | ||
cl2: xr.DataArray, | ||
hwva: xr.DataArray, | ||
angldegx: Optional[xr.DataArray] = None, | ||
cdist: Optional[xr.DataArray] = None, | ||
): | ||
dict_dataset = { | ||
"cell_id1": cell_id1, | ||
"cell_id2": cell_id2, | ||
"layer": layer, | ||
"model_name_1": transport_model_id1, | ||
"model_name_2": transport_model_id2, | ||
"flow_model_name_1": flow_model_id1, | ||
"flow_model_name_2": flow_model_id2, | ||
"ihc": xr.DataArray(np.ones_like(cl1, dtype=int)), | ||
"cl1": cl1, | ||
"cl2": cl2, | ||
"hwva": hwva, | ||
} | ||
super().__init__(dict_dataset) | ||
|
||
auxiliary_variables = [var for var in [angldegx, cdist] if var is not None] | ||
if auxiliary_variables: | ||
self.dataset["auxiliary_data"] = xr.merge(auxiliary_variables).to_array( | ||
name="auxiliary_data" | ||
) | ||
expand_transient_auxiliary_variables(self) | ||
|
||
def set_options( | ||
self, | ||
print_input: Optional[bool] = None, | ||
print_flows: Optional[bool] = None, | ||
save_flows: Optional[bool] = None, | ||
adv_scheme: Optional[str] = None, | ||
dsp_xt3d_off: Optional[bool] = None, | ||
dsp_xt3d_rhs: Optional[bool] = None, | ||
): | ||
self.dataset["print_input"] = print_input | ||
self.dataset["print_flows"] = print_flows | ||
self.dataset["save_flows"] = save_flows | ||
self.dataset["adv_scheme"] = adv_scheme | ||
self.dataset["dsp_xt3d_off"] = dsp_xt3d_off | ||
self.dataset["dsp_xt3d_rhs"] = dsp_xt3d_rhs | ||
|
||
def clip_box( | ||
self, | ||
time_min: Optional[cftime.datetime | np.datetime64 | str] = None, | ||
time_max: Optional[cftime.datetime | np.datetime64 | str] = None, | ||
layer_min: Optional[int] = None, | ||
layer_max: Optional[int] = None, | ||
x_min: Optional[float] = None, | ||
x_max: Optional[float] = None, | ||
y_min: Optional[float] = None, | ||
y_max: Optional[float] = None, | ||
top: Optional[GridDataArray] = None, | ||
bottom: Optional[GridDataArray] = None, | ||
state_for_boundary: Optional[GridDataArray] = None, | ||
) -> Package: | ||
raise NotImplementedError("this package cannot be clipped") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# this file contains the exchanges from model {{model_name_1}} to model {{model_name_2}} | ||
|
||
begin options | ||
gwfmodelname1 {{flow_model_name_1}} | ||
gwfmodelname2 {{flow_model_name_2}} | ||
{% if auxiliary is defined %} auxiliary {{auxiliary|join(" ")}} | ||
{% endif -%} | ||
{%- if print_input is defined -%} print_input | ||
{% endif -%} | ||
{%- if print_flows is defined -%} print_flows | ||
{% endif -%} | ||
{%- if save_flows is defined -%} save_flows | ||
{% endif -%} | ||
{%- if adv_scheme is defined -%} adv_scheme {{adv_scheme}} | ||
{% endif -%} | ||
{%- if dsp_xt3d_off is defined -%} dsp_xt3d_off | ||
{% endif -%} | ||
{%- if dsp_xt3d_rhs is defined -%} dsp_xt3d_rhs | ||
{% endif -%} | ||
{%- if mvt is defined -%} mvt6 filein {{mvt}} | ||
{% endif -%} | ||
{%- if obs is defined -%} obs6 filein {{obs}} | ||
{% endif -%} | ||
end options | ||
{% set nexg = layer | length %} | ||
begin dimensions | ||
nexg {{nexg}} | ||
end dimensions | ||
|
||
begin exchangedata | ||
# first 3 (structured) or 2 (unstructured) columns are the exchange boundary cell indices in the numbering local to {{model_name_1}} | ||
# second 3 (structured) or 2 (unstructured) columns are the exchange boundary cell indices in the numbering local to {{model_name_2}} | ||
# followed by columns ihc, cl1, cl2, hwva and auxiliary variables, if any | ||
{%- for i in range(nexg) %} | ||
{{layer[i]}} {{cell_id1[i]|join(" ")}} {{layer[i]}} {{cell_id2[i]|join(" ")}} {{ihc[i]}} {{cl1[i]}} {{cl2[i]}} {{hwva[i]}} {%- if auxiliary_data is defined %} {{auxiliary_data.T[i]|join(" ")}}{% endif %} | ||
{%- endfor %} | ||
end exchangedata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.