/// <summary> /// performs one timestep /// </summary> /// <param name="dt">size of timestep</param> public override double Perform(double dt) { using (var tr = new ilPSP.Tracing.FuncTrace()) { if (TimeStepConstraints != null) { dt = CalculateTimeStep(); } double[][] k = new double[m_Scheme.Stages][]; for (int i = 0; i < m_Scheme.Stages; i++) { k[i] = new double[Mapping.LocalLength]; } double[] y0 = new double[Mapping.LocalLength]; DGCoordinates.CopyTo(y0, 0); // logging tr.Info("Runge-Kutta Scheme with " + m_Scheme.Stages + " stages."); double time0 = m_Time; tr.Info("time = " + time0 + ", dt = " + dt); // berechne k[0] ComputeChangeRate(k[0], m_Time, 0);// invokes MPI communication for (int s = 1; s < m_Scheme.Stages; s++) { PerformStage(y0, s, k, dt); m_Time = time0 + m_Scheme.c[s] * dt; ComputeChangeRate(k[s], m_Time, m_Scheme.c[s] * dt);// invokes MPI communication } // next timestep DGCoordinates.Clear(); DGCoordinates.CopyFrom(y0, 0); Array.Clear(y0, 0, y0.Length); for (int s = 0; s < m_Scheme.Stages; s++) { if (m_Scheme.b[s] != 0.0) { BLAS.daxpy(y0.Length, -m_Scheme.b[s] * dt, k[s], 1, y0, 1); } } DGCoordinates.axpy <double[]>(y0, 1.0); base.ApplyFilter(dt); m_Time = time0 + dt; } return(dt); }
protected override double[] ComputesUpdatedDGCoordinates(double[] completeChangeRate) { double[] y0 = new double[Mapping.LocalLength]; DGCoordinates.CopyTo(y0, 0); DGCoordinates.axpy <double[]>(completeChangeRate, -1); // Speciality for IBM: Do the extrapolation speciesMap.Agglomerator.Extrapolate(DGCoordinates.Mapping); double[] upDGC = DGCoordinates.ToArray(); upDGC = OrderValuesBySgrd(upDGC); // DGCoordinates should be untouched after calling this method DGCoordinates.Clear(); DGCoordinates.CopyFrom(y0, 0); return(upDGC); }