SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Enabling technologies: Algorithmic
Differentation
Arjen Markus
November 15, 2018
Purpose of the experiment
”Algorithmic differentiation” is a venerable technique:
Quite intrusive if done manually
However, the toolkit by NAG
makes it easy to apply to C++
and Fortran programs
Built into the compiler(s) – very
little changes to the source code
needed
This presentation is about our experiences with the tool.
1. Introduction November 15, 2018 2 / 20
Not only smooth problems ... BLOOM
To get acquainted with the method we chose a module from our
water quality model that is not too extensive and not too trivial –
BLOOM.
BLOOM uses an optimisation algorithm based on linear
programming: how much algae of various species can exist
given light, nutrients, ...
1. Introduction November 15, 2018 3 / 20
Algorithmic differentiation (1)
In many applications of our numerical models we need to
answer such questions as:
Sensitivity analysis: Which parameters influence the
outcome the most?
Calibration: How can we get as close as possible to the
measurements?
Data assimilation: How can we use the limited
observations we have to estimate a good starting point?
...
2. Technique November 15, 2018 4 / 20
Algorithmic differentiation (2)
To answer such questions we have many (mathematical)
methods to our disposal.
Some, however, are fairly na¨ıve. To determine the sensitivity of
the outcome to the parameters we can use the following
method:
Try different values
of the relevant
parameters
Determine
difference with
”nominal” result
0 20 40 60 80 100
0
1
2
3
4
5
Increasing parameter
2. Technique November 15, 2018 5 / 20
Algorithmic differentiation (3)
This works fine – if you have a small number of parameters.
It also assumes the response is more or less linear.
Two alternatives:
The tangent linear method:
∂U
∂x
,
∂U
∂y
,
∂U
∂z
, ...
The adjoint method:
∂x
∂U
,
∂y
∂U
,
∂z
∂U
, ...
Number of parameters: this can be large indeed, think of the
number of grid cells, in case of data assimilation.
2. Technique November 15, 2018 6 / 20
How it works – tangent linear method
Some technical details – for the tangent linear method:
A special compiler takes the source code and transforms it.
Each arithmetic operation now calculates the value and the
derivative:
w = x · y → (w,
dw
dz
) = (x · y, x ·
dy
dz
+ y ·
dx
dz
) (1)
Each mathematical function does the same.
The result is the precise derivative.
2. Technique November 15, 2018 7 / 20
How it works – adjoint method
For the adjoint method, things are slightly more complicated:
A special compiler takes the source code and transforms it
so that all operations are stored – the so-called tape.
The calculation is done both forward (normal) and
backward to calculate the derivative.
Advantage: much faster and you get a direct answer as to how
to change the parameters.
2. Technique November 15, 2018 8 / 20
The tools from NAG
NAG, Numerical Algorithms Group, offers:
HPC consulting and services
Software services in general
An extensive library with
numerical algorithms
A Fortran compiler that strictly
checks for conformance.
The AD compiler for C++ and
Fortran
3. About NAG November 15, 2018 9 / 20
Cooperation with NAG
Given their experience with numerical algorithms,
high-performance computing and their extensive library and
other tools, NAG is an interesting party.
This experiment was a first opportunity to closely cooperate
with them.
For the purpose of this presentation, I will focus on two simpler
applications.
The BLOOM experiment showed that smoothness is not a
prerequisite.
3. About NAG November 15, 2018 10 / 20
Linear programming – BLOOM
Constraints: (2)
x + 0.4y ≤ 10 (3)
x + 1.8y ≤ 5 (4)
Optimise: x + y (5)
The result: the optimum
depends on several
parameters
Determine the Jacobian
matrix to identify them
Information specific to
solution
X
Y
Constraints
Optimum
4. Examples November 15, 2018 11 / 20
Simple example: Streeter-Phelps
The classical model of BOD and DO in a river:
dBOD
dt
= −kBOD
dDO
dt
= −kBOD + r(DOsat − DO)/H
Five parameters:
Initial conditions for BOD and DO
Saturation concentration DO
Decay rate of BOD
Reaeration rate DO
4. Examples November 15, 2018 12 / 20
Simple example: Streeter-Phelps – the data
Artificial data with noise:
0 5 10 15 20
0
2
4
6
8
10
Oxygen
BOD
4. Examples November 15, 2018 13 / 20
Simple example: Streeter-Phelps – error
Using a simple line search algorithm and the results of the AD
tool:
1
10
100
1000
10000
100000
1000000
10000000
0 10 20 30 40
4. Examples November 15, 2018 14 / 20
Simple example: Streeter-Phelps – final
result
Using a simple line search algorithm and the results of the AD
tool:
BOD initial: 9.7 mg/l (10)
DO initial: 9.2 mg/l (8.0)
Saturation: 7.9 mg/l (7.8)
Decay rate: 0.5 d−1 (0.4)
Reaeration: 2.0 d−1 (2.5)
0 5 10 15 20
0
2
4
6
8
10
Oxygen (data)
Oxygen (model)
BOD (data)
BOD (model)
(In parenthe
4. Examples November 15, 2018 15 / 20
Backtracking an oil spill
The idea:
We have observed an oil spill somewhere.
It was released some two days before.
Can we trace it back to its origins?
A form of inverse modelling!
4. Examples November 15, 2018 16 / 20
Backtracking an oil spill – set-up
Very simple grid – rectangular, constant flow.
But:
We seek the initial condition that gives us the following patch
after two days:
0 5 10 15 20 25
0
1
2
3
4
5
Initial patch
"Observed" patch
(Green: a very rough estimate ...)
4. Examples November 15, 2018 17 / 20
Backtracking an oil spill – result
Use the adjoint gradient of the final result wrt the initial
condition:
Determine a new initial condition that will yield a result that is
closer to the observation.
Result:
0 5 10 15 20 25
0
1
2
3
4
5
< 0.001
< 0.003
< 0.01
< 0.03
< 0.1
< 0.3
< 0.6
> 0.6
4. Examples November 15, 2018 18 / 20
A bit of source code ...
do iteration = 1,100
! Update the initial condition
conc_init = max(0.0, conc_init - conc_init_adjoint * 0.01)
call dco_a1s_tape_create
call dco_a1s_tape_register_variable( conc_init )
... calculate concentration over time
... calculate deviation from "observed" concentration
! Examine the adjoint results
call dco_a1s_tape_register_output_variable( deviation )
call dco_a1s_tape_switch_to_passive
call dco_a1s_set( deviation, 1.0, -1 )
call dco_a1s_tape_interpret_adjoint
call dco_a1s_get( conc_init, conc_init_adjoint, -1 )
call dco_a1s_tape_remove
enddo
4. Examples November 15, 2018 19 / 20
Conclusions and recommendations
The technique of algorithmic differentation is very
promising (and actually well-established).
The tool provided by NAG is easy to use, even if there are
some complications you need to deal with.
One immediate benefit is with OpenDA.
4. Examples November 15, 2018 20 / 20

Contenu connexe

Similaire à DSD-INT 2018 Algorithmic Differentiation - Markus

Aoa amortized analysis
Aoa amortized analysisAoa amortized analysis
Aoa amortized analysisSalabat Khan
 
Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...
Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...
Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...Antoine Savine
 
Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...João Baltazar
 
ICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph Analysis
ICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph AnalysisICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph Analysis
ICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph AnalysisJason Riedy
 
Planning for power systems
Planning for power systemsPlanning for power systems
Planning for power systemsOlivier Teytaud
 
Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...João Baltazar
 
Buzz words-dunning-real-time-learning
Buzz words-dunning-real-time-learningBuzz words-dunning-real-time-learning
Buzz words-dunning-real-time-learningTed Dunning
 
Problem 7PurposeBreak apart a complicated system.ConstantsC7C13.docx
Problem 7PurposeBreak apart a complicated system.ConstantsC7C13.docxProblem 7PurposeBreak apart a complicated system.ConstantsC7C13.docx
Problem 7PurposeBreak apart a complicated system.ConstantsC7C13.docxLacieKlineeb
 
Trivento summercamp fast data 9/9/2016
Trivento summercamp fast data 9/9/2016Trivento summercamp fast data 9/9/2016
Trivento summercamp fast data 9/9/2016Stavros Kontopoulos
 
IRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms ComparisonIRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms ComparisonIRJET Journal
 
IRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms ComparisonIRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms ComparisonIRJET Journal
 
IRJET - New Generation Multilevel based Atm Security System
IRJET - New Generation Multilevel based Atm Security SystemIRJET - New Generation Multilevel based Atm Security System
IRJET - New Generation Multilevel based Atm Security SystemIRJET Journal
 
IRJET - Comparison of Vedic, Wallac Tree and Array Multipliers
IRJET -  	  Comparison of Vedic, Wallac Tree and Array MultipliersIRJET -  	  Comparison of Vedic, Wallac Tree and Array Multipliers
IRJET - Comparison of Vedic, Wallac Tree and Array MultipliersIRJET Journal
 
Fall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docx
Fall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docxFall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docx
Fall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docxlmelaine
 
Fraud detection ML
Fraud detection MLFraud detection ML
Fraud detection MLMaatougSelim
 
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0Piotr Dziurzanski
 
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...IRJET Journal
 

Similaire à DSD-INT 2018 Algorithmic Differentiation - Markus (20)

Aoa amortized analysis
Aoa amortized analysisAoa amortized analysis
Aoa amortized analysis
 
Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...
Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...
Practical Implementation of AAD by Antoine Savine, Brian Huge and Hans-Jorgen...
 
Unit i
Unit iUnit i
Unit i
 
Lecture2a algorithm
Lecture2a algorithmLecture2a algorithm
Lecture2a algorithm
 
Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...
 
ICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph Analysis
ICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph AnalysisICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph Analysis
ICIAM 2019: A New Algorithm Model for Massive-Scale Streaming Graph Analysis
 
Planning for power systems
Planning for power systemsPlanning for power systems
Planning for power systems
 
Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...Recent Developments in Computational Methods for the Analysis of Ducted Prope...
Recent Developments in Computational Methods for the Analysis of Ducted Prope...
 
Buzz words-dunning-real-time-learning
Buzz words-dunning-real-time-learningBuzz words-dunning-real-time-learning
Buzz words-dunning-real-time-learning
 
Problem 7PurposeBreak apart a complicated system.ConstantsC7C13.docx
Problem 7PurposeBreak apart a complicated system.ConstantsC7C13.docxProblem 7PurposeBreak apart a complicated system.ConstantsC7C13.docx
Problem 7PurposeBreak apart a complicated system.ConstantsC7C13.docx
 
Trivento summercamp fast data 9/9/2016
Trivento summercamp fast data 9/9/2016Trivento summercamp fast data 9/9/2016
Trivento summercamp fast data 9/9/2016
 
IRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms ComparisonIRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms Comparison
 
IRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms ComparisonIRJET- Supervised Learning Classification Algorithms Comparison
IRJET- Supervised Learning Classification Algorithms Comparison
 
Unit i
Unit iUnit i
Unit i
 
IRJET - New Generation Multilevel based Atm Security System
IRJET - New Generation Multilevel based Atm Security SystemIRJET - New Generation Multilevel based Atm Security System
IRJET - New Generation Multilevel based Atm Security System
 
IRJET - Comparison of Vedic, Wallac Tree and Array Multipliers
IRJET -  	  Comparison of Vedic, Wallac Tree and Array MultipliersIRJET -  	  Comparison of Vedic, Wallac Tree and Array Multipliers
IRJET - Comparison of Vedic, Wallac Tree and Array Multipliers
 
Fall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docx
Fall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docxFall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docx
Fall 2016 Insurance Case Study – Finance 360Loss ControlLoss.docx
 
Fraud detection ML
Fraud detection MLFraud detection ML
Fraud detection ML
 
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0
 
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
 

Plus de Deltares

DSD-INT 2023 Hydrology User Days - Intro - Day 3 - Kroon
DSD-INT 2023 Hydrology User Days - Intro - Day 3 - KroonDSD-INT 2023 Hydrology User Days - Intro - Day 3 - Kroon
DSD-INT 2023 Hydrology User Days - Intro - Day 3 - KroonDeltares
 
DSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin Rodriguez
DSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin RodriguezDSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin Rodriguez
DSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin RodriguezDeltares
 
DSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - Taner
DSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - TanerDSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - Taner
DSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - TanerDeltares
 
DSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - Rooze
DSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - RoozeDSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - Rooze
DSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - RoozeDeltares
 
DSD-INT 2023 Approaches for assessing multi-hazard risk - Ward
DSD-INT 2023 Approaches for assessing multi-hazard risk - WardDSD-INT 2023 Approaches for assessing multi-hazard risk - Ward
DSD-INT 2023 Approaches for assessing multi-hazard risk - WardDeltares
 
DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...
DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...
DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...Deltares
 
DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...
DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...
DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...Deltares
 
DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...
DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...
DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...Deltares
 
DSD-INT 2023 Knowledge and tools for Climate Adaptation - Jeuken
DSD-INT 2023 Knowledge and tools for Climate Adaptation - JeukenDSD-INT 2023 Knowledge and tools for Climate Adaptation - Jeuken
DSD-INT 2023 Knowledge and tools for Climate Adaptation - JeukenDeltares
 
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - BootsmaDSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - BootsmaDeltares
 
DSD-INT 2023 Create your own MODFLOW 6 sub-variant - Muller
DSD-INT 2023 Create your own MODFLOW 6 sub-variant - MullerDSD-INT 2023 Create your own MODFLOW 6 sub-variant - Muller
DSD-INT 2023 Create your own MODFLOW 6 sub-variant - MullerDeltares
 
DSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - Romero
DSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - RomeroDSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - Romero
DSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - RomeroDeltares
 
DSD-INT 2023 Challenges and developments in groundwater modeling - Bakker
DSD-INT 2023 Challenges and developments in groundwater modeling - BakkerDSD-INT 2023 Challenges and developments in groundwater modeling - Bakker
DSD-INT 2023 Challenges and developments in groundwater modeling - BakkerDeltares
 
DSD-INT 2023 Demo new features iMOD Suite - van Engelen
DSD-INT 2023 Demo new features iMOD Suite - van EngelenDSD-INT 2023 Demo new features iMOD Suite - van Engelen
DSD-INT 2023 Demo new features iMOD Suite - van EngelenDeltares
 
DSD-INT 2023 iMOD and new developments - Davids
DSD-INT 2023 iMOD and new developments - DavidsDSD-INT 2023 iMOD and new developments - Davids
DSD-INT 2023 iMOD and new developments - DavidsDeltares
 
DSD-INT 2023 Recent MODFLOW Developments - Langevin
DSD-INT 2023 Recent MODFLOW Developments - LangevinDSD-INT 2023 Recent MODFLOW Developments - Langevin
DSD-INT 2023 Recent MODFLOW Developments - LangevinDeltares
 
DSD-INT 2023 Hydrology User Days - Presentations - Day 2
DSD-INT 2023 Hydrology User Days - Presentations - Day 2DSD-INT 2023 Hydrology User Days - Presentations - Day 2
DSD-INT 2023 Hydrology User Days - Presentations - Day 2Deltares
 
DSD-INT 2023 Needs related to user interfaces - Snippen
DSD-INT 2023 Needs related to user interfaces - SnippenDSD-INT 2023 Needs related to user interfaces - Snippen
DSD-INT 2023 Needs related to user interfaces - SnippenDeltares
 
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - BootsmaDSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - BootsmaDeltares
 
DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...
DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...
DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...Deltares
 

Plus de Deltares (20)

DSD-INT 2023 Hydrology User Days - Intro - Day 3 - Kroon
DSD-INT 2023 Hydrology User Days - Intro - Day 3 - KroonDSD-INT 2023 Hydrology User Days - Intro - Day 3 - Kroon
DSD-INT 2023 Hydrology User Days - Intro - Day 3 - Kroon
 
DSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin Rodriguez
DSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin RodriguezDSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin Rodriguez
DSD-INT 2023 Demo EPIC Response Assessment Methodology (ERAM) - Couvin Rodriguez
 
DSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - Taner
DSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - TanerDSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - Taner
DSD-INT 2023 Demo Climate Stress Testing Tool (CST Tool) - Taner
 
DSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - Rooze
DSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - RoozeDSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - Rooze
DSD-INT 2023 Demo Climate Resilient Cities Tool (CRC Tool) - Rooze
 
DSD-INT 2023 Approaches for assessing multi-hazard risk - Ward
DSD-INT 2023 Approaches for assessing multi-hazard risk - WardDSD-INT 2023 Approaches for assessing multi-hazard risk - Ward
DSD-INT 2023 Approaches for assessing multi-hazard risk - Ward
 
DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...
DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...
DSD-INT 2023 Dynamic Adaptive Policy Pathways (DAPP) - Theory & Showcase - Wa...
 
DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...
DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...
DSD-INT 2023 Global hydrological modelling to support worldwide water assessm...
 
DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...
DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...
DSD-INT 2023 Modelling implications - IPCC Working Group II - From AR6 to AR7...
 
DSD-INT 2023 Knowledge and tools for Climate Adaptation - Jeuken
DSD-INT 2023 Knowledge and tools for Climate Adaptation - JeukenDSD-INT 2023 Knowledge and tools for Climate Adaptation - Jeuken
DSD-INT 2023 Knowledge and tools for Climate Adaptation - Jeuken
 
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - BootsmaDSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
 
DSD-INT 2023 Create your own MODFLOW 6 sub-variant - Muller
DSD-INT 2023 Create your own MODFLOW 6 sub-variant - MullerDSD-INT 2023 Create your own MODFLOW 6 sub-variant - Muller
DSD-INT 2023 Create your own MODFLOW 6 sub-variant - Muller
 
DSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - Romero
DSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - RomeroDSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - Romero
DSD-INT 2023 Example of unstructured MODFLOW 6 modelling in California - Romero
 
DSD-INT 2023 Challenges and developments in groundwater modeling - Bakker
DSD-INT 2023 Challenges and developments in groundwater modeling - BakkerDSD-INT 2023 Challenges and developments in groundwater modeling - Bakker
DSD-INT 2023 Challenges and developments in groundwater modeling - Bakker
 
DSD-INT 2023 Demo new features iMOD Suite - van Engelen
DSD-INT 2023 Demo new features iMOD Suite - van EngelenDSD-INT 2023 Demo new features iMOD Suite - van Engelen
DSD-INT 2023 Demo new features iMOD Suite - van Engelen
 
DSD-INT 2023 iMOD and new developments - Davids
DSD-INT 2023 iMOD and new developments - DavidsDSD-INT 2023 iMOD and new developments - Davids
DSD-INT 2023 iMOD and new developments - Davids
 
DSD-INT 2023 Recent MODFLOW Developments - Langevin
DSD-INT 2023 Recent MODFLOW Developments - LangevinDSD-INT 2023 Recent MODFLOW Developments - Langevin
DSD-INT 2023 Recent MODFLOW Developments - Langevin
 
DSD-INT 2023 Hydrology User Days - Presentations - Day 2
DSD-INT 2023 Hydrology User Days - Presentations - Day 2DSD-INT 2023 Hydrology User Days - Presentations - Day 2
DSD-INT 2023 Hydrology User Days - Presentations - Day 2
 
DSD-INT 2023 Needs related to user interfaces - Snippen
DSD-INT 2023 Needs related to user interfaces - SnippenDSD-INT 2023 Needs related to user interfaces - Snippen
DSD-INT 2023 Needs related to user interfaces - Snippen
 
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - BootsmaDSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
DSD-INT 2023 Coupling RIBASIM to a MODFLOW groundwater model - Bootsma
 
DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...
DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...
DSD-INT 2023 Parameterization of a RIBASIM model and the network lumping appr...
 

Dernier

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 

Dernier (20)

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 

DSD-INT 2018 Algorithmic Differentiation - Markus

  • 2. Purpose of the experiment ”Algorithmic differentiation” is a venerable technique: Quite intrusive if done manually However, the toolkit by NAG makes it easy to apply to C++ and Fortran programs Built into the compiler(s) – very little changes to the source code needed This presentation is about our experiences with the tool. 1. Introduction November 15, 2018 2 / 20
  • 3. Not only smooth problems ... BLOOM To get acquainted with the method we chose a module from our water quality model that is not too extensive and not too trivial – BLOOM. BLOOM uses an optimisation algorithm based on linear programming: how much algae of various species can exist given light, nutrients, ... 1. Introduction November 15, 2018 3 / 20
  • 4. Algorithmic differentiation (1) In many applications of our numerical models we need to answer such questions as: Sensitivity analysis: Which parameters influence the outcome the most? Calibration: How can we get as close as possible to the measurements? Data assimilation: How can we use the limited observations we have to estimate a good starting point? ... 2. Technique November 15, 2018 4 / 20
  • 5. Algorithmic differentiation (2) To answer such questions we have many (mathematical) methods to our disposal. Some, however, are fairly na¨ıve. To determine the sensitivity of the outcome to the parameters we can use the following method: Try different values of the relevant parameters Determine difference with ”nominal” result 0 20 40 60 80 100 0 1 2 3 4 5 Increasing parameter 2. Technique November 15, 2018 5 / 20
  • 6. Algorithmic differentiation (3) This works fine – if you have a small number of parameters. It also assumes the response is more or less linear. Two alternatives: The tangent linear method: ∂U ∂x , ∂U ∂y , ∂U ∂z , ... The adjoint method: ∂x ∂U , ∂y ∂U , ∂z ∂U , ... Number of parameters: this can be large indeed, think of the number of grid cells, in case of data assimilation. 2. Technique November 15, 2018 6 / 20
  • 7. How it works – tangent linear method Some technical details – for the tangent linear method: A special compiler takes the source code and transforms it. Each arithmetic operation now calculates the value and the derivative: w = x · y → (w, dw dz ) = (x · y, x · dy dz + y · dx dz ) (1) Each mathematical function does the same. The result is the precise derivative. 2. Technique November 15, 2018 7 / 20
  • 8. How it works – adjoint method For the adjoint method, things are slightly more complicated: A special compiler takes the source code and transforms it so that all operations are stored – the so-called tape. The calculation is done both forward (normal) and backward to calculate the derivative. Advantage: much faster and you get a direct answer as to how to change the parameters. 2. Technique November 15, 2018 8 / 20
  • 9. The tools from NAG NAG, Numerical Algorithms Group, offers: HPC consulting and services Software services in general An extensive library with numerical algorithms A Fortran compiler that strictly checks for conformance. The AD compiler for C++ and Fortran 3. About NAG November 15, 2018 9 / 20
  • 10. Cooperation with NAG Given their experience with numerical algorithms, high-performance computing and their extensive library and other tools, NAG is an interesting party. This experiment was a first opportunity to closely cooperate with them. For the purpose of this presentation, I will focus on two simpler applications. The BLOOM experiment showed that smoothness is not a prerequisite. 3. About NAG November 15, 2018 10 / 20
  • 11. Linear programming – BLOOM Constraints: (2) x + 0.4y ≤ 10 (3) x + 1.8y ≤ 5 (4) Optimise: x + y (5) The result: the optimum depends on several parameters Determine the Jacobian matrix to identify them Information specific to solution X Y Constraints Optimum 4. Examples November 15, 2018 11 / 20
  • 12. Simple example: Streeter-Phelps The classical model of BOD and DO in a river: dBOD dt = −kBOD dDO dt = −kBOD + r(DOsat − DO)/H Five parameters: Initial conditions for BOD and DO Saturation concentration DO Decay rate of BOD Reaeration rate DO 4. Examples November 15, 2018 12 / 20
  • 13. Simple example: Streeter-Phelps – the data Artificial data with noise: 0 5 10 15 20 0 2 4 6 8 10 Oxygen BOD 4. Examples November 15, 2018 13 / 20
  • 14. Simple example: Streeter-Phelps – error Using a simple line search algorithm and the results of the AD tool: 1 10 100 1000 10000 100000 1000000 10000000 0 10 20 30 40 4. Examples November 15, 2018 14 / 20
  • 15. Simple example: Streeter-Phelps – final result Using a simple line search algorithm and the results of the AD tool: BOD initial: 9.7 mg/l (10) DO initial: 9.2 mg/l (8.0) Saturation: 7.9 mg/l (7.8) Decay rate: 0.5 d−1 (0.4) Reaeration: 2.0 d−1 (2.5) 0 5 10 15 20 0 2 4 6 8 10 Oxygen (data) Oxygen (model) BOD (data) BOD (model) (In parenthe 4. Examples November 15, 2018 15 / 20
  • 16. Backtracking an oil spill The idea: We have observed an oil spill somewhere. It was released some two days before. Can we trace it back to its origins? A form of inverse modelling! 4. Examples November 15, 2018 16 / 20
  • 17. Backtracking an oil spill – set-up Very simple grid – rectangular, constant flow. But: We seek the initial condition that gives us the following patch after two days: 0 5 10 15 20 25 0 1 2 3 4 5 Initial patch "Observed" patch (Green: a very rough estimate ...) 4. Examples November 15, 2018 17 / 20
  • 18. Backtracking an oil spill – result Use the adjoint gradient of the final result wrt the initial condition: Determine a new initial condition that will yield a result that is closer to the observation. Result: 0 5 10 15 20 25 0 1 2 3 4 5 < 0.001 < 0.003 < 0.01 < 0.03 < 0.1 < 0.3 < 0.6 > 0.6 4. Examples November 15, 2018 18 / 20
  • 19. A bit of source code ... do iteration = 1,100 ! Update the initial condition conc_init = max(0.0, conc_init - conc_init_adjoint * 0.01) call dco_a1s_tape_create call dco_a1s_tape_register_variable( conc_init ) ... calculate concentration over time ... calculate deviation from "observed" concentration ! Examine the adjoint results call dco_a1s_tape_register_output_variable( deviation ) call dco_a1s_tape_switch_to_passive call dco_a1s_set( deviation, 1.0, -1 ) call dco_a1s_tape_interpret_adjoint call dco_a1s_get( conc_init, conc_init_adjoint, -1 ) call dco_a1s_tape_remove enddo 4. Examples November 15, 2018 19 / 20
  • 20. Conclusions and recommendations The technique of algorithmic differentation is very promising (and actually well-established). The tool provided by NAG is easy to use, even if there are some complications you need to deal with. One immediate benefit is with OpenDA. 4. Examples November 15, 2018 20 / 20