Skip to content

Commit 039bc48

Browse files
committed
Fixed: evalSol for mixed PoroFracture.
Changed: The PoroFractureElasticity class now any applies to non-mixed.
1 parent 7a12f8a commit 039bc48

2 files changed

Lines changed: 55 additions & 7 deletions

File tree

‎PoroFracture.C‎

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ public:
3636
//! \brief Constructor for integrands with a parent integrand.
3737
//! \param parent The parent integrand of this one
3838
//! \param[in] nd Number of spatial dimensions
39-
//! \param[in] nv Number of primary solution variables per node
40-
PoroFractureElasticity(IntegrandBase* parent,
41-
unsigned short int nd, unsigned short int nv)
42-
: FractureElasticityVoigt(parent,nd) { npv = nv; }
39+
PoroFractureElasticity(IntegrandBase* parent, unsigned short int nd)
40+
: FractureElasticityVoigt(parent,nd) { npv = nd+1; }
4341
//! \brief Empty destructor.
4442
virtual ~PoroFractureElasticity() {}
4543

@@ -53,7 +51,6 @@ public:
5351
return false;
5452

5553
// Filter out the pressure components
56-
// FIXME: Mixed
5754
size_t nen = MNPC.size();
5855
if (eV.front().size() == nen*(nsd+1))
5956
{
@@ -72,7 +69,10 @@ public:
7269

7370
PoroFracture::PoroFracture (unsigned short int n, bool m) : PoroElasticity(n,m)
7471
{
75-
fracEl = new PoroFractureElasticity(this, n, m ? n : n+1);
72+
if (m)
73+
fracEl = new FractureElasticityVoigt(this,n);
74+
else
75+
fracEl = new PoroFractureElasticity(this,n);
7676

7777
L_per = 0.01;
7878
d_min = 0.1;
@@ -204,12 +204,14 @@ double PoroFracture::formCrackedPermeabilityTensor (SymmTensor& Kcrack,
204204
const PoroMaterial* pmat = dynamic_cast<const PoroMaterial*>(material);
205205
if (!pmat)
206206
return -4.0;
207+
207208
double perm = pmat->getPermeability(X)[0];
208209

209210
Vec3 gradD; // Evaluate the phase field value and gradient
210211
double d = fracEl->evalPhaseField(gradD,eV,fe.N,fe.dNdX);
211212
if (d < 0.0)
212213
{
214+
#pragma omp critical
213215
std::cerr <<" *** PoroFracture::formCrackedPermeabilityTensor(X = "<< X
214216
<<")\n Invalid phase field value: "<< d << std::endl;
215217
return d;
@@ -224,6 +226,7 @@ double PoroFracture::formCrackedPermeabilityTensor (SymmTensor& Kcrack,
224226
double d2 = gradD.length2();
225227
if (d2 <= 0.0)
226228
{
229+
#pragma omp critical
227230
std::cerr <<" *** PoroFracture::formCrackedPermeabilityTensor(X = "<< X
228231
<<")\n Zero phase field gradient: "<< gradD << std::endl;
229232
return -1.0;
@@ -255,7 +258,17 @@ double PoroFracture::formCrackedPermeabilityTensor (SymmTensor& Kcrack,
255258

256259
// Compute the perpendicular crack stretch
257260
// lambda = gradD*gradD / gradD*C^-1*gradD (see M&M eq. (106), F&K eq. (36))
258-
double lambda = sqrt(d2 / (gradD*CigD));
261+
double gDCigD = gradD*CigD;
262+
if (gDCigD <= 0.0)
263+
{
264+
#pragma omp critical
265+
std::cerr <<" *** PoroFracture::formCrackedPermeabilityTensor:"
266+
<<" grad(D) = "<< gradD <<", C^-1*grad(D) = "<< CigD
267+
<<"\n => non-positive dot product "<< gDCigD << std::endl;
268+
return -3.5;
269+
}
270+
271+
double lambda = sqrt(d2/gDCigD);
259272
#if INT_DEBUG > 3
260273
std::cout <<"PoroFracture::formCrackedPermeabilityTensor(X = "<< X
261274
<<") lambda = "<< lambda << std::endl;
@@ -326,3 +339,28 @@ bool PoroFracture::evalSol (Vector& s, const FiniteElement& fe,
326339

327340
return true;
328341
}
342+
343+
344+
bool PoroFracture::evalSol (Vector& s, const MxFiniteElement& fe,
345+
const Vec3& X, const std::vector<int>& MNPC,
346+
const std::vector<size_t>& elem_sizes,
347+
const std::vector<size_t>&) const
348+
{
349+
std::vector<int> MNPC1(MNPC.begin(),MNPC.begin()+elem_sizes.front());
350+
351+
Vectors eV(1);
352+
utl::gather(MNPC1,nsd,primsol.front(),eV.front());
353+
354+
if (!this->evalSol(s,fe,X,eV.front()))
355+
return false;
356+
357+
if (!fracEl->getElementSolution(eV,MNPC1))
358+
return false;
359+
360+
SymmTensor Kc(nsd);
361+
s.push_back(this->formCrackedPermeabilityTensor(Kc,eV,fe,X));
362+
for (size_t i = 1; i <= Kc.dim(); i++)
363+
s.push_back(Kc(i,i));
364+
365+
return true;
366+
}

‎PoroFracture.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ class PoroFracture : public PoroElasticity
7777
//! \param[in] MNPC Nodal point correspondance for the basis function values
7878
virtual bool evalSol(Vector& s, const FiniteElement& fe,
7979
const Vec3& X, const std::vector<int>& MNPC) const;
80+
//! \brief Evaluates the secondary solution at a result point (mixed problem).
81+
//! \param[out] s The solution field values at current point
82+
//! \param[in] fe Mixed finite element data at current point
83+
//! \param[in] X Cartesian coordinates of current point
84+
//! \param[in] MNPC Nodal point correspondance for the bases
85+
//! \param[in] elem_sizes Size of each basis on the element
86+
virtual bool evalSol(Vector& s, const MxFiniteElement& fe, const Vec3& X,
87+
const std::vector<int>& MNPC,
88+
const std::vector<size_t>& elem_sizes,
89+
const std::vector<size_t>&) const;
8090

8191
//! \brief Returns a pointer to the Gauss-point tensile energy array.
8292
virtual const RealArray* getTensileEnergy() const;

0 commit comments

Comments
 (0)