/// <summary> /// Calculate Nusselt number for Low-Mach number flows. /// </summary> /// <param name="Timestep"></param> /// <param name="GridDat"></param> /// <param name="Temperature"></param> /// <param name="SolverConf"></param> void CalculateNusselt(TimestepNumber Timestep, IGridData GridDat, SinglePhaseField Temperature, SIMPLEControl SolverConf) { // Initialize calculation of Nusselt number. if (NusseltNum == null) { LowMachSIMPLEControl lowMachConf = SolverConf as LowMachSIMPLEControl; NusseltNum = new NusseltNumber(GridDat, Temperature, lowMachConf.EoS, lowMachConf.EdgeTagsNusselt); if ((base.MPIRank == 0) && (CurrentSessionInfo.ID != Guid.Empty)) { LogNusselt = base.DatabaseDriver.FsDriver.GetNewLog("Nusselt", CurrentSessionInfo.ID); LogNusselt.Write("Timestep"); for (int bc = 0; bc < NusseltNum.Nusselt.Length; bc++) { LogNusselt.Write("\t" + lowMachConf.EdgeTagsNusselt[bc]); } LogNusselt.WriteLine(); } } // Calculate Nusselt number NusseltNum.CalculateNusseltNumber(); // Write result to text file if ((base.MPIRank == 0) && (LogNusselt != null)) { LogNusselt.Write(Timestep.ToString()); for (int bc = 0; bc < NusseltNum.Nusselt.Length; bc++) { LogNusselt.Write("\t" + NusseltNum.Nusselt[bc].ToString("0.0000000000E+00", NumberFormatInfo.InvariantInfo)); } LogNusselt.WriteLine(); LogNusselt.Flush(); } }
protected override void PlotCurrentState(double phystime, TimestepNumber timestepNo, int superSampling = 0) { BoSSS.Solution.Tecplot.Tecplot.PlotFields( ArrayTools.Cat <DGField>(this.U, this.RHS, this.bnd, this.Residual, this.Err, this.mu, this.ViscU_linear, this.ViscU_nonlinear), "ipViscosity", phystime, superSampling); BoSSS.Solution.Tecplot.Tecplot.PlotFields( ArrayTools.Cat <DGField>(this.U, this.RHS, this.bnd, this.Residual, this.Err, this.mu, this.ViscU_linear, this.ViscU_nonlinear), "grid", phystime, 0); }
/// <summary> /// ... /// </summary> public override void PostRestart(double time, TimestepNumber timestep) { //InitLogEnergyOrrSommerfeld(); WorkingSet.Initialize(Control); // Create WorkingSetMatrices switch (Control.PhysicsMode) { case PhysicsMode.Incompressible: break; case PhysicsMode.LowMach: LowMachSIMPLEControl lowMachConf = Control as LowMachSIMPLEControl; m_WorkingSetMatrices = new VariableMatrices(base.GridData, WorkingSet.VelBasis, WorkingSet.PressureBasis, lowMachConf.EoS, WorkingSet.Temperature.Current); break; case PhysicsMode.Multiphase: MultiphaseSIMPLEControl multiphaseConf = Control as MultiphaseSIMPLEControl; m_WorkingSetMatrices = new VariableMatrices(base.GridData, WorkingSet.VelBasis, WorkingSet.PressureBasis, multiphaseConf.EoS, WorkingSet.Phi.Current); break; default: throw new NotImplementedException(); } WorkingSet.CheckForNanOrInf(Control); // push start values to history WorkingSet.Push(Control); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { string filename = "MatrixTest." + timestepNo; //Tecplot.PlotFields(new DGField[] { u1, u2, Phi, Amarker, Bmarker, MPIrank }, filename, 0, superSampling); Tecplot.PlotFields(new DGField[] { u1, u2, Phi, Amarker, Bmarker, MPIrank }, filename, 0, superSampling); }
/// <summary> /// Override the original run method defined by the super-class because /// we don't want to run an actual calculation. Plots the data for /// every selected time-step. /// </summary> protected void Run() { ISessionInfo session = m_Database.Controller.GetSessionInfo(m_config.SessionGuid); var timesteps = session.Timesteps.Where( tsi => this.m_config.TimeSteps.Contains(tsi.TimeStepNumber)).ToArray(); int TotCnt = timesteps.Count(); int process = this.DBDriver.MyRank + 1; int processCount = this.DBDriver.Size; this.m_info = this.m_Database.Controller.GetSessionInfo(this.m_config.SessionGuid); GC.Collect(); for (int i = 0; i < timesteps.Length; i++) { var ts = timesteps[i]; double physTime = ts.PhysicalTime; TimestepNumber timestepNo = ts.TimeStepNumber; if (this.GridDat == null || !this.GridDat.Grid.ID.Equals(ts.Grid.ID)) { WriteMessage(process, processCount, "Loading grid ..."); GridCommons grid = DBDriver.LoadGrid(ts.Grid.ID, m_Database); this.GridDat = this.m_Database.Controller.GetInitializationContext(ts).GridData; WriteMessage(process, processCount, " Number of cells: " + this.GridDat.Grid.NoOfUpdateCells); this.CreatePlotter(); } WriteMessage(process, processCount, "Loading timestep ... (" + (i + 1) + " of " + TotCnt + ")"); var fields = DBDriver.LoadFields(ts, this.GridDat, this.m_config.FieldNames).ToList(); WriteMessage(process, processCount, "Loaded timestep " + timestepNo + ". Plotting..."); //{ // Console.WriteLine("computing vorticity..."); // DGField velX = fields.Single(f => f.Identification == "VelocityX"); // DGField velY = fields.Single(f => f.Identification == "VelocityY"); // DGField vortZ = velX.CloneAs(); // vortZ.Identification = "Vorticity"; // vortZ.Clear(); // vortZ.DerivativeByFlux(1.0, velY, 0); // vortZ.DerivativeByFlux(-1.0, velX, 1); // Console.WriteLine("done."); // fields.Add(vortZ); //} PlotCurrentState(fields, physTime, timestepNo); double perc = Math.Round(100.0 * (double)(i + 1) / (double)TotCnt, 1); WriteMessage(process, processCount, "Finished timestep (" + perc + "% of timesteps done)"); // Free memory if possible timesteps[i] = null; GC.Collect(); } }
private void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling, SubGrid subGrid) { Tecplot tecplot = new Tecplot(GridData, true, false, (uint)superSampling, subGrid.VolumeMask); //Tecplot tecplot = new Tecplot(m_Context, true, false, (uint)superSampling, null); string path = Path.Combine(Path.GetFullPath("."), "plot_" + testCase.GetType().Name); tecplot.PlotFields(path, physTime, m_IOFields); }
/// <summary> /// Usual plotting /// </summary> protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { Tecplot.PlotFields( ArrayTools.Cat <DGField>( f1Gradient_Analytical, f1Gradient_Numerical, f1, GridData.BoundaryMark(), Laplace_f1_Numerical, Laplace_f2_Numerical, f2), "derivatives", 0.0, superSampling); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { if (plotDriver == null) { plotDriver = new Tecplot(GridData, true, false, (uint)superSampling); } UpdateDerivedVariables(); plotDriver.PlotFields("XDGShockTest-" + timestepNo, physTime, m_IOFields); }
/// <summary> /// default plotting /// </summary> protected override void PlotCurrentState(double phystime, TimestepNumber timestepNo, int superSampling = 0) { string caseStr = ""; DGField[] Fields = new DGField[0]; SinglePhaseField phiDist = ComputeDistanceField(); Fields = Fields.Cat(this.phi, this.mu, this.Velocity, this.gradPhi0, this.Curvature, this.DCurvature, phiDist); BoSSS.Solution.Tecplot.Tecplot.PlotFields(Fields, "Phasefield-" + timestepNo + caseStr, phystime, superSampling); }
/// <summary> /// Computes the L2 error of field <paramref name="fieldName"/> with /// respect to a field with the same name stored in the time-step with /// <see cref="TimestepNumber"/> <paramref name="timestepNumber"/> within the /// current database. /// </summary> /// <param name="fieldName"> /// The name of the field to be evaluated /// </param> /// <param name="timestepNumber"> /// The time-step containing the reference field /// </param> /// <returns> /// The error of <paramref name="fieldName"/> in the L2 norm. /// </returns> public static Query L2Error(string fieldName, TimestepNumber timestepNumber) { return(delegate(IApplication <AppControl> app, double time) { ITimestepInfo ts = app.CurrentSessionInfo.Timesteps.Single(t => t.TimeStepNumber.Equals(timestepNumber)); DGField field = app.IOFields.Single(f => f.Identification == fieldName); DGField referenceField = GetStoredField(app.GridData, ts.ID, fieldName); return L2Error(fieldName, referenceField)(app, time); }); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { string filename = "AdaptiveMeshRefinementTest." + timestepNo; Tecplot.PlotFields(base.m_RegisteredFields.ToArray(), filename, physTime, superSampling); //DGField[] RefinedFields = new[] { Refined_u, Refined_TestData, Refined_Grad_u[0], Refined_Grad_u[1], Refined_MagGrad_u }; //string filename2 = "RefinedGrid." + timestepNo; //Tecplot.PlotFields(RefinedFields, filename2, physTime, superSampling); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int susamp) { var Fields = ArrayTools.Cat <DGField>(this.GradientU, this.Phi, this.u, this.rhs, this.residual, this.uEx, this.uErr); if (this.MGColoring != null && this.MGColoring.Length > 0) { Fields = ArrayTools.Cat <DGField>(Fields, this.MGColoring); } Tecplot.PlotFields(Fields, "XPoisson" + timestepNo.ToString(), physTime, susamp); Tecplot.PlotFields(Fields, "grid" + timestepNo.ToString(), physTime, 0); }
/// <summary> /// Creates a restart-job control object from a given session. /// </summary> /// <param name="sess"></param> /// <returns></returns> public static AppControl CreateRestartControl(this ISessionInfo sess) { var ctrl = sess.GetControl(); Guid rst_ID = sess.ID; TimestepNumber rst_ts = sess.Timesteps.Last().TimeStepNumber; ctrl.InitialValues.Clear(); ctrl.InitialValues_Evaluators.Clear(); ctrl.RestartInfo = Tuple.Create(rst_ID, rst_ts); ctrl.SessionName = ctrl.SessionName + "_Restart"; return(ctrl); }
/// <summary> /// Override the original run method defined by the super-class because /// we don't want to run an actual calculation. Plots the data for /// every selected time-step. /// </summary> protected void Run() { ISessionInfo session = m_Database.Controller.GetSessionInfo(m_config.SessionGuid); var timesteps = session.Timesteps.Where( tsi => this.m_config.TimeSteps.Contains(tsi.TimeStepNumber)).ToArray(); int TotCnt = timesteps.Count(); int process = this.DBDriver.MyRank + 1; int processCount = this.DBDriver.Size; this.m_info = this.m_Database.Controller.GetSessionInfo(this.m_config.SessionGuid); GC.Collect(); for (int i = 0; i < timesteps.Length; i++) { var ts = timesteps[i]; double physTime = ts.PhysicalTime; TimestepNumber timestepNo = ts.TimeStepNumber; if (this.GridDat == null || !this.GridDat.Grid.ID.Equals(ts.Grid.ID)) { WriteMessage(process, processCount, "Loading grid ..."); GridCommons grid = DBDriver.LoadGrid(ts.Grid.ID, m_Database); this.GridDat = this.m_Database.Controller.GetInitializationContext(ts).GridData; WriteMessage(process, processCount, " Number of cells: " + this.GridDat.Grid.NoOfUpdateCells); this.CreatePlotter(); } WriteMessage(process, processCount, "Loading timestep ... (" + (i + 1) + " of " + TotCnt + ")"); var fields = DBDriver.LoadFields(ts, this.GridDat, this.m_config.FieldNames); WriteMessage(process, processCount, "Loaded timestep " + timestepNo + ". Plotting..."); PlotCurrentState(fields, physTime, timestepNo); double perc = Math.Round(100.0 * (double)(i + 1) / (double)TotCnt, 1); WriteMessage(process, processCount, "Finished timestep (" + perc + "% of timesteps done)"); // Free memory if possible timesteps[i] = null; GC.Collect(); } }
/// <summary> /// writes one line to the Log File /// </summary> public void WriteLogLine(TimestepNumber TimestepNo, double phystime) { double[] BQnts = ComputeBenchmarkQuantities(); if (this.MPIRank != 0) { return; } using (var Log = new StreamWriter("Phasefield_Quantities.txt", true)) { string line = String.Format($"{TimestepNo}\t{phystime}\t{BQnts[0]}\t{BQnts[1]}\t{BQnts[2]}\t{BQnts[3]}\t{BQnts[4]}\t{BQnts[5]}\t{BQnts[6]}"); Log.WriteLine(line); Log.Flush(); } return; }
/// <summary> /// Deletes a time-step from its database. /// </summary> /// <param name="timestep">The time-step to be deleted.</param> /// <param name="force"> /// If true, the user will not be asked for confirmation /// </param> public static void Delete(this ITimestepInfo timestep, bool force = false) { bool sure = true; if (!force) { Console.WriteLine("Time-step: " + timestep.ToString()); Console.Write("Do you really want to delete this time-step? [y/n]: "); string line = Console.ReadLine(); sure = line.ToLower().Equals("y"); } if (sure) { TimestepNumber number = timestep.TimeStepNumber; timestep.Database.Controller.DeleteTimestep(timestep); Console.WriteLine("Time-step " + number + " deleted."); } else { Console.WriteLine("Session delete canceled."); } }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { throw new NotImplementedException(); }
/// <summary> /// /// </summary> public RheologyTimestepInfo(double physTime, ISessionInfo session, TimestepNumber TimestepNo, IEnumerable <DGField> fields, double __currentWeissenbergNumber) : base(physTime, session, TimestepNo, fields) // { currentWeissenbergNumber = __currentWeissenbergNumber; }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { }
/// <summary> /// Setting <see cref="RestartInfo"/> /// </summary> public void SetRestart(ISessionInfo si, TimestepNumber idx) { this.InitialValues.Clear(); this.InitialValues_Evaluators.Clear(); this.RestartInfo = Tuple.Create(si.ID, idx); }
/// <summary> /// performs Tecplot output of field <see cref="u"/> /// </summary> protected override void PlotCurrentState(double phystime, TimestepNumber timestepNo, int superSampling) { Tecplot plt1 = new Tecplot(GridData, true, false, (uint)superSampling); plt1.PlotFields("transport." + timestepNo, phystime, u, mpi_rank); }
protected override void LoadRestart(out double Time, out TimestepNumber TimestepNo) { throw new NotSupportedException("schlecht für BDF"); //base.LoadRestart(out Time, out TimestepNo); //PostInitial(Time); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { string filename = "ZwoLsTest." + timestepNo; Tecplot.PlotFields(new DGField[] { u, du_dx, Phi0, Phi1, Amarker, Bmarker, Xmarker, du_dx_Exact, ERR, XERR }, filename, 0, superSampling); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { Tecplot.PlotFields(new DGField[] { this.Pressure, this.LevSet }, "XNSE_prj" + timestepNo, physTime, superSampling); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { Tecplot plt1 = new Tecplot(GridData, true, false, (uint)superSampling); plt1.PlotFields("ALTSTests_" + timestepNo, physTime, m_IOFields); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { string filename = "LoadBalancingTest." + timestepNo; Tecplot.PlotFields(base.m_RegisteredFields.ToArray(), filename, physTime, superSampling); }
/// <summary> /// default plotting /// </summary> protected override void PlotCurrentState(double phystime, TimestepNumber timestepNo, int superSampling = 0) { DGField[] Fields = new DGField[] { T, Tex, RHS, ResiualKP1, Error }; BoSSS.Solution.Tecplot.Tecplot.PlotFields(Fields, "poisson_" + timestepNo, phystime, superSampling); }
/// <summary> /// Actual plotting routine which uses /// <see cref="PlotDriver.PlotFields(string, double, IEnumerable{DGField})"/> /// to plot a single time-step /// </summary> /// <param name="fields"></param> /// <param name="physTime"></param> /// <param name="timestepNo"></param> protected void PlotCurrentState(IEnumerable <DGField> fields, double physTime, TimestepNumber timestepNo) { m_PlotDriver.PlotFields( Path.Combine(m_path, "state_") + timestepNo, physTime, fields); }
/// <summary> /// /// </summary> /// <param name="physTime"></param> /// <param name="timestepNo"></param> protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int superSampling = 0) { Tecplot.PlotFields(m_IOFields, "SIMPLE-TimeStep" + timestepNo, physTime, superSampling); }
protected override void PlotCurrentState(double physTime, TimestepNumber timestepNo, int susamp) { var Fields = new DGField[] { this.Phi, this.u, this.rhs, this.Residual, this.V[0], this.V[1], this.CutMarker, this.DOFMarker, this.NearMarker }; Tecplot.PlotFields(Fields, "XdgTimesteppingTest" + timestepNo.ToString(), physTime, susamp); }