-
Notifications
You must be signed in to change notification settings - Fork 40
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
CHT example with CoSim #138
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (ρ): 1.0 _Kg/m<sup>3</sup>_ | ||
* Kinematic viscosity (μ): 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 (κ): 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 (ρ): 4.0 _Kg/m<sub>3</sub>_ | ||
* Conductivity (κ): 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) |
Binary file added
BIN
+3.87 MB
co_simulation/validation/cylinder_cooling/data/cylinder_cooling_Re100_Pr2_p.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.5 MB
co_simulation/validation/cylinder_cooling/data/cylinder_cooling_Re100_Pr2_t.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.88 MB
co_simulation/validation/cylinder_cooling/data/cylinder_cooling_Re100_Pr2_v.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
co_simulation/validation/cylinder_cooling/source/BuoyancyMaterials.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
112
co_simulation/validation/cylinder_cooling/source/CoSim.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
co_simulation/validation/cylinder_cooling/source/ConvectionDiffusionMaterials.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
25
co_simulation/validation/cylinder_cooling/source/MainKratos.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubenzorrilla it is the same example, and it is referenced to the original source. I keep the original description to help potential reader faster understand the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Fair enough. No objections from my side.