Skip to content

Commit

Permalink
[GeoMechanicsApplication] Add point heat flux (source) condition for …
Browse files Browse the repository at this point in the history
…heat (#12340)

* Added flux point condition for thermal part

* deleted thermal files, in order to add them again with small letters

This is a trick, because winsows does not see difference in small or capital letters, but the compiliation fails on GCC. Delete them first then add them again with small letters

* Added the files again with small letters

* Added test cases for 2D and 3D line elements -> 2D and 3D point fluxes

* A small fix

* Added section area to line element

* Fixed test cases which were influenced by adding SECTION_AREA

* Modifications based on review requirements

* Modifications based on review

* Added test documentation

* fix in Readme

* Removed "SECTION_AREA"from registration

* Modification in material parameters

* Modification in README.md based on review suggestions

* Modifications based on review

* fix in README.md

* modifications based on review
  • Loading branch information
mnabideltares authored May 9, 2024
1 parent 8dbd2ec commit 44468d2
Show file tree
Hide file tree
Showing 23 changed files with 1,701 additions and 310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ Condition::DofsVectorType GeoTCondition<TDim, TNumNodes>::GetDofs() const
return Geo::DofUtilities::ExtractDofsFromNodes(this->GetGeometry(), TEMPERATURE);
}

template class GeoTCondition<2, 1>;
template class GeoTCondition<2, 2>;
template class GeoTCondition<2, 3>;
template class GeoTCondition<2, 4>;
template class GeoTCondition<2, 5>;
template class GeoTCondition<3, 1>;
template class GeoTCondition<3, 3>;
template class GeoTCondition<3, 4>;
template class GeoTCondition<3, 6>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// KRATOS___
// // ) )
// // ___ ___
// // ____ //___) ) // ) )
// // / / // // / /
// ((____/ / ((____ ((___/ / MECHANICS
//
// License: geo_mechanics_application/license.txt
//
//
// Main authors: Mohamed Nabi
// John van Esch
//

#include "custom_conditions/thermal_point_flux_condition.h"

namespace Kratos
{

template <unsigned int TDim, unsigned int TNumNodes>
GeoThermalPointFluxCondition<TDim, TNumNodes>::GeoThermalPointFluxCondition()
: GeoTCondition<TDim, TNumNodes>()
{
}

template <unsigned int TDim, unsigned int TNumNodes>
GeoThermalPointFluxCondition<TDim, TNumNodes>::GeoThermalPointFluxCondition(IndexType NewId,
GeometryType::Pointer pGeometry)
: GeoTCondition<TDim, TNumNodes>(NewId, pGeometry)
{
}

template <unsigned int TDim, unsigned int TNumNodes>
GeoThermalPointFluxCondition<TDim, TNumNodes>::GeoThermalPointFluxCondition(IndexType NewId,
GeometryType::Pointer pGeometry,
PropertiesType::Pointer pProperties)
: GeoTCondition<TDim, TNumNodes>(NewId, pGeometry, pProperties)
{
}

template <unsigned int TDim, unsigned int TNumNodes>
void GeoThermalPointFluxCondition<TDim, TNumNodes>::CalculateRHS(Vector& rRightHandSideVector, const ProcessInfo&)
{
rRightHandSideVector[0] = this->GetGeometry()[0].FastGetSolutionStepValue(NORMAL_HEAT_FLUX);
}

template class GeoThermalPointFluxCondition<2, 1>;
template class GeoThermalPointFluxCondition<3, 1>;

} // namespace Kratos
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// KRATOS___
// // ) )
// // ___ ___
// // ____ //___) ) // ) )
// // / / // // / /
// ((____/ / ((____ ((___/ / MECHANICS
//
// License: geo_mechanics_application/license.txt
//
//
// Main authors: Mohamed Nabi
// John van Esch
//

#pragma once

#include "custom_conditions/T_condition.h"
#include "includes/serializer.h"

namespace Kratos
{

template <unsigned int TDim, unsigned int TNumNodes>
class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoThermalPointFluxCondition
: public GeoTCondition<TDim, TNumNodes>
{
public:
using GeometryType = Geometry<Node>;
using PropertiesType = Properties;
using NodesArrayType = GeometryType::PointsArrayType;
using BaseType = GeoTCondition<TDim, TNumNodes>;

KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(GeoThermalPointFluxCondition);

GeoThermalPointFluxCondition();

GeoThermalPointFluxCondition(IndexType NewId, GeometryType::Pointer pGeometry);

GeoThermalPointFluxCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

Condition::Pointer Create(IndexType NewId, const NodesArrayType& rThisNodes, PropertiesType::Pointer pProperties) const override
{
return Kratos::make_intrusive<GeoThermalPointFluxCondition>(
NewId, this->GetGeometry().Create(rThisNodes), pProperties);
}

protected:
void CalculateRHS(Vector& rRightHandSideVector, const ProcessInfo& CurrentProcessInfo) override;

private:
friend class Serializer;

void save(Serializer& rSerializer) const override
{
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, BaseType)
}

void load(Serializer& rSerializer) override
{
KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, BaseType)
}
};

} // namespace Kratos
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ void KratosGeoMechanicsApplication::Register() {
KRATOS_REGISTER_CONDITION("GeoTNormalFluxCondition3D8N", mGeoTNormalFluxCondition3D8N)
KRATOS_REGISTER_CONDITION("GeoTNormalFluxCondition3D9N", mGeoTNormalFluxCondition3D9N)

KRATOS_REGISTER_CONDITION("GeoThermalPointFluxCondition2D1N", mGeoThermalPointFluxCondition2D1N)
KRATOS_REGISTER_CONDITION("GeoThermalPointFluxCondition3D1N", mGeoThermalPointFluxCondition3D1N)

KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition2D2N", mGeoTMicroClimateFluxCondition2D2N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition2D3N", mGeoTMicroClimateFluxCondition2D3N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition2D4N", mGeoTMicroClimateFluxCondition2D4N)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "custom_conditions/surface_load_3D_diff_order_condition.hpp"
#include "custom_conditions/surface_normal_fluid_flux_3D_diff_order_condition.hpp"
#include "custom_conditions/surface_normal_load_3D_diff_order_condition.hpp"
#include "custom_conditions/thermal_point_flux_condition.h"

// Geometries
#include "geometries/hexahedra_3d_20.h"
Expand Down Expand Up @@ -561,6 +562,9 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) KratosGeoMechanicsApplication : publ
const GeoTNormalFluxCondition<3, 8> mGeoTNormalFluxCondition3D8N{ 0, Kratos::make_shared< Quadrilateral3D8 <NodeType> >(Condition::GeometryType::PointsArrayType(8)) };
const GeoTNormalFluxCondition<3, 9> mGeoTNormalFluxCondition3D9N{ 0, Kratos::make_shared< Quadrilateral3D9 <NodeType> >(Condition::GeometryType::PointsArrayType(9)) };

const GeoThermalPointFluxCondition<2, 1> mGeoThermalPointFluxCondition2D1N{ 0, Kratos::make_shared<Point2D<NodeType>>(Condition::GeometryType::PointsArrayType(1)) };
const GeoThermalPointFluxCondition<3, 1> mGeoThermalPointFluxCondition3D1N{ 0, Kratos::make_shared<Point3D<NodeType>>(Condition::GeometryType::PointsArrayType(1)) };

const GeoTMicroClimateFluxCondition<2, 2> mGeoTMicroClimateFluxCondition2D2N{0, Kratos::make_shared<Line2D2 <NodeType>>(Condition::GeometryType::PointsArrayType(2))};
const GeoTMicroClimateFluxCondition<2, 3> mGeoTMicroClimateFluxCondition2D3N{0, Kratos::make_shared<Line2D3 <NodeType>>(Condition::GeometryType::PointsArrayType(3))};
const GeoTMicroClimateFluxCondition<2, 4> mGeoTMicroClimateFluxCondition2D4N{0, Kratos::make_shared<Line2D4 <NodeType>>(Condition::GeometryType::PointsArrayType(4))};
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"properties": [{
"model_part_name": "PorousDomain.Soil",
"properties_id": 1,
"Material": {
"constitutive_law": {
"name" : "GeoThermalDispersion2DLaw"
},
"Variables": {
"DENSITY_SOLID" : 2650,
"DENSITY_WATER" : 1000,
"POROSITY" : 0.36,
"RETENTION_LAW" : "SaturatedLaw",
"SATURATED_SATURATION" : 1.0,
"SPECIFIC_HEAT_CAPACITY_SOLID" : 400.0,
"SPECIFIC_HEAT_CAPACITY_WATER" : 3795.0,
"THERMAL_CONDUCTIVITY_SOLID_XX" : 1.50,
"THERMAL_CONDUCTIVITY_WATER" : 0.48,
"CROSS_AREA" : 0.3
},
"Tables": {}
}
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"properties": [{
"model_part_name": "PorousDomain.Soil",
"properties_id": 1,
"Material": {
"constitutive_law": {
"name" : "GeoThermalDispersion3DLaw"
},
"Variables": {
"DENSITY_SOLID" : 2650,
"DENSITY_WATER" : 1000,
"POROSITY" : 0.36,
"RETENTION_LAW" : "SaturatedLaw",
"SATURATED_SATURATION" : 1.0,
"SPECIFIC_HEAT_CAPACITY_SOLID" : 400.0,
"SPECIFIC_HEAT_CAPACITY_WATER" : 3795.0,
"THERMAL_CONDUCTIVITY_SOLID_XX" : 1.50,
"THERMAL_CONDUCTIVITY_WATER" : 0.48,
"CROSS_AREA" : 0.3
},
"Tables": {}
}
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Test Cases for Thermal Point Flux Condition

**Author:** [Mohamed Nabi](https://github.com/mnabideltares)

**Source files:** [Thermal line element with point flux condition](https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_thermal_element/test_thermal_heat_flux_line_element)

## Case Specification
In this thermal test case, a 1 m high soil column is considered, where the initial temperature in the entire domain is set to 0 $\mathrm{[^\circ C]}$. The top boundary condition is set to be 0 $\mathrm{[^\circ C]}$. A heat flux of 100 $\mathrm{[W/m^2]}$ is set at the bottom boundary. The simulation spans 250 days to allow for a transition from the initial condition to a linear temperature profile between the two sides. This test is conducted for various configurations, including 2D2N, 2D3N, 2D4N, 2D5N, 3D2N and 3D3N line elements. The temperature distribution along the depth is then evaluated with its own result.
The boundary conditions are shown below:

<img src="../documentation_data/test_thermal_point_flux_condition.svg" alt="Visualization of the Boundary conditions" title="Visualization of the Boundary conditions" width="600">

## Results

The picture below illustrates the temperature distribution resulting from the simulation (as an example the 2D3N test is shown below).

<img src="../documentation_data/test_thermal_point_flux_condition_2D3N_result.png" alt="Temperature along the depth at the last time step" title="Temperature along the depth at the last time step" width="600">

These results are associated with the final time step after the solution reaches a steady state. The analytical solution is:

$T = \frac{q}{D} \left( 1 - y \right)$

where $q$ is flux per cross sectional area and $D$ is the dispersion coefficient.

$q = \frac{Q}{A} = \frac{30}{0.3} = 100 \mathrm{[W/m^2]}$ and $D = 1.1328 $
$D = n S \lambda^w + (1-n) \lambda^s = 0.36 \times 1 \times 0.48 + (1-0.36) \times 1.5 = 1.1328 \mathrm{[W/m ^\circ C]}$

where, $Q \mathrm{[W]}$ is the total flux, $A \mathrm{[m^2]}$ is the cross section area, $n \mathrm{[-]}$ porosity, $S \mathrm{[-]}$ the saturation, $\lambda^w \mathrm{[W/m ^\circ C]}$ water thermal conductivity and $\lambda^s \mathrm{[W/m ^\circ C]}$ is the soil thermal conductivity.

In this test case, the result at node number 1 at location the bottom of the column, namely at $y = 0 \mathrm{[m]}$, is compared with the analytical solution. The value of the temperature at node 1 is $\frac{100}{1.1328}$ $\mathrm{[^\circ C]}$
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"problem_data": {
"problem_name": "test_thermal_point_flux_2D2N",
"start_time": 0.0,
"end_time": 21600000,
"echo_level": 1,
"parallel_type": "OpenMP",
"number_of_threads": 1
},
"solver_settings": {
"solver_type": "T",
"model_part_name": "PorousDomain",
"domain_size": 2,
"model_import_settings": {
"input_type": "mdpa",
"input_filename": "test_thermal_point_flux_2D2N"
},
"material_import_settings": {
"materials_filename": "../Common/MaterialParameters2D.json"
},
"time_stepping": {
"time_step": 600,
"max_delta_time_factor": 1000
},
"buffer_size": 2,
"echo_level": 1,
"clear_storage": false,
"compute_reactions": false,
"move_mesh_flag": false,
"reform_dofs_at_each_step": false,
"nodal_smoothing": false,
"block_builder": true,
"solution_type": "Transient_Heat_Transfer",
"scheme_type": "Backward_Euler",
"reset_displacements": true,
"newmark_beta": 0.25,
"newmark_gamma": 0.5,
"newmark_theta": 0.5,
"rayleigh_m": 0.0,
"rayleigh_k": 0.0,
"strategy_type": "newton_raphson",
"convergence_criterion": "temperature_criterion",
"temperature_relative_tolerance": 1.0E-4,
"temperature_absolute_tolerance": 1.0E-9,
"residual_relative_tolerance": 1.0E-4,
"residual_absolute_tolerance": 1.0E-9,
"min_iterations": 6,
"max_iterations": 15,
"number_cycles": 100,
"reduction_factor": 0.5,
"increase_factor": 2.0,
"desired_iterations": 4,
"max_radius_factor": 10.0,
"min_radius_factor": 0.1,
"calculate_reactions": true,
"max_line_search_iterations": 5,
"first_alpha_value": 0.5,
"second_alpha_value": 1.0,
"min_alpha": 0.1,
"max_alpha": 2.0,
"line_search_tolerance": 0.5,
"rotation_dofs": true,
"linear_solver_settings": {
"solver_type": "LinearSolversApplication.sparse_lu",
"scaling": true
},
"problem_domain_sub_model_part_list": ["Soil"],
"processes_sub_model_part_list": ["top","bottom"],
"body_domain_sub_model_part_list": ["Soil"]
},
"output_processes": {
"gid_output": [{
"python_module": "gid_output_process",
"kratos_module": "KratosMultiphysics",
"process_name": "GiDOutputProcess",
"Parameters": {
"model_part_name": "PorousDomain.porous_computational_model_part",
"output_name": "test_thermal_point_flux_2D2N",
"postprocess_parameters": {
"result_file_configuration": {
"gidpost_flags": {
"WriteDeformedMeshFlag": "WriteUndeformed",
"WriteConditionsFlag": "WriteElementsOnly",
"GiDPostMode": "GiD_PostAscii",
"MultiFileFlag": "SingleFile"
},
"file_label": "step",
"output_control_type": "step",
"output_interval": 1,
"body_output": true,
"node_output": false,
"skin_output": false,
"plane_output": [],
"nodal_results": ["TEMPERATURE"],
"gauss_point_results": []
},
"point_data_configuration": []
}
}
}]
},
"processes": {
"constraints_process_list": [{
"python_module": "apply_scalar_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyScalarConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.Soil",
"variable_name": "TEMPERATURE",
"is_fixed": false,
"value": 0.0,
"table": 0
}
},{
"python_module": "apply_scalar_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyScalarConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.top",
"variable_name": "TEMPERATURE",
"is_fixed": true,
"value": 0.0,
"table": 0
}
}],
"loads_process_list": [{
"python_module": "apply_scalar_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyScalarConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.bottom",
"variable_name": "NORMAL_HEAT_FLUX",
"value": 30.0,
"table": 0
}
}],
"auxiliar_process_list": []
}
}
Loading

0 comments on commit 44468d2

Please sign in to comment.