/// <summary> /// Create Operators for Nonconservative Advection /// </summary> public ExplicitNonconservativeAdvection(SinglePhaseField LevelSet, VectorFieldHistory <SinglePhaseField> Velocity, IncompressibleBoundaryCondMap BcMap, bool AssumeDivergenceFreeVelocity = false) : base(LevelSet, BcMap, AssumeDivergenceFreeVelocity) { this.Velocity = Velocity; VelocityInterpolation = new VectorField <SinglePhaseField>(D.ForLoop(d => new SinglePhaseField(Velocity.Current[d].Basis, "VelocityInterpolation" + d))); MeanVelocity = new VectorField <SinglePhaseField>(D.ForLoop(d => new SinglePhaseField(new Basis(GridDat, 0), VariableNames.Velocity0MeanVector(D)[d]))); SpatialOperator Lsevo = CreateAdvectionSpatialOperator(BcMap); DGField[] ParamFields; if (!divUzero) { ParamFields = ArrayTools.Cat(this.Velocity.Current, this.MeanVelocity, this.divU); } else { ParamFields = ArrayTools.Cat(this.Velocity.Current, this.MeanVelocity); } TimeEvo = new RungeKutta(RungeKuttaScheme.TVD3, Lsevo, this.LevelSet.Mapping, new CoordinateMapping(ParamFields)); TimeEvo.OnBeforeComputeChangeRate += RKParamterUpdate; }
/// <summary> /// [Incompressible] Summand for previous time steps in momentum equation. /// </summary> /// <param name="dt"></param> /// <param name="BDFOrder"></param> /// <param name="Velocity"></param> /// <param name="SpatialComponent">Velocity component.</param> /// <param name="RhsSummand">Accumulator for the result.</param> public void ComputeRhsSummand(double dt, int BDFOrder, VectorFieldHistory <SinglePhaseField> Velocity, int SpatialComponent, SinglePhaseField RhsSummand) { for (int alpha = 1; alpha <= BDFOrder; alpha++) { RhsSummand.Acc(beta[BDFOrder - 1][alpha], Velocity[1 - alpha][SpatialComponent]); } RhsSummand.Scale(1.0 / (gamma[BDFOrder - 1] * dt)); }
public PrescribedVectorExtVel(SinglePhaseField LevelSet, VectorField <SinglePhaseField> Velocity, bool nearfield, NSECommon.IncompressibleBoundaryCondMap bcMap, Func <double[], double, double[]> AnalyticalExtVel) { this.nearfield = nearfield; this.LevelSet = LevelSet; this.Velocity = Velocity; this.AnalyticalExtVel = AnalyticalExtVel; VelocityHistory = new VectorFieldHistory <SinglePhaseField>(Velocity); VelocityHistory.IncreaseHistoryLength(1); VelocityHistory.Push(); explicitNonconservativeAdvection = new ExplicitNonconservativeAdvection(LevelSet, VelocityHistory, bcMap, false); }
/// <summary> /// [LowMach] Summand for previous time steps in momentum equation. /// </summary> /// <param name="dt"></param> /// <param name="BDFOrder"></param> /// <param name="Scalar"></param> /// <param name="Velocity"></param> /// <param name="SpatialComponent">Velocity component.</param> /// <param name="EoS"></param> /// <param name="RhsSummand">Accumulator for the result.</param> public void ComputeRhsSummand(double dt, int BDFOrder, ScalarFieldHistory <SinglePhaseField> Scalar, VectorFieldHistory <SinglePhaseField> Velocity, int SpatialComponent, MaterialLaw EoS, SinglePhaseField RhsSummand) { for (int alpha = 1; alpha <= BDFOrder; alpha++) { RhsSummand.ProjectFunction(beta[BDFOrder - 1][alpha], (X, U, cell) => EoS.GetDensity(U[0]) * U[1], null, Scalar[1 - alpha], Velocity[1 - alpha][SpatialComponent]); } RhsSummand.Scale(1.0 / (gamma[BDFOrder - 1] * dt)); }
/// <summary> /// /// </summary> /// <param name="LSTrk"></param> /// <param name="LevelSet"></param> /// <param name="LevelSetGradient"></param> /// <param name="Velocity"></param> /// <param name="Control"></param> /// <param name="bcMap"></param> /// <param name="BDForder">Quick Hack: -1 = CrankNicholson, 0= Explicit, >0: BDF</param> /// <param name="VectorExtension"></param> /// <param name="nearfield"></param> public VectorExtVelAdvection(LevelSetTracker LSTrk, SinglePhaseField LevelSet, VectorField <SinglePhaseField> LevelSetGradient, VectorField <SinglePhaseField> Velocity, EllipticExtVelAlgoControl Control, NSECommon.IncompressibleBoundaryCondMap bcMap, int BDForder, out VectorField <SinglePhaseField> VectorExtension, SubGrid subGrid = null) { D = LSTrk.GridDat.SpatialDimension; this.LevelSetGradient = LevelSetGradient; this.UseImplicitTimeStepping = (BDForder != 0); this.nearfield = subGrid != null; this.Velocity = Velocity; this.LSTrk = LSTrk; this.LevelSet = LevelSet; VectorExtensionHistory = new VectorFieldHistory <SinglePhaseField>(new VectorField <SinglePhaseField>(D, Velocity[0].Basis, "ExtVel", SinglePhaseField.Factory)); VectorExtension = VectorExtensionHistory.Current; this.VectorExtension = VectorExtension; double PenaltyBase = Control.PenaltyMultiplierInterface * ((double)((LevelSet.Basis.Degree + 1) * (LevelSet.Basis.Degree + D))) / ((double)D); ILevelSetForm InterfaceFlux = new SingleComponentInterfaceForm(PenaltyBase, LSTrk); VelocityExtender = new Extender[D]; for (int d = 0; d < D; d++) { VelocityExtender[d] = new Extender(VectorExtension[d], LSTrk, InterfaceFlux, new List <DGField> { Velocity[d] }, LevelSetGradient, Control); VelocityExtender[d].ConstructExtension(new List <DGField> { Velocity[d] }, Control.subGridRestriction); } if (!this.UseImplicitTimeStepping) { VectorExtensionHistory.IncreaseHistoryLength(1); VectorExtensionHistory.Push(); Advection = new ExplicitNonconservativeAdvection(LevelSet, VectorExtensionHistory, bcMap); } else { Advection = new BDFNonconservativeAdvection(LevelSet, VectorExtension, bcMap, BDForder, subGrid, false); } }
/// <summary> /// Ctor. /// </summary> /// <param name="solverConf"></param> /// <param name="_sparseSolver"></param> /// <param name="MatAsmblyPredictor"></param> /// <param name="MatAsmblyPredictorApprox"></param> /// <param name="PressureGradient"></param> /// <param name="BDF"></param> /// <param name="Velocity"></param> /// <param name="Pressure"></param> public SolverPredictor(SolverConfiguration solverConf, ISparseSolver _sparseSolver, SIMPLEMatrixAssembly[] MatAsmblyPredictor, SIMPLEMatrixAssembly MatAsmblyPredictorApprox, SIMPLEOperator[] PressureGradient, BDFScheme BDF, VectorFieldHistory <SinglePhaseField> Velocity, SinglePhaseField Pressure) : base(solverConf, _sparseSolver) { m_SolverConf = solverConf; m_MatAsmblyPredictor = MatAsmblyPredictor; m_MatAsmblyPredictorApprox = MatAsmblyPredictorApprox; m_PressureGradient = PressureGradient; m_BDF = BDF; m_Velocity = Velocity; m_Pressure = Pressure; m_RelaxFactor = (1.0 - base.m_solverConf.Control.RelexationFactorVelocity) / base.m_solverConf.Control.RelexationFactorVelocity; }
public LevelSetMover(DGField[] _Velocity, VectorFieldHistory <SinglePhaseField> FilteredVelocity, LevelSetTracker _LsTrk, XVelocityProjection.CutCellVelocityProjectiontype _CutCellVelocityProjectiontype, ScalarFieldHistory <SinglePhaseField> _DGLevSet, IncompressibleBoundaryCondMap BcMap) { this.Velocity = _Velocity; this.LsTrk = _LsTrk; this.DGLevSet = _DGLevSet; this.FilteredVelocity = FilteredVelocity; VelocityFilter = new XVelocityProjection(_LsTrk, Velocity, FilteredVelocity.Current); VelocityFilter.Config.CutCellVelocityProjectiontype = _CutCellVelocityProjectiontype; //Advection = new ImplicitNonconservativeAdvection(DGLevSet.Current, FilteredVelocity.Current, BcMap); //Advection = new ImplicitNonconservativeAdvection(DGLevSet.Current, FilteredVelocity.Current, BcMap, AssumeDivergenceFreeVelocity: true); Advection = new ExplicitNonconservativeAdvection(DGLevSet.Current, FilteredVelocity, BcMap, AssumeDivergenceFreeVelocity: true); }
/// <summary> /// Ctor. /// </summary> /// <param name="solverConf"></param> /// <param name="_sparseSolver"></param> /// <param name="DensityMatrix"></param> /// <param name="MatAsmblyPredictor"></param> /// <param name="MatAsmblyPredictorApprox"></param> /// <param name="PressureGradient"></param> /// <param name="Pressure"></param> /// <param name="MatAsmblyViscSplit"></param> /// <param name="BuoyantForce"></param> /// <param name="Velocity"></param> /// <param name="Scalar"></param> /// <param name="EoS"></param> /// <param name="BDF"></param> public VariableDensitySolverPredictor(SolverConfiguration solverConf, ISparseSolver _sparseSolver, BlockDiagonalMatrix DensityMatrix, SIMPLEMatrixAssembly MatAsmblyPredictor, SIMPLEMatrixAssembly MatAsmblyPredictorApprox, SIMPLEOperator[] PressureGradient, SinglePhaseField Pressure, SIMPLEMatrixAssembly[,] MatAsmblyViscSplit, IEvaluatorNonLin[] BuoyantForce, VectorFieldHistory <SinglePhaseField> Velocity, ScalarFieldHistory <SinglePhaseField> Scalar, MaterialLaw EoS, BDFScheme BDF) : base(solverConf, _sparseSolver) { m_DensityMatrix = DensityMatrix; m_MatAsmblyPredictor = MatAsmblyPredictor; m_MatAsmblyPredictorApprox = MatAsmblyPredictorApprox; m_PressureGradient = PressureGradient; m_Pressure = Pressure; m_MatAsmblyViscSplit = MatAsmblyViscSplit; m_BuoyantForceEvaluator = BuoyantForce; m_Velocity = Velocity; m_Scalar = Scalar; m_EoS = EoS; m_RelaxFactor = (1.0 - base.m_solverConf.Control.RelexationFactorVelocity) / base.m_solverConf.Control.RelexationFactorVelocity; m_BDF = BDF; }