DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
meshMovement.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17
18
19#ifndef meshMovement_H_
20#define meshMovement_H_
21#include "constants.h"
22#include "headers.h"
23#include "dftParameters.h"
24
25namespace dftfe
26{
27 /**
28 * @brief Base class to move triangulation vertices
29 *
30 * @author Sambit Das
31 */
33 {
34 public:
35 /** @brief Constructor
36 *
37 * @param[in] mpi_comm_parent parent mpi communicator
38 * @param[in] mpi_comm_domain mpi communicator for domain decomposition
39 */
40 meshMovementClass(const MPI_Comm & mpi_comm_parent,
41 const MPI_Comm & mpi_comm_domain,
42 const dftParameters &dftParams);
43
45 {}
46
47 /** @brief Initializes the required data-structures for a given triangulation
48 *
49 * @param[in] triangulation triangulation object whose nodes are to be
50 * moved
51 * @param[in] serial triangulation to create constraints from serial
52 * dofHandler (temporary fix)
53 * @param[in] domainBoundingVectors domain vectors of the domain
54 * corresponding to the triangulation object.
55 */
56 void init(dealii::Triangulation<3, 3> & triangulation,
57 dealii::Triangulation<3, 3> & serialTriangulation,
58 const std::vector<std::vector<double>> &domainBoundingVectors);
59
60 /** @brief Re-initializes the required data-structures for a given triangulation
61 *
62 * @param[in] domainBoundingVectors current domain vectors of the domain
63 * corresponding to the triangulation object.
64 */
65 void
66 initMoved(const std::vector<std::vector<double>> &domainBoundingVectors);
67
68 /** @brief Finds the closest triangulation vertices to a given vector of position coordinates
69 *
70 * @param[in] destinationPoints vector of points in cartesian coordinates
71 * (origin at center of the domain) to which closest triangulation vertices
72 * are desired.
73 * @param[out] closestTriaVertexToDestPointsLocation vector of positions of
74 * the closest triangulation v vertices.
75 * @param[out] dispClosestTriaVerticesToDestPoints vector of displacements
76 * of the destinationPoints from the closest triangulation vertices.
77 */
78 void
80 const std::vector<dealii::Point<3>> &destinationPoints,
81 std::vector<dealii::Point<3>> &closestTriaVertexToDestPointsLocation,
82 std::vector<dealii::Tensor<1, 3, double>>
83 &dispClosestTriaVerticesToDestPoints);
84
85 protected:
86 /// Initializes the parallel layout of d_incrementalDisplacementParallel
87 void
89
90 /// Takes care of communicating the movement of triangulation vertices on
91 /// processor boundaries, and also takes care of hanging nodes and periodic
92 /// constraints
93 void
95
96 /// Function which updates the locally relevant triangulation vertices
97 void
99
100 /// Function which moves subdivided mesh
101 void
103
104 /// Performs periodic matching sanity check and returns the pair<if negative
105 /// jacobian, maximum inverse jacobian magnitude>
106 std::pair<bool, double>
108
109 // virtual void computeIncrement()=0;
110
111 /// vector of displacements of the triangulation vertices
112 // dealii::Vector<double> d_incrementalDisplacement;
114
116
117 // dealii based FE data structres
118 dealii::FESystem<3> FEMoveMesh;
119 dealii::DoFHandler<3> d_dofHandlerMoveMesh;
120 dealii::parallel::distributed::Triangulation<3> *d_triaPtr;
121 dealii::Triangulation<3, 3> * d_triaPtrSerial;
122 dealii::IndexSet d_locally_owned_dofs;
123 dealii::IndexSet d_locally_relevant_dofs;
124 dealii::AffineConstraints<double> d_constraintsMoveMesh;
125 std::vector<dealii::GridTools::PeriodicFacePair<
126 typename dealii::DoFHandler<3>::cell_iterator>>
128 std::vector<std::vector<double>> d_domainBoundingVectors;
129
131
132 // parallel objects
135 const unsigned int this_mpi_process;
136 dealii::ConditionalOStream pcout;
137 };
138} // namespace dftfe
139#endif
Namespace which declares the input parameters and the functions to parse them from the input paramete...
Definition dftParameters.h:35
MPI_Comm mpi_communicator
Definition meshMovement.h:134
std::vector< std::vector< double > > d_domainBoundingVectors
Definition meshMovement.h:128
dealii::AffineConstraints< double > d_constraintsMoveMesh
Definition meshMovement.h:124
distributedCPUVec< double > d_incrementalDisplacement
vector of displacements of the triangulation vertices
Definition meshMovement.h:113
dealii::FESystem< 3 > FEMoveMesh
Definition meshMovement.h:118
meshMovementClass(const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const dftParameters &dftParams)
Constructor.
void initMoved(const std::vector< std::vector< double > > &domainBoundingVectors)
Re-initializes the required data-structures for a given triangulation.
dealii::IndexSet d_locally_relevant_dofs
Definition meshMovement.h:123
void findClosestVerticesToDestinationPoints(const std::vector< dealii::Point< 3 > > &destinationPoints, std::vector< dealii::Point< 3 > > &closestTriaVertexToDestPointsLocation, std::vector< dealii::Tensor< 1, 3, double > > &dispClosestTriaVerticesToDestPoints)
Finds the closest triangulation vertices to a given vector of position coordinates.
const unsigned int this_mpi_process
Definition meshMovement.h:135
void updateTriangulationVertices()
Function which updates the locally relevant triangulation vertices.
std::pair< bool, double > movedMeshCheck()
void init(dealii::Triangulation< 3, 3 > &triangulation, dealii::Triangulation< 3, 3 > &serialTriangulation, const std::vector< std::vector< double > > &domainBoundingVectors)
Initializes the required data-structures for a given triangulation.
dealii::ConditionalOStream pcout
Definition meshMovement.h:136
dealii::IndexSet d_locally_owned_dofs
Definition meshMovement.h:122
void moveSubdividedMesh()
Function which moves subdivided mesh.
std::vector< dealii::GridTools::PeriodicFacePair< typename dealii::DoFHandler< 3 >::cell_iterator > > d_periodicity_vector
Definition meshMovement.h:127
void initIncrementField()
Initializes the parallel layout of d_incrementalDisplacementParallel.
dealii::DoFHandler< 3 > d_dofHandlerMoveMesh
Definition meshMovement.h:119
virtual ~meshMovementClass()
Definition meshMovement.h:44
bool d_isParallelMesh
Definition meshMovement.h:115
dealii::parallel::distributed::Triangulation< 3 > * d_triaPtr
Definition meshMovement.h:120
MPI_Comm d_mpiCommParent
Definition meshMovement.h:133
const dftParameters & d_dftParams
Definition meshMovement.h:130
dealii::Triangulation< 3, 3 > * d_triaPtrSerial
Definition meshMovement.h:121
Definition pseudoPotentialToDftfeConverter.cc:34
dealii::LinearAlgebra::distributed::Vector< elem_type, dealii::MemorySpace::Host > distributedCPUVec
Definition headers.h:92