Parallel Finite Element - General geometry Ewald-like Method
Part of Continuum-particle Simulation Suite under MICCOM
assemble_system.h
Go to the documentation of this file.
1 // Parallel Finite Element-General Geometry Ewald-like Method.
2 // Copyright (C) 2015-2016 Xujun Zhao, Jiyuan Li, Xikai Jiang
3 
4 // This code is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 
10 // This code is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 
15 
16 // You should have received a copy of the GNU General Public
17 // License along with this code; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 
21 
22 #pragma once
23 
24 // C++ includes
25 #include <stdio.h>
26 #include <iostream>
27 #include <cstring>
28 #include <utility>
29 #include <vector>
30 #include <map>
31 
32 // Libmesh includes
33 #include "libmesh/libmesh.h"
34 #include "libmesh/equation_systems.h"
35 #include "libmesh/point.h"
37 
38 // Bring in everything from the libMesh namespace
39 using namespace libMesh;
40 
41 
48 class AssembleSystem : public ReferenceCountedObject<AssembleSystem>
49 {
50 public:
55  AssembleSystem(EquationSystems& es);
56 
57 
61  ~AssembleSystem();
62 
63 
71  virtual void assemble_global_K(const std::string& system_name,
72  const std::string& option) = 0;
73 
74 
81  virtual void assemble_global_F(const std::string& system_name,
82  const std::string& option) = 0;
83 
84 
85 
92  virtual void assemble_element_KIJ(const std::vector<Real>& JxW,
93  const std::vector<std::vector<RealGradient> >& dphi,
94  const unsigned int n_u_dofs,
95  const unsigned int I,
96  const unsigned int J,
97  DenseMatrix<Number>& Kij) = 0;
98 
103  virtual void compute_element_rhs(const Elem* elem,
104  const unsigned int n_u_dofs,
105  FEBase& fe_v,
106  const std::vector<std::size_t> n_list,
107  const bool& pf_flag,
108  const std::string& option,
109  const Real& alpha,
110  DenseVector<Number>& Fe) = 0;
111 
112 
116  virtual void apply_bc_by_penalty(const Elem* elem,
117  const std::string& matrix_or_vector,
118  DenseMatrix<Number>& Ke,
119  DenseVector<Number>& Fe,
120  const std::string& option) = 0;
121 
122 
128  void assemble_int_force(const Elem* elem,
129  const unsigned int n_u_dofs,
130  FEBase& fe_v);
131 
132 
136  virtual void select_boundary_side(const Elem* elem) = 0;
137 
138 
142  void penalize_elem_matrix_vector(DenseMatrix<Number>& Ke,
143  DenseVector<Number>& Fe,
144  const std::string & matrix_or_vector,
145  const unsigned int& var_number, // variable number
146  const unsigned int& local_node_id, // local node id to be penalized
147  const unsigned int& n_nodes_elem, // vel-node number of elem!
148  const Real& penalty,
149  const Real& value);
150 
151 
152 
153 protected:
154  // Equation systems
155  EquationSystems& _eqn_sys;
156 
157  // system dimension
158  unsigned int _dim;
159 
160  // Fluid mesh
161  MeshBase& _mesh;
162 
163  // Boundary ids
164  // defaults in cubic geometry generated from libMesh
165  const std::vector<boundary_id_type> _boundary_id_3D = {4,2,1,3,0,5};
166  const std::vector<std::string> _boundary_name_3D = {"left", "right", "bottom", "top", "back", "front"};
167 
168  // int_force matrix
169  // this matrix stores the product of JxW[qp] * phi[k][qp]
170  // size = num_elem * (n_u_dofs * n_quad_points)
171  std::vector<std::vector<Real>> _int_force;
172 
173 
174  // vector stores q_xyz size
175  // size = num_elem * q_xyz.size()
176  std::vector<std::vector<Point>> _q_xyz;
177 
178  // vector stores dof sizes for all elems
179  std::vector<unsigned int> _n_dofs;
180  std::vector<unsigned int> _n_u_dofs;
181  std::vector<unsigned int> _n_p_dofs;
182  std::vector<unsigned int> _n_uvw_dofs;
183 
184  // dof indices
185  std::vector<std::vector<dof_id_type> > _dof_indices;
186  std::vector<std::vector<dof_id_type> > _dof_indices_u;
187  std::vector<std::vector<dof_id_type> > _dof_indices_p;
188 
189  // sides on the boundary
190  std::vector<std::vector<unsigned int> > _boundary_sides;
191 
192 };
std::vector< std::vector< unsigned int > > _boundary_sides
Definition: assemble_system.h:190
MeshBase & _mesh
Definition: assemble_system.h:161
This base class provides the template for assembling the matrix and right-hand-side vector when solvi...
Definition: assemble_system.h:48
std::vector< unsigned int > _n_dofs
Definition: assemble_system.h:179
std::vector< std::vector< dof_id_type > > _dof_indices_u
Definition: assemble_system.h:186
std::vector< unsigned int > _n_p_dofs
Definition: assemble_system.h:181
std::vector< unsigned int > _n_u_dofs
Definition: assemble_system.h:180
Definition: brownian_system.h:58
std::vector< std::vector< dof_id_type > > _dof_indices_p
Definition: assemble_system.h:187
std::vector< std::vector< Real > > _int_force
Definition: assemble_system.h:171
EquationSystems & _eqn_sys
Definition: assemble_system.h:155
unsigned int _dim
Definition: assemble_system.h:158
std::vector< std::vector< dof_id_type > > _dof_indices
Definition: assemble_system.h:185
std::vector< std::vector< Point > > _q_xyz
Definition: assemble_system.h:176
std::vector< unsigned int > _n_uvw_dofs
Definition: assemble_system.h:182