List of usage examples for org.apache.commons.math3.ode.nonstiff DormandPrince853Integrator DormandPrince853Integrator
public DormandPrince853Integrator(final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance)
From source file:org.orekit.utils.SecularAndHarmonicTest.java
private NumericalPropagator createPropagator(CircularOrbit orbit) throws OrekitException { OrbitType type = OrbitType.CIRCULAR; double[][] tolerances = NumericalPropagator.tolerances(0.1, orbit, type); DormandPrince853Integrator integrator = new DormandPrince853Integrator(1.0, 600, tolerances[0], tolerances[1]);/*from w w w.j av a 2 s .c o m*/ integrator.setInitialStepSize(60.0); NumericalPropagator propagator = new NumericalPropagator(integrator); propagator.addForceModel(new HolmesFeatherstoneAttractionModel(earth.getBodyFrame(), gravityField)); propagator.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getSun())); propagator.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getMoon())); propagator.setOrbitType(type); propagator.resetInitialState(new SpacecraftState(orbit)); return propagator; }
From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java
private double[] interpolationErrors(final TimeStampedAngularCoordinates reference, double dt) throws OrekitException { final FirstOrderDifferentialEquations ode = new FirstOrderDifferentialEquations() { public int getDimension() { return 4; }/* w ww . j a v a 2s .co m*/ public void computeDerivatives(final double t, final double[] q, final double[] qDot) { final double omegaX = reference.getRotationRate().getX() + t * reference.getRotationAcceleration().getX(); final double omegaY = reference.getRotationRate().getY() + t * reference.getRotationAcceleration().getY(); final double omegaZ = reference.getRotationRate().getZ() + t * reference.getRotationAcceleration().getZ(); qDot[0] = 0.5 * MathArrays.linearCombination(-q[1], omegaX, -q[2], omegaY, -q[3], omegaZ); qDot[1] = 0.5 * MathArrays.linearCombination(q[0], omegaX, -q[3], omegaY, q[2], omegaZ); qDot[2] = 0.5 * MathArrays.linearCombination(q[3], omegaX, q[0], omegaY, -q[1], omegaZ); qDot[3] = 0.5 * MathArrays.linearCombination(-q[2], omegaX, q[1], omegaY, q[0], omegaZ); } }; final List<TimeStampedAngularCoordinates> complete = new ArrayList<TimeStampedAngularCoordinates>(); FirstOrderIntegrator integrator = new DormandPrince853Integrator(1.0e-6, 1.0, 1.0e-12, 1.0e-12); integrator.addStepHandler(new StepNormalizer(dt / 2000, new FixedStepHandler() { public void init(double t0, double[] y0, double t) { } public void handleStep(double t, double[] y, double[] yDot, boolean isLast) { complete.add( new TimeStampedAngularCoordinates(reference.getDate().shiftedBy(t), new Rotation(y[0], y[1], y[2], y[3], true), new Vector3D(1, reference.getRotationRate(), t, reference.getRotationAcceleration()), reference.getRotationAcceleration())); } })); double[] y = new double[] { reference.getRotation().getQ0(), reference.getRotation().getQ1(), reference.getRotation().getQ2(), reference.getRotation().getQ3() }; integrator.integrate(ode, 0, y, dt, y); List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>(); sample.add(complete.get(0)); sample.add(complete.get(complete.size() / 2)); sample.add(complete.get(complete.size() - 1)); double maxRotationError = 0; double maxRateError = 0; double maxAccelerationError = 0; for (TimeStampedAngularCoordinates acRef : complete) { TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates.interpolate(acRef.getDate(), AngularDerivativesFilter.USE_RRA, sample); double rotationError = Rotation.distance(acRef.getRotation(), interpolated.getRotation()); double rateError = Vector3D.distance(acRef.getRotationRate(), interpolated.getRotationRate()); double accelerationError = Vector3D.distance(acRef.getRotationAcceleration(), interpolated.getRotationAcceleration()); maxRotationError = FastMath.max(maxRotationError, rotationError); maxRateError = FastMath.max(maxRateError, rateError); maxAccelerationError = FastMath.max(maxAccelerationError, accelerationError); } return new double[] { maxRotationError, maxRateError, maxAccelerationError }; }
From source file:Quick_Copy_Files.MasterMode.java
/** Program entry point. * @param args program arguments (unused here) *//*w ww. j a v a 2 s. c o m*/ public static void main(String[] args) { try { // configure Orekit AutoconfigurationCustom.configureOrekit(); // gravitation coefficient double mu = 3.986004415e+14; // inertial frame Frame inertialFrame = FramesFactory.getEME2000(); // Initial date AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC()); // Initial orbit double a = 24396159; // semi major axis in meters double e = 0.72831215; // eccentricity double i = FastMath.toRadians(7); // inclination double omega = FastMath.toRadians(180); // perigee argument double raan = FastMath.toRadians(261); // right ascention of ascending node double lM = 0; // mean anomaly Orbit initialOrbit = new KeplerianOrbit(a, e, i, omega, raan, lM, PositionAngle.MEAN, inertialFrame, initialDate, mu); // Initial state definition SpacecraftState initialState = new SpacecraftState(initialOrbit); // Adaptive step integrator with a minimum step of 0.001 and a maximum step of 1000 final double minStep = 0.001; final double maxstep = 1000.0; final double positionTolerance = 10.0; final OrbitType propagationType = OrbitType.KEPLERIAN; final double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, initialOrbit, propagationType); AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxstep, tolerances[0], tolerances[1]); // Propagator NumericalPropagator propagator = new NumericalPropagator(integrator); propagator.setOrbitType(propagationType); // Force Model (reduced to perturbing gravity field) final NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(10, 10); ForceModel holmesFeatherstone = new HolmesFeatherstoneAttractionModel( FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider); // Add force model to the propagator propagator.addForceModel(holmesFeatherstone); // Set up initial state in the propagator propagator.setInitialState(initialState); // Set up operating mode for the propagator as master mode // with fixed step and specialized step handler propagator.setMasterMode(60., new TutorialStepHandler()); // Extrapolate from the initial to the final date SpacecraftState finalState = propagator.propagate(initialDate.shiftedBy(630.)); KeplerianOrbit o = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(finalState.getOrbit()); System.out.format(Locale.US, "Final state:%n%s %12.3f %10.8f %10.6f %10.6f %10.6f %10.6f%n", finalState.getDate(), o.getA(), o.getE(), FastMath.toDegrees(o.getI()), FastMath.toDegrees(o.getPerigeeArgument()), FastMath.toDegrees(o.getRightAscensionOfAscendingNode()), FastMath.toDegrees(o.getTrueAnomaly())); } catch (OrekitException oe) { System.err.println(oe.getMessage()); } }
From source file:reactor.semibatchreactor.Simulation.java
public static void main(String[] args) { double[] initialConditions = { 10, 0, 0, 0, 300 }; double[] tempParameters = { 2500, 280, 2, 0.004, 75240, 300, -7.9076 * Math.pow(10, 7) }; double[] odeParameters = { 0.2, 6.14, 0, 2.37989273, 8.94266 * Math.pow(10, 12), 803373.6 }; SemiBatchReactor reactor = new SemiBatchReactor(initialConditions, tempParameters, odeParameters); FirstOrderIntegrator integrator = new DormandPrince853Integrator(0.1, 0.1, 0.001, 0.001); FirstOrderDifferentialEquations ode = reactor; integrator.addStepHandler(reactor.stepHandler); integrator.integrate(ode, 0.0, initialConditions, 10, initialConditions); }
From source file:travelTimesBack.Dp853.java
/** * Instantiates a new dp853 solver./* www .ja va2s. c o m*/ * * @param dt: the integration time * @param ode: is the ordinary differential equation to be solved * @param y: is a vector with the boundary conditions */ public Dp853(double dt, FirstOrderDifferentialEquations ode, double[] y) { this.ode = ode; this.y = y; this.dt = dt; this.integrator = new DormandPrince853Integrator(1.0e-8, dt, 1.0e-10, 1.0e-10); }
From source file:ummisco.gaml.extensions.maths.ode.utils.solver.DormandPrince853Solver.java
public DormandPrince853Solver(final double minStep, final double maxStep, final double scalAbsoluteTolerance, final double scalRelativeTolerance, final GamaMap<String, IList<Double>> integrated_val) { super((minStep + maxStep) / 2, new DormandPrince853Integrator(minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance), integrated_val); }