[cig-commits] commit 2435 by heister to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Tue Apr 8 15:48:13 PDT 2014


Revision 2435

mesh vertices

U   branches/freesurface/cookbooks/future/crameri_benchmark_2.prm
U   branches/freesurface/source/postprocess/visualization.cc
U   branches/freesurface/source/simulator/core.cc
U   branches/freesurface/source/simulator/freesurface.cc


http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=2435&peg=2435

Diff:
Modified: branches/freesurface/cookbooks/future/crameri_benchmark_2.prm
===================================================================
--- branches/freesurface/cookbooks/future/crameri_benchmark_2.prm	2014-04-08 22:04:15 UTC (rev 2434)
+++ branches/freesurface/cookbooks/future/crameri_benchmark_2.prm	2014-04-08 22:48:12 UTC (rev 2435)
@@ -90,7 +90,7 @@
 subsection Mesh refinement
   set Additional refinement times        =
   set Initial adaptive refinement        = 2
-  set Initial global refinement          = 5  
+  set Initial global refinement          = 3
   set Refinement fraction                = 0.3
   set Coarsening fraction                = 0.05
   set Strategy                           = density,composition
@@ -139,6 +139,6 @@
     set List of output variables = viscosity,density
     set Number of grouped files       = 1
     set Output format                 = vtu
-    set Time between graphical output = 1.e6
+    set Time between graphical output = 0
   end
 end

Modified: branches/freesurface/source/postprocess/visualization.cc
===================================================================
--- branches/freesurface/source/postprocess/visualization.cc	2014-04-08 22:04:15 UTC (rev 2434)
+++ branches/freesurface/source/postprocess/visualization.cc	2014-04-08 22:48:12 UTC (rev 2435)
@@ -149,6 +149,9 @@
                                 DataOut<dim>::type_dof_data,
                                 interpretation);
 
+
+//      data_out.add_data_vector(free_surface_dof_handler, mesh_vertices, "meshvertices");
+
       // then for each additional selected output variable
       // add the computed quantity as well. keep a list of
       // pointers to data vectors created by cell data visualization

Modified: branches/freesurface/source/simulator/core.cc
===================================================================
--- branches/freesurface/source/simulator/core.cc	2014-04-08 22:04:15 UTC (rev 2434)
+++ branches/freesurface/source/simulator/core.cc	2014-04-08 22:48:12 UTC (rev 2435)
@@ -1010,15 +1010,25 @@
          cell != triangulation.end_active(parameters.min_grid_level); ++cell)
       cell->clear_coarsen_flag ();
 
-    std::vector<const LinearAlgebra::BlockVector *> x_system (2);
+    std::vector<const LinearAlgebra::BlockVector *> x_system (4);
     x_system[0] = &solution;
     x_system[1] = &old_solution;
+    x_system[2] = &mesh_velocity;
+    x_system[3] = &old_mesh_velocity;
 
     parallel::distributed::SolutionTransfer<dim,LinearAlgebra::BlockVector>
     system_trans(dof_handler);
 
+    std::vector<const LinearAlgebra::Vector *> x_fs_system (1);
+    x_fs_system[0] = &mesh_vertices;
+
+    parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector>
+        freesurface_trans(free_surface_dof_handler);
+
+
     triangulation.prepare_coarsening_and_refinement();
     system_trans.prepare_for_coarsening_and_refinement(x_system);
+    freesurface_trans.prepare_for_coarsening_and_refinement(x_fs_system);
 
     triangulation.execute_coarsening_and_refinement ();
     global_volume = GridTools::volume (triangulation, mapping);
@@ -1033,15 +1043,35 @@
       distributed_system (system_rhs);
       LinearAlgebra::BlockVector
       old_distributed_system (system_rhs);
-      std::vector<LinearAlgebra::BlockVector *> system_tmp (2);
+      LinearAlgebra::BlockVector
+      distributed_mesh_velocity (system_rhs);
+      LinearAlgebra::BlockVector
+      old_distributed_mesh_velocity (system_rhs);
+
+      std::vector<LinearAlgebra::BlockVector *> system_tmp (4);
       system_tmp[0] = &(distributed_system);
       system_tmp[1] = &(old_distributed_system);
+      system_tmp[2] = &(distributed_mesh_velocity);
+      system_tmp[3] = &(old_distributed_mesh_velocity);
 
       system_trans.interpolate (system_tmp);
       solution     = distributed_system;
       old_solution = old_distributed_system;
+      mesh_velocity = distributed_mesh_velocity;
+      old_mesh_velocity = old_distributed_mesh_velocity;
     }
 
+    {
+      LinearAlgebra::Vector
+       distributed_mesh_vertices;
+      distributed_mesh_vertices.reinit(mesh_locally_owned, mpi_communicator);
+
+      std::vector<LinearAlgebra::Vector *> system_tmp (1);
+       system_tmp[0] = &(distributed_mesh_vertices);
+       freesurface_trans.interpolate (system_tmp);
+       mesh_vertices     = distributed_mesh_vertices;
+    }
+
     computing_timer.exit_section();
   }
 

Modified: branches/freesurface/source/simulator/freesurface.cc
===================================================================
--- branches/freesurface/source/simulator/freesurface.cc	2014-04-08 22:04:15 UTC (rev 2434)
+++ branches/freesurface/source/simulator/freesurface.cc	2014-04-08 22:48:12 UTC (rev 2435)
@@ -25,6 +25,7 @@
 #include <deal.II/dofs/dof_renumbering.h>
 #include <deal.II/dofs/dof_accessor.h>
 #include <deal.II/dofs/dof_tools.h>
+#include <deal.II/fe/fe_values.h>
 
 
 using namespace dealii;
@@ -47,6 +48,7 @@
 
 
 
+  free_surface_displace_mesh();
 }
 
 template <int dim>
@@ -76,6 +78,8 @@
 
   free_surface_dof_handler.distribute_dofs(free_surface_fe);
 
+  pcout << "FS: n_dofs = " << free_surface_dof_handler.n_dofs() << std::endl;
+
   // Renumber the DoFs hierarchical so that we get the
   // same numbering if we resume the computation. This
   // is because the numbering depends on the order the
@@ -91,7 +95,41 @@
       mesh_locally_relevant);
 
   mesh_vertices.reinit(mesh_locally_owned, mesh_locally_relevant, mpi_communicator);
+  //if we are just starting, we need to initialize mesh_vertices
+   if(this->timestep_number == 0)
+   {
+       pcout << "FS: get initial mesh vertices" << std::endl;
 
+     LinearAlgebra::Vector distributed_mesh_vertices;
+     distributed_mesh_vertices.reinit(mesh_locally_owned, mpi_communicator);
+
+     const std::vector<Point<dim> > mesh_support_points
+       = free_surface_fe.base_element(0).get_unit_support_points();
+     FEValues<dim> mesh_points (mapping, free_surface_fe,
+         mesh_support_points, update_quadrature_points);
+     std::vector<unsigned int> cell_dof_indices (free_surface_fe.dofs_per_cell);
+
+     typename DoFHandler<dim>::active_cell_iterator cell = free_surface_dof_handler.begin_active(),
+                                                    endc = free_surface_dof_handler.end();
+     for(; cell != endc; ++cell)
+       if(cell->is_locally_owned())
+       {
+         mesh_points.reinit(cell);
+         cell->get_dof_indices (cell_dof_indices);
+         for(unsigned int j=0; j<free_surface_fe.base_element(0).dofs_per_cell; ++j)
+           for(unsigned int dir=0; dir<dim; ++dir)
+           {
+              unsigned int support_point_index
+                 = free_surface_fe.component_to_system_index(/*velocity component=*/ dir,
+                                                            /*dof index within component=*/ j);
+             distributed_mesh_vertices[cell_dof_indices[support_point_index]] = mesh_points.quadrature_point(j)[dir];
+           }
+       }
+
+     distributed_mesh_vertices.compress(VectorOperation::insert);
+     mesh_vertices = distributed_mesh_vertices;
+   }
+
   free_surface_make_constraints();
 
   // matrix
@@ -140,8 +178,24 @@
 template <int dim>
 void Simulator<dim>::free_surface_displace_mesh()
 {
+  pcout << "FS: free_surface_displace_mesh()" << std::endl;
 
+  typename DoFHandler<dim>::active_cell_iterator  cell = free_surface_dof_handler.begin_active(),
+                                                     endc = free_surface_dof_handler.end();
+
+     for(cell = free_surface_dof_handler.begin_active(); cell != endc; ++cell)
+       if(cell->is_artificial() == false)
+         for(unsigned int vertex_no = 0; vertex_no < GeometryInfo<dim>::vertices_per_cell; ++vertex_no)
+         {
+           Point<dim> &v=cell->vertex(vertex_no);
+           for (unsigned int dir=0; dir<dim; ++dir)
+             v(dir) = mesh_vertices(
+                 cell->vertex_dof_index(vertex_no, dir)
+                     ); //enforce the vertex position
+         }
+
 }
+
 }
 
 


More information about the CIG-COMMITS mailing list