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

[Fluid-SDEM] Dynamic vms dem coupled #8018

Merged
merged 24 commits into from
Jan 8, 2021
Merged

Conversation

jgonzalezusua
Copy link
Member

Description
This PR is aimed to develop the formulation of the generalized N-S equations including the porosity and using the dynamic subscales for both ASGS and OSS methods.

Please mark the PR with appropriate tags:

  • Feature
  • Application

Changelog
The changes of this PR are:

  • Added element called d_vms_dem_coupled.cpp derived from d_vms.cpp
  • Added a cpp test for the new element.
  • Updated navier_stokes_vms_monolithic_DEMCoupled.py to add the new element to the solver.

@jgonzalezusua jgonzalezusua requested review from a team as code owners December 21, 2020 14:52
@jgonzalezusua jgonzalezusua changed the title Dynamic vms dem coupled [Fluid-SDEM] Dynamic vms dem coupled Dec 21, 2020
rElem.Check(r_process_info);
i->CalculateLocalVelocityContribution(LHS, RHS, r_process_info);
std::cout.precision(10);
//std::cout << i->Info() << RHS << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

remove comments

Copy link
Member

Choose a reason for hiding this comment

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

In this specific case I'd keep it (these are really useful when it is required to update the test values due to a formulation upgrade or correction).

Copy link
Member

Choose a reason for hiding this comment

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

I see.

// Auxiliary coefficient StaticTauOne*TauTwo/Dt that appears on the pressure subscale model
// This coefficient comes from mass equation: div(u^n+1 + u^n) = 0 setting to 0 is to consider
// div(u^n+1) = 0
TauP = 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

I would remove all reference to this term. If we want, we can add it later, but it is better to leave everything clean

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, aren't these the standard tau constant used in the base NS formulation? If so it is the base class method could be used.

// Some terms are the same for all velocity components, calculate them once for each i,j

// Skew-symmetric convective term 1/2( v*grad(u)*u - grad(v) uu )
//double K = 0.5*(rN[i]*AGradN[j] - AGradN[i]*rN[j]);
Copy link
Member

Choose a reason for hiding this comment

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

I do not remember discussing the possibility of using this skew-symmetric form. It could be something else to study in the future

Copy link
Member Author

Choose a reason for hiding this comment

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

This is inherited from the d_vms.cpp, I prefer to keep this line commented.

Copy link
Member

@GuillermoCasas GuillermoCasas left a comment

Choose a reason for hiding this comment

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

All minor changes

GeometryType::Pointer pGeom,
Properties::Pointer pProperties) const override;

void Calculate(
Copy link
Member

Choose a reason for hiding this comment

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

Did you really need to override all these 'Calculate' functions?

Copy link
Member

Choose a reason for hiding this comment

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

Agree. Indeed in your implementation you are precluding the access to the base class ones.

"element_name": "DVMSDEMCoupled"
}""")
settings.ValidateAndAssignDefaults(default_settings)

Copy link
Member

Choose a reason for hiding this comment

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

Consider the changes in #7997

Copy link
Member Author

Choose a reason for hiding this comment

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

Why did you include the dynamic_tau in the DVMS settings? It is not used in the element...

Copy link
Member

Choose a reason for hiding this comment

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

It is used in the base quasi-static class to calculate the stabilization constants.

Comment on lines 79 to 182
const ProcessInfo& rCurrentProcessInfo) {}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::Calculate(
const Variable<array_1d<double, 3>>& rVariable,
array_1d<double, 3>& rOutput,
const ProcessInfo& rCurrentProcessInfo) {
// Lumped projection terms
if (rVariable == ADVPROJ) {
this->CalculateProjections(rCurrentProcessInfo);
}
}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::Calculate(
const Variable<Vector>& rVariable,
Vector& rOutput,
const ProcessInfo& rCurrentProcessInfo) {}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::Calculate(
const Variable<Matrix>& rVariable,
Matrix& rOutput,
const ProcessInfo& rCurrentProcessInfo) {}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::Initialize(const ProcessInfo& rCurrentProcessInfo)
{
// Base class does things with constitutive law here.
DVMS<TElementData>::Initialize(rCurrentProcessInfo);
}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo)
{
DVMS<TElementData>::FinalizeSolutionStep(rCurrentProcessInfo);
}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo)
{
DVMS<TElementData>::InitializeNonLinearIteration(rCurrentProcessInfo);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Inquiry

template< class TElementData >
int DVMSDEMCoupled<TElementData>::Check(const ProcessInfo &rCurrentProcessInfo) const
{
int out = DVMS<TElementData>::Check(rCurrentProcessInfo);

return out;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

template< class TElementData >
void DVMSDEMCoupled<TElementData>::GetValueOnIntegrationPoints(
Variable<array_1d<double, 3 > > const& rVariable,
std::vector<array_1d<double, 3 > >& rValues,
ProcessInfo const& rCurrentProcessInfo)
{
DVMS<TElementData>::GetValueOnIntegrationPoints(rVariable,rValues,rCurrentProcessInfo);
}

template< class TElementData >
void DVMSDEMCoupled<TElementData>::GetValueOnIntegrationPoints(
Variable<double> const& rVariable,
std::vector<double>& rValues,
ProcessInfo const& rCurrentProcessInfo)
{
DVMS<TElementData>::GetValueOnIntegrationPoints(rVariable,rValues,rCurrentProcessInfo);
}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::GetValueOnIntegrationPoints(
Variable<array_1d<double, 6>> const& rVariable,
std::vector<array_1d<double, 6>>& rValues,
ProcessInfo const& rCurrentProcessInfo)
{
DVMS<TElementData>::GetValueOnIntegrationPoints(rVariable,rValues,rCurrentProcessInfo);
}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::GetValueOnIntegrationPoints(
Variable<Vector> const& rVariable,
std::vector<Vector>& rValues,
ProcessInfo const& rCurrentProcessInfo)
{
DVMS<TElementData>::GetValueOnIntegrationPoints(rVariable,rValues,rCurrentProcessInfo);
}

template <class TElementData>
void DVMSDEMCoupled<TElementData>::GetValueOnIntegrationPoints(
Variable<Matrix> const& rVariable,
std::vector<Matrix>& rValues,
ProcessInfo const& rCurrentProcessInfo)
{
DVMS<TElementData>::GetValueOnIntegrationPoints(rVariable,rValues,rCurrentProcessInfo);
}
Copy link
Member

Choose a reason for hiding this comment

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

Why overriding all these methods?

Comment on lines 91 to 93
if (rVariable == ADVPROJ) {
this->CalculateProjections(rCurrentProcessInfo);
}
Copy link
Member

Choose a reason for hiding this comment

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

An else statement calling the base class Calculate should be added in case the provided variable it's not implemented in here.

DVMSDEMCoupled(IndexType NewId, GeometryType::Pointer pGeometry, Properties::Pointer pProperties);

/// Destructor.
~DVMSDEMCoupled() override;
Copy link
Member

Choose a reason for hiding this comment

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

Destructors shouldn't be override specified (see here).

Copy link
Member

@GuillermoCasas GuillermoCasas left a comment

Choose a reason for hiding this comment

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

I think this is ready for merging

Copy link
Member

@GuillermoCasas GuillermoCasas left a comment

Choose a reason for hiding this comment

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

PLease change what we discussed about the evaluatiion of the error at the Gauss points

@jgonzalezusua jgonzalezusua merged commit 8f752f3 into master Jan 8, 2021
@jgonzalezusua jgonzalezusua deleted the dynamic-vms-DEM-coupled branch January 8, 2021 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants