예제 #1
0
파일: ipPoisson.cs 프로젝트: octwanna/BoSSS
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            using (FuncTrace tr = new FuncTrace()) {
                // assemble system, create matrix
                // ------------------------------

                var volQrSch = new CellQuadratureScheme(true, CellMask.GetFullMask(this.GridData));
                var edgQrSch = new EdgeQuadratureScheme(true, EdgeMask.GetFullMask(this.GridData));

                double D              = this.GridData.SpatialDimension;
                double penalty_base   = (T.Basis.Degree + 1) * (T.Basis.Degree + D) / D;
                double penalty_factor = base.Control.penalty_poisson;

                {
                    // equation assembly
                    // -----------------
                    tr.Info("creating sparse system...");
                    Console.WriteLine("creating sparse system for {0} DOF's ...", T.Mapping.Ntotal);
                    Stopwatch stw = new Stopwatch();
                    stw.Start();

                    SpatialOperator LapaceIp = new SpatialOperator(1, 1, QuadOrderFunc.SumOfMaxDegrees(), "T", "T");
                    var             flux     = new ipFlux(penalty_base * base.Control.penalty_poisson, this.GridData.Cells.cj, base.Control);
                    LapaceIp.EquationComponents["T"].Add(flux);


                    LapaceIp.Commit();

#if DEBUG
                    var RefLaplaceMtx = new MsrMatrix(T.Mapping);
#endif
                    LaplaceMtx    = new BlockMsrMatrix(T.Mapping);
                    LaplaceAffine = new double[T.Mapping.LocalLength];

                    LapaceIp.ComputeMatrixEx(T.Mapping, null, T.Mapping,
                                             LaplaceMtx, LaplaceAffine,
                                             volQuadScheme: volQrSch, edgeQuadScheme: edgQrSch);
#if DEBUG
                    LaplaceAffine.ClearEntries();
                    LapaceIp.ComputeMatrixEx(T.Mapping, null, T.Mapping,
                                             RefLaplaceMtx, LaplaceAffine,
                                             volQuadScheme: volQrSch, edgeQuadScheme: edgQrSch);
                    MsrMatrix ErrMtx = RefLaplaceMtx.CloneAs();
                    ErrMtx.Acc(-1.0, LaplaceMtx);
                    double err    = ErrMtx.InfNorm();
                    double infNrm = LaplaceMtx.InfNorm();
                    Console.WriteLine("Matrix comparison error: " + err + ", matrix norm is: " + infNrm);
                    Assert.Less(err, infNrm * 1e-10, "MsrMatrix2 comparison failed.");
#endif
                    //int q = LaplaceMtx._GetTotalNoOfNonZeros();
                    //tr.Info("finished: Number of non-zeros: " + q);
                    stw.Stop();
                    Console.WriteLine("done {0} sec.", stw.Elapsed.TotalSeconds);


                    //double condNo = LaplaceMtx.condest(BatchmodeConnector.Flavor.Octave);
                    //Console.WriteLine("condition number: {0:0.####E-00} ",condNo);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Step 2 of 2 for dynamic load balancing: restore this objects
        /// status after the grid has been re-distributed.
        /// </summary>
        public void DataRestoreAfterBalancing(GridUpdateDataVaultBase L,
                                              IEnumerable <DGField> Fields,
                                              IEnumerable <DGField> IterationResiduals,
                                              LevelSetTracker LsTrk,
                                              AggregationGridData[] _MultigridSequence) //
        {
            if (LsTrk != null)
            {
                this.LsTrk = LsTrk;
            }
            else
            {
                CreateDummyTracker(Fields);
            }

            Parameters = this.Operator.InvokeParameterFactory(Fields);

            if (m_BDF_Timestepper != null)
            {
                m_BDF_Timestepper.DataRestoreAfterBalancing(L, Fields, IterationResiduals, LsTrk, _MultigridSequence);
            }
            else if (m_RK_Timestepper != null)
            {
                throw new NotImplementedException("Load balancing and adaptive mesh refinement are not supported for Runge-Kutta XDG timestepping.");
            }
            else
            {
                throw new NotImplementedException();
            }
        }
예제 #3
0
 /// <summary>
 /// Step 2 of 2 for dynamic load balancing: restore this objects
 /// status after the grid has been re-distributed.
 /// </summary>
 public override void DataBackupBeforeBalancing(GridUpdateDataVaultBase L)
 {
     Timestepping.DataBackupBeforeBalancing(L);
     CurrentStateVector    = null;
     CurrentResidualVector = null;
     ClearOperator();
 }
예제 #4
0
        /// <summary>
        /// Includes assembly of the matrix.
        /// </summary>
        /// <param name="L"></param>
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L) {
            using (FuncTrace tr = new FuncTrace()) {

                // create operator
                // ===============
                {
                    double D = this.GridData.SpatialDimension;
                    double penalty_base = (T.Basis.Degree + 1) * (T.Basis.Degree + D) / D;
                    double penalty_factor = base.Control.penalty_poisson;

                    BoundaryCondMap<BoundaryType> PoissonBcMap = new BoundaryCondMap<BoundaryType>(this.GridData, this.Control.BoundaryValues, "T");

                    LapaceIp = new SpatialOperator(1, 1, QuadOrderFunc.SumOfMaxDegrees(), "T", "T");
                    var flux = new ipFlux(penalty_base * base.Control.penalty_poisson, ((GridData)(this.GridData)).Cells.cj, PoissonBcMap);

                    LapaceIp.EquationComponents["T"].Add(flux);

                    LapaceIp.Commit();
                }



                //double condNo = LaplaceMtx.condest(BatchmodeConnector.Flavor.Octave);
                //Console.WriteLine("condition number: {0:0.####E-00} ",condNo);

            }
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            using (new FuncTrace()) {
                // Create SIMPLEStatus
                SIMPLEStatus = new SIMPLEStepStatus(Control);

                // Create SIMPLEStep
                switch (Control.PhysicsMode)
                {
                case PhysicsMode.Incompressible:
                    SIMPLEStep = new SIMPLEStepIncompressible(SolverConf, WorkingSet);
                    break;

                case PhysicsMode.LowMach:
                    SIMPLEStep = new SIMPLEStepLowMach(SolverConf, WorkingSet, WorkingSetMatrices);
                    break;

                case PhysicsMode.Multiphase:
                    SIMPLEStep = new SIMPLEStepMultiphase(SolverConf, WorkingSet, WorkingSetMatrices);
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            diffOp = new SpatialOperator(new string[] { "u" },
                                         Solution.NSECommon.VariableNames.VelocityVector(this.GridData.SpatialDimension),
                                         new string[] { "codom1" },
                                         QuadOrderFunc.Linear());


            switch (this.GridData.SpatialDimension)
            {
            case 2:
                diffOp.EquationComponents["codom1"].Add(new ScalarTransportFlux());
                break;

            case 3:
                diffOp.EquationComponents["codom1"].Add(new ScalarTransportFlux3D());
                break;

            default:
                throw new NotImplementedException("spatial dim. not supported.");
            }
            diffOp.Commit();

            Timestepper = new RungeKutta(RungeKuttaScheme.TVD3,
                                         diffOp,
                                         new CoordinateMapping(u), Velocity.Mapping);

            //Timestepper = new ROCK4(diffOp, u.CoordinateVector, Velocity.Mapping);
        }
예제 #7
0
파일: Program.cs 프로젝트: xyuan/BoSSS
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            diffOp = new SpatialOperator(
                new string[] { "c" },
                new string[] { "viscosity", "VelocityX", "VelocityY" },
                new string[] { "codom1" },
                QuadOrderFunc.Linear());
            diffOp.EquationComponents["codom1"].Add(new ScalarTransportFlux2D(inflowDirichletValue));
            diffOp.Commit();

            CoordinateMapping coordMap;

            coordMap = new CoordinateMapping(viscosity, Velocity[0], Velocity[1]);

            // 3 sub-grids
            MultidimensionalArray metricOne = MultidimensionalArray.Create(numOfCellsX);
            MultidimensionalArray metricTwo = MultidimensionalArray.Create(numOfCellsX);

            // 3 cells
            //metricOne[0] = 2;
            //metricOne[1] = 1;
            //metricOne[2] = 0.5;

            //metricTwo[0] = 1;
            //metricTwo[1] = 0.5;
            //metricTwo[2] = 2;

            // 4 cells
            metricOne[0] = 2;
            metricOne[1] = 1;
            metricOne[2] = 0.5;
            metricOne[3] = 0.25;

            metricTwo[0] = 0.5;
            metricTwo[1] = 2;
            metricTwo[2] = 0.25;
            metricTwo[3] = 1;

            CustomTimestepConstraint = new SurrogateConstraint(GridData, dtFixed, dtFixed, double.MaxValue, endTime, metricOne, metricTwo);

            timeStepper = new AdamsBashforthLTS(
                diffOp,
                new CoordinateMapping(c),
                coordMap,
                order: ABOrder,
                numOfClusters: this.numOfSubgrids,
                timeStepConstraints: new List <TimeStepConstraint>()
            {
                CustomTimestepConstraint
            },
                fluxCorrection: false,
                reclusteringInterval: 1);

            // Sub-grid visualization
            //AdamsBashforthLTS timeStepper2 = timeStepper as AdamsBashforthLTS;
            //timeStepper2.SubGridField.Identification = "clusterLTS";
            //m_IOFields.Add(timeStepper2.SubGridField);
            //timeStepper = timeStepper2;
        }
예제 #8
0
        //XdgBDFTimestepping AltTimeIntegration;

        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            int quadorder = this.u.Basis.Degree * 2 + 1;

            Op = new XSpatialOperatorMk2(1, 0, 1, (A, B, C) => quadorder, LsTrk.SpeciesNames, "u", "c1");

            var blkFlux = new DxFlux(this.LsTrk, alpha_A, alpha_B);

            Op.EquationComponents["c1"].Add(blkFlux);                                     // Flux in Bulk Phase;
            Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, alpha_A, alpha_B)); // flux am lev-set 0

            Op.LinearizationHint = LinearizationHint.AdHoc;

            Op.TemporalOperator = new ConstantXTemporalOperator(Op, 1.0);

            Op.Commit();

            if (L == null)
            {
                /*
                 * AltTimeIntegration = new XdgBDFTimestepping(
                 *  new DGField[] { u }, new DGField[0], new DGField[] { uResidual }, base.LsTrk,
                 *  true,
                 *  DelComputeOperatorMatrix, Op.TemporalOperator, DelUpdateLevelset,
                 *  3, // BDF3
                 *     //-1, // Crank-Nicolson
                 *     //0, // Explicit Euler
                 *  LevelSetHandling.LieSplitting,
                 *  MassMatrixShapeandDependence.IsTimeDependent,
                 *  SpatialOperatorType.LinearTimeDependent,
                 *  MultigridOperatorConfig,
                 *  this.MultigridSequence,
                 *  this.LsTrk.SpeciesIdS.ToArray(),
                 *  quadorder,
                 *  this.THRESHOLD,
                 *  true,
                 *  this.Control.NonLinearSolver,
                 *  this.Control.LinearSolver);
                 */

                TimeIntegration = new XdgTimestepping(
                    Op,
                    new DGField[] { u }, new DGField[] { uResidual },
                    TimeSteppingScheme.BDF3,
                    this.DelUpdateLevelset, LevelSetHandling.LieSplitting,
                    MultigridOperatorConfig, MultigridSequence,
                    _AgglomerationThreshold: this.THRESHOLD,
                    LinearSolver: this.Control.LinearSolver, NonLinearSolver: this.Control.NonLinearSolver);
            }
            else
            {
                Debug.Assert(object.ReferenceEquals(this.MultigridSequence[0].ParentGrid, this.GridData));
                TimeIntegration.DataRestoreAfterBalancing(L, new DGField[] { u }, new DGField[] { uResidual }, base.LsTrk, this.MultigridSequence);
                //AltTimeIntegration.DataRestoreAfterBalancing(L, new DGField[] { u }, new DGField[] { uResidual }, base.LsTrk, this.MultigridSequence);
            }
        }
예제 #9
0
 protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
 {
     if (L == null)
     {
     }
     else
     {
         //throw new NotImplementedException("todo");
     }
 }
예제 #10
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            Op = new XSpatialOperator(1, 0, 1, QuadOrderFunc.SumOfMaxDegrees(RoundUp: true), "u", "c1");

            Op.EquationComponents["c1"].Add(new DxFlux());                   // Flux in Bulk Phase;
            Op.EquationComponents["c1"].Add(new LevSetFlx_phi0(this.LsTrk)); // flux am lev-set 0
            Op.EquationComponents["c1"].Add(new LevSetFlx_phi1(this.LsTrk)); // flux am lev-set 1

            Op.Commit();
        }
예제 #11
0
 protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
 {
     if (L == null)
     {
     }
     else
     {
         //throw new NotImplementedException("todo");
         //PlotCurrentState(100, new TimestepNumber(100, 1), 2);
     }
 }
예제 #12
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            SpatialOperator diffOp = new SpatialOperator(1, 0, 1, QuadOrderFunc.MaxDegTimesTwo(), "u", "codom1");

            diffOp.EquationComponents["codom1"].Add(new ScalarTransportFlux());
            diffOp.Commit();

            CustomTimestepConstraint = new SurrogateConstraint(GridData, dt_input, dt_input, double.MaxValue, endTime);

            if (LTS)
            {
                AdamsBashforthLTS ltsTimeStepper = new AdamsBashforthLTS(
                    diffOp,
                    new CoordinateMapping(u),
                    null,
                    ABorder,
                    numOfSubgrids,
                    fluxCorrection: true,
                    reclusteringInterval: 0,
                    timeStepConstraints: new List <TimeStepConstraint>()
                {
                    CustomTimestepConstraint
                });
                timeStepper = ltsTimeStepper;
            }
            else if (ALTS)
            {
                AdamsBashforthLTS ltsTimeStepper = new AdamsBashforthLTS(
                    diffOp,
                    new CoordinateMapping(u),
                    null,
                    ABorder,
                    numOfSubgrids,
                    fluxCorrection: false,
                    reclusteringInterval: 1,
                    timeStepConstraints: new List <TimeStepConstraint>()
                {
                    CustomTimestepConstraint
                });
                timeStepper = ltsTimeStepper;
            }
            else
            {
                timeStepper = new AdamsBashforth(diffOp, new CoordinateMapping(u), null, ABorder);
                //timeStepper = new RungeKutta(RungeKutta.RungeKuttaScheme.Heun, diffOp, new CoordinateMapping(u),null);
                //timeStepper = RungeKutta.Factory(ABorder, diffOp, new CoordinateMapping(u));
            }
        }
예제 #13
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            m_quadOrder = u1.Basis.Degree * 2;

            Op = new XSpatialOperator(2, 0, 2, (A, B, c) => m_quadOrder, "u1", "u2", "c1", "c2");

            Op.EquationComponents["c1"].Add(new DxFlux("u1", -3.0)); // Flux in Bulk Phase;
            Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u1", -3.0));

            Op.EquationComponents["c2"].Add(new DxFlux("u1", +3.0)); // Flux in Bulk Phase;
            Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u1", +3.0));
            Op.EquationComponents["c2"].Add(new DxFlux("u2", 77.7)); // Flux in Bulk Phase;
            Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u2", 77.7));

            Op.Commit();
        }
예제 #14
0
        /// <summary>
        /// Step 1 of 2 for dynamic load balancing: creating a backup of this objects
        /// status in the load-balancing thing <paramref name="L"/>
        /// </summary>
        public void DataBackupBeforeBalancing(GridUpdateDataVaultBase L)
        {
            if (m_BDF_Timestepper != null)
            {
                m_BDF_Timestepper.DataBackupBeforeBalancing(L);
            }
            else if (m_RK_Timestepper != null)
            {
                throw new NotImplementedException("Load balancing and adaptive mesh refinement are not supported for Runge-Kutta XDG timestepping.");
            }
            else
            {
                throw new NotImplementedException();
            }

            this.LsTrk      = null;
            this.Parameters = null;
        }
예제 #15
0
        /// <summary>
        ///
        /// </summary>
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            if (L == null)
            {
                // +++++++++++++++++++++++++++++++++++++++++++++++++++
                // Creation of time-integrator (initial, no balancing)
                // +++++++++++++++++++++++++++++++++++++++++++++++++++

                InitSolver();
                Timestepping.RegisterResidualLogger(new ResidualLogger(this.MPIRank, this.DatabaseDriver, new Guid()));
            }
            else
            {
                // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                // restore BDF time-stepper after grid redistribution (dynamic load balancing)
                // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                Timestepping.DataRestoreAfterBalancing(L, CurrentState.Fields, CurrentResidual.Fields, base.LsTrk, base.MultigridSequence);
            }
        }
예제 #16
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            int quadorder = this.u.Basis.Degree * 2 + 1;

            Op = new XSpatialOperator(1, 0, 1, (A, B, C) => quadorder, "u", "c1");

            var blkFlux = new DxFlux(this.LsTrk, alpha_A, alpha_B);

            Op.EquationComponents["c1"].Add(blkFlux);                                     // Flux in Bulk Phase;
            Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, alpha_A, alpha_B)); // flux am lev-set 0

            Op.Commit();

            if (L == null)
            {
                TimeIntegration = new XdgBDFTimestepping(
                    new DGField[] { u }, new DGField[] { uResidual }, base.LsTrk,
                    true,
                    DelComputeOperatorMatrix, null, DelUpdateLevelset,
                    3, // BDF3
                       //-1, // Crank-Nicolson
                       //0, // Explicit Euler
                    LevelSetHandling.LieSplitting,
                    MassMatrixShapeandDependence.IsTimeDependent,
                    SpatialOperatorType.LinearTimeDependent,
                    MassScale,
                    MultigridOperatorConfig,
                    this.MultigridSequence,
                    this.LsTrk.SpeciesIdS.ToArray(),
                    quadorder,
                    this.THRESHOLD,
                    true,
                    this.Control.NonLinearSolver,
                    this.Control.LinearSolver);
            }
            else
            {
                Debug.Assert(object.ReferenceEquals(this.MultigridSequence[0].ParentGrid, this.GridData));
                TimeIntegration.DataRestoreAfterBalancing(L, new DGField[] { u }, new DGField[] { uResidual }, base.LsTrk, this.MultigridSequence);
            }
        }
예제 #17
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            Op = new XSpatialOperatorMk2(1, 0, 1,
                                         QuadOrderFunc: (int[] DomDegs, int[] ParamDegs, int[] CoDomDegs) => QuadOrder,
                                         __Species: new [] { "B" },
                                         __varnames: new[] { "u", "c1" });


            Op.EquationComponents["c1"].Add(new DxFlux()); // Flux in Bulk Phase;
            if (usePhi0)
            {
                Op.EquationComponents["c1"].Add(new LevSetFlx_phi0(this.LsTrk)); // flux am lev-set 0
            }
            if (usePhi1)
            {
                Op.EquationComponents["c1"].Add(new LevSetFlx_phi1(this.LsTrk)); // flux am lev-set 1
            }
            //Op.EquationComponents["c1"].Add(new DxBroken());

            Op.Commit();
        }
예제 #18
0
        /// <summary>
        /// Includes assembly of the matrix.
        /// </summary>
        /// <param name="L"></param>
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            using (FuncTrace tr = new FuncTrace()) {
                // create operator
                // ===============
                {
                    double D              = this.GridData.SpatialDimension;
                    double penalty_base   = (T.Basis.Degree + 1) * (T.Basis.Degree + D) / D;
                    double penalty_factor = base.Control.penalty_poisson;

                    BoundaryCondMap <BoundaryType> PoissonBcMap = new BoundaryCondMap <BoundaryType>(this.GridData, this.Control.BoundaryValues, "T");

                    LapaceIp = new SpatialOperator(1, 1, QuadOrderFunc.SumOfMaxDegrees(), "T", "T");

                    MultidimensionalArray LengthScales;
                    if (this.GridData is GridData)
                    {
                        LengthScales = ((GridData)GridData).Cells.cj;
                    }
                    else if (this.GridData is AggregationGridData)
                    {
                        LengthScales = ((AggregationGridData)GridData).AncestorGrid.Cells.cj;
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }

                    var flux = new ipFlux(penalty_base * base.Control.penalty_poisson, LengthScales, PoissonBcMap);

                    LapaceIp.EquationComponents["T"].Add(flux);

                    LapaceIp.Commit();
                }
            }
        }
예제 #19
0
        /// <summary>
        /// Includes assembly of the matrix.
        /// </summary>
        /// <param name="L"></param>
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            using (FuncTrace tr = new FuncTrace()) {
                // create operator
                // ===============
                SpatialOperator LapaceIp;
                {
                    double D              = this.GridData.SpatialDimension;
                    double penalty_base   = (T.Basis.Degree + 1) * (T.Basis.Degree + D) / D;
                    double penalty_factor = base.Control.penalty_poisson;

                    BoundaryCondMap <BoundaryType> PoissonBcMap = new BoundaryCondMap <BoundaryType>(this.GridData, this.Control.BoundaryValues, "T");

                    LapaceIp = new SpatialOperator(1, 1, QuadOrderFunc.SumOfMaxDegrees(), "T", "T");
                    var flux = new ipFlux(penalty_base * base.Control.penalty_poisson, this.GridData.Cells.cj, PoissonBcMap);
                    LapaceIp.EquationComponents["T"].Add(flux);

                    LapaceIp.Commit();
                }

                // Create Matrices
                // ===============

                {
                    // time measurement for matrix assembly
                    Stopwatch stw = new Stopwatch();
                    stw.Start();

                    // console
                    Console.WriteLine("creating sparse system for {0} DOF's ...", T.Mapping.Ntotal);

                    // quadrature domain
                    var volQrSch = new CellQuadratureScheme(true, CellMask.GetFullMask(this.GridData));
                    var edgQrSch = new EdgeQuadratureScheme(true, EdgeMask.GetFullMask(this.GridData));

#if DEBUG
                    // in DEBUG mode, we compare 'MsrMatrix' (old, reference implementation) and 'BlockMsrMatrix' (new standard)
                    var RefLaplaceMtx = new MsrMatrix(T.Mapping);
#endif
                    using (new BlockTrace("SipMatrixAssembly", tr)) {
                        LaplaceMtx    = new BlockMsrMatrix(T.Mapping);
                        LaplaceAffine = new double[T.Mapping.LocalLength];

                        LapaceIp.ComputeMatrixEx(T.Mapping, null, T.Mapping,
                                                 LaplaceMtx, LaplaceAffine,
                                                 volQuadScheme: volQrSch, edgeQuadScheme: edgQrSch);
                    }
#if DEBUG
                    LaplaceAffine.ClearEntries();
                    LapaceIp.ComputeMatrixEx(T.Mapping, null, T.Mapping,
                                             RefLaplaceMtx, LaplaceAffine,
                                             volQuadScheme: volQrSch, edgeQuadScheme: edgQrSch);
                    MsrMatrix ErrMtx = RefLaplaceMtx.CloneAs();
                    ErrMtx.Acc(-1.0, LaplaceMtx);
                    double err    = ErrMtx.InfNorm();
                    double infNrm = LaplaceMtx.InfNorm();
                    Console.WriteLine("Matrix comparison error: " + err + ", matrix norm is: " + infNrm);
                    Assert.Less(err, infNrm * 1e-10, "MsrMatrix2 comparison failed.");
#endif
                    stw.Stop();
                    Console.WriteLine("done {0} sec.", stw.Elapsed.TotalSeconds);
                }


                //double condNo = LaplaceMtx.condest(BatchmodeConnector.Flavor.Octave);
                //Console.WriteLine("condition number: {0:0.####E-00} ",condNo);
            }
        }
예제 #20
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            // Boundary condition map
            Material material = this.Control.GetMaterial();
            IBoundaryConditionMap boundaryMap = new XDGCompressibleBoundaryCondMap(this.GridData, this.Control, material, new string[] { "A", "B" });

            // Operator
            string[] variables = new string[] { CompressibleVariables.Density, CompressibleVariables.Momentum.xComponent, CompressibleVariables.Momentum.yComponent, CompressibleVariables.Energy };

            if (ArtificialViscosityField != null)
            {
                this.XSpatialOperator = new XSpatialOperatorMk2(variables, new string[] { ArtificialViscosityField.Identification }, variables, (int[] A, int[] B, int[] C) => NonlinearQuadratureDegree, LsTrk.SpeciesIdS.ToArray());
            }
            else
            {
                this.XSpatialOperator = new XSpatialOperatorMk2(variables, null, variables, (int[] A, int[] B, int[] C) => NonlinearQuadratureDegree, LsTrk.SpeciesIdS.ToArray());
            }

            // Bulk fluxes
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Density].Add(new OptimizedHLLCDensityFlux(boundaryMap, material));
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Momentum.xComponent].Add(new OptimizedHLLCMomentumFlux(boundaryMap, 0, material));
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Momentum.yComponent].Add(new OptimizedHLLCMomentumFlux(boundaryMap, 1, material));
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Energy].Add(new OptimizedHLLCEnergyFlux(boundaryMap, material));

            // Interface fluxes
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Density].Add(new OptimizedHLLCFlux_Interface(this.LevelSetTracker, boundaryMap, material, FluxVariables.Density));
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Momentum.xComponent].Add(new OptimizedHLLCFlux_Interface(this.LevelSetTracker, boundaryMap, material, FluxVariables.Momentum, 0));
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Momentum.yComponent].Add(new OptimizedHLLCFlux_Interface(this.LevelSetTracker, boundaryMap, material, FluxVariables.Momentum, 1));
            this.XSpatialOperator.EquationComponents[CompressibleVariables.Energy].Add(new OptimizedHLLCFlux_Interface(this.LevelSetTracker, boundaryMap, material, FluxVariables.Energy));

            // Artificial viscosity bulk fluxes
            if (this.ArtificialViscosityField != null)
            {
                GridData gridData = (GridData)this.GridData;

                this.XSpatialOperator.EquationComponents[CompressibleVariables.Density].Add(
                    new OptimizedLaplacianArtificialViscosityFlux(
                        gridData,
                        CompressibleVariables.Density,
                        penaltySafetyFactor: 1.0,
                        penaltyFactor: (Density.Basis.Degree + 1) * (Density.Basis.Degree + gridData.SpatialDimension) / gridData.SpatialDimension,
                        cellLengthScales: gridData.Cells.CellLengthScale
                        ));

                for (int d = 0; d < CompressibleEnvironment.NumberOfDimensions; d++)
                {
                    this.XSpatialOperator.EquationComponents[CompressibleVariables.Momentum[d]].Add(
                        new OptimizedLaplacianArtificialViscosityFlux(
                            gridData,
                            CompressibleVariables.Momentum[d],
                            penaltySafetyFactor: 1.0,
                            penaltyFactor: (Momentum[0].Basis.Degree + 1) * (Momentum[0].Basis.Degree + gridData.SpatialDimension) / gridData.SpatialDimension,
                            cellLengthScales: gridData.Cells.CellLengthScale
                            ));
                }
                this.XSpatialOperator.EquationComponents[CompressibleVariables.Energy].Add(
                    new OptimizedLaplacianArtificialViscosityFlux(
                        gridData,
                        CompressibleVariables.Energy,
                        penaltySafetyFactor: 1.0,
                        penaltyFactor: (Energy.Basis.Degree + 1) * (Energy.Basis.Degree + gridData.SpatialDimension) / gridData.SpatialDimension,
                        cellLengthScales: gridData.Cells.CellLengthScale
                        ));
            }

            this.XSpatialOperator.Commit();

            // Timestepper
            this.TimeStepper = new XDGShockTimeStepping(
                this.ConservativeFields,
                this.Residuals,
                this.LevelSetTracker,
                this.DelComputeOperatorMatrix,
                this.DelUpdateLevelset,
                RungeKuttaScheme.ExplicitEuler,
                LevelSetHandling.None,
                MassMatrixShapeandDependence.IsIdentity,
                SpatialOperatorType.Nonlinear,
                this.MassScale,
                this.MultigridOperatorConfig,
                base.MultigridSequence,
                this.LevelSetTracker.SpeciesIdS.ToArray(),
                this.NonlinearQuadratureDegree,
                this.Control.AgglomerationThreshold,
                true,
                this.Control.NonLinearSolver,
                this.Control.LinearSolver);
        }
예제 #21
0
 protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
 {
 }
예제 #22
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            using (FuncTrace tr = new FuncTrace()) {
                this.BcMap = new IncompressibleBoundaryCondMap(this.GridData, grid.GetBoundaryConfig(), PhysicsMode.Incompressible);


                // assemble system, create matrix
                // ------------------------------



                int D = GridData.SpatialDimension;
                //double penalty_base = ((double)((U[0].Basis.Degree + 1) * (U[0].Basis.Degree + D))) / ((double)D);
                double penalty_base   = 1.0;
                double penalty_factor = 1.2;



                // equation assembly
                // -----------------
                string[] CodNames = D.ForLoop(i => "C" + i);
                Operator = new SpatialOperator(VariableNames.VelocityVector(D), new string[] { VariableNames.ViscosityMolecular }, CodNames, QuadOrderFunc.Linear());

                for (int d = 0; d < D; d++)
                {
                    if ((this.whichTerms & Terms.T1) != 0)
                    {
                        var flx1 = new swipViscosity_Term1(penalty_base * penalty_factor, d, D, BcMap, ViscosityOption.VariableViscosity);

                        flx1.g_Diri_Override = this.solution.U;
                        flx1.g_Neu_Override  = this.solution.dU;
                        Operator.EquationComponents[CodNames[d]].Add(flx1);
                    }
                    if ((this.whichTerms & Terms.T2) != 0)
                    {
                        var flx2 = new swipViscosity_Term2(penalty_base * penalty_factor, d, D, BcMap, ViscosityOption.VariableViscosity);

                        flx2.g_Diri_Override = this.solution.U;
                        flx2.g_Neu_Override  = this.solution.dU;
                        Operator.EquationComponents[CodNames[d]].Add(flx2);
                    }
                    if ((this.whichTerms & Terms.T3) != 0)
                    {
                        var flx3 = new swipViscosity_Term3(penalty_base * penalty_factor, d, D, BcMap, ViscosityOption.VariableViscosity);

                        flx3.g_Diri_Override = this.solution.U;
                        flx3.g_Neu_Override  = this.solution.dU;
                        Operator.EquationComponents[CodNames[d]].Add(flx3);
                    }
                } // */
                Operator.Commit();


                var map = this.U.Mapping;
                OperatorMtx = new MsrMatrix(map, map);
                Operator.ComputeMatrixEx(map, new DGField[] { this.mu }, map,
                                         OperatorMtx, this.bnd.CoordinateVector,
                                         volQuadScheme: null, edgeQuadScheme: null);

                // test for matrix symmetry
                // ========================

                if (base.MPISize == 1)
                {
                    double MatrixAssymmetry = OperatorMtx.SymmetryDeviation();
                    Console.WriteLine("Matrix asymmetry: " + MatrixAssymmetry);
                    Assert.LessOrEqual(Math.Abs(MatrixAssymmetry), 1.0e-10);
                }
            }
        }
예제 #23
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            if (Operator != null)
            {
                return;
            }

            // create operator
            // ---------------

            Func <double[], double, double> S;

            switch (this.Control.InterfaceMode)
            {
            case InterfaceMode.MovingInterface:
                S = this.Control.S;
                break;

            case InterfaceMode.Splitting:
                S = (X, t) => 0.0;
                break;

            default:
                throw new NotImplementedException();
            }

            int quadOrder;

            if (this.Control.Eq == Equation.ScalarTransport)
            {
                quadOrder = this.LinearQuadratureDegree;

                Func <double[], double, double>[] uBnd = new Func <double[], double, double> [this.Grid.EdgeTagNames.Keys.Max() + 1];
                for (int iEdgeTag = 1; iEdgeTag < uBnd.Length; iEdgeTag++)
                {
                    string nameEdgeTag;
                    if (this.Grid.EdgeTagNames.TryGetValue((byte)iEdgeTag, out nameEdgeTag))
                    {
                        if (!this.Control.BoundaryValues[nameEdgeTag].Evaluators.TryGetValue("u", out uBnd[iEdgeTag]))
                        {
                            uBnd[iEdgeTag] = (X, t) => 0.0;
                        }
                    }
                }

                Operator = new XSpatialOperator(1, 2, 1, (A, B, C) => quadOrder, "u", "Vx", "Vy", "Cod1");
                Operator.EquationComponents["Cod1"].Add(new TranportFlux_Bulk()
                {
                    Inflow = uBnd
                });
                Operator.EquationComponents["Cod1"].Add(new TransportFlux_Interface(this.LsTrk, S));
                Operator.Commit();
            }
            else if (this.Control.Eq == Equation.HeatEq)
            {
                quadOrder = this.LinearQuadratureDegree;

                Operator = new XSpatialOperator(1, 0, 1, (A, B, C) => quadOrder, "u", "Cod1");

                var bulkFlx = new HeatFlux_Bulk()
                {
                    m_muA = this.Control.muA, m_muB = this.Control.muB, m_rhsA = this.Control.rhsA, m_rhsB = this.Control.rhsB
                };
                var intfFlx = new HeatFlux_Interface(this.LsTrk, S)
                {
                    m_muA = this.Control.muA, m_muB = this.Control.muB
                };

                Operator.EquationComponents["Cod1"].Add(bulkFlx);
                Operator.EquationComponents["Cod1"].Add(intfFlx);
                Operator.Commit();
            }
            else if (this.Control.Eq == Equation.Burgers)
            {
                quadOrder = this.NonlinearQuadratureDegree;

                Operator = new XSpatialOperator(1, 1, 1, (A, B, C) => quadOrder, "u", "u0", "Cod1");
                Operator.EquationComponents["Cod1"].Add(new BurgersFlux_Bulk()
                {
                    Direction = this.Control.BurgersDirection, Inflow = this.Control.u_Ex
                });
                Operator.EquationComponents["Cod1"].Add(new BurgersFlux_Interface(this.LsTrk, S, this.Control.BurgersDirection));
                Operator.Commit();
            }
            else
            {
                throw new NotImplementedException();
            }

            // create timestepper
            // ------------------

            LevelSetHandling lsh;

            switch (this.Control.InterfaceMode)
            {
            case InterfaceMode.MovingInterface:
                lsh = LevelSetHandling.Coupled_Once;
                break;

            case InterfaceMode.Splitting:
                lsh = LevelSetHandling.LieSplitting;
                break;

            default:
                throw new NotImplementedException();
            }

            RungeKuttaScheme rksch = null;
            int bdfOrder           = -1000;

            if (this.Control.TimeSteppingScheme == TimeSteppingScheme.CrankNicolson)
            {
                bdfOrder = -1;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.ExplicitEuler)
            {
                bdfOrder = 0;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.ImplicitEuler)
            {
                bdfOrder = 1;
            }
            else if (this.Control.TimeSteppingScheme.ToString().StartsWith("BDF"))
            {
                bdfOrder = Convert.ToInt32(this.Control.TimeSteppingScheme.ToString().Substring(3));
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK1)
            {
                rksch = RungeKuttaScheme.ExplicitEuler;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK1u1)
            {
                rksch = RungeKuttaScheme.ExplicitEuler2;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK2)
            {
                rksch = RungeKuttaScheme.Heun2;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK3)
            {
                rksch = RungeKuttaScheme.TVD3;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK4)
            {
                rksch = RungeKuttaScheme.RungeKutta1901;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK_ImplicitEuler)
            {
                rksch = RungeKuttaScheme.ImplicitEuler;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK_CrankNic)
            {
                rksch = RungeKuttaScheme.CrankNicolson;
            }
            else if (this.Control.TimeSteppingScheme == TimeSteppingScheme.RK_IMEX3)
            {
                rksch = RungeKuttaScheme.IMEX3;
            }
            else
            {
                throw new NotImplementedException();
            }


            if (bdfOrder > -1000)
            {
                m_BDF_Timestepper = new XdgBDFTimestepping(new DGField[] { this.u }, new DGField[] { this.Residual }, LsTrk, true,
                                                           DelComputeOperatorMatrix, DelUpdateLevelset,
                                                           bdfOrder,
                                                           lsh,
                                                           MassMatrixShapeandDependence.IsTimeDependent,
                                                           SpatialOperatorType.LinearTimeDependent,
                                                           MassScale,
                                                           null, base.MultigridSequence,
                                                           this.LsTrk.SpeciesIdS.ToArray(), quadOrder,
                                                           this.Control.AgglomerationThreshold, false);
            }
            else
            {
                m_RK_Timestepper = new XdgRKTimestepping(new DGField[] { this.u }, new DGField[] { this.Residual }, LsTrk,
                                                         DelComputeOperatorMatrix, DelUpdateLevelset,
                                                         rksch,
                                                         lsh,
                                                         MassMatrixShapeandDependence.IsTimeDependent,
                                                         SpatialOperatorType.LinearTimeDependent,
                                                         MassScale,
                                                         null, base.MultigridSequence,
                                                         this.LsTrk.SpeciesIdS.ToArray(), quadOrder,
                                                         this.Control.AgglomerationThreshold, false);
            }
        }
예제 #24
0
        protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
        {
            m_quadOrder = u1.Basis.Degree * 2;


            Setup();

            //XLaplaceBCs xLaplaceBCs = new XLaplaceBCs();
            //xLaplaceBCs.g_Diri = ((CommonParamsBnd inp) => 0.0);
            //xLaplaceBCs.IsDirichlet = (inp => true);
            //double penalty_base = (m_DGorder + 1) * (m_DGorder + 2) / 2;
            //var lengthScales = ((BoSSS.Foundation.Grid.Classic.GridData)GridData).Cells.PenaltyLengthScales;
            //var lap = new XLaplace_Bulk(this.LsTrk, 2.0 * penalty_base, "u1", xLaplaceBCs, 1.0, 1, 1000, lengthScales, XLaplace_Interface.Mode.SIP);

            Op = new XSpatialOperatorMk2(2, 0, 2, (A, B, c) => m_quadOrder, LsTrk.SpeciesNames, "u1", "u2", "c1", "c2");
            //Op = new XSpatialOperatorMk2(1, 0, 1, (A, B, c) => m_quadOrder, LsTrk.SpeciesIdS.ToArray(), "u1","c1");

            switch (m_Mshape)
            {
            case MatrixShape.laplace:
                var    lengthScales = ((BoSSS.Foundation.Grid.Classic.GridData)GridData).Cells.PenaltyLengthScales;
                int    p            = u1.Basis.Degree;
                int    D            = this.GridData.SpatialDimension;
                double penalty_base = (p + 1) * (p + D) / D;
                double MU_A         = 1;
                double MU_B         = 10;

                Op.EquationComponents["c1"].Add(new XLaplace_Bulk(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u1", lengthScales));      // Bulk form
                Op.EquationComponents["c1"].Add(new XLaplace_Interface(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u1", lengthScales)); // coupling form
                Op.EquationComponents["c1"].Add(new XLaplace_Bulk(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u2", lengthScales));      // Bulk form
                Op.EquationComponents["c1"].Add(new XLaplace_Interface(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u2", lengthScales)); // coupling form
                Op.EquationComponents["c2"].Add(new XLaplace_Bulk(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u1", lengthScales));      // Bulk form
                Op.EquationComponents["c2"].Add(new XLaplace_Interface(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u1", lengthScales)); // coupling form
                Op.EquationComponents["c2"].Add(new XLaplace_Bulk(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u2", lengthScales));      // Bulk form
                Op.EquationComponents["c2"].Add(new XLaplace_Interface(this.LsTrk, MU_A, MU_B, penalty_base * 2, "u2", lengthScales)); // coupling form
                Op.EquationComponents["c1"].Add(new SourceTest("u1", 11));                                                             // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new SourceTest("u2", 11));                                                             // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u1", 11));                                                             // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u2", 11));                                                             // Flux in Bulk Phase;
                break;

            case MatrixShape.full:
                //tested: shape valid for testing
                Op.EquationComponents["c1"].Add(new DxFlux("u1", 3));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new DxFlux("u2", 4));     // Flux in Bulk Phase;
                break;

            case MatrixShape.full_var:
                //tested: shape valid for testing
                Op.EquationComponents["c1"].Add(new SourceTest("u1", 1));  // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new SourceTest("u2", 2));  // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new DxFlux("u1", 3));      // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new DxFlux("u2", 4));      // Flux in Bulk Phase;

                Op.EquationComponents["c2"].Add(new SourceTest("u1", -5)); // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u2", -6)); // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new DxFlux("u1", -7));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new DxFlux("u2", -8));     // Flux in Bulk Phase;
                break;

            case MatrixShape.full_spec:
                //tested: no spec coupling in the secondary diagonals (obviously)
                Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u1", -1));
                Op.EquationComponents["c1"].Add(new SourceTest("u1", 1));  // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new DxFlux("u1", 10));     // Flux in Bulk Phase;

                Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u2", -4));
                Op.EquationComponents["c2"].Add(new SourceTest("u2", -2));  // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new DxFlux("u2", -11));     // Flux in Bulk Phase;
                break;

            case MatrixShape.full_var_spec:
                //tested: no spec coupling in the secondary diagonals (obviously)
                Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u1", -1));
                Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u2", -1));
                Op.EquationComponents["c1"].Add(new DxFlux("u1", 3));     // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new DxFlux("u2", 4));     // Flux in Bulk Phase;

                Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u1", -1));
                Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u2", -1));
                Op.EquationComponents["c2"].Add(new DxFlux("u1", 3));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new DxFlux("u2", 4));     // Flux in Bulk Phase;
                break;

            case MatrixShape.diagonal_var_spec:
                // block diagonal matrix (ignore cell coupling)
                Op.EquationComponents["c1"].Add(new SourceTest("u1", 1));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u1", -2));    // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new SourceTest("u2", 3));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u2", -4));    // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u1", -2));
                Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u2", -4));
                break;

            case MatrixShape.diagonal_spec:
                // block diagonal matrix (ignore cell and variable coupling)
                Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u1", -2));
                Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u2", -4));
                Op.EquationComponents["c1"].Add(new SourceTest("u1", 1));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u2", -4));    // Flux in Bulk Phase;
                break;

            case MatrixShape.diagonal:
                // sparse matrix (ignore cell and variable coupling)
                Op.EquationComponents["c1"].Add(new SourceTest("u1", 1));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u2", -4));    // Flux in Bulk Phase;
                break;

            case MatrixShape.diagonal_var:
                // sparse matrix (ignore cell and variable coupling)
                Op.EquationComponents["c1"].Add(new SourceTest("u1", 1));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u1", -2));    // Flux in Bulk Phase;
                Op.EquationComponents["c1"].Add(new SourceTest("u2", 3));     // Flux in Bulk Phase;
                Op.EquationComponents["c2"].Add(new SourceTest("u2", -4));    // Flux in Bulk Phase;
                break;
            }



            //Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u1", -1));
            //Op.EquationComponents["c1"].Add(new DxFlux("u2", -1)); // Flux in Bulk Phase;
            //Op.EquationComponents["c2"].Add(new DxFlux("u1", 2)); // Flux in Bulk Phase;
            //Op.EquationComponents["c2"].Add(new DxFlux("u2", -2)); // Flux in Bulk Phase;

            //Op.EquationComponents["c1"].Add(new DxFlux("u1", -3.0)); // Flux in Bulk Phase;
            //Op.EquationComponents["c1"].Add(new LevSetFlx(this.LsTrk, "u1", -3.0));

            //Op.EquationComponents["c2"].Add(new DxFlux("u1", +3.0)); // Flux in Bulk Phase;
            //Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u1", +3.0));
            //Op.EquationComponents["c2"].Add(new DxFlux("u2", 77.7)); // Flux in Bulk Phase;
            //Op.EquationComponents["c2"].Add(new LevSetFlx(this.LsTrk, "u2", 77.7));



            Op.Commit();

            Basis maxB = map.BasisS.ElementAtMax(bss => bss.Degree);

            //massFact = new MassMatrixFactory(maxB, agg);
            massFact = LsTrk.GetXDGSpaceMetrics(this.LsTrk.SpeciesIdS.ToArray(), m_quadOrder).MassMatrixFactory;
        }
예제 #25
0
 public override void DataBackupBeforeBalancing(GridUpdateDataVaultBase L)
 {
     TimeIntegration.DataBackupBeforeBalancing(L);
 }
예제 #26
0
 protected override void CreateEquationsAndSolvers(GridUpdateDataVaultBase L)
 {
     AssembleMatrix(this.Control.MU_A, this.Control.MU_B, out Op_Matrix, out Op_Affine, out Op_Agglomeration, out Op_mass);
     Console.WriteLine("Matrix norm: {0}", Op_Matrix.InfNorm());
     Console.WriteLine("Symm. diff: {0}", Op_Matrix.SymmetryDeviation());
 }