Skip to content

Commit 562c624

Browse files
committed
Fixed: Mixed phase-field solver, assign zero dofs for second basis.
Removed unused 1D version, no longer compile due to Dim::nf reference.
1 parent e077fd1 commit 562c624

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

CahnHilliard.C

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,13 @@ bool CahnHilliard::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
305305
}
306306

307307

308+
bool CahnHilliard::evalIntMx (LocalIntegral& elmInt, const MxFiniteElement& fe,
309+
const Vec3& X) const
310+
{
311+
return this->evalInt(elmInt,fe,X);
312+
}
313+
314+
308315
bool CahnHilliard::evalBou (LocalIntegral& elmInt, const FiniteElement& fe,
309316
const Vec3& X, const Vec3& normal) const
310317
{
@@ -363,6 +370,12 @@ NormBase* CahnHilliard::getNormIntegrand (AnaSol* a) const
363370
}
364371

365372

373+
CahnHilliard4::CahnHilliard4 (unsigned short int n) : CahnHilliard(n)
374+
{
375+
scale2nd = 2.0;
376+
}
377+
378+
366379
bool CahnHilliard4::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
367380
const Vec3& X) const
368381
{
@@ -460,6 +473,14 @@ bool CahnHilliardNorm::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
460473
}
461474

462475

476+
bool CahnHilliardNorm::evalIntMx (LocalIntegral& elmInt,
477+
const MxFiniteElement& fe,
478+
const Vec3& X) const
479+
{
480+
return this->evalInt(elmInt,fe,X);
481+
}
482+
483+
463484
bool CahnHilliardNorm::finalizeElement (LocalIntegral& elmInt)
464485
{
465486
if (Lnorm == 0) return true;

CahnHilliard.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ class CahnHilliard : public IntegrandBase
6464
virtual bool evalInt(LocalIntegral& elmInt, const FiniteElement& fe,
6565
const Vec3& X) const;
6666

67+
using IntegrandBase::evalIntMx;
68+
//! \brief Evaluates the integrand at an interior point.
69+
//! \param elmInt The local integral object to receive the contributions
70+
//! \param[in] fe Mixed finite element data of current integration point
71+
//! \param[in] X Cartesian coordinates of current integration point
72+
virtual bool evalIntMx(LocalIntegral& elmInt, const MxFiniteElement& fe,
73+
const Vec3& X) const;
74+
6775
using IntegrandBase::evalSol;
6876
//! \brief Evaluates the secondary solution at a result point.
6977
//! \param[out] s Array of solution field values at current point
@@ -156,7 +164,7 @@ class CahnHilliard4 : public CahnHilliard
156164
{
157165
public:
158166
//! \brief The constructor forwards to the parent class constructor.
159-
explicit CahnHilliard4(unsigned short int n) : CahnHilliard(n) { scale2nd = 2.0; }
167+
explicit CahnHilliard4(unsigned short int n);
160168
//! \brief Empty destructor.
161169
virtual ~CahnHilliard4() {}
162170

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

204+
using NormBase::evalIntMx;
205+
//! \brief Evaluates the integrand at an interior point.
206+
//! \param elmInt The local integral object to receive the contributions
207+
//! \param[in] fe Mixed finite element data of current integration point
208+
//! \param[in] X Cartesian coordinates of current integration point
209+
virtual bool evalIntMx(LocalIntegral& elmInt, const MxFiniteElement& fe,
210+
const Vec3& X) const;
211+
196212
using NormBase::finalizeElement;
197213
//! \brief Finalizes the element norms after the numerical integration.
198214
//! \param elmInt The local integral object to receive the contributions

SIMPhaseField.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ template<class Dim> class SIMPhaseField : public Dim
5555
{
5656
Dim::myHeading = "Cahn-Hilliard solver";
5757
if (gridOwner && gridOwner->createFEMmodel())
58+
{
59+
Dim::nf.resize(gridOwner->getNoBasis(),0);
5860
this->clonePatches(gridOwner->getFEModel(),gridOwner->getGlob2LocMap());
61+
}
5962

6063
eps_d0 = refTol = 0.0;
6164
vtfStep = irefine = 0;

main_CahnHilliard.C

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//==============================================================================
1313

1414
#include "IFEM.h"
15-
#include "SIM1D.h"
1615
#include "SIM2D.h"
1716
#include "SIM3D.h"
1817
#include "SIMPhaseField.h"
@@ -82,8 +81,6 @@ int main (int argc, char** argv)
8281
; // ignore the obsolete option
8382
else if (!strcmp(argv[i],"-2D"))
8483
ndim = 2;
85-
else if (!strcmp(argv[i],"-1D"))
86-
ndim = 1;
8784
else if (!infile)
8885
infile = argv[i];
8986
else
@@ -93,7 +90,7 @@ int main (int argc, char** argv)
9390
{
9491
std::cout <<"usage: "<< argv[0]
9592
<<" <inputfile> [-dense|-spr|-superlu[<nt>]|-samg|-petsc]\n"
96-
<<" [-lag|-spec|-LR] [-1D|-2D] [-nGauss <n>]\n"
93+
<<" [-lag|-spec|-LR] [-2D] [-nGauss <n>]\n"
9794
<<" [-vtf <format> [-nviz <nviz>]"
9895
<<" [-nu <nu>] [-nv <nv>] [-nw <nw>]] [-hdf5]"<< std::endl;
9996
return 0;
@@ -107,5 +104,5 @@ int main (int argc, char** argv)
107104
else if (ndim == 2)
108105
return runSimulator<SIM2D>(infile);
109106
else
110-
return runSimulator<SIM1D>(infile);
107+
return 1; // 1D no longer supported
111108
}

0 commit comments

Comments
 (0)