Skip to content

Commit f3882e6

Browse files
akva2kmokstad
authored andcommitted
Fixed: When the elasticity solver is mixed, use an additional MADOF array
defined on the first basis for explicit phase field. Don't use shared grid if the phase field solver is used and the elasticity solver is mixed.
1 parent 6837d96 commit f3882e6

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

SIMDynElasticity.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,12 @@ class SIMDynElasticity : public Sim
336336
return result;
337337
}
338338

339+
//! \brief Adds an additional MADOF array if required.
340+
bool preprocessB() override
341+
{
342+
return this->mixedProblem() ? this->addMADOF(1,1,false) : true;
343+
}
344+
339345
private:
340346
std::string energFile; //!< File name for global energy output
341347

SIMExplPhaseField.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ bool SIMExplPhaseField::solveStep (TimeStep& tp, bool)
7979
bool SIMExplPhaseField::saveStep (const TimeStep& tp, int& nBlock)
8080
{
8181
if (tp.step%opt.saveInc == 0 && opt.format >= 0)
82-
if (myOwner->writeGlvS1(phaseField,++myStep,nBlock,tp.time.t,
83-
"phase",6,1,true) < 0) return false;
82+
return myOwner->writeGlvS(phaseField,"phase",++myStep,nBlock);
8483

8584
return true;
8685
}

SIMFractureDynamics.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ class SIMFracture : public Coupling<SolidSolver,PhaseSolver>
6161
//! \brief Initializes and sets up field dependencies.
6262
virtual void setupDependencies()
6363
{
64-
this->S1.registerDependency(&this->S2,"phasefield",1);
64+
if (this->S1.mixedProblem() && this->S2.getNoParamDim() == 0)
65+
// The solid solver is mixed and we use a mesh-less explicit phase field.
66+
// Then set up the dependency to the phase field using an additional
67+
// MADOF array defined for a scalar field on the first basis.
68+
this->S1.registerDependency("phasefield",&this->S2);
69+
else
70+
this->S1.registerDependency(&this->S2,"phasefield");
71+
6572
// The tensile energy is defined on integration points and not nodal points.
6673
// It is a global buffer array across all patches in the model.
6774
// Use an explicit call instead of normal couplings for this.

SIMPhaseField.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ template<class Dim> class SIMPhaseField : public Dim
5454
explicit SIMPhaseField(Dim* gridOwner = nullptr, size_t n = 2) : Dim(1)
5555
{
5656
Dim::myHeading = "Cahn-Hilliard solver";
57-
if (gridOwner && gridOwner->createFEMmodel())
57+
if (gridOwner && !gridOwner->mixedProblem() && gridOwner->createFEMmodel())
5858
this->clonePatches(gridOwner->getFEModel(),gridOwner->getGlob2LocMap());
5959

6060
eps_d0 = refTol = 0.0;

0 commit comments

Comments
 (0)