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
57 init(dealii::Triangulation<3, 3> &triangulation,
58 dealii::Triangulation<3, 3> &serialTriangulation,
59 const std::vector<std::vector<double>> &domainBoundingVectors);
60
61 /** @brief Re-initializes the required data-structures for a given triangulation
62 *
63 * @param[in] domainBoundingVectors current domain vectors of the domain
64 * corresponding to the triangulation object.
65 */
66 void
67 initMoved(const std::vector<std::vector<double>> &domainBoundingVectors);
68
69 /** @brief Finds the closest triangulation vertices to a given vector of position coordinates
70 *
71 * @param[in] destinationPoints vector of points in cartesian coordinates
72 * (origin at center of the domain) to which closest triangulation vertices
73 * are desired.
74 * @param[out] closestTriaVertexToDestPointsLocation vector of positions of
75 * the closest triangulation v vertices.
76 * @param[out] dispClosestTriaVerticesToDestPoints vector of displacements
77 * of the destinationPoints from the closest triangulation vertices.
78 */
79 void
81 const std::vector<dealii::Point<3>> &destinationPoints,
82 std::vector<dealii::Point<3>> &closestTriaVertexToDestPointsLocation,
83 std::vector<dealii::Tensor<1, 3, double>>
84 &dispClosestTriaVerticesToDestPoints);
85
86 protected:
87 /// Initializes the parallel layout of d_incrementalDisplacementParallel
88 void
90
91 /// Takes care of communicating the movement of triangulation vertices on
92 /// processor boundaries, and also takes care of hanging nodes and periodic
93 /// constraints
94 void
96
97 /// Function which updates the locally relevant triangulation vertices
98 void
100
101 /// Function which moves subdivided mesh
102 void
104
105 /// Performs periodic matching sanity check and returns the pair<if negative
106 /// jacobian, maximum inverse jacobian magnitude>
107 std::pair<bool, double>
109
110 // virtual void computeIncrement()=0;
111
112 /// vector of displacements of the triangulation vertices
113 // dealii::Vector<double> d_incrementalDisplacement;
115
117
118 // dealii based FE data structres
119 dealii::FESystem<3> FEMoveMesh;
120 dealii::DoFHandler<3> d_dofHandlerMoveMesh;
121 dealii::parallel::distributed::Triangulation<3> *d_triaPtr;
122 dealii::Triangulation<3, 3> *d_triaPtrSerial;
123 dealii::IndexSet d_locally_owned_dofs;
124 dealii::IndexSet d_locally_relevant_dofs;
125 dealii::AffineConstraints<double> d_constraintsMoveMesh;
126 std::vector<dealii::GridTools::PeriodicFacePair<
127 typename dealii::DoFHandler<3>::cell_iterator>>
129 std::vector<std::vector<double>> d_domainBoundingVectors;
130
132
133 // parallel objects
137 dealii::ConditionalOStream pcout;
138 };
139} // namespace dftfe
140#endif
Namespace which declares the input parameters and the functions to parse them from the input paramete...
Definition dftParameters.h:36
MPI_Comm mpi_communicator
Definition meshMovement.h:135
std::vector< std::vector< double > > d_domainBoundingVectors
Definition meshMovement.h:129
dealii::AffineConstraints< double > d_constraintsMoveMesh
Definition meshMovement.h:125
distributedCPUVec< double > d_incrementalDisplacement
vector of displacements of the triangulation vertices
Definition meshMovement.h:114
dealii::FESystem< 3 > FEMoveMesh
Definition meshMovement.h:119
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:124
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.
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:137
dealii::IndexSet d_locally_owned_dofs
Definition meshMovement.h:123
void moveSubdividedMesh()
Function which moves subdivided mesh.
std::vector< dealii::GridTools::PeriodicFacePair< typename dealii::DoFHandler< 3 >::cell_iterator > > d_periodicity_vector
Definition meshMovement.h:128
void initIncrementField()
Initializes the parallel layout of d_incrementalDisplacementParallel.
dealii::DoFHandler< 3 > d_dofHandlerMoveMesh
Definition meshMovement.h:120
virtual ~meshMovementClass()
Definition meshMovement.h:44
bool d_isParallelMesh
Definition meshMovement.h:116
const dftfe::uInt this_mpi_process
Definition meshMovement.h:136
dealii::parallel::distributed::Triangulation< 3 > * d_triaPtr
Definition meshMovement.h:121
MPI_Comm d_mpiCommParent
Definition meshMovement.h:134
const dftParameters & d_dftParams
Definition meshMovement.h:131
dealii::Triangulation< 3, 3 > * d_triaPtrSerial
Definition meshMovement.h:122
Definition pseudoPotentialToDftfeConverter.cc:34
dealii::LinearAlgebra::distributed::Vector< elem_type, dealii::MemorySpace::Host > distributedCPUVec
Definition headers.h:92
std::uint32_t uInt
Definition TypeConfig.h:10