Compare commits

..
176 Commits
Author SHA1 Message Date
Theophile Terraz 9b6abadb5a debug release 2025-01-23 16:57:03 +01:00
Theophile Terraz 686b01c43a Merge branch 'master' of gitlab.com:pamhyr/pamhyr2 2025-01-23 15:17:52 +01:00
Theophile Terraz 04afbf2f84 debug CI 2025-01-23 15:16:22 +01:00
Dorian Hernandez 75f2796748 Ajout du TP AdisTS dans la release 2025-01-23 14:29:07 +01:00
Dorian Hernandez 45179bc542 Ajout du TP AdisTS 2025-01-23 14:11:11 +01:00
Theophile Terraz 67729e94bf add Tuto 2 (thanks to Celine Berni) 2025-01-23 10:03:00 +01:00
Theophile Terraz c53e82a423 debug remove sediment 2025-01-22 16:01:59 +01:00
Theophile Terraz 02ccfa9ed7 disable custom plot adists 2025-01-22 11:59:39 +01:00
Theophile Terraz fc5de2a097 pep8 2025-01-22 11:46:08 +01:00
Theophile Terraz 0753c4e1b7 debug profile geometry window 2025-01-22 11:15:07 +01:00
Theophile Terraz d8c2634a66 debug 2025-01-22 09:13:13 +01:00
Theophile Terraz 6f7a891a6d optimization + debug 2025-01-20 16:24:17 +01:00
Theophile Terraz e4224e6358 force Mage sulver type in open from file 2025-01-17 13:54:27 +01:00
Theophile Terraz aa8a9dccbf translation 2025-01-17 12:00:42 +01:00
Theophile Terraz 1732e30e58 debug 2025-01-17 09:31:37 +01:00
Theophile Terraz 9eedd1fff9 debug results 2025-01-17 09:20:01 +01:00
Theophile Terraz ac6e8a3704 debug Adis-TS files generation 2025-01-16 15:54:50 +01:00
Theophile Terraz c5f918c885 pep8 2025-01-16 15:08:24 +01:00
Theophile Terraz 230712c3ea debug Adis-TS 2025-01-16 15:03:52 +01:00
Theophile Terraz 2e2f054a4f debug Adis-TS 2025-01-16 14:16:24 +01:00
Theophile Terraz f75a25d010 debug 2025-01-15 14:26:31 +01:00
Theophile Terraz 9db90debeb translation 2024-12-20 17:13:44 +01:00
Theophile Terraz 2333ab540e debug 2024-12-20 15:54:25 +01:00
Theophile Terraz c81d65f527 rm test case 2024-12-20 15:49:30 +01:00
Theophile Terraz bf44f5c027 rm test case 2024-12-20 15:47:48 +01:00
Theophile Terraz d1400f12a6 debug 2024-12-20 15:41:19 +01:00
Theophile Terraz c610717220 pep8 2024-12-20 10:47:08 +01:00
Theophile Terraz 5edcf15072 Export Adis to csv 2024-12-20 10:05:56 +01:00
Theophile Terraz e4bffce6f4 debug node name in adis BC 2024-12-19 11:24:30 +01:00
Theophile Terraz 54fe032791 pep8 + colors + debug 2024-12-18 16:19:41 +01:00
Theophile Terraz c668dddcfd more work on adis results 2024-12-18 15:17:13 +01:00
Theophile Terraz bdc975f280 work on plot multiple lines 2024-12-17 16:22:07 +01:00
Theophile Terraz 4315fb94f3 debug last solver 2024-12-16 15:34:19 +01:00
Theophile Terraz eb1163f712 debug ci 2024-12-11 11:26:46 +01:00
Theophile Terraz 42f3c02c3e work on release 2024-12-09 17:17:28 +01:00
Theophile Terraz 31ebcf07e0 debug 2024-12-09 14:06:01 +01:00
Theophile Terraz 95612e8ce9 debug 2024-12-09 14:04:48 +01:00
Theophile Terraz e56d88937a pep8 2024-12-09 09:28:00 +01:00
Theophile Terraz 8c697a9621 debug incomplete database 2024-12-09 09:03:02 +01:00
Theophile Terraz 2d3747b3d3 add adists default path 2024-12-05 17:26:47 +01:00
Theophile Terraz b38e252746 cleaning 2024-12-05 16:50:10 +01:00
Theophile Terraz f1d6eb8990 more work on adists results 2024-12-05 16:03:40 +01:00
Theophile Terraz c2c77304d7 remove suspension BC in main window 2024-12-05 14:30:22 +01:00
Theophile Terraz 0b051ad3c6 debug adis BC 2024-12-05 13:38:22 +01:00
Theophile Terraz b72ffe03c3 more work on adis results 2024-12-04 16:09:33 +01:00
Theophile Terraz 01de0cfe93 remove empty tab 2024-12-04 12:01:46 +01:00
Theophile Terraz d6f152958f work on results adis 2024-12-04 11:59:02 +01:00
Theophile Terraz b85962bfcd work on results, type_pol 2024-12-03 14:59:38 +01:00
Theophile Terraz a1ae3f42f4 work on adis results 2024-12-02 15:07:50 +01:00
Theophile Terraz 21876586df debug read_bin 2024-12-02 13:48:57 +01:00
Theophile Terraz a317cd849f more pep8 2024-11-29 11:52:06 +01:00
Theophile Terraz 3b8a49d429 add src/View/ui/OutputRKAdisTS.ui 2024-11-29 09:31:03 +01:00
Theophile Terraz 872235e94f pep8 Model 2024-11-29 09:30:37 +01:00
Theophile Terraz da7ef60bef pep8 src/Solver/AdisTS.py 2024-11-28 14:32:45 +01:00
Theophile Terraz 824669f70f debug 2024-11-28 11:46:20 +01:00
Youcef AOUAD 19a3f3d310 mass zero results fixed 2024-11-28 08:31:40 +01:00
Youcef AOUAD 49aab685fb to fix mass zero 2024-11-27 14:50:44 +01:00
Youcef AOUAD 4383599d30 node name fixed 2024-11-12 09:01:25 +01:00
Youcef AOUAD ae6bca3033 display results from main complete 2024-11-08 09:36:03 +01:00
Theophile Terraz 1266884f93 Merge branch 'terraz_dev' into adists_release 2024-11-07 16:29:19 +01:00
Theophile Terraz f91527464d Merge branch 'master' into terraz_dev 2024-11-07 16:28:24 +01:00
Theophile Terraz 58f72cfa6b add solver dirs in .gitignore 2024-11-07 16:28:07 +01:00
Youcef AOUAD 97f8a3ccde correction of results 2024-11-07 14:20:58 +01:00
Theophile Terraz 69134303d2 work on bed evolution visu 2024-11-06 17:52:11 +01:00
Theophile Terraz cef67540c2 debug 2024-11-06 13:40:16 +01:00
Theophile Terraz ff38571933 merge 2024-11-05 13:29:12 +01:00
Theophile Terraz 5d0109769d pep8 2024-11-05 11:25:10 +01:00
Theophile Terraz 6852b08cfc debug CI 2024-11-05 11:16:17 +01:00
Theophile Terraz 2896c604a5 export envelops to .csv 2024-11-04 17:44:30 +01:00
Theophile Terraz b21b6be9ca envelop optional 2024-11-04 16:32:44 +01:00
Theophile Terraz 5f043468ee add envelop in custom plots + optim + clean 2024-11-04 16:03:18 +01:00
Theophile Terraz e25a3ae98c debug 2024-11-04 10:44:09 +01:00
Theophile Terraz 4f69553bd3 merge 2024-10-31 14:02:38 +01:00
Theophile Terraz 38560cdcf5 translation 2024-10-30 17:42:28 +01:00
Theophile Terraz 7cd4d070ac switch axes in reservoirs 2024-10-30 17:33:30 +01:00
Theophile Terraz e6b36f3fe5 pep8 2024-10-30 17:29:01 +01:00
Theophile Terraz 36597d9b3d debug IC 2024-10-30 17:24:20 +01:00
Theophile Terraz c4e965a631 cleaning 2024-10-30 17:12:20 +01:00
Theophile Terraz 15da23183b debug VAR 2024-10-30 15:38:43 +01:00
Theophile Terraz 77baba0893 add XY geom view in main window 2024-10-30 12:00:45 +01:00
Theophile Terraz 55da743977 Merge branch 'master' into terraz_dev 2024-10-30 10:31:23 +01:00
Theophile Terraz a19ab7aa79 debug rubar 2024-10-30 10:31:11 +01:00
Theophile Terraz 29d4c7c146 Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr 2024-10-30 09:22:28 +01:00
Youcef AOUAD e711f0fb6f results from main solver type 2024-10-24 10:40:13 +02:00
Youcef AOUAD 36fd8cdc8a display adists results from main 2024-10-22 11:35:29 +02:00
Theophile Terraz 4a24e39224 Merge branch 'adists_release' into terraz_dev 2024-10-21 14:27:14 +02:00
Youcef AOUAD 97c161fc3f correct names nodes reaches 2024-10-21 14:21:25 +02:00
Theophile Terraz 00c43d91cd Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-21 14:18:50 +02:00
Youcef AOUAD 100cfd095e db version fixed for adists files 2024-10-17 10:36:25 +02:00
Youcef AOUAD 5047dbc85e tables load fixed 2024-10-16 11:15:27 +02:00
Pierre-Antoine Rouby 69f40748e5 doc: dev: Update wine runner environement creation and minor change. 2024-10-15 10:25:19 +02:00
Theophile Terraz c7eb10884a remove solver 2024-10-14 14:46:20 +02:00
Theophile Terraz 0ec1a39328 adistslc => adistswc 2024-10-14 14:44:26 +02:00
Theophile Terraz 92c9b106e3 add time slider (results) 2024-10-11 08:57:40 +02:00
Theophile Terraz 37a9122aa8 debug td 2024-10-08 17:40:30 +02:00
Theophile Terraz 91e780432d Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-08 10:59:13 +02:00
Theophile Terraz 81f15208cf debug 2024-10-07 16:55:24 +02:00
Theophile Terraz c9c5bfe093 Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-07 15:35:53 +02:00
Theophile Terraz 0483a2463b Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-07 15:30:06 +02:00
Theophile Terraz 9364b99158 Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-07 14:27:42 +02:00
Theophile Terraz fa2cc303cd Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-07 14:25:58 +02:00
Theophile Terraz 2b85f221bb Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-04 10:16:12 +02:00
Theophile Terraz 55d96a3767 Merge branch 'test_merge_master' into terraz_dev 2024-10-02 10:58:55 +02:00
Theophile Terraz 6000a91e74 Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr into terraz_dev 2024-10-02 10:57:25 +02:00
Theophile Terraz bd6e200a70 merge 2024-10-02 10:57:17 +02:00
Theophile Terraz 143f468c26 kp to rk 2024-09-25 12:03:48 +02:00
Theophile Terraz 334633f0fb replace kp with rk 2024-09-24 16:28:23 +02:00
Theophile Terraz a52e6b86f4 merge master 2024-09-24 16:04:22 +02:00
Youcef AOUAD 9ae16ca6ec delete page from ui resultsadists 2024-09-17 11:04:39 +02:00
Youcef AOUAD c7406d3bce raw data done for one timestamp 2024-09-17 10:23:41 +02:00
Youcef AOUAD cb8ecc752b raw data for adists 2024-09-16 16:33:02 +02:00
Youcef AOUAD 4c522ae050 plot tabs tot sediments done with limit effect 2024-09-13 18:21:38 +02:00
Youcef AOUAD 689d5a7592 plot tot sediments done 2024-09-13 09:40:57 +02:00
Youcef AOUAD c118d4fae8 tot sed plots 2024-09-12 15:27:52 +02:00
Youcef AOUAD 1baf2e8dd5 plot c m done 2024-09-12 11:05:19 +02:00
Youcef AOUAD 1fcdaa8b81 pollutant selection done 2024-09-11 15:14:39 +02:00
Youcef AOUAD 71729578dd reload plot H 2024-09-11 10:29:56 +02:00
Youcef AOUAD abe7bf969a delete sliders 2024-09-10 11:44:31 +02:00
Youcef AOUAD 673ae3908c var phys 2024-09-09 11:44:17 +02:00
Youcef AOUAD 1a31c9122e first plot complete 2024-09-05 12:35:16 +02:00
Youcef AOUAD c53d7d9c25 bug results fixed for data 2024-09-03 14:03:42 +02:00
Youcef AOUAD 02f14ffdf1 debug results profiles read from bin 2024-09-03 11:43:13 +02:00
Youcef AOUAD 84fd841f86 results adists pollutants table view 2024-09-02 15:12:07 +02:00
Youcef AOUAD 629b856788 data view complete pols 2024-09-02 11:42:51 +02:00
Youcef AOUAD f3007e2fe2 adists results data phys variables complete 2024-08-30 12:08:43 +02:00
Youcef AOUAD a7a1a4ddd1 adists results read bin data 2024-08-29 17:26:53 +02:00
Youcef AOUAD 0719db17ed results adists tables 2024-08-26 16:02:25 +02:00
Youcef AOUAD 018192714c windiow results adists mage 2024-08-23 14:59:28 +02:00
Theophile Terraz e1f69e41b0 pep8 2024-08-21 15:48:11 +02:00
Youcef AOUAD 501000fa6b display message run adists 2024-07-24 14:25:29 +02:00
Youcef AOUAD 75149000db rep mage select fixed 2024-07-22 15:22:55 +02:00
Youcef AOUAD 3c82148f44 select adists fixed 2024-07-17 14:24:26 +02:00
Youcef AOUAD 7f2ff9d341 time display ald fixed 2024-07-15 10:06:03 +02:00
Youcef AOUAD 57be80bcd4 cancel merge with master and update 2024-07-12 11:26:28 +02:00
Youcef AOUAD 29b5c97345 Solver adists done 2024-06-28 11:40:57 +02:00
Youcef AOUAD b171eb7d32 Solver connect 2024-06-27 15:46:27 +02:00
Youcef AOUAD 0e18d43496 Export Files 2 2024-06-26 17:04:14 +02:00
Youcef AOUAD bd4222adfa Export files 1 2024-06-26 12:55:07 +02:00
Youcef AOUAD 1e4761609d DIF Complete 2024-06-24 15:55:42 +02:00
Youcef AOUAD de72e2e96b DIF Model 2024-06-24 11:23:09 +02:00
Youcef AOUAD 95a0dabe68 d90 Complete 2024-06-21 15:46:41 +02:00
Youcef AOUAD 9f53ad685e d90 Model 2024-06-21 11:39:04 +02:00
Youcef AOUAD 02c597d109 LCS Complete 2024-06-20 11:59:57 +02:00
Youcef AOUAD 510bee115b LCS -data 2024-06-20 11:12:14 +02:00
Youcef AOUAD ed250f836d LC View Tab 2024-06-19 16:01:58 +02:00
Youcef AOUAD a47410a0f1 LC Model 2024-06-19 11:10:09 +02:00
Youcef AOUAD 704130966e BC AdisTS Complete 2024-06-18 15:40:06 +02:00
Youcef AOUAD b927aa81b3 BC AdisTS View Table 2024-06-17 16:34:41 +02:00
Youcef AOUAD d154ac96c2 BC AdisTS View1 2024-06-17 12:02:07 +02:00
Youcef AOUAD 6067ba601e BC Model 2024-06-14 14:52:29 +02:00
Youcef AOUAD 716d0af96f INI GOOD 2024-06-13 14:35:40 +02:00
Youcef AOUAD f917dd9284 INISPEC DEL 2024-06-12 16:56:05 +02:00
Youcef AOUAD cd68bebf03 INI SPEC Table 2024-06-12 15:06:28 +02:00
Youcef AOUAD 35cc348f03 INI SPEC 2024-06-11 16:22:07 +02:00
Youcef AOUAD 6f3e1e31f0 INI table db 2024-06-11 11:43:04 +02:00
Youcef AOUAD 7df0750c58 INI Default 2024-06-10 16:26:56 +02:00
Youcef AOUAD bcf825a4f7 ini view 2024-06-07 16:34:28 +02:00
Youcef AOUAD 3afd9f5025 IC model 2024-06-06 15:26:55 +02:00
Youcef AOUAD 3cb47ee5c8 ic 2024-06-06 12:00:52 +02:00
Youcef AOUAD 1535247e1b pollutants edit db 2024-06-05 11:35:41 +02:00
Youcef AOUAD 37dd4ebaef characteristics pollutant 2024-06-04 16:29:03 +02:00
Youcef AOUAD 1e8949067b pollutant characteristics 2024-06-03 16:23:39 +02:00
Youcef AOUAD 1945e94190 pollutants names 2024-06-03 12:01:41 +02:00
Youcef AOUAD 1ba971af24 adists run 2024-05-31 15:12:40 +02:00
Youcef AOUAD 0b5357d12a adisTS NUM file 1 2024-05-30 16:03:44 +02:00
Youcef AOUAD 3be361b03c adistTS NUM file 2024-05-30 16:01:13 +02:00
Youcef AOUAD 7681b5d326 adists export 2024-05-29 16:19:46 +02:00
Youcef AOUAD 0a35d387f7 adists check list 2024-05-28 16:39:11 +02:00
Youcef AOUAD b40efc2426 output kp 2024-05-27 16:48:03 +02:00
Youcef AOUAD 59aae7fd40 work 6 2024-05-24 16:07:33 +02:00
Youcef AOUAD a633e4bccf work 5 2024-05-24 15:59:25 +02:00
Youcef AOUAD b56b8099ab work 5 2024-05-23 16:48:31 +02:00
Youcef AOUAD f9fe5c9b6c work 4 2024-05-23 16:38:32 +02:00
Youcef AOUAD 13b954d580 work 3 2024-05-22 16:13:18 +02:00
Youcef AOUAD f53289ef1b output table 2024-05-21 16:29:41 +02:00
Youcef AOUAD 1b3ce91582 adding adists solver 1 2024-05-17 16:43:38 +02:00
220 changed files with 78089 additions and 658 deletions

No files matched your search

+5
View File
@@ -9,6 +9,8 @@
*.class *.class
tmp tmp
mage8
adists
*.tar *.tar
*.tar.* *.tar.*
@@ -39,6 +41,9 @@ __old__
*-venv *-venv
mage8
adists
### END CUSTOM ### ### END CUSTOM ###
# Created by https://www.toptal.com/developers/gitignore/api/python # Created by https://www.toptal.com/developers/gitignore/api/python
+75 -11
View File
@@ -83,6 +83,34 @@ dl-mage8-windows:
- mage8-windows/mailleurTT.exe - mage8-windows/mailleurTT.exe
- mage8-windows/libbief.dll - mage8-windows/libbief.dll
dl-adists-linux:
stage: downloads
tags:
- linux
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- mkdir -p adists-linux
- cd adists-linux
- curl -L -o adists https://gitlab.irstea.fr/jean-baptiste.faure/adists/-/releases/v1.0.1/downloads/executables/adists
artifacts:
paths:
- adists-linux/adists
dl-adists-windows:
stage: downloads
tags:
- linux
rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
script:
- mkdir -p adists-windows
- cd adists-windows
- curl -L -o adists.exe https://gitlab.irstea.fr/jean-baptiste.faure/adists/-/releases/v1.0.1/downloads/executables/adists_win64.exe
artifacts:
paths:
- adists-windows/adists.exe
############# #############
# CONFIGURE # # CONFIGURE #
############# #############
@@ -177,13 +205,32 @@ build-td:
- job: set-version - job: set-version
artifacts: true artifacts: true
script: script:
- cd ./doc/users/Tuto1/ - cd ./doc/users/TP_Hydraulique_Hogneau/
- ./build.sh - ./build.sh
artifacts: artifacts:
paths: paths:
- doc/users/Tuto1/step-by-step.pdf - doc/users/TP_Hydraulique_Hogneau/step-by-step.pdf
- doc/users/Tuto1/pas-a-pas.pdf - doc/users/TP_Hydraulique_Hogneau/pas-a-pas.pdf
- doc/users/Tuto1/data/ - doc/users/TP_Hydraulique_Hogneau/Tuto-2-fr.pdf
- doc/users/TP_Hydraulique_Hogneau/data/
allow_failure: true
build-td-2:
stage: build
tags:
- linux
needs:
- job: set-version
artifacts: true
script:
- cd ./doc/users/TP_AdisTS_Vieux_Rhone/
- ./build.sh
artifacts:
paths:
- doc/users/TP_AdisTS_Vieux_Rhone/pas-a-pas.pdf
- doc/users/TP_AdisTS_Vieux_Rhone/data/
- doc/users/TP_AdisTS_Vieux_Rhone/Sujet.pdf
- doc/users/TP_AdisTS_Vieux_Rhone/Vieux_Rhone_TP_AdisTS.pamhyr
allow_failure: true allow_failure: true
build-developers-doc: build-developers-doc:
@@ -224,6 +271,8 @@ build-linux:
rules: rules:
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
needs: needs:
- job: dl-adists-linux
artifacts: true
- job: dl-mage8-linux - job: dl-mage8-linux
artifacts: true artifacts: true
- job: dl-mage8-doc - job: dl-mage8-doc
@@ -238,6 +287,8 @@ build-linux:
# artifacts: true # artifacts: true
- job: build-td - job: build-td
artifacts: true artifacts: true
- job: build-td-2
artifacts: true
script: script:
- mkdir -p linux - mkdir -p linux
- cd linux - cd linux
@@ -260,6 +311,9 @@ build-linux:
# Copy mage # Copy mage
- mkdir -p pamhyr/mage8 - mkdir -p pamhyr/mage8
- cp -v ../mage8-linux/* pamhyr/mage8/ - cp -v ../mage8-linux/* pamhyr/mage8/
# Copy adists
- mkdir -p pamhyr/adists
- cp -v ../adists-linux/* pamhyr/adists/
# Copy Pamhyr # Copy Pamhyr
- cp -r dist/pamhyr/* pamhyr/ - cp -r dist/pamhyr/* pamhyr/
# Pamhyr script to force x11 # Pamhyr script to force x11
@@ -294,13 +348,19 @@ build-linux:
- cp -r ../doc/dev/images/* pamhyr/doc/images - cp -r ../doc/dev/images/* pamhyr/doc/images
- cp -r ../doc/images/* pamhyr/doc/images - cp -r ../doc/images/* pamhyr/doc/images
# Copy Tuto # Copy Tuto
- mkdir -p pamhyr/doc/Tuto1/ - mkdir -p pamhyr/doc/TP_Hydraulique_Hogneau/
- mkdir -p pamhyr/doc/Tuto1/data - mkdir -p pamhyr/doc/TP_Hydraulique_Hogneau/data
- cp ../doc/users/Tuto1/Hogneau_Engees2022.pdf pamhyr/doc/Tuto1/Hogneau_Engees2022.pdf - cp ../doc/users/TP_Hydraulique_Hogneau/Hogneau_Engees2022.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Hogneau_Engees2022.pdf
- cp ../doc/users/Tuto1/step-by-step.pdf pamhyr/doc/Tuto1/Tuto1-en.pdf - cp ../doc/users/TP_Hydraulique_Hogneau/step-by-step.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Tuto1-en.pdf
- cp ../doc/users/Tuto1/pas-a-pas.pdf pamhyr/doc/Tuto1/Tuto1-fr.pdf - cp ../doc/users/TP_Hydraulique_Hogneau/pas-a-pas.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Tuto1-fr.pdf
- cp ../doc/users/Tuto1/*.pamhyr pamhyr/doc/Tuto1/ - cp ../doc/users/TP_Hydraulique_Hogneau/Tuto-2-fr.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Tuto2-fr.pdf
- cp ../doc/users/Tuto1/data/* pamhyr/doc/Tuto1/data/ - cp ../doc/users/TP_Hydraulique_Hogneau/*.pamhyr pamhyr/doc/TP_Hydraulique_Hogneau/
- cp ../doc/users/TP_Hydraulique_Hogneau/data/* pamhyr/doc/TP_Hydraulique_Hogneau/data/
- mkdir -p pamhyr/doc/TP_AdisTS_Vieux_Rhone/
- mkdir -p pamhyr/doc/TP_AdisTS_Vieux_Rhone/data
- cp ../doc/users/TP_AdisTS_Vieux_Rhone/*.pdf pamhyr/doc/TP_AdisTS_Vieux_Rhone/
- cp ../doc/users/TP_AdisTS_Vieux_Rhone/data/* pamhyr/doc/TP_AdisTS_Vieux_Rhone/data/
- cp ../doc/users/TP_AdisTS_Vieux_Rhone/Vieux_Rhone_TP_AdisTS.pamhyr pamhyr/doc/TP_AdisTS_Vieux_Rhone/Vieux_Rhone_TP_AdisTS.pamhyr
# Copy TP charriage # Copy TP charriage
- mkdir -p pamhyr/doc/TP_charriage/ - mkdir -p pamhyr/doc/TP_charriage/
- cp ../doc/users/TP_charriage/* pamhyr/doc/TP_charriage - cp ../doc/users/TP_charriage/* pamhyr/doc/TP_charriage
@@ -317,6 +377,8 @@ build-windows:
needs: needs:
- job: dl-mage8-windows - job: dl-mage8-windows
artifacts: true artifacts: true
- job: dl-adists-windows
artifacts: true
- job: dl-mage8-doc - job: dl-mage8-doc
artifacts: true artifacts: true
- job: set-version - job: set-version
@@ -329,6 +391,8 @@ build-windows:
# artifacts: true # artifacts: true
- job: build-td - job: build-td
artifacts: true artifacts: true
- job: build-td-2
artifacts: true
script: script:
- mkdir windows - mkdir windows
- cd windows - cd windows
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+6
View File
@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.10 (pamhyr)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (pamhyr)" project-jdk-type="Python SDK" />
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pamhyr.iml" filepath="$PROJECT_DIR$/.idea/pamhyr.iml" />
</modules>
</component>
</project>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.10 (pamhyr)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
</module>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+126 -77
View File
@@ -28,20 +28,6 @@
#+OPTIONS: toc:t #+OPTIONS: toc:t
#+LANGUAGE: UKenglish #+LANGUAGE: UKenglish
#+NAME: attr_wrap
#+HEADER: :var width="\\textwidth"
#+HEADER: :var caption=""
#+HEADER: :var smallcaption=""
#+HEADER: :var name=""
#+HEADER: :var data=""
#+HEADER: :var float="nil"
#+BEGIN_SRC sh :results output :exports none
echo "#+CAPTION[$smallcaption]: $caption"
echo "#+NAME: $name"
echo "#+ATTR_LATEX: :width $width :float $float"
echo "$data"
#+END_SRC
#+BEGIN_abstract #+BEGIN_abstract
This document is for the use of developers. It describes the project This document is for the use of developers. It describes the project
architecture, the tools available to assist development and architecture, the tools available to assist development and
@@ -54,13 +40,13 @@ documentation, translations or code.
* Introduction * Introduction
Pamhyr2 is free and open source software (FOSS) graphical user {{{pamhyr2}}} is free and open source software (FOSS) graphical user
interface (GUI) for 1D hydro-sedimentary modelling of rivers developed interface (GUI) for 1D hydro-sedimentary modelling of rivers developed
in Python (with version 3.8). It use PyQt at version 5 and matplotlib in Python (with version 3.8). It use PyQt at version 5 and matplotlib
in version 3.4.1 or later for the user insterface (see in version 3.4.1 or later for the user insterface (see
{{{file(/requirements.txt)}}} for details). The architecture of {{{file(/requirements.txt)}}} for details). The architecture of
project code follow the Qt Model/View architecture [fn:qt-arch] (see project code follow the Qt Model/View architecture [fn:qt-arch] (see
details in section [[Architecture]]). Pamhyr2 packages can be build details in section [[Architecture]]). {{{pamhyr2}}} packages can be build
manually (see section [[Building packages]]), but there are automatically manually (see section [[Building packages]]), but there are automatically
build with the gitlab-ci (see the section [[Setup the CI build with the gitlab-ci (see the section [[Setup the CI
environment]]). Documentation files are written with org-mode[fn:org], environment]]). Documentation files are written with org-mode[fn:org],
@@ -75,7 +61,7 @@ https://doc.qt.io/qt-5/model-view-programming.html (last access
* Architecture * Architecture
Pamhyr2's architecture is based on Qt Model/View, see Figure {{{pamhyr2}}}'s architecture is based on Qt Model/View, see Figure
[[graph-architecture]]. It is made up of several different components: the [[graph-architecture]]. It is made up of several different components: the
model (in blue), the graphical components (in red), the model (in blue), the graphical components (in red), the
actions/delegates (in green), the commands (in purple), the solvers actions/delegates (in green), the commands (in purple), the solvers
@@ -178,7 +164,7 @@ https://doc.qt.io/qt-5/model-view-programming.html
** Model ** Model
The model is a set of Python classes. In Pamhyr2, this classes must The model is a set of Python classes. In {{{pamhyr2}}}, this classes must
respect some constraint. Each model class must inherits respect some constraint. Each model class must inherits
=Model.Tools.SQLSubModel= abstract class, except the =Model.Study= =Model.Tools.SQLSubModel= abstract class, except the =Model.Study=
class who inherits =Model.Tools.SQLModel= (see [[SQL]]). class who inherits =Model.Tools.SQLModel= (see [[SQL]]).
@@ -456,12 +442,12 @@ of Bar (Listing [[sql-bar]] and [[sql-foo]]).
bar._sql_save(execute, data=data) bar._sql_save(execute, data=data)
#+end_src #+end_src
Let see the results database scheme for Pamhyr2 at version v0.0.7 in Let see the results database scheme for {{{pamhyr2}}} at version v0.0.7 in
Figure [[sql_schema]]. Figure [[sql_schema]].
#+NAME: sql_schema #+NAME: sql_schema
#+ATTR_LATEX: :width 16cm #+ATTR_LATEX: :width 16cm
#+CAPTION: SQLite database scheme at Pamhyr2 version v0.0.7 (generate with [[https://gitlab.com/Screwtapello/sqlite-schema-diagram]]) #+CAPTION: SQLite database scheme at {{{pamhyr2}}} version v0.0.7 (generate with [[https://gitlab.com/Screwtapello/sqlite-schema-diagram]])
[[./images/schema_v0.0.7.png]] [[./images/schema_v0.0.7.png]]
@@ -486,7 +472,7 @@ PamhyrModelList but use a dictionary instead of list.
** View ** View
Pamhyr2 use Qt as graphical user interface library with the {{{pamhyr2}}} use Qt as graphical user interface library with the
application "Qt designer" for windows or widget creation (see [[UI file]]) application "Qt designer" for windows or widget creation (see [[UI file]])
and "Qt linguist" for interface translate (see [[Translate]]). In and "Qt linguist" for interface translate (see [[Translate]]). In
addition, we use matplotlib as ploting library (see [[Plot]]). addition, we use matplotlib as ploting library (see [[Plot]]).
@@ -501,11 +487,11 @@ componant translate, and possible other files or sub-directories.
*** UI file *** UI file
We define as possible all Pamhyr2 windows and custom widgets with "Qt We define as possible all {{{pamhyr2}}} windows and custom widgets
designer". This application generate UI file who describes interface with "Qt designer". This application generate UI file who describes
organisation with table, layout, button, etc. This method is faster interface organisation with table, layout, button, etc. This method is
than hand made windows and widget creation, and saves us some purely faster than hand made windows and widget creation, and saves us some
descriptive code. The UI files are saved into =src/View/ui= for purely descriptive code. The UI files are saved into =src/View/ui= for
window, and =/src/View/ui/Widgets= for custom widget. window, and =/src/View/ui/Widgets= for custom widget.
*** Translate *** Translate
@@ -533,10 +519,11 @@ window, and =/src/View/ui/Widgets= for custom widget.
*** Window *** Window
The abstract class PamhyrWindow and PamhyrDialog are used for most of The abstract class =PamhyrWindow= and =PamhyrDialog= are used for most
Pamhyr2 window. These class allow to create an window for Pamhyr2 GUI of {{{pamhyr2}}} window. These class allow to create an window for
and implemente some useful methods. The super class method difine some {{{pamhyr2}}} GUI and implemente some useful methods. The super class
generic value from optional parameters, for examples: method difine some generic value from optional parameters, for
examples:
- =self._study=: The study giving in constructor parameters =study= - =self._study=: The study giving in constructor parameters =study=
(typically a =Model.Study= class object) (typically a =Model.Study= class object)
- =self._config=: The configuration giving in constructor parameters - =self._config=: The configuration giving in constructor parameters
@@ -546,7 +533,7 @@ generic value from optional parameters, for examples:
object) object)
#+NAME: window #+NAME: window
#+CAPTION: Example of Pamhyr2 window #+CAPTION: Example of {{{pamhyr2}}} window
#+begin_src python :python python3 :results output :noweb yes #+begin_src python :python python3 :results output :noweb yes
from View.Tools.PamhyrWindow import PamhyrWindow from View.Tools.PamhyrWindow import PamhyrWindow
from View.My.Translate import MyTranslate from View.My.Translate import MyTranslate
@@ -593,7 +580,7 @@ window componants or connections.
*** Table *** Table
An abstract class PamhyrTableModel is available to define a simple An abstract class =PamhyrTableModel= is available to define a simple
QAbstractTableModel shortly. In simple cases, there are only =data= QAbstractTableModel shortly. In simple cases, there are only =data=
and =setData= methode to implement, but the constructor needs more and =setData= methode to implement, but the constructor needs more
information than a classic QAbstractTableModel class. information than a classic QAbstractTableModel class.
@@ -654,7 +641,7 @@ class AddNodeCommand(QUndoCommand):
All undo command must be push into a =QUndoStack= (see Listing All undo command must be push into a =QUndoStack= (see Listing
[[undo-cmd-push]]) to perform the action and allow user undo and redo this [[undo-cmd-push]]) to perform the action and allow user undo and redo this
action. In PamhyrWindow (and PamhyrDialog) the undo stack is action. In =PamhyrWindow= (and =PamhyrDialog=) the undo stack is
automatically create if the option ="undo"= is activate at window automatically create if the option ="undo"= is activate at window
creation, this stack is accessible at =self._undo_stack=. creation, this stack is accessible at =self._undo_stack=.
@@ -672,7 +659,7 @@ creation, this stack is accessible at =self._undo_stack=.
*** Plot *** Plot
To define a new plot you can create a class who inherit to To define a new plot you can create a class who inherit to
PamhyrPlot. The creator need at leaste five argument: =PamhyrPlot=. The creator need at leaste five argument:
- A =canvas= of type =MplCanvas= - A =canvas= of type =MplCanvas=
- A (optional) =trad= of type =PamhyrTranslate= - A (optional) =trad= of type =PamhyrTranslate=
- A =data= used in =draw= and =update= to create and update the plot - A =data= used in =draw= and =update= to create and update the plot
@@ -719,8 +706,8 @@ data has changed.
** Solver ** Solver
The Pamhyr2 architecture allow to define multiple solver. A solver is The {{{pamhyr2}}} architecture allow to define multiple solver. A
define by a: solver is define by a:
- type - type
- name - name
- description, - description,
@@ -736,11 +723,11 @@ different solver type, this solver type implement the code for export
study to solver input format, and read the solver output to study study to solver input format, and read the solver output to study
results. There exists a generic solver with a generic input and output results. There exists a generic solver with a generic input and output
format, the type could be use to use a solver not implemented in format, the type could be use to use a solver not implemented in
Pamhyr2, but this solver must can read/write input and output generic {{{pamhyr2}}}, but this solver must can read/write input and output
format or use external script. There is possible to define different generic format or use external script. There is possible to define
solver with the same type, for example two differents version of the different solver with the same type, for example two differents
same solver. Finaly, with input and output formater is possible to version of the same solver. Finaly, with input and output formater is
execute a code on distant computer, for example, over ssh. possible to execute a code on distant computer, for example, over ssh.
#+name: graph-multi-solver #+name: graph-multi-solver
#+header: :results drawer #+header: :results drawer
@@ -857,8 +844,8 @@ solver and get results:
- (2.1) The solver read the input file(s) - (2.1) The solver read the input file(s)
- (2.2) The solver compute results and write it to solver output - (2.2) The solver compute results and write it to solver output
file(s) file(s)
- (3) Pamhyr2 create a =Results= object - (3) {{{pamhyr2}}} create a =Results= object
- (3.1) The Pamhyr2 solver class read solver output file(s) and - (3.1) The {{{pamhyr2}}} solver class read solver output file(s) and
complete Results with readed data complete Results with readed data
#+name: graph-pipeline #+name: graph-pipeline
@@ -976,7 +963,7 @@ the temporal order of action is prensented in Figure
} }
#+end_src #+end_src
To implement a Solver in Pamhyr2, there exists a abstract class To implement a Solver in {{{pamhyr2}}}, there exists a abstract class
=Solver.AbstractSolver=. A class who herits this class, must implement =Solver.AbstractSolver=. A class who herits this class, must implement
different methods: different methods:
- =export=: Export the study to solver input file(s) - =export=: Export the study to solver input file(s)
@@ -987,7 +974,7 @@ different methods:
** Unit tests ** Unit tests
A very small part of Pamhyr2 has unit test. This part is limited to the Model. A very small part of {{{pamhyr2}}} has unit test. This part is limited to the Model.
#+begin_src shell #+begin_src shell
python3 -m venv test python3 -m venv test
@@ -1000,9 +987,9 @@ A very small part of Pamhyr2 has unit test. This part is limited to the Model.
** The debug mode ** The debug mode
To activate an deactivate the Pamhyr2 debug mode you can open the To activate an deactivate the {{{pamhyr2}}} debug mode you can open
configuration window and type "Ctrl+G" or run Pamhyr2 with command the configuration window and type "Ctrl+G" or run {{{pamhyr2}}} with
line: command line:
#+begin_src shell #+begin_src shell
./Pamhyr2 debug ./Pamhyr2 debug
#+end_src #+end_src
@@ -1015,7 +1002,7 @@ data base file.
#+NAME: debug-repl #+NAME: debug-repl
#+ATTR_LATEX: :width 14cm #+ATTR_LATEX: :width 14cm
#+CAPTION: Pamhyr2 debug Python REPL #+CAPTION: {{{pamhyr2}}} debug Python REPL
[[./images/python-debug-repl.png]] [[./images/python-debug-repl.png]]
* Build the project * Build the project
@@ -1028,7 +1015,7 @@ to build packages manually.
If you need an hand made package, you can script available in If you need an hand made package, you can script available in
{{{file(packages)}}} directory. {{{file(packages)}}} directory.
*** GNU/Linux *** GNU/Linux {{{linux}}}
On GNU/Linux building GNU/Linux packages is easy, you just need python On GNU/Linux building GNU/Linux packages is easy, you just need python
in version 3.8 must be installed with venv and pyinstaller packages in version 3.8 must be installed with venv and pyinstaller packages
@@ -1050,7 +1037,7 @@ cd packages
./linux.sh ./linux.sh
#+end_src #+end_src
*** Windows *** Windows {{{windows}}}
To make the Windows packages you have two choice: If you use Windows To make the Windows packages you have two choice: If you use Windows
you can use the script {{{file(packages/windows.bat)}}}, other else you can use the script {{{file(packages/windows.bat)}}}, other else
@@ -1065,10 +1052,10 @@ winetricks installed.
** Setup the CI environment ** Setup the CI environment
Pamhyr2 need a Linux ci-runner and a Windows ci-runner for building {{{pamhyr2}}} need a Linux ci-runner and a Windows ci-runner for building
package. The windows ci-runner could run on a Wine environement. package. The windows ci-runner could run on a Wine environement.
*** Linux *** Linux {{{linux}}}
The Linux ci-runner need some software and dependencies in addtion of The Linux ci-runner need some software and dependencies in addtion of
gitlab-ci. gitlab-ci.
@@ -1078,10 +1065,11 @@ gitlab-ci.
emacs emacs-goodies-el \ emacs emacs-goodies-el \
texlive-full \ texlive-full \
python3.8 python3.8-venv python3.8 python3.8-venv
sudo python3 -m pip install pyinstaller sudo python3 -m pip install pyinstaller
#+end_src #+end_src
*** Windows (Wine) *** Windows (Wine) {{{windows}}}
The ci-runner environment for Wine need at least wine version 8, let The ci-runner environment for Wine need at least wine version 8, let
[[https://www.numetopia.fr/comment-installer-wine-sur-ubuntu-ou-linux-mint/][see who to add wine official depot to your linux distribution]]. [[https://www.numetopia.fr/comment-installer-wine-sur-ubuntu-ou-linux-mint/][see who to add wine official depot to your linux distribution]].
@@ -1090,18 +1078,77 @@ The ci-runner environment for Wine need at least wine version 8, let
sudo apt install wine-stable winetricks sudo apt install wine-stable winetricks
#+end_src #+end_src
In addition, the environment need windows version of: **** Setup environment
- [[https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe][Python 3.8.10]]
- Git Export Wine environment variable to set wine as 64 bits architecture
- PowerShell and set the correct path for wine environment.
- Gitlab-ci
#+begin_src shell
export WINARCH=win64
export WINEPREFIX=$PWD/my-wine-runner-prefix
#+end_src
Setup Wine environment to Windows 10 and install the minimal fonts
with =winetricks=.
#+begin_src shell
winetricks corefonts win10
#+end_src
**** Install dependencies
First install 7zip with help of =winetricks=.
#+begin_src shell
winetricks 7zip
#+end_src
In addition, install in the environment the Windows version of:
- [[https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe][Python 3.8.10]] (ensure the python path is set and Pip is enable)
- [[https://git-scm.com/downloads][Git]]
- [[https://github.com/PowerShell/PowerShell/releases/download/v7.0.1/PowerShell-7.0.1-win-x64.msi][PowerShell]]
- [[https://freefr.dl.sourceforge.net/project/nsis/NSIS%203/3.08/nsis-3.08-setup.exe][Nsis]] - [[https://freefr.dl.sourceforge.net/project/nsis/NSIS%203/3.08/nsis-3.08-setup.exe][Nsis]]
To run a Windows executable into wine environement, use =wine64= command:
#+begin_src shell
wine64 <the-exe-file>
#+end_src
Now, we can install =pyinstaller= on this windows environment: Now, we can install =pyinstaller= on this windows environment:
#+begin_src shell #+begin_src shell
wine python -m pip install pyinstaller wine python -m pip install pyinstaller
#+end_src #+end_src
Now, we can download [[https://docs.gitlab.com/runner/install/windows.html][Gitlab-ci]] runner for Windows an put it in the
current path.
**** Setup runner
You can configure the runner with command:
#+begin_src shell
wine64 gitlab-runner-windows-amd64.exe register
#+end_src
**** Run the runner
Create a new executable shell script =runner.sh= with following lines:
#+begin_src shell
#! /bin/sh
export WINARCH=win64
export WINEPREFIX=$PWD/my-wine-runner-prefix
wine64 gitlab-runner-windows-amd64.exe run
#+end_src
Now you can run the runner with command =./runner.sh=.
{{{bulb}}} You can run this command into a =screen= terminal, detach
the terminal and disconnect from runner machine to keep runner alive.
* Documentation files * Documentation files
This document and the user documentation are org files. This text file This document and the user documentation are org files. This text file
@@ -1284,23 +1331,23 @@ Some org-mode configuration used in documentations files are define in
* How to contribute? * How to contribute?
Pamhyr2 is free software: you can redistribute it and/or modify it {{{pamhyr2}}} is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License[fn:license], either it under the terms of the GNU General Public License[fn:license],
version 3 of the License, or any later version. either version 3 of the License, or any later version.
[fn:license] The GPLv3 web page: [fn:license] The GPLv3 web page:
https://www.gnu.org/licenses/gpl-3.0.en.html https://www.gnu.org/licenses/gpl-3.0.en.html
** Guidelines ** Guidelines
To contribute to Pamhyr2, we expect a minimum of respect between To contribute to {{{pamhyr2}}}, we expect a minimum of respect between
contributors. We therefore ask you to respect the following rules contributors. We therefore ask you to respect the following rules
regarding communication and contribution content: regarding communication and contribution content:
+ No gender, racial, religious or social discrimination + No gender, racial, religious or social discrimination
+ No insults, personal attacks or potentially offensive remarks + No insults, personal attacks or potentially offensive remarks
+ Pamhyr2 is free software, and intended to remain so, so take care + {{{pamhyr2}}} is free software, and intended to remain so, so take
with the licensing of libraries and external content you want to add care with the licensing of libraries and external content you want
to the project to add to the project
+ Humour or hidden easter eggs are welcome if they respect the + Humour or hidden easter eggs are welcome if they respect the
previous rules previous rules
@@ -1311,11 +1358,12 @@ an issue on the project's gitlab page[fn:p2-gitlab], or you can create
a merge request on the same page with the changes you have made to the a merge request on the same page with the changes you have made to the
code, translation or documentation. code, translation or documentation.
The Pamhyr2 copyright is owned by INRAE[fn:inrae], but we keep a The {{{pamhyr2}}} copyright is owned by INRAE[fn:inrae], but we keep a
record of each contributors. If you made a modification to pamhyr2 record of each contributors. If you made a modification to
software, please add your name at the end of {{{file(AUTHORS)}}} file {{{pamhyr2}}} software, please add your name at the end of
and respect the Listing [[auth-format]] format. You can update this file {{{file(AUTHORS)}}} file and respect the Listing [[auth-format]]
information for following contribution. format. You can update this file information for following
contribution.
#+NAME: auth-format #+NAME: auth-format
#+CAPTION: =AUTHORS= file format #+CAPTION: =AUTHORS= file format
@@ -1326,16 +1374,17 @@ information for following contribution.
#+CAPTION: Current =AUTHORS= file #+CAPTION: Current =AUTHORS= file
#+INCLUDE: "../../AUTHORS" src text #+INCLUDE: "../../AUTHORS" src text
[fn:p2-gitlab] The Pamhyr2 Gitlab project page: [fn:p2-gitlab] The {{{pamhyr2}}} Gitlab project page:
https://gitlab.irstea.fr/theophile.terraz/pamhyr https://gitlab.irstea.fr/theophile.terraz/pamhyr
[fn:inrae] The INRAE web site: https://www.inrae.fr/ [fn:inrae] The INRAE web site: https://www.inrae.fr/
** Translate ** Translate
You can improve or add translation for the project. To contribute to You can improve or add translation for the project. To contribute to
Pamhyr2 translate, you need to use Qt Linguist[fn:qt-linguist]. Open {{{pamhyr2}}} translate, you need to use Qt
Qt-linguist and edit the translation ({{{file(.ts)}}}) file, finally, Linguist[fn:qt-linguist]. Open Qt-linguist and edit the translation
commit the new version of file and make a merge request. ({{{file(.ts)}}}) file, finally, commit the new version of file and
make a merge request.
If you want add a new language, edit the script If you want add a new language, edit the script
{{{file(src/lang/create_ts.sh)}}} like Listing [[ts-it]]. Run the script {{{file(src/lang/create_ts.sh)}}} like Listing [[ts-it]]. Run the script
@@ -1344,7 +1393,7 @@ and open the new file with Qt-linguist, setup target language (Figure
file and make a merge request. file and make a merge request.
#+NAME: ts-it #+NAME: ts-it
#+CAPTION: Example of modified {{{file(src/lang/create_ts.sh)}}} to add italian (it) translate for Pamhyr2 #+CAPTION: Example of modified {{{file(src/lang/create_ts.sh)}}} to add italian (it) translate for {{{pamhyr2}}}
#+begin_src shell #+begin_src shell
... ...
LANG="fr it" LANG="fr it"
@@ -1362,7 +1411,7 @@ https://doc.qt.io/qt-5/qtlinguist-index.html (last access 2023-09-18)
** Code contribution ** Code contribution
If you are developper you can improve and/or add features to If you are developper you can improve and/or add features to
Pamhyr2. Please, follow the architecture described in section {{{pamhyr2}}}. Please, follow the architecture described in section
[[Architecture]] as closely as possible. Keep the code simple, clear and [[Architecture]] as closely as possible. Keep the code simple, clear and
efficient as possible. The master branch is reserved for the project efficient as possible. The master branch is reserved for the project
maintainer; you can create a new branch or fork the project before the maintainer; you can create a new branch or fork the project before the
+4
View File
@@ -163,3 +163,7 @@
\SetWatermarkScale{3} \SetWatermarkScale{3}
\SetWatermarkFontSize{1cm} \SetWatermarkFontSize{1cm}
\SetWatermarkText{Work in progress} \SetWatermarkText{Work in progress}
%% Icons
\usepackage{fontawesome5}
+19 -5
View File
@@ -17,11 +17,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Constant name # Constant name
#+MACRO: oldPamhyr PAMHyR #+MACRO: pamhyr \textsc{PAMHyR}
#+MACRO: Pamhyr Pamhyr2 #+MACRO: pamhyr2 \textsc{Pamhyr2}
#+MACRO: Mage Mage #+MACRO: mage \textsc{Mage}
#+MACRO: Rubarbe RubarBE #+MACRO: mage7 \textsc{Mage7}
#+MACRO: Inrae INRAE #+MACRO: mage8 \textsc{Mage8}
#+MACRO: rubarbe \textsc{RubarBE}
#+MACRO: adists \textsc{AdisTS}
#+MACRO: mascaret \textsc{Mascaret}
#+MACRO: inrae INRAE
#+MACRO: latex \LaTeX #+MACRO: latex \LaTeX
# Information # Information
@@ -35,6 +39,16 @@
#+MACRO: cite [cite:$1] #+MACRO: cite [cite:$1]
#+MACRO: biblio \bibliography{documentation} #+MACRO: biblio \bibliography{documentation}
# Icons
#+MACRO: bulb \faIcon{lightbulb}
#+MACRO: OK \faIcon{check}
#+MACRO: linux \faIcon{linux}
#+MACRO: windows \faIcon{windows}
#+MACRO: python \faIcon{python}
#+MACRO: java \faIcon{java}
# Wrapper # Wrapper
#+NAME: attr_wrap #+NAME: attr_wrap
#+HEADER: :var width="\\textwidth" #+HEADER: :var width="\\textwidth"
@@ -0,0 +1,68 @@
@article{camenen_simple_2007,
title = {Simple and {General} {Formula} for the {Settling} {Velocity} of {Particles}},
volume = {133},
language = {en},
number = {2},
urldate = {2025-01-23},
journal = {Journal of Hydraulic Engineering},
author = {Camenen, Benoit},
month = feb,
year = {2007},
pages = {229-233},
}
@article{meyer-peter_formulas_1948,
address = {Stockholm, Sweden},
title = {Formulas for bed-load transport.},
journal = {Report on Second Meeting of IAHR},
author = {Meyer-Peter, E and Mueller, R},
year = {1948},
pages = {39-64},
}
@article{elder_dispersion_1959,
title = {The dispersion of marked fluid in turbulent shear flow},
volume = {5},
issn = {0022-1120, 1469-7645},
language = {en},
number = {04},
urldate = {2025-01-23},
journal = {Journal of Fluid Mechanics},
author = {Elder, J. W.},
month = may,
year = {1959},
pages = {544},
}
@article{fischer_discussion_1975,
title = {Discussion of Simple Method for Predicting Dispersion in Streams},
volume = {101},
issn = {0090-3914, 2690-2435},
language = {en},
number = {3},
urldate = {2025-01-23},
journal = {Journal of the Environmental Engineering Division},
author = {Fischer, Hugo B},
month = mar,
year = {1975},
pages = {453-455},
}
@article{iwasa_predicting_1991,
address = {Hong Kong},
title = {Predicting longitudinal dispersion coefficient in open channel flows},
journal = {roc. Int. Symp. of Environmental Hydraulics},
author = {Iwasa, Y and Aya, S},
year = {1991},
pages = {505-510},
}
@book{soulsby_dynamics_1997,
address = {London},
edition = {Thomas Telford},
title = {Dynamics of {Marine} {Sands}: {A} {Manual} for {Practical} {Applications}},
urldate = {2025-01-23},
author = {Soulsby, Richard},
year = {1997},
}
+175
View File
@@ -0,0 +1,175 @@
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,french]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm,headheight=2cm,headsep=2cm,footskip=2cm}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[frenchb]{babel}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\makeatother
\usepackage{babel}
\addto\extrasfrench{%
\providecommand{\og}{\leavevmode\flqq~}%
\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}%
}
\begin{document}
\includegraphics[width=5cm]{img/Logo-INRAE_Transparent.png}
~
~
~
\begin{center}
TP AdisTS - Pamhyr2\\
Version : Janvier 2025
\par\end{center}
~
~
\begin{center}
\textbf{\LARGE Modélisation 1D du transport sédimentaire : } \\
\textbf{\LARGE Cas du Vieux-Rhône de Miribel-Jonage}\\
\textbf{\LARGE (Lyon, France)}
\par\end{center}{\LARGE \par}
~
\begin{center}
\includegraphics[width=17cm]{img/Garde.jpeg}
\par\end{center}
~
\begin{center}
{\large INRAE Lyon-Grenoble Auvergne-Rhône-Alpes}
\par\end{center}{\large \par}
\begin{center}
RiverLy, Hydraulique des rivières
\par\end{center}
~
\begin{center}
\begin{tabular}{lll}
Auteur : & Dorian Hernandez & dorian.hernandez@inrae.fr\tabularnewline
& Théophile Terraz & theophile.terraz@inrae.fr\tabularnewline
\end{tabular}
\par\end{center}
~
\pagebreak{}
\begin{center}
\tableofcontents{}
\par\end{center}
~
\pagebreak{}
% \section{Introduction}
%
% TODO
%
% \pagebreak{}
\section{Contexte de l'étude - le colmatage du Vieux-Rhône}
Le champ de captage de Crépieux-Charmy est un site de pompage d'eau potable alimentant 97 \% de la ville de Lyon. Situé au nord-est de la ville, il est en contact hydraulique avec trois chenaux du Rhône. Le canal de Miribel au Nord, dont les débits varient entre 89 (débit réservé) et 2400 ~$m³/s$ (Crue extrême), le canal de Jonage au sud, imposant un débit quasi constant de 600 ~$m³/s$ pour alimenter la centrale de Cusset, et un Vieux-Rhône qui traverse le site. Les fortes variations hydrauliques le long de Miribel, ainsi que le débit constant le long de Jonage mènent à un dépôt général des sédiments fins et grossiers le long du Vieux-Rhône, avec la création d'un remous important causé par Jonage.
\begin{center}
\includegraphics[width=15cm]{img/Intro.jpeg}
\par\end{center}
Eau du grand Lyon, le gérant du champ de captage, souhaite identifier les zones de dépôts de sédiments fin le long du Vieux-Rhône, cause principale de colmatage, impactant les performances de pompage de l'eau dans les nappes.
\begin{center}
\includegraphics[width=15cm]{img/Champ_captant.jpeg}
\par\end{center}
Pour cela, une campagne expérimentale visant à identifier les zones colmatés du Vieux-Rhône a été réalisée et a mis en avant une hétérogénéité du site. Notamment, une forte zone de dépôts de grossier est présente en amont. Tandis qu'une présence plus importante de fines et sables dans la zone aval (zone de remous de Jonage) a été observée, ainsi qu'un colmatage plus important.
\begin{center}
\includegraphics[width=15cm]{img/Grossier_sable.jpeg}
\par\end{center}
En parallèle, un modèle numérique hydraulique 1D a été élaboré sous Pamhyr2 afin d'analyser l'écoulement sur le site. Les résultats numériques mettent alors bien en avant le remous généré par Jonage, ainsi qu'une diminution de la vitesse de l'écoulement à partir du point kilométrique (PK) 1000, fin de la zone amont.
\begin{center}
\includegraphics[width=15cm]{img/Simu.jpeg}
\par\end{center}
\section{Objectifs de l'étude}
Le modèle numérique 1D représente actuellement la partie hydraulique du système. L'objectif du TP est alors de mettre en donnée la partie sédimentaire (fines) du modèle, afin d'effectuer des calculs à l'aide de AdisTS , et in-fine, identifier les zones de dépôt et d'érosion des sédiments fins le long du Vieux-Rhône selon différents scénarios hydraulique. Les différentes étapes seront alors :
\begin{itemize}
\item Mettre en données le modèle Pamhyr2 du Vieux-Rhône pour le solveur AdisTS.
\item Lancer des calculs Mage - AdisTS pour différents scénarios hydrauliques.
\item Interpréter et discuter les résultats obtenus (comportement hydro-sédimentaire du site, impacts des débits, impact d'une crue, limites du modèle, etc..)
\end{itemize}
\section{Données fournies}
\textbf{Le modèle numérique du Vieux-Rhône}
Fichier \textit{Vieux\_Rhone\_TP\_AdisTS.pamhyr}.\\
\textbf{Les scénarios hydrauliques}
Quatre scénarios hydrauliques sont à analyser (voir les conditions initiales hydraulique) :
\begin{itemize}
\item Le premier correspond à un débit constant de 25~$m³/s$
\item Le deuxième consiste en une faible montée en débit puis à une redescente (25 - 50 - 25~$m³/s)$.
\item Le troisième correspondant à une plus forte montée en débit (25 - 100 - 25~$m³/s)$.
\item Le dernier correspond à une crue (25 - 600 - 25~$m3/s)$.\\
\end{itemize}
\textbf{Propriétés des sédiments}
Nous considérerons 2 classes de sédiments de types sable naturel, correspondant à une classe de Fines (limon) de diamètre moyen 63 microns et une classe de Sable de 500 microns. Les deux classes auront une masse volumique de 2650~$kg/m³$, et une porosité de 0,45 pourra être choisie. Leurs concentrations constantes en amont (conditions aux limites amont) seront de 60 $mg/l$ pour les fines et 30 $mg/l$ pour les sables. Nous considérerons dans un premier temps qu'il n'y a aucun dépôt initial de ces deux classes de sédiments et que la concentration initiale en sédiments dans le bief est nulle.\\
\textbf{Documentation}
\begin{itemize}
\item Un tutoriel guidé de mise en données : Pas-a-pas.pdf.
\item Un guide utilisateur de AdisTS : adis-TS\_usage.pdf
\item Un guide de conception de AdisTS : adis-TS\_conception.pdf
\end{itemize}
\section{Bonus}
Ajouter une épaisseur initiale de sédiments \textit{Sables} au fond de 1 $cm$ et relancer un calcul avec le scénario 1.
\pagebreak{}
\end{document}
+8
View File
@@ -0,0 +1,8 @@
#! /bin/sh
pdflatex -no-shell-escape pas-a-pas.tex
bibtex pas-a-pas.aux
pdflatex -no-shell-escape pas-a-pas.tex
pdflatex -no-shell-escape pas-a-pas.tex
pdflatex -no-shell-escape Sujet.tex
pdflatex -no-shell-escape Sujet.tex
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@@ -0,0 +1,291 @@
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,french]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm,headheight=2cm,headsep=2cm,footskip=2cm}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[frenchb]{babel}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\makeatother
\usepackage{babel}
\addto\extrasfrench{%
\providecommand{\og}{\leavevmode\flqq~}%
\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}%
}
\begin{document}
\includegraphics[width=5cm]{img/Logo-INRAE_Transparent.png}
~
~
~
\begin{center}
Tutoriel Pas-à-pas AdisTS - Pamhyr2
Version : Janvier 2025
\par\end{center}
~
~
\begin{center}
\textbf{\LARGE Modélisation 1D du transport sédimentaire : } \\
\textbf{\LARGE Cas du Vieux-Rhône de Miribel-Jonage}\\
\textbf{\LARGE (Lyon, France)}
\par\end{center}{\LARGE \par}
~
\begin{center}
\includegraphics[width=17cm]{img/Garde.jpeg}
\par\end{center}
~
\begin{center}
{\large INRAE Lyon-Grenoble Auvergne-Rhône-Alpes}
\par\end{center}{\large \par}
\begin{center}
RiverLy, Hydraulique des rivières
\par\end{center}
~
\begin{center}
\begin{tabular}{lll}
Auteurs : & Dorian Hernandez & dorian.hernandez@inrae.fr\tabularnewline
& Théophile Terraz & theophile.terraz@inrae.fr\tabularnewline
\end{tabular}
\par\end{center}
~
\pagebreak{}
\begin{center}
\tableofcontents{}
\par\end{center}
~
\pagebreak{}
% \section{Introduction}
%
% TODO
%
% \pagebreak{}
\section{Ouvrir l'étude}
Lancez Pamhyr2.
Cliquez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/open.png} puis ouvrez le modèle Pamhyr2 \textit{Vieux\_Rhone\_TP\_AdisTS.pamhyr}.
Le modèle à un bief du Vieux-Rhône s'affiche sur la fenêtre graphique.
\begin{center}
\includegraphics[width=15cm]{img/Open_model.jpeg}
\par\end{center}
\section{Mise en donnée}
\subsection{Création des classes de sédiments}
Dans la fenêtre principale, cliquez sur \texttt{[AdisTS] => [Polluants]} pour créer des classes de sédiments.
\begin{center}
\includegraphics[width=15cm]{img/Model_menu_Adists.jpeg}
\par\end{center}
La fenêtre \textit{Polluants - Vieux-Rhône} s'affiche. Elle va nous permettre de définir l'ensemble des caractéristiques (type de sédiment, taille moyenne, masse volumique,..) de nos classes de sédiments, ainsi que les conditions sédimentaires initiales et aux limites du modèle.
A l'aide du bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} inclure deux nouvelles classes de sédiments et les nommer \textit{Fines} et \textit{Sables}.
\begin{center}
\includegraphics[width=15cm]{img/Polluants_fenetre.jpeg}
\par\end{center}
Pensez à sauvegarder régulièrement l'étude, à l'aide du bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/save.png} de la fenêtre principale.
\subsection{Caractéristiques et conditions initiales des sédiments}
Pour pouvoir attribuer des caractéristiques et des conditions initiales à une classe de sédiments, il faut d'abord la sélectionner.
Cliquez sur la classe de sédiments \textit{Fines}, puis ouvrez la fenêtre \texttt{[Caractéristiques]}.
\begin{center}
\includegraphics[width=15cm]{img/Pol_to_Caracteristique.jpeg}
\par\end{center}
La fenêtre d'édition de la classe de sédiments \textit{Fines} s'ouvre.
\begin{center}
\includegraphics[width=15cm]{img/caracteristique_fines_a_completer.jpeg}
\par\end{center}
Celle-ci contient les informations nécessaire à la résolution des termes sources (taux d'érosion et de dépôt) de l'équation de transport-dispersion. Notamment pour le calcul de la vitesse de chute selon \cite{camenen_simple_2007} et la contrainte critique de mise en mouvement via l'approximation de \cite{soulsby_dynamics_1997}.
Complétez les valeurs manquantes du tableau selon les données de l'énoncé. Puis, fermez la fenêtre des caractéristiques.
Ouvrez à présent la fenêtre de \texttt{[Conditions initiales]} (toujours pour les \textit{Fines}).
\begin{center}
\includegraphics[width=15cm]{img/CI.jpeg}
\par\end{center}
Cette fenêtre contient deux espaces permettant de définir la concentration initiale de \textit{Fines} (dans "l'eau" du bief) et l'épaisseur de dépôt de fines au fond du bief. Dans le compartiment de gauche, on définit les valeurs par défaut, appliquées à l'ensemble du bief. Le compartiment de droite permet d'imposer des conditions initiales différentes en fonction des PKs du bief.
Nous considérerons une concentration initiale nulle en sédiments fins, ainsi qu'une épaisseur nulle au fond.\\
\\
Fermez la fenêtre de conditions initiales.\\
\\
Sélectionnez la classe de sédiments \textit{Sables} et répétez les étapes précédentes en considérant cette fois-ci les caractéristiques propres aux sables selon l'énoncé.
\subsection{Conditions aux limites}
Pour les conditions aux limites il n'est pas nécessaire de mettre en surbrillance les classes de sédiments.\\
\\
Ouvrez la fenêtre de \texttt{[Conditions aux limites]} et ajouter deux conditions aux limites de type concentration au n½ud amont du bief. Il y aura alors une condition aux limites pour chaque classe de sédiments.
\begin{center}
\includegraphics[width=15cm]{img/CL.jpeg}
\par\end{center}
Éditez la condition aux limites \textit{Fines} en la mettant en surbrillance et en cliquant sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/edit.png}.\\
Créez une condition aux limites de type concentration constante de 60 $kg/m³$ en insérant deux lignes \textit{Temps/Concentration} à l'aide du bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png}.
\begin{center}
\includegraphics[width=15cm]{img/CL_edit.jpeg}
\par\end{center}
Procédez de la même façon pour la classe de sédiments \textit{Sables}, mais avec une concentration de 30 $kg/m³$.\\
\\
Fermez les fenêtres d'éditions des conditions aux limites et des polluants.
\subsection{Caractéristiques du fond fixe}
Dans la fenêtre principale, cliquez sur \texttt{[AdisTS] => [D90]}. Cette fenêtre permet de définir le diamètre des particules fixes au fond du canal, nécessaire pour le calcul du coefficient de Strickler à la manière de \cite{meyer-peter_formulas_1948}. De même que pour les conditions initiales des polluants, la fenêtre d'édition est divisée en deux parties afin d'introduire un paramètres par défaut et de laisser la possibilité d'appliquer des valeurs de $d_{90}$ variables le long du bief.
\begin{center}
\includegraphics[width=15cm]{img/D90.jpeg}
\par\end{center}
Définissez 2 coefficients différents. Une valeur de 5 cm sur la partie amont (zone principale de dépôt de grossier) et 2 cm sur la partie avale.
\subsection{Coefficient de diffusion}
Le coefficient de diffusion $D_f$ comprend une part de diffusion moléculaire prise par défaut à $D_{mol}=10^{-6}$, à laquelle s'ajoutent les diffusions turbulentes et la dispersion sous forme d'un seul terme $D_{mix}$ défini selon les formules de \cite{fischer_discussion_1975}, \cite{elder_dispersion_1959} ou \cite{iwasa_predicting_1991}. Il est aussi possible d'utiliser une forme générique de $D_{mix}$ (voir doc utilisateur) ou encore d'imposer une valeur constante. Dans le cas tu TP nous choisirons Iwasa et Aya avec $\alpha=2$.
\begin{center}
\includegraphics[width=15cm]{img/Diff.jpeg}
\par\end{center}
\section{Paramètres du solveur}
Dans la fenêtre principale, cliquez sur \texttt{[Exécuter] => [Paramètres numériques des solveurs]}.
Dans la fenêtre \textit{Paramètres du solveur}, sélectionnez l'onglet \texttt{[Adis-TS\_WC]}.
Ces paramètres pilotent le comportement du solveur numérique. On retrouve notamment les temps de début et de fin de la simulation. Le pas de temps maximal en secondes pour le calcul. Le paramètre d'implicitation du schéma numérique de Crank-Nicholson (0.5 comme valeur recommandée). Les temps d'écriture des fichiers .bin, .csv (pour l'export à la volée), et de l'affichage à l'écran. On retrouve aussi la possibilité d'appliquer une concentration initiale.
Exemple de valeurs des paramètres :
\begin{center}
\includegraphics[width=15cm]{img/Execute_param.jpeg}
\par\end{center}
Fermez la fenêtre \textit{Paramètres du solveur}.
\section{Lancer une simulation}
Avant de lancer AdisTS, il est nécessaire d'avoir une première solution hydraulique.
Vérifiez que les conditions aux limites amont et aval sélectionnées sont bien celles correspondantes à l'hydrogramme et au limnigramme du scénrio souhaité.
\begin{center}
\includegraphics[width=15cm]{img/CL_verif.jpeg}
\par\end{center}
Dans la fenêtre principale, cliquez sur \texttt{[Exécuter] => [Lancer le solveur]}.
Sélectionnez \textit{Defaut-Mage - (Mage8)} et cliquez sur le bouton \textit{Lancer}.
La fenêtre \textit{Log du solveur} s'ouvre.
Cette fenêtre affiche les sorties texte du solveur.
À partir de la fenêtre \textit{Log du solveur}, il est possible de réexécuter le calcul en cliquant sur l'icône \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/run.png}. Cliquez sur le bouton \textit{Résultats} pour ouvrir la fenêtre \textit{Résultats} de Mage.
Dans la fenêtre principale, cliquez sur \texttt{[Exécuter] => [Lancer AdisTS]}.
Sélectionnez \textit{Defaut-AdisTS - (adistswc)} et cliquez sur le bouton \textit{Lancer}.
La fenêtre \textit{Log du solveur} s'ouvre.
Cette fenêtre affiche les sorties texte du solveur. Si le calcul s'est déroulé correctement, la fenêtre log devrait ressembler à celle-ci :
\begin{center}
\includegraphics[width=15cm]{img/log.jpeg}
\par\end{center}
Cliquez sur le bouton \textit{Résultats} pour ouvrir la fenêtre \textit{Résultats} de AdisTS. Il est aussi possible de ré-ouvrir les résultats de Mage en cliquant sur le bouton \textit{Résultats Mage}.
\section{Visualisation et export de résultats}
Il est aussi possible d'ouvrir la fenêtre \textit{Résultats} si vous avez fermé la fenêtre \textit{Log du solveur}, en cliquant sur \texttt{[Résultats] => [Visualiser les derniers résultats]} à partir de la fenêtre principale. Les résultats affichés sont ceux de AdisTS.
\begin{center}
\includegraphics[width=15cm]{img/Results.jpeg}
\par\end{center}
Le panneau supérieur gauche permet de sélectionner le bief, le panneau du milieu gauche permet de sélectionner une section dans ce bief et le panneau inférieur gauche permet de sélectionner la classe de sédiments dont on veut extraire des résultats.
La fenêtre de droite possède 4 onglets. Chaque onglet présente des résultats en fonction du temps (un curseur en bas de la fenêtre permet de visualiser les résultats à différents pas de temps) :
\begin{itemize}
\item Le premier onglet correspond aux données brutes de concentration dans l'eau et de masse déposée pour chaque classe de sédiments de l'étude.
\item Le deuxième onglet est divisée en deux sous-onglets permettant de visualiser de deux façons différentes la concentration de la classe de sédiments sélectionnée : soit en fonction du PK du bief, soit en fonction du temps.
\item De même, le troisième onglet est divisé en deux sous-onglets permettant de visualiser cette fois-ci la masse linéique de sédiments s'étant déposés.
\item Enfin le dernier onglet présente l'épaisseur des sédiments déposés.
\end{itemize}
Il est possible d'exporter les résultats au format CSV en cliquant sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/export.png} en haut à gauche de la fenêtre.
\begin{center}
\includegraphics[width=15cm]{img/Export_res_adis.jpeg}
\par\end{center}
Répétez les étapes 4 et 5, selon différents scénarios hydrauliques.
\section{Bonus}
Ajoutez une épaisseur initiale de 1 cm de sédiments \textit{Sables} au fond et relancer un calcul avec le scénario 1.
\bibliographystyle{plainnat}
\bibliography{Biblio.bib}
\pagebreak{}
\end{document}
+263
View File
@@ -0,0 +1,263 @@
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,french]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm,headheight=2cm,headsep=2cm,footskip=2cm}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[frenchb]{babel}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
\usepackage{amsthm}
\newtheorem{remark}{Q?}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\makeatother
\usepackage{babel}
\addto\extrasfrench{%
\providecommand{\og}{\leavevmode\flqq~}%
\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}%
}
\begin{document}
\includegraphics[width=5cm]{img/Logo-INRAE_Transparent.png}
~
~
~
\begin{center}
Tutoriel pour Pamhyr2
- suite -
Janvier 2025
\par\end{center}
~
~
\begin{center}
\textbf{\LARGE Scénarii d'aménagement de la rivière } \\
\textbf{\LARGE Hogneau (Nord, France) avec Pamhyr2}
\par\end{center}{\LARGE \par}
~
~
\begin{center}
{\large INRAE Lyon-Grenoble Auvergne-Rhône-Alpes}
\par\end{center}{\large \par}
\begin{center}
RiverLy, Hydraulique des rivières
\par\end{center}
~
~
~
~
~
~
\begin{center}
\begin{tabular}{lll}
Auteurs : & Céline Berni & celine.berni@inrae.fr\tabularnewline
& Théophile TERRAZ & theophile.terraz@inrae.fr\tabularnewline
\end{tabular}
\par\end{center}
~
\pagebreak{}
\begin{center}
\tableofcontents{}
\par\end{center}
~
\pagebreak{}
% \section{Introduction}
%
% TODO
%
% \pagebreak{}
\section{Préambule}
Dans ce document, nous expliciterons les fonctionnalités de PamHyr utiles à la modélisation de scénarii d'aménagement de la rivière Hogneau comme décrit dans le document de TP.
Il est utile au préalable d'avoir suivi le tutoriel pour la modélisation de la rivière Hogneau fourni avec le logiciel (Tuto1-fr.pdf).
Suivre le tutoriel 1 vous permettra de construire le modèle avec le scénario de référence (la rivière avant aménagement).
Notez que l'outil PamHyr ne permet pas au stade actuel de comparer plusieurs scenarii.
Vous devrez pour ce faire exporter les vos résultats à partir de la fenêtre \textit{Résultats} qui s'ouvre en cliquant sur \texttt{[Résultats] => [Visualiser les derniers résultats]} à partir de la fenêtre principale.
Le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/export.png} vous permet d'exporter les résultats au format CSV pour une utilisation en dehors de Pamhyr2.
Vous pouvez soit vous placer en un point kilométrique (PK) donné (celui marqué en rouge sur la visualisation du profil en long ou sélectionné dans le tableau) et exporter la hauteur d'eau, le niveau d'eau le débit ou autre en fonction du temps (sélectionnez alors \texttt{Temps (s)} pour l'axe X), soit vous placer à un instant donné et exporter la grandeur de votre choix pour tous les points kilométriques de votre maillage (sélectionnez alors \texttt{Point Kilométrique (m)} pour l'axe X).
Si vous choisissez cette seconde option, cocher \texttt{envelop} vous permettra d'exporter en plus la valeur maximale au cours du temps pour la grandeur choisie.
Ainsi dans l'exemple ci-dessous, les données exportées le seront au point kilométrique 34000\,m, à l'instant $t=1$ jour et 12h.
\begin{center}
\includegraphics[width=15cm]{img/export_resultats.png}
\includegraphics[width=12cm]{img/export_resultats2.png}
\par\end{center}
\section{Premier scénario d'aménagement : abaissement du seuil}
Parmi les 3 options d'aménagement évoquées par la collectivité locale, jouer sur le contrôle aval en abaissant le seuil qui marque la jonction avec le canal de Condé-Pommeroeul peut faire baisser le niveau à l’amont.
\begin{remark}
Pourquoi jouer sur le contrôle aval peut-il avoir un effet sur le niveau d'eau en amont ?
\end{remark}
Pour modifier la hauteur du seuil, dans la fenêtre principale, cliquez sur \texttt{[Hydraulique] => [Ouvrages hydrauliques]} pour ouvrir la fenêtre des ouvrages hydrauliques.
Vous pouvez alors sélectionner le seuil Palplanche.
\begin{center}
\includegraphics[width=15cm]{img/ouvrage_seuilpalplanche.png}
\par\end{center}
Sélectionnez le seuil aval (SeuilPalplanche) et cliquez sur \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"} pour modifier les lois de cet ouvrage.
Vous pouvez alors essayer de modifier la cote du seuil.
Lancez le calcul en exécutant le programme pour plusieurs hauteurs de seuil (dont celle initiale de référence) avec chacune des trois crues proposées en condition amont.
\begin{remark}
Exportez les données obtenues en fonction du PK pour 2 ou 3 hauteurs de seuil.
Sur quelle distance le seuil aval influence-t-il la hauteur d'eau ?
Est-ce suffisant pour limiter la hauteur d'eau au niveau du pont de l'A2 ($PK \approx 33000$\,m) ?
\end{remark}
\section{Second scénario d'aménagement : élargissement du lit moyen}
Ce scénario d'aménagement consiste à essayer d’augmenter le laminage en créant un lit moyen en rive droite entre les PKs 32 015 et 33 920\,m. Pour rappel, cette localisation est imposée pour des raisons de disponibilité des terrains et on ne peut pas envisager une largeur du lit moyen supérieure à 50 mètres.
\begin{remark}
Pourquoi élargir le lit moyen peut-il avoir un effet sur le niveau d'eau durant la crue ?
\end{remark}
Pour élargir le lit moyen, la géométrie doit être modifiée.
Il est judicieux d'enregistrer votre étude sous un autre nom avant de procéder à ces modifications (cliquez sur \texttt{[Fichier] => [Sauvegarder sous]}).
Le plus simple est de repartir de la géométrie avant maillage avant de modifier les transects.
Vous pouvez supprimer les sections interpolées en les sélectionnant dans la fenêtre \textit{Géométrie} et en appuyant sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/del.png}.
Cliquez sur \texttt{[Géométrie] => [Modifier la géométrie]} ou sur l'icône \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/geometry.png} pour définir la géométrie du bief.
Sélectionnez la section en travers que vous souhaitez modifier.
Vous pouvez l'éditer en cliquant sur l'icône \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"}.
S'ouvre alors la fenêtre suivante :
\begin{center}
\includegraphics[width=15cm]{img/modif_profil_en_travers.png}
\par\end{center}
En appuyant sur \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/add.png"} vous pourrez ajouter un point sur votre profil en travers que vous pourrez ensuite placer ou vous le souhaitez sur le profil grâce aux flèches \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/up.png"} ou \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/down.png"}.
Dans le cas présent, afin d'élargir le lit moyen de 50\,m, vous pourrez ajouter un point juste après le point qui correspond à la rive droite (rd) légèrement plus haut et 50\,m plus à droite (en $Y=61.5$\,m et $Z=20.1$\,m par exemple).
Il ne restera alors plus qu'à décaler tous les points suivants de 50\,m.
Vous devriez obtenir la géométrie suivante :
\begin{center}
\includegraphics[width=15cm]{img/modif_profil_en_travers2.png}
\par\end{center}
Vous pouvez appliquer cette méthode à l'ensemble des transects à élargir et lancer le calcul pour chacune des crues proposées avec ce nouvel aménagement.
\begin{remark}
Exportez les résultats obtenus pour la hauteur d'eau en fonction du PK pour ce nouveau scénario.
Quel est l'effet de cet aménagement sur la hauteur d'eau et sur quel secteur ?
Exportez également le débit en fonction du temps en quelques sections choisies.
Quel est l'effet de cet aménagement sur l'hydrogramme de crue ?
Peut-on s'attendre à ce résultat compte tenu du volume qu'il est possible de stocker en lit moyen et du volume total de la crue ?
\end{remark}
\section{Troisième scénario d'aménagement : casier de stockage}
Ce troisième scénario consiste à faire baisser le débit dans la rivière en créant un déversement vers un casier de stockage en rive gauche juste en aval du pont de l'A2.
La surface de stockage disponible a été estimée à 42 ha pour une altitude moyenne du terrain naturel de 18\,m.
\begin{remark}
Quel volume d'eau ce réservoir peut-il stocker ?
Comment se compare-t-il au volume de la crue ?
Quel est alors l'effet attendu de cet ouvrage ?
\end{remark}
Pour modéliser ce scénario, il est nécessaire de dévier une part de l'écoulement pour le diriger vers un casier.
Il faut donc créer une difluence, soit modifier le réseau.
De nouveau, il est préférable d'enregistrer l'étude sous un autre nom avant de procéder à ces modifications.
Cliquez sur \texttt{[Réseau] => [Modifier le réseau]} ou sur l'icône \includegraphics[width=0.5cm]{img/network.png} pour modifier la structure de votre rivière.
Le réseau pour la configuration de référence ne comportait qu'un seul bief entre deux noeuds.
Pour ajouter un casier, il faut ajouter un noeud pour la diffluence, un noeud en amont du casier et un noeud en aval du casier.
Le casier ne peut en effet pas être en limite aval du modèle ni directement au niveau de la confluence.
Pour ajouter un noeud, cliquez \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} pour sélectionner l'outil ``d'addition'' et cliquez ensuite dans la fenêtre grise à l'endroit ou vous souhaitez ajouter un noeud.
De la même façon vous pourrez avec cet outil ajouter un bief entre deux noeuds en cliquant successivement sur l'un puis sur l'autre.
Vous pourrez alors créer un réseau tel que celui ci-dessous où DevLat est le noeud marquant la diffluence.
\begin{center}
\includegraphics[width=12cm]{img/reseau_casier.png}
\par\end{center}
Pour chacun des nouveau biefs crées, il vous faudra créer ou adapter la géométrie.
Deux exemples vous sont proposés ci-dessous pour les biefs amont et aval du casier.
\begin{center}
\includegraphics[width=10cm]{img/geom_am_casier.png}
\includegraphics[width=10cm]{img/geom_av_casier.png}
\par\end{center}
Vous noterez la présence d'un ouvrage sur le bief amont afin de pouvoir contrôler à partir de quelle hauteur d'eau on souhaite commencer le remplissage du casier.
Pour le bief principal constitué des deux biefs Crespin->DevLat et DevLat->SeuilAval, l'un d'eux porte la géométrie complète tandis que la géométrie de l'autre n'est pas définie.
Il vous faudra supprimer les sections dans l'un que vous implémenterez dans l'autre.
L'outil d'import de géométrie pourra vous aider.
Il faudra le cas échéant réimplémenter également les ouvrages.
Lancez le calcul pour chacune des crues proposées avec ce nouvel aménagement.
\begin{remark}
Exportez les résultats obtenus pour la hauteur d'eau en fonction du PK pour ce nouveau scénario.
Quel est l'effet de cet aménagement sur la hauteur d'eau et sur quel secteur ?
Exportez également le débit en fonction du temps en quelques sections choisies.
Quel est l'effet de cet aménagement sur l'hydrogramme de crue ?
Comparer les crues centenale et décennale : comment l'ouvrage sur le bief amont impacte-t-il les hydrogrammes ?
Vos résultats sont-ils cohérent avec vos premières estimations ?
\end{remark}
\section{Conclusion}
\`A l'aide de la modélisation numérique du cours d'eau de l'Hogneau, vous avez pu comparer l'efficacité de 3 scenarii d'aménagement sur une crue historique, une crue centenale et une crue décennale.
\begin{remark}
Quel aménagement jugez-vous le plus efficace ?
Quels éléments vous ont apporté la modélisation ?
Que proposeriez-vous à la collectivité locale ?
\end{remark}
A travers cet exemple, avez pris en main l'outil PamHyr avec le code de calcul MAGE.
\pagebreak{}
\end{document}
@@ -4,3 +4,5 @@ pdflatex -no-shell-escape step-by-step.tex
pdflatex -no-shell-escape step-by-step.tex pdflatex -no-shell-escape step-by-step.tex
pdflatex -no-shell-escape pas-a-pas.tex pdflatex -no-shell-escape pas-a-pas.tex
pdflatex -no-shell-escape pas-a-pas.tex pdflatex -no-shell-escape pas-a-pas.tex
pdflatex -no-shell-escape Tuto-2-fr.tex
pdflatex -no-shell-escape Tuto-2-fr.tex
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

File renamed without changes.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

File renamed without changes.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@@ -1,3 +1,4 @@
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/. %% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing. %% Do not edit unless you really know what you are doing.
\documentclass[12pt,french]{article} \documentclass[12pt,french]{article}
@@ -8,6 +9,7 @@
\usepackage{textcomp} \usepackage{textcomp}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{hyperref} \usepackage{hyperref}
\usepackage[frenchb]{babel}
\makeatletter \makeatletter
@@ -132,17 +134,17 @@ Pendant que vous travaillez sur votre
\section{Créer la structure de la rivière} \section{Créer la structure de la rivière}
Cliquez sur \texttt{[Réseau] => [Éditer le réseau]} ou sur l'icône \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/network.png} pour créer la structure de votre rivière. Cliquez sur \texttt{[Réseau] => [Modifier le réseau]} ou sur l'icône \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/network.png} pour créer la structure de votre rivière.
Nous voici dans la fenêtre \textit{Réseau}. Nous voici dans la fenêtre \textit{Réseau}.
Dans cette fenêtre, nous allons définir un graphe orienté qui représente les biefs de notre réseau fluvial : les arêtes sont les biefs, les n½uds sont soit des conditions limites amont, soit des conditions limites aval, soit des jonctions entre biefs. Dans cette fenêtre, nous allons définir un graphe orienté qui représente les biefs de notre réseau fluvial : les arêtes sont les biefs, les n\oe{}uds sont soit des conditions limites amont, soit des conditions limites aval, soit des jonctions entre biefs.
Un bief par défaut existe dans la nouvelle étude. Un bief par défaut existe dans la nouvelle étude.
Pour les besoins de ce tutoriel, nous allons le supprimer : Pour les besoins de ce tutoriel, nous allons le supprimer :
cliquez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/del.png} pour entrer dans le mode \textit{Suppression} puis cliquez sur les n½uds. cliquez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/del.png} pour entrer dans le mode \textit{Suppression} puis cliquez sur les n\oe{}uds.
Nous voilà repartis sur une fenêtre vierge. Nous voilà repartis sur une fenêtre vierge.
Appuyez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} pour entrer dans le mode \textit{Ajout}. Créez deux n½uds en cliquant dans la zone grise de la fenêtre, et créez un lien en cliquant à nouveau sur chaque n½ud. Appuyez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} pour entrer dans le mode \textit{Ajout}. Créez deux n\oe{}uds en cliquant dans la zone grise de la fenêtre, et créez un lien en cliquant à nouveau sur chaque n\oe{}ud.
Appuyez à nouveau sur \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} pour quitter le mode \textit{Ajout}. Appuyez à nouveau sur \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} pour quitter le mode \textit{Ajout}.
Vous avez créé votre premier bief, avec un n½ud amont et un n½ud aval. Vous avez créé votre premier bief, avec un n\oe{}ud amont et un n\oe{}ud aval.
Dans la partie inférieure de la fenêtre \textit{Réseau}, vous pouvez renommer les n½uds et les biefs. Dans la partie inférieure de la fenêtre \textit{Réseau}, vous pouvez renommer les n\oe{}uds et les biefs.
Comme le bief que nous avons créé est automatiquement sélectionné, toutes les étapes suivantes s'appliqueront à ce bief. Comme le bief que nous avons créé est automatiquement sélectionné, toutes les étapes suivantes s'appliqueront à ce bief.
La fenêtre doit se présenter comme suit : La fenêtre doit se présenter comme suit :
@@ -154,7 +156,7 @@ Fermez la fen
\section{Éditer la géométrie de la rivière} \section{Éditer la géométrie de la rivière}
Cliquez sur \texttt{[Géométrie] => [Éditer la géométrie]} ou sur l'icône \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/geometry.png} pour définir la géométrie du bief sélectionné. Cliquez sur \texttt{[Géométrie] => [Modifier la géométrie]} ou sur l'icône \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/geometry.png} pour définir la géométrie du bief sélectionné.
Pour Importer une géométrie depuis un fichier, cliquez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/import.png}. Pour Importer une géométrie depuis un fichier, cliquez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/import.png}.
Sélectionnez le fichier \texttt{Data/Bief\_1.st}. Sélectionnez le fichier \texttt{Data/Bief\_1.st}.
Vous devriez voir : Vous devriez voir :
@@ -237,8 +239,8 @@ Nous pouvons cliquer sur la nouvelle ligne pour s
Ici, nous définirons le débit mesuré lors de la crue de février 2002. Ici, nous définirons le débit mesuré lors de la crue de février 2002.
Sélectionnez la cellule \textit{Nom} pour donner un nom à la condition limite par exemple "crue2002". Sélectionnez la cellule \textit{Nom} pour donner un nom à la condition limite par exemple "crue2002".
Sélectionner la cellule \textit{Type} et utiliser la combo box pour mettre une loi \textit{Q(t)} : débit en fonction du temps (hydrogramme). Sélectionner la cellule \textit{Type} et utiliser la combo box pour mettre une loi \textit{Q(t)} : débit en fonction du temps (hydrogramme).
Sélectionnez la cellule \textit{N½ud} et attribuez cette condition au n½ud amont. Sélectionnez la cellule \textit{n\oe{}ud} et attribuez cette condition au n\oe{}ud amont.
Les noms des n½uds sont rappelés dans le panneau de droite, avec une vue du réseau. Les noms des n\oe{}uds sont rappelés dans le panneau de droite, avec une vue du réseau.
Sélectionnez maintenant la ligne entière et cliquez sur le bouton d'édition \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"}. Sélectionnez maintenant la ligne entière et cliquez sur le bouton d'édition \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"}.
Vous avez ouvert la fenêtre \textit{Éditer les conditions aux limites}. Vous avez ouvert la fenêtre \textit{Éditer les conditions aux limites}.
Dans un éditeur de texte, ouvrez le fichier \texttt{data/Fevrier\_2002.txt}. Dans un éditeur de texte, ouvrez le fichier \texttt{data/Fevrier\_2002.txt}.
@@ -250,7 +252,7 @@ Vous pouvez maintenant voir la courbe de d
\par\end{center} \par\end{center}
Fermez cette fenêtre. Revenez sur la fenêtre \textit{Conditions aux limites}. Fermez cette fenêtre. Revenez sur la fenêtre \textit{Conditions aux limites}.
Ajoutez une nouvelle ligne, donnez lui un nom, donnez lui le type \textit{Z(T)} (limnigramme) et associez là au n½ud aval du réseau. Ajoutez une nouvelle ligne, donnez lui un nom, donnez lui le type \textit{Z(T)} (limnigramme) et associez là au n\oe{}ud aval du réseau.
Ouvrez la fenêtre d'édition des conditions aux limites (\includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"}). Ouvrez la fenêtre d'édition des conditions aux limites (\includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"}).
Ajoutez deux lignes et rentrez les valeurs suivantes : Ajoutez deux lignes et rentrez les valeurs suivantes :
\begin{center} \begin{center}
@@ -271,7 +273,7 @@ Vous pouvez fermer les fen
% Cette condition limite se trouve au niveau d'un seuil. % Cette condition limite se trouve au niveau d'un seuil.
% A cet endroit, l'écoulement passe d'un régime fluvial à un régime torentiel. % A cet endroit, l'écoulement passe d'un régime fluvial à un régime torentiel.
% Nous allons donc calculer une courbe de tarage qui correspond au régime critique de l'écoulement au niveau du seuil. % Nous allons donc calculer une courbe de tarage qui correspond au régime critique de l'écoulement au niveau du seuil.
% Sélectionnez la condition limite et ouvrez la fenêtre \textit{Éditer les conditions aux limites} : (\includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"}). % Sélectionnez la condition limite et ouvrez la fenêtre \textit{Éditer les conditions aux limites} : (\includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"}).
% Dans la fenêtre \textit{Éditer les conditions aux limites} cliquez sur \texttt{[Générer régime critique]} pour générer cette courbe. % Dans la fenêtre \textit{Éditer les conditions aux limites} cliquez sur \texttt{[Générer régime critique]} pour générer cette courbe.
% Cliquez ensuite sur \texttt{[Rendre croissant]} pour suprimer les points de la courbe qui ne sont pas strictement croissants. % Cliquez ensuite sur \texttt{[Rendre croissant]} pour suprimer les points de la courbe qui ne sont pas strictement croissants.
% Vous pouvez fermer les fenêtres \textit{Éditer les conditions aux limites} et \textit{Conditions aux limites}. % Vous pouvez fermer les fenêtres \textit{Éditer les conditions aux limites} et \textit{Conditions aux limites}.
@@ -400,19 +402,19 @@ Si vous r
\section{Paramètres du solveur} \section{Paramètres du solveur}
Dans la fenêtre principale, cliquez sur \texttt{[Exécuter] => [Parameters numériques des solveurs]}. Dans la fenêtre principale, cliquez sur \texttt{[Exécuter] => [Paramètres numériques des solveurs]}.
Dans la fenêtre \textit{Paramètres du solveur}, sélectionnez l'onglet \texttt{[Mage v8]}. Dans la fenêtre \textit{Paramètres du solveur}, sélectionnez l'onglet \texttt{[Mage v8]}.
Ces paramètres pilotent le comportement du solveur numérique. Ces paramètres pilotent le comportement du solveur numérique.
la valeur 999:99:00:00 du temps final indique au solveur de s'arrêter lorsqu'il a atteint un régime permanent. la valeur {\NoAutoSpacing 999:99:00:00} du temps final indique au solveur de s'arrêter lorsqu'il a atteint un régime permanent.
Vous pouvez changer la fréquence d'écriture des résultats dans la ligne \textit{Pas de temps d'écriture dans le fichier .BIN}. Vous pouvez changer la fréquence d'écriture des résultats dans la ligne \textit{Pas de temps d'écriture dans le fichier .BIN}.
Une valeur inférieure à 1 seconde indique que la valeur de la ligne \textit{Pas de temps d'écriture dans le fichier .TRA} s sera prise à la place. Une valeur inférieure à 1 seconde indique que la valeur de la ligne \textit{Pas de temps d'écriture dans le fichier .TRA} s sera prise à la place.
% En effet, durant la montée du pic de crue, le solveur a besoin de réduire le pas de temps suffisament pour permettre la convergence des itérations. % En effet, durant la montée du pic de crue, le solveur a besoin de réduire le pas de temps suffisament pour permettre la convergence des itérations.
Pour accélérer les calculs et pour aider le solveur à démarer, nous allons l'autoriser à dégrader la précision, à l'aide des facteurs de réduction de la précision. Pour accélérer les calculs et pour aider le solveur à démarrer, nous allons l'autoriser à dégrader la précision, à l'aide des facteurs de réduction de la précision.
Les précisions internes du solveur sont de 10$^{-9}$. Les précisions internes du solveur sont de 10$^{-9}$.
Cette précision est multipliée par le facteur de réduction de la précision : un facteur de 1000 ramènera donc la précision à 10$^{-5}$. Cette précision est multipliée par le facteur de réduction de la précision : un facteur de 1000 ramènera donc la précision à 10$^{-5}$.
Pour utiliser ce facteur de réduction de la précision, il faut donner un \textit{nombre d'itérations à précision maximum} inférieur au \textit{nombre maximum d'itérations} : le solveur va d'abord tenter de converger avec un certain nombre d'itératons à la précision maximum avant de basculer sur une précision dégradée pour le reste des itérations. Pour utiliser ce facteur de réduction de la précision, il faut donner un \textit{nombre d'itérations à précision maximum} inférieur au \textit{nombre maximum d'itérations} : le solveur va d'abord tenter de converger avec un certain nombre d'itératons à la précision maximum avant de basculer sur une précision dégradée pour le reste des itérations.
Dans notre cas, c'est nécessaire pour lancer le solveur à partir de la condition initiale calculée par Pamhyr2. Dans notre cas, c'est nécessaire pour lancer le solveur à partir de la condition initiale calculée par Pamhyr2.
rentrez 1000 dans les trois lignes \textit{facteurs de réduction de la précision}, rentrez 99 pour le \textit{Nombre d'itérations} et 5 pour le \textit{nombre d'itérations à la précision maximum}. Rentrez 1000 dans les trois lignes \textit{facteurs de réduction de la précision}, rentrez 99 pour le \textit{Nombre maximum d'itérations} et 5 pour le \textit{nombre d'itérations à la précision maximum}.
Gardez les autres paramètres du solveur par défaut. Gardez les autres paramètres du solveur par défaut.
Fermer la fenêtre \textit{Paramètres du solveur}. Fermer la fenêtre \textit{Paramètres du solveur}.
@@ -426,12 +428,13 @@ Cette fen
\section{Visualiser les résultats} \section{Visualiser les résultats}
il est aussi possible d'ouvrir la fenêtre \textit{Résultats} si vous avez fermé la fenêtre \textit{Log du solveur}, en cliquant sur \texttt{[Résultats] => [Visualiser les derniers résultats]} à partir de la fenêtre principale. Il est aussi possible d'ouvrir la fenêtre \textit{Résultats} si vous avez fermé la fenêtre \textit{Log du solveur}, en cliquant sur \texttt{[Résultats] => [Visualiser les derniers résultats]} à partir de la fenêtre principale.
Le panneau supérieur vous permet de sélectionner le bief, le panneau inférieur gauche vous permet de sélectionner une section dans ce bief. Le panneau supérieur vous permet de sélectionner le bief, le panneau inférieur gauche vous permet de sélectionner une section dans ce bief.
Les trois diagrammes sur la droite montrent le bief et la section en travers de la même manière que dans la fenêtre \textit{Géométrie}. Les trois diagrammes sur la droite montrent le bief et la section en travers de la même manière que dans la fenêtre \textit{Géométrie}.
Vous pouvez utiliser le curseur du bas pour visualiser les résultats à différents pas de temps. Vous pouvez utiliser le curseur du bas pour visualiser les résultats à différents pas de temps.
Les croix rouges dans les deux vues du haut correspondent aux points ou l'eau déborde de la géométrie au moins une fois dans la simulation. Les croix rouges dans les deux vues du haut correspondent aux points ou l'eau déborde de la géométrie au moins une fois dans la simulation.
En pratique il n'y a pas de perte de volume par débordement en dehors du modèle, car le solveur ajoute un mur virtuel aux extrémités des sections. En pratique il n'y a pas de perte de volume par débordement en dehors du modèle, car le solveur ajoute un mur virtuel aux extrémités des sections.
Pour visualiser le débit, passez à l'onglet \textit{Hydrogramme}. Pour visualiser le débit, passez à l'onglet \textit{Hydrogramme}.
Pour créer des tracés 2D personnalisés, cliquez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} en haut à gauche de la fenêtre. Pour créer des tracés 2D personnalisés, cliquez sur le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/add.png} en haut à gauche de la fenêtre.
Sélectionnez les valeurs que vous voulez sur les axes $X$ et $Y$ et cliquez sur \texttt{[OK]}. Sélectionnez les valeurs que vous voulez sur les axes $X$ et $Y$ et cliquez sur \texttt{[OK]}.
@@ -440,4 +443,3 @@ Le bouton \includegraphics[width=0.5cm]{../../../src/View/ui/ressources/export.p
\pagebreak{} \pagebreak{}
\end{document} \end{document}
File renamed without changes.
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
$Clapet_001 clapet
Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.
+4
View File
@@ -46,6 +46,10 @@ copy /y ..\mage8-windows\mage_extraire.exe pamhyr\mage8\
copy /y ..\mage8-windows\mailleurTT.exe pamhyr\mage8\ copy /y ..\mage8-windows\mailleurTT.exe pamhyr\mage8\
copy /y ..\mage8-windows\libbief.dll pamhyr\mage8\ copy /y ..\mage8-windows\libbief.dll pamhyr\mage8\
rem adists
mkdir pamhyr\adists
copy /y ..\adists-windows\adists.exe pamhyr\adists\
rem Copy tests_cases rem Copy tests_cases
mkdir pamhyr\tests_cases mkdir pamhyr\tests_cases
mkdir pamhyr\tests_cases\Saar mkdir pamhyr\tests_cases\Saar
+52
View File
@@ -0,0 +1,52 @@
# Adists.py -- Pamhyr study checkers
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import time
import logging
from functools import reduce
from PyQt5.QtCore import QCoreApplication
from Modules import Modules
from Checker.Checker import AbstractModelChecker, STATUS
_translate = QCoreApplication.translate
logger = logging.getLogger()
class AdistsOutputRKChecker(AbstractModelChecker):
def __init__(self):
super(AdistsOutputRKChecker, self).__init__()
self._name = _translate("Checker", "AdisTS output RK checker")
self._description = _translate(
"Checker", "Check output RK"
)
self._modules = Modules.OUTPUT_RK
def run(self, study):
ok = True
nerror = 0
self._summary = "ok"
self._status = STATUS.OK
if not self.basic_check(study):
return False
return ok
+1 -1
View File
@@ -395,7 +395,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
logger.info( logger.info(
f"! {self._exe_path()} " + f"! {self._exe_path()} " +
f"{st_file} {m_file} " + f"{st_file} {m_file} " +
f"update_kp " + f"update_rk " +
f"{str(step)} " + f"{str(step)} " +
f"{limites[0]} {limites[1]} " + f"{limites[0]} {limites[1]} " +
f"{directrices[0]} {directrices[1]} " + f"{directrices[0]} {directrices[1]} " +
@@ -128,7 +128,8 @@ class BoundaryCondition(SQLSubModel):
bc.node = None bc.node = None
if row[3] != -1: if row[3] != -1:
bc.node = next(filter(lambda n: n.id == row[3], data["nodes"])) bc.node = next(filter(lambda n: n.id == row[3], data["nodes"]),
None)
values = execute( values = execute(
"SELECT ind, data0, data1 FROM boundary_condition_data " + "SELECT ind, data0, data1 FROM boundary_condition_data " +
@@ -0,0 +1,224 @@
# BoundaryConditionsAdisTS.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import logging
from tools import (
trace, timer,
old_pamhyr_date_to_timestamp,
date_iso_to_timestamp,
date_dmy_to_timestamp,
)
from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError
logger = logging.getLogger()
class BoundaryConditionAdisTS(SQLSubModel):
_sub_classes = []
_id_cnt = 0
def __init__(self, id: int = -1,
pollutant: int = -1, status=None):
super(BoundaryConditionAdisTS, self).__init__()
self._status = status
if id == -1:
self.id = BoundaryConditionAdisTS._id_cnt
else:
self.id = id
self._type = ""
self._node = None
self._pollutant = pollutant
self._data = []
self._header = []
self._types = [self.time_convert, float]
BoundaryConditionAdisTS._id_cnt = max(
BoundaryConditionAdisTS._id_cnt + 1, self.id)
@classmethod
def _db_create(cls, execute):
execute("""
CREATE TABLE boundary_condition_adists(
id INTEGER NOT NULL PRIMARY KEY,
pollutant INTEGER NOT NULL,
type TEXT NOT NULL,
node INTEGER,
FOREIGN KEY(pollutant) REFERENCES Pollutants(id),
FOREIGN KEY(node) REFERENCES river_node(id)
)
""")
execute("""
CREATE TABLE boundary_condition_data_adists(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
data0 TEXT NOT NULL,
data1 TEXT NOT NULL,
bc INTEGER,
FOREIGN KEY(bc) REFERENCES boundary_condition_adists(id)
)
""")
return cls._create_submodel(execute)
@classmethod
def _db_update(cls, execute, version):
return True
@classmethod
def _db_load(cls, execute, data=None):
new = []
table = execute(
"SELECT id, pollutant, type, node " +
"FROM boundary_condition_adists"
)
if table is not None:
for row in table:
bc = cls(
id=row[0],
pollutant=row[1],
status=data['status']
)
bc.type = row[2]
bc.node = None
if row[3] != -1:
tmp = next(filter(
lambda n: n.id == row[3], data["nodes"]),
None)
if tmp is not None:
bc.node = tmp.id
else:
bc.node = -1
values = execute(
"SELECT data0, data1 FROM " +
"boundary_condition_data_adists " +
f"WHERE bc = '{bc.id}'"
)
# Write data
for v in values:
data0 = bc._types[0](v[0])
data1 = bc._types[1](v[1])
# Replace data at pos ind
bc._data.append((data0, data1))
new.append(bc)
return new
def _db_save(self, execute, data=None):
execute(f"DELETE FROM boundary_condition_adists WHERE id = {self.id}")
execute(f"DELETE FROM boundary_condition_data_adists" +
f" WHERE bc = {self.id}")
node = -1
if self._node is not None:
node = self._node
sql = (
"INSERT INTO " +
"boundary_condition_adists(id, pollutant, type, node) " +
"VALUES (" +
f"{self.id}, {self._pollutant}, " +
f"'{self._db_format(self._type)}', {node}" +
")"
)
execute(sql)
for d in self._data:
data0 = self._db_format(str(d[0]))
data1 = self._db_format(str(d[1]))
sql = (
"INSERT INTO " +
"boundary_condition_data_adists(data0, data1, bc) " +
f"VALUES ('{data0}', {data1}, {self.id})"
)
execute(sql)
return True
def __len__(self):
return len(self._data)
@classmethod
def time_convert(cls, data):
if type(data) is str:
if data.count("-") == 2:
return date_iso_to_timestamp(data)
if data.count("/") == 2:
return date_dmy_to_timestamp(data)
if data.count(":") == 3:
return old_pamhyr_date_to_timestamp(data)
if data.count(":") == 2:
return old_pamhyr_date_to_timestamp("00:" + data)
if data.count(".") == 1:
return round(float(data))
return int(data)
@property
def node(self):
return self._node
@node.setter
def node(self, node):
self._node = node
self._status.modified()
@property
def header(self):
return self._header.copy()
@header.setter
def header(self, header):
self._header = header
self._status.modified()
@property
def pollutant(self):
return self._pollutant
@pollutant.setter
def pollutant(self, pollutant):
self._pollutant = pollutant
self._status.modified()
@property
def type(self):
return self._type
@type.setter
def type(self, type):
self._type = type
self._status.modified()
@property
def data(self):
return self._data.copy()
@@ -0,0 +1,67 @@
# BoundaryConditionsAdisTSList.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
from copy import copy
from tools import trace, timer
from Model.Tools.PamhyrList import PamhyrModelList
from Model.Except import NotImplementedMethodeError
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS \
import BoundaryConditionAdisTS
class BoundaryConditionsAdisTSList(PamhyrModelList):
_sub_classes = [
BoundaryConditionAdisTS,
]
@classmethod
def _db_load(cls, execute, data=None):
new = cls(status=data['status'])
if data is None:
data = {}
new._lst = BoundaryConditionAdisTS._db_load(
execute, data
)
return new
def _db_save(self, execute, data=None):
execute("DELETE FROM boundary_condition_adists")
execute("DELETE FROM boundary_condition_data_adists")
if data is None:
data = {}
for bc in self._lst:
bc._db_save(execute, data=data)
return True
def new(self, index, pollutant):
n = BoundaryConditionAdisTS(pollutant=pollutant, status=self._status)
self._lst.insert(index, n)
self._status.modified()
return n
@property
def BCs_AdisTS_List(self):
return self.lst
+196
View File
@@ -0,0 +1,196 @@
# D90AdisTS.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import logging
from functools import reduce
from tools import trace, timer, old_pamhyr_date_to_timestamp
from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError
from Model.D90AdisTS.D90AdisTSSpec import D90AdisTSSpec
logger = logging.getLogger()
class D90AdisTS(SQLSubModel):
_sub_classes = [
D90AdisTSSpec,
]
_id_cnt = 0
def __init__(self, id: int = -1, name: str = "default",
status=None):
super(D90AdisTS, self).__init__()
self._status = status
if id == -1:
self.id = D90AdisTS._id_cnt
else:
self.id = id
self._name = name
self._d90 = None
self._enabled = True
self._data = []
D90AdisTS._id_cnt = max(
D90AdisTS._id_cnt + 1,
self.id
)
@classmethod
def _db_create(cls, execute):
execute("""
CREATE TABLE d90_adists(
id INTEGER NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
d90 REAL NOT NULL,
enabled BOOLEAN NOT NULL
)
""")
return cls._create_submodel(execute)
@classmethod
def _db_update(cls, execute, version):
major, minor, release = version.strip().split(".")
if major == 0 and minor < 1:
if int(release) < 6:
cls._db_create(execute)
return True
@classmethod
def _db_load(cls, execute, data=None):
new = []
table = execute(
"SELECT id, name, d90, enabled " +
"FROM d90_adists"
)
if table is not None:
for row in table:
d90_id = row[0]
name = row[1]
d90 = row[2]
enabled = (row[3] == 1)
D90 = cls(
id=d90_id,
name=name,
status=data['status']
)
D90.d90 = d90
D90.enabled = enabled
data['d90_default_id'] = d90_id
D90._data = D90AdisTSSpec._db_load(execute, data)
new.append(D90)
return new
def _db_save(self, execute, data=None):
execute(f"DELETE FROM d90_adists WHERE id = {self.id}")
d90 = -1.
if self.d90 is not None:
d90 = self.d90
sql = (
"INSERT INTO " +
"d90_adists(" +
"id, name, d90, enabled" +
") " +
"VALUES (" +
f"{self.id}, '{self._db_format(self._name)}', " +
f"{d90}, {self._enabled}" +
")"
)
execute(sql)
data['d90_default_id'] = self.id
execute(
"DELETE FROM d90_spec " +
f"WHERE d90_default = {self.id}"
)
for d90_spec in self._data:
d90_spec._db_save(execute, data)
return True
def __len__(self):
return len(self._data)
@property
def name(self):
return self._name
@name.setter
def name(self, name):
self._name = name
self._status.modified()
@property
def d90(self):
return self._d90
@d90.setter
def d90(self, d90):
self._d90 = d90
self._status.modified()
@property
def enabled(self):
return self._enabled
@enabled.setter
def enabled(self, enabled):
self._enabled = enabled
self._status.modified()
def new(self, index):
n = D90AdisTSSpec(status=self._status)
self._data.insert(index, n)
self._status.modified()
return n
def delete(self, data):
self._data = list(
filter(
lambda x: x not in data,
self._data
)
)
self._status.modified()
def delete_i(self, indexes):
for ind in indexes:
del self._data[ind]
self._status.modified()
def insert(self, index, data):
self._data.insert(index, data)
self._status.modified()
+63
View File
@@ -0,0 +1,63 @@
# D90AdisTSList.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
from copy import copy
from tools import trace, timer
from Model.Tools.PamhyrList import PamhyrModelList
from Model.D90AdisTS.D90AdisTS import D90AdisTS
class D90AdisTSList(PamhyrModelList):
_sub_classes = [
D90AdisTS,
]
@classmethod
def _db_load(cls, execute, data=None):
new = cls(status=data['status'])
if data is None:
data = {}
new._lst = D90AdisTS._db_load(
execute, data
)
return new
def _db_save(self, execute, data=None):
execute("DELETE FROM d90_adists")
if data is None:
data = {}
for d90 in self._lst:
d90._db_save(execute, data=data)
return True
def new(self, index):
n = D90AdisTS(status=self._status)
self._lst.insert(index, n)
self._status.modified()
return n
@property
def D90_AdisTS_List(self):
return self.lst
+193
View File
@@ -0,0 +1,193 @@
# D90AdisTSSpec.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import logging
from tools import trace, timer
from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError
logger = logging.getLogger()
class D90AdisTSSpec(SQLSubModel):
_sub_classes = [
]
_id_cnt = 0
def __init__(self, id: int = -1, name: str = "",
status=None):
super(D90AdisTSSpec, self).__init__()
self._status = status
if id == -1:
self.id = D90AdisTSSpec._id_cnt
else:
self.id = id
self._name_section = name
self._reach = None
self._start_rk = None
self._end_rk = None
self._d90 = None
self._enabled = True
D90AdisTSSpec._id_cnt = max(D90AdisTSSpec._id_cnt + 1, self.id)
@classmethod
def _db_create(cls, execute):
execute("""
CREATE TABLE d90_spec(
id INTEGER NOT NULL PRIMARY KEY,
d90_default INTEGER NOT NULL,
name TEXT NOT NULL,
reach INTEGER NOT NULL,
start_rk REAL NOT NULL,
end_rk REAL NOT NULL,
d90 REAL NOT NULL,
enabled BOOLEAN NOT NULL,
FOREIGN KEY(d90_default) REFERENCES d90_adists(id),
FOREIGN KEY(reach) REFERENCES river_reach(id)
)
""")
return cls._create_submodel(execute)
@classmethod
def _db_update(cls, execute, version):
major, minor, release = version.strip().split(".")
if major == 0 and minor < 1:
if int(release) < 6:
cls._db_create(execute)
return True
@classmethod
def _db_load(cls, execute, data=None):
new = []
table = execute(
"SELECT id, d90_default, name, reach, start_rk, end_rk, " +
"d90, enabled " +
"FROM d90_spec " +
f"WHERE d90_default = {data['d90_default_id']} "
)
if table is not None:
for row in table:
id = row[0]
name = row[2]
reach = row[3]
start_rk = row[4]
end_rk = row[5]
d90 = row[6]
enabled = (row[7] == 1)
new_spec = cls(
id=id,
name=name,
status=data['status']
)
new_spec.reach = reach
new_spec.start_rk = start_rk
new_spec.end_rk = end_rk
new_spec.d90 = d90
new_spec.enabled = enabled
new.append(new_spec)
return new
def _db_save(self, execute, data=None):
d90_default = data['d90_default_id']
sql = (
"INSERT INTO " +
"d90_spec(id, d90_default, name, reach, " +
"start_rk, end_rk, d90, enabled) " +
"VALUES (" +
f"{self.id}, " +
f"{d90_default}, " +
f"'{self._db_format(self._name_section)}', " +
f"{self._reach}, " +
f"{self._start_rk}, " +
f"{self._end_rk}, " +
f"{self._d90}, " +
f"{self._enabled}" +
")"
)
execute(sql)
return True
@property
def name(self):
return self._name_section
@name.setter
def name(self, name):
self._name_section = name
self._status.modified()
@property
def reach(self):
return self._reach
@reach.setter
def reach(self, reach):
self._reach = reach
self._status.modified()
@property
def start_rk(self):
return self._start_rk
@start_rk.setter
def start_rk(self, start_rk):
self._start_rk = start_rk
self._status.modified()
@property
def end_rk(self):
return self._end_rk
@end_rk.setter
def end_rk(self, end_rk):
self._end_rk = end_rk
self._status.modified()
@property
def d90(self):
return self._d90
@d90.setter
def d90(self, d90):
self._d90 = d90
self._status.modified()
@property
def enabled(self):
return self._enabled
@enabled.setter
def enabled(self, enabled):
self._enabled = enabled
self._status.modified()
+253
View File
@@ -0,0 +1,253 @@
# DIFAdisTS.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import logging
from functools import reduce
from tools import trace, timer, old_pamhyr_date_to_timestamp
from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError
from Model.DIFAdisTS.DIFAdisTSSpec import DIFAdisTSSpec
logger = logging.getLogger()
class DIFAdisTS(SQLSubModel):
_sub_classes = [
DIFAdisTSSpec,
]
_id_cnt = 0
def __init__(self, id: int = -1, name: str = "default",
status=None):
super(DIFAdisTS, self).__init__()
self._status = status
if id == -1:
self.id = DIFAdisTS._id_cnt
else:
self.id = id
self._name = name
self._method = None
self._dif = None
self._b = None
self._c = None
self._enabled = True
self._types = ["iwasa", "fisher", "elder", "constante", "generique"]
self._data = []
DIFAdisTS._id_cnt = max(
DIFAdisTS._id_cnt + 1,
self.id
)
@classmethod
def _db_create(cls, execute):
execute("""
CREATE TABLE dif_adists(
id INTEGER NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
method TEXT NOT NULL,
dif REAL NOT NULL,
b REAL,
c REAL,
enabled BOOLEAN NOT NULL
)
""")
return cls._create_submodel(execute)
@classmethod
def _db_update(cls, execute, version):
major, minor, release = version.strip().split(".")
if major == 0 and minor < 1:
if int(release) < 6:
cls._db_create(execute)
return True
@classmethod
def _db_load(cls, execute, data=None):
new = []
table = execute(
"SELECT id, name, method, dif, b, c, enabled " +
"FROM dif_adists"
)
if table is not None:
for row in table:
dif_id = row[0]
name = row[1]
method = row[2]
dif = row[3]
b = row[4]
c = row[5]
enabled = (row[6] == 1)
DIF = cls(
id=dif_id,
name=name,
status=data['status']
)
DIF.method = method
DIF.dif = dif
DIF.b = b
DIF.c = c
DIF.enabled = enabled
data['dif_default_id'] = dif_id
DIF._data = DIFAdisTSSpec._db_load(execute, data)
new.append(DIF)
return new
def _db_save(self, execute, data=None):
execute(f"DELETE FROM dif_adists WHERE id = {self.id}")
method = ""
if self.method is not None:
method = self.method
dif = -1.
if self.dif is not None:
dif = self.dif
b = -1.
if self.b is not None:
b = self.b
c = -1.
if self.dif is not None:
c = self.c
sql = (
"INSERT INTO " +
"dif_adists(" +
"id, name, method, dif, b, c, enabled" +
") " +
"VALUES (" +
f"{self.id}, '{self._db_format(self._name)}', " +
f"'{self._db_format(self._method)}', " +
f"{dif}, {b}, {c}, {self._enabled}" +
")"
)
execute(sql)
data['dif_default_id'] = self.id
execute(
"DELETE FROM dif_spec " +
f"WHERE dif_default = {self.id}"
)
for dif_spec in self._data:
dif_spec._db_save(execute, data)
return True
def __len__(self):
return len(self._data)
@property
def name(self):
return self._name
@name.setter
def name(self, name):
self._name = name
self._status.modified()
@property
def method(self):
return self._method
@method.setter
def method(self, method):
self._method = method
self._status.modified()
@property
def types(self):
return self._types
@property
def dif(self):
return self._dif
@dif.setter
def dif(self, dif):
self._dif = dif
self._status.modified()
@property
def b(self):
return self._b
@b.setter
def b(self, b):
self._b = b
self._status.modified()
@property
def c(self):
return self._c
@c.setter
def c(self, c):
self._c = c
self._status.modified()
@property
def enabled(self):
return self._enabled
@enabled.setter
def enabled(self, enabled):
self._enabled = enabled
self._status.modified()
def new(self, index):
n = DIFAdisTSSpec(status=self._status)
self._data.insert(index, n)
self._status.modified()
return n
def delete(self, data):
self._data = list(
filter(
lambda x: x not in data,
self._data
)
)
self._status.modified()
def delete_i(self, indexes):
for ind in indexes:
del self._data[ind]
self._status.modified()
def insert(self, index, data):
self._data.insert(index, data)
self._status.modified()
+63
View File
@@ -0,0 +1,63 @@
# DIFAdisTSList.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
from copy import copy
from tools import trace, timer
from Model.Tools.PamhyrList import PamhyrModelList
from Model.DIFAdisTS.DIFAdisTS import DIFAdisTS
class DIFAdisTSList(PamhyrModelList):
_sub_classes = [
DIFAdisTS,
]
@classmethod
def _db_load(cls, execute, data=None):
new = cls(status=data['status'])
if data is None:
data = {}
new._lst = DIFAdisTS._db_load(
execute, data
)
return new
def _db_save(self, execute, data=None):
execute("DELETE FROM dif_adists")
if data is None:
data = {}
for dif in self._lst:
dif._db_save(execute, data=data)
return True
def new(self, index):
n = DIFAdisTS(status=self._status)
self._lst.insert(index, n)
self._status.modified()
return n
@property
def DIF_AdisTS_List(self):
return self.lst
+221
View File
@@ -0,0 +1,221 @@
# DIFAdisTSSpec.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import logging
from tools import trace, timer
from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError
logger = logging.getLogger()
class DIFAdisTSSpec(SQLSubModel):
_sub_classes = [
]
_id_cnt = 0
def __init__(self, id: int = -1, method: str = "",
status=None):
super(DIFAdisTSSpec, self).__init__()
self._status = status
if id == -1:
self.id = DIFAdisTSSpec._id_cnt
else:
self.id = id
self._method = method
self._reach = None
self._start_rk = None
self._end_rk = None
self._dif = None
self._b = None
self._c = None
self._enabled = True
DIFAdisTSSpec._id_cnt = max(DIFAdisTSSpec._id_cnt + 1, self.id)
@classmethod
def _db_create(cls, execute):
execute("""
CREATE TABLE dif_spec(
id INTEGER NOT NULL PRIMARY KEY,
dif_default INTEGER NOT NULL,
method TEXT NOT NULL,
reach INTEGER NOT NULL,
start_rk REAL NOT NULL,
end_rk REAL NOT NULL,
dif REAL NOT NULL,
b REAL,
c REAL,
enabled BOOLEAN NOT NULL,
FOREIGN KEY(dif_default) REFERENCES dif_adists(id),
FOREIGN KEY(reach) REFERENCES river_reach(id)
)
""")
return cls._create_submodel(execute)
@classmethod
def _db_update(cls, execute, version):
major, minor, release = version.strip().split(".")
if major == 0 and minor < 1:
if int(release) < 6:
cls._db_create(execute)
return True
@classmethod
def _db_load(cls, execute, data=None):
new = []
table = execute(
"SELECT id, dif_default, method, reach, start_rk, end_rk, " +
"dif, b, c, enabled " +
"FROM dif_spec " +
f"WHERE dif_default = {data['dif_default_id']} "
)
if table is not None:
for row in table:
id = row[0]
method = row[2]
reach = row[3]
start_rk = row[4]
end_rk = row[5]
dif = row[6]
b = row[7]
c = row[8]
enabled = (row[9] == 1)
new_spec = cls(
id=id,
method=method,
status=data['status']
)
new_spec.reach = reach
new_spec.start_rk = start_rk
new_spec.end_rk = end_rk
new_spec.dif = dif
new_spec.b = b
new_spec.c = c
new_spec.enabled = enabled
new.append(new_spec)
return new
def _db_save(self, execute, data=None):
dif_default = data['dif_default_id']
sql = (
"INSERT INTO " +
"dif_spec(id, dif_default, method, reach, " +
"start_rk, end_rk, dif, b, c, enabled) " +
"VALUES (" +
f"{self.id}, " +
f"{dif_default}, " +
f"'{self._db_format(self._method)}', " +
f"{self._reach}, " +
f"{self._start_rk}, " +
f"{self._end_rk}, " +
f"{self._dif}, " +
f"{self._b}, " +
f"{self._c}, " +
f"{self._enabled}" +
")"
)
execute(sql)
return True
@property
def method(self):
return self._method
@method.setter
def method(self, method):
self._method = method
self._status.modified()
@property
def reach(self):
return self._reach
@reach.setter
def reach(self, reach):
self._reach = reach
self._status.modified()
@property
def start_rk(self):
return self._start_rk
@start_rk.setter
def start_rk(self, start_rk):
self._start_rk = start_rk
self._status.modified()
@property
def end_rk(self):
return self._end_rk
@end_rk.setter
def end_rk(self, end_rk):
self._end_rk = end_rk
self._status.modified()
@property
def dif(self):
return self._dif
@dif.setter
def dif(self, dif):
self._dif = dif
self._status.modified()
@property
def b(self):
return self._b
@b.setter
def b(self, b):
self._b = b
self._status.modified()
@property
def c(self):
return self._c
@c.setter
def c(self, c):
self._c = c
self._status.modified()
@property
def enabled(self):
return self._enabled
@enabled.setter
def enabled(self, enabled):
self._enabled = enabled
self._status.modified()
+97 -13
View File
@@ -20,6 +20,7 @@ import logging
import numpy as np import numpy as np
from typing import List from typing import List
from functools import reduce from functools import reduce
from dataclasses import dataclass
from tools import timer from tools import timer
from shapely import geometry from shapely import geometry
@@ -33,6 +34,13 @@ from Model.Geometry.Vector_1d import Vector1d
logger = logging.getLogger() logger = logging.getLogger()
@dataclass
class Tabulation:
z: np.array([])
A: np.array([])
L: np.array([])
class ProfileXYZ(Profile, SQLSubModel): class ProfileXYZ(Profile, SQLSubModel):
_sub_classes = [ _sub_classes = [
PointXYZ, PointXYZ,
@@ -70,6 +78,14 @@ class ProfileXYZ(Profile, SQLSubModel):
status=status, status=status,
) )
self.tab = Tabulation([], [], [])
self.tab_up_to_date = False
self.time_z = 0.0
self.time_A = 0.0
self.time_l = 0.0
self._station = []
self.station_up_to_date = False
@classmethod @classmethod
def _db_create(cls, execute): def _db_create(cls, execute):
execute(""" execute("""
@@ -305,6 +321,8 @@ class ProfileXYZ(Profile, SQLSubModel):
pt = PointXYZ(*point, profile=self, status=self._status) pt = PointXYZ(*point, profile=self, status=self._status)
self.points.append(pt) self.points.append(pt)
self._status.modified() self._status.modified()
self.tab_up_to_date = False
self.station_up_to_date = False
def get_point_i(self, index: int) -> PointXYZ: def get_point_i(self, index: int) -> PointXYZ:
"""Get point at index. """Get point at index.
@@ -366,6 +384,8 @@ class ProfileXYZ(Profile, SQLSubModel):
point_xyz = PointXYZ(0., 0., 0., profile=self, status=self._status) point_xyz = PointXYZ(0., 0., 0., profile=self, status=self._status)
self.points.append(point_xyz) self.points.append(point_xyz)
self._status.modified() self._status.modified()
self.tab_up_to_date = False
self.station_up_to_date = False
def insert(self, index: int): def insert(self, index: int):
"""Insert a new point at index. """Insert a new point at index.
@@ -379,6 +399,8 @@ class ProfileXYZ(Profile, SQLSubModel):
point = PointXYZ(0., 0., 0., profile=self, status=self._status) point = PointXYZ(0., 0., 0., profile=self, status=self._status)
self.points.insert(index, point) self.points.insert(index, point)
self._status.modified() self._status.modified()
self.tab_up_to_date = False
self.station_up_to_date = False
return point return point
def filter_isnan(self, lst): def filter_isnan(self, lst):
@@ -410,7 +432,7 @@ class ProfileXYZ(Profile, SQLSubModel):
return abs(rg.dist(rd)) return abs(rg.dist(rd))
def wet_width(self, z): def compute_wet_width(self, z):
start, end = self.get_all_water_limits_ac(z) start, end = self.get_all_water_limits_ac(z)
if len(start) == 0: if len(start) == 0:
@@ -421,6 +443,17 @@ class ProfileXYZ(Profile, SQLSubModel):
length += abs(s - e) length += abs(s - e)
return length return length
def wet_width(self, z):
if self.tab_up_to_date:
if z > self.tab.z[-1]:
return self.tab.L[-1]
elif z < self.tab.z[0]:
return 0.0
else:
return np.interp(z, self.tab.z, self.tab.L)
else:
return self.compute_wet_width(z)
def wet_perimeter(self, z): def wet_perimeter(self, z):
lines = self.wet_lines(z) lines = self.wet_lines(z)
@@ -432,17 +465,46 @@ class ProfileXYZ(Profile, SQLSubModel):
length += line.length length += line.length
return length return length
def wet_area(self, z): def compute_wet_area(self, z):
lines = self.wet_lines(z)
if lines is None:
return 0
area = 0.0 area = 0.0
for line in lines: if len(self.tab.L) > 0:
if len(line.coords) > 2: if z < self.tab.z[0]:
poly = geometry.Polygon(line) return 0.0
area += poly.area i = np.searchsorted([z], self.tab.z, side='right')[0]
for j in range(i-1):
area += (self.tab.L[j] + self.tab.L[j+1]) * (
self.tab.z[j+1] - self.tab.z[j]) / 2.0
area += (self.tab.L[i-1] + self.wet_width(z))
else:
lines = self.wet_lines(z)
if lines is None:
return 0.0
for line in lines:
if len(line.coords) > 2:
poly = geometry.Polygon(line)
area += poly.area
return area
def wet_area(self, z):
if self.tab_up_to_date:
if z > self.tab.z[-1]:
return self.tab.A[-1] + self.tab.L[-1] * (z - self.tab.z[-1])
elif z < self.tab.z[0]:
return 0.0
else:
return np.interp(z, self.tab.z, self.tab.A)
else:
lines = self.wet_lines(z)
if lines is None:
return 0.0
area = 0.0
for line in lines:
if len(line.coords) > 2:
poly = geometry.Polygon(line)
area += poly.area
return area return area
def wet_radius(self, z): def wet_radius(self, z):
@@ -563,7 +625,7 @@ class ProfileXYZ(Profile, SQLSubModel):
return None return None
zz = list(map(lambda p: p.z, points)) zz = list(map(lambda p: p.z, points))
station = self._get_station(points) station = self.get_station()
start = [] start = []
if points[0].z <= z: if points[0].z <= z:
@@ -651,6 +713,19 @@ class ProfileXYZ(Profile, SQLSubModel):
return pt_left, pt_right return pt_left, pt_right
def compute_tabulation(self):
sorted_points = sorted(self._points, key=lambda p: p.z)
self.tab.z = np.array([p.z for p in sorted_points], np.float64)
self.tab.L = np.zeros(len(self.tab.z), np.float64)
self.tab.A = np.zeros(len(self.tab.z), np.float64)
for i in range(1, len(self.tab.z)):
self.tab.L[i] = self.compute_wet_width(self.tab.z[i])
dx = (self.tab.L[i] + self.tab.L[i-1])/2
dz = self.tab.z[i] - self.tab.z[i-1]
self.tab.A[i] = self.tab.A[i-1] + dz * dx
self.tab_up_to_date = True
def get_station(self): def get_station(self):
"""Projection of the points of the profile on a plane. """Projection of the points of the profile on a plane.
@@ -663,7 +738,12 @@ class ProfileXYZ(Profile, SQLSubModel):
if self.nb_points < 2: if self.nb_points < 2:
return [0.0] return [0.0]
else: else:
return self._get_station(self.points) if self.station_up_to_date:
return self._station
else:
self._station = self._get_station(self.points)
self.station_up_to_date = True
return self._station
@timer @timer
def _get_station(self, points): def _get_station(self, points):
@@ -799,3 +879,7 @@ class ProfileXYZ(Profile, SQLSubModel):
p.x = p.x + x p.x = p.x + x
p.y = p.y + y p.y = p.y + y
p.z = p.z + z p.z = p.z + z
def modified(self):
self.tab_up_to_date = False
self.station_up_to_date = False
@@ -64,6 +64,7 @@ class HydraulicStructure(SQLSubModel):
@classmethod @classmethod
def _db_create(cls, execute): def _db_create(cls, execute):
execute(""" execute("""
CREATE TABLE hydraulic_structures( CREATE TABLE hydraulic_structures(
id INTEGER NOT NULL PRIMARY KEY, id INTEGER NOT NULL PRIMARY KEY,
@@ -154,6 +155,7 @@ class HydraulicStructure(SQLSubModel):
return new return new
def _db_save(self, execute, data=None): def _db_save(self, execute, data=None):
print("save hs unit")
execute(f"DELETE FROM hydraulic_structures WHERE id = {self.id}") execute(f"DELETE FROM hydraulic_structures WHERE id = {self.id}")
input_reach_id = -1 input_reach_id = -1
@@ -360,26 +360,11 @@ class InitialConditions(SQLSubModel):
def get_discharge(self): def get_discharge(self):
return self._data_get("discharge") return self._data_get("discharge")
def _sort_by_z_and_rk(self, profiles):
profiles.sort(
reverse=False,
key=lambda p: p.rk
)
first_z = profiles[0].z()
last_z = profiles[-1].z()
if first_z > last_z:
profiles.sort(
reverse=True,
key=lambda p: p.rk
)
def generate_growing_constant_depth(self, height: float, def generate_growing_constant_depth(self, height: float,
compute_discharge: bool): compute_discharge: bool):
profiles = self._reach.reach.profiles.copy() profiles = self._reach.reach.profiles.copy()
self._sort_by_z_and_rk(profiles) profiles.reverse()
previous_elevation = -99999.99 previous_elevation = -99999.99
@@ -433,12 +418,12 @@ class InitialConditions(SQLSubModel):
previous_elevation = elevation previous_elevation = elevation
self._data.append(new) self._data.append(new)
self._generate_resort_data(profiles) self._data.reverse()
def generate_discharge(self, discharge: float, compute_height: bool): def generate_discharge(self, discharge: float, compute_height: bool):
profiles = self._reach.reach.profiles.copy() profiles = self._reach.reach.profiles.copy()
self._sort_by_z_and_rk(profiles) profiles.reverse()
previous_elevation = -99999.99 previous_elevation = -99999.99
@@ -491,7 +476,7 @@ class InitialConditions(SQLSubModel):
previous_elevation = elevation previous_elevation = elevation
self._data.append(new) self._data.append(new)
self._generate_resort_data(profiles) self._data.reverse()
def generate_height(self, def generate_height(self,
elevation1: float, elevation1: float,
@@ -525,13 +510,3 @@ class InitialConditions(SQLSubModel):
new["discharge"] = d new["discharge"] = d
new["elevation"] = elevation new["elevation"] = elevation
self._data.append(new) self._data.append(new)
def _generate_resort_data(self, profiles):
is_reverse = False
if profiles[0].rk > profiles[-1].rk:
is_reverse = True
self._data.sort(
reverse=not is_reverse,
key=lambda d: d['rk']
)
@@ -0,0 +1,268 @@
# InitialConditionsAdisTS.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import logging
from functools import reduce
from tools import trace, timer, old_pamhyr_date_to_timestamp
from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError
from Model.InitialConditionsAdisTS.InitialConditionsAdisTSSpec \
import ICAdisTSSpec
logger = logging.getLogger()
class InitialConditionsAdisTS(SQLSubModel):
_sub_classes = [
ICAdisTSSpec,
]
_id_cnt = 0
def __init__(self, id: int = -1, name: str = "default",
pollutant: int = -1, status=None):
super(InitialConditionsAdisTS, self).__init__()
self._status = status
if id == -1:
self.id = InitialConditionsAdisTS._id_cnt
else:
self.id = id
self._name = name
self._pollutant = pollutant
self._concentration = None
self._eg = None
self._em = None
self._ed = None
self._enabled = True
self._data = []
InitialConditionsAdisTS._id_cnt = max(
InitialConditionsAdisTS._id_cnt + 1,
self.id
)
@classmethod
def _db_create(cls, execute):
execute("""
CREATE TABLE initial_conditions_adists(
id INTEGER NOT NULL PRIMARY KEY,
pollutant INTEGER NOT NULL,
name TEXT NOT NULL,
concentration REAL NOT NULL,
eg REAL NOT NULL,
em REAL NOT NULL,
ed REAL NOT NULL,
enabled BOOLEAN NOT NULL,
FOREIGN KEY(pollutant) REFERENCES Pollutants(id)
)
""")
return cls._create_submodel(execute)
@classmethod
def _db_update(cls, execute, version):
major, minor, release = version.strip().split(".")
if major == 0 and minor < 1:
if int(release) < 6:
cls._db_create(execute)
return True
@classmethod
def _db_load(cls, execute, data=None):
new = []
table = execute(
"SELECT id, pollutant, name, concentration, eg, em, ed, " +
"enabled " +
"FROM initial_conditions_adists"
)
if table is not None:
for row in table:
IC_id = row[0]
pollutant = row[1]
name = row[2]
concentration = row[3]
eg = row[4]
em = row[5]
ed = row[6]
enabled = (row[7] == 1)
IC = cls(
id=IC_id,
name=name,
status=data['status']
)
IC.pollutant = pollutant
IC.concentration = concentration
IC.eg = eg
IC.em = em
IC.ed = ed
IC.enabled = enabled
data['ic_default_id'] = IC_id
IC._data = ICAdisTSSpec._db_load(execute, data)
new.append(IC)
return new
def _db_save(self, execute, data=None):
execute(f"DELETE FROM initial_conditions_adists WHERE id = {self.id}")
pollutant = -1
if self.pollutant is not None:
pollutant = self.pollutant
concentration = -1.
if self.concentration is not None:
concentration = self.concentration
eg = -1.
if self.eg is not None:
eg = self.eg
em = -1.
if self.em is not None:
em = self.em
ed = -1.
if self.ed is not None:
ed = self.ed
sql = (
"INSERT INTO " +
"initial_conditions_adists(" +
"id, pollutant, name, concentration, " +
"eg, em, ed, enabled" +
") " +
"VALUES (" +
f"{self.id}, {pollutant}, '{self._db_format(self._name)}', " +
f"{concentration}, {eg}, {em}, {ed}, {self._enabled}" +
")"
)
execute(sql)
data['ic_default_id'] = self.id
execute(
"DELETE FROM initial_conditions_spec " +
f"WHERE ic_default = {self.id}"
)
for ic_spec in self._data:
ic_spec._db_save(execute, data)
return True
def __len__(self):
return len(self._data)
@property
def name(self):
return self._name
@name.setter
def name(self, name):
self._name = name
self._status.modified()
@property
def pollutant(self):
return self._pollutant
@pollutant.setter
def pollutant(self, pollutant):
self._pollutant = pollutant
self._status.modified()
@property
def concentration(self):
return self._concentration
@concentration.setter
def concentration(self, concentration):
self._concentration = concentration
self._status.modified()
@property
def eg(self):
return self._eg
@eg.setter
def eg(self, eg):
self._eg = eg
self._status.modified()
@property
def em(self):
return self._em
@em.setter
def em(self, em):
self._em = em
self._status.modified()
@property
def ed(self):
return self._ed
@ed.setter
def ed(self, ed):
self._ed = ed
self._status.modified()
@property
def enabled(self):
return self._enabled
@enabled.setter
def enabled(self, enabled):
self._enabled = enabled
self._status.modified()
def new(self, index):
n = ICAdisTSSpec(status=self._status)
self._data.insert(index, n)
self._status.modified()
return n
def delete(self, data):
self._data = list(
filter(
lambda x: x not in data,
self._data
)
)
self._status.modified()
def delete_i(self, indexes):
for ind in indexes:
del self._data[ind]
self._status.modified()
def insert(self, index, data):
self._data.insert(index, data)
self._status.modified()
Loaded 100 of 220 files, more files were not shown because too many files have changed in this diff. Show more