Skip to content

Commit

Permalink
Fixed: Mixed phase-field solver, assign zero dofs for second basis.
Browse files Browse the repository at this point in the history
Removed unused 1D version, no longer compile due to Dim::nf reference.
  • Loading branch information
kmokstad committed Sep 8, 2018
1 parent e077fd1 commit 562c624
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
21 changes: 21 additions & 0 deletions CahnHilliard.C
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ bool CahnHilliard::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
}


bool CahnHilliard::evalIntMx (LocalIntegral& elmInt, const MxFiniteElement& fe,
const Vec3& X) const
{
return this->evalInt(elmInt,fe,X);
}


bool CahnHilliard::evalBou (LocalIntegral& elmInt, const FiniteElement& fe,
const Vec3& X, const Vec3& normal) const
{
Expand Down Expand Up @@ -363,6 +370,12 @@ NormBase* CahnHilliard::getNormIntegrand (AnaSol* a) const
}


CahnHilliard4::CahnHilliard4 (unsigned short int n) : CahnHilliard(n)
{
scale2nd = 2.0;
}


bool CahnHilliard4::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
const Vec3& X) const
{
Expand Down Expand Up @@ -460,6 +473,14 @@ bool CahnHilliardNorm::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
}


bool CahnHilliardNorm::evalIntMx (LocalIntegral& elmInt,
const MxFiniteElement& fe,
const Vec3& X) const
{
return this->evalInt(elmInt,fe,X);
}


bool CahnHilliardNorm::finalizeElement (LocalIntegral& elmInt)
{
if (Lnorm == 0) return true;
Expand Down
18 changes: 17 additions & 1 deletion CahnHilliard.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ class CahnHilliard : public IntegrandBase
virtual bool evalInt(LocalIntegral& elmInt, const FiniteElement& fe,
const Vec3& X) const;

using IntegrandBase::evalIntMx;
//! \brief Evaluates the integrand at an interior point.
//! \param elmInt The local integral object to receive the contributions
//! \param[in] fe Mixed finite element data of current integration point
//! \param[in] X Cartesian coordinates of current integration point
virtual bool evalIntMx(LocalIntegral& elmInt, const MxFiniteElement& fe,
const Vec3& X) const;

using IntegrandBase::evalSol;
//! \brief Evaluates the secondary solution at a result point.
//! \param[out] s Array of solution field values at current point
Expand Down Expand Up @@ -156,7 +164,7 @@ class CahnHilliard4 : public CahnHilliard
{
public:
//! \brief The constructor forwards to the parent class constructor.
explicit CahnHilliard4(unsigned short int n) : CahnHilliard(n) { scale2nd = 2.0; }
explicit CahnHilliard4(unsigned short int n);
//! \brief Empty destructor.
virtual ~CahnHilliard4() {}

Expand Down Expand Up @@ -193,6 +201,14 @@ class CahnHilliardNorm : public NormBase
virtual bool evalInt(LocalIntegral& elmInt, const FiniteElement& fe,
const Vec3& X) const;

using NormBase::evalIntMx;
//! \brief Evaluates the integrand at an interior point.
//! \param elmInt The local integral object to receive the contributions
//! \param[in] fe Mixed finite element data of current integration point
//! \param[in] X Cartesian coordinates of current integration point
virtual bool evalIntMx(LocalIntegral& elmInt, const MxFiniteElement& fe,
const Vec3& X) const;

using NormBase::finalizeElement;
//! \brief Finalizes the element norms after the numerical integration.
//! \param elmInt The local integral object to receive the contributions
Expand Down
3 changes: 3 additions & 0 deletions SIMPhaseField.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ template<class Dim> class SIMPhaseField : public Dim
{
Dim::myHeading = "Cahn-Hilliard solver";
if (gridOwner && gridOwner->createFEMmodel())
{
Dim::nf.resize(gridOwner->getNoBasis(),0);
this->clonePatches(gridOwner->getFEModel(),gridOwner->getGlob2LocMap());
}

eps_d0 = refTol = 0.0;
vtfStep = irefine = 0;
Expand Down
7 changes: 2 additions & 5 deletions main_CahnHilliard.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//==============================================================================

#include "IFEM.h"
#include "SIM1D.h"
#include "SIM2D.h"
#include "SIM3D.h"
#include "SIMPhaseField.h"
Expand Down Expand Up @@ -82,8 +81,6 @@ int main (int argc, char** argv)
; // ignore the obsolete option
else if (!strcmp(argv[i],"-2D"))
ndim = 2;
else if (!strcmp(argv[i],"-1D"))
ndim = 1;
else if (!infile)
infile = argv[i];
else
Expand All @@ -93,7 +90,7 @@ int main (int argc, char** argv)
{
std::cout <<"usage: "<< argv[0]
<<" <inputfile> [-dense|-spr|-superlu[<nt>]|-samg|-petsc]\n"
<<" [-lag|-spec|-LR] [-1D|-2D] [-nGauss <n>]\n"
<<" [-lag|-spec|-LR] [-2D] [-nGauss <n>]\n"
<<" [-vtf <format> [-nviz <nviz>]"
<<" [-nu <nu>] [-nv <nv>] [-nw <nw>]] [-hdf5]"<< std::endl;
return 0;
Expand All @@ -107,5 +104,5 @@ int main (int argc, char** argv)
else if (ndim == 2)
return runSimulator<SIM2D>(infile);
else
return runSimulator<SIM1D>(infile);
return 1; // 1D no longer supported
}

0 comments on commit 562c624

Please sign in to comment.