Skip to content

Commit

Permalink
Merge pull request #138 from KratosMultiphysics/adding_CHT_CoSim_Example
Browse files Browse the repository at this point in the history
CHT example with CoSim
  • Loading branch information
Igarizza authored Sep 5, 2024
2 parents de55239 + 16f9f6d commit 314ee6b
Show file tree
Hide file tree
Showing 12 changed files with 45,705 additions and 0 deletions.
48 changes: 48 additions & 0 deletions co_simulation/validation/cylinder_cooling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Cylinder cooling Re = 100 and Pr = 2

**Author:** [Ihar Antonau](https://github.com/Igarizza)

**Kratos version:** 9.5

**Source files:** [Cylinder cooling Re = 100 and Pr = 2](https://github.com/KratosMultiphysics/Examples/tree/master/co_simulation/validation/cylinder_cooling/source)

## Case Specification

#### The test case is implemented based on the [CHT example](https://github.com/KratosMultiphysics/Examples/tree/master/conjugate_heat_transfer/validation/cylinder_cooling_Re100_Pr2) using CoSimulationApplication.

This is a 2D Conjugate Heat Transfer (CHT) simulation of a cylinder cooling procedure. The flow and material parameters are set such that the Reynolds number is 100 while the Prandtl one is 2.

The geometry consists in a 5 x 2 m channel inside which the cylinder is placed. The center of the cylinder is placed in (0.9375,1.0) coordinates and its radius is 0.0625 m. For the CFD problem, the cylinder is considered to be no-slip while the top and bottom walls are slip. The pressure is fixed along the right edge. A constant inlet equal to 1.0 m/s, is set in the left edge. Concerning the thermal problem, the temperature is fixed to 0 K in the CFD domain left edge while an initial temperature of 1 K is set in the entire cylinder (solid) domain.

Concerning the material properties, a Newtonian constitutive law is used in the CFD problem. Considering that the cylinder diameter is 0.125 m and the mean velocity is 1 m/s, the fluid characteristic parameters to obtain a 100 Re flow are:
* Density (&rho;): 1.0 _Kg/m<sup>3</sup>_
* Kinematic viscosity (&mu;): 1.25E-03 _Kg/ms_

For the coupled thermal problem, the properties are set such that the difusivity as well as the volumetric heat capacity of both materials is the same. This is achieved by setting the fluid values to
* Conductivity (&kappa;): 6.25E-01 _W/m<sup>2</sup>K_
* Specific heat (c<inf>p</inf>): 1.0E+03 _J/Kg·K_

and the solid values to
* Density (&rho;): 4.0 _Kg/m<sub>3</sub>_
* Conductivity (&kappa;): 2.0E+03 _W/m<sup>2</sup>K_
* Specific heat (c<sub>p</sub>): 2.5E+02 _J/Kg·K_

The time step is 0.1 seconds, while the total simulation time is 15.0 seconds.

## Results
The obtained velocity, pressure and temperature fields are shown in the animations below. As can be observed, the expected 100 Re Von Karman vortex street is developed in the downstream region of the cylinder. The affectation of the velocity solution periodicity can be also observed in the fluid temperature field. Furthermore, the correctness of the thermal coupling is also proved since no temperature discontinuities can be noted in the fluid-solid interface.

<p align="center">
<img src="data/cylinder_cooling_Re100_Pr2_v.gif" alt="Cylinder cooling Re = 100 and Pr = 2 velocity field [m/s]." style="width: 600px;"/>
</p>

<p align="center">
<img src="data/cylinder_cooling_Re100_Pr2_p.gif" alt="Cylinder cooling Re = 100 and Pr = 2 pressure field [Pa]." style="width: 600px;"/>
</p>

<p align="center">
<img src="data/cylinder_cooling_Re100_Pr2_t.gif" alt="Cylinder cooling Re = 100 and Pr = 2 temperature field [K]." style="width: 600px;"/>
</p>

## References
Wang, Zimeng & Colin, Fabrice & Le, Guigao & Zhang, Junfeng. (2017). Counter-Extrapolation Method for Conjugate Heat and Mass Transfer with Interfacial Discontinuity. International Journal of Numerical Methods for Heat and Fluid Flow. 27. 2231-2258. 10.1108/HFF-10-2016-0422. [Link to the publication](https://www.researchgate.net/publication/311681538_Counter-Extrapolation_Method_for_Conjugate_Heat_and_Mass_Transfer_with_Interfacial_Discontinuity)
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.
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,15 @@
{
"properties" : [{
"model_part_name" : "FluidModelPart.Parts_Fluid",
"properties_id" : 1,
"Material" : {
"Variables" : {
"DENSITY" : 1.0,
"DYNAMIC_VISCOSITY" : 0.00125,
"CONDUCTIVITY" : 0.625,
"SPECIFIC_HEAT" : 1000.0
},
"Tables" : {}
}
}]
}
112 changes: 112 additions & 0 deletions co_simulation/validation/cylinder_cooling/source/CoSim.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"problem_data": {
"start_time": 0.0,
"end_time": 15.0,
"echo_level": 0,
"print_colors": true,
"parallel_type": "OpenMP"
},
"solver_settings": {
"type": "coupled_solvers.gauss_seidel_strong",
"echo_level": 3,
"predictors": [],
"data_transfer_operators": {
"mapper": {
"type": "kratos_mapping",
"mapper_settings": {
"mapper_type": "nearest_neighbor"
}
}
},
"num_coupling_iterations": 10,
"convergence_accelerators": [],
"coupling_operations" : {
"distribute_point_values" : {
"type" : "distribute_point_values",
"redistribution_iterations" : 100,
"redistribution_tolerance" : 1e-6,
"solver" : "solid",
"data_point_values" : "reaction",
"data_distributed_values" : "flux",
"entities" : "conditions"
}
},
"convergence_criteria": [
{
"type": "relative_norm_previous_residual",
"solver": "fluid",
"data_name": "temp",
"abs_tolerance": 1e-3,
"rel_tolerance": 1e-3
}
],
"coupling_sequence": [
{
"name": "solid",
"input_data_list": [
{
"data": "reaction",
"from_solver": "fluid",
"from_solver_data": "reaction",
"data_transfer_operator": "mapper",
"data_transfer_operator_options": [
"swap_sign"
],
"after_data_transfer_operations":["distribute_point_values"]
}
],
"output_data_list": [
{
"data": "temp",
"to_solver": "fluid",
"to_solver_data": "temp",
"data_transfer_operator": "mapper"
}
]
},
{
"name": "fluid",
"output_data_list": [],
"input_data_list": []
}
],
"solvers": {
"fluid": {
"type": "solver_wrappers.kratos.convection_diffusion_wrapper",
"solver_wrapper_settings": {
"input_file": "ProjectParametersFTHERMAL"
},
"data": {
"temp": {
"model_part_name": "ThermalModelPart.FluidThermalInterface2D_Fluid_Interface",
"variable_name": "TEMPERATURE"
},
"reaction": {
"model_part_name": "ThermalModelPart.FluidThermalInterface2D_Fluid_Interface",
"variable_name": "REACTION_FLUX"
}
}
},
"solid": {
"type": "solver_wrappers.kratos.convection_diffusion_wrapper",
"solver_wrapper_settings": {
"input_file": "ProjectParametersSOLID"
},
"data": {
"temp": {
"model_part_name": "Parts_Solid.SolidThermalInterface2D_Solid_Interface",
"variable_name": "TEMPERATURE"
},
"reaction": {
"model_part_name": "Parts_Solid.SolidThermalInterface2D_Solid_Interface",
"variable_name": "REACTION_FLUX"
},
"flux": {
"model_part_name": "Parts_Solid.SolidThermalInterface2D_Solid_Interface",
"variable_name": "FACE_HEAT_FLUX"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"properties" : [{
"model_part_name" : "Parts_Solid",
"properties_id" : 2,
"Material" : {
"Variables" : {
"DENSITY" : 4.0,
"CONDUCTIVITY" : 2000.0,
"SPECIFIC_HEAT" : 250.0
},
"Tables" : {}
}
}]
}
25 changes: 25 additions & 0 deletions co_simulation/validation/cylinder_cooling/source/MainKratos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import KratosMultiphysics as KM
from KratosMultiphysics.CoSimulationApplication.co_simulation_analysis import CoSimulationAnalysis
import time

# get the start time
st = time.time()

"""
For user-scripting it is intended that a new class is derived
from CoSimulationAnalysis to do modifications
Check also "kratos/python_scripts/analysis-stage.py" for available methods that can be overridden
"""

parameter_file_name = "CoSim.json"
with open(parameter_file_name,'r') as parameter_file:
parameters = KM.Parameters(parameter_file.read())

simulation = CoSimulationAnalysis(parameters)
simulation.Run()

# get the end time
et = time.time()
# get the execution time
elapsed_time = et - st
print('Execution time:', elapsed_time, 'seconds')
Loading

0 comments on commit 314ee6b

Please sign in to comment.