/// <summary> /// Single run of the solver /// </summary> protected override double RunSolverOneStep(int TimestepNo, double phystime, double dt) { using (new FuncTrace()) { //this.WriteSEMMatrices(); if (Control.AdaptiveMeshRefinement == false) { base.NoOfTimesteps = -1; if (TimestepNo > 1) throw new ApplicationException("steady-state-equation."); base.TerminationKey = true; } // Update matrices // --------------- UpdateMatrices(); // call solver // ----------- double mintime, maxtime; bool converged; int NoOfIterations; switch (base.Control.solver_name) { case SolverCodes.classic_cg: case SolverCodes.classic_mumps: case SolverCodes.classic_pardiso: ClassicSolve(out mintime, out maxtime, out converged, out NoOfIterations); break; default: ExperimentalSolve(out mintime, out maxtime, out converged, out NoOfIterations); break; } Console.WriteLine("finished; " + NoOfIterations + " iterations."); Console.WriteLine("converged? " + converged); Console.WriteLine("Timespan: " + mintime + " to " + maxtime + " seconds"); base.QueryHandler.ValueQuery("minSolRunT", mintime, true); base.QueryHandler.ValueQuery("maxSolRunT", maxtime, true); base.QueryHandler.ValueQuery("Conv", converged ? 1.0 : 0.0, true); base.QueryHandler.ValueQuery("NoIter", NoOfIterations, true); base.QueryHandler.ValueQuery("NoOfCells", this.GridData.CellPartitioning.TotalLength, true); base.QueryHandler.ValueQuery("DOFs", T.Mapping.TotalLength, true); base.QueryHandler.ValueQuery("BlockSize", T.Basis.Length, true); if (base.Control.ExactSolution_provided) { SinglePhaseField ERR; if (Tex.Basis.Degree >= T.Basis.Degree) { ERR = this.Tex.CloneAs(); ERR.AccLaidBack(-1.0, T); } else { ERR = this.T.CloneAs(); ERR.AccLaidBack(-1.0, Tex); } double L2_ERR = ERR.L2Norm(); base.QueryHandler.ValueQuery("SolL2err", L2_ERR, true); } // evaluate residual // ================= { this.ResiualKP1.Clear(); if(this.Control.InitialValues_Evaluators.ContainsKey("RHS")) { this.ResiualKP1.ProjectField(this.Control.InitialValues_Evaluators["RHS"]); } var ev = this.LapaceIp.GetEvaluator(T.Mapping, ResiualKP1.Mapping); ev.Evaluate(-1.0, 1.0, ResiualKP1.CoordinateVector); } // return // ====== return 0.0; } }
protected override double RunSolverOneStep(int TimestepNo, double phystime, double dt) { using (new FuncTrace()) { //this.WriteSEMMatrices(); base.NoOfTimesteps = -1; if (TimestepNo > 1) { throw new ApplicationException("steady-state-equation."); } base.TerminationKey = true; // call solver // ----------- double mintime, maxtime; bool converged; int NoOfIterations; if (base.Control.solver_name == null) { ClassicSolve(out mintime, out maxtime, out converged, out NoOfIterations); } else { //ExperimentalSolve(out mintime, out maxtime, out converged, out NoOfIterations); throw new NotImplementedException("todo"); } Console.WriteLine("finished; " + NoOfIterations + " iterations."); Console.WriteLine("converged? " + converged); Console.WriteLine("Timespan: " + mintime + " to " + maxtime + " seconds"); base.QueryHandler.ValueQuery("minSolRunT", mintime, true); base.QueryHandler.ValueQuery("maxSolRunT", maxtime, true); base.QueryHandler.ValueQuery("Conv", converged ? 1.0 : 0.0, true); base.QueryHandler.ValueQuery("NoIter", NoOfIterations, true); base.QueryHandler.ValueQuery("NoOfCells", this.GridData.CellPartitioning.TotalLength); base.QueryHandler.ValueQuery("DOFs", T.Mapping.TotalLength, true); base.QueryHandler.ValueQuery("BlockSize", T.Basis.Length, true); if (base.Control.ExactSolution_provided) { SinglePhaseField ERR; if (Tex.Basis.Degree >= T.Basis.Degree) { ERR = this.Tex.CloneAs(); ERR.AccLaidBack(-1.0, T); } else { ERR = this.T.CloneAs(); ERR.AccLaidBack(-1.0, Tex); } double L2_ERR = ERR.L2Norm(); base.QueryHandler.ValueQuery("SolL2err", L2_ERR, true); } return(0.0); } }