[cig-commits] [commit] master: Add the option to increase output resolution. (4ebdcf4)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Sun Sep 14 13:05:26 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/d6cb37df5cdcac509136f55e118aabc0cb3569b9...5355d1f99396cc686dd0d7b235c54b62a1f4926d

>---------------------------------------------------------------

commit 4ebdcf41f55e58ffaf81febf8cc9d3bb5a3f1116
Author: Rene Gassmoeller <R.Gassmoeller at mailbox.org>
Date:   Sun Sep 14 11:46:27 2014 +0200

    Add the option to increase output resolution.


>---------------------------------------------------------------

4ebdcf41f55e58ffaf81febf8cc9d3bb5a3f1116
 doc/modules/changes.h                      | 10 ++++++++++
 include/aspect/postprocess/visualization.h | 13 +++++++++++++
 include/aspect/simulator_access.h          |  7 +++++++
 source/postprocess/visualization.cc        | 18 +++++++++++++++++-
 source/simulator/simulator_access.cc       |  6 ++++++
 5 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/doc/modules/changes.h b/doc/modules/changes.h
index 402ad92..f9e016b 100644
--- a/doc/modules/changes.h
+++ b/doc/modules/changes.h
@@ -6,6 +6,16 @@
  *
  *
  * <ol>
+ *<li> New: There is now the possibility to interpolate the visualization
+ * output to a refined output mesh. This accounts for the fact that most
+ * visualization software only offers linear interpolation between grid points
+ * and therefore the output file is a very coarse representation of the actual
+ * solution field. The new output is still a linear interpolation, but at least
+ * on a finer grid. The visualization output quality and used disk space will
+ * increase when activating this option.
+ * <br>
+ * (Rene Gassmoeller, 2014/09/14)
+ *
  * <li> Fixed: There was a race condition in writing output files: we
  * write to them in a temporary location and then move them to their
  * final location. We used to do the second step before actually closing
diff --git a/include/aspect/postprocess/visualization.h b/include/aspect/postprocess/visualization.h
index c6b2235..a44022b 100644
--- a/include/aspect/postprocess/visualization.h
+++ b/include/aspect/postprocess/visualization.h
@@ -359,6 +359,19 @@ namespace aspect
         unsigned int group_files;
 
         /**
+         * deal.II offers the possibility to linearly interpolate
+         * output fields of higher order elements to a finer resolution.
+         * This somewhat compensates the fact that most visualization
+         * software only offers linear interpolation between grid points
+         * and therefore the output file is a very coarse representation
+         * of the actual solution field. Activating this option increases
+         * the spatial resolution in each dimension by a factor equal
+         * to the polynomial degree used for the velocity finite element
+         * (usually 2).
+         */
+        bool interpolate_output;
+
+        /**
          * Compute the next output time from the current one. In the simplest
          * case, this is simply the previous next output time plus the
          * interval, but in general we'd like to ensure that it is larger than
diff --git a/include/aspect/simulator_access.h b/include/aspect/simulator_access.h
index 2cf54e8..13855c9 100644
--- a/include/aspect/simulator_access.h
+++ b/include/aspect/simulator_access.h
@@ -191,6 +191,13 @@ namespace aspect
       include_latent_heat () const;
 
       /**
+       * Return the stokes velocity degree.
+       */
+      int
+      get_stokes_velocity_degree () const;
+
+
+      /**
        * Return the adiabatic surface temperature.
        */
       double
diff --git a/source/postprocess/visualization.cc b/source/postprocess/visualization.cc
index 154ccfe..7dc6575 100644
--- a/source/postprocess/visualization.cc
+++ b/source/postprocess/visualization.cc
@@ -290,7 +290,10 @@ namespace aspect
         }
 
       // now build the patches and see how we can output these
-      data_out.build_patches ();
+      data_out.build_patches ((interpolate_output) ?
+                               this->get_stokes_velocity_degree()
+                               :
+                               0);
 
       std::string solution_file_prefix = "solution-" + Utilities::int_to_string (output_file_number, 5);
       std::string mesh_file_prefix = "mesh-" + Utilities::int_to_string (output_file_number, 5);
@@ -638,6 +641,18 @@ namespace aspect
                              "A value of 1 will generate one big file containing the whole "
                              "solution.");
 
+          prm.declare_entry ("Interpolate output", "false",
+                             Patterns::Bool(),
+                             "deal.II offers the possibility to linearly interpolate "
+                             "output fields of higher order elements to a finer resolution. "
+                             "This somewhat compensates the fact that most visualization "
+                             "software only offers linear interpolation between grid points "
+                             "and therefore the output file is a very coarse representation "
+                             "of the actual solution field. Activating this option increases "
+                             "the spatial resolution in each dimension by a factor equal "
+                             "to the polynomial degree used for the velocity finite element "
+                             "(usually 2).");
+
           // finally also construct a string for Patterns::MultipleSelection that
           // contains the names of all registered visualization postprocessors
           const std::string pattern_of_names
@@ -685,6 +700,7 @@ namespace aspect
           output_interval = prm.get_double ("Time between graphical output");
           output_format   = prm.get ("Output format");
           group_files     = prm.get_integer("Number of grouped files");
+          interpolate_output = prm.get_bool("Interpolate output");
 
           // now also see which derived quantities we are to compute
           viz_names = Utilities::split_string_list(prm.get("List of output variables"));
diff --git a/source/simulator/simulator_access.cc b/source/simulator/simulator_access.cc
index 9c8989b..72fd4eb 100644
--- a/source/simulator/simulator_access.cc
+++ b/source/simulator/simulator_access.cc
@@ -157,6 +157,12 @@ namespace aspect
     return simulator->parameters.include_latent_heat;
   }
 
+  template <int dim>
+  int
+  SimulatorAccess<dim>::get_stokes_velocity_degree () const
+  {
+    return simulator->parameters.stokes_velocity_degree;
+  }
 
   template <int dim>
   double



More information about the CIG-COMMITS mailing list