Add sy pertubation method#2
Draft
HendrikKok wants to merge 12 commits into
Draft
Conversation
- Add RichardsSnapshots helper class (include/daisy/richards_snapshots.h)
General pre/post snapshot mechanism using pointer-to-member to avoid
code duplication. Replaces individual h_pretick_/theta_pretick_/etc. fields.
- Refactor column_std.C to use RichardsSnapshots
snap_pre() called just before movement->tick(), snap_post() just after.
perturbation_tick() uses RAII guard to restore post-tick state atomically.
- Rename estimate_sy_perturbation -> perturbation_tick throughout
Return type changes from {double Sy, vec, vec} to {vec, vec, vec}.
Sy computation moves to the Python caller.
- Add DaisyAPI class (include/programs/daisy_api.h, src/programs/daisy_api.C)
Inherits DaisyBMI (pure BMI 2.0), adds non-standard extensions.
perturbation_tick() lives here, not on DaisyBMI.
- Rename DaisyPythonController -> DaisyController
Name no longer implies Python-specific; it is an internal C++ wrapper.
- Rename bmi_bindings.cpp -> api_bindings.cpp
Binds both DaisyBMI and DaisyAPI. DaisyAPI is the recommended class
for Python coupling.
- Update CMakeLists.txt, __init__.py to reflect new files and DaisyAPI export
# Conflicts: # python/src/daisy/__init__.py
# Conflicts: # include/programs/bmi.h # src/programs/api_bindings.cpp # src/programs/daisy_bmi.C
# Conflicts: # include/daisy/column.h # include/daisy/daisy.h # src/daisy/column_std.C # src/daisy/daisy.C
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add Daisy-specific API layer with perturbation_tick support
Builds on top of
add_bmito expose aDaisyAPIclass that inheritsthe standard BMI interface and adds Daisy-specific coupling methods not
covered by BMI 2.0.
What's in this branch
DaisyAPIclass (include/programs/daisy_api.h,src/programs/daisy_api.C)BMI— all standard BMI methods are availableperturbation_tick(dh_cm): re-runs Richards with a raised groundwatertable and returns the perturbed
(theta, flux, h)arrays, then restoresDaisy to the real post-tick state via a RAII guard. Used by the caller to
estimate specific yield (Sy) externally.
RichardsSnapshots(include/daisy/richards_snapshots.h)h,Theta,S_sum, groundwater table)movement->tick(); restore in either directionGroundwaterApi(src/daisy/lower_boundary/groundwater_api.C)Groundwatersubtype whose table depth is written each coupling step from PythonPython bindings (
src/programs/api_bindings.cpp)BMIregistered as"BMI"(was"DaisyBMI")DaisyAPIregistered as"API"get_value_arrayexposed for array variables__init__.pyBMIandAPIfrom the.pydExample (
python/examples/daisy_api_example.py, renamed fromdaisy_bmi_example.py)APIusage