Examples of ExpandableStatefulODE


Examples of org.apache.commons.math3.ode.ExpandableStatefulODE

            // predict a first estimate of the state at step end
            final double stepEnd = stepStart + stepSize;
            interpolator.shift();
            interpolator.setInterpolatedTime(stepEnd);
            final ExpandableStatefulODE expandable = getExpandable();
            final EquationsMapper primary = expandable.getPrimaryMapper();
            primary.insertEquationData(interpolator.getInterpolatedState(), y);
            int index = 0;
            for (final EquationsMapper secondary : expandable.getSecondaryMappers()) {
                secondary.insertEquationData(interpolator.getInterpolatedSecondaryState(index), y);
                ++index;
            }

            // evaluate the derivative
View Full Code Here

Examples of org.apache.commons.math3.ode.ExpandableStatefulODE

                stepSize = hNew;

                // predict a first estimate of the state at step end (P in the PECE sequence)
                final double stepEnd = stepStart + stepSize;
                interpolator.setInterpolatedTime(stepEnd);
                final ExpandableStatefulODE expandable = getExpandable();
                final EquationsMapper primary = expandable.getPrimaryMapper();
                primary.insertEquationData(interpolator.getInterpolatedState(), yTmp);
                int index = 0;
                for (final EquationsMapper secondary : expandable.getSecondaryMappers()) {
                    secondary.insertEquationData(interpolator.getInterpolatedSecondaryState(index), yTmp);
                    ++index;
                }

                // evaluate a first estimate of the derivative (first E in the PECE sequence)
View Full Code Here

Examples of org.apache.commons.math3.ode.ExpandableStatefulODE

        final double tolerance = 0.1;
        EventState es = new EventState(closeEventsGenerator, 1.5 * gap,
                                       tolerance, 100,
                                       new BrentSolver(tolerance));
        es.setExpandable(new ExpandableStatefulODE(new FirstOrderDifferentialEquations() {
            public int getDimension() {
                return 0;
            }
            public void computeDerivatives(double t, double[] y, double[] yDot) {
            }
View Full Code Here

Examples of org.apache.commons.math3.ode.ExpandableStatefulODE

    @Test
    public void testIssue965()
        throws DimensionMismatchException, NumberIsTooSmallException,
               MaxCountExceededException, NoBracketingException {

        ExpandableStatefulODE equation =
                new ExpandableStatefulODE(new FirstOrderDifferentialEquations() {
           
            public int getDimension() {
                return 1;
            }
           
            public void computeDerivatives(double t, double[] y, double[] yDot) {
                yDot[0] = 2.0;
            }
        });
        equation.setTime(0.0);
        equation.setPrimaryState(new double[1]);
        equation.addSecondaryEquations(new SecondaryEquations() {
           
            public int getDimension() {
                return 1;
            }
           
            public void computeDerivatives(double t, double[] primary,
                                           double[] primaryDot, double[] secondary,
                                           double[] secondaryDot) {
                secondaryDot[0] = -3.0;
            }
        });
        int index = equation.getSecondaryMappers()[0].getFirstIndex();

        DormandPrince853Integrator integrator = new DormandPrince853Integrator(0.001, 1000, 1.0e-14, 1.0e-14);
        integrator.addEventHandler(new SecondaryStateEvent(index, -3.0), 0.1, 1.0e-9, 1000);
        integrator.setInitialStepSize(3.0);

        integrator.integrate(equation, 30.0);
        Assert.assertEquals( 1.0, equation.getTime(), 1.0e-10);
        Assert.assertEquals( 2.0, equation.getPrimaryState()[0], 1.0e-10);
        Assert.assertEquals(-3.0, equation.getSecondaryState(0)[0], 1.0e-10);

    }
View Full Code Here

Examples of org.apache.commons.math3.ode.ExpandableStatefulODE

                stepSize = hNew;

                // predict a first estimate of the state at step end (P in the PECE sequence)
                final double stepEnd = stepStart + stepSize;
                interpolator.setInterpolatedTime(stepEnd);
                final ExpandableStatefulODE expandable = getExpandable();
                final EquationsMapper primary = expandable.getPrimaryMapper();
                primary.insertEquationData(interpolator.getInterpolatedState(), yTmp);
                int index = 0;
                for (final EquationsMapper secondary : expandable.getSecondaryMappers()) {
                    secondary.insertEquationData(interpolator.getInterpolatedSecondaryState(index), yTmp);
                    ++index;
                }

                // evaluate a first estimate of the derivative (first E in the PECE sequence)
View Full Code Here

Examples of org.apache.commons.math3.ode.ExpandableStatefulODE

            // predict a first estimate of the state at step end
            final double stepEnd = stepStart + stepSize;
            interpolator.shift();
            interpolator.setInterpolatedTime(stepEnd);
            final ExpandableStatefulODE expandable = getExpandable();
            final EquationsMapper primary = expandable.getPrimaryMapper();
            primary.insertEquationData(interpolator.getInterpolatedState(), y);
            int index = 0;
            for (final EquationsMapper secondary : expandable.getSecondaryMappers()) {
                secondary.insertEquationData(interpolator.getInterpolatedSecondaryState(index), y);
                ++index;
            }

            // evaluate the derivative
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.