diff-grok 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.MD +80 -31
- package/dist/index.d.ts +6 -0
- package/{index.js → dist/index.js} +2 -1
- package/dist/index.js.map +1 -0
- package/dist/src/examples/basic-use.d.ts +10 -0
- package/dist/src/examples/basic-use.js.map +1 -0
- package/dist/src/examples/check-methods.d.ts +1 -0
- package/{src → dist/src}/examples/check-methods.js +15 -3
- package/dist/src/examples/check-methods.js.map +1 -0
- package/dist/src/examples/corr-probs.d.ts +15 -0
- package/{src → dist/src}/examples/corr-probs.js +2 -2
- package/dist/src/examples/corr-probs.js.map +1 -0
- package/dist/src/examples/cyclic-model.d.ts +6 -0
- package/dist/src/examples/cyclic-model.js.map +1 -0
- package/dist/src/examples/e5.d.ts +15 -0
- package/dist/src/examples/e5.js.map +1 -0
- package/dist/src/examples/hires.d.ts +15 -0
- package/dist/src/examples/hires.js.map +1 -0
- package/dist/src/examples/index.d.ts +22 -0
- package/dist/src/examples/index.js.map +1 -0
- package/dist/src/examples/model-updates.d.ts +6 -0
- package/dist/src/examples/model-updates.js.map +1 -0
- package/dist/src/examples/orego.d.ts +15 -0
- package/dist/src/examples/orego.js.map +1 -0
- package/dist/src/examples/pipeline-use.d.ts +6 -0
- package/dist/src/examples/pipeline-use.js.map +1 -0
- package/dist/src/examples/pollution.d.ts +15 -0
- package/dist/src/examples/pollution.js.map +1 -0
- package/{src/examples/print-benchmark.ts → dist/src/examples/print-benchmark.d.ts} +8 -58
- package/dist/src/examples/print-benchmark.js.map +1 -0
- package/dist/src/examples/robertson.d.ts +15 -0
- package/{src → dist/src}/examples/robertson.js +2 -2
- package/dist/src/examples/robertson.js.map +1 -0
- package/dist/src/examples/scripting.d.ts +1 -0
- package/dist/src/examples/scripting.js.map +1 -0
- package/dist/src/examples/vdpol.d.ts +15 -0
- package/dist/src/examples/vdpol.js.map +1 -0
- package/dist/src/latex-export/examples/advanced-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/advanced-to-latex.js +41 -0
- package/dist/src/latex-export/examples/advanced-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/basic-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/basic-to-latex.js +17 -0
- package/dist/src/latex-export/examples/basic-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/bioreactor-to-latex-selective.d.ts +2 -0
- package/dist/src/latex-export/examples/bioreactor-to-latex-selective.js +145 -0
- package/dist/src/latex-export/examples/bioreactor-to-latex-selective.js.map +1 -0
- package/dist/src/latex-export/examples/chem-react-to-latex-no-cdot.d.ts +2 -0
- package/dist/src/latex-export/examples/chem-react-to-latex-no-cdot.js +41 -0
- package/dist/src/latex-export/examples/chem-react-to-latex-no-cdot.js.map +1 -0
- package/dist/src/latex-export/examples/energy-n-control-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/energy-n-control-to-markdown.js +58 -0
- package/dist/src/latex-export/examples/energy-n-control-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/extended-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/extended-to-markdown.js +37 -0
- package/dist/src/latex-export/examples/extended-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/fermentation-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/fermentation-to-latex.js +32 -0
- package/dist/src/latex-export/examples/fermentation-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/ga-production-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/ga-production-to-markdown.js +58 -0
- package/dist/src/latex-export/examples/ga-production-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/nimotuzumab-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/nimotuzumab-to-latex.js +53 -0
- package/dist/src/latex-export/examples/nimotuzumab-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/pk-pd-to-markdown-minimal.d.ts +2 -0
- package/dist/src/latex-export/examples/pk-pd-to-markdown-minimal.js +50 -0
- package/dist/src/latex-export/examples/pk-pd-to-markdown-minimal.js.map +1 -0
- package/dist/src/latex-export/examples/pk-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/pk-to-markdown.js +35 -0
- package/dist/src/latex-export/examples/pk-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/pollution-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/pollution-to-latex.js +141 -0
- package/dist/src/latex-export/examples/pollution-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/robertson-to-latex-no-meta.d.ts +2 -0
- package/dist/src/latex-export/examples/robertson-to-latex-no-meta.js +25 -0
- package/dist/src/latex-export/examples/robertson-to-latex-no-meta.js.map +1 -0
- package/dist/src/latex-export/generator/bracket-manager.d.ts +19 -0
- package/dist/src/latex-export/generator/bracket-manager.js +58 -0
- package/dist/src/latex-export/generator/bracket-manager.js.map +1 -0
- package/dist/src/latex-export/generator/document-builder.d.ts +13 -0
- package/dist/src/latex-export/generator/document-builder.js +433 -0
- package/dist/src/latex-export/generator/document-builder.js.map +1 -0
- package/dist/src/latex-export/generator/latex-generator.d.ts +23 -0
- package/dist/src/latex-export/generator/latex-generator.js +176 -0
- package/dist/src/latex-export/generator/latex-generator.js.map +1 -0
- package/dist/src/latex-export/index.d.ts +8 -0
- package/dist/src/latex-export/index.js +25 -0
- package/dist/src/latex-export/index.js.map +1 -0
- package/dist/src/latex-export/output/md-formatter.d.ts +16 -0
- package/dist/src/latex-export/output/md-formatter.js +27 -0
- package/dist/src/latex-export/output/md-formatter.js.map +1 -0
- package/dist/src/latex-export/output/tex-formatter.d.ts +5 -0
- package/dist/src/latex-export/output/tex-formatter.js +20 -0
- package/dist/src/latex-export/output/tex-formatter.js.map +1 -0
- package/dist/src/latex-export/parser/ast-parser.d.ts +7 -0
- package/dist/src/latex-export/parser/ast-parser.js +153 -0
- package/dist/src/latex-export/parser/ast-parser.js.map +1 -0
- package/dist/src/latex-export/parser/ivp-parser.d.ts +6 -0
- package/dist/src/latex-export/parser/ivp-parser.js +219 -0
- package/dist/src/latex-export/parser/ivp-parser.js.map +1 -0
- package/dist/src/latex-export/parser/line-joiner.d.ts +25 -0
- package/dist/src/latex-export/parser/line-joiner.js +80 -0
- package/dist/src/latex-export/parser/line-joiner.js.map +1 -0
- package/dist/src/latex-export/parser/tokenizer.d.ts +7 -0
- package/dist/src/latex-export/parser/tokenizer.js +143 -0
- package/dist/src/latex-export/parser/tokenizer.js.map +1 -0
- package/dist/src/latex-export/transformer/functions.d.ts +12 -0
- package/dist/src/latex-export/transformer/functions.js +47 -0
- package/dist/src/latex-export/transformer/functions.js.map +1 -0
- package/dist/src/latex-export/transformer/identifier.d.ts +23 -0
- package/dist/src/latex-export/transformer/identifier.js +194 -0
- package/dist/src/latex-export/transformer/identifier.js.map +1 -0
- package/dist/src/latex-export/transformer/operators.d.ts +9 -0
- package/dist/src/latex-export/transformer/operators.js +41 -0
- package/dist/src/latex-export/transformer/operators.js.map +1 -0
- package/dist/src/latex-export/types.d.ts +122 -0
- package/dist/src/latex-export/types.js +10 -0
- package/dist/src/latex-export/types.js.map +1 -0
- package/{src/pipeline/basic-pipeline-creator.ts → dist/src/pipeline/basic-pipeline-creator.d.ts} +11 -28
- package/dist/src/pipeline/basic-pipeline-creator.js.map +1 -0
- package/dist/src/pipeline/constants.d.ts +14 -0
- package/dist/src/pipeline/constants.js.map +1 -0
- package/dist/src/pipeline/index.d.ts +7 -0
- package/dist/src/pipeline/index.js.map +1 -0
- package/dist/src/pipeline/input.d.ts +3 -0
- package/dist/src/pipeline/input.js.map +1 -0
- package/dist/src/pipeline/loops-pipeline-creator.d.ts +124 -0
- package/dist/src/pipeline/loops-pipeline-creator.js.map +1 -0
- package/dist/src/pipeline/output.d.ts +10 -0
- package/{src → dist/src}/pipeline/output.js +1 -1
- package/dist/src/pipeline/output.js.map +1 -0
- package/dist/src/pipeline/pipeline-creator.d.ts +12 -0
- package/{src → dist/src}/pipeline/pipeline-creator.js +2 -0
- package/dist/src/pipeline/pipeline-creator.js.map +1 -0
- package/{src/pipeline/pipeline.ts → dist/src/pipeline/pipeline.d.ts} +10 -97
- package/dist/src/pipeline/pipeline.js.map +1 -0
- package/{src/pipeline/updates-pipeline-creator.ts → dist/src/pipeline/updates-pipeline-creator.d.ts} +15 -131
- package/dist/src/pipeline/updates-pipeline-creator.js.map +1 -0
- package/dist/src/scripting-tools/constants.d.ts +59 -0
- package/dist/src/scripting-tools/constants.js.map +1 -0
- package/dist/src/scripting-tools/index.d.ts +3 -0
- package/dist/src/scripting-tools/index.js.map +1 -0
- package/dist/src/scripting-tools/model-error.d.ts +10 -0
- package/{src → dist/src}/scripting-tools/model-error.js +2 -1
- package/dist/src/scripting-tools/model-error.js.map +1 -0
- package/dist/src/scripting-tools/scripting-tools.d.ts +277 -0
- package/{src → dist/src}/scripting-tools/scripting-tools.js +2 -4
- package/dist/src/scripting-tools/scripting-tools.js.map +1 -0
- package/dist/src/solver-tools/ab4-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ab4-method.js +3 -3
- package/dist/src/solver-tools/ab4-method.js.map +1 -0
- package/dist/src/solver-tools/ab5-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ab5-method.js +3 -3
- package/dist/src/solver-tools/ab5-method.js.map +1 -0
- package/dist/src/solver-tools/callbacks/callback-base.d.ts +8 -0
- package/dist/src/solver-tools/callbacks/callback-base.js.map +1 -0
- package/dist/src/solver-tools/callbacks/callback-tools.d.ts +6 -0
- package/dist/src/solver-tools/callbacks/callback-tools.js.map +1 -0
- package/dist/src/solver-tools/callbacks/iter-checker-callback.d.ts +12 -0
- package/{src → dist/src}/solver-tools/callbacks/iter-checker-callback.js +2 -0
- package/dist/src/solver-tools/callbacks/iter-checker-callback.js.map +1 -0
- package/dist/src/solver-tools/callbacks/time-checker-callback.d.ts +12 -0
- package/{src → dist/src}/solver-tools/callbacks/time-checker-callback.js +2 -2
- package/dist/src/solver-tools/callbacks/time-checker-callback.js.map +1 -0
- package/dist/src/solver-tools/cvode/common.d.ts +395 -0
- package/dist/src/solver-tools/cvode/common.js +483 -0
- package/dist/src/solver-tools/cvode/common.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode.d.ts +23 -0
- package/dist/src/solver-tools/cvode/cvode.js +1062 -0
- package/dist/src/solver-tools/cvode/cvode.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_adams.d.ts +22 -0
- package/dist/src/solver-tools/cvode/cvode_adams.js +124 -0
- package/dist/src/solver-tools/cvode/cvode_adams.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_bdf.d.ts +37 -0
- package/dist/src/solver-tools/cvode/cvode_bdf.js +153 -0
- package/dist/src/solver-tools/cvode/cvode_bdf.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_class.d.ts +116 -0
- package/dist/src/solver-tools/cvode/cvode_class.js +163 -0
- package/dist/src/solver-tools/cvode/cvode_class.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_hin.d.ts +24 -0
- package/dist/src/solver-tools/cvode/cvode_hin.js +119 -0
- package/dist/src/solver-tools/cvode/cvode_hin.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_io.d.ts +98 -0
- package/dist/src/solver-tools/cvode/cvode_io.js +202 -0
- package/dist/src/solver-tools/cvode/cvode_io.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_ls.d.ts +23 -0
- package/dist/src/solver-tools/cvode/cvode_ls.js +210 -0
- package/dist/src/solver-tools/cvode/cvode_ls.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_nls.d.ts +25 -0
- package/dist/src/solver-tools/cvode/cvode_nls.js +220 -0
- package/dist/src/solver-tools/cvode/cvode_nls.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_root.d.ts +64 -0
- package/dist/src/solver-tools/cvode/cvode_root.js +415 -0
- package/dist/src/solver-tools/cvode/cvode_root.js.map +1 -0
- package/dist/src/solver-tools/cvode/dense_linalg.d.ts +50 -0
- package/dist/src/solver-tools/cvode/dense_linalg.js +131 -0
- package/dist/src/solver-tools/cvode/dense_linalg.js.map +1 -0
- package/dist/src/solver-tools/cvode/index.d.ts +24 -0
- package/dist/src/solver-tools/cvode/index.js +26 -0
- package/dist/src/solver-tools/cvode/index.js.map +1 -0
- package/dist/src/solver-tools/cvode-method.d.ts +47 -0
- package/dist/src/solver-tools/cvode-method.js +114 -0
- package/dist/src/solver-tools/cvode-method.js.map +1 -0
- package/dist/src/solver-tools/index.d.ts +16 -0
- package/{src → dist/src}/solver-tools/index.js +1 -0
- package/dist/src/solver-tools/index.js.map +1 -0
- package/dist/src/solver-tools/lin-alg-tools.d.ts +6 -0
- package/dist/src/solver-tools/lin-alg-tools.js.map +1 -0
- package/dist/src/solver-tools/lsoda/blas.d.ts +59 -0
- package/{src → dist/src}/solver-tools/lsoda/blas.js +11 -0
- package/dist/src/solver-tools/lsoda/blas.js.map +1 -0
- package/dist/src/solver-tools/lsoda/cfode.d.ts +18 -0
- package/{src → dist/src}/solver-tools/lsoda/cfode.js +11 -0
- package/dist/src/solver-tools/lsoda/cfode.js.map +1 -0
- package/dist/src/solver-tools/lsoda/common.d.ts +85 -0
- package/dist/src/solver-tools/lsoda/common.js +96 -0
- package/dist/src/solver-tools/lsoda/common.js.map +1 -0
- package/dist/src/solver-tools/lsoda/corfailure.d.ts +18 -0
- package/{src → dist/src}/solver-tools/lsoda/corfailure.js +11 -0
- package/dist/src/solver-tools/lsoda/corfailure.js.map +1 -0
- package/dist/src/solver-tools/lsoda/correction.d.ts +23 -0
- package/{src → dist/src}/solver-tools/lsoda/correction.js +11 -0
- package/dist/src/solver-tools/lsoda/correction.js.map +1 -0
- package/dist/src/solver-tools/lsoda/dense.d.ts +47 -0
- package/{src → dist/src}/solver-tools/lsoda/dense.js +13 -0
- package/dist/src/solver-tools/lsoda/dense.js.map +1 -0
- package/dist/src/solver-tools/lsoda/index.d.ts +16 -0
- package/dist/src/solver-tools/lsoda/index.js +15 -0
- package/dist/src/solver-tools/lsoda/index.js.map +1 -0
- package/dist/src/solver-tools/lsoda/intdy.d.ts +19 -0
- package/{src → dist/src}/solver-tools/lsoda/intdy.js +11 -0
- package/dist/src/solver-tools/lsoda/intdy.js.map +1 -0
- package/dist/src/solver-tools/lsoda/lsoda.d.ts +66 -0
- package/{src → dist/src}/solver-tools/lsoda/lsoda.js +24 -5
- package/dist/src/solver-tools/lsoda/lsoda.js.map +1 -0
- package/dist/src/solver-tools/lsoda/methodswitch.d.ts +21 -0
- package/{src → dist/src}/solver-tools/lsoda/methodswitch.js +11 -0
- package/dist/src/solver-tools/lsoda/methodswitch.js.map +1 -0
- package/dist/src/solver-tools/lsoda/orderswitch.d.ts +21 -0
- package/{src → dist/src}/solver-tools/lsoda/orderswitch.js +11 -0
- package/dist/src/solver-tools/lsoda/orderswitch.js.map +1 -0
- package/dist/src/solver-tools/lsoda/prja.d.ts +18 -0
- package/{src → dist/src}/solver-tools/lsoda/prja.js +11 -0
- package/dist/src/solver-tools/lsoda/prja.js.map +1 -0
- package/dist/src/solver-tools/lsoda/scaleh.d.ts +16 -0
- package/{src → dist/src}/solver-tools/lsoda/scaleh.js +11 -0
- package/dist/src/solver-tools/lsoda/scaleh.js.map +1 -0
- package/dist/src/solver-tools/lsoda/solsy.d.ts +17 -0
- package/dist/src/solver-tools/lsoda/solsy.js +25 -0
- package/dist/src/solver-tools/lsoda/solsy.js.map +1 -0
- package/dist/src/solver-tools/lsoda/stoda.d.ts +19 -0
- package/{src → dist/src}/solver-tools/lsoda/stoda.js +11 -0
- package/dist/src/solver-tools/lsoda/stoda.js.map +1 -0
- package/dist/src/solver-tools/lsoda-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/lsoda-method.js +23 -9
- package/dist/src/solver-tools/lsoda-method.js.map +1 -0
- package/dist/src/solver-tools/mrt-method.d.ts +47 -0
- package/{src → dist/src}/solver-tools/mrt-method.js +2 -2
- package/dist/src/solver-tools/mrt-method.js.map +1 -0
- package/dist/src/solver-tools/rk3-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/rk3-method.js +2 -2
- package/dist/src/solver-tools/rk3-method.js.map +1 -0
- package/dist/src/solver-tools/rk4-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/rk4-method.js +2 -2
- package/dist/src/solver-tools/rk4-method.js.map +1 -0
- package/dist/src/solver-tools/rkdp-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/rkdp-method.js +2 -2
- package/dist/src/solver-tools/rkdp-method.js.map +1 -0
- package/dist/src/solver-tools/ros34prw-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ros34prw-method.js +2 -2
- package/dist/src/solver-tools/ros34prw-method.js.map +1 -0
- package/dist/src/solver-tools/ros3prw-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ros3prw-method.js +2 -2
- package/dist/src/solver-tools/ros3prw-method.js.map +1 -0
- package/{src/solver-tools/solver-defs.ts → dist/src/solver-tools/solver-defs.d.ts} +45 -84
- package/{src → dist/src}/solver-tools/solver-defs.js +1 -0
- package/dist/src/solver-tools/solver-defs.js.map +1 -0
- package/dist/src/worker-tools/index.d.ts +2 -0
- package/dist/src/worker-tools/index.js.map +1 -0
- package/{src/worker-tools/scripting.ts → dist/src/worker-tools/scripting.d.ts} +9 -91
- package/dist/src/worker-tools/scripting.js.map +1 -0
- package/dist/src/worker-tools/solving.d.ts +7 -0
- package/{src → dist/src}/worker-tools/solving.js +3 -1
- package/dist/src/worker-tools/solving.js.map +1 -0
- package/package.json +13 -12
- package/.claude/settings.local.json +0 -11
- package/.eslintrc.json +0 -45
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -22
- package/.github/scripts/bump-js-api-version.sh +0 -106
- package/.github/scripts/check-output.sh +0 -20
- package/.github/scripts/iac-cfn-deploy.sh +0 -90
- package/.github/scripts/slack_api_request.sh +0 -65
- package/.github/scripts/test_package.sh +0 -270
- package/.github/workflows/deploy-docs.yml +0 -15
- package/.github/workflows/libraries.yaml +0 -305
- package/.github/workflows/test.yaml +0 -19
- package/CLAUDE.md +0 -98
- package/CONTRIBUTING.md +0 -74
- package/eslintrc.json +0 -45
- package/images/E5.png +0 -0
- package/images/HIRES.png +0 -0
- package/images/OREGO.png +0 -0
- package/images/POLL-full.png +0 -0
- package/images/POLL.png +0 -0
- package/images/ROBER.png +0 -0
- package/images/VDP0L.png +0 -0
- package/images/VDPOL.png +0 -0
- package/images/acid-prod.gif +0 -0
- package/index.js.map +0 -1
- package/index.ts +0 -17
- package/jest.config.js +0 -13
- package/src/examples/basic-use.js.map +0 -1
- package/src/examples/basic-use.ts +0 -44
- package/src/examples/bioreactor.js +0 -125
- package/src/examples/bioreactor.js.map +0 -1
- package/src/examples/bioreactor.ts +0 -132
- package/src/examples/check-methods.js.map +0 -1
- package/src/examples/check-methods.ts +0 -81
- package/src/examples/corr-probs.js.map +0 -1
- package/src/examples/corr-probs.ts +0 -155
- package/src/examples/cyclic-model.js.map +0 -1
- package/src/examples/cyclic-model.ts +0 -112
- package/src/examples/e5.js.map +0 -1
- package/src/examples/e5.ts +0 -36
- package/src/examples/hires.js.map +0 -1
- package/src/examples/hires.ts +0 -40
- package/src/examples/index.js.map +0 -1
- package/src/examples/index.ts +0 -34
- package/src/examples/model-updates.js.map +0 -1
- package/src/examples/model-updates.ts +0 -122
- package/src/examples/orego.js.map +0 -1
- package/src/examples/orego.ts +0 -25
- package/src/examples/pipeline-use.js.map +0 -1
- package/src/examples/pipeline-use.ts +0 -98
- package/src/examples/pollution.js.map +0 -1
- package/src/examples/pollution.ts +0 -133
- package/src/examples/print-benchmark.js.map +0 -1
- package/src/examples/robertson.js.map +0 -1
- package/src/examples/robertson.ts +0 -19
- package/src/examples/scripting.js.map +0 -1
- package/src/examples/scripting.ts +0 -35
- package/src/examples/vdpol.js.map +0 -1
- package/src/examples/vdpol.ts +0 -17
- package/src/pipeline/basic-pipeline-creator.js.map +0 -1
- package/src/pipeline/constants.js.map +0 -1
- package/src/pipeline/constants.ts +0 -21
- package/src/pipeline/index.js.map +0 -1
- package/src/pipeline/index.ts +0 -7
- package/src/pipeline/input.js.map +0 -1
- package/src/pipeline/input.ts +0 -55
- package/src/pipeline/loops-pipeline-creator.js.map +0 -1
- package/src/pipeline/loops-pipeline-creator.ts +0 -252
- package/src/pipeline/output.js.map +0 -1
- package/src/pipeline/output.ts +0 -201
- package/src/pipeline/pipeline-creator.js.map +0 -1
- package/src/pipeline/pipeline-creator.ts +0 -20
- package/src/pipeline/pipeline.js.map +0 -1
- package/src/pipeline/updates-pipeline-creator.js.map +0 -1
- package/src/scripting-tools/constants.js.map +0 -1
- package/src/scripting-tools/constants.ts +0 -69
- package/src/scripting-tools/index.js.map +0 -1
- package/src/scripting-tools/index.ts +0 -8
- package/src/scripting-tools/model-error.js.map +0 -1
- package/src/scripting-tools/model-error.ts +0 -21
- package/src/scripting-tools/scripting-tools.js.map +0 -1
- package/src/scripting-tools/scripting-tools.ts +0 -1582
- package/src/solver-tools/ab4-method.js.map +0 -1
- package/src/solver-tools/ab4-method.ts +0 -395
- package/src/solver-tools/ab5-method.js.map +0 -1
- package/src/solver-tools/ab5-method.ts +0 -397
- package/src/solver-tools/callbacks/callback-base.js.map +0 -1
- package/src/solver-tools/callbacks/callback-base.ts +0 -12
- package/src/solver-tools/callbacks/callback-tools.js.map +0 -1
- package/src/solver-tools/callbacks/callback-tools.ts +0 -22
- package/src/solver-tools/callbacks/iter-checker-callback.js.map +0 -1
- package/src/solver-tools/callbacks/iter-checker-callback.ts +0 -25
- package/src/solver-tools/callbacks/time-checker-callback.js.map +0 -1
- package/src/solver-tools/callbacks/time-checker-callback.ts +0 -23
- package/src/solver-tools/index.js.map +0 -1
- package/src/solver-tools/index.ts +0 -15
- package/src/solver-tools/lin-alg-tools.js.map +0 -1
- package/src/solver-tools/lin-alg-tools.ts +0 -75
- package/src/solver-tools/lsoda/blas.js.map +0 -1
- package/src/solver-tools/lsoda/blas.ts +0 -267
- package/src/solver-tools/lsoda/cfode.js.map +0 -1
- package/src/solver-tools/lsoda/cfode.ts +0 -83
- package/src/solver-tools/lsoda/common.js +0 -94
- package/src/solver-tools/lsoda/common.js.map +0 -1
- package/src/solver-tools/lsoda/common.ts +0 -135
- package/src/solver-tools/lsoda/corfailure.js.map +0 -1
- package/src/solver-tools/lsoda/corfailure.ts +0 -30
- package/src/solver-tools/lsoda/correction.js.map +0 -1
- package/src/solver-tools/lsoda/correction.ts +0 -119
- package/src/solver-tools/lsoda/dense.js.map +0 -1
- package/src/solver-tools/lsoda/dense.ts +0 -129
- package/src/solver-tools/lsoda/index.js +0 -4
- package/src/solver-tools/lsoda/index.js.map +0 -1
- package/src/solver-tools/lsoda/index.ts +0 -5
- package/src/solver-tools/lsoda/intdy.js.map +0 -1
- package/src/solver-tools/lsoda/intdy.ts +0 -50
- package/src/solver-tools/lsoda/lsoda.js.map +0 -1
- package/src/solver-tools/lsoda/lsoda.ts +0 -632
- package/src/solver-tools/lsoda/methodswitch.js.map +0 -1
- package/src/solver-tools/lsoda/methodswitch.ts +0 -107
- package/src/solver-tools/lsoda/orderswitch.js.map +0 -1
- package/src/solver-tools/lsoda/orderswitch.ts +0 -95
- package/src/solver-tools/lsoda/prja.js.map +0 -1
- package/src/solver-tools/lsoda/prja.ts +0 -49
- package/src/solver-tools/lsoda/scaleh.js.map +0 -1
- package/src/solver-tools/lsoda/scaleh.ts +0 -33
- package/src/solver-tools/lsoda/solsy.js +0 -14
- package/src/solver-tools/lsoda/solsy.js.map +0 -1
- package/src/solver-tools/lsoda/solsy.ts +0 -18
- package/src/solver-tools/lsoda/stoda.js.map +0 -1
- package/src/solver-tools/lsoda/stoda.ts +0 -286
- package/src/solver-tools/lsoda-method.js.map +0 -1
- package/src/solver-tools/lsoda-method.ts +0 -136
- package/src/solver-tools/mrt-method.js.map +0 -1
- package/src/solver-tools/mrt-method.ts +0 -398
- package/src/solver-tools/rk3-method.js.map +0 -1
- package/src/solver-tools/rk3-method.ts +0 -257
- package/src/solver-tools/rk4-method.js.map +0 -1
- package/src/solver-tools/rk4-method.ts +0 -286
- package/src/solver-tools/rkdp-method.js.map +0 -1
- package/src/solver-tools/rkdp-method.ts +0 -300
- package/src/solver-tools/ros34prw-method.js.map +0 -1
- package/src/solver-tools/ros34prw-method.ts +0 -373
- package/src/solver-tools/ros3prw-method.js.map +0 -1
- package/src/solver-tools/ros3prw-method.ts +0 -342
- package/src/solver-tools/solver-defs.js.map +0 -1
- package/src/tests/correctness.test.js +0 -15
- package/src/tests/correctness.test.js.map +0 -1
- package/src/tests/correctness.test.ts +0 -16
- package/src/tests/lsoda-lib-correctness.test.js +0 -223
- package/src/tests/lsoda-lib-correctness.test.js.map +0 -1
- package/src/tests/lsoda-lib-correctness.test.ts +0 -283
- package/src/tests/lsoda-lib-performance.test.js +0 -95
- package/src/tests/lsoda-lib-performance.test.js.map +0 -1
- package/src/tests/lsoda-lib-performance.test.ts +0 -126
- package/src/tests/performance.test.js +0 -16
- package/src/tests/performance.test.js.map +0 -1
- package/src/tests/performance.test.ts +0 -17
- package/src/tests/pipeline.test.js +0 -10
- package/src/tests/pipeline.test.js.map +0 -1
- package/src/tests/pipeline.test.ts +0 -11
- package/src/tests/test-defs.js +0 -207
- package/src/tests/test-defs.js.map +0 -1
- package/src/tests/test-defs.ts +0 -225
- package/src/tests/test-utils.js +0 -28
- package/src/tests/test-utils.js.map +0 -1
- package/src/tests/test-utils.ts +0 -37
- package/src/worker-tools/index.js.map +0 -1
- package/src/worker-tools/index.ts +0 -2
- package/src/worker-tools/scripting.js.map +0 -1
- package/src/worker-tools/solving.js.map +0 -1
- package/src/worker-tools/solving.ts +0 -83
- package/tsconfig.json +0 -71
- package/typedoc.json +0 -8
- /package/{src → dist/src}/examples/basic-use.js +0 -0
- /package/{src → dist/src}/examples/cyclic-model.js +0 -0
- /package/{src → dist/src}/examples/e5.js +0 -0
- /package/{src → dist/src}/examples/hires.js +0 -0
- /package/{src → dist/src}/examples/index.js +0 -0
- /package/{src → dist/src}/examples/model-updates.js +0 -0
- /package/{src → dist/src}/examples/orego.js +0 -0
- /package/{src → dist/src}/examples/pipeline-use.js +0 -0
- /package/{src → dist/src}/examples/pollution.js +0 -0
- /package/{src → dist/src}/examples/print-benchmark.js +0 -0
- /package/{src → dist/src}/examples/scripting.js +0 -0
- /package/{src → dist/src}/examples/vdpol.js +0 -0
- /package/{src → dist/src}/pipeline/basic-pipeline-creator.js +0 -0
- /package/{src → dist/src}/pipeline/constants.js +0 -0
- /package/{src → dist/src}/pipeline/index.js +0 -0
- /package/{src → dist/src}/pipeline/input.js +0 -0
- /package/{src → dist/src}/pipeline/loops-pipeline-creator.js +0 -0
- /package/{src → dist/src}/pipeline/pipeline.js +0 -0
- /package/{src → dist/src}/pipeline/updates-pipeline-creator.js +0 -0
- /package/{src → dist/src}/scripting-tools/constants.js +0 -0
- /package/{src → dist/src}/scripting-tools/index.js +0 -0
- /package/{src → dist/src}/solver-tools/callbacks/callback-base.js +0 -0
- /package/{src → dist/src}/solver-tools/callbacks/callback-tools.js +0 -0
- /package/{src → dist/src}/solver-tools/lin-alg-tools.js +0 -0
- /package/{src → dist/src}/worker-tools/index.js +0 -0
- /package/{src → dist/src}/worker-tools/scripting.js +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/** Example. Solve the following initial value problem
|
|
2
|
-
|
|
3
|
-
dx / dt = x + y - t
|
|
4
|
-
dy / dt = x * y + t
|
|
5
|
-
x(0) = 1
|
|
6
|
-
y(0) = -1
|
|
7
|
-
|
|
8
|
-
on [0, 2] with the step 0.01.
|
|
9
|
-
*/
|
|
10
|
-
import { lsoda } from '../../index';
|
|
11
|
-
// constants
|
|
12
|
-
const VLinit = 7.2;
|
|
13
|
-
const VTV = 10;
|
|
14
|
-
const speed = 400;
|
|
15
|
-
const diam = 6;
|
|
16
|
-
const power = 2.1;
|
|
17
|
-
const pH = 7.4;
|
|
18
|
-
const k1red = 0.05604;
|
|
19
|
-
const k1ox = 0.0108;
|
|
20
|
-
const k2Fd = 1.35;
|
|
21
|
-
const k2Fa = 110400000;
|
|
22
|
-
const k2Kd = 0.04038;
|
|
23
|
-
const k2Ka = 120000000;
|
|
24
|
-
const k3FKa = 181200000;
|
|
25
|
-
const k3FKd = 0.01188;
|
|
26
|
-
const k4ox = 0.0108;
|
|
27
|
-
const k4red = 0.05604;
|
|
28
|
-
const ktox = 0.005;
|
|
29
|
-
const krcyst = 0;
|
|
30
|
-
const pO2sat = 100;
|
|
31
|
-
const pKa2MEA = 8.18;
|
|
32
|
-
const H = 1.072069378;
|
|
33
|
-
const R = 0.082;
|
|
34
|
-
const _t0 = 0;
|
|
35
|
-
const _t1 = 1000;
|
|
36
|
-
const _h = 1;
|
|
37
|
-
const FFox = 0.2;
|
|
38
|
-
const KKox = 0.2;
|
|
39
|
-
const FFred = 0.1;
|
|
40
|
-
const KKred = 0.1;
|
|
41
|
-
const Ffree = 0;
|
|
42
|
-
const Kfree = 0;
|
|
43
|
-
const FKred = 0;
|
|
44
|
-
const FKox = 0;
|
|
45
|
-
const MEAthiol = 15;
|
|
46
|
-
const CO2 = 0.12;
|
|
47
|
-
const yO2P = 0.209;
|
|
48
|
-
const CYST = 0;
|
|
49
|
-
const VL = 7.2;
|
|
50
|
-
const qin = 1;
|
|
51
|
-
const yO2in = 0.21;
|
|
52
|
-
const T = 300;
|
|
53
|
-
const P = 1;
|
|
54
|
-
const switchTime = 135;
|
|
55
|
-
// the problem definition
|
|
56
|
-
const task = {
|
|
57
|
-
name: 'Bioreactor',
|
|
58
|
-
arg: { name: 't', start: _t0, finish: _t1, step: _h },
|
|
59
|
-
initial: [FFox, KKox, FFred, KKred, Ffree, Kfree, FKred, FKox, MEAthiol, CO2, yO2P, CYST, VL],
|
|
60
|
-
func: (t, _y, _output) => {
|
|
61
|
-
// extract function values
|
|
62
|
-
const FFox = _y[0];
|
|
63
|
-
const KKox = _y[1];
|
|
64
|
-
const FFred = _y[2];
|
|
65
|
-
const KKred = _y[3];
|
|
66
|
-
const Ffree = _y[4];
|
|
67
|
-
const Kfree = _y[5];
|
|
68
|
-
const FKred = _y[6];
|
|
69
|
-
const FKox = _y[7];
|
|
70
|
-
const MEAthiol = _y[8];
|
|
71
|
-
const CO2 = _y[9];
|
|
72
|
-
const yO2P = _y[10];
|
|
73
|
-
const CYST = _y[11];
|
|
74
|
-
const VL = _y[12];
|
|
75
|
-
// evaluate expressions
|
|
76
|
-
const KF = pow(VL, -0.65) * 0.065 * pow(Math.pow(speed, 3) * Math.pow(diam, 5) * power / 2.16e12, 0.361);
|
|
77
|
-
const MA = MEAthiol * pow(10, pH - pKa2MEA);
|
|
78
|
-
const qout = qin - KF * (yO2P * H - CO2) * VL * R * T / (P * 1000);
|
|
79
|
-
const OTR = KF * (yO2P * H - CO2);
|
|
80
|
-
const Fin = t < switchTime ? 0 : 0.025;
|
|
81
|
-
const Fper = t < switchTime ? 0.025 : Fin;
|
|
82
|
-
const E0 = VLinit / VL;
|
|
83
|
-
const E1 = Math.pow((MA * E0), 2);
|
|
84
|
-
const E11 = k1red * FFox * E0 * E1;
|
|
85
|
-
const E12 = k1ox * FFred * E0;
|
|
86
|
-
const E31 = k2Fd * FFred * E0;
|
|
87
|
-
const E32 = k2Fa * Math.pow((Ffree * E0), 2) * E1;
|
|
88
|
-
const E21 = k1red * KKox * E0 * E1;
|
|
89
|
-
const E22 = k1ox * KKred * E0;
|
|
90
|
-
const E41 = k2Kd * KKred * E0;
|
|
91
|
-
const E42 = k2Ka * Math.pow((Kfree * E0), 2) * E1;
|
|
92
|
-
const E51 = k3FKa * Ffree * E0 * Kfree * E0;
|
|
93
|
-
const E52 = k3FKd * FKred * E0;
|
|
94
|
-
const E61 = k4ox * FKred * E0 * Math.pow((CYST * E0), 2);
|
|
95
|
-
const E62 = k4red * FKox * E0 * E1;
|
|
96
|
-
const E70 = E0 * CO2;
|
|
97
|
-
const E71 = Math.pow((MEAthiol * E0), 2);
|
|
98
|
-
const E72 = (E70 >= 0) ? sqrt(E70) : 0;
|
|
99
|
-
// compute output
|
|
100
|
-
_output[0] = -E11 + E12;
|
|
101
|
-
_output[1] = -E21 + E22;
|
|
102
|
-
_output[2] = E11 - E12 - E31 + E32;
|
|
103
|
-
_output[3] = E21 - E22 - E41 + E42;
|
|
104
|
-
_output[4] = 2 * (E31 - E32) - E51 + E52;
|
|
105
|
-
_output[5] = 2 * (E41 - E42) - E51 + E52;
|
|
106
|
-
_output[6] = E51 - E52 - E61 + E62;
|
|
107
|
-
_output[7] = E61 - E62;
|
|
108
|
-
_output[8] = 2 * (-E11 + E12 - E21 + E22 + E31 + E41 - E32 - E42 - E62 - ktox * E71 * E72) -
|
|
109
|
-
(MEAthiol + MA) * (Fin + Fper) / VL;
|
|
110
|
-
_output[9] = (Fin * pO2sat * 0.0022 - 2 * Fper * CO2) / VL + OTR - 0.5 * ktox * E71 * E72;
|
|
111
|
-
_output[10] = -OTR * (VL / (VTV - VL)) * R * T * P + yO2in * qin - yO2P * qout;
|
|
112
|
-
_output[11] = ktox * E71 * E72 - krcyst * CYST * E0 - (Fin + Fper) * CYST / VL;
|
|
113
|
-
_output[12] = Fin - Fper;
|
|
114
|
-
},
|
|
115
|
-
tolerance: 0.00005,
|
|
116
|
-
solutionColNames: ['FFox', 'KKox', 'FFred', 'KKred', 'Ffree', 'Kfree', 'FKred',
|
|
117
|
-
'FKox', 'MEAthiol', 'CO2', 'yO2P', 'CYST', 'VL'],
|
|
118
|
-
};
|
|
119
|
-
// used Math-functions
|
|
120
|
-
const pow = (x, y) => Math.pow(x, y);
|
|
121
|
-
const tan = (x) => Math.tan(x);
|
|
122
|
-
const sqrt = (x) => Math.sqrt(x);
|
|
123
|
-
const exp = (x) => Math.exp(x);
|
|
124
|
-
const solution = lsoda(task);
|
|
125
|
-
//# sourceMappingURL=bioreactor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bioreactor.js","sourceRoot":"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
|
|
7
|
-
|
|
8
|
-
on [0, 2] with the step 0.01.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {ODEs, lsoda, mrt} from '../../index';
|
|
12
|
-
|
|
13
|
-
// constants
|
|
14
|
-
const VLinit = 7.2;
|
|
15
|
-
const VTV = 10;
|
|
16
|
-
const speed = 400;
|
|
17
|
-
const diam = 6;
|
|
18
|
-
const power = 2.1;
|
|
19
|
-
const pH = 7.4;
|
|
20
|
-
const k1red = 0.05604;
|
|
21
|
-
const k1ox = 0.0108;
|
|
22
|
-
const k2Fd = 1.35;
|
|
23
|
-
const k2Fa = 110400000;
|
|
24
|
-
const k2Kd = 0.04038;
|
|
25
|
-
const k2Ka = 120000000;
|
|
26
|
-
const k3FKa = 181200000;
|
|
27
|
-
const k3FKd = 0.01188;
|
|
28
|
-
const k4ox = 0.0108;
|
|
29
|
-
const k4red = 0.05604;
|
|
30
|
-
const ktox = 0.005;
|
|
31
|
-
const krcyst = 0;
|
|
32
|
-
const pO2sat = 100;
|
|
33
|
-
const pKa2MEA = 8.18;
|
|
34
|
-
const H = 1.072069378;
|
|
35
|
-
const R = 0.082;
|
|
36
|
-
|
|
37
|
-
const _t0 = 0;
|
|
38
|
-
const _t1 = 1000;
|
|
39
|
-
const _h = 1;
|
|
40
|
-
const FFox = 0.2;
|
|
41
|
-
const KKox = 0.2;
|
|
42
|
-
const FFred = 0.1;
|
|
43
|
-
const KKred = 0.1;
|
|
44
|
-
const Ffree = 0;
|
|
45
|
-
const Kfree = 0;
|
|
46
|
-
const FKred = 0;
|
|
47
|
-
const FKox = 0;
|
|
48
|
-
const MEAthiol = 15;
|
|
49
|
-
const CO2 = 0.12;
|
|
50
|
-
const yO2P = 0.209;
|
|
51
|
-
const CYST = 0;
|
|
52
|
-
const VL = 7.2;
|
|
53
|
-
const qin = 1;
|
|
54
|
-
const yO2in = 0.21;
|
|
55
|
-
const T = 300;
|
|
56
|
-
const P = 1;
|
|
57
|
-
const switchTime = 135;
|
|
58
|
-
|
|
59
|
-
// the problem definition
|
|
60
|
-
const task = {
|
|
61
|
-
name: 'Bioreactor',
|
|
62
|
-
arg: {name: 't', start: _t0, finish: _t1, step: _h},
|
|
63
|
-
initial: [FFox, KKox, FFred, KKred, Ffree, Kfree, FKred, FKox, MEAthiol, CO2, yO2P, CYST, VL],
|
|
64
|
-
func: (t: number, _y: Float64Array, _output: Float64Array) => {
|
|
65
|
-
// extract function values
|
|
66
|
-
const FFox = _y[0];
|
|
67
|
-
const KKox = _y[1];
|
|
68
|
-
const FFred = _y[2];
|
|
69
|
-
const KKred = _y[3];
|
|
70
|
-
const Ffree = _y[4];
|
|
71
|
-
const Kfree = _y[5];
|
|
72
|
-
const FKred = _y[6];
|
|
73
|
-
const FKox = _y[7];
|
|
74
|
-
const MEAthiol = _y[8];
|
|
75
|
-
const CO2 = _y[9];
|
|
76
|
-
const yO2P = _y[10];
|
|
77
|
-
const CYST = _y[11];
|
|
78
|
-
const VL = _y[12];
|
|
79
|
-
|
|
80
|
-
// evaluate expressions
|
|
81
|
-
const KF = pow(VL, -0.65) * 0.065 * pow(speed**3 * diam**5 * power / 2.16e12, 0.361);
|
|
82
|
-
const MA = MEAthiol * pow(10, pH - pKa2MEA);
|
|
83
|
-
const qout = qin - KF * (yO2P * H - CO2) * VL * R * T / (P * 1000);
|
|
84
|
-
const OTR = KF * (yO2P * H - CO2);
|
|
85
|
-
const Fin = t < switchTime ? 0 : 0.025;
|
|
86
|
-
const Fper = t < switchTime ? 0.025 : Fin;
|
|
87
|
-
const E0 = VLinit / VL;
|
|
88
|
-
const E1 = (MA * E0)**2;
|
|
89
|
-
const E11 = k1red * FFox * E0 * E1;
|
|
90
|
-
const E12 = k1ox * FFred * E0;
|
|
91
|
-
const E31 = k2Fd * FFred * E0;
|
|
92
|
-
const E32 = k2Fa * (Ffree * E0)**2 * E1;
|
|
93
|
-
const E21 = k1red * KKox * E0 * E1;
|
|
94
|
-
const E22 = k1ox * KKred * E0;
|
|
95
|
-
const E41 = k2Kd * KKred * E0;
|
|
96
|
-
const E42 = k2Ka * (Kfree * E0)**2 * E1;
|
|
97
|
-
const E51 = k3FKa * Ffree * E0 * Kfree * E0;
|
|
98
|
-
const E52 = k3FKd * FKred * E0;
|
|
99
|
-
const E61 = k4ox * FKred * E0 * (CYST * E0)**2;
|
|
100
|
-
const E62 = k4red * FKox * E0 * E1;
|
|
101
|
-
const E70 = E0 * CO2;
|
|
102
|
-
const E71 = (MEAthiol * E0)**2;
|
|
103
|
-
const E72 = (E70 >= 0) ? sqrt(E70) : 0;
|
|
104
|
-
|
|
105
|
-
// compute output
|
|
106
|
-
_output[0] = -E11 + E12;
|
|
107
|
-
_output[1] = -E21 + E22;
|
|
108
|
-
_output[2] = E11 - E12 - E31 + E32;
|
|
109
|
-
_output[3] = E21 - E22 - E41 + E42;
|
|
110
|
-
_output[4] = 2 * (E31 - E32) - E51 + E52;
|
|
111
|
-
_output[5] = 2 * (E41 - E42) - E51 + E52;
|
|
112
|
-
_output[6] = E51 - E52 - E61 + E62;
|
|
113
|
-
_output[7] = E61 - E62;
|
|
114
|
-
_output[8] = 2 * (-E11 + E12 - E21 + E22 + E31 + E41 - E32 - E42 - E62 - ktox * E71 * E72) -
|
|
115
|
-
(MEAthiol + MA) * (Fin + Fper) / VL;
|
|
116
|
-
_output[9] = (Fin * pO2sat * 0.0022 - 2 * Fper * CO2) / VL + OTR - 0.5 * ktox * E71 * E72;
|
|
117
|
-
_output[10] = -OTR * (VL / (VTV - VL)) * R * T * P + yO2in * qin - yO2P * qout;
|
|
118
|
-
_output[11] = ktox * E71 * E72 - krcyst * CYST * E0 - (Fin + Fper) * CYST / VL;
|
|
119
|
-
_output[12] = Fin - Fper;
|
|
120
|
-
},
|
|
121
|
-
tolerance: 0.00005,
|
|
122
|
-
solutionColNames: ['FFox', 'KKox', 'FFred', 'KKred', 'Ffree', 'Kfree', 'FKred',
|
|
123
|
-
'FKox', 'MEAthiol', 'CO2', 'yO2P', 'CYST', 'VL'],
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// used Math-functions
|
|
127
|
-
const pow = (x: number, y: number) => Math.pow(x, y);
|
|
128
|
-
const tan = (x: number) => Math.tan(x);
|
|
129
|
-
const sqrt = (x: number) => Math.sqrt(x);
|
|
130
|
-
const exp = (x: number) => Math.exp(x);
|
|
131
|
-
|
|
132
|
-
const solution = lsoda(task);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-methods.js","sourceRoot":"","sources":["check-methods.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,EAAO,SAAS,EAAe,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAEvG,wGAAwG;AACxG,SAAS,QAAQ,CAAC,MAAsC,EAAE,OAAoB;IAC5E,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,yBAAyB;IACzB,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAE5B,MAAM,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAE9B,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC;IAC/B,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;IAE7C,gBAAgB;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC;QACrC,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC;YACjC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,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perfProbs, refPoints} from '../../index';
|
|
4
|
-
|
|
5
|
-
/** Return numerical solution error: maximum absolute deviation between approximate & exact solutions */
|
|
6
|
-
function getError(method: (odes: ODEs) => Float64Array[], corProb: CorrProblem): number {
|
|
7
|
-
let error = 0;
|
|
8
|
-
|
|
9
|
-
// Get numerical solution
|
|
10
|
-
const approxSolution = method(corProb.odes);
|
|
11
|
-
|
|
12
|
-
const exact = corProb.exact;
|
|
13
|
-
|
|
14
|
-
const arg = approxSolution[0];
|
|
15
|
-
|
|
16
|
-
const pointsCount = arg.length;
|
|
17
|
-
const funcsCount = approxSolution.length - 1;
|
|
18
|
-
|
|
19
|
-
// Compute error
|
|
20
|
-
for (let i = 0; i < pointsCount; ++i) {
|
|
21
|
-
const exactSolution = exact(arg[i]);
|
|
22
|
-
|
|
23
|
-
for (let j = 0; j < funcsCount; ++j)
|
|
24
|
-
error = Math.max(error, Math.abs(exactSolution[j] - approxSolution[j + 1][i]));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return error;
|
|
28
|
-
} // getError
|
|
29
|
-
|
|
30
|
-
function getDeviationFromReferencePoint(solution: Float64Array[], refPoint: Float64Array): number {
|
|
31
|
-
let absolute = 0;
|
|
32
|
-
const lastIdx = solution[0].length - 1;
|
|
33
|
-
let cur = 0;
|
|
34
|
-
|
|
35
|
-
for (let k = 0; k < solution.length; ++k) {
|
|
36
|
-
cur = Math.abs(solution[k][lastIdx] - refPoint[k]);
|
|
37
|
-
absolute = Math.max(cur, absolute);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return absolute;
|
|
41
|
-
} // getDeviationFromReferencePoint
|
|
42
|
-
|
|
43
|
-
const methods = new Map([
|
|
44
|
-
['MRT', mrt],
|
|
45
|
-
['ROS3PRw', ros3prw],
|
|
46
|
-
['ROS34PRw', ros34prw],
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
|
-
console.log('Performance\n');
|
|
50
|
-
|
|
51
|
-
methods.forEach((method, name) => {
|
|
52
|
-
console.log(' ', name);
|
|
53
|
-
|
|
54
|
-
console.log(' PROBLEM TIME,MS ERR*');
|
|
55
|
-
|
|
56
|
-
perfProbs.forEach((odes, idx) => {
|
|
57
|
-
const start = Date.now();
|
|
58
|
-
const solution = method(odes);
|
|
59
|
-
const absErr = getDeviationFromReferencePoint(solution.slice(1), refPoints[idx]).toExponential(2);
|
|
60
|
-
const finish = Date.now();
|
|
61
|
-
console.log(` ${odes.name} ${finish - start} ${absErr}`.padStart(37));
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
console.log();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
console.log('* approximate vs. reference (also, numerical)\n\n');
|
|
68
|
-
|
|
69
|
-
console.log('Correctness (maximum absolute deviation): approximate vs. exact\n');
|
|
70
|
-
|
|
71
|
-
methods.forEach((method, name) => {
|
|
72
|
-
console.log(' ', name);
|
|
73
|
-
console.log(' PROBLEM ERR');
|
|
74
|
-
|
|
75
|
-
corrProbs.forEach((problem) => {
|
|
76
|
-
const error = getError(method, problem);
|
|
77
|
-
console.log(` ${problem.odes.name} ${error.toExponential(2)}`.padStart(28));
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
console.log();
|
|
81
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"corr-probs.js","sourceRoot":"","sources":["corr-probs.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAI/D,4DAA4D;AAC5D,MAAM,UAAU,GAAS;IACvB,IAAI,EAAE,cAAc;IACpB,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAC;IACjD,OAAO,EAAE,CAAC,CAAC,CAAC;IACZ,IAAI,EAAE,CAAC,CAAS,EAAE,CAAe,EAAE,MAAoB,EAAE,EAAE;QACzD,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAA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C,CAAC;AAUF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAC;IAC1C,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAC;IAC1C,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAC;IAC1C,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAC;IACpC,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAC;IACpC,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAC;CACrC,CAAC"}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
// Problems with known exact solution (for testing correctness)
|
|
2
|
-
|
|
3
|
-
import {ODEs} from '../../index';
|
|
4
|
-
|
|
5
|
-
/** Non-stiff 1D test problem: equation (see [1], p. 736) */
|
|
6
|
-
const nonStiff1D: ODEs = {
|
|
7
|
-
name: 'non-stiff 1D',
|
|
8
|
-
arg: {name: 't', start: 0, finish: 4, step: 0.01},
|
|
9
|
-
initial: [2],
|
|
10
|
-
func: (t: number, y: Float64Array, output: Float64Array) => {
|
|
11
|
-
output[0] = 4 * Math.exp(0.8 * t) - 0.5 * y[0];
|
|
12
|
-
},
|
|
13
|
-
tolerance: 0.00001,
|
|
14
|
-
solutionColNames: ['y'],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/** Non-stiff 1D test problem: exact solution (see [1], p. 736) */
|
|
18
|
-
const exactNonStiff1D = (t: number) => {
|
|
19
|
-
return new Float64Array([
|
|
20
|
-
(Math.exp(0.8 * t) - Math.exp(-0.5 * t)) * 4 / 1.3 + 2 * Math.exp(-0.5 * t),
|
|
21
|
-
]);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/** Non-stiff 2D test problem: equation */
|
|
25
|
-
const nonStiff2D: ODEs = {
|
|
26
|
-
name: 'non-stiff 2D',
|
|
27
|
-
arg: {name: 't', start: 0, finish: 4, step: 0.01},
|
|
28
|
-
initial: [1, 1],
|
|
29
|
-
func: (t: number, y: Float64Array, output: Float64Array) => {
|
|
30
|
-
output[0] = y[0] + y[1];
|
|
31
|
-
output[1] = y[1] - y[0];
|
|
32
|
-
},
|
|
33
|
-
tolerance: 0.000000001,
|
|
34
|
-
solutionColNames: ['x', 'y'],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** Non-stiff 2D test problem: exact solution */
|
|
38
|
-
const exactNonStiff2D = (t: number) => {
|
|
39
|
-
return new Float64Array([
|
|
40
|
-
Math.exp(t) * (Math.cos(t) + Math.sin(t)),
|
|
41
|
-
Math.exp(t) * (Math.cos(t) - Math.sin(t)),
|
|
42
|
-
]);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/** Non-stiff 3D test problem: equations */
|
|
46
|
-
const nonStiff3D: ODEs = {
|
|
47
|
-
name: 'non-stiff 3D',
|
|
48
|
-
arg: {name: 't', start: 0, finish: 2, step: 0.001},
|
|
49
|
-
initial: [0.3, -0.8, 0],
|
|
50
|
-
func: (t: number, y: Float64Array, output: Float64Array) => {
|
|
51
|
-
output[0] = 5 * y[0] + 2 * y[1] + Math.sin(t);
|
|
52
|
-
output[1] = -4 * y[0] - y[1] + Math.exp(2 * t);
|
|
53
|
-
output[2] = 5 * t**4 - 3 * t**2 + 2 * t;
|
|
54
|
-
},
|
|
55
|
-
tolerance: 0.00000001,
|
|
56
|
-
solutionColNames: ['x', 'y', 'z'],
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/** Non-stiff 3D test problem: exact solution */
|
|
60
|
-
const exactNonStiff3D = (t: number) => {
|
|
61
|
-
const e1 = Math.exp(t);
|
|
62
|
-
const e2 = Math.exp(2 * t);
|
|
63
|
-
const e3 = Math.exp(3 * t);
|
|
64
|
-
const c = Math.cos(t);
|
|
65
|
-
const s = Math.sin(t);
|
|
66
|
-
|
|
67
|
-
return new Float64Array([
|
|
68
|
-
e1 + e3 + 0.1 * (3 * c - s) - 2 * e2,
|
|
69
|
-
-2 * e1 - e3 - 0.2 * (2 * s + 4 * c) + 3 * e2,
|
|
70
|
-
t**5 - t**3 + t**2,
|
|
71
|
-
]);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/** Stiff 1D test problem: equation (see [1], p. 767) */
|
|
75
|
-
const stiff1D: ODEs = {
|
|
76
|
-
name: 'stiff 1D',
|
|
77
|
-
arg: {name: 't', start: 0, finish: 4, step: 0.01},
|
|
78
|
-
initial: [0],
|
|
79
|
-
func: (t: number, y: Float64Array, output: Float64Array) => {
|
|
80
|
-
output[0] = -1000 * y[0] + 3000 - 2000 * Math.exp(-t);
|
|
81
|
-
},
|
|
82
|
-
tolerance: 0.0000005,
|
|
83
|
-
solutionColNames: ['y'],
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/** Stiff 1D test problem: exact solution (see [1], p. 767) */
|
|
87
|
-
const exactStiff1D = (t: number) => {
|
|
88
|
-
return new Float64Array([
|
|
89
|
-
3 - 0.998 * Math.exp(-1000 * t) - 2.002 * Math.exp(-t),
|
|
90
|
-
]);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/** Stiff 2D test problem: equations (see [1], p. 770) */
|
|
94
|
-
const stiff2D: ODEs = {
|
|
95
|
-
name: 'stiff 2D',
|
|
96
|
-
arg: {name: 't', start: 0, finish: 4, step: 0.01},
|
|
97
|
-
initial: [52.29, 83.82],
|
|
98
|
-
func: (t: number, y: Float64Array, output: Float64Array) => {
|
|
99
|
-
output[0] = -5 * y[0] + 3 * y[1];
|
|
100
|
-
output[1] = 100 * y[0] - 301 * y[1];
|
|
101
|
-
},
|
|
102
|
-
tolerance: 0.0000005,
|
|
103
|
-
solutionColNames: ['x', 'y'],
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/** Stiff 2D test problem: exact solution (see [1], p. 770) */
|
|
107
|
-
const exactStiff2D = (t: number) => {
|
|
108
|
-
return new Float64Array([
|
|
109
|
-
52.96 * Math.exp(-3.9899 * t) - 0.67 * Math.exp(-302.0101 * t),
|
|
110
|
-
17.83 * Math.exp(-3.9899 * t) + 65.99 * Math.exp(-302.0101 * t),
|
|
111
|
-
]);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/** Stiff 3D test problem: equations */
|
|
115
|
-
const stiff3D: ODEs = {
|
|
116
|
-
name: 'stiff 3D',
|
|
117
|
-
arg: {name: 't', start: 0, finish: 4, step: 0.01},
|
|
118
|
-
initial: [2, 1, 0],
|
|
119
|
-
func: (t: number, y: Float64Array, output: Float64Array) => {
|
|
120
|
-
output[0] = -100 * y[0] + 100 * y[1] + y[2];
|
|
121
|
-
output[1] = y[2];
|
|
122
|
-
output[2] = -y[1];
|
|
123
|
-
},
|
|
124
|
-
tolerance: 0.00000001,
|
|
125
|
-
solutionColNames: ['x', 'y', 'z'],
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
/** Stiff 3D test problem: exact solution */
|
|
129
|
-
const exactStiff3D = (t: number) => {
|
|
130
|
-
return new Float64Array([
|
|
131
|
-
Math.exp(-100 * t) + Math.cos(t),
|
|
132
|
-
Math.cos(t),
|
|
133
|
-
-Math.sin(t),
|
|
134
|
-
]);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/** Correctness problem
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
export type CorrProblem = {
|
|
141
|
-
odes: ODEs,
|
|
142
|
-
exact: (t: number) => Float64Array,
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/** Problems for testing correctness
|
|
146
|
-
* @internal
|
|
147
|
-
*/
|
|
148
|
-
export const corrProbs = [
|
|
149
|
-
{odes: nonStiff1D, exact: exactNonStiff1D},
|
|
150
|
-
{odes: nonStiff2D, exact: exactNonStiff2D},
|
|
151
|
-
{odes: nonStiff3D, exact: exactNonStiff3D},
|
|
152
|
-
{odes: stiff1D, exact: exactStiff1D},
|
|
153
|
-
{odes: stiff2D, exact: exactStiff2D},
|
|
154
|
-
{odes: stiff3D, exact: exactStiff3D},
|
|
155
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cyclic-model.js","sourceRoot":"","sources":["cyclic-model.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B;;;;EAIE;AAEF,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAEnC,6BAA6B;AAC7B,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAyCkC,CAAC;AAEjD,oFAAoF;AACpF,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAExC,8BAA8B;AAC9B,IAAI,CAAC;IACH,gCAAgC;IAChC,MAAM,WAAW,GAAG,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC;IAEnC,wBAAwB;IACxB,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;QACP,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,IAAI;QACR,EAAE,EAAE,GAAG;QACP,EAAE,EAAE,IAAI;QACR,CAAC,EAAE,KAAK;QACR,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,KAAK;KACZ,CAAC;IACF,MAAM,WAAW,GAAG,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEpD,yBAAyB;IACzB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAElD,8CAA8C;IAC9C,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAEjE,qBAAqB;IAErB,sBAAsB;IACtB,IAAI,IAAI,GAAG,WAAW,CAAC;IACvB,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,GAAG,aAAa,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAElB,6BAA6B;IAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QAChC,IAAI,GAAG,EAAE,CAAC;QAEV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,EAAE,CAAC;YAC9B,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;QAE9C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
/** This example shows how to apply pipelines and cyclic models.
|
|
3
|
-
This approach can be used for in-webworkers analysis of models.
|
|
4
|
-
|
|
5
|
-
Here, we consider pharmacokinetic-pharmacodynamic (PK-PD) simulation: two-compartment model.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as DGL from '../../index';
|
|
9
|
-
|
|
10
|
-
/** 1. Model specification */
|
|
11
|
-
const model = `#name: PK-PD
|
|
12
|
-
#tags: model
|
|
13
|
-
#description: Pharmacokinetic-pharmacodynamic (PK-PD) simulation: two-compartment model
|
|
14
|
-
#equations:
|
|
15
|
-
d(depot)/dt = -KA * depot
|
|
16
|
-
d(centr)/dt = KA * depot - CL * C2 - Q * C2 + Q * C3
|
|
17
|
-
d(peri)/dt = Q * C2 - Q * C3
|
|
18
|
-
d(eff)/dt = Kin - Kout * (1 - C2/(EC50 + C2)) * eff
|
|
19
|
-
|
|
20
|
-
#expressions:
|
|
21
|
-
C2 = centr / V2
|
|
22
|
-
C3 = peri / V3
|
|
23
|
-
|
|
24
|
-
#loop:
|
|
25
|
-
_count = 10 {caption: count; category: Dosing; min: 1; max: 20} [Number of doses]
|
|
26
|
-
depot += dose
|
|
27
|
-
|
|
28
|
-
#argument: t
|
|
29
|
-
_t0 = 0 {units: h; caption: begin; category: Dosing; min: 0; max: 1} [Begin of dosing interval]
|
|
30
|
-
_t1 = 12 {units: h; caption: end; category: Dosing; min: 5; max: 15} [End of dosing interval]
|
|
31
|
-
_h = 1 {units: h; caption: step; category: Dosing; min: 0.01; max: 0.1} [Time step of simulation]
|
|
32
|
-
|
|
33
|
-
#inits:
|
|
34
|
-
depot = 0 {category: Initial values}
|
|
35
|
-
centr = 0 {category: Initial values} [Central]
|
|
36
|
-
peri = 0 {category: Initial values} [Peripheral]
|
|
37
|
-
eff = 0.2 {category: Initial values} [Effective compartment rate]
|
|
38
|
-
|
|
39
|
-
#parameters:
|
|
40
|
-
dose = 1e4 {category: Dosing; min: 1e3; max: 2e4; step: 1e3} [Dosage]
|
|
41
|
-
KA = 0.3 {caption: rate constant; category: Parameters; min: 0.1; max: 1}
|
|
42
|
-
CL = 2 {caption: clearance; category: Parameters; min: 1; max: 5}
|
|
43
|
-
V2 = 4 {caption: central volume; category: Parameters; min: 1; max: 10} [Central compartment volume]
|
|
44
|
-
Q = 1 {caption: inter rate; category: Parameters; min: 0.1; max: 1} [Intercompartmental rate]
|
|
45
|
-
V3 = 30 {caption: peri volume; category: Parameters; min: 20; max: 40} [Peripheral compartment volume]
|
|
46
|
-
EC50 = 8 {caption: effect; category: Parameters; min: 1; max: 10}
|
|
47
|
-
Kin = 0.2 {caption: Kin; category: Parameters; min: 0.1; max: 0.5} [The first-order production constant]
|
|
48
|
-
Kout = 0.2 {caption: Kout; category: Parameters; min: 0.1; max: 0.5} [The first-order dissipation rate constant]
|
|
49
|
-
|
|
50
|
-
#tolerance: 1e-9
|
|
51
|
-
|
|
52
|
-
#meta.solver: {method: 'rkdp'; maxTimeMs: 5000}`;
|
|
53
|
-
|
|
54
|
-
/** 2. Generate IVP-objects: for the main thread & for computations in webworkers */
|
|
55
|
-
const ivp = DGL.getIVP(model);
|
|
56
|
-
const ivpWW = DGL.getIvp2WebWorker(ivp);
|
|
57
|
-
|
|
58
|
-
/** 3. Perform computations */
|
|
59
|
-
try {
|
|
60
|
-
// 3.1) Extract names of outputs
|
|
61
|
-
const outputNames = DGL.getOutputNames(ivp);
|
|
62
|
-
const outSize = outputNames.length;
|
|
63
|
-
|
|
64
|
-
// 3.2) Set model inputs
|
|
65
|
-
const inputs = {
|
|
66
|
-
_count: 10,
|
|
67
|
-
_t0: 0,
|
|
68
|
-
_t1: 16,
|
|
69
|
-
_h: 1,
|
|
70
|
-
depot: 0,
|
|
71
|
-
centr: 0,
|
|
72
|
-
peri: 0,
|
|
73
|
-
eff: 0.2,
|
|
74
|
-
dose: 10000,
|
|
75
|
-
KA: 0.63,
|
|
76
|
-
CL: 3.2,
|
|
77
|
-
V2: 6.58,
|
|
78
|
-
Q: 0.622,
|
|
79
|
-
V3: 35.6,
|
|
80
|
-
EC50: 5.41,
|
|
81
|
-
Kin: 0.272,
|
|
82
|
-
Kout: 0.276,
|
|
83
|
-
};
|
|
84
|
-
const inputVector = DGL.getInputVector(inputs, ivp);
|
|
85
|
-
|
|
86
|
-
// 3.3) Create a pipeline
|
|
87
|
-
const creator = DGL.getPipelineCreator(ivp);
|
|
88
|
-
const pipeline = creator.getPipeline(inputVector);
|
|
89
|
-
|
|
90
|
-
// 3.4) Apply pipeline to perform computations
|
|
91
|
-
const solution = DGL.applyPipeline(pipeline, ivpWW, inputVector);
|
|
92
|
-
|
|
93
|
-
// 3.5) Print results
|
|
94
|
-
|
|
95
|
-
// 3.5.1) Table header
|
|
96
|
-
let line = ' ';
|
|
97
|
-
outputNames.forEach((name) => line += name + ' ');
|
|
98
|
-
console.log(line);
|
|
99
|
-
|
|
100
|
-
// 3.5.2) Table with solution
|
|
101
|
-
const length = solution[0].length;
|
|
102
|
-
for (let i = 0; i < length; ++i) {
|
|
103
|
-
line = '';
|
|
104
|
-
|
|
105
|
-
for (let j = 0; j < outSize; ++j)
|
|
106
|
-
line += solution[j][i].toFixed(8) + ' ';
|
|
107
|
-
|
|
108
|
-
console.log(line);
|
|
109
|
-
}
|
|
110
|
-
} catch (err) {
|
|
111
|
-
console.log('Simulation failed: ', err instanceof Error ? err.message : 'Unknown problem!');
|
|
112
|
-
}
|
package/src/examples/e5.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"e5.js","sourceRoot":"","sources":["e5.ts"],"names":[],"mappings":"AAAC,0CAA0C;AAC1C,IAAK,EAKH;AALF,WAAK,EAAE;IACJ,8BAAa,CAAA;IACb,gCAAW,CAAA;IACX,8BAAU,CAAA;IACV,0BAAW,CAAA;AACb,CAAC,EALG,EAAE,KAAF,EAAE,QAKL;AAAA,CAAC;AAEJ,2FAA2F;AAC3F,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM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