CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
do_beach_sediment_movement.cpp
Go to the documentation of this file.
1
12
13/* ==============================================================================================================================
14
15 This file is part of CoastalME, the Coastal Modelling Environment.
16
17 CoastalME 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; either version 3 of the License, or (at your option) any later version.
18
19 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.
20
21 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23==============================================================================================================================*/
24#include <assert.h>
25
26#include <cmath>
27
28#include <cfloat>
29
30#include <iostream>
31using std::cout;
32using std::endl;
33
34#include <string>
35using std::to_string;
36
37#include <algorithm>
38using std::stable_sort;
39
40#include "cme.h"
41#include "simulation.h"
42#include "coast.h"
43
44//===============================================================================================================================
46//===============================================================================================================================
47bool bPolygonAndAdjCompare(const vector<int> &nVLeft, const vector<int> &nVRight)
48{
49 // Each row (vector) of this vector-of-vectors is:
50 // 0: This-polygon global ID (not used)
51 // 1: This-polygon coast ID (in down-coast seq when sorted)
52 // 2: This-polygon down-coast (true) or up-coast (false) sediment movement
53 // 3 and subsequent: if sediment movement is down-coast, coast IDs of down-coast adjacent polygons; if sediment movement is up-coast, coast IDs of up-coast adjacent polygons
54
55 bool bDownCoastLeft = nVLeft[2];
56 bool bDownCoastRight = nVRight[2];
57
58 if (bDownCoastLeft)
59 {
60 // LHS polygon is down-coast. First, deal with polygon 0
61 if (nVLeft[1] == 0)
62 // Do not swap LHS and RHS polygons
63 return true;
64
65 if (nVRight[1] == 0)
66 // Swap LHS and RHS polygons
67 return false;
68
69 if ((nVLeft.size() >= 4) && (nVRight.size() >= 4))
70 {
71 // Search the adjacent polygons of the LHS argument, is there an "off edge" amongst them?
72 bool bLHSOffEdge = false;
73
74 for (unsigned int n = 3; n < nVLeft.size(); n++)
75 {
76 if (nVLeft[n] == INT_NODATA)
77 {
78 bLHSOffEdge = true;
79 break;
80 }
81 }
82
83 if (bLHSOffEdge)
84 // Yes, there is an "off edge" among the adjacent polygons of the LHS polygon: so swap LHS and RHS polygons
85 return false;
86
87 // Search the adjacent polygons of the RHS argument, is there an "off edge" amongst them?
88 bool bRHSOffEdge = false;
89
90 for (unsigned int n = 3; n < nVRight.size(); n++)
91 {
92 if (nVRight[n] == INT_NODATA)
93 {
94 bRHSOffEdge = true;
95 break;
96 }
97 }
98
99 if (bRHSOffEdge)
100 // Yes, there is an "off edge" among the adjacent polygons of the LHS polygon: do not swap LHS and RHS polygons
101 return true;
102
103 // Do we have a local change of sediment direction?
104 if (! bDownCoastRight)
105 // Yes, there is a change of sediment direction between this and the adjacent polygon. Keep the existing sequence
106 return true;
107
108 // Now sort out polygon-to-polygon dependencies. We need to put 'target' polygons after 'source' polygons, so that the source is processed before the target. So is the RHS polygon among the adjacent polygons of the LHS polygon?
109 bool bLeftFound = false;
110
111 for (unsigned int n = 3; n < nVLeft.size(); n++)
112 {
113 if (nVLeft[n] == nVRight[1])
114 bLeftFound = true;
115 }
116
117 if (bLeftFound)
118 // Yes, the RHS polygon is among the adjacent polygons of the LHS polygon, so uncons sediment movement is from the LHS polygon to the RHS polygon, and so down-coast (i.e. along the coast in the direction of increasing coastline point numbers). Keep the existing sequence
119 return true;
120
121 // Is the LHS polygon among the adjacent polygons of the RHS polygon?
122 bool bRightFound = false;
123
124 for (unsigned int n = 3; n < nVRight.size(); n++)
125 {
126 if (nVRight[n] == nVLeft[1])
127 bRightFound = true;
128 }
129
130 if (bRightFound)
131 // Yes, the LHS polygon is among the adjacent polygons of the RHS polygon, so uncons sediment movement is from the RHS polygon to the LHS polygon, and so up-coast (i.e. along the coast in the direction of decreasing coastline point numbers). Swap them
132 return false;
133 }
134
135 // Neither polygon has an "off edge", and each polygon does not have the other polygon's coast ID amongst its list of adjacent polygons. So just put the polygon in increasing own-coast sequence
136 if (nVLeft[1] < nVRight[1])
137 return true;
138
139 else
140 return false;
141 }
142
143 else
144 {
145 // LHS polygon is up-coast. First, deal with polygon 0
146 if (nVLeft[1] == 0)
147 // Swap LHS and RHS polygons
148 return false;
149
150 if (nVRight[1] == 0)
151 // Do not swap LHS and RHS polygons
152 return true;
153
154 if ((nVLeft.size() >= 4) && (nVRight.size() >= 4))
155 {
156 // Next, search the adjacent polygons of the LHS argument, is there an "off edge" amongst them?
157 bool bLHSOffEdge = false;
158
159 for (unsigned int n = 3; n < nVLeft.size(); n++)
160 {
161 if (nVLeft[n] == INT_NODATA)
162 {
163 bLHSOffEdge = true;
164 break;
165 }
166 }
167
168 if (bLHSOffEdge)
169 // Yes, there is an "off edge" among the adjacent polygons of the LHS polygon: so do not swap LHS and RHS polygons
170 return true;
171
172 // Search the adjacent polygons of the RHS argument, is there an "off edge" amongst them?
173 bool bRHSOffEdge = false;
174
175 for (unsigned int n = 3; n < nVRight.size(); n++)
176 {
177 if (nVRight[n] == INT_NODATA)
178 {
179 bRHSOffEdge = true;
180 break;
181 }
182 }
183
184 if (bRHSOffEdge)
185 // Yes, there is an "off edge" among the adjacent polygons of the LHS polygon: swap LHS and RHS polygons
186 return false;
187
188 // Do we have a local change of sediment direction?
189 if (! bDownCoastRight)
190 // Yes, there is a change of sediment direction between this and the adjacent polygon. Keep the existing sequence
191 return true;
192
193 // Now sort out polygon-to-polygon dependencies. We need to put 'target' polygons after 'source' polygons, so that the source is processed before the target. So is the RHS polygon among the adjacent polygons of the LHS polygon?
194 bool bLeftFound = false;
195
196 for (unsigned int n = 3; n < nVLeft.size(); n++)
197 {
198 if (nVLeft[n] == nVRight[1])
199 bLeftFound = true;
200 }
201
202 if (bLeftFound)
203 // Yes, the RHS polygon is among the adjacent polygons of the LHS polygon, so uncons sediment movement is from the LHS polygon to the RHS polygon, and so down-coast (i.e. along the coast in the direction of increasing coastline point numbers). Keep the existing sequence of polygons
204 return true;
205
206 // Is the LHS polygon among the adjacent polygons of the RHS polygon?
207 bool bRightFound = false;
208
209 for (unsigned int n = 3; n < nVRight.size(); n++)
210 {
211 if (nVRight[n] == nVLeft[1])
212 bRightFound = true;
213 }
214
215 if (bRightFound)
216 // Yes, the LHS polygon is among the adjacent polygons of the RHS polygon, so uncons sediment movement is from the RHS polygon to the LHS polygon, and so up-coast (i.e. along the coast in the direction of decreasing coastline point numbers). Swap the LHS and RHS polygons
217 return false;
218 }
219
220 // Neither polygon has an "off edge", and each polygon does not have the other polygon's coast ID amongst its list of adjacent polygons. So just put the polygons in decreasing own-coast sequence
221 if (nVLeft[1] < nVRight[1])
222 return false;
223
224 else
225 return true;
226 }
227
228 // Default return value, should never get here
229 return true;
230}
231
232//===============================================================================================================================
234//===============================================================================================================================
236{
237 for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
238 {
239 int nRet;
240
242 LogStream << m_ulIter << ": Calculating unconsolidated sediment transport" << endl;
243
244 // Update the values of pre-existing unconsolidated sediment, for all three size classes, to include unconsolidated sediment derived from platform erosion, cliff collapse, and sediment input events
246
248 {
251 }
252
253 // Now route actually-eroded sand/coarse sediment to adjacent polygons, or off-grid. Sort polygons first
254 // Each row (vector) of this vector-of-vectors is:
255 // 0: This-polygon global ID
256 // 1: This-polygon coast ID (in down-coast seq when sorted)
257 // 2: This-polygon down-coast (true) or up-coast (false) sediment movement
258 // 3 and subsequent: if sediment movement is down-coast, coast IDs of down-coast adjacent polygons; if sediment movement is up-coast, coast IDs of up-coast adjacent polygons
259 vector<vector<int> > nVVPolyAndAdjacent;
260 vector<int> nVPolyAndAdj;
261
262 for (int nn = 0; nn < m_VCoast[nCoast].nGetNumPolygons(); nn++)
263 {
264 CGeomCoastPolygon const* pPolygon = m_VCoast[nCoast].pGetPolygon(nn);
265 nVPolyAndAdj.clear();
266
267 // The first [0] nVPolyAndAdj array item is the polygon's global ID
268 nVPolyAndAdj.push_back(pPolygon->nGetGlobalID());
269
270 // The second [1] nVPolyAndAdj array item is the polygon's down-coast ID
271 nVPolyAndAdj.push_back(pPolygon->nGetCoastID());
272
273 if (pPolygon->bDownCoastThisIter())
274 {
275 // Sediment is leaving this polygon in a down-coast direction. Set this as the third [2] nVPolyAndAdj array item
276 nVPolyAndAdj.push_back(true);
277
278 // Fourth [3] and subsequent nVPolyAndAdj array items are the down-coast seqs of adjacent down-coast polygons
279 for (int nAdj = 0; nAdj < pPolygon->nGetNumDownCoastAdjacentPolygons(); nAdj++)
280 {
281 // Save the coast ID of each down-coast adjacent polygon
282 int nAdjPolyID = pPolygon->nGetDownCoastAdjacentPolygon(nAdj);
283 nVPolyAndAdj.push_back(nAdjPolyID);
284 }
285 }
286
287 else
288 {
289 // Sediment is leaving this polygon in an up-coast direction. Set this as the third [2] nVPolyAndAdj array item
290 nVPolyAndAdj.push_back(false);
291
292 // Fourth [3] and susequent nVPolyAndAdj array items are the down-coast IDs of adjacent up-coast polygons
293 for (int nAdj = 0; nAdj < pPolygon->nGetNumUpCoastAdjacentPolygons(); nAdj++)
294 {
295 // Save the coast ID of each up-coast adjacent polygon
296 int nAdjPolyID = pPolygon->nGetUpCoastAdjacentPolygon(nAdj);
297 nVPolyAndAdj.push_back(nAdjPolyID);
298 }
299 }
300
301 // Save this 'row'
302 nVVPolyAndAdjacent.push_back(nVPolyAndAdj);
303 }
304
305 // Write out the unsorted polygon sequence
307 WritePolygonUnsortedSequence(nCoast, nVVPolyAndAdjacent);
308
309 // OK, now sort the array using bPolygonAndAdjCompare(), so that 'target' polygons are processed after 'source' polygons NOTE: crashes if just use "sort", related to this? https://stackoverflow.com/questions/18291620/why-will-stdsort-crash-if-the-comparison-function-is-not-as-operator
310 stable_sort(nVVPolyAndAdjacent.begin(), nVVPolyAndAdjacent.end(), bPolygonAndAdjCompare);
311
312 // And check for circularities i.e. where poly X -> poly Y -> poly X. Note that we only look for two-way circularities. i.e. we ignore poly A -> poly B -> Poly C -> poly A patterns. These are probably pretty rare, however
313 vector<int> VnSourcePolygons;
314
315 for (int n = 0; n < static_cast<int>(nVVPolyAndAdjacent.size()); n++)
316 {
317 int nThisPoly = nVVPolyAndAdjacent[n][1];
318 VnSourcePolygons.push_back(nThisPoly);
319
320 for (int m = 3; m < static_cast<int>(nVVPolyAndAdjacent[n].size()); m++)
321 {
322 // Check the adjacent polygon(s) for circularities
323 int nToFind = nVVPolyAndAdjacent[n][m];
324 vector<int>::iterator it = find(VnSourcePolygons.begin(), VnSourcePolygons.end(), nToFind);
325
326 if (it != VnSourcePolygons.end())
327 {
328 // Uh-oh: this adjacent polygon is in the list of previously-processed source polygons. So store the coast ID numbers of the polygons with circularity in both polygons
329 CGeomCoastPolygon* pPoly = m_VCoast[nCoast].pGetPolygon(nThisPoly);
330 pPoly->AddCircularity(nToFind);
331
332 pPoly = m_VCoast[nCoast].pGetPolygon(nToFind);
333 pPoly->AddCircularity(nThisPoly);
334 }
335 }
336 }
337
339 WritePolygonSortedSequence(nCoast, nVVPolyAndAdjacent);
340
341 int nNumPolygons = m_VCoast[nCoast].nGetNumPolygons();
342
343 // Now process all polygons and do the actual (supply-limited) unconsolidated sediment movement
344 for (int nPoly = 0; nPoly < nNumPolygons; nPoly++)
345 {
346 int nPolygon = nVVPolyAndAdjacent[nPoly][1];
347 CGeomCoastPolygon* pPolygon = m_VCoast[nCoast].pGetPolygon(nPolygon);
348
349 // // DEBUG CODE =====================
350 // int nUpCoastProfile = pPolygon->nGetUpCoastProfile();
351 // CGeomProfile* pUpCoastProfile = m_VCoast[nCoast].pGetProfile(nUpCoastProfile);
352 // int nDownCoastProfile = pPolygon->nGetDownCoastProfile();
353 // CGeomProfile* pDownCoastProfile = m_VCoast[nCoast].pGetProfile(nDownCoastProfile);
354 // int nNumUpCoastCell = pUpCoastProfile->nGetNumCellsInProfile();
355 // int nNumDownCoastCell = pDownCoastProfile->nGetNumCellsInProfile();
356 // LogStream << "pUpCoastProfile->nGetNumCellsInProfile() = " << nNumUpCoastCell << " pDownCoastProfile->nGetNumCellsInProfile() = " << nNumDownCoastCell << endl;
357 // // DEBUG CODE =====================
358
359 // // DEBUG CODE ============================================================================================================================================
360 // // Get total depths of sand consolidated and unconsolidated for every cell
361 // if (m_ulIter == 5)
362 // {
363 // double dTmpSandUncons = 0;
364 // for (int nX1 = 0; nX1 < m_nXGridSize; nX1++)
365 // {
366 // for (int nY1 = 0; nY1 < m_nYGridSize; nY1++)
367 // {
368 // dTmpSandUncons += m_pRasterGrid->m_Cell[nX1][nY1].dGetTotUnconsSand();
369 // }
370 // }
371 //
372 // LogStream << endl;
373 // LogStream << "*****************************" << endl;
374 // LogStream << m_ulIter << ": before beach movement on nPoly = " << nPoly << " TOTAL UNCONSOLIDATED SAND ON ALL CELLS = " << dTmpSandUncons * m_dCellArea << endl;
375 // }
376 // // DEBUG CODE ============================================================================================================================================
377
378 // Do deposition first: does this polygon have coarse deposition?
379 double dCoarseDepositionTarget = pPolygon->dGetToDoBeachDepositionUnconsCoarse();
380
381 if (dCoarseDepositionTarget > 0)
382 {
383 // It does, first tho', if we have some coarse sediment which we were unable to deposit on the previously-processed polygon (which could be the last-processed polygon of the previous timestep), then add this in
385 {
386 // We had some coarse unconsolidated sediment which we were unable to deoosit on the last polygon (which could have been the last polygon of the previous iteration). So add it to the total to be deposited here
388 LogStream << m_ulIter << ": nPoly = " << nPolygon << " dCoarseDepositionTarget was = " << dCoarseDepositionTarget * m_dCellArea << " adding m_dDepositionCoarseDiff = " << m_dDepositionCoarseDiff * m_dCellArea;
389
390 dCoarseDepositionTarget += m_dDepositionCoarseDiff;
392
394 LogStream << " dCoarseDepositionTarget now = " << dCoarseDepositionTarget << endl;
395 }
396
397 // OK, do deposition of coarse sediment: calculate a net increase in depth of coarse-sized unconsolidated sediment on the cells within the polygon. Note that some cells may decrease in elevation (i.e. have some coarse-sized sediment erosion) however
398 double dCoarseDeposited = 0;
399 nRet = nDoUnconsDepositionOnPolygon(nCoast, pPolygon, TEXTURE_COARSE, dCoarseDepositionTarget, dCoarseDeposited);
400
401 if (nRet != RTN_OK)
402 return nRet;
403
404 double dCoarseNotDeposited = dCoarseDepositionTarget - dCoarseDeposited;
405
406 if (dCoarseNotDeposited > 0)
407 {
408 m_dDepositionCoarseDiff += dCoarseNotDeposited;
409 }
410 }
411
412 // Does this polygon have sand deposition?
413 double dSandDepositionTarget = pPolygon->dGetToDoBeachDepositionUnconsSand();
414
415 if (dSandDepositionTarget > 0)
416 {
417 // It does, first tho', if we have some sand sediment which we were unable to deposit on the previously-processed polygon (which could be the last-processed polygon of the previous timestep), then add this in
419 {
420 // We had some sand unconsolidated sediment which we were unable to deoosit on the last polygon (which could have been the last polygon of the previous iteration). So add it to the total to be deposited here
422 LogStream << m_ulIter << ": nPolygon = " << nPolygon << " dSandDepositionTarget was = " << dSandDepositionTarget * m_dCellArea << " adding m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea;
423
424 dSandDepositionTarget += m_dDepositionSandDiff;
426
428 LogStream << " dSandDepositionTarget now = " << dSandDepositionTarget << endl;
429 }
430
431 // Now do deposition of sand sediment: calculate a net increase in depth of sand-sized unconsolidated sediment on the cells within the polygon. Note that some cells may decrease in elevation (i.e. have some sand-sized sediment erosion) however
432 double dSandDeposited = 0;
433 nRet = nDoUnconsDepositionOnPolygon(nCoast, pPolygon, TEXTURE_SAND, dSandDepositionTarget, dSandDeposited);
434
435 if (nRet != RTN_OK)
436 return nRet;
437
438 double dSandNotDeposited = dSandDepositionTarget - dSandDeposited;
439
440 if (dSandNotDeposited > 0)
441 {
442 m_dDepositionSandDiff += dSandNotDeposited;
443 }
444
445 // // DEBUG CODE #####################
446 // if (m_ulIter == 5)
447 // {
448 // LogStream << m_ulIter << ": after sand deposition on nPoly = " << nPoly << " dSandDepositionTarget = " << dSandDepositionTarget * m_dCellArea << " dSandDeposited = " << dSandDeposited * m_dCellArea << " dSandNotDeposited = " << dSandNotDeposited * m_dCellArea << " m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << endl;
449 //
450 // double dTmpSandUncons = 0;
451 // for (int nX1 = 0; nX1 < m_nXGridSize; nX1++)
452 // {
453 // for (int nY1 = 0; nY1 < m_nYGridSize; nY1++)
454 // {
455 // dTmpSandUncons += m_pRasterGrid->m_Cell[nX1][nY1].dGetTotUnconsSand();
456 // }
457 // }
458 //
459 // LogStream << m_ulIter << ": after sand deposition on nPoly = " << nPoly << " TOTAL UNCONSOLIDATED SAND ON ALL CELLS = " << dTmpSandUncons * m_dCellArea << endl;
460 // }
461 // // DEBUG CODE #####################
462 }
463
464 // Now do erosion
465 double dPotentialErosion = -pPolygon->dGetPotentialErosion();
466
467 if (dPotentialErosion > 0)
468 {
469 // There is some erosion on this polygon: process this in the sequence fine, sand, coarse. Is there any fine sediment on this polygon?
470 double dExistingUnconsFine = pPolygon->dGetPreExistingUnconsFine();
471
472 if (dExistingUnconsFine > 0)
473 {
474 // Yes there is, so crudely partition this potential value for this size class by erodibility, the result will almost always be much greater than actual (supply limited) erosion
475 double dFinePotentialErosion = dPotentialErosion * m_dFineErodibilityNormalized;
476
477 // Now reduce this further, by considering the total depth of fine sediment on the polygon
478 double dFineErosionTarget = tMin(dFinePotentialErosion, dExistingUnconsFine);
479
480 // OK, do the supply-limited erosion of fine sediment
481 double dFineEroded = 0;
482 nRet = nDoUnconsErosionOnPolygon(nCoast, pPolygon, TEXTURE_FINE, dFineErosionTarget, dFineEroded);
483
484 if (nRet != RTN_OK)
485 return nRet;
486
487 if (dFineEroded > 0)
488 {
489 // We eroded some fine sediment, so add to the this-iteration total. Note that total this gets added in to the suspended load elsewhere, so no need to do it here
490 m_dThisIterBeachErosionFine += dFineEroded;
491
492 // Also add to the suspended load
494
495 // Store the amount of unconsolidated fine beach sediment eroded for this polygon
496 pPolygon->SetBeachErosionUnconsFine(-dFineEroded);
497 }
498 }
499
500 // Is there any sand-sized sediment on this polygon?
501 double dExistingUnconsSand = pPolygon->dGetPreExistingUnconsSand();
502 double dSandEroded = 0;
503
504 if (dExistingUnconsSand > 0)
505 {
506 // There is: so crudely partition this potential value for this size class by erodibility, the result will almost always be much greater than actual (supply limited) erosion
507 double dSandPotentialErosion = dPotentialErosion * m_dSandErodibilityNormalized;
508
509 // Now reduce this further, by considering the total depth of sand sediment on the polygon
510 double dSandErosionTarget = tMin(dSandPotentialErosion, dExistingUnconsSand);
511
512 // OK, do the supply-limited erosion of sand sediment
513 nRet = nDoUnconsErosionOnPolygon(nCoast, pPolygon, TEXTURE_SAND, dSandErosionTarget, dSandEroded);
514
515 if (nRet != RTN_OK)
516 return nRet;
517
518 if (dSandEroded > 0)
519 {
520 // We eroded some sand sediment, so add to the this-iteration total
521 m_dThisIterBeachErosionSand += dSandEroded;
522
523 // Store the amount eroded for this polygon
524 pPolygon->SetBeachErosionUnconsSand(-dSandEroded);
525 }
526
527 // // DEBUG CODE #####################
528 // if (m_ulIter == 5)
529 // {
530 // LogStream << m_ulIter << ": nPoly = " << nPoly << " dSandErosionTarget = " << dSandErosionTarget * m_dCellArea << " m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << " dSandEroded = " << dSandEroded * m_dCellArea << " m_dThisIterBeachErosionSand = " << m_dThisIterBeachErosionSand * m_dCellArea << endl;
531 //
532 // double dTmpSandUncons = 0;
533 // for (int nX1 = 0; nX1 < m_nXGridSize; nX1++)
534 // {
535 // for (int nY1 = 0; nY1 < m_nYGridSize; nY1++)
536 // {
537 // dTmpSandUncons += m_pRasterGrid->m_Cell[nX1][nY1].dGetTotUnconsSand();
538 // }
539 // }
540 //
541 // LogStream << m_ulIter << ": after sand erosion on nPoly = " << nPoly << " TOTAL UNCONSOLIDATED SAND ON ALL CELLS = " << dTmpSandUncons * m_dCellArea << endl;
542 // }
543 // // DEBUG CODE #####################
544 }
545
546 // Is there any coarse sediment on this polygon?
547 double dExistingUnconsCoarse = pPolygon->dGetPreExistingUnconsCoarse();
548 double dCoarseEroded = 0;
549
550 if (dExistingUnconsCoarse > 0)
551 {
552 // There is: so crudely partition this potential value for this size class by erodibility, the result will almost always be much greater than actual (supply limited) erosion
553 double dCoarsePotentialErosion = dPotentialErosion * m_dCoarseErodibilityNormalized;
554
555 // Now reduce this further, by considering the total depth of coarse sediment on the polygon
556 double dCoarseErosionTarget = tMin(dCoarsePotentialErosion, dExistingUnconsCoarse);
557
558 // OK, do the supply-limited erosion of coarse sediment
559 nRet = nDoUnconsErosionOnPolygon(nCoast, pPolygon, TEXTURE_COARSE, dCoarseErosionTarget, dCoarseEroded);
560
561 if (nRet != RTN_OK)
562 return nRet;
563
564 if (dCoarseEroded > 0)
565 {
566 // We eroded some coarse sediment, so add to the this-iteration toal
567 m_dThisIterBeachErosionCoarse += dCoarseEroded;
568
569 // Store the amount eroded for this polygon
570 pPolygon->SetBeachErosionUnconsCoarse(-dCoarseEroded);
571 }
572 }
573
574 // OK we now have the actual values of sediment eroded from this polygon, so next determine where this eroded sand and coarse sediment goes (have to consider fine sediment too, because this goes off-grid on grid-edge polygons). Only do this if some sand or coarse was eroded on this polygon
575 if ((dSandEroded + dCoarseEroded) > 0)
576 {
577 if (pPolygon->bDownCoastThisIter())
578 {
579 // Moving eroded sediment down-coast
580 int nNumAdjPoly = pPolygon->nGetNumDownCoastAdjacentPolygons();
581
582 for (int nn = 0; nn < nNumAdjPoly; nn++)
583 {
584 int nAdjPoly = pPolygon->nGetDownCoastAdjacentPolygon(nn);
585
586 // if (m_nLogFileDetail >= LOG_FILE_MIDDLE_DETAIL)
587 // LogStream << m_ulIter << ": polygon " << nPoly << " moves sediment down-coast to polygon " << nAdjPoly << endl;
588
589 if (nAdjPoly == INT_NODATA)
590 {
591 // Sediment is leaving the grid
592 if (pPolygon->bIsCoastStartPolygon())
593 {
594 // Error: uncons sediment movement is down-coast and off-edge, but this polygon is at the up-coast end of the coastline
596 LogStream << m_ulIter << ": " << ERR << "in sediment export. Unconsolidated sediment movement is DOWN-COAST, and sediment is leaving the grid, but polygon " << nPolygon << " is at the up-coast end of the coastline. This will result in mass balance problems." << endl;
597 }
598
599 else if (pPolygon->bIsCoastEndPolygon())
600 {
601 // This is the polygon at the down-coast end of the coastline, and uncons sediment movement is down-coast. Decide what to do based on the user setting m_nUnconsSedimentHandlingAtGridEdges
603 {
604 // Closed grid edges: no uncons sediment moves off-grid, nothing is removed from this polygon, so cannot adjust sediment export
606 LogStream << m_ulIter << ": when adjusting sediment export, polygon " << nPolygon << " is at the down-coast end of the coastline, and actual sediment movement is DOWN-COAST. Since grid edges are closed, no sand or coarse unconsolidated sediment goes off-grid so cannot adjust sediment export. This will result in mass balance problems." << endl;
607 }
608
610 {
611 // Open grid edges, so this sediment goes off-grid
612 m_dThisIterLeftGridUnconsSand += dSandEroded;
613 m_dThisIterLeftGridUnconsCoarse += dCoarseEroded;
614
615 // // DEBUG CODE ##################
616 // if (m_ulIter == 5)
617 // {
618 // LogStream << m_ulIter << ": nPoly = " << nPoly << " LOST FROM GRID = " << dSandEroded * m_dCellArea << endl;
619 // }
620 // // DEBUG CODE ##################
621 }
622
624 {
625 // Re-circulating grid edges, so adjust the sediment exported to the polygon at the up-coast end of this coastline
626 int nOtherEndPoly = 0;
627 CGeomCoastPolygon* pOtherEndPoly = m_VCoast[nCoast].pGetPolygon(nOtherEndPoly);
628
629 if (dSandEroded > 0)
630 {
631 // Add to the still-to-do total of unconsolidated sand to be deposited on the polygon at the up-coast end of this coastline
632 pOtherEndPoly->AddToDoBeachDepositionUnconsSand(dSandEroded);
633 }
634
635 if (dCoarseEroded > 0)
636 {
637 // Add to the still-to-do total of unconsolidated coarse sediment to be deposited on the polygon at the up-coast end of this coastline
638 pOtherEndPoly->AddToDoBeachDepositionUnconsCoarse(dCoarseEroded);
639 }
640 }
641 }
642 }
643
644 else
645 {
646 // This polygon is not at the grid edge
647 CGeomCoastPolygon* pAdjPolygon = m_VCoast[nCoast].pGetPolygon(nAdjPoly);
648 double dBoundaryShare = pPolygon->dGetDownCoastAdjacentPolygonBoundaryShare(nn);
649
650 if (dSandEroded > 0)
651 {
652 // if (m_ulIter == 5)
653 // LogStream << m_ulIter << ": B polygon not at grid edge nPoly = " << nPoly << " nAdjPoly = " << nAdjPoly << ", dGetToDoBeachDepositionUnconsSand() on nAdjPoly is = " << pAdjPolygon->dGetToDoBeachDepositionUnconsSand() * m_dCellArea << endl;
654
655 // Add to the still-to-do total of unconsolidated sand to be deposited on the adjacent polygon
656 pAdjPolygon->AddToDoBeachDepositionUnconsSand(dSandEroded * dBoundaryShare);
657
658 // if (m_ulIter == 5)
659 // LogStream << m_ulIter << ": B after nAdjPoly = " << nAdjPoly << " AddToDoBeachDepositionUnconsSand(" << dSandEroded * dBoundaryShare * m_dCellArea << ") dGetToDoBeachDepositionUnconsSand() now = " << pAdjPolygon->dGetToDoBeachDepositionUnconsSand() * m_dCellArea << endl;
660 }
661
662 if (dCoarseEroded > 0)
663 {
664 // if (m_nLogFileDetail >= LOG_FILE_ALL)
665 // LogStream << m_ulIter << ": polygon = " << nPoly << " adjacent polygon = " << nAdjPoly << ", beach deposition 1 of uncons coarse was = " << pAdjPolygon->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea;
666
667 // Add to the still-to-do total of unconsolidated coarse sediment to be deposited on the adjacent polygon
668 pAdjPolygon->AddToDoBeachDepositionUnconsCoarse(dCoarseEroded * dBoundaryShare);
669
670 // if (m_nLogFileDetail >= LOG_FILE_ALL)
671 // LogStream << " after AddToDoBeachDepositionUnconsCoarse(" << dCoarseEroded * dBoundaryShare << ") beach deposition 1 of uncons coarse now = " << pAdjPolygon->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea << endl;
672 }
673 }
674 }
675
676 // if (m_nLogFileDetail >= LOG_FILE_ALL)
677 // LogStream << m_ulIter << ": 1 uncons sand eroded = " << dSandEroded * m_dCellArea << " 1 uncons coarse eroded = " << dCoarseEroded * m_dCellArea << endl;
678 }
679
680 else
681 {
682 // Moving eroded sediment up-coast
683 int nNumAdjPoly = pPolygon->nGetNumUpCoastAdjacentPolygons();
684
685 for (int nn = 0; nn < nNumAdjPoly; nn++)
686 {
687 int nAdjPoly = pPolygon->nGetUpCoastAdjacentPolygon(nn);
688 // if (m_nLogFileDetail >= LOG_FILE_ALL)
689 // LogStream << m_ulIter << ": polygon " << nPoly << " moves sediment up-coast to polygon " << nAdjPoly << endl;
690
691 if (nAdjPoly == INT_NODATA)
692 {
693 // Sediment is leaving the grid
694 if (pPolygon->bIsCoastEndPolygon())
695 {
696 // Error: uncons sediment movement is down-coast and off-edge, but this polygon is at the up-coast end of the coastline
698 LogStream << m_ulIter << ": " << ERR << "in sediment export. Unconsolidated sediment movement is UP-COAST, and sediment is leaving the grid, but polygon " << nPolygon << " is at the down-coast end of the coastline. This will result in mass balance problems." << endl;
699
700 }
701
702 else if (pPolygon->bIsCoastStartPolygon())
703 {
704 // This is the polygon at the up-coast end of the coastline, and uncons sediment movement is up-coast. Decide what to do based on the user setting m_nUnconsSedimentHandlingAtGridEdges
706 {
707 // Closed grid edges: no uncons sediment moves off-grid, nothing is removed from this polygon, so cannot adjust sediment export
709 LogStream << m_ulIter << ": when adjusting sediment export, polygon " << nPolygon << " is at the up-coast end of the coastline, and actual sediment movement is UP-COAST. Since grid edges are closed, no sand or coarse unconsolidated sediment goes off-grid so cannot adjust sediment export" << endl;
710 }
711
713 {
714 // Open grid edges, so this sediment goes off-grid
715 m_dThisIterLeftGridUnconsSand += dSandEroded;
716 m_dThisIterLeftGridUnconsCoarse += dCoarseEroded;
717 }
718
720 {
721 // Re-circulating grid edges, so adjust the sediment exported to the polygon at the up-coast end of this coastline TODO 016 Check whether this causes mass balance problems, depending on the sequence of polygon processing
722 int nOtherEndPoly = 0;
723 CGeomCoastPolygon* pOtherEndPoly = m_VCoast[nCoast].pGetPolygon(nOtherEndPoly);
724
725 if (dSandEroded > 0)
726 {
727 // Add to the still-to-do total of unconsolidated sand to be deposited on the polygon at the up-coast end of this coastline
728 pOtherEndPoly->AddToDoBeachDepositionUnconsSand(dSandEroded);
729 }
730
731 if (dCoarseEroded > 0)
732 {
733 // Add to the still-to-do total of unconsolidated coarse sediment to be deposited on the polygon at the up-coast end of this coastline
734 pOtherEndPoly->AddToDoBeachDepositionUnconsCoarse(dCoarseEroded);
735 }
736 }
737 }
738 }
739
740 else
741 {
742 // This polygon is not at the grid edge
743 CGeomCoastPolygon* pAdjPolygon = m_VCoast[nCoast].pGetPolygon(nAdjPoly);
744 double dBoundaryShare = pPolygon->dGetUpCoastAdjacentPolygonBoundaryShare(nn);
745
746 if (dSandEroded > 0)
747 {
748 // if (m_ulIter == 5)
749 // LogStream << m_ulIter << ": A polygon not at grid edge nPoly = " << nPoly << " nAdjPoly = " << nAdjPoly << ", dGetToDoBeachDepositionUnconsSand() on nAdjPoly is = " << pAdjPolygon->dGetToDoBeachDepositionUnconsSand() * m_dCellArea << endl;
750
751 // Add to the still-to-do total of unconsolidated sand to be deposited on the the adjacent polygon
752 pAdjPolygon->AddToDoBeachDepositionUnconsSand(dSandEroded * dBoundaryShare);
753
754 // if (m_ulIter == 5)
755 // LogStream << m_ulIter << ": A after nAdjPoly = " << nAdjPoly << " AddToDoBeachDepositionUnconsSand(" << dSandEroded * dBoundaryShare * m_dCellArea << ") dGetToDoBeachDepositionUnconsSand() now = " << pAdjPolygon->dGetToDoBeachDepositionUnconsSand() * m_dCellArea << endl;
756 }
757
758 if (dCoarseEroded > 0)
759 {
760 // if (m_ulIter == 5)
761 // LogStream << m_ulIter << ": polygon not at grid edge nPoly = " << nPoly << " nAdjPoly = " << nAdjPoly << ", beach deposition of uncons coarse was = " << pAdjPolygon->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea << endl;
762
763 // Add to the still-to-do total of unconsolidated coarse sediment to be deposited on the adjacent polygon
764 pAdjPolygon->AddToDoBeachDepositionUnconsCoarse(+dCoarseEroded * dBoundaryShare);
765
766 // if (m_ulIter == 5)
767 // LogStream << " After AddToDoBeachDepositionUnconsCoarse(" << dCoarseEroded * dBoundaryShare << ") uncons coarse now = " << pAdjPolygon->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea << endl;
768 }
769 }
770 }
771 }
772 }
773
774 // if (m_nLogFileDetail >= LOG_FILE_ALL)
775 // LogStream << m_ulIter << ": sand eroded on poly = " << dSandEroded * m_dCellArea << " coarse eroded on poly = " << dCoarseEroded * m_dCellArea << endl;
776
777 } // if (dPotentialErosion > 0)
778
779 // // DEBUG CODE ============================================================================================================================================
780 // // Get total depths of unconsolidated sand for every cell
781 // if (m_ulIter == 5)
782 // {
783 // double dTmpSandUncons = 0;
784 // for (int nX1 = 0; nX1 < m_nXGridSize; nX1++)
785 // {
786 // for (int nY1 = 0; nY1 < m_nYGridSize; nY1++)
787 // {
788 // dTmpSandUncons += m_pRasterGrid->m_Cell[nX1][nY1].dGetTotUnconsSand();
789 // }
790 // }
791 //
792 // LogStream << endl;
793 // LogStream << m_ulIter << ": TOTAL UNCONSOLIDATED SAND ON ALL CELLS after beach movement on nPoly = " << nPoly << " dTmpSandUncons = " << dTmpSandUncons * m_dCellArea << " (dTmpSandUncons - m_dStartIterUnconsSandAllCells) = " << (dTmpSandUncons - m_dStartIterUnconsSandAllCells) * m_dCellArea << endl;
794 //
795 // // Now get the total in all still-to-do fields of all polygons
796 // double dToDoTot = 0;
797 //
798 // for (int nn = 0; nn < nPolygons; nn++)
799 // {
800 // CGeomCoastPolygon* pThisPolygon = m_VCoast[nCoast].pGetPolygon(nn);
801 // dToDoTot += pThisPolygon->dGetToDoBeachDepositionUnconsSand();
802 // }
803 //
804 // LogStream << endl << m_ulIter << ": dToDoTot = " << dToDoTot * m_dCellArea << endl;
805 // LogStream << m_ulIter << ": dTmpSandUncons + dToDoTot = " << (dTmpSandUncons + dToDoTot) * m_dCellArea << endl << endl;
806 //
807 // LogStream << m_ulIter << ": m_dThisIterLeftGridUnconsSand = " << m_dThisIterLeftGridUnconsSand * m_dCellArea << endl;
808 //
809 // LogStream << "*****************************" << endl;
810 // }
811 // // DEBUG CODE ============================================================================================================================================
812
813 } // for (int n = 0; n < nNumPolygons; n++)
814
815 // OK we have processed all polygons, But if there are adjacent-polygon circularities (i.e. Polygon A -> Polygon B -> Polygon A) then we may have some still-to-do deposition on at least one polygon. So look through all polygons and check their still-to-do lists
816 int nPolygons = m_VCoast[nCoast].nGetNumPolygons();
817
818// for (int nn = 0; nn < nPolygons; nn++)
819 for (int nn = nPolygons - 1; nn >= 0; nn--)
820 {
821 int nThisPoly = nVVPolyAndAdjacent[nn][1];
822 CGeomCoastPolygon* pThisPolygon = m_VCoast[nCoast].pGetPolygon(nThisPoly);
823
824 double dSandToDepositOnPoly = pThisPolygon->dGetToDoBeachDepositionUnconsSand();
825
826 if (dSandToDepositOnPoly > 0)
827 {
828 // There is some still-to-do deposition of sand sediment on this polygon: calculate a net increase in depth of sand-sized unconsolidated sediment on the cells within the polygon. Note that some cells may decrease in elevation (i.e. have some sand-sized sediment erosion) however
829 double dSandDeposited = 0;
830 nRet = nDoUnconsDepositionOnPolygon(nCoast, pThisPolygon, TEXTURE_SAND, dSandToDepositOnPoly, dSandDeposited);
831
832 if (nRet != RTN_OK)
833 return nRet;
834
835 double dSandNotDeposited = dSandToDepositOnPoly - dSandDeposited;
836
837 if (dSandNotDeposited > 0)
838 m_dDepositionSandDiff += dSandNotDeposited;
839
841 LogStream << m_ulIter << ": re-processing nThisPoly = " << nThisPoly << " dSandDeposited = " << dSandDeposited * m_dCellArea << " dSandNotDeposited = " << dSandNotDeposited * m_dCellArea << " m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << endl;
842 }
843
844 double dCoarseToDepositOnPoly = pThisPolygon->dGetToDoBeachDepositionUnconsCoarse();
845
846 if (dCoarseToDepositOnPoly > 0)
847 {
848 // There is some still-to-do deposition of coarse sediment on this polygon: calculate a net increase in depth of coarse-sized unconsolidated sediment on the cells within the polygon. Note that some cells may decrease in elevation (i.e. have some coarse-sized sediment erosion) however
849 double dCoarseDeposited = 0;
850 nRet = nDoUnconsDepositionOnPolygon(nCoast, pThisPolygon, TEXTURE_COARSE, dCoarseToDepositOnPoly, dCoarseDeposited);
851
852 if (nRet != RTN_OK)
853 return nRet;
854
855 double dCoarseNotDeposited = dCoarseToDepositOnPoly - dCoarseDeposited;
856
857 if (dCoarseNotDeposited > 0)
858 m_dDepositionCoarseDiff += dCoarseNotDeposited;
859
861 LogStream << m_ulIter << ": re-processing nThisPoly = " << nThisPoly << " dCoarseDeposited = " << dCoarseDeposited * m_dCellArea << " dCoarseNotDeposited = " << dCoarseNotDeposited * m_dCellArea << " m_dDepositionCoarseDiff = " << m_dDepositionCoarseDiff * m_dCellArea << endl;
862 }
863 }
864
866 WritePolygonActualMovement(nCoast, nVVPolyAndAdjacent);
867 }
868
869 return RTN_OK;
870}
871
872//===============================================================================================================================
874//===============================================================================================================================
876{
877 int nNumPolygons = m_VCoast[nCoast].nGetNumPolygons();
878
879 for (int nPoly = 0; nPoly < nNumPolygons; nPoly++)
880 {
881 CGeomCoastPolygon* pPolygon = m_VCoast[nCoast].pGetPolygon(nPoly);
882
883 // Only include unconsolidated fine sediment from sediment input events, don't include any unconsolidated fine sediment from platform erosion and cliff collapse since these have gone to suspension
884 double dFine = pPolygon->dGetSedimentInputUnconsFine();
885 pPolygon->SetPreExistingUnconsFine(dFine);
886
887 // Include unconsolidated sand sediment derived from platform erosion, cliff collapse, and sediment input events
889 pPolygon->SetPreExistingUnconsSand(dSand);
890
891 // Include unconsolidated coarse sediment derived from platform erosion, cliff collapse, and sediment input events
893 pPolygon->SetPreExistingUnconsCoarse(dCoarse);
894 }
895}
Geometry class used for coast polygon objects.
bool bIsCoastStartPolygon(void) const
Is this polygon the coast-start polygon?
double dGetSedimentInputUnconsSand(void) const
Get the value of sand sediment on the polygon derived from sediment input events(s)
double dGetPotentialErosion(void) const
Returns this timestep's total change in depth of unconsolidated sediment (all size classes) due to be...
double dGetCliffCollapseUnconsSandDeposition(void) const
Get the this-iteration total of unconsolidated sand sediment deposited from cliff collapse on this po...
bool bIsCoastEndPolygon(void) const
Is this polygon the coast-end polygon?
void SetPreExistingUnconsFine(double const)
Set the value of pre-existing unconsolidated fine sediment stored on this polygon.
double dGetPreExistingUnconsSand(void) const
Get the value of pre-existing unconsolidated sand sediment stored on this polygon.
void AddToDoBeachDepositionUnconsSand(double const)
Adds a depth (in m) of sand-sized unconsolidated sediment to this timestep's still-to-do deposition o...
void SetPreExistingUnconsSand(double const)
Set the value of pre-existing unconsolidated sand sediment stored on this polygon.
double dGetUpCoastAdjacentPolygonBoundaryShare(int const) const
Gets the boundary shares for all up-coast adjacent polygons.
int nGetUpCoastAdjacentPolygon(int const) const
Gets a single up-coast adjacent polygon.
double dGetPlatformErosionUnconsCoarse(void) const
Get the this-iteration total of unconsolidated coarse sediment derived from shore platform erosion on...
double dGetSedimentInputUnconsFine(void) const
Get the value of fine sediment on the polygon derived from sediment input events(s)
int nGetNumUpCoastAdjacentPolygons(void) const
Gets all up-coast adjacent polygons.
int nGetGlobalID(void) const
Get the global ID.
double dGetCliffCollapseUnconsCoarseDeposition(void) const
Get the this-iteration total of unconsolidated coarse sediment deposited from cliff collapse on this ...
double dGetDownCoastAdjacentPolygonBoundaryShare(int const) const
Gets the boundary shares for all down-coast adjacent polygons.
void SetBeachErosionUnconsFine(double const)
Sets a value (must be < 0) for this timestep's erosion of fine unconsolidated sediment (beach redistr...
double dGetPreExistingUnconsFine(void) const
Get the value of pre-existing unconsolidated fine sediment stored on this polygon.
void AddToDoBeachDepositionUnconsCoarse(double const)
Adds a depth (in m) of coarse unconsolidated sediment to this timestep's still-to-do deposition of un...
int nGetDownCoastAdjacentPolygon(int const) const
Gets a single down-coast adjacent polygon.
int nGetNumDownCoastAdjacentPolygons(void) const
Gets all down-coast adjacent polygons.
double dGetToDoBeachDepositionUnconsSand(void) const
Returns this timestep's still-to-do deposition of sand-sized unconsolidated sediment (from beach redi...
void SetPreExistingUnconsCoarse(double const)
Set the value of pre-existing unconsolidated coarse sediment stored on this polygon.
double dGetPlatformErosionUnconsSand(void) const
Get the this-iteration total of unconsolidated sand sediment derived from shore platform erosion on t...
double dGetPreExistingUnconsCoarse(void) const
Get the value of pre-existing unconsolidated coarse sediment stored on this polygon.
void SetBeachErosionUnconsSand(double const)
Sets a value (must be < 0) for this timestep's erosion of sand-sized unconsolidated sediment (beach r...
double dGetSedimentInputUnconsCoarse(void) const
Get the value of coarse sediment on the polygon derived from sediment input events(s)
bool bDownCoastThisIter(void) const
Is sediment movement on this polygon down-coast this iteration?
int nGetCoastID(void) const
Get the coast ID, this is the same as the down-coast sequence of polygons.
void AddCircularity(int const)
Add a circularity to this polygon.
void SetBeachErosionUnconsCoarse(double const)
Sets a value (must be < 0) for this timestep's erosion of coarse unconsolidated sediment (beach redis...
double dGetToDoBeachDepositionUnconsCoarse(void) const
Returns this timestep's still-to-do deposition of coarse unconsolidated sediment (from beach redistri...
int m_nLogFileDetail
Definition simulation.h:591
ofstream LogStream
double m_dThisIterBeachErosionCoarse
Definition simulation.h:902
vector< CRWCoast > m_VCoast
The coastline objects.
double m_dFineErodibilityNormalized
Relative erodibility of fine unconsolidated beach sediment, normalized.
Definition simulation.h:834
void WritePolygonSedimentBeforeMovement(int const)
Writes to the log file a table showing per-polygon totals of stored unconsolidated beach sediment pri...
void WritePolygonSortedSequence(int const, vector< vector< int > > &)
Writes to the log file a table showing the sorted sequence of polygon processing, and any circulariti...
int m_nUnconsSedimentHandlingAtGridEdges
Definition simulation.h:539
double m_dCoarseErodibilityNormalized
Relative erodibility of coarse unconsolidated beach sediment, normalized.
Definition simulation.h:840
double m_dDepositionCoarseDiff
Definition simulation.h:950
int nDoAllActualBeachErosionAndDeposition(void)
Does between-polygon and within-polygon actual (supply-limited) redistribution of transported beach s...
double m_dDepositionSandDiff
Definition simulation.h:946
void WritePolygonPotentialErosion(int const)
Writes to the log file a table showing per-polygon potential erosion of all size classes of unconsoli...
void WritePolygonActualMovement(int const, vector< vector< int > > const &)
Writes to the log file a table showing per-polygon actual movement of unconsolidated beach sediment.
int nDoUnconsDepositionOnPolygon(int const, CGeomCoastPolygon *, int const, double, double &)
Deposits unconsolidated beach sediment (sand or coarse) on the cells within a polygon....
double m_dSandErodibilityNormalized
Relative erodibility of sand unconsolidated beach sediment, normalized.
Definition simulation.h:837
double m_dThisIterBeachErosionSand
Definition simulation.h:898
double m_dThisIterFineSedimentToSuspension
Definition simulation.h:914
double m_dThisIterBeachErosionFine
Definition simulation.h:894
void AllPolygonsUpdateStoredUncons(int const)
Before simulating beach erosion, update the per-polygon values of pre-existing unconsolidated sedimen...
int nDoUnconsErosionOnPolygon(int const, CGeomCoastPolygon *, int const, double const, double &)
Erodes unconsolidated beach sediment of one texture class on the cells within a polygon....
double m_dCellArea
Area of a cell (in external CRS units)
Definition simulation.h:692
double m_dThisIterLeftGridUnconsCoarse
Definition simulation.h:930
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:618
void WritePolygonUnsortedSequence(int const, vector< vector< int > > &)
Writes to the log file a table showing the unsorted sequence of polygon processing.
double m_dThisIterLeftGridUnconsSand
Definition simulation.h:926
STL iterator class.
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:474
T tMin(T a, T b)
Definition cme.h:1251
string const ERR
Definition cme.h:890
int const TEXTURE_COARSE
Definition cme.h:515
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:489
int const GRID_EDGE_CLOSED
Definition cme.h:775
int const GRID_EDGE_RECIRCULATE
Definition cme.h:777
double const MASS_BALANCE_TOLERANCE
Definition cme.h:814
int const LOG_FILE_HIGH_DETAIL
Definition cme.h:490
int const TEXTURE_FINE
Definition cme.h:513
int const RTN_OK
Definition cme.h:692
int const GRID_EDGE_OPEN
Definition cme.h:776
int const TEXTURE_SAND
Definition cme.h:514
Contains CRWCoast definitions.
bool bPolygonAndAdjCompare(const vector< int > &nVLeft, const vector< int > &nVRight)
Function used to sort polygons before doing the polygon-to-polygon source-target pattern....
Contains CSimulation definitions.