#r "BoSSSpad.dll"
using System;
using System.Collections.Generic;
using System.Linq;
using ilPSP;
using ilPSP.Utils;
using BoSSS.Platform;
using BoSSS.Platform.LinAlg;
using BoSSS.Foundation;
using BoSSS.Foundation.XDG;
using BoSSS.Foundation.Grid;
using BoSSS.Foundation.Grid.Classic;
using BoSSS.Foundation.Grid.RefElements;
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.AdvancedSolvers;
using BoSSS.Solution.Gnuplot;
using BoSSS.Application.BoSSSpad;
using BoSSS.Application.XNSE_Solver;
using static BoSSS.Application.BoSSSpad.BoSSSshell;
Init();
This tutorial demostrates the creation, resp. the import of grids/meshes
into BoSSS.
A 2D Cartesian mesh can be created form an array of $x$- and $y$-nodes via the method Grid2D.Cartesian2DGrid.
Note that the number of nodes needes to be equal to the number of cells $+1$. For instance, for $10$ cells we need $11$ nodes.
int Res = 10;
double[] xNodes = GenericBlas.Linspace(0, 1, Res + 1);
double[] yNodes = GenericBlas.Linspace(0, 1, Res + 1);
int J = (xNodes.Length - 1)*(yNodes.Length - 1);
string GridName = string.Format(BoSSSshell.WorkflowMgm.CurrentProject + "_J" +J);
Console.WriteLine("Creating grid with " + J + " cells. ");
GridCommons g;
g = Grid2D.Cartesian2DGrid(xNodes, yNodes);
g.Name = GridName;
Creating grid with 100 cells.