Skip to content

Commit

Permalink
Added a criteria based on quality of mesh to decide between autoMesh …
Browse files Browse the repository at this point in the history
…or gaussian movement. Also fixed a bug which pops after Gaussian movement immediately after AutoMesh. Extensive testing going on
  • Loading branch information
phanimotamarri committed Aug 15, 2019
1 parent 9e61929 commit 1f482a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions include/dft.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ namespace dftfe {
*/
triangulationManager d_mesh;

double d_autoMeshMaxJacobianRatio;

/// affine transformation object
meshMovementAffineTransform d_affineTransformMesh;

Expand Down
14 changes: 7 additions & 7 deletions src/dft/moveAtoms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ void dftClass<FEOrder>::updateAtomPositionsAndMoveMesh(const std::vector<Tensor<
else
init(0);

for (unsigned int iAtom=0;iAtom <numberGlobalAtoms; iAtom++)
d_dispClosestTriaVerticesToAtoms[iAtom]= 0.0;
//for (unsigned int iAtom=0;iAtom <numberGlobalAtoms; iAtom++)
//d_dispClosestTriaVerticesToAtoms[iAtom]= 0.0;

if (!dftParameters::reproducible_output)
pcout << "...Reinitialization end" << std::endl;
Expand Down Expand Up @@ -293,16 +293,16 @@ void dftClass<FEOrder>::updateAtomPositionsAndMoveMesh(const std::vector<Tensor<
pcout << "Auto remeshing and reinitialization of dft problem for new atom coordinates as max net displacement magnitude: "<<maxDispAtom<< " is greater than: "<< break1 << " Bohr..." << std::endl;
init(0);

for (unsigned int iAtom=0;iAtom <numberGlobalAtoms; iAtom++)
d_dispClosestTriaVerticesToAtoms[iAtom]=0;
//for (unsigned int iAtom=0;iAtom <numberGlobalAtoms; iAtom++)
//d_dispClosestTriaVerticesToAtoms[iAtom]=0;
pcout << "...Reinitialization end" << std::endl;
}
else
{
pcout << "Trying to Move using Gaussian with same Gaussian constant for computing the forces: "<<forcePtr->getGaussianGeneratorParameter()<<" as max displacement magnitude: "<< maxDispAtom<< " is below " << break1 <<" Bohr"<<std::endl;
const std::pair<bool,double> meshQualityMetrics=gaussianMove.moveMesh(controlPointLocations,controlPointDisplacements,forcePtr->getGaussianGeneratorParameter());
unsigned int autoMesh=0;
if (meshQualityMetrics.first || meshQualityMetrics.second>maxJacobianRatio)
if (meshQualityMetrics.first || meshQualityMetrics.second>1.2*d_autoMeshMaxJacobianRatio)
autoMesh=1;
MPI_Bcast(&(autoMesh),
1,
Expand All @@ -317,8 +317,8 @@ void dftClass<FEOrder>::updateAtomPositionsAndMoveMesh(const std::vector<Tensor<
pcout<< " Auto remeshing and reinitialization of dft problem for new atom coordinates due to maximum jacobian ratio: "<< meshQualityMetrics.second<< " exceeding set bound of: "<< maxJacobianRatio<<" after Gaussian mesh movement using Gaussian constant: "<< forcePtr->getGaussianGeneratorParameter()<<std::endl;
init(0);

for (unsigned int iAtom=0;iAtom <numberGlobalAtoms; iAtom++)
d_dispClosestTriaVerticesToAtoms[iAtom]=0;
//for (unsigned int iAtom=0;iAtom <numberGlobalAtoms; iAtom++)
//d_dispClosestTriaVerticesToAtoms[iAtom]=0;
pcout << "...Reinitialization end" << std::endl;
}
else
Expand Down
2 changes: 2 additions & 0 deletions src/dft/moveMeshToAtoms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ void dftClass<FEOrder>::moveMeshToAtoms(Triangulation<3,3> & triangulationMove,

AssertThrow(!meshQualityMetrics.first,ExcMessage("Negative jacobian created after moving closest nodes to atoms. Suggestion: increase refinement near atoms"));

d_autoMeshMaxJacobianRatio = meshQualityMetrics.second;

if (dftParameters::verbosity>=2)
pcout<< "Mesh quality check after mesh movement, maximum jacobian ratio: "<< meshQualityMetrics.second<<std::endl;
}
Expand Down

0 comments on commit 1f482a4

Please sign in to comment.