model integration with swat
DESCRIPTION
Model Integration with SWAT. A publish-subscribe type system June 24, 2013 André Dozier and Olaf David. Optimization – yearly (or 2-5 year) and 30-50km resolution. IUWM BMPs. Ensure Economic Demand = Cons. Use. CGE Solver. SWAT Solver. WALL Solver. Manually add model detail. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/1.jpg)
Model Integration with SWAT
A publish-subscribe type systemJune 24, 2013
André Dozier and Olaf David
![Page 2: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/2.jpg)
Detailed Assessment Model – daily and 1-5km resolution
SWATRead Inputs
MODFLOWSolver
MODFLOWRead Inputs
MODFLOWClose
RT3DRead Inputs
RT3DSolver
RT3DClose
SWATHRU calcs
SWATRouting
SWATOutput
SWATClose
DailyLoop
Optimization – yearly (or 2-5 year) and 30-50km resolution
WALLSolver
WALLSolver
Minimize Vulnerability and Cost
CGESolver
SWATSolver
IUWMBMPs
Few Iterations
Ensure Economic Demand = Cons. Use
Supply to WALLDemand to SWAT
Manuallyadd model
detail
Pareto optimalcurve of
managementsolutions
DayCent
![Page 3: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/3.jpg)
Linkages
• Need to add two linking components
SWAT ModelOther Model
![Page 4: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/4.jpg)
Linkages
• Need to add two linking components
SWAT Model
OMS Simulation
Other Model
![Page 5: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/5.jpg)
My OMS ComponentMy Wrapper
Linkages
• Need to add two linking components
SWAT Model
OMS Simulation
Other Model
![Page 6: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/6.jpg)
My OMS ComponentMy Wrapper
Linkages
• Need to add two linking components
SWAT Model
event
publish
OMS Simulation
subscribe
SWATrun
directionOther Model
runcomponent
finishedinform SWAT
![Page 7: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/7.jpg)
My OMS ComponentMy Wrapper
Special OMS Component- Event names- Event inputs- Event outputs- Communication via MPI
(use blocking sends)
Linkages
• Need to add two linking components
OMS Simulation
Other Model
![Page 8: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/8.jpg)
My OMS ComponentNormal (or special if desired) OMS component- Inputs- Outputs- Execution subroutine
My WrapperSpecial OMS Component- Event names- Event inputs- Event outputs- Communication via MPI
(use blocking sends)
Linkages
• Need to add two linking components
OMS Simulation
![Page 9: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/9.jpg)
OMS Simulation
My OMS ComponentNormal (or special if desired) OMS component- Inputs- Outputs- Execution subroutine
My WrapperSpecial OMS Component- Event names- Event inputs- Event outputs- Communication via MPI
(use blocking sends)
Linkages
• Need to add two linking components
Simulation specifications- location(s) or NULL- Native or managed?
![Page 10: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/10.jpg)
“Events” in SWATSWAT
StartRead InputsYear Loop Month Loop Daily Loop End EndEnd
![Page 11: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/11.jpg)
“Events” in SWATSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End EndEnd
![Page 12: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/12.jpg)
“Events” in SWATSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End EndEnd
Array of function pointers
![Page 13: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/13.jpg)
“Events” in SWATSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End EndEnd
mysub
othersub
Array of function pointers
To “subscribe”
subroutine mysub() print *,“my sub”end subroutine
subroutine othersub() print *,“other sub”end subroutine
![Page 14: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/14.jpg)
“Events” in SWATSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End EndEnd
mysub
othersub
Array of function pointers
To “subscribe”
subroutine mysub() print *,“my sub”end subroutine
subroutine othersub() print *,“other sub”end subroutine
program subscriber() use parm implicit none integer :: event_i interface subroutine mysub() end subroutine end interface interface subroutine othersub() end subroutine end interface event_i = TopOfDailyLoop%subscribe(mysub) event_i = TopOfDailyLoop%subscribe(othersub) call swat_main() end program
![Page 15: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/15.jpg)
“Events” in SWATSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End EndEnd
mysub
othersub
Array of function pointers
subroutine mysub() print *,“my sub”end subroutine
subroutine othersub() print *,“other sub”end subroutine
![Page 16: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/16.jpg)
Special OMS-SWAT ComponentSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End End call EndOfYear%fire()End
mpi_input
mpi_output
subroutine mpi_input() use parm
! Variable initialization
! MPI inputs call MPI_RECEIVE(buf, …)
! Variable dereferencing
end subroutine
subroutine mpi_output() use parm
! Variable initialization
! MPI outputs call MPI_SEND(buf, …)
! MPI wait until finished call MPI_RECEIVE(buf, …)
! Variable dereferencing
end subroutine
![Page 17: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/17.jpg)
Special OMS-SWAT ComponentSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End End call EndOfYear%fire()End
mpi_input
mpi_output
Waits until inputs are available from anotherOMS component
Sends output fromSWAT to OMS with the option of waiting untilthe component has finished running
![Page 18: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/18.jpg)
My OMS ComponentMy Wrapper
Linkages
• Need to add two linking components
SWAT Model
event
publish
OMS Simulation
subscribe
SWATrun
directionOther Model
runcomponent
finishedinform SWAT
![Page 19: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/19.jpg)
One Possible OrientationSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End End call EndOfYear%fire()End
mpi_input
mpi_output
OMS Simulation
OMS Component(s)
OMS Component(s)
![Page 20: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/20.jpg)
Another Possible OrientationSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End End call EndOfYear%fire()End
mpi_output
mpi_input
OMS Simulation
OMS Component(s)
Allows parallel implementation
![Page 21: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/21.jpg)
Yet Another Possible OrientationSWAT
StartRead InputsYear Loop Month Loop Daily Loop call TopOfDailyLoop%fire() End End call EndOfYear%fire()End
mpi_output
mpi_input
OMS Simulation
OMS Component(s)
mpi_input
mpi_output
![Page 22: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/22.jpg)
Detailed Assessment Model – daily and 1-5km resolution
SWATRead Inputs
MODFLOWSolver
MODFLOWRead Inputs
MODFLOWClose
RT3DRead Inputs
RT3DSolver
RT3DClose
SWATHRU calcs
SWATRouting
SWATOutput
SWATClose
DailyLoop
Optimization – yearly (or 2-5 year) and 30-50km resolution
WALLSolver
WALLSolver
Minimize Vulnerability and Cost
CGESolver
SWATSolver
IUWMBMPs
Few Iterations
Ensure Economic Demand = Cons. Use
Supply to WALLDemand to SWAT
Manuallyadd model
detail
Pareto optimalcurve of
managementsolutions
DayCent
![Page 23: Model Integration with SWAT](https://reader035.vdocuments.us/reader035/viewer/2022062314/56812a68550346895d8deb43/html5/thumbnails/23.jpg)
First test case