Exemple #1
0
 def monitor(self, t, solution, solution_dot):
     if matplotlib.get_backend() != "agg":
         self._solution_from_dense_to_sparse(solution, u)
         self._solution_from_dense_to_sparse(solution_dot, u_dot)
         plt.subplot(1, 2, 1).clear()
         plot(u, title="u at t = " + str(t))
         plt.subplot(1, 2, 2).clear()
         plot(u_dot, title="u_dot at t = " + str(t))
         plt.show(block=False)
         plt.pause(DOLFIN_EPS)
     else:
         print("||u|| at t = " + str(t) + ": " + str(monitor_norm(solution.vector())))
         print("||u_dot|| at t = " + str(t) + ": " + str(monitor_norm(solution_dot.vector())))
 def monitor(self, solution):
     if matplotlib.get_backend() != "agg":
         self._solution_from_dense_to_sparse(solution)
         plot(u, title="u")
         plt.show(block=False)
         plt.pause(1)
     else:
         print("||u|| = " + str(monitor_norm(solution.vector())))
Exemple #3
0
 def monitor(self, solution):
     if matplotlib.get_backend() != "agg":
         solution_array = solution.vector()
         solution_array[[min_dof_0_2pi, max_dof_0_2pi, 0, 1]] = solution_array[
             [0, 1, min_dof_0_2pi, max_dof_0_2pi]]
         plt.plot(x_to_dof.keys(), solution_array)
         solution_array[[0, 1, min_dof_0_2pi, max_dof_0_2pi]] = solution_array[
             [min_dof_0_2pi, max_dof_0_2pi, 0, 1]]
         plt.show(block=False)
         plt.pause(1)
     else:
         print("||u|| = " + str(monitor_norm(solution.vector())))