public void Prepare(PICProject project) { w = project.Relaxation; backscattering = project.Backscattering; alfa = project.BackscatteringAlfa; beta = project.BackscatteringBeta; step = project.Step; u = project.Voltage; particles = new ParticleArrayStorage<Particle>(project.ParticlesCount); boundaryConditions = new BoundaryConditions { Top = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Neumann }, Bottom = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Neumann }, Left = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Dirichlet }, Right = new BoundaryCondition { Value = x => u, Type = BoundaryConditionType.Dirichlet } }; emitter = new Emitter2D(0, project.EmitterBottom, 0, project.EmitterTop, project.ParticlesCount, 0, 0, -0.5 * Constants.ChildLangmuirCurrent(project.Length, u), step); mover = new Leapfrog(); grid = new Grid2D(); grid.InitializeGrid(project.GridN, project.GridM, 0, project.Length, 0, project.Height); mesh = new Mesh2D(); mesh.InitializeMesh(grid.N * grid.M); interpolator = new CloudInCellCurrentLinkage(particles, grid, mesh, false); poissonSolver = new Poisson2DFdmSolver(grid, boundaryConditions); poissonSolver.FdmMatrix = poissonSolver.BuildMatrix(); h = step * Constants.LightVelocity; Monitor = new PICMonitor(grid, mesh, particles, this); density = new double[grid.N * grid.M]; Trajectories = new List<Tuple<int, double, double>>(particles.Count * 1000); }
private void LoadProject() { Project = new PICProject() { Backscattering = true, BackscatteringAlfa = 0.5, BackscatteringBeta = 0.9, GridM = 101, GridN = 101, Method = PICMethod.Iterative, ParticlesCount = 100, Step = 1E-12, Voltage = 100000, Height = 0.5, Length = 0.1, Relaxation = 0.9, EmitterTop = 0.3, EmitterBottom = 0.2 }; Solver = (Project.Method == PICMethod.ParticleInCell) ? (IPICSolver)new PICSolver2D() : new IterativePICSolver2D(); Solver.Prepare(Project); }