Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvment and bugfixing in CFiniteElementVec #105

Merged
merged 15 commits into from
Aug 7, 2018

Conversation

wenqing
Copy link
Member

@wenqing wenqing commented Jul 4, 2018

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.

{
if (smat->bishop_model < 0) // Without Bishop
{
for (int i = 0; i < nnodes; i++)
{
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
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.

@@ -1721,7 +1683,7 @@ void CFiniteElementVec::GlobalAssembly_RHS()
{
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
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.


for (i = 0; i < nnodesHQ; i++)
{
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
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.

@@ -2791,35 +2770,13 @@ void CRFProcessDeformation::PostExcavation()
{
// MXDumpGLS("rf_pcs.txt",1,eqs->b,eqs->x); //abort();}
// 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
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.

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
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
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.


if (Flow_Type == 2 || Flow_Type == 3)
double rho = (1. - porosity) * fabs(smat->Density())
Copy link
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
Member Author

Choose a reason for hiding this comment

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

removed.

return rho;

// If negative value is given in the .msp file, gravity by solid is skipped
if (smat->Density() > 0.0)
Copy link
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
Member Author

Choose a reason for hiding this comment

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

Corrected.

double fac = 1.0;
if (Flow_Type == 1)
fac = -1.0;
const double fac = (_flow_type == FiniteElement::RICHARDS_FLOW) ? -1. : 1.;
Copy link
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
Member Author

Choose a reason for hiding this comment

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

Added.

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
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
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.

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
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
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.

@@ -1634,8 +1599,10 @@ void CFiniteElementVec::GlobalAssembly_RHS()
else if (pcs->ExcavMaterialGroup > -1)
{
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
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
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
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