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

dealii.demon at gmail.com dealii.demon at gmail.com
Tue Apr 8 14:50:02 PDT 2014


Revision 2433

initial fs stuff

U   branches/freesurface/include/aspect/simulator.h
U   branches/freesurface/source/simulator/core.cc
A   branches/freesurface/source/simulator/freesurface.cc


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

Diff:
Modified: branches/freesurface/include/aspect/simulator.h
===================================================================
--- branches/freesurface/include/aspect/simulator.h	2014-04-08 17:01:41 UTC (rev 2432)
+++ branches/freesurface/include/aspect/simulator.h	2014-04-08 21:49:59 UTC (rev 2433)
@@ -1261,6 +1261,33 @@
        * @}
        */
 
+      void free_surface_execute();
+
+      void free_surface_setup_dofs();
+
+      void free_surface_displace_mesh();
+
+
+      // internal functions:
+      void free_surface_make_constraints();
+
+
+      const FESystem<dim>                                       free_surface_fe;
+
+      DoFHandler<dim>                                           free_surface_dof_handler;
+
+      LinearAlgebra::BlockVector mesh_velocity;
+      LinearAlgebra::BlockVector old_mesh_velocity;
+
+      LinearAlgebra::Vector mesh_vertices;
+      LinearAlgebra::SparseMatrix mesh_matrix;
+      LinearAlgebra::Vector mesh_rhs;
+
+      IndexSet mesh_locally_owned;
+      IndexSet mesh_locally_relevant;
+
+      ConstraintMatrix mesh_constraints;
+
       friend class boost::serialization::access;
       friend class SimulatorAccess<dim>;
   };

Modified: branches/freesurface/source/simulator/core.cc
===================================================================
--- branches/freesurface/source/simulator/core.cc	2014-04-08 17:01:41 UTC (rev 2432)
+++ branches/freesurface/source/simulator/core.cc	2014-04-08 21:49:59 UTC (rev 2433)
@@ -143,7 +143,10 @@
     dof_handler (triangulation),
 
     rebuild_stokes_matrix (true),
-    rebuild_stokes_preconditioner (true)
+    rebuild_stokes_preconditioner (true),
+    free_surface_fe (FE_Q<dim>(1),dim),
+    free_surface_dof_handler (triangulation)
+
   {
     computing_timer.enter_section("Initialization");
 
@@ -838,6 +841,8 @@
     }
     constraints.close();
 
+    free_surface_setup_dofs();
+
     // finally initialize vectors, matrices, etc.
 
     setup_system_matrix (introspection.index_sets.system_partitioning);
@@ -1080,6 +1085,7 @@
               assemble_advection_system (TemperatureOrComposition::composition(c));
               build_advection_preconditioner(TemperatureOrComposition::composition(c),
                                              C_preconditioner);
+
               solve_advection(TemperatureOrComposition::composition(c)); // this is correct, 0 would be temperature
               current_linearization_point.block(introspection.block_indices.compositional_fields[c])
                 = solution.block(introspection.block_indices.compositional_fields[c]);
@@ -1098,6 +1104,8 @@
           build_stokes_preconditioner();
           solve_stokes();
 
+          free_surface_execute ();
+
           break;
         }
         case NonlinearSolver::Stokes_only:

Added: branches/freesurface/source/simulator/freesurface.cc
===================================================================
--- branches/freesurface/source/simulator/freesurface.cc	                        (rev 0)
+++ branches/freesurface/source/simulator/freesurface.cc	2014-04-08 21:49:59 UTC (rev 2433)
@@ -0,0 +1,149 @@
+/*
+  Copyright (C) 2011, 2012, 2013, 2014 by the authors of the ASPECT code.
+
+  This file is part of ASPECT.
+
+  ASPECT is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2, or (at your option)
+  any later version.
+
+  ASPECT is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with ASPECT; see the file doc/COPYING.  If not see
+  <http://www.gnu.org/licenses/>.
+ */
+/*  $Id: main.cc 2430 2014-04-08 14:41:18Z heister $  */
+
+#include <aspect/simulator.h>
+#include <aspect/global.h>
+
+#include <deal.II/dofs/dof_renumbering.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_tools.h>
+
+
+using namespace dealii;
+
+
+namespace aspect
+{
+
+template <int dim>
+void Simulator<dim>::free_surface_execute()
+{
+  pcout << "FS: free_surface_execute()" << std::endl;
+
+
+
+
+
+
+
+
+}
+
+template <int dim>
+void Simulator<dim>::free_surface_make_constraints()
+{
+  pcout << "FS: free_surface_make_constraints()" << std::endl;
+
+mesh_constraints.clear();
+
+//Assert(we need a free surface)
+
+}
+
+template <int dim>
+void Simulator<dim>::free_surface_setup_dofs()
+{
+  pcout << "FS: free_surface_setup_dofs()" << std::endl;
+
+  // these live in the same FE as the velocity variable:
+  mesh_velocity.reinit(introspection.index_sets.system_partitioning, introspection.index_sets.system_relevant_partitioning, mpi_communicator);
+  old_mesh_velocity.reinit(introspection.index_sets.system_partitioning, introspection.index_sets.system_relevant_partitioning, mpi_communicator);
+
+
+  free_surface_dof_handler.distribute_dofs(free_surface_fe);
+
+  // 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
+  // cells are created.
+  DoFRenumbering::hierarchical (free_surface_dof_handler);
+//  DoFRenumbering::component_wise (free_surface_dof_handler,
+//      introspection.components_to_blocks);
+
+
+
+  mesh_locally_owned = free_surface_dof_handler.locally_owned_dofs();
+  DoFTools::extract_locally_relevant_dofs (free_surface_dof_handler,
+      mesh_locally_relevant);
+
+  mesh_vertices.reinit(mesh_locally_owned, mesh_locally_relevant, mpi_communicator);
+
+  free_surface_make_constraints();
+
+  // matrix
+  {
+    mesh_matrix.clear ();
+
+    Table<2,DoFTools::Coupling> coupling (dim, dim);
+    coupling.fill(DoFTools::none);
+
+      for (unsigned int c=0; c<dim; ++c)
+          coupling[c][c] = DoFTools::always;
+
+#ifdef USE_PETSC
+    LinearAlgebra::CompressedSparsityPattern sp(error);
+
+#else
+    TrilinosWrappers::SparsityPattern sp (mesh_locally_owned,mesh_locally_owned,
+                                               mpi_communicator);
+#endif
+
+    DoFTools::make_sparsity_pattern (free_surface_dof_handler,
+                                     coupling, sp,
+                                     mesh_constraints, false,
+                                     Utilities::MPI::
+                                     this_mpi_process(mpi_communicator));
+
+#ifdef USE_PETSC
+    SparsityTools::distribute_sparsity_pattern(sp,
+        free_surface_dof_handler.locally_owned_dofs_per_processor(),
+        mpi_communicator, mesh_locally_relevant);
+
+    sp.compress();
+
+    mesh_matrix.reinit (mesh_locally_owned, mesh_locally_owned, sp, mpi_communicator);
+#else
+    sp.compress();
+
+    mesh_matrix.reinit (sp);
+#endif
+
+  }
+
+
+}
+
+template <int dim>
+void Simulator<dim>::free_surface_displace_mesh()
+{
+
+}
+}
+
+
+// explicit instantiation of the functions we implement in this file
+namespace aspect
+{
+#define INSTANTIATE(dim) \
+  template class Simulator<dim>;
+
+  ASPECT_INSTANTIATE(INSTANTIATE)
+}


More information about the CIG-COMMITS mailing list