public void ImposeBoundaryCondition(FluxDirection eDir, MorphologicalUnit unit, Volume boundaryVol)
        {
            // Make sure to remove any existing boundary condition flux
            ResetFluxes();

            // Update all units with the new flux as the reach input
            UpdateFluxes(eDir, unit, boundaryVol);
        }
Example #2
0
        public override string GetDescription()
        {
            string res = "";

            res += "center wavelength : " + (CenterWavelength * 1000).ToString() + " nm\r\n";
            res += "wavelength span   : " + (WavelengthSpan * 1000).ToString() + " nm\r\n";
            res += "point number      : " + PointNum.ToString() + "\r\n";
            res += "location          : " + Center.ToString() + " [um,um,um]\r\n";
            res += "size              : " + Size.ToString() + " [um,um,um]\r\n";
            res += "direction         : " + FluxDirection.ToString() + "\r\n";
            return(res);
        }
        private void UpdateFluxes(FluxDirection eDir, MorphologicalUnit boundaryUnit, Volume boundaryFlux)
        {
            BoundaryFluxDirection = eDir;
            BoundaryFluxUnit      = boundaryUnit;
            BoundaryFlux          = boundaryFlux;
            ReachInputFlux        = boundaryFlux - (eDir == FluxDirection.Input ? boundaryUnit.VolIn : boundaryUnit.VolOut);

            // Add back in the VolOut for the minimum flux cell (or the whole reach if there was no min flux cell)
            Units[0].VolIn            = -1 * Units[0].VolChange + ReachInputFlux;
            Units[0].VolOut           = Units[0].VolIn + Units[0].VolChange;
            Units[0].CumulativeVolume = Units[0].VolChange;

            // Recalculate the VolOut for each downstream unit now we know the reach input flux
            for (int i = 1; i < Units.Count; i++)
            {
                Units[i].VolIn            = Units[i - 1].VolOut;
                Units[i].VolOut           = Units[i].VolIn - Units[i].VolChange;
                Units[i].CumulativeVolume = Units[i - 1].CumulativeVolume + Units[i].VolChange;
            }

            // Loop over all units and recalc the erosion and deposition.
            MorphologicalUnit muTotal = Units.Last();

            muTotal.VolErosion       = new Volume(0);
            muTotal.VolErosionErr    = new Volume(0);
            muTotal.VolDeposition    = new Volume(0);
            muTotal.VolDepositionErr = new Volume(0);
            foreach (MorphologicalUnit unit in Units)
            {
                muTotal.VolErosion       += unit.VolErosion;
                muTotal.VolErosionErr    += unit.VolErosionErr;
                muTotal.VolDeposition    += unit.VolDeposition;
                muTotal.VolDepositionErr += unit.VolDepositionErr;
            }

            muTotal.VolIn            = Units[0].VolIn;
            muTotal.VolOut           = Units[Units.Count - 1].VolOut;
            muTotal.CumulativeVolume = Units[Units.Count - 1].CumulativeVolume;

            CalculateWork();
        }