47 for (
int nCoast = 0; nCoast < static_cast<int>(
m_VCoast.size()); nCoast++)
49 for (
int nCoastPoint = 0; nCoastPoint <
m_VCoast[nCoast].nGetCoastlineSize(); nCoastPoint++)
54 int const nX =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint)->nGetX();
55 int const nY =
m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(nCoastPoint)->nGetY();
62 double const dWaveHeightAtCoast =
m_VCoast[nCoast].dGetCoastWaveHeight(nCoastPoint);
69 double const dWaveEnergy =
m_VCoast[nCoast].dGetWaveEnergyAtBreaking(nCoastPoint);
121 double dCliffElevPreCollapse = 0;
122 double dCliffElevPostCollapse = 0;
123 double dFineCollapse = 0;
124 double dSandCollapse = 0;
125 double dCoarseCollapse = 0;
128 nRet =
nDoCliffCollapse(nCoast, pCliff, dFineCollapse, dSandCollapse, dCoarseCollapse, nNotchLayer, dCliffElevPreCollapse, dCliffElevPostCollapse);
199int CSimulation::nDoCliffCollapse(
int const nCoast,
CRWCliff* pCliff,
double& dFineCollapse,
double& dSandCollapse,
double& dCoarseCollapse,
int& nNotchLayer,
double& dPreCollapseCellElev,
double& dPostCollapseCellElevNoTalus)
206 int const nPoly =
m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
221 nNotchLayer =
m_pRasterGrid->m_Cell[nX][nY].nGetLayerAtElev(dNotchElev);
227 double const dTopElevNoTalus =
m_pRasterGrid->m_Cell[nX][nY].dGetConsSedTopElevOmitTalus();
228 double const dTopElevIncTalus =
m_pRasterGrid->m_Cell[nX][nY].dGetConsSedTopElevIncTalus();
229 LogStream <<
m_ulIter <<
": cliff ready to collapse at [" << nX <<
"][" << nY <<
"] but notch apex is above sediment top, nNotchLayer = " << nNotchLayer <<
" dNotchElev = " << dNotchElev <<
" cons sediment top elev without talus = " << dTopElevNoTalus <<
" cons sediment top elev inc talus = " << dTopElevIncTalus << endl;
237 LogStream <<
m_ulIter <<
": " <<
WARN <<
"in nDoCliffCollapse(), [" << nX <<
"][" << nY <<
"] nNotchLayer is in basement" << endl;
250 int const nTopLayer =
m_pRasterGrid->m_Cell[nX][nY].nGetNumOfTopLayerAboveBasement();
255 LogStream <<
m_ulIter <<
": " <<
WARN <<
"in nDoCliffCollapse(), [" << nX <<
"][" << nY <<
"] nTopLayer = " << nTopLayer << endl;
260 for (
int nLayer = nNotchLayer; nLayer <= nTopLayer; nLayer++)
267 dPreCollapseCellElev =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevOmitTalus();
270 double dAvailable = 0;
271 double dFineConsLost = 0;
272 double dFineUnconsLost = 0;
273 double dSandConsLost = 0;
274 double dSandUnconsLost = 0;
275 double dCoarseConsLost = 0;
276 double dCoarseUnconsLost = 0;
279 for (
int n = nTopLayer; n > nNotchLayer; n--)
282 dAvailable =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->dGetFineDepth() -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->dGetNotchFineLost();
286 dFineCollapse += dAvailable;
287 dFineUnconsLost += dAvailable;
288 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->SetFineDepth(0);
289 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->SetNotchFineLost(0);
292 dAvailable =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->dGetSandDepth() -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->dGetNotchSandLost();
296 dSandCollapse += dAvailable;
297 dSandUnconsLost += dAvailable;
298 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->SetSandDepth(0);
299 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->SetNotchSandLost(0);
302 dAvailable =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->dGetCoarseDepth() -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->dGetNotchCoarseLost();
306 dCoarseCollapse += dAvailable;
307 dCoarseUnconsLost += dAvailable;
308 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->SetCoarseDepth(0);
309 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetUnconsolidatedSediment()->SetNotchCoarseLost(0);
313 dAvailable =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->dGetFineDepth() -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->dGetNotchFineLost();
317 dFineCollapse += dAvailable;
318 dFineConsLost += dAvailable;
319 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->SetFineDepth(0);
320 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->SetNotchFineLost(0);
323 dAvailable =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->dGetSandDepth() -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->dGetNotchSandLost();
327 dSandCollapse += dAvailable;
328 dSandConsLost += dAvailable;
329 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->SetSandDepth(0);
330 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->SetNotchSandLost(0);
333 dAvailable =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->dGetCoarseDepth() -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->dGetNotchCoarseLost();
337 dCoarseCollapse += dAvailable;
338 dCoarseConsLost += dAvailable;
339 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->SetCoarseDepth(0);
340 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(n)->pGetConsolidatedSediment()->SetNotchCoarseLost(0);
345 double const dNotchLayerTop =
m_pRasterGrid->m_Cell[nX][nY].dCalcLayerElev(nNotchLayer);
346 double const dNotchLayerThickness =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->dGetTotalThickness();
347 double const dNotchLayerFracRemoved = (dNotchLayerTop - dNotchElev) / dNotchLayerThickness;
350 double dFineDepth =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->dGetFineDepth();
351 dAvailable = dFineDepth -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->dGetNotchFineLost();
356 double const dLost = dAvailable * dNotchLayerFracRemoved;
357 dFineCollapse += dLost;
358 dFineUnconsLost += dLost;
359 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->SetFineDepth(dFineDepth - dLost);
360 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->SetNotchFineLost(0);
363 double dSandDepth =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->dGetSandDepth();
364 dAvailable = dSandDepth -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->dGetNotchSandLost();
369 double const dLost = dAvailable * dNotchLayerFracRemoved;
370 dSandCollapse += dLost;
371 dSandUnconsLost += dLost;
372 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->SetSandDepth(dSandDepth - dLost);
373 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->SetNotchSandLost(0);
376 double dCoarseDepth =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->dGetCoarseDepth();
377 dAvailable = dCoarseDepth -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->dGetNotchCoarseLost();
382 double const dLost = dAvailable * dNotchLayerFracRemoved;
383 dCoarseCollapse += dLost;
384 dCoarseUnconsLost += dLost;
385 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->SetCoarseDepth(dCoarseDepth - dLost);
386 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetUnconsolidatedSediment()->SetNotchCoarseLost(0);
390 dFineDepth =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->dGetFineDepth();
391 dAvailable = dFineDepth -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->dGetNotchFineLost();
396 double const dLost = dAvailable * dNotchLayerFracRemoved;
397 dFineCollapse += dLost;
398 dFineConsLost += dLost;
399 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->SetFineDepth(dFineDepth - dLost);
400 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->SetNotchFineLost(0);
403 dSandDepth =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->dGetSandDepth();
404 dAvailable = dSandDepth -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->dGetNotchSandLost();
409 double const dLost = dAvailable * dNotchLayerFracRemoved;
410 dSandCollapse += dLost;
411 dSandConsLost += dLost;
412 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->SetSandDepth(dSandDepth - dLost);
413 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->SetNotchSandLost(0);
416 dCoarseDepth =
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->dGetCoarseDepth();
417 dAvailable = dCoarseDepth -
m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->dGetNotchCoarseLost();
422 double const dLost = dAvailable * dNotchLayerFracRemoved;
423 dCoarseCollapse += dLost;
424 dCoarseConsLost += dLost;
425 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->SetCoarseDepth(dCoarseDepth - dLost);
426 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nNotchLayer)->pGetConsolidatedSediment()->SetNotchCoarseLost(0);
430 m_pRasterGrid->m_Cell[nX][nY].IncrCliffCollapseErosion(dFineCollapse, dSandCollapse, dCoarseCollapse);
436 dPostCollapseCellElevNoTalus =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevOmitTalus();
439 LogStream <<
m_ulIter <<
": \tcoast " << nCoast <<
" cliff collapse at [" << nX <<
"][" << nY <<
"], before talus deposition: original cell elevation = " << dPreCollapseCellElev <<
", new cell elevation = " << dPostCollapseCellElevNoTalus <<
", change in elevation = " << dPreCollapseCellElev - dPostCollapseCellElevNoTalus << endl;
473 int const nNewTopLayer =
m_pRasterGrid->m_Cell[nX][nY].nGetNumOfTopLayerAboveBasement();
489 double const dRunup =
m_VCoast[nCoast].dGetRunUp(nCoastPoint);
499 double const dSedTopElevNoTalus =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevOmitTalus();
501 assert(dNotchApexElev <= dSedTopElevNoTalus);
506 if (dWaveElev < dCutoffElev)
510 double const dSedTopElevIncTalus =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevIncTalus();
512 LogStream <<
m_ulIter <<
": \tNO incision of existing notch at [" << nX <<
"][" << nY <<
"] dWaveElev = " << dWaveElev <<
" dCutoffElev = " << dCutoffElev <<
" dRunup = " << dRunup <<
" dNotchApexElev = " << dNotchApexElev <<
" dSedTopElevNoTalus = " << dSedTopElevNoTalus <<
" dSedTopElevIncTalus = " << dSedTopElevIncTalus << endl;
519 if (dWaveElev > dNotchApexElev)
533 m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->AddToAccumWaveEnergy(dWaveEnergy* dWeight);
536 LogStream <<
m_ulIter <<
": \tincision of existing notch at [" << nX <<
"][" << nY <<
"] dWaveElev = " << dWaveElev <<
" dCutoffElev = " << dCutoffElev <<
" dRunup = " << dRunup <<
" dWeight = " << dWeight <<
" dNotchApexElev = " << dNotchApexElev <<
" dSedTopElevNoTalus = " << dSedTopElevNoTalus <<
" dNotchIncision = " << dNotchIncision << endl;
543 double const dSedTopElevNoTalus =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevOmitTalus();
554 if (dWaveElev < dCutoffElev)
558 double const dSedTopElevIncTalus =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevIncTalus();
560 LogStream <<
m_ulIter <<
": \tNO incision of new notch at [" << nX <<
"][" << nY <<
"] dWaveElev = " << dWaveElev <<
" dCutoffElev = " << dCutoffElev <<
" dRunup = " << dRunup <<
" dNotchApexElev = " << dNotchApexElev <<
" dSedTopElevNoTalus = " << dSedTopElevNoTalus <<
" dSedTopElevIncTalus = " << dSedTopElevIncTalus << endl;
567 if (dWaveElev > dNotchApexElev)
581 m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->AddToAccumWaveEnergy(dWaveEnergy * dWeight);
584 LogStream <<
m_ulIter <<
": \tincision of newly-created notch at [" << nX <<
"][" << nY <<
"] dWaveElev = " << dWaveElev <<
" dCutoffElev = " << dCutoffElev <<
" dRunup = " << dRunup <<
" dWeight = " << dWeight <<
" dNotchApexElev = " << dNotchApexElev <<
" dSedTopElevNoTalus = " << dSedTopElevNoTalus <<
" dNotchIncision = " << dNotchIncision << endl;
591 if ((nCoastPoint == 0) || (nCoastPoint ==
m_VCoast[nCoast].nGetCoastlineSize()-1))
607 LogStream <<
m_ulIter <<
": \tIn bCreateNotchInland() for [" << nX <<
"][" << nY <<
"]" << endl;
610 int const nSeaHandedness =
m_VCoast[nCoast].nGetSeaHandedness();
626 int const nXTmp = PtiTmp.
nGetX();
627 int const nYTmp = PtiTmp.
nGetY();
629 bool bPreExistingNotch;
632 double dNotchApexElev =
m_pRasterGrid->m_Cell[nXTmp][nYTmp].pGetLandform()->dGetCliffNotchApexElev();
637 bPreExistingNotch =
false;
643 bPreExistingNotch =
true;
646 double const dSedTopElevNoTalus =
m_pRasterGrid->m_Cell[nXTmp][nYTmp].dGetAllSedTopElevOmitTalus();
647 if (dNotchApexElev < dSedTopElevNoTalus)
651 if (bPreExistingNotch)
652 LogStream <<
m_ulIter <<
": \tIncision of pre-existing inland cliff at [" << nXTmp <<
"][" << nYTmp <<
"] dNotchApexElev = " << dNotchApexElev <<
" dSedTopElevNoTalus = " << dSedTopElevNoTalus << endl;
654 LogStream <<
m_ulIter <<
": \tCreation of new inland cliff at [" << nXTmp <<
"][" << nYTmp <<
"] dNotchApexElev = " << dNotchApexElev <<
" dSedTopElevNoTalus = " << dSedTopElevNoTalus << endl;
661 m_pRasterGrid->m_Cell[nXTmp][nYTmp].pGetLandform()->SetCliffNotchApexElev(dNotchApexElev);
665 if (dWaveElev > dNotchApexElev)
675 if (bPreExistingNotch)
676 m_pRasterGrid->m_Cell[nXTmp][nYTmp].pGetLandform()->AddToCliffNotchIncisionDepth(dNotchIncision);
678 m_pRasterGrid->m_Cell[nXTmp][nYTmp].pGetLandform()->SetCliffNotchIncisionDepth(dNotchIncision);
681 m_pRasterGrid->m_Cell[nXTmp][nYTmp].pGetLandform()->AddToAccumWaveEnergy(dWaveEnergy * dWeight);
684 double const dSedTopElevIncTalus =
m_pRasterGrid->m_Cell[nXTmp][nYTmp].dGetAllSedTopElevIncTalus();
686 assert(dNotchApexElev < dSedTopElevNoTalus);
688 LogStream <<
m_ulIter <<
": \tINLAND cliff created (or re-created) at [" << nXTmp <<
"][" << nYTmp <<
"] dNotchApexElev = " << dNotchApexElev <<
" dSedTopElevNoTalus = " << dSedTopElevNoTalus <<
" dSedTopElevIncTalus = " << dSedTopElevIncTalus <<
" dNotchIncision = " << dNotchIncision <<
" dNotchApexElev = " << dNotchApexElev << endl;
719 if (dSandFromCollapse > 0)
723 m_pRasterGrid->m_Cell[nX][nY].AddSandTalusDeposition(dSandFromCollapse);
726 if (dCoarseFromCollapse > 0)
730 m_pRasterGrid->m_Cell[nX][nY].AddCoarseTalusDeposition(dCoarseFromCollapse);
737 LogStream <<
m_ulIter <<
";\tcoast " << nCoast <<
" cliff collapse talus deposition on [" << nX <<
"][" << nY <<
"] dSandFromCollapse = " << dSandFromCollapse <<
" dCoarseFromCollapse = " << dCoarseFromCollapse <<
" sea depth = " <<
m_pRasterGrid->m_Cell[nX][nY].dGetSeaDepth() << endl;
750 int const nLayers =
m_pRasterGrid->m_Cell[nX][nY].nGetNumLayers();
751 for (
int nLayer = 0; nLayer < nLayers; nLayer++)
761 double const dThisTalusBottomElev =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevOmitTalus();
770 double const dRunup =
m_VCoast[nCoastClosest].dGetRunUp(nCoastPointClosest);
776 if (dWaveElev < dThisTalusBottomElev)
780 LogStream <<
m_ulIter <<
": \tNO talus moved from [" << nX <<
"][" << nY <<
"] since waves do not reach talus base: dWaveElev = " << dWaveElev <<
" dThisTalusBottomElev = " << dThisTalusBottomElev << endl;
786 double const dThisTalusTopElev =
m_pRasterGrid->m_Cell[nX][nY].dGetAllSedTopElevIncTalus();
787 double const dTalusDepth = dThisTalusTopElev - dThisTalusBottomElev;
790 if (dWaveElev > dThisTalusTopElev)
795 dWeight = 1 - ((dThisTalusTopElev - dWaveElev) / dTalusDepth);
800 LogStream <<
m_ulIter <<
": \tNO talus moved from [" << nX <<
"][" << nY <<
"] dWeight = " << dWeight << endl;
806 LogStream <<
m_ulIter <<
": \ttalus potentially moved from [" << nX <<
"][" << nY <<
"] dThisTalusBottomElev = " << dThisTalusBottomElev <<
" dThisTalusTopElev = " << dThisTalusTopElev <<
" dWeight = " << dWeight << endl;
811 double dTotElevDiff = 0;
812 vector<double> VdAdjElevDiff;
813 vector<CGeom2DIPoint> VptAdj;
815 for (
int nSearchDirection =
NORTH; nSearchDirection <=
NORTH_WEST; nSearchDirection++)
820 switch (nSearchDirection)
828 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
829 if (dAdjElev < dThisTalusTopElev)
832 VdAdjElevDiff.push_back(dAdjElev);
833 dTotElevDiff += dAdjElev;
845 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
846 if (dAdjElev < dThisTalusTopElev)
849 VdAdjElevDiff.push_back(dAdjElev);
850 dTotElevDiff += dAdjElev;
862 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
863 if (dAdjElev < dThisTalusTopElev)
866 VdAdjElevDiff.push_back(dAdjElev);
867 dTotElevDiff += dAdjElev;
879 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
880 if (dAdjElev < dThisTalusTopElev)
883 VdAdjElevDiff.push_back(dAdjElev);
884 dTotElevDiff += dAdjElev;
896 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
897 if (dAdjElev < dThisTalusTopElev)
900 VdAdjElevDiff.push_back(dAdjElev);
901 dTotElevDiff += dAdjElev;
913 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
914 if (dAdjElev < dThisTalusTopElev)
917 VdAdjElevDiff.push_back(dAdjElev);
918 dTotElevDiff += dAdjElev;
930 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
931 if (dAdjElev < dThisTalusTopElev)
934 VdAdjElevDiff.push_back(dAdjElev);
935 dTotElevDiff += dAdjElev;
947 dAdjElev =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].dGetAllSedTopElevIncTalus();
948 if (dAdjElev < dThisTalusTopElev)
951 VdAdjElevDiff.push_back(dAdjElev);
952 dTotElevDiff += dAdjElev;
960 int const nLower =
static_cast<int>(VptAdj.size());
965 LogStream <<
m_ulIter <<
": \tNO talus moved from [" << nX <<
"][" << nY <<
"] since no adjacent cells are lower" << endl;
971 vector<double> VdPropToMove(nLower);
972 for (
int n = 0; n < nLower; n++)
973 VdPropToMove[n] = VdAdjElevDiff[n] / dTotElevDiff;
985 double dTalusSandMoved = 0;
986 double dTalusCoarseMoved = 0;
987 double const dTalusErodibility = 0.3;
988 double const dSandRemovalRate = 1 * dTalusErodibility;
989 double const dCoarseRemovalRate = 0.8 * dTalusErodibility;
991 for (
int n = 0; n < nLower; n++)
993 if (dTalusSandToMove > 0)
996 int const nXAdj = VptAdj[n].nGetX();
997 int const nYAdj = VptAdj[n].nGetY();
999 int const nTopLayer =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].nGetNumOfTopLayerAboveBasement();
1000 double const dSandOnAdj =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->dGetSandDepth();
1002 double const dPotentialDepthToMove = pTalus->
dGetSandDepth() * dWeight * dSandRemovalRate * VdPropToMove[n] *
m_dTimeStep;
1003 double const dActualDepthToMove =
tMin(dTalusSandToMove, dPotentialDepthToMove);
1005 m_pRasterGrid->m_Cell[nXAdj][nYAdj].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->SetSandDepth(dSandOnAdj + dActualDepthToMove);
1006 dTalusSandToMove -= dActualDepthToMove;
1007 dTalusSandMoved += dActualDepthToMove;
1009 assert(dTalusSandToMove >= 0.0);
1014 LogStream <<
m_ulIter <<
": \t" << std::scientific << dActualDepthToMove << std::fixed <<
" talus sand deposited at [" << nXAdj <<
"][" << nYAdj <<
"], talus sand still to deposit on [" << nX <<
"][" << nY <<
"] = " << std::scientific << dTalusSandToMove <<
" talus sand removed = " << dTalusSandMoved << std::fixed << endl;
1020 if (dTalusCoarseToMove > 0)
1023 int const nXAdj = VptAdj[n].nGetX();
1024 int const nYAdj = VptAdj[n].nGetY();
1026 int const nTopLayer =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].nGetNumOfTopLayerAboveBasement();
1027 double const dCoarseOnAdj =
m_pRasterGrid->m_Cell[nXAdj][nYAdj].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->dGetCoarseDepth();
1029 double const dPotentialDepthToMove = pTalus->
dGetCoarseDepth() * dWeight * dCoarseRemovalRate * VdPropToMove[n] *
m_dTimeStep;
1030 double const dActualDepthToMove =
tMin(dTalusCoarseToMove, dPotentialDepthToMove);
1032 m_pRasterGrid->m_Cell[nXAdj][nYAdj].pGetLayerAboveBasement(nTopLayer)->pGetUnconsolidatedSediment()->SetSandDepth(dCoarseOnAdj + dActualDepthToMove);
1033 dTalusCoarseToMove -= dActualDepthToMove;
1034 dTalusCoarseMoved += dActualDepthToMove;
1036 assert(dTalusCoarseToMove >= 0.0);
1038 LogStream <<
m_ulIter <<
": \t" << std::scientific << dActualDepthToMove << std::fixed <<
" talus coarse deposited at [" << nXAdj <<
"][" << nYAdj <<
"], talus coarse still to deposit on [" << nX <<
"][" << nY <<
"] = " << std::scientific << dTalusCoarseToMove <<
" talus coarse removed = " << dTalusCoarseMoved << std::fixed << endl;
1049 if (dTalusSandMoved > 0)
1052 double const dTalusSandRemaining =
tMax(dTalusSandOrig - dTalusSandMoved, 0.0);
1057 if (dTalusCoarseMoved > 0)
1060 double const dTalusCoarseRemaining =
tMax(dTalusCoarseOrig - dTalusCoarseMoved, 0.0);
1068 LogStream <<
m_ulIter <<
": \tpTalus->dGetSandDepth() + pTalus->dGetCoarseDepth() = " << std::scientific << pTalus->
dGetSandDepth() + pTalus->
dGetCoarseDepth() << std::fixed <<
" so deleting talus object at [" << nX <<
"][" << nY <<
"]" << endl;
1069 m_pRasterGrid->m_Cell[nX][nY].pGetLayerAboveBasement(nLayer)->DeleteTalus();
1076 LogStream <<
m_ulIter <<
": \ttalus moved from [" << nX <<
"][" << nY <<
"] sea depth = " <<
m_pRasterGrid->m_Cell[nX][nY].dGetSeaDepth() << endl;
Contains CGeom2DIPoint definitions.
Geometry class used to represent 2D point objects with integer coordinates.
int nGetY(void) const
Returns the CGeom2DIPoint object's integer Y coordinate.
int nGetX(void) const
Returns the CGeom2DIPoint object's integer X coordinate.
Geometry class used for coast polygon objects.
void AddCliffCollapseToSuspensionFine(double const)
Add to the this-iteration total of unconsolidated fine sediment from cliff collapse which goes to sus...
void AddCliffCollapseErosionCoarse(double const)
Add to the this-iteration total of unconsolidated coarse sediment from cliff collapse on this polygon...
void AddCliffCollapseErosionFine(double const)
Add to the this-iteration total of unconsolidated fine sediment eroded from cliff collapse on this po...
void AddCliffCollapseErosionSand(double const)
Add to the this-iteration total of unconsolidated sand sediment from cliff collapse on this polygon,...
Real-world class used to represent the sediment layers associated with a cell object.
CRWCellTalus * pGetOrCreateTalus(void)
Returns a pointer to the layer's talus object. If there is no talus object, then create one.
Real-world class used to represent the talus (unconsolidated sediment resulting from cliff collapse) ...
double dGetCoarseDepth(void) const
Returns the coarse sediment depth equivalent for this talus object object.
double dGetSandDepth(void) const
Returns the sand sediment depth equivalent for this talus object.
void AddCoarseDepth(double const)
Adds coarse sediment (depth equivalent) to this talus object object's coarse sediment.
void SetSandDepth(double const)
Sets this talus object's sand sediment depth equivalent. Note no checks here to see if new equiv dept...
void SetCoarseDepth(double const)
Sets this talus object object's coarse sediment depth equivalent. Note no checks here to see if new e...
void AddSandDepth(double const)
Adds sand sediment (depth equivalent) to this talus object object's sand sediment.
Real-world class used to represent the 'cliff' category of coastal landform object.
void SetNotchApexElev(double const)
Sets the elevation of the apex of the erosional notch (in external CRS units)
bool bReadyToCollapse(double const) const
Returns true if the horizontal incision of the erosional notch exceeds the critical notch incision.
void IncreaseNotchIncision(double const)
Increases the horizontal incision (in external CRS units) of the erosional notch, measured inland fro...
void SetCliffCollapsed(void)
Flags the cliff as having collapsed.
void SetNotchIncision(double const)
Sets the horizontal incision (in external CRS units) of the erosional notch, measured inland from the...
double dGetNotchApexElev(void) const
Returns the elevation of the apex of the erosional notch (in external CRS units)
int m_nLogFileDetail
The level of detail in the log file output. Can be LOG_FILE_LOW_DETAIL, LOG_FILE_MIDDLE_DETAIL,...
int m_nNumTotCliffCollapse
The total number of cells with cliff collapse since the start of the simulation.
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int nMoveCliffTalusToUnconsolidated(void)
Move talus from previous cliff collapse to unconsolidated sediment.
int m_nXGridSize
The size of the grid in the x direction.
vector< CRWCoast > m_VCoast
The coastline objects.
int m_nNumThisIterCliffCollapse
The number of cells with cliff collapse this iteration.
int m_nYGridSize
The size of the grid in the y direction.
static CGeom2DIPoint PtiGetPerpendicular(CGeom2DIPoint const *, CGeom2DIPoint const *, double const, int const)
Returns a CGeom2DIPoint (grid CRS) which is the 'other' point of a two-point vector passing through P...
double m_dNotchIncisionAtCollapse
Notch overhang (i.e. length of horizontal incision at the apex elevation) to initiate collapse (m)
void DoCliffCollapseTalusDeposition(int const, CRWCliff const *, double const, double const, int const)
Deposit the unconsolidated sediment from cliff collapse as talus on the cell on which collapse occurr...
double m_dThisIterCliffCollapseErosionCoarseUncons
This-iteration total of coarse unconsolidated sediment produced by cliff collapse (m^3)
bool bCreateNotchInland(int const, int const, int const, int const, double const, double const)
If possible, creates an erosional notch further inland from a given coastline point.
double m_dThisIterCliffCollapseErosionFineUncons
This-iteration total of fine unconsolidated sediment produced by cliff collapse (m^3)
double m_dThisIterNewNotchApexElev
Elevation (m) of the apex of any cliff notches created during this iteration.
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
double dGridCentroidYToExtCRSY(int const) const
Given the integer Y-axis ordinate of a cell in the raster grid CRS, returns the external CRS Y-axis o...
int nDoCliffCollapse(int const, CRWCliff *, double &, double &, double &, int &, double &, double &)
Simulates cliff collapse on a single cell. Collapse happens when when a notch which is incised into t...
bool bIncreaseCliffNotchIncision(int const, int const, int const, CRWCliff *, double const)
Increase the incision (if any) of a cliff notch, assuming a linear decrease in incision with distance...
double m_dThisIterUnconsCoarseCliffDeposition
This-iteration total of coarse unconsolidated sediment deposited due to cliff collapse (m^3)
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
double m_dThisIterFineSedimentToSuspension
Total fine unconsolidated sediment in suspension for this iteration (depth in m)
int nDoAllWaveEnergyToCoastLandforms(void)
double m_dNotchApexAboveMHW
Distance of notch base below SWL (m)
vector< bool > m_bUnconsChangedThisIter
One element per layer: has the consolidated sediment of this layer been changed during this iteration...
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
double m_dTimeStep
The length of an iteration (a timestep) in hours.
double m_dCellArea
Area of a cell (in external CRS units)
bool bIsWithinValidGrid(int const, int const) const
Checks whether the supplied point (an x-y pair, in the grid CRS) is within the raster grid,...
int nFindClosestCoastPoint(int const, int const, int &)
Finds the number of the closest point on any coastline to a given point, or INT_NODATA in case of err...
double m_dThisIterCliffCollapseErosionSandCons
This-iteration total of sand consolidated sediment produced by cliff collapse (m^3)
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
unsigned long m_ulIter
The number of the current iteration (time step)
double dGridCentroidXToExtCRSX(int const) const
Given the integer X-axis ordinate of a cell in the raster grid CRS, returns the external CRS X-axis o...
double m_dCellSide
Length of a cell side (in external CRS units)
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
vector< bool > m_bConsChangedThisIter
One element per layer: has the consolidated sediment of this layer been changed during this iteration...
Contains CRWCliff definitions.
This file contains global definitions for CoastalME.
int const RTN_ERR_NO_TOP_LAYER
int const ELEV_ABOVE_SEDIMENT_TOP
int const LOG_FILE_MIDDLE_DETAIL
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
int const LF_CLIFF_INLAND
int const RTN_ERR_CLIFF_NOT_IN_POLYGON
double const CLIFF_NOTCH_CUTOFF_DISTANCE
int const LF_CLIFF_ON_COASTLINE
int const RTN_ERR_CLIFF_NOTCH
int const ELEV_IN_BASEMENT
double const SED_ELEV_TOLERANCE
int const RTN_ERR_CLIFF_TALUS_TO_UNCONS
Contains CSimulation definitions.