CArl
Code Arlequin / C++ implementation
assemble_coupling.h
Go to the documentation of this file.
1 /*
2  * assemble_coupling.h
3  *
4  * Created on: Apr 13, 2017
5  * Author: Thiago Milanetto Schlittler
6  */
7 
8 #ifndef ASSEMBLE_COUPLING_H_
9 #define ASSEMBLE_COUPLING_H_
10 
11 #include "carl_headers.h"
12 
13 #include "mpi_carl_tools.h"
14 #include "weak_formulations.h"
16 
18 const bool MASTER_debug_coupling_assemble = false;
19 
20 namespace carl
21 {
22 
24 {
25 private:
26  // Private default constructor
28 
29 public:
30 
31  // Constructor
32  libMesh_fe_addresses_3(libMesh::System& input_system,
33  const std::string u_var_name = "u", const std::string v_var_name =
34  "v", const std::string w_var_name = "w") :
35  eq_system { input_system },
36  mesh { eq_system.get_mesh() },
37  dim { mesh.mesh_dimension() },
38  u_var { input_system.variable_number(u_var_name) },
39  v_var { input_system.variable_number(v_var_name) },
40  w_var { input_system.variable_number(w_var_name) },
41  dof_map { input_system.get_dof_map() },
42  fe_type { dof_map.variable_type(u_var) },
43  fe_unique_ptr { libMesh::FEBase::build(dim, fe_type) },
44  qrule { dim, fe_type.default_quadrature_order() },
45  n_dofs { 0 },
46  n_dofs_u { 0 },
47  n_dofs_v { 0 },
48  n_dofs_w { 0 }
49 
50  {
51  fe_unique_ptr->attach_quadrature_rule(&qrule);
52  };
53 
54  // Members set at initialization
55  libMesh::System& eq_system;
56  const libMesh::MeshBase& mesh;
57  const unsigned int dim;
58  const unsigned int u_var;
59  const unsigned int v_var;
60  const unsigned int w_var;
61  const libMesh::DofMap& dof_map;
62  libMesh::FEType fe_type;
63  libMesh::UniquePtr<libMesh::FEBase> fe_unique_ptr;
64  libMesh::QGauss qrule;
65  const libMesh::Elem* elem;
66 
67  // Members set with the set_dofs method
68  std::vector<libMesh::dof_id_type> dof_indices;
69  std::vector<libMesh::dof_id_type> dof_indices_u;
70  std::vector<libMesh::dof_id_type> dof_indices_v;
71  std::vector<libMesh::dof_id_type> dof_indices_w;
72 
73  unsigned int n_dofs;
74  unsigned int n_dofs_u;
75  unsigned int n_dofs_v;
76  unsigned int n_dofs_w;
77 
78  void set_DoFs(int idx = 0)
79  {
80  const libMesh::Elem* elem_dummy = mesh.elem(idx);
81  elem = mesh.elem(idx);
82  dof_map.dof_indices(elem_dummy, dof_indices);
83  dof_map.dof_indices(elem_dummy, dof_indices_u, u_var);
84  dof_map.dof_indices(elem_dummy, dof_indices_v, v_var);
85  dof_map.dof_indices(elem_dummy, dof_indices_w, w_var);
86  n_dofs = dof_indices.size();
87  n_dofs_u = dof_indices_u.size();
88  n_dofs_v = dof_indices_v.size();
89  n_dofs_w = dof_indices_w.size();
90  };
91 };
92 
94 {
95 public:
96  libMesh::DenseMatrix<libMesh::Number> Me;
97  libMesh::DenseSubMatrix<libMesh::Number> Me_uu, Me_uv, Me_uw, Me_vu, Me_vv,
99 
101  Me_uu
102  { Me }, Me_uv
103  { Me }, Me_uw
104  { Me }, Me_vu
105  { Me }, Me_vv
106  { Me }, Me_vw
107  { Me }, Me_wu
108  { Me }, Me_wv
109  { Me }, Me_ww
110  { Me }
111  {
112 
113  }
114 
115  void set_matrices(libMesh_fe_addresses_3& system_type_AAA,
116  libMesh_fe_addresses_3& system_type_BBB)
117  {
118  Me.resize(system_type_AAA.n_dofs, system_type_BBB.n_dofs);
119 
120  Me_uu.reposition(system_type_AAA.u_var * system_type_AAA.n_dofs_u,
121  system_type_BBB.u_var * system_type_BBB.n_dofs_u,
122  system_type_AAA.n_dofs_u, system_type_BBB.n_dofs_u);
123 
124  Me_uv.reposition(system_type_AAA.u_var * system_type_AAA.n_dofs_u,
125  system_type_BBB.v_var * system_type_BBB.n_dofs_v,
126  system_type_AAA.n_dofs_u, system_type_BBB.n_dofs_v);
127 
128  Me_uw.reposition(system_type_AAA.u_var * system_type_AAA.n_dofs_u,
129  system_type_BBB.w_var * system_type_BBB.n_dofs_w,
130  system_type_AAA.n_dofs_u, system_type_BBB.n_dofs_w);
131 
132  Me_vu.reposition(system_type_AAA.v_var * system_type_AAA.n_dofs_v,
133  system_type_BBB.u_var * system_type_BBB.n_dofs_u,
134  system_type_AAA.n_dofs_v, system_type_BBB.n_dofs_u);
135 
136  Me_vv.reposition(system_type_AAA.v_var * system_type_AAA.n_dofs_v,
137  system_type_BBB.v_var * system_type_BBB.n_dofs_v,
138  system_type_AAA.n_dofs_v, system_type_BBB.n_dofs_v);
139 
140  Me_vw.reposition(system_type_AAA.v_var * system_type_AAA.n_dofs_v,
141  system_type_BBB.w_var * system_type_BBB.n_dofs_w,
142  system_type_AAA.n_dofs_v, system_type_BBB.n_dofs_w);
143 
144  Me_wu.reposition(system_type_AAA.w_var * system_type_AAA.n_dofs_w,
145  system_type_BBB.u_var * system_type_BBB.n_dofs_u,
146  system_type_AAA.n_dofs_w, system_type_BBB.n_dofs_u);
147 
148  Me_wv.reposition(system_type_AAA.w_var * system_type_AAA.n_dofs_w,
149  system_type_BBB.v_var * system_type_BBB.n_dofs_v,
150  system_type_AAA.n_dofs_w, system_type_BBB.n_dofs_v);
151 
152  Me_ww.reposition(system_type_AAA.w_var * system_type_AAA.n_dofs_w,
153  system_type_BBB.w_var * system_type_BBB.n_dofs_w,
154  system_type_AAA.n_dofs_w, system_type_BBB.n_dofs_w);
155  }
156 
158  const libMesh_fe_addresses_3& system_type_BBB, int qp,
159  const std::vector<std::vector<libMesh::Real> >& corrected_phi_AAA,
160  const std::vector<std::vector<libMesh::Real> >& corrected_phi_BBB,
161  const std::vector<libMesh::Real>& JxW, double L2_coupling_const)
162  {
163  L2_Coupling(Me_uu, qp, corrected_phi_AAA, corrected_phi_BBB,
164  system_type_AAA.n_dofs_u, system_type_BBB.n_dofs_u, JxW,
165  L2_coupling_const);
166 
167  L2_Coupling(Me_vv, qp, corrected_phi_AAA, corrected_phi_BBB,
168  system_type_AAA.n_dofs_v, system_type_BBB.n_dofs_v, JxW,
169  L2_coupling_const);
170 
171  L2_Coupling(Me_ww, qp, corrected_phi_AAA, corrected_phi_BBB,
172  system_type_AAA.n_dofs_w, system_type_BBB.n_dofs_w, JxW,
173  L2_coupling_const);
174  }
175 
176  void add_H1_coupling_matrix(const libMesh_fe_addresses_3& system_type_AAA,
177  const libMesh_fe_addresses_3& system_type_BBB, int qp,
178  const std::vector<std::vector<libMesh::RealGradient> >& corrected_dphi_sysAAA,
179  const std::vector<std::vector<libMesh::RealGradient> >& corrected_dphi_sysBBB,
180  const std::vector<libMesh::Real>& JxW,
181  const libMesh::Number H1_coupling_const)
182  {
183  unsigned int n_components = 3;
184  H1_Coupling_Extra_Term(Me_uu, qp, system_type_AAA.u_var,
185  system_type_BBB.u_var, n_components, n_components,
186  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
187  system_type_AAA.n_dofs_u, system_type_BBB.n_dofs_u, JxW,
188  H1_coupling_const);
189 
190  H1_Coupling_Extra_Term(Me_uv, qp, system_type_AAA.u_var,
191  system_type_BBB.v_var, n_components, n_components,
192  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
193  system_type_AAA.n_dofs_u, system_type_BBB.n_dofs_v, JxW,
194  H1_coupling_const);
195 
196  H1_Coupling_Extra_Term(Me_uw, qp, system_type_AAA.u_var,
197  system_type_BBB.w_var, n_components, n_components,
198  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
199  system_type_AAA.n_dofs_u, system_type_BBB.n_dofs_w, JxW,
200  H1_coupling_const);
201 
202  H1_Coupling_Extra_Term(Me_vu, qp, system_type_AAA.v_var,
203  system_type_BBB.u_var, n_components, n_components,
204  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
205  system_type_AAA.n_dofs_v, system_type_BBB.n_dofs_u, JxW,
206  H1_coupling_const);
207 
208  H1_Coupling_Extra_Term(Me_vv, qp, system_type_AAA.v_var,
209  system_type_BBB.v_var, n_components, n_components,
210  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
211  system_type_AAA.n_dofs_v, system_type_BBB.n_dofs_v, JxW,
212  H1_coupling_const);
213 
214  H1_Coupling_Extra_Term(Me_vw, qp, system_type_AAA.v_var,
215  system_type_BBB.w_var, n_components, n_components,
216  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
217  system_type_AAA.n_dofs_v, system_type_BBB.n_dofs_w, JxW,
218  H1_coupling_const);
219 
220  H1_Coupling_Extra_Term(Me_wu, qp, system_type_AAA.w_var,
221  system_type_BBB.u_var, n_components, n_components,
222  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
223  system_type_AAA.n_dofs_w, system_type_BBB.n_dofs_u, JxW,
224  H1_coupling_const);
225 
226  H1_Coupling_Extra_Term(Me_wv, qp, system_type_AAA.w_var,
227  system_type_BBB.v_var, n_components, n_components,
228  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
229  system_type_AAA.n_dofs_w, system_type_BBB.n_dofs_v, JxW,
230  H1_coupling_const);
231 
232  H1_Coupling_Extra_Term(Me_ww, qp, system_type_AAA.w_var,
233  system_type_BBB.w_var, n_components, n_components,
234  corrected_dphi_sysAAA, corrected_dphi_sysBBB,
235  system_type_AAA.n_dofs_w, system_type_BBB.n_dofs_w, JxW,
236  H1_coupling_const);
237  }
238  ;
239 
240  void zero()
241  {
242  Me.zero();
243  }
244 };
245 
247 {
248 protected:
249  // Members
250 
251  // Communicator
252  const libMesh::Parallel::Communicator * m_comm;
253 
254  // -> Equation system maps
255  std::pair<std::string, libMesh::EquationSystems*> m_BIG_EquationSystem;
256  std::pair<std::string, libMesh::EquationSystems*> m_R_BIG_EquationSystem;
257 
258  std::map<std::string, libMesh::EquationSystems*> m_micro_EquationSystemMap;
259  std::map<std::string, libMesh::EquationSystems*> m_R_micro_EquationSystemMap;
260 
261  std::map<std::string, libMesh::EquationSystems*> m_inter_EquationSystemMap;
262  std::map<std::string, libMesh::EquationSystems*> m_mediator_EquationSystemMap;
263 
264  // -> Matrix maps
265  std::map<std::string, libMesh::PetscMatrix<libMesh::Number>*> m_couplingMatrixMap_mediator_micro;
266  std::map<std::string, libMesh::PetscMatrix<libMesh::Number>*> m_couplingMatrixMap_mediator_BIG;
267  std::map<std::string, libMesh::PetscMatrix<libMesh::Number>*> m_couplingMatrixMap_mediator_mediator;
268 
269  // -> Bools for assembly of the system
270  std::map<std::string, bool> m_bUseH1Coupling;
271  std::map<std::string, bool> m_bHasAssembled_micro;
275 
276  // -> Coupling constant maps
277  std::map<std::string, double> m_coupling_rigidityMap;
278  std::map<std::string, double> m_coupling_widthMap;
279 
280  // -> Typedefs of the destructor iterators
281  typedef std::map<std::string, libMesh::EquationSystems*>::iterator EqSystem_iterator;
282  typedef std::map<std::string, libMesh::PetscMatrix<libMesh::Number>*>::iterator Matrix_iterator;
283  typedef std::map<std::string, libMesh::PetscVector<libMesh::Number>*>::iterator Vector_iterator;
284 
285 private:
287 
288 public:
289  // Members
290 
291  // Constructors
292  assemble_coupling_matrices(const libMesh::Parallel::Communicator& comm) :
293  m_comm { &comm },
294  m_bHasAssembled_BIG { false },
295  m_bHasDefinedMeshRestrictions { false }
296  {
297  };
298 
299  // Destructor
301  {
302  this->clear();
303  }
304 
305  void clear();
306 
307  // Methods implemented in assemble_coupling.cpp
308  // -> Adding BIG / micro / inter /mediator systems
309  libMesh::EquationSystems& set_BIG_EquationSystem(const std::string& name,
310  libMesh::MeshBase& BIGMesh);
311 
312  libMesh::EquationSystems& set_Restricted_BIG_EquationSystem(const std::string& name,
313  libMesh::MeshBase& R_BIGMesh);
314 
315  template<typename libMesh_MatrixType>
316  libMesh::EquationSystems& add_micro_EquationSystem(const std::string& name,
317  libMesh::MeshBase& microMesh)
318  {
319  libMesh::EquationSystems* EqSystemPtr = NULL;
320  libMesh::PetscMatrix<libMesh::Number>* Matrix_mediator_micro_Ptr = NULL;
321  libMesh::PetscMatrix<libMesh::Number>* Matrix_mediator_BIG_Ptr = NULL;
322  libMesh::PetscMatrix<libMesh::Number>* Matrix_mediator_mediator_Ptr =
323  NULL;
324 
325  if (!m_micro_EquationSystemMap.count(name))
326  {
327  // Then add a new system
328  EqSystemPtr = new libMesh::EquationSystems(microMesh);
329 
330  Matrix_mediator_micro_Ptr = new libMesh_MatrixType(
331  microMesh.comm());
332  Matrix_mediator_BIG_Ptr = new libMesh_MatrixType(microMesh.comm());
333  Matrix_mediator_mediator_Ptr = new libMesh_MatrixType(
334  microMesh.comm());
335 
336  m_micro_EquationSystemMap.insert(std::make_pair(name, EqSystemPtr));
337  m_couplingMatrixMap_mediator_micro.insert(
338  std::make_pair(name, Matrix_mediator_micro_Ptr));
339 
340  m_couplingMatrixMap_mediator_BIG.insert(
341  std::make_pair(name, Matrix_mediator_BIG_Ptr));
342 
343  m_couplingMatrixMap_mediator_mediator.insert(
344  std::make_pair(name, Matrix_mediator_mediator_Ptr));
345 
346  m_bHasAssembled_micro.insert(std::make_pair(name, false));
347  m_bUseH1Coupling.insert(std::make_pair(name, false));
348  }
349  else
350  {
351  // System already exits, return the system pointer
352  std::cerr << " *** Warning: micro system " << name
353  << " already exists!" << std::endl;
354  EqSystemPtr = m_micro_EquationSystemMap[name];
355  }
356 
357  return *EqSystemPtr;
358  }
359 
360  libMesh::EquationSystems& add_Restricted_micro_EquationSystem(const std::string& name,
361  libMesh::MeshBase& R_microMesh);
362 
363  libMesh::EquationSystems& add_inter_EquationSystem(const std::string& name,
364  libMesh::MeshBase& interMesh);
365 
366  libMesh::EquationSystems& add_mediator_EquationSystem(
367  const std::string& name, libMesh::MeshBase& mediatorMesh);
368 
370  void set_coupling_parameters(const std::string& name,
371  double coupling_rigidity, double coupling_width);
372 
374  const std::vector<std::vector<libMesh::Real> >& lambda_weights,
375  const std::vector<std::vector<libMesh::Real> >& phi_inter,
376  std::vector<std::vector<libMesh::Real> >& phi_corrected);
377 
379  const std::vector<std::vector<libMesh::Real> >& lambda_weights,
380  const std::vector<std::vector<libMesh::RealGradient> >& phi_inter,
381  std::vector<std::vector<libMesh::RealGradient> >& phi_corrected);
382 
383  void get_lambdas(const unsigned int dim, const libMesh::FEType& fe_t,
384  const libMesh::Elem* base_elem,
385  const std::vector<libMesh::Point>& phys_points,
386  std::vector<libMesh::Point>& ref_points,
387  std::vector<std::vector<libMesh::Real> >& lambda_weights);
388 
389  libMesh::PetscMatrix<libMesh::Number>& get_micro_coupling_matrix(
390  const std::string& name);
391 
392  libMesh::PetscMatrix<libMesh::Number>& get_BIG_coupling_matrix(
393  const std::string& name);
394 
395  libMesh::PetscMatrix<libMesh::Number>& get_mediator_coupling_matrix(
396  const std::string& name);
397 
398  void print_matrix_micro_info(const std::string& name);
399 
400  void print_matrix_BIG_info(const std::string& name);
401 
402  void print_matrix_mediator_info(const std::string& name);
403 
404  void print_matrices_matlab(const std::string& name,
405  const std::string& outputRoot = "coupling");
406 
407  void print_PETSC_matrices(const std::string& name, const std::string& outputRoot = "coupling");
408  void use_H1_coupling(std::string name);
409 
410  void use_L2_coupling(std::string name);
411 
412  // Methods implemented in assemble_functions_coupling.cpp
414  libMesh::PetscMatrix<libMesh::Number>& coupling_matrix,
415  libMesh_fe_addresses_3& row_addresses,
416  libMesh_fe_addresses_3& col_addresses,
417  const std::unordered_multimap<int,int>& inter_table
418  );
419 
421  const std::string BIG_name,
422  const std::string micro_name,
423  const std::string inter_name,
424  const std::string mediator_name,
425 
426  const libMesh::MeshBase& mesh_R_BIG,
427  const libMesh::MeshBase& mesh_R_micro,
428 
429  const std::unordered_map<int,std::pair<int,int> >&
430  full_intersection_pairs_map,
431  const std::unordered_map<int,std::pair<int,int> >&
432  full_intersection_restricted_pairs_map,
433  const std::unordered_map<int,int>&
434  local_intersection_meshI_to_inter_map,
435  const std::unordered_multimap<int,int>& inter_table_mediator_BIG,
436  const std::unordered_multimap<int,int>& inter_table_mediator_micro,
437  const std::string BIG_type = "Elasticity",
438  const std::string micro_type = "Elasticity",
439  bool bSameElemsType = true);
440 
442  const std::string BIG_name,
443  const std::string micro_name,
444  const std::string inter_name,
445  const std::string mediator_name,
446 
447  const libMesh::MeshBase& mesh_R_BIG,
448  const libMesh::MeshBase& mesh_R_micro,
449 
450  const std::unordered_map<int,std::pair<int,int> >&
451  full_intersection_pairs_map,
452  const std::unordered_map<int,std::pair<int,int> >&
453  full_intersection_restricted_pairs_map,
454  const std::unordered_map<int,int>&
455  local_intersection_meshI_to_inter_map,
456  const std::unordered_multimap<int,int>& inter_table_mediator_BIG,
457  const std::unordered_multimap<int,int>& inter_table_mediator_micro,
458  const std::string BIG_type = "Elasticity",
459  const std::string micro_type = "Elasticity",
460  bool bSameElemsType = true);
461 };
462 };
463 
464 #endif /* ASSEMBLE_COUPLING_H_ */
libMesh::PetscMatrix< libMesh::Number > & get_BIG_coupling_matrix(const std::string &name)
void check_coupling_construction_3D_parallel(const std::string BIG_name, const std::string micro_name, const std::string inter_name, const std::string mediator_name, const libMesh::MeshBase &mesh_R_BIG, const libMesh::MeshBase &mesh_R_micro, const std::unordered_map< int, std::pair< int, int > > &full_intersection_pairs_map, const std::unordered_map< int, std::pair< int, int > > &full_intersection_restricted_pairs_map, const std::unordered_map< int, int > &local_intersection_meshI_to_inter_map, const std::unordered_multimap< int, int > &inter_table_mediator_BIG, const std::unordered_multimap< int, int > &inter_table_mediator_micro, const std::string BIG_type="Elasticity", const std::string micro_type="Elasticity", bool bSameElemsType=true)
void add_H1_coupling_matrix(const libMesh_fe_addresses_3 &system_type_AAA, const libMesh_fe_addresses_3 &system_type_BBB, int qp, const std::vector< std::vector< libMesh::RealGradient > > &corrected_dphi_sysAAA, const std::vector< std::vector< libMesh::RealGradient > > &corrected_dphi_sysBBB, const std::vector< libMesh::Real > &JxW, const libMesh::Number H1_coupling_const)
libMesh::DenseSubMatrix< libMesh::Number > Me_uv
libMesh::EquationSystems & set_BIG_EquationSystem(const std::string &name, libMesh::MeshBase &BIGMesh)
const libMesh::Parallel::Communicator * m_comm
void get_lambdas(const unsigned int dim, const libMesh::FEType &fe_t, const libMesh::Elem *base_elem, const std::vector< libMesh::Point > &phys_points, std::vector< libMesh::Point > &ref_points, std::vector< std::vector< libMesh::Real > > &lambda_weights)
libMesh_fe_addresses_3(libMesh::System &input_system, const std::string u_var_name="u", const std::string v_var_name="v", const std::string w_var_name="w")
std::map< std::string, libMesh::EquationSystems * > m_mediator_EquationSystemMap
const bool MASTER_debug_coupling_assemble
std::pair< std::string, libMesh::EquationSystems * > m_BIG_EquationSystem
libMesh::DenseSubMatrix< libMesh::Number > Me_uw
std::vector< libMesh::dof_id_type > dof_indices_v
void set_matrices(libMesh_fe_addresses_3 &system_type_AAA, libMesh_fe_addresses_3 &system_type_BBB)
libMesh::DenseSubMatrix< libMesh::Number > Me_vw
void print_matrix_BIG_info(const std::string &name)
std::map< std::string, double > m_coupling_widthMap
const libMesh::DofMap & dof_map
std::map< std::string, double > m_coupling_rigidityMap
std::map< std::string, libMesh::EquationSystems * > m_inter_EquationSystemMap
std::map< std::string, libMesh::EquationSystems * > m_R_micro_EquationSystemMap
void set_corrected_shape_gradients(const std::vector< std::vector< libMesh::Real > > &lambda_weights, const std::vector< std::vector< libMesh::RealGradient > > &phi_inter, std::vector< std::vector< libMesh::RealGradient > > &phi_corrected)
void print_matrix_micro_info(const std::string &name)
libMesh::EquationSystems & add_inter_EquationSystem(const std::string &name, libMesh::MeshBase &interMesh)
std::map< std::string, libMesh::EquationSystems * > m_micro_EquationSystemMap
libMesh::DenseSubMatrix< libMesh::Number > Me_wu
libMesh::DenseSubMatrix< libMesh::Number > Me_uu
std::map< std::string, libMesh::EquationSystems * >::iterator EqSystem_iterator
std::map< std::string, libMesh::PetscMatrix< libMesh::Number > * >::iterator Matrix_iterator
libMesh::DenseSubMatrix< libMesh::Number > Me_ww
libMesh::EquationSystems & add_micro_EquationSystem(const std::string &name, libMesh::MeshBase &microMesh)
void assemble_coupling_elasticity_3D_parallel(const std::string BIG_name, const std::string micro_name, const std::string inter_name, const std::string mediator_name, const libMesh::MeshBase &mesh_R_BIG, const libMesh::MeshBase &mesh_R_micro, const std::unordered_map< int, std::pair< int, int > > &full_intersection_pairs_map, const std::unordered_map< int, std::pair< int, int > > &full_intersection_restricted_pairs_map, const std::unordered_map< int, int > &local_intersection_meshI_to_inter_map, const std::unordered_multimap< int, int > &inter_table_mediator_BIG, const std::unordered_multimap< int, int > &inter_table_mediator_micro, const std::string BIG_type="Elasticity", const std::string micro_type="Elasticity", bool bSameElemsType=true)
void use_H1_coupling(std::string name)
void print_matrix_mediator_info(const std::string &name)
libMesh::DenseSubMatrix< libMesh::Number > Me_vu
libMesh::PetscMatrix< libMesh::Number > & get_mediator_coupling_matrix(const std::string &name)
const libMesh::MeshBase & mesh
std::pair< std::string, libMesh::EquationSystems * > m_R_BIG_EquationSystem
void set_coupling_parameters(const std::string &name, double coupling_rigidity, double coupling_width)
Set physical parameters.
libMesh::DenseSubMatrix< libMesh::Number > Me_wv
libMesh::DenseMatrix< libMesh::Number > Me
const bool MASTER_bPerfLog_assemble_coupling
std::map< std::string, bool > m_bHasAssembled_micro
void H1_Coupling_Extra_Term(libMesh::DenseSubMatrix< libMesh::Number > &Coupl, unsigned int qp, unsigned int C_i, unsigned int C_k, unsigned int n_components_A, unsigned int n_components_B, const std::vector< std::vector< libMesh::RealGradient > > &dphi_sysA, const std::vector< std::vector< libMesh::RealGradient > > &dphi_sysB, const unsigned int n_dofs_sysA, const unsigned int n_dofs_sysB, const std::vector< libMesh::Real > &JxW, const libMesh::Number cte)
assemble_coupling_matrices(const libMesh::Parallel::Communicator &comm)
std::map< std::string, bool > m_bUseH1Coupling
void build_L2_coupling_matrix(const libMesh_fe_addresses_3 &system_type_AAA, const libMesh_fe_addresses_3 &system_type_BBB, int qp, const std::vector< std::vector< libMesh::Real > > &corrected_phi_AAA, const std::vector< std::vector< libMesh::Real > > &corrected_phi_BBB, const std::vector< libMesh::Real > &JxW, double L2_coupling_const)
libMesh::PetscMatrix< libMesh::Number > & get_micro_coupling_matrix(const std::string &name)
std::map< std::string, libMesh::PetscVector< libMesh::Number > * >::iterator Vector_iterator
std::vector< libMesh::dof_id_type > dof_indices
libMesh::DenseSubMatrix< libMesh::Number > Me_vv
void print_matrices_matlab(const std::string &name, const std::string &outputRoot="coupling")
void L2_Coupling(libMesh::DenseMatrix< libMesh::Number > &Coupl, unsigned int qp, const std::vector< std::vector< libMesh::Real > > &phi_sysA, const std::vector< std::vector< libMesh::Real > > &phi_sysB, const unsigned int n_dofs_sysA, const unsigned int n_dofs_sysB, const std::vector< libMesh::Real > &JxW, const libMesh::Number cte)
std::map< std::string, libMesh::PetscMatrix< libMesh::Number > * > m_couplingMatrixMap_mediator_mediator
std::map< std::string, libMesh::PetscMatrix< libMesh::Number > * > m_couplingMatrixMap_mediator_BIG
void set_corrected_shapes(const std::vector< std::vector< libMesh::Real > > &lambda_weights, const std::vector< std::vector< libMesh::Real > > &phi_inter, std::vector< std::vector< libMesh::Real > > &phi_corrected)
void print_PETSC_matrices(const std::string &name, const std::string &outputRoot="coupling")
std::map< std::string, libMesh::PetscMatrix< libMesh::Number > * > m_couplingMatrixMap_mediator_micro
void prepare_coupling_preallocation(libMesh::PetscMatrix< libMesh::Number > &coupling_matrix, libMesh_fe_addresses_3 &row_addresses, libMesh_fe_addresses_3 &col_addresses, const std::unordered_multimap< int, int > &inter_table)
std::vector< libMesh::dof_id_type > dof_indices_w
void use_L2_coupling(std::string name)
std::vector< libMesh::dof_id_type > dof_indices_u
libMesh::EquationSystems & add_mediator_EquationSystem(const std::string &name, libMesh::MeshBase &mediatorMesh)
libMesh::EquationSystems & set_Restricted_BIG_EquationSystem(const std::string &name, libMesh::MeshBase &R_BIGMesh)
libMesh::EquationSystems & add_Restricted_micro_EquationSystem(const std::string &name, libMesh::MeshBase &R_microMesh)
const libMesh::Elem * elem
libMesh::UniquePtr< libMesh::FEBase > fe_unique_ptr