Exemple #1
0
        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;
        }
Exemple #2
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));
            }
        }