// #r "D:\BoSSS2\experimental\public\src\L4-application\BoSSSpad\bin\Release\net5.0\bossspad.dll"
#r "BoSSSpad.dll"
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Data;
using System.Globalization;
using System.Threading;
using ilPSP;
using ilPSP.Utils;
using BoSSS.Platform;
using BoSSS.Foundation;
using BoSSS.Foundation.Grid;
using BoSSS.Foundation.Grid.Classic;
using BoSSS.Foundation.IO;
using BoSSS.Solution;
using BoSSS.Solution.Control;
using BoSSS.Solution.GridImport;
using BoSSS.Solution.Statistic;
using BoSSS.Solution.Utils;
using BoSSS.Solution.Gnuplot;
using BoSSS.Application.BoSSSpad;
using BoSSS.Application.XNSE_Solver;
using static BoSSS.Application.BoSSSpad.BoSSSshell;
using BoSSS.Foundation.Grid.RefElements;
using BoSSS.Platform.LinAlg;
using BoSSS.Solution.NSECommon;
using BoSSS.Application.XNSEC;
using NSE_SIMPLE;
using NSE_SIMPLE.LowMach;
using ilPSP.LinSolvers.PARDISO;
using BoSSS.Solution.Queries;
Init();
static string name = "CTD_CONV_STUDY_PowerLaw";
BoSSSshell.WorkflowMgm.Init(name);
BoSSSshell.WorkflowMgm.SetNameBasedSessionJobControlCorrelation();
Project name is set to 'CTD_CONV_STUDY_PowerLaw'. Default Execution queue is chosen for the database. Opening existing database '\\fdygitrunner\ValidationTests\databases\CTD_CONV_STUDY_PowerLaw'.
static var myBatch = GetDefaultQueue();
static var myDb = BoSSSshell.WorkflowMgm.DefaultDatabase;
// myBatch.AllowedDatabasesPaths.Add(new AllowedDatabasesPair(myDb.Path,""));
int[] dgDegree = new int[]{1,2,3,4};
int[] res = new int[]{4,5,6,7};
Type solverXNSEC = typeof(BoSSS.Application.XNSEC.XNSEC);
for (int dg = 0; dg < dgDegree.Length; dg++) {
for (int r = 0; r < res.Length; r++) {
string ending = "P" + dgDegree[dg] + "K" + res[r];
string jobName = string.Format("XNSEC_HEATEDCOUETTE"+ ending);
string StartupString = string.Format("cs:BoSSS.Application.XNSEC.FullNSEControlExamples.SteadyCouetteFlowWithTemperatureGradient({0}, {1},@\"{2}\")", dgDegree[dg] , res[r], myDb.Path);
var oneJob = new Job(jobName, solverXNSEC);
oneJob.SetControlStatement(StartupString);
oneJob.NumberOfMPIProcs = r > 2? 4:4; // seems to work only with 4 cores.
oneJob.Activate(myBatch);
}
}
Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061337.043427' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K4 08/04/2023 06:14:06 bb8cdf2d..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061354.643886' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K5 08/04/2023 06:14:26 59104c8a..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061411.922686' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K6 08/04/2023 06:14:44 4e3467c0..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061428.377579' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K7 08/04/2023 06:15:00 9abdf45a..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061447.275142' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K4 08/04/2023 06:15:21 115a2947..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061506.533812' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K5 08/04/2023 06:15:38 0df645b4..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061524.207872' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K6 08/04/2023 06:15:54 17e8858b..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061541.234885' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K7 08/04/2023 06:16:13 3fc21c08..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061601.533262' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K4 08/04/2023 06:16:35 fb5703c1..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061621.872551' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K5 08/04/2023 06:16:53 c63f4d03..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061641.718004' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K6 08/04/2023 06:17:16 13971088..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061702.657331' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K7 08/04/2023 06:17:36 4e97ce66..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061721.655188' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K4 08/04/2023 06:17:53 c0c112ca..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061742.431277' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K5 08/04/2023 06:18:19 59b39747..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061807.203615' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K6 08/04/2023 06:18:41 6df47645..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful Deployments so far (1): (Job token: unknown, FinishedSuccessful 'CTD_CONV_STUDY_PowerLaw-XNSEC2023Aug04_061838.861626' @ MS HPC client MSHPC-AllNodes @DC2, @\\fdygitrunner\ValidationTests\deploy, FinishedSuccessful); Success: 1 Info: Found successful session "CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K7 08/04/2023 06:19:13 5f0ec517..." -- job is marked as successful, no further action. No submission, because job status is: FinishedSuccessful
BoSSSshell.WorkflowMgm.BlockUntilAllJobsTerminate(PollingIntervallSeconds:100);
All jobs finished.
var NoSuccess = wmg.AllJobs.Values.Where(job => job.Status != JobStatus.FinishedSuccessful).ToArray();
NoSuccess
NUnit.Framework.Assert.Zero(NoSuccess.Count(), "Some Jobs Failed");
//foreach(var j in NoSuccess)
// j.DeleteOldDeploymentsAndSessions();
//NoSuccess[0]
//NoSuccess[0].GetStatus(WriteHints:true)
//NoSuccess[0].LatestDeployment
wmg.Sessions
#0: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K7 08/04/2023 06:19:13 5f0ec517... #1: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K6 08/04/2023 06:18:41 6df47645... #2: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K5 08/04/2023 06:18:19 59b39747... #3: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP4K4 08/04/2023 06:17:53 c0c112ca... #4: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K7 08/04/2023 06:17:36 4e97ce66... #5: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K6 08/04/2023 06:17:16 13971088... #6: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K5 08/04/2023 06:16:53 c63f4d03... #7: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP3K4 08/04/2023 06:16:35 fb5703c1... #8: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K7 08/04/2023 06:16:13 3fc21c08... #9: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K6 08/04/2023 06:15:54 17e8858b... #10: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K5 08/04/2023 06:15:38 0df645b4... #11: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP2K4 08/04/2023 06:15:21 115a2947... #12: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K7 08/04/2023 06:15:00 9abdf45a... #13: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K6 08/04/2023 06:14:44 4e3467c0... #14: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K5 08/04/2023 06:14:26 59104c8a... #15: CTD_CONV_STUDY_PowerLaw XNSEC_HEATEDCOUETTEP1K4 08/04/2023 06:14:06 bb8cdf2d...
var Tab = BoSSSshell.WorkflowMgm.SessionTable;
Tab = Tab.ExtractColumns("DGdegree:Velocity*","DGdegree:Temperature", "DGdegree:Pressure","Grid:hMin","SolL2err_u","SolL2err_v","SolL2err_T","SolL2err_p");
var ErrorPlot_u = Tab.ToPlot ("Grid:hMin", "SolL2err_u","DGdegree:Velocity*"); // column for grou
var ErrorPlot_v = Tab.ToPlot ("Grid:hMin", "SolL2err_v","DGdegree:Velocity*"); // column for grou
var ErrorPlot_T = Tab.ToPlot ("Grid:hMin", "SolL2err_T","DGdegree:Temperature"); // column for grou
var ErrorPlot_p = Tab.ToPlot ("Grid:hMin", "SolL2err_p","DGdegree:Pressure"); // column for grou
ErrorPlot_u.LogX = true ;
ErrorPlot_u.LogY = true ;
ErrorPlot_v.LogX = true ;
ErrorPlot_v.LogY = true ;
ErrorPlot_T.LogX = true ;
ErrorPlot_T.LogY = true ;
ErrorPlot_p.LogX = true ;
ErrorPlot_p.LogY = true ;
var ConvergencePlots = new Plot2Ddata[2,2];
ConvergencePlots[0,0] = ErrorPlot_u;
ConvergencePlots[0,1] = ErrorPlot_v;
ConvergencePlots[1,0] = ErrorPlot_T;
ConvergencePlots[1,1] = ErrorPlot_p; // pDegPlot.SaveTextFileToPublish(folderpath+"\\"+ varname + "DG" + pDeg, false);
var gp = ConvergencePlots.ToGnuplot();
gp.PlotSVG(xRes:1000,yRes:800)
Using gnuplot: C:\Program Files (x86)\FDY\BoSSS\bin\native\win\gnuplot-gp510-20160418-win32-mingw\gnuplot\bin\gnuplot.exe Note: In a Jupyter Worksheet, you must NOT have a trailing semicolon in order to see the plot on screen; otherwise, the output migth be surpressed.!
warning CS1701: Assuming assembly reference 'Microsoft.AspNetCore.Html.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' used by 'BoSSSpad' matches identity 'Microsoft.AspNetCore.Html.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' of 'Microsoft.AspNetCore.Html.Abstractions', you may need to supply runtime policy
bool savetoTxtFile = false;
// private static void ToTxtFile(string fileName, double[] x, double[] y) {
// if(x.Length != y.Length)
// throw new Exception();
// using (var file = new StreamWriter(fileName)) {
// file.Write("x" + "\t"+ "y");
// file.WriteLine();
// for(int i = 0; i< x.Length; i++){
// file.Write(x[i] + "\t" + y[i]);
// file.WriteLine();
// }
// }
// }
private static void ToTxtFile(string fileName, double[] x, double[] y) {
if(x.Length != y.Length)
throw new Exception();
var dummy = x.ToList();
dummy.Reverse();
var xinv2 = dummy.ToArray();
var dummy2 = y.ToList();
dummy2.Reverse();
var yinv2 = dummy2.ToArray();
using (var file = new StreamWriter(fileName)) {
file.Write("x" + "\t"+ "y");
file.WriteLine();
for(int i = 0; i< xinv2.Length; i++){
file.Write(xinv2[i] + "\t" + yinv2[i]);
file.WriteLine();
}
}
}
Tab = Tab.ExtractColumns("DGdegree:Velocity*","DGdegree:Temperature", "DGdegree:Pressure","Grid:hMin","SolL2err_u","SolL2err_v","SolL2err_T","SolL2err_p");
string[] varnames = new string[]{"VelocityX","VelocityY","Temperature", "Pressure" };
Plot2Ddata[,] ConvergencePlots = new Plot2Ddata[2, 2];
foreach (var varname in varnames) {
string SolL2Err = "";
string DgDegreeStr = "";
int x = 0;
int y = 0;
switch(varname){
case "VelocityX":
SolL2Err = "SolL2err_u";
DgDegreeStr = "DGdegree:Velocity*";
x = 0; y = 0;
break;
case "VelocityY":
SolL2Err = "SolL2err_v";
DgDegreeStr = "DGdegree:Velocity*";
x = 1; y = 0;
break;
case "Temperature":
SolL2Err = "SolL2err_T";
DgDegreeStr = "DGdegree:Temperature";
x = 0; y = 1;
break;
case "Pressure":
SolL2Err = "SolL2err_p";
DgDegreeStr = "DGdegree:Pressure";
x = 1; y = 1;
break;
}
var ErrorPlot = Tab. ToPlot ("Grid:hMin",SolL2Err,DgDegreeStr);
ErrorPlot.LogX = true ;
ErrorPlot.LogY = true ;
ConvergencePlots[x,y] = ErrorPlot;
// save text file for each polynomial degree.
foreach(var datagroup in ErrorPlot.dataGroups ){
int dg = datagroup.Name[datagroup.Name.Length-1] - '0';
if(varname == "Pressure"){
dg =dg+1;
}
//string filename = folderpath + @"\" + varname + "DG" + dg + "Data.txt";
//if(savetoTxtFile)
// ToTxtFile(filename,datagroup.Abscissas,datagroup.Values);
}
}
var gp = ConvergencePlots.ToGnuplot();
gp.PlotSVG(xRes:1000,yRes:800)
Using gnuplot: C:\Program Files (x86)\FDY\BoSSS\bin\native\win\gnuplot-gp510-20160418-win32-mingw\gnuplot\bin\gnuplot.exe Note: In a Jupyter Worksheet, you must NOT have a trailing semicolon in order to see the plot on screen; otherwise, the output migth be surpressed.!
warning CS1701: Assuming assembly reference 'Microsoft.AspNetCore.Html.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' used by 'BoSSSpad' matches identity 'Microsoft.AspNetCore.Html.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' of 'Microsoft.AspNetCore.Html.Abstractions', you may need to supply runtime policy
var ErrorPlot_T = Tab. ToPlot ("Grid:hMin", "SolL2err_T","DGdegree:Temperature"); // column for grou
ErrorPlot_T.dataGroups[0].Abscissas
index | value |
---|---|
0 | 0.1428571428571428 |
1 | 0.16666666666666652 |
2 | 0.19999999999999996 |
3 | 0.25 |
// string dataPathResultsBase = @"C:\Users\Gutierrez\Documents\data\convergenceProblemData\" ;
//string dataPathResultsBase = @"D:\ThesisDGCombustion\dgcombustionthesis\data\ConvStudy_Couette_PowerLaw";
//string folderpath = dataPathResultsBase ;// + ending +"LowTemp"+ @"\";
//System.IO.Directory.CreateDirectory(folderpath); // Create folder for storing data