public LayerSolver(LayerData prevLayer, NumericalParameters numericalParameters) { width = prevLayer.Width; height = prevLayer.Height; thickness = prevLayer.Thickness; this.prevLayer = prevLayer; this.oldLayer = prevLayer; this.nextLayer = new LayerData(width, height, thickness); this.intermediateLayer1 = new LayerData(width, height, thickness); this.intermediateLayer2 = new LayerData(width, height, thickness); this.numPar = numericalParameters; this.cp = (numericalParameters.Gamma - 1) / (numericalParameters.Gamma * numericalParameters.Re); //Параметры колонны Ax = Az = 0; Dx = width; Dz = thickness; //if (Nz = 50, Ny = Nx = 40) => Bx = (int)(numericalParameters.Nx / 2.0 - numericalParameters.Nx / 4.0); //10 Cx = (int)(numericalParameters.Nx / 2.0 + numericalParameters.Nx / 4.0); //30 Bz = (int)(numericalParameters.Nz / 2.0 - numericalParameters.Nz / 5.0); //15 Cz = (int)(numericalParameters.Nz / 2.0 + numericalParameters.Nz / 5.0); //35 }
public static void Main(string[] args) { var port = ProxyDataSet.Create("msds:nc?file=../../../temp.nc"); NumericalParameters nPar = new NumericalParameters(0.01, 0.02, 0.02, 0.01, 40, 40, 50, 40, 150, 0.78, 1.4); solver = new FluidCurrentSolver(nPar); //DataSetFactory.Register(typeof(NetCDFDataSet)); solver.SolveAll("msds:nc?file=../../../temp.nc"); Console.WriteLine("Done!"); }
private static double GetDZ(DoubleMatrix3D data, int i, int j, int k, NumericalParameters numPar) { if (k == 0) return (GetValue(data, i, j, k + 1) - GetValue(data, i, j, k)) / numPar.Dz; else if (k == numPar.Nz - 1) return (GetValue(data, i, j, k) - GetValue(data, i, j, k - 1)) / numPar.Dz; else return (GetValue(data, i, j, k + 1) - GetValue(data, i, j, k - 1)) / (2 * numPar.Dz); }
private static double GetDY(DoubleMatrix3D data, int i, int j, int k, NumericalParameters numPar) { if (j == 0) return (GetValue(data, i, j + 1, k) - GetValue(data, i, j, k)) / numPar.Dy; else if (j == numPar.Ny - 1) return (GetValue(data, i, j, k) - GetValue(data, i, j - 1, k)) / numPar.Dy; else return (GetValue(data, i, j + 1, k) - GetValue(data, i, j - 1, k)) / (2 * numPar.Dy); }
private static double GetDX(DoubleMatrix3D data, int i, int j, int k, NumericalParameters numPar) { if (i == 0) return (GetValue(data, i + 1, j, k) - GetValue(data, i, j, k)) / numPar.Dx; else if (i == numPar.Nx - 1) return (GetValue(data, i, j, k) - GetValue(data, i - 1, j, k)) / numPar.Dx; else return (GetValue(data, i + 1, j, k) - GetValue(data, i - 1, j, k)) / (2 * numPar.Dx); }
public static double GetPhiZ(DoubleMatrix3D u, DoubleMatrix3D v, DoubleMatrix3D w, int i, int j, int k, NumericalParameters numPar) { double u_z = GetDZ(u, i, j, k, numPar); double v_z = GetDZ(v, i, j, k, numPar); double w_z = GetDZ(w, i, j, k, numPar); double w_x = GetDX(w, i, j, k, numPar); double w_y = GetDY(w, i, j, k, numPar); return u_z * u_z + v_z * v_z + 2 * w_z * w_z + u_z * w_x + w_y * v_z; }
public static double GetPhiY(DoubleMatrix3D u, DoubleMatrix3D v, DoubleMatrix3D w, int i, int j, int k, NumericalParameters numPar) { double u_y = GetDY(u, i, j, k, numPar); double v_y = GetDY(v, i, j, k, numPar); double w_y = GetDY(w, i, j, k, numPar); double v_x = GetDX(v, i, j, k, numPar); double v_z = GetDZ(v, i, j, k, numPar); return u_y * u_y + 2 * v_y * v_y + w_y * w_y + u_y * v_x + w_y * v_z; }
public static double GetPhiX(DoubleMatrix3D u, DoubleMatrix3D v, DoubleMatrix3D w, int i, int j, int k, NumericalParameters numPar) { double u_x = GetDX(u, i, j, k, numPar); double v_x = GetDX(v, i, j, k, numPar); double w_x = GetDX(w, i, j, k, numPar); double u_y = GetDY(u, i, j, k, numPar); double u_z = GetDZ(u, i, j, k, numPar); return 2 * u_x * u_x + v_x * v_x + w_x * w_x + v_x * u_y + w_x * u_z; }
public FluidCurrentSolver(NumericalParameters modellingParams) { this.modellingParams = modellingParams; prevData = new LayerData(modellingParams.Nx, modellingParams.Ny, modellingParams.Nz); //Задаем начальные условия. Жидкость покоится, температура постоянна по всему объему prevData.U.InitializeData(0); prevData.V.InitializeData(0); prevData.W.InitializeData(0); prevData.T.InitializeData(1.0); prevData.Div.InitializeData(0); }