Skip to content

Commit

Permalink
Merge pull request #6511 from KratosMultiphysics/PfemFluid/add-therma…
Browse files Browse the repository at this point in the history
…l-coupling

[PfemFluid] Add thermal coupling files
  • Loading branch information
MZecchetto authored May 4, 2020
2 parents 6dfc105 + a31e146 commit 24c9763
Show file tree
Hide file tree
Showing 28 changed files with 3,749 additions and 46 deletions.
6 changes: 6 additions & 0 deletions applications/PfemFluidDynamicsApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ set( KRATOS_PFEM_FLUID_DYNAMICS_APPLICATION_CORE
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/fluid_constitutive_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/bingham_2D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/bingham_3D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/bingham_temperature_dependent_2D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/bingham_temperature_dependent_3D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/newtonian_2D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/newtonian_3D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/newtonian_temperature_dependent_2D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/newtonian_temperature_dependent_3D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/papanastasiou_mu_I_rheology_2D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/papanastasiou_mu_I_rheology_3D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/fluid_laws/barker_mu_I_rheology_3D_law.cpp
Expand All @@ -56,6 +60,8 @@ set( KRATOS_PFEM_FLUID_DYNAMICS_APPLICATION_CORE
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/solid_laws/solid_constitutive_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/solid_laws/hypoelastic_2D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/solid_laws/hypoelastic_3D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/solid_laws/hypoelastic_temperature_dependent_2D_law.cpp
${CMAKE_CURRENT_SOURCE_DIR}/custom_constitutive/solid_laws/hypoelastic_temperature_dependent_3D_law.cpp
)

set( KRATOS_PFEM_FLUID_DYNAMICS_APPLICATION_PYTHON_INTERFACE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
//-------------------------------------------------------------
// ___ __ ___ _ _ _
// KRATOS| _ \/ _|___ _ __ | __| |_ _(_)__| |
// | _/ _/ -_) ' \| _|| | || | / _` |
// |_| |_| \___|_|_|_|_| |_|\_,_|_\__,_|DYNAMICS
//
// BSD License: PfemFluidDynamicsApplication/license.txt
//
// Main authors: Massimiliano Zecchetto
// Collaborators:
//
//-------------------------------------------------------------
//

// System includes
#include <iostream>

// External includes
#include <cmath>

// Project includes
#include "custom_constitutive/fluid_laws/bingham_temperature_dependent_2D_law.h"
#include "includes/checks.h"
#include "includes/properties.h"
#include "pfem_fluid_dynamics_application_variables.h"

namespace Kratos {

//********************************CONSTRUCTOR*********************************
//****************************************************************************

BinghamTemperatureDependent2DLaw::BinghamTemperatureDependent2DLaw() : Bingham2DLaw() {}

//******************************COPY CONSTRUCTOR******************************
//****************************************************************************

BinghamTemperatureDependent2DLaw::BinghamTemperatureDependent2DLaw(const BinghamTemperatureDependent2DLaw& rOther) : Bingham2DLaw(rOther) {}

//***********************************CLONE************************************
//****************************************************************************

ConstitutiveLaw::Pointer BinghamTemperatureDependent2DLaw::Clone() const { return Kratos::make_shared<BinghamTemperatureDependent2DLaw>(*this); }

//*********************************DESTRUCTOR*********************************
//****************************************************************************

BinghamTemperatureDependent2DLaw::~BinghamTemperatureDependent2DLaw() {}

std::string BinghamTemperatureDependent2DLaw::Info() const { return "BinghamTemperatureDependent2DLaw"; }

//******************CHECK CONSISTENCY IN THE CONSTITUTIVE LAW******************
//*****************************************************************************

int BinghamTemperatureDependent2DLaw::Check(const Properties& rMaterialProperties, const GeometryType& rElementGeometry,
const ProcessInfo& rCurrentProcessInfo) {

KRATOS_CHECK_VARIABLE_KEY(DYNAMIC_VISCOSITY);
KRATOS_CHECK_VARIABLE_KEY(YIELD_SHEAR);
KRATOS_CHECK_VARIABLE_KEY(ADAPTIVE_EXPONENT);
KRATOS_CHECK_VARIABLE_KEY(BULK_MODULUS);

if (rMaterialProperties[DYNAMIC_VISCOSITY] <= 0.0) {
KRATOS_ERROR << "Incorrect or missing DYNAMIC_VISCOSITY provided in process info for BinghamTemperatureDependent2DLaw: "
<< rMaterialProperties[DYNAMIC_VISCOSITY] << std::endl;
}

if (rMaterialProperties[YIELD_SHEAR] <= 0.0) {
KRATOS_ERROR << "Incorrect or missing YIELD_SHEAR provided in process info for BinghamTemperatureDependent2DLaw: "
<< rMaterialProperties[YIELD_SHEAR] << std::endl;
}

if (rMaterialProperties[ADAPTIVE_EXPONENT] <= 0.0) {
KRATOS_ERROR << "Incorrect or missing ADAPTIVE_EXPONENT provided in process info for BinghamTemperatureDependent2DLaw: "
<< rMaterialProperties[ADAPTIVE_EXPONENT] << std::endl;
}

if (rMaterialProperties[BULK_MODULUS] <= 0.0) {
KRATOS_ERROR << "Incorrect or missing BULK_MODULUS provided in process info for BinghamTemperatureDependent2DLaw: "
<< rMaterialProperties[BULK_MODULUS] << std::endl;
}

return 0;
}

double BinghamTemperatureDependent2DLaw::GetEffectiveViscosity(ConstitutiveLaw::Parameters& rParameters) const {
return rParameters.GetConstitutiveMatrix()(2, 2);
}

double BinghamTemperatureDependent2DLaw::GetEffectiveDensity(ConstitutiveLaw::Parameters& rParameters) const {
const Properties& r_properties = rParameters.GetMaterialProperties();
double effective_density;
if (r_properties.HasTable(TEMPERATURE, DENSITY)) {
effective_density = this->GetValueFromTable(TEMPERATURE, DENSITY, rParameters);
} else {
effective_density = r_properties[DENSITY];
}
return effective_density;
}

double BinghamTemperatureDependent2DLaw::GetEffectiveDynamicViscosity(ConstitutiveLaw::Parameters& rParameters) const {
const Properties& r_properties = rParameters.GetMaterialProperties();
double effective_viscosity;
if (r_properties.HasTable(TEMPERATURE, DYNAMIC_VISCOSITY)) {
effective_viscosity = this->GetValueFromTable(TEMPERATURE, DYNAMIC_VISCOSITY, rParameters);
} else {
effective_viscosity = r_properties[DYNAMIC_VISCOSITY];
}
return effective_viscosity;
}

double BinghamTemperatureDependent2DLaw::GetEffectiveYieldShear(ConstitutiveLaw::Parameters& rParameters) const {
const Properties& r_properties = rParameters.GetMaterialProperties();
double effective_yield_shear;
if (r_properties.HasTable(TEMPERATURE, YIELD_SHEAR)) {
effective_yield_shear = this->GetValueFromTable(TEMPERATURE, YIELD_SHEAR, rParameters);
} else {
effective_yield_shear = r_properties[YIELD_SHEAR];
}
return effective_yield_shear;
}

void BinghamTemperatureDependent2DLaw::save(Serializer& rSerializer) const {
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, Bingham2DLaw)
}

void BinghamTemperatureDependent2DLaw::load(Serializer& rSerializer) {
KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, Bingham2DLaw)
}

} // Namespace Kratos
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
//-------------------------------------------------------------
// ___ __ ___ _ _ _
// KRATOS| _ \/ _|___ _ __ | __| |_ _(_)__| |
// | _/ _/ -_) ' \| _|| | || | / _` |
// |_| |_| \___|_|_|_|_| |_|\_,_|_\__,_|DYNAMICS
//
// BSD License: PfemFluidDynamicsApplication/license.txt
//
// Main authors: Massimiliano Zecchetto
// Collaborators:
//
//-------------------------------------------------------------
//

#if !defined(KRATOS_BINGHAM_TEMPERATURE_DEPENDENT_2D_LAW_H_INCLUDED)
#define KRATOS_BINGHAM_TEMPERATURE_DEPENDENT_2D_LAW_H_INCLUDED

// System includes

// External includes

// Project includes
#include "custom_constitutive/fluid_laws/bingham_2D_law.h"

namespace Kratos {
/**
* Defines a 2D Bingham non-Newtonian constitutive law
* This material law is defined by the parameters:
* 1) DYNAMIC_VISCOSITY
* 2) YIELD_SHEAR
* 3) ADAPTIVE_EXPONENT
*/
class KRATOS_API(PFEM_FLUID_DYNAMICS_APPLICATION) BinghamTemperatureDependent2DLaw : public Bingham2DLaw {
public:
/**
* Type Definitions
*/
typedef ProcessInfo ProcessInfoType;
typedef ConstitutiveLaw BaseType;
typedef std::size_t SizeType;

/**
* Counted pointer of BinghamTemperatureDependent2DLaw
*/
KRATOS_CLASS_POINTER_DEFINITION(BinghamTemperatureDependent2DLaw);

/**
* Life Cycle
*/

/**
* Default constructor.
*/
BinghamTemperatureDependent2DLaw();

/**
* Clone function (has to be implemented by any derived class)
* @return a pointer to a new instance of this constitutive law
*/
ConstitutiveLaw::Pointer Clone() const override;

/**
* Copy constructor.
*/
BinghamTemperatureDependent2DLaw(const BinghamTemperatureDependent2DLaw& rOther);

/**
* Destructor.
*/
~BinghamTemperatureDependent2DLaw() override;

/**
* Operators
*/

/**
* Operations needed by the base class:
*/

/**
* This function is designed to be called once to perform all the checks needed
* on the input provided. Checks can be "expensive" as the function is designed
* to catch user's errors.
* @param rMaterialProperties
* @param rElementGeometry
* @param rCurrentProcessInfo
* @return
*/
int Check(const Properties& rMaterialProperties, const GeometryType& rElementGeometry,
const ProcessInfo& rCurrentProcessInfo) override;

/**
* Input and output
*/

/**
* Turn back information as a string.
*/
std::string Info() const override;

protected:
///@name Protected static Member Variables
///@{

///@}
///@name Protected member Variables
///@{

///@}
///@name Protected Operators
///@{

///@}
///@name Protected Operations
///@{

/// Get the effective viscosity (in dynamic units -- Pa s) for the fluid.
double GetEffectiveViscosity(ConstitutiveLaw::Parameters& rParameters) const override;

/// Get the effective density for the fluid.
double GetEffectiveDensity(ConstitutiveLaw::Parameters& rParameters) const override;

/// Get the effective yield shear for the fluid.
double GetEffectiveYieldShear(ConstitutiveLaw::Parameters& rParameters) const;

/// Get the effective dynamic viscosity for the fluid.
double GetEffectiveDynamicViscosity(ConstitutiveLaw::Parameters& rParameters) const;

///@}

private:
///@name Static Member Variables
///@{

///@}
///@name Member Variables
///@{

///@}
///@name Private Operators
///@{

///@}
///@name Private Operations
///@{
///@}

///@}
///@name Private Access
///@{
///@}

///@}
///@name Serialization
///@{
friend class Serializer;

void save(Serializer& rSerializer) const override;

void load(Serializer& rSerializer) override;
///@}

}; // Class BinghamTemperatureDependent2DLaw

} // namespace Kratos.

#endif // KRATOS_BINGHAM_TEMPERATURE_DEPENDENT_2D_LAW_H_INCLUDED defined
Loading

0 comments on commit 24c9763

Please sign in to comment.