Skip to content
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

Adding ThermoMechanical example: couplinbg between the ConvectionDiffusion and the StructuralMechanics apps #88

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Example of coupled thermo-mechanical calculation

**Author:** Alejandro Cornejo Velázquez

**Kratos version:** Current Head

**Source files:** [ThermoMechanical test](https://github.com/KratosMultiphysics/Examples/tree/master/structural_mechanics/use_cases/thermo_mechanical_coupling/source)

## Problem definition

The problem consists on a ThermoMechanical test. In this case, an Eulerian convection-diffusion calcuation is performed and then a Lagrangian structural calculation is conducted. In this case, the temperature increment induces thermal strains (expansion in this case) and the material properties of the structural calculation are also affected (young modulus in this case).

- The simple mesh:

<img src="data/mesh.png" width="600">

- The result at t=0:

<img src="data/t_0.png" width="600">

- The result at t=100:

<img src="data/t_100.png" width="600">

- The result at t=200:

<img src="data/t_200.png" width="600">

## Results

The whole animation:

<img src="data/video_1.gif" width="600">


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.
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,14 @@
{
"properties" : [{
"model_part_name" : "ThermalModelPart.CNVDFFParts_Parts_Auto1",
"properties_id" : 1,
"Material" : {
"Variables" : {
"DENSITY" : 7850.0,
"CONDUCTIVITY" : 50.0e3,
"SPECIFIC_HEAT" : 460.0
},
"Tables" : {}
}
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7

import KratosMultiphysics
from KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis import ConvectionDiffusionAnalysis

import sys
import time

class ConvectionDiffusionAnalysisWithFlush(ConvectionDiffusionAnalysis):

def __init__(self,model,project_parameters,flush_frequency=10.0):
super(ConvectionDiffusionAnalysisWithFlush,self).__init__(model,project_parameters)

self.flush_frequency = flush_frequency
self.last_flush = time.time()

def FinalizeSolutionStep(self):
super(ConvectionDiffusionAnalysisWithFlush,self).FinalizeSolutionStep()

if self.parallel_type == "OpenMP":
now = time.time()
if now - self.last_flush > self.flush_frequency:
sys.stdout.flush()
self.last_flush = now

if __name__ == "__main__":

with open("ProjectParameters.json",'r') as parameter_file:
parameters = KratosMultiphysics.Parameters(parameter_file.read())

model = KratosMultiphysics.Model()
simulation = ConvectionDiffusionAnalysisWithFlush(model,parameters)
simulation.Run()
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
{
"problem_data" : {
"problem_name" : "coupled_problem",
"parallel_type" : "OpenMP",
"start_time" : 0.0,
"end_time" : 200.0,
"echo_level" : 0
},
"solver_settings" : {
"solver_type" : "ThermoMechanicallyCoupled",
"domain_size" : 2,
"echo_level" : 0,
"structural_solver_settings" : {
"solver_type" : "Static",
"model_part_name" : "Structure",
"domain_size" : 2,
"echo_level" : 1,
"analysis_type" : "non_linear",
"model_import_settings" : {
"input_type" : "mdpa",
"input_filename" : "coupled_problem"
},
"material_import_settings" : {
"materials_filename" : "StructuralMaterials.json"
},
"time_stepping" : {
"time_step" : 1.0
},
"line_search" : false,
"convergence_criterion" : "residual_criterion",
"displacement_relative_tolerance" : 0.0001,
"displacement_absolute_tolerance" : 1e-9,
"residual_relative_tolerance" : 0.0001,
"residual_absolute_tolerance" : 1e-8,
"max_iteration" : 10,
"rotation_dofs" : false
},
"thermal_solver_settings" : {
"solver_type" : "stationary",
"analysis_type" : "non_linear",
"model_part_name" : "ThermalModelPart",
"domain_size" : 2,
"model_import_settings" : {
"input_type" : "mdpa",
"input_filename" : "coupled_problem"
},
"material_import_settings" : {
"materials_filename" : "ConvectionDiffusionMaterials.json"
},
"line_search" : false,
"echo_level" : 1,
"compute_reactions" : false,
"max_iteration" : 10,
"convergence_criterion" : "residual_criterion",
"solution_relative_tolerance" : 1e-5,
"solution_absolute_tolerance" : 1e-7,
"residual_relative_tolerance" : 1e-5,
"residual_absolute_tolerance" : 1e-7,
"problem_domain_sub_model_part_list" : ["CNVDFFParts_Parts_Auto1"],
"processes_sub_model_part_list" : ["TEMPERATURE_Temperature_Auto1","ImposedTemperature2D_Imposed_temperature_Auto1","HeatFlux2D_External_heat_flux_Auto1"],
"time_stepping" : {
"time_step" : 1.0
}
}
},
"processes" : {
"initial_conditions_process_list" : [{
"python_module" : "assign_scalar_variable_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "AssignScalarVariableProcess",
"Parameters" : {
"model_part_name" : "ThermalModelPart.TEMPERATURE_Temperature_Auto1",
"variable_name" : "TEMPERATURE",
"interval" : [0.0,0.0],
"constrained" : false,
"value" : 0.0
}
}],
"constraints_process_list" : [{
"python_module" : "assign_scalar_variable_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "AssignScalarVariableProcess",
"Parameters" : {
"model_part_name" : "ThermalModelPart.ImposedTemperature2D_Imposed_temperature_Auto1",
"variable_name" : "TEMPERATURE",
"interval" : [0.0,"End"],
"constrained" : true,
"value" : 25.2
}
},{
"python_module" : "assign_vector_variable_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "AssignVectorVariableProcess",
"Parameters" : {
"model_part_name" : "Structure.DISPLACEMENT_Displacement_Auto1",
"variable_name" : "DISPLACEMENT",
"interval" : [0.0,"End"],
"constrained" : [true,true,true],
"value" : [0.0,0.0,0.0]
}
},{
"python_module" : "assign_scalar_variable_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "AssignScalarVariableProcess",
"Parameters" : {
"model_part_name" : "ThermalModelPart.HeatFlux2D_External_heat_flux_Auto1",
"variable_name" : "FACE_HEAT_FLUX",
"interval" : [0.0,0.0],
"constrained" : false,
"value" : 50000000.0
}
}],
"loads_process_list" : [{
"python_module" : "assign_vector_by_direction_process",
"kratos_module" : "KratosMultiphysics",
"check" : "DirectorVectorNonZero direction",
"process_name" : "AssignVectorByDirectionProcess",
"Parameters" : {
"model_part_name" : "Structure.SelfWeight2D_Self_weight_Auto1",
"variable_name" : "VOLUME_ACCELERATION",
"interval" : [0.0,"End"],
"constrained" : false,
"modulus" : 9.81,
"direction" : [0.0,-1.0,0.0]
}
}],
"list_other_processes" : [{
"python_module" : "assign_scalar_variable_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "AssignScalarVariableProcess",
"Parameters" : {
"model_part_name" : "ThermalModelPart.CNVDFFParts_Parts_Auto1",
"variable_name" : "HEAT_FLUX",
"value" : 0.0,
"constrained" : false
}
}]
},
"output_processes" : {
"gid_output" : [{
"python_module" : "gid_output_process",
"kratos_module" : "KratosMultiphysics",
"process_name" : "GiDOutputProcess",
"help" : "This process writes postprocessing files for GiD",
"Parameters" : {
"model_part_name" : "Structure",
"output_name" : "coupled_problem",
"postprocess_parameters" : {
"result_file_configuration" : {
"gidpost_flags" : {
"GiDPostMode" : "GiD_PostBinary",
"WriteDeformedMeshFlag" : "WriteDeformed",
"WriteConditionsFlag" : "WriteElementsOnly",
"MultiFileFlag" : "SingleFile"
},
"file_label" : "step",
"output_control_type" : "step",
"output_frequency" : 5,
"body_output" : true,
"node_output" : false,
"skin_output" : false,
"plane_output" : [],
"nodal_results" : ["TEMPERATURE", "DISPLACEMENT","VELOCITY","MESH_VELOCITY"],
"gauss_point_results" : ["CAUCHY_STRESS_VECTOR", "REFERENCE_TEMPERATURE"]
},
"point_data_configuration" : []
}
}
}],
"vtk_output" : []
},
"restart_options" : {
"SaveRestart" : "False",
"RestartFrequency" : 0,
"LoadRestart" : "False",
"Restart_Step" : 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties" : [{
"model_part_name" : "Structure.Parts_Solid_Solid_Auto1",
"properties_id" : 1,
"Material" : {
"constitutive_law" : {
"name" : "ThermalLinearPlaneStrain"

},
"Variables" : {
"DENSITY" : 7850.0,
"YOUNG_MODULUS" : 2.1e11,
"POISSON_RATIO" : 0.29,
"THERMAL_EXPANSION_COEFFICIENT" : 7.2e-6,
"REFERENCE_TEMPERATURE" : 22.5
},
"Tables" : {
"TEMPERATURE_vs_E" : {
"input_variable" : "TEMPERATURE",
"output_variable" : "YOUNG_MODULUS",
"data" : [[-1, 2.1e11],
[3500, 2.1e8 ],
[1e6, 2.1e8 ]]
}
}
}
}]
}

Large diffs are not rendered by default.