49 bool bPolygonLengthPairCompare(
const pair<int, double> &prLeft,
const pair<int, double> &prRight)
62 for (
int nCoast = 0; nCoast < static_cast<int>(
m_VCoast.size()); nCoast++)
64 int const nNumPolygons =
m_VCoast[nCoast].nGetNumPolygons();
67 vector<pair<int, double>> prVPolygonLength;
69 for (
int nPoly = 0; nPoly < nNumPolygons; nPoly++)
72 double const dSeawardLength = pPolygon->
dGetLength();
73 prVPolygonLength.push_back(make_pair(nPoly, dSeawardLength));
77 sort(prVPolygonLength.begin(), prVPolygonLength.end(), bPolygonLengthPairCompare);
80 for (
int n = 0; n < nNumPolygons; n++)
82 int const nThisPoly = prVPolygonLength[n].first;
89 int const nCoastStartPoint =
m_VCoast[nCoast].pGetProfile(nStartNormal)->nGetCoastPoint();
90 int const nCoastEndPoint =
m_VCoast[nCoast].pGetProfile(nEndNormal)->nGetCoastPoint();
92 int nActiveZonePoints = 0;
94 double dAvgBreakingWaveHeight = 0;
95 double dAvgBreakingWaveAngle = 0;
96 double dAvgDeepWaterWavePeriod = 0;
97 double dAvgFluxOrientation = 0;
98 double dAvgBreakingDepth = 0;
99 double dAvgBreakingDist = 0;
102 for (
int nCoastPoint = nCoastStartPoint; nCoastPoint < nCoastEndPoint - 1; nCoastPoint++)
105 dAvgFluxOrientation +=
m_VCoast[nCoast].dGetFluxOrientation(nCoastPoint);
107 double const dThisBreakingWaveHeight =
m_VCoast[nCoast].dGetBreakingWaveHeight(nCoastPoint);
113 dAvgBreakingWaveHeight += dThisBreakingWaveHeight;
115 double const dThisBreakingWaveAngle =
m_VCoast[nCoast].dGetBreakingWaveAngle(nCoastPoint);
116 double const dThisDeepWaterWavePeriod =
m_VCoast[nCoast].dGetCoastDeepWaterWavePeriod(nCoastPoint);
118 dAvgBreakingWaveAngle += dThisBreakingWaveAngle;
119 dAvgDeepWaterWavePeriod += dThisDeepWaterWavePeriod;
121 dAvgBreakingDepth +=
m_VCoast[nCoast].dGetDepthOfBreaking(nCoastPoint);
128 if (nCoastPoints == 0)
132 dAvgFluxOrientation /= nCoastPoints;
134 if (nActiveZonePoints > 0)
137 dAvgBreakingWaveHeight /= nActiveZonePoints;
138 dAvgBreakingWaveAngle /= nActiveZonePoints;
139 dAvgDeepWaterWavePeriod /= nActiveZonePoints;
140 dAvgBreakingDepth /= nActiveZonePoints;
141 dAvgBreakingDist /= nActiveZonePoints;
144 int const nSeaHand =
m_VCoast[nCoast].nGetSeaHandedness();
145 double dNormalOrientation;
154 double dThetaBr = dNormalOrientation - dAvgBreakingWaveAngle;
157 dThetaBr = dAvgBreakingWaveAngle + 360.0 - dNormalOrientation;
159 else if (dThetaBr < -270)
160 dThetaBr = dNormalOrientation + 360.0 - dAvgBreakingWaveAngle;
162 bool bDownCoast =
true;
171 dThetaBr =
tAbs(dThetaBr);
174 dThetaBr =
tMin(dThetaBr, 90.0);
177 double dImmersedWeightTransport = 0;
205 if (dAvgBreakingDist > 0)
211 double const dBeachSlope = dAvgBreakingDepth / dAvgBreakingDist;
214 dImmersedWeightTransport =
m_dKamphuis * 2.33 * pow(dAvgDeepWaterWavePeriod, 1.5) * pow(dBeachSlope, 0.75) * pow(dD50, -0.25) * pow(dAvgBreakingWaveHeight, 2) * pow(sin((
PI / 180) * 2 * dThetaBr), 0.6);
226 double dSedimentDepth = dSedimentVol /
m_dCellArea;