subroutine updmor ( pmsa , fl , ipoint , increm , noseg , &
& noflux , iexpnt , iknmrk , noq1 , noq2 , &
& noq3 , noq4 )
!DEC$ ATTRIBUTES DLLEXPORT, ALIAS: 'UPDMOR' :: UPDMOR
!>\file
!> Process: BedUpdate - Update bed levels
!----- GPL ---------------------------------------------------------------------
!
! Copyright (C) Stichting Deltares, 2011-2021.
!
! This program is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation version 3.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see .
!
! contact: delft3d.support@deltares.nl
! Stichting Deltares
! P.O. Box 177
! 2600 MH Delft, The Netherlands
!
! All indications and logos of, and references to, "Delft3D" and "Deltares"
! are registered trademarks of Stichting Deltares, and remain the property of
! Stichting Deltares. All rights reserved.
!
!------------------------------------------------------------------------------
use bedcomposition_module, only:updmorlyr
! use sediment_basics_module
use message_module, only:writemessages
use bed_ensemble
use precision
!
IMPLICIT NONE
!
! Type Name I/O Description
!
real(4), dimension(*) :: pmsa !0) dbodsd(i,ifrom) = dbodsd(i,ifrom) - S
if (ito>0) dbodsd(i,ito) = dbodsd(i,ito) + S
enddo
!
! Increment pointers
!
ipnt = ipnt + increm(1:nItem)
!
enddo
!
! Reset pointers
!
ipnt = ipoint(1:nItem)
iflux = 0
!
! Convert sediment total mass into sediment per m2
!
pSurf = ipnt(iMorFac+2)
do iseg = 1, noseg
Surf = pmsa( pSurf )
do i = 1, numIS
dbodsd(i,iseg) = dbodsd(i,iseg) / Surf
enddo
pSurf = pSurf + increm(iMorFac+2)
enddo
!
! Update bedcomposition
!
call getbedcomp(bed,1,1)
if (updmorlyr(bed%comp, dbodsd, blchg, bed%messages) /= 0) then
call writemessages(bed%messages, 6)
stop
endif
!
! Reset pointers
!
ipnt = ipoint(1:nItem)
iflux = 0
!
! Loop over all segments
!
do iseg = 1, noseg
Surf = pmsa( ipnt(iMorFac+2) )
!
dZB = blchg(iseg)
dVB = blchg(iseg)*Surf
!
! Put output and flux values into arrays
!
fl ( iflux+1 ) = dZB
pmsa( ipnt(iMorFac+4) ) = dVB
!
! Increment pointers
!
iflux = iflux + noflux
ipnt = ipnt + increm(1:nItem)
!
enddo
!
deallocate(ipnt)
deallocate(dbodsd)
deallocate(blchg)
!
end subroutine updmor