示例#1
0
        private void UpdateParameter()
        {
            int D = this.GridData.SpatialDimension;

            this.phi0.Clear();
            this.phi0.Acc(1.0, this.phi);

            this.gradPhi0.Clear();
            this.gradPhi0.Gradient(1.0, this.phi0);

            if (this.Control.CurvatureCorrectionType == PhasefieldControl.CurvatureCorrection.DirectCoupledIterative)
            {
                VectorField <SinglePhaseField> filtgrad;
                CurvatureAlgorithmsForLevelSet.CurvatureDriver(
                    CurvatureAlgorithmsForLevelSet.SurfaceStressTensor_IsotropicMode.Curvature_Projected,
                    CurvatureAlgorithmsForLevelSet.FilterConfiguration.Phasefield,
                    this.DCurvature, out filtgrad, CorrectionLsTrk,
                    this.DCurvature.Basis.Degree * 2,
                    this.phi);
            }
        }
示例#2
0
        protected override double RunSolverOneStep(int _TimestepNo, double _dt, double _phystime)
        {
            using (new FuncTrace())
            {
                if (_TimestepNo == -1.0)
                {
                    Console.WriteLine("Initializing Phasefield");
                }
                else
                {
                    Console.WriteLine("Moving Phasefield in timestep #{0}, t = {1}, dt = {2} ...", _TimestepNo, _phystime, _dt);
                }

                // Perform timestep
                // ================

                if (this.Control.CurvatureCorrectionType == PhasefieldControl.CurvatureCorrection.DirectCoupledOnce)
                {
                    phi0.Clear();
                    phi0.Acc(1.0, phi);
                    gradPhi0.Clear();
                    gradPhi0.Gradient(1.0, phi0);

                    VectorField <SinglePhaseField> filtgrad;
                    CurvatureAlgorithmsForLevelSet.CurvatureDriver(
                        CurvatureAlgorithmsForLevelSet.SurfaceStressTensor_IsotropicMode.Curvature_Projected,
                        CurvatureAlgorithmsForLevelSet.FilterConfiguration.Phasefield,
                        this.DCurvature, out filtgrad, CorrectionLsTrk,
                        this.DCurvature.Basis.Degree * 2,
                        phi0);
                }

                //PlotCurrentState(_phystime, new Foundation.IO.TimestepNumber(new int[] { _TimestepNo , 0}), 2);
                base.Timestepping.Solve(_phystime, _dt);
                //PlotCurrentState(_phystime, new Foundation.IO.TimestepNumber(new int[] { _TimestepNo }), 2);

                // algebraic correction
                switch (this.Control.CorrectionType)
                {
                case PhasefieldControl.Correction.Concentration:
                    ConservativityCorrection();
                    break;

                case PhasefieldControl.Correction.Mass:
                    MassCorrection();
                    break;

                case PhasefieldControl.Correction.None:
                default:
                    break;
                }

                // update DG LevelSet
                DGLevSet.Clear();
                DGLevSet.Acc(1.0, phi);

                CorrectionLevSet.Clear();
                CorrectionLevSet.Acc(1.0, phi);
                this.CorrectionLsTrk.UpdateTracker(0.0);

                // return
                // ======
                WriteLogLine(_TimestepNo, _phystime + _dt);

                //PlotCurrentState(_phystime, new Foundation.IO.TimestepNumber(new int[] { _TimestepNo }), 2);

                Console.WriteLine("done moving Phasefield in timestep #{0}.", _TimestepNo);

                return(_dt);
            }
        }