Skip to content

Improvment and bugfixing in CFiniteElementVec - #105

Merged
norihiro-w merged 15 commits into
ufz:masterfrom
wenqing:improveLocalAssemblerM
Aug 7, 2018
Merged

norihiro-w merged 15 commits into
ufz:masterfrom
wenqing:improveLocalAssemblerM

Conversation

@wenqing

@wenqing wenqing commented Jul 4, 2018 •

Copy link
Copy Markdown
Member

This PR improves CFiniteElementVec, and it contains

  1. removed the negative value option of the Biot's constant.
  2. in the assembly of the pressure coupling related RHS and matrix,
    • replaced the element constant saturation with node saturations,
    • changed the computation of pressure coupled matrix for the staggered scheme for H2M, and fixed a bug for the monolithic scheme of H2M
    • removed the restriction of pore pressure to be positive in the total stress calculation.
  3. fixed the excavation conditions for the time stepping excavation model.
  4. replaced `int CFiniteElementVec::Flow_Type``with an enum variable.
  5. made some variable declarations local.
  6. removed some repeated or unused source code.

The changes in 2) improves the computation solutions of the benchmarks for the THM coupled processes. Therefore the reference results of the affected benchmarks have to be updated too.

Comment thread FEM/fem_ele_vec.cpp
{
nodal_pore_p[i] = (biot < 0.0 && _nodal_p1[i] < 0.0) ?
0.0 : LoadFactor * S_Water * _nodal_p1[i];
nodal_pore_p[i] = LoadFactor * _nodal_S[i] * _nodal_p1[i];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Element saturation to nodal saturation.

Comment thread FEM/fem_ele_vec.cpp
{
const double p0 = h_pcs->GetNodeValue(nodes[i], idx_p1_ini);
const double Sat0 = LoadFactor * m_mmp->SaturationCapillaryPressureFunction(-p0);
nodal_pore_p[i] -= (p0 > 0.0) ? LoadFactor * Sat0 * p0 : 0.0;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the restriction of positive pore pressure in the total stress calculation for the partially saturated flow.

Comment thread FEM/fem_ele_std.cpp
{
NodalVal2[i] = dm_pcs->GetNodeValue(nodes[i], Idx_dm1[0]);
NodalVal3[i] = dm_pcs->GetNodeValue(nodes[i], Idx_dm1[1]);
NodalVal2[i] = dm_pcs->GetNodeValue(nodes[i], Idx_dm0[0]);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a bug in the monolithic H2M.

Comment thread FEM/pcs_dm.cpp
// 07.04.2010 WW
bool done;
ElementValue_DM* eleV_DM = NULL;
if ((fem_dm->Flow_Type == 0 || fem_dm->Flow_Type == 2 || fem_dm->Flow_Type == 1) && Neglect_H_ini == 2)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the repeated code.

Comment thread FEM/fem_ele_vec.cpp Outdated
Sw += shapefct[i] * _nodal_S[i];
}
rho = (1. - porosity) * fabs(smat->Density()) + porosity * Sw * density_fluid;
const double density_fluid = (mfp_vector.empty()) ? m_mfp->Density() : 0.0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am puzzled here. why should the fluid density be zero if mfp_vector is not empty?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it is wrong. Removed the ternary operator.

Comment thread FEM/fem_ele_vec.cpp Outdated
const double porosity = m_mmp->Porosity(this);

if (Flow_Type == 2 || Flow_Type == 3)
double rho = (1. - porosity) * fabs(smat->Density())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since smat->Density() is positive (line 738), fabs is not needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

Comment thread FEM/fem_ele_vec.cpp Outdated
return rho;

// If negative value is given in the .msp file, gravity by solid is skipped
if (smat->Density() > 0.0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please correct indent

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected.

Comment thread FEM/fem_ele_vec.cpp
double fac = 1.0;
if (Flow_Type == 1)
fac = -1.0;
const double fac = (_flow_type == FiniteElement::RICHARDS_FLOW) ? -1. : 1.;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you write a comment here explaining what is fac variable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread FEM/rf_pcs.cpp Outdated
if ((GetCurveValue(ExcavCurve, 0, aktuelle_zeit, &valid) + ExcavBeginCoordinate)
> (ele_center[ExcavDirection])
&& (ele_center[ExcavDirection] - ExcavBeginCoordinate) > -0.001)
const double expected_coordinate =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see these lines several times. can you create a function for this and remove repeated codes?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a new function.

@wenqing
wenqing force-pushed the improveLocalAssemblerM branch from 8992194 to c495882 Compare August 1, 2018 11:56
@wenqing
wenqing force-pushed the improveLocalAssemblerM branch from c495882 to efe1ed9 Compare August 1, 2018 15:17
Comment thread FEM/fem_ele_vec.cpp Outdated
if ((GetCurveValue(pcs->ExcavCurve, 0, aktuelle_zeit, &valid) + pcs->ExcavBeginCoordinate)
> (ele_center[pcs->ExcavDirection])
&& (ele_center[pcs->ExcavDirection] - pcs->ExcavBeginCoordinate) > -0.001)
const double expected_coordinate =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it possible to use the new function isPointInExcavatedDomain() here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace the lines with the new function.

Comment thread FEM/fem_ele_vec.cpp
double const* ele_center(elem->GetGravityCenter());
if ((GetCurveValue(pcs->ExcavCurve, 0, aktuelle_zeit, &valid) + pcs->ExcavBeginCoordinate)
< (ele_center[pcs->ExcavDirection]))
const double expected_coordinate =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just took a loot. Here the if-condition is different from that in the new function.

@norihiro-w
norihiro-w merged commit fe05142 into ufz:master Aug 7, 2018
@norihiro-w

Copy link
Copy Markdown
Contributor

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants