DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
|
This class generates and stores adaptive finite element meshes for the real-space dft problem. More...
#include <triangulationManager.h>
Public Member Functions | |
triangulationManager (const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const MPI_Comm &interpoolcomm, const MPI_Comm &interBandGroupComm, const unsigned int FEOrder, const dftParameters &dftParams) | |
Constructor. | |
~triangulationManager () | |
void | generateSerialUnmovedAndParallelMovedUnmovedMesh (const std::vector< std::vector< double > > &atomLocations, const std::vector< std::vector< double > > &imageAtomLocations, const std::vector< int > &imageIds, const std::vector< double > &nearestAtomDistances, const std::vector< std::vector< double > > &domainBoundingVectors, const bool generateSerialTria) |
generates parallel moved and unmoved meshes, and serial unmoved mesh. | |
void | generateCoarseMeshesForRestart (const std::vector< std::vector< double > > &atomLocations, const std::vector< std::vector< double > > &imageAtomLocations, const std::vector< int > &imageIds, const std::vector< double > &nearestAtomDistances, const std::vector< std::vector< double > > &domainBoundingVectors, const bool generateSerialTria) |
generates the coarse meshes for restart. | |
void | generateAutomaticMeshApriori (const dealii::DoFHandler< 3 > &dofHandler, dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation, const std::vector< distributedCPUVec< double > > &eigenVectorsArrayIn, const unsigned int FEOrder) |
returns generates A-posteriori refined mesh | |
dealii::parallel::distributed::Triangulation< 3 > & | getSerialMeshUnmoved () |
returns constant reference to serial unmoved triangulation | |
dealii::parallel::distributed::Triangulation< 3 > & | getParallelMeshMoved () |
returns reference to parallel moved triangulation | |
dealii::parallel::distributed::Triangulation< 3 > & | getParallelMeshUnmoved () |
returns constant reference to parallel unmoved triangulation | |
void | resetMesh (dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulationA, dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulationB) |
resets the vertices of meshB moved to vertices of meshA. | |
void | generateResetMeshes (const std::vector< std::vector< double > > &domainBoundingVectors, const bool generateSerialTria) |
generates reset meshes to the last mesh generated by auto mesh approach. This is used in Gaussian update of meshes during electrostatics | |
void | saveTriangulationsSolutionVectors (std::string path, const unsigned int feOrder, const unsigned int nComponents, const std::vector< const distributedCPUVec< double > * > &solutionVectors, const MPI_Comm &interpoolComm, const MPI_Comm &interBandGroupComm) |
serialize the triangulations and the associated solution vectors | |
void | loadTriangulationsSolutionVectors (std::string path, const unsigned int feOrder, const unsigned int nComponents, std::vector< distributedCPUVec< double > * > &solutionVectors) |
de-serialize the triangulations and the associated solution vectors | |
void | generateMesh (dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation, dealii::parallel::distributed::Triangulation< 3 > &serialTriangulation, std::vector< std::vector< bool > > ¶llelTriaCurrentRefinement, std::vector< std::vector< bool > > &serialTriaCurrentRefinement, const bool generateSerialTria=false, const bool enableManualRepartitioning=false) |
internal function which generates a parallel and serial mesh using a adaptive refinement strategy. | |
Private Member Functions | |
void | generateCoarseMesh (dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation) |
internal function which generates a coarse mesh which is required for the load function call in restarts. | |
bool | refinementAlgorithmA (dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation, std::vector< unsigned int > &locallyOwnedCellsRefineFlags, std::map< dealii::CellId, unsigned int > &cellIdToCellRefineFlagMapLocal, const bool smoothenCellsOnPeriodicBoundary=false, const double smootheningFactor=2.0) |
internal function which sets refinement flags based on a custom created algorithm | |
bool | consistentPeriodicBoundaryRefinement (dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation, std::vector< unsigned int > &locallyOwnedCellsRefineFlags, std::map< dealii::CellId, unsigned int > &cellIdToCellRefineFlagMapLocal) |
internal function which sets refinement flags to have consistent refinement across periodic boundary | |
bool | checkPeriodicSurfaceRefinementConsistency (dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation) |
check that triangulation has consistent refinement across periodic boundary including for ghost cells | |
bool | checkConstraintsConsistency (dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation) |
check that FEOrder=1 dofHandler using the triangulation has parallel consistent combined hanging node and periodic constraints | |
void | refineSerialMesh (const std::map< dealii::CellId, unsigned int > &cellIdToCellRefineFlagMapLocal, const MPI_Comm &mpi_comm, dealii::parallel::distributed::Triangulation< 3 > &serialTriangulation, const dealii::parallel::distributed::Triangulation< 3 > ¶llelTriangulation, std::vector< bool > &serialTriaCurrentRefinement) |
internal function which refines the serial mesh based on refinement flags from parallel mesh. This ensures that we get the same mesh in serial and parallel. | |
void | saveSupportTriangulations (std::string path) |
internal function to serialize support triangulations. No solution data is attached to them | |
void | loadSupportTriangulations (std::string path) |
internal function to de-serialize support triangulations. No solution data is read from them | |
Private Attributes | |
dealii::parallel::distributed::Triangulation< 3 > | d_parallelTriangulationUnmoved |
dealii::parallel::distributed::Triangulation< 3 > | d_parallelTriangulationMoved |
dealii::parallel::distributed::Triangulation< 3 > | d_serialTriangulationUnmoved |
std::vector< std::vector< bool > > | d_parallelTriaCurrentRefinement |
std::vector< std::vector< bool > > | d_serialTriaCurrentRefinement |
std::vector< std::vector< double > > | d_atomPositions |
std::vector< std::vector< double > > | d_imageAtomPositions |
std::vector< std::vector< double > > | d_meshSizes |
std::vector< int > | d_imageIds |
std::vector< double > | d_nearestAtomDistances |
std::vector< std::vector< double > > | d_domainBoundingVectors |
const unsigned int | d_max_refinement_steps = 40 |
const unsigned int | d_FEOrder |
const dftParameters & | d_dftParams |
const MPI_Comm | d_mpiCommParent |
const MPI_Comm | mpi_communicator |
const MPI_Comm | interpoolcomm |
const MPI_Comm | interBandGroupComm |
const unsigned int | this_mpi_process |
const unsigned int | n_mpi_processes |
dealii::ConditionalOStream | pcout |
dealii::TimerOutput | computing_timer |
This class generates and stores adaptive finite element meshes for the real-space dft problem.
The class uses an adpative mesh generation strategy to generate finite element mesh for given domain based on five input parameters: BASE MESH SIZE, ATOM BALL RADIUS, MESH SIZE ATOM BALL, MESH SIZE NEAR ATOM and MAX REFINEMENT STEPS (Refer to utils/dftParameters.cc for their corresponding internal variable names). Additionaly, this class also applies periodicity to mesh. The class stores two types of meshes: moved and unmoved. They are essentially the same meshes, except that we move the nodes of the moved mesh (in the meshMovement class) such that the atoms lie on the nodes. However, once the mesh is moved, dealii has issues using that mesh for further refinement, which is why we also carry an unmoved triangulation.
dftfe::triangulationManager::triangulationManager | ( | const MPI_Comm & | mpi_comm_parent, |
const MPI_Comm & | mpi_comm_domain, | ||
const MPI_Comm & | interpoolcomm, | ||
const MPI_Comm & | interBandGroupComm, | ||
const unsigned int | FEOrder, | ||
const dftParameters & | dftParams ) |
Constructor.
mpi_comm_parent | parent mpi communicator |
mpi_comm_domain | domain decomposition mpi communicator |
interpool_comm | mpi interpool communicator over k points |
interBandGroupComm | mpi interpool communicator over band groups |
dftfe::triangulationManager::~triangulationManager | ( | ) |
triangulationManager destructor
|
private |
check that FEOrder=1 dofHandler using the triangulation has parallel consistent combined hanging node and periodic constraints
|
private |
check that triangulation has consistent refinement across periodic boundary including for ghost cells
|
private |
internal function which sets refinement flags to have consistent refinement across periodic boundary
void dftfe::triangulationManager::generateAutomaticMeshApriori | ( | const dealii::DoFHandler< 3 > & | dofHandler, |
dealii::parallel::distributed::Triangulation< 3 > & | parallelTriangulation, | ||
const std::vector< distributedCPUVec< double > > & | eigenVectorsArrayIn, | ||
const unsigned int | FEOrder ) |
returns generates A-posteriori refined mesh
dofHandler | corresponds to starting mesh which has to refined |
parallelTriangulation | corresponds to starting triangulation |
eigenVectorsArrayIn | solution vectors used to compute errors in each cell required for refinement |
FEOrder | finite-element interpolating polynomial |
|
private |
internal function which generates a coarse mesh which is required for the load function call in restarts.
void dftfe::triangulationManager::generateCoarseMeshesForRestart | ( | const std::vector< std::vector< double > > & | atomLocations, |
const std::vector< std::vector< double > > & | imageAtomLocations, | ||
const std::vector< int > & | imageIds, | ||
const std::vector< double > & | nearestAtomDistances, | ||
const std::vector< std::vector< double > > & | domainBoundingVectors, | ||
const bool | generateSerialTria ) |
generates the coarse meshes for restart.
atomLocations | vector containing cartesian coordinates at atoms with respect to origin (center of domain). |
imageAtomLocations | vector containing cartesian coordinates of image atoms with respect to origin. |
domainBoundingVectors | vector of domain bounding vectors (refer to description of input parameters. |
generateSerialMesh | bool to toggle to generation of serial tria |
void dftfe::triangulationManager::generateMesh | ( | dealii::parallel::distributed::Triangulation< 3 > & | parallelTriangulation, |
dealii::parallel::distributed::Triangulation< 3 > & | serialTriangulation, | ||
std::vector< std::vector< bool > > & | parallelTriaCurrentRefinement, | ||
std::vector< std::vector< bool > > & | serialTriaCurrentRefinement, | ||
const bool | generateSerialTria = false, | ||
const bool | enableManualRepartitioning = false ) |
internal function which generates a parallel and serial mesh using a adaptive refinement strategy.
void dftfe::triangulationManager::generateResetMeshes | ( | const std::vector< std::vector< double > > & | domainBoundingVectors, |
const bool | generateSerialTria ) |
generates reset meshes to the last mesh generated by auto mesh approach. This is used in Gaussian update of meshes during electrostatics
void dftfe::triangulationManager::generateSerialUnmovedAndParallelMovedUnmovedMesh | ( | const std::vector< std::vector< double > > & | atomLocations, |
const std::vector< std::vector< double > > & | imageAtomLocations, | ||
const std::vector< int > & | imageIds, | ||
const std::vector< double > & | nearestAtomDistances, | ||
const std::vector< std::vector< double > > & | domainBoundingVectors, | ||
const bool | generateSerialTria ) |
generates parallel moved and unmoved meshes, and serial unmoved mesh.
atomLocations | vector containing cartesian coordinates at atoms with respect to origin (center of domain). |
imageAtomLocations | vector containing cartesian coordinates of image atoms with respect to origin. |
domainBoundingVectors | vector of domain bounding vectors (refer to description of input parameters. |
generateSerialMesh | bool to toggle to generation of serial tria |
dealii::parallel::distributed::Triangulation< 3 > & dftfe::triangulationManager::getParallelMeshMoved | ( | ) |
returns reference to parallel moved triangulation
dealii::parallel::distributed::Triangulation< 3 > & dftfe::triangulationManager::getParallelMeshUnmoved | ( | ) |
returns constant reference to parallel unmoved triangulation
dealii::parallel::distributed::Triangulation< 3 > & dftfe::triangulationManager::getSerialMeshUnmoved | ( | ) |
returns constant reference to serial unmoved triangulation
|
private |
internal function to de-serialize support triangulations. No solution data is read from them
void dftfe::triangulationManager::loadTriangulationsSolutionVectors | ( | std::string | path, |
const unsigned int | feOrder, | ||
const unsigned int | nComponents, | ||
std::vector< distributedCPUVec< double > * > & | solutionVectors ) |
de-serialize the triangulations and the associated solution vectors
[input]feOrder | finite element polynomial order of the dofHandler on which solution vectors to be de-serialized are based upon |
[input]nComponents | number of components of the dofHandler on which solution vectors to be de-serialized are based upon |
[output]solutionVectors | vector of parallel distributed de-serialized solution vectors. The vector length must match the input vector length used in the call to saveTriangulationSolutionVectors |
|
private |
internal function which sets refinement flags based on a custom created algorithm
|
private |
internal function which refines the serial mesh based on refinement flags from parallel mesh. This ensures that we get the same mesh in serial and parallel.
void dftfe::triangulationManager::resetMesh | ( | dealii::parallel::distributed::Triangulation< 3 > & | parallelTriangulationA, |
dealii::parallel::distributed::Triangulation< 3 > & | parallelTriangulationB ) |
resets the vertices of meshB moved to vertices of meshA.
|
private |
internal function to serialize support triangulations. No solution data is attached to them
void dftfe::triangulationManager::saveTriangulationsSolutionVectors | ( | std::string | path, |
const unsigned int | feOrder, | ||
const unsigned int | nComponents, | ||
const std::vector< const distributedCPUVec< double > * > & | solutionVectors, | ||
const MPI_Comm & | interpoolComm, | ||
const MPI_Comm & | interBandGroupComm ) |
serialize the triangulations and the associated solution vectors
[input]feOrder | finite element polynomial order of the dofHandler on which solution vectors are based upon |
[input]nComponents | number of components of the dofHandler on which solution vectors are based upon |
[input]solutionVectors | vector of parallel distributed solution vectors to be serialized |
[input]interpoolComm | This communicator is used to ensure serialization happens only in k point pool |
[input]interBandGroupComm | This communicator to ensure serialization happens only in band group |
|
private |
|
private |
|
private |
|
private |
|
private |
FEOrder to be used for checking parallel consistency of periodic+hanging node constraints
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |