13 #if !defined(KRATOS_EULERIAN_DIFFUSION_ELEMENT_INCLUDED )
14 #define KRATOS_EULERIAN_DIFFUSION_ELEMENT_INCLUDED
33 #include "utilities/geometry_utilities.h"
60 template<
unsigned int TDim,
unsigned int TNumNodes>
82 :
Element(NewId, pGeometry, pProperties)
100 return Kratos::make_intrusive<EulerianDiffusionElement>(NewId,
GetGeometry().
Create(ThisNodes), pProperties);
103 Element::Pointer
Create(
IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties)
const override
105 return Kratos::make_intrusive<EulerianDiffusionElement>(NewId, pGeom, pProperties);
116 if (rLeftHandSideMatrix.size1() != TNumNodes)
117 rLeftHandSideMatrix.
resize(TNumNodes, TNumNodes,
false);
119 if (rRightHandSideVector.size() != TNumNodes)
120 rRightHandSideVector.
resize(TNumNodes,
false);
129 const double delta_t = rCurrentProcessInfo[DELTA_TIME];
130 const double dt_inv = 1.0 /
delta_t;
131 const double lumping_factor = 1.00 /
double(TNumNodes);
133 ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
151 const bool IsDefinedDensityVariable = my_settings->IsDefinedDensityVariable();
152 const bool IsDefinedSpecificHeatVariableVariable = my_settings->IsDefinedSpecificHeatVariable();
153 const bool IsDefinedDiffusionVariable = my_settings->IsDefinedDiffusionVariable();
154 const bool IsDefinedProjectionVariable = my_settings->IsDefinedProjectionVariable();
159 for (
unsigned int i = 0;
i < TNumNodes;
i++)
163 if (IsDefinedProjectionVariable)
164 phi_convected[
i] =
GetGeometry()[
i].FastGetSolutionStepValue((my_settings->GetProjectionVariable()),0);
171 if (IsDefinedDensityVariable)
179 if (IsDefinedSpecificHeatVariableVariable)
181 const Variable<double>& rSpecificHeatVar = my_settings->GetSpecificHeatVariable();
187 if (IsDefinedDiffusionVariable)
189 const Variable<double>& rDiffusionVar = my_settings->GetDiffusionVariable();
204 for(
unsigned int igauss=0; igauss<TDim+1; igauss++)
222 rRightHandSideVector *= Volume/
static_cast<double>(TNumNodes);
223 rLeftHandSideMatrix *= Volume/
static_cast<double>(TNumNodes);
234 if (rRightHandSideVector.size() != TNumNodes) {
235 rRightHandSideVector.
resize(TNumNodes,
false);
238 ConvectionDiffusionSettings::Pointer p_my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
239 const auto& r_unknown_var = p_my_settings->GetUnknownVariable();
255 const bool is_defined_density_variable = p_my_settings->IsDefinedDensityVariable();
256 const bool is_defined_specific_heat_variable = p_my_settings->IsDefinedSpecificHeatVariable();
257 const bool is_defined_diffusion_variable = p_my_settings->IsDefinedDiffusionVariable();
258 const bool is_defined_projection_variable = p_my_settings->IsDefinedProjectionVariable();
262 for (
unsigned int i = 0;
i < TNumNodes;
i++) {
263 const auto& r_node = r_geom[
i];
264 phi[
i] = r_node.FastGetSolutionStepValue(r_unknown_var);
268 if (is_defined_projection_variable) {
269 const auto& r_projection_var = p_my_settings->GetProjectionVariable();
270 phi_convected[
i] = r_node.FastGetSolutionStepValue(r_projection_var);
272 phi_old[
i] = r_node.FastGetSolutionStepValue(r_unknown_var,1);
276 if (is_defined_density_variable) {
277 const auto& r_density_var = p_my_settings->GetDensityVariable();
278 density += r_node.FastGetSolutionStepValue(r_density_var);
283 if (is_defined_specific_heat_variable) {
284 const auto& r_specific_heat_var = p_my_settings->GetSpecificHeatVariable();
285 specific_heat += r_node.FastGetSolutionStepValue(r_specific_heat_var);
290 if (is_defined_diffusion_variable) {
291 const auto& r_diffusion_var = p_my_settings->GetDiffusionVariable();
292 conductivity += r_node.FastGetSolutionStepValue(r_diffusion_var);
296 const double lumping_factor = 1.0 /
static_cast<double>(TNumNodes);
304 for(
unsigned int i_gauss=0; i_gauss < TDim+1; ++i_gauss){
309 const double dt_inv = 1.0 / rCurrentProcessInfo[DELTA_TIME];
313 noalias(rRightHandSideVector) = aux_1 *
prod(aux_NxN, phi_convected -
phi);
320 KRATOS_CATCH(
"Error in Eulerian diffusion element CalculateRightHandSide")
325 const ProcessInfo& rCurrentProcessInfo)
const override
329 ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
332 if (rResult.size() != TNumNodes)
333 rResult.resize(TNumNodes,
false);
335 for (
unsigned int i = 0;
i < TNumNodes;
i++)
337 rResult[
i] =
GetGeometry()[
i].GetDof(rUnknownVar).EquationId();
345 const ProcessInfo& rCurrentProcessInfo)
const override
349 ConvectionDiffusionSettings::Pointer my_settings = rCurrentProcessInfo.
GetValue(CONVECTION_DIFFUSION_SETTINGS);
352 if (ElementalDofList.size() != TNumNodes)
353 ElementalDofList.resize(TNumNodes);
355 for (
unsigned int i = 0;
i < TNumNodes;
i++)
380 std::string
Info()
const override
382 return "LevelSetConvectionElementSimplex #";
389 rOStream <<
Info() <<
Id();
427 Ncontainer(0,0) = 0.58541020; Ncontainer(0,1) = 0.13819660; Ncontainer(0,2) = 0.13819660; Ncontainer(0,3) = 0.13819660;
428 Ncontainer(1,0) = 0.13819660; Ncontainer(1,1) = 0.58541020; Ncontainer(1,2) = 0.13819660; Ncontainer(1,3) = 0.13819660;
429 Ncontainer(2,0) = 0.13819660; Ncontainer(2,1) = 0.13819660; Ncontainer(2,2) = 0.58541020; Ncontainer(2,3) = 0.13819660;
430 Ncontainer(3,0) = 0.13819660; Ncontainer(3,1) = 0.13819660; Ncontainer(3,2) = 0.13819660; Ncontainer(3,3) = 0.58541020;
436 const double one_sixt = 1.0/6.0;
437 const double two_third = 2.0/3.0;
438 Ncontainer(0,0) = one_sixt; Ncontainer(0,1) = one_sixt; Ncontainer(0,2) = two_third;
439 Ncontainer(1,0) = one_sixt; Ncontainer(1,1) = two_third; Ncontainer(1,2) = one_sixt;
440 Ncontainer(2,0) = two_third; Ncontainer(2,1) = one_sixt; Ncontainer(2,2) = one_sixt;
481 void save(
Serializer& rSerializer)
const override
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
Base class for all Elements.
Definition: element.h:60
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
formulation described in https://docs.google.com/document/d/13a_zGLj6xORDuLgoOG5LwHI6BwShvfO166opZ815...
Definition: eulerian_diff.h:63
virtual ~EulerianDiffusionElement()
Destructor.
Definition: eulerian_diff.h:86
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: eulerian_diff.h:387
std::string Info() const override
Turn back information as a string.
Definition: eulerian_diff.h:380
void GetShapeFunctionsOnGauss(BoundedMatrix< double, 4, 4 > &Ncontainer)
Definition: eulerian_diff.h:425
EulerianDiffusionElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: eulerian_diff.h:81
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
It creates a new element pointer.
Definition: eulerian_diff.h:98
void GetShapeFunctionsOnGauss(BoundedMatrix< double, 3, 3 > &Ncontainer)
Definition: eulerian_diff.h:434
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Definition: eulerian_diff.h:323
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: eulerian_diff.h:228
void GetDofList(DofsVectorType &ElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Definition: eulerian_diff.h:343
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
It creates a new element pointer.
Definition: eulerian_diff.h:103
EulerianDiffusionElement(IndexType NewId, GeometryType::Pointer pGeometry)
Default constructor.
Definition: eulerian_diff.h:77
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(EulerianDiffusionElement)
Counted pointer of.
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: eulerian_diff.h:109
EulerianDiffusionElement()
Definition: eulerian_diff.h:416
std::size_t IndexType
Definition: flags.h:74
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
static void CalculateGeometryData(const GeometryType &rGeometry, BoundedMatrix< double, 4, 3 > &rDN_DX, array_1d< double, 4 > &rN, double &rVolume)
This function is designed to compute the shape function derivatives, shape functions and volume in 3D...
Definition: geometry_utilities.h:176
IndexType Id() const
Definition: indexed_object.h:107
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
AMatrix::VectorOuterProductExpression< TExpression1Type, TExpression2Type > outer_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:582
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
float specific_heat
Definition: face_heat.py:57
float conductivity
Definition: face_heat.py:55
float density
Definition: face_heat.py:56
phi_old
Definition: generate_convection_diffusion_explicit_element.py:103
phi
Definition: isotropic_damage_automatic_differentiation.py:168
float aux1
Definition: isotropic_damage_automatic_differentiation.py:239
def load(f)
Definition: ode_solve.py:307
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
N
Definition: sensitivityMatrix.py:29
volume
Definition: sp_statistics.py:15
integer i
Definition: TensorModule.f:17