Skip to content

Commit e82c150

Browse files
adding thermomechanical coupling
1 parent df1aed7 commit e82c150

5 files changed

Lines changed: 15547 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"properties" : [{
3+
"model_part_name" : "ThermalModelPart.CNVDFFParts_Parts_Auto1",
4+
"properties_id" : 1,
5+
"Material" : {
6+
"Variables" : {
7+
"DENSITY" : 7850.0,
8+
"CONDUCTIVITY" : 50.0e3,
9+
"SPECIFIC_HEAT" : 460.0
10+
},
11+
"Tables" : {}
12+
}
13+
}]
14+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
2+
3+
import KratosMultiphysics
4+
from KratosMultiphysics.ConvectionDiffusionApplication.convection_diffusion_analysis import ConvectionDiffusionAnalysis
5+
6+
import sys
7+
import time
8+
9+
class ConvectionDiffusionAnalysisWithFlush(ConvectionDiffusionAnalysis):
10+
11+
def __init__(self,model,project_parameters,flush_frequency=10.0):
12+
super(ConvectionDiffusionAnalysisWithFlush,self).__init__(model,project_parameters)
13+
14+
self.flush_frequency = flush_frequency
15+
self.last_flush = time.time()
16+
17+
def FinalizeSolutionStep(self):
18+
super(ConvectionDiffusionAnalysisWithFlush,self).FinalizeSolutionStep()
19+
20+
if self.parallel_type == "OpenMP":
21+
now = time.time()
22+
if now - self.last_flush > self.flush_frequency:
23+
sys.stdout.flush()
24+
self.last_flush = now
25+
26+
if __name__ == "__main__":
27+
28+
with open("ProjectParameters.json",'r') as parameter_file:
29+
parameters = KratosMultiphysics.Parameters(parameter_file.read())
30+
31+
model = KratosMultiphysics.Model()
32+
simulation = ConvectionDiffusionAnalysisWithFlush(model,parameters)
33+
simulation.Run()
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
{
2+
"problem_data" : {
3+
"problem_name" : "coupled_problem",
4+
"parallel_type" : "OpenMP",
5+
"start_time" : 0.0,
6+
"end_time" : 200.0,
7+
"echo_level" : 0
8+
},
9+
"solver_settings" : {
10+
"solver_type" : "ThermoMechanicallyCoupled",
11+
"domain_size" : 2,
12+
"echo_level" : 0,
13+
"structural_solver_settings" : {
14+
"solver_type" : "Static",
15+
"model_part_name" : "Structure",
16+
"domain_size" : 2,
17+
"echo_level" : 1,
18+
"analysis_type" : "non_linear",
19+
"model_import_settings" : {
20+
"input_type" : "mdpa",
21+
"input_filename" : "coupled_problem"
22+
},
23+
"material_import_settings" : {
24+
"materials_filename" : "StructuralMaterials.json"
25+
},
26+
"time_stepping" : {
27+
"time_step" : 1.0
28+
},
29+
"line_search" : false,
30+
"convergence_criterion" : "residual_criterion",
31+
"displacement_relative_tolerance" : 0.0001,
32+
"displacement_absolute_tolerance" : 1e-9,
33+
"residual_relative_tolerance" : 0.0001,
34+
"residual_absolute_tolerance" : 1e-8,
35+
"max_iteration" : 10,
36+
"rotation_dofs" : false
37+
},
38+
"thermal_solver_settings" : {
39+
"solver_type" : "stationary",
40+
"analysis_type" : "non_linear",
41+
"model_part_name" : "ThermalModelPart",
42+
"domain_size" : 2,
43+
"model_import_settings" : {
44+
"input_type" : "mdpa",
45+
"input_filename" : "coupled_problem"
46+
},
47+
"material_import_settings" : {
48+
"materials_filename" : "ConvectionDiffusionMaterials.json"
49+
},
50+
"line_search" : false,
51+
"echo_level" : 1,
52+
"compute_reactions" : false,
53+
"max_iteration" : 10,
54+
"convergence_criterion" : "residual_criterion",
55+
"solution_relative_tolerance" : 1e-5,
56+
"solution_absolute_tolerance" : 1e-7,
57+
"residual_relative_tolerance" : 1e-5,
58+
"residual_absolute_tolerance" : 1e-7,
59+
"problem_domain_sub_model_part_list" : ["CNVDFFParts_Parts_Auto1"],
60+
"processes_sub_model_part_list" : ["TEMPERATURE_Temperature_Auto1","ImposedTemperature2D_Imposed_temperature_Auto1","HeatFlux2D_External_heat_flux_Auto1"],
61+
"time_stepping" : {
62+
"time_step" : 1.0
63+
}
64+
}
65+
},
66+
"processes" : {
67+
"initial_conditions_process_list" : [{
68+
"python_module" : "assign_scalar_variable_process",
69+
"kratos_module" : "KratosMultiphysics",
70+
"process_name" : "AssignScalarVariableProcess",
71+
"Parameters" : {
72+
"model_part_name" : "ThermalModelPart.TEMPERATURE_Temperature_Auto1",
73+
"variable_name" : "TEMPERATURE",
74+
"interval" : [0.0,0.0],
75+
"constrained" : false,
76+
"value" : 0.0
77+
}
78+
}],
79+
"constraints_process_list" : [{
80+
"python_module" : "assign_scalar_variable_process",
81+
"kratos_module" : "KratosMultiphysics",
82+
"process_name" : "AssignScalarVariableProcess",
83+
"Parameters" : {
84+
"model_part_name" : "ThermalModelPart.ImposedTemperature2D_Imposed_temperature_Auto1",
85+
"variable_name" : "TEMPERATURE",
86+
"interval" : [0.0,"End"],
87+
"constrained" : true,
88+
"value" : 25.2
89+
}
90+
},{
91+
"python_module" : "assign_vector_variable_process",
92+
"kratos_module" : "KratosMultiphysics",
93+
"process_name" : "AssignVectorVariableProcess",
94+
"Parameters" : {
95+
"model_part_name" : "Structure.DISPLACEMENT_Displacement_Auto1",
96+
"variable_name" : "DISPLACEMENT",
97+
"interval" : [0.0,"End"],
98+
"constrained" : [true,true,true],
99+
"value" : [0.0,0.0,0.0]
100+
}
101+
},{
102+
"python_module" : "assign_scalar_variable_process",
103+
"kratos_module" : "KratosMultiphysics",
104+
"process_name" : "AssignScalarVariableProcess",
105+
"Parameters" : {
106+
"model_part_name" : "ThermalModelPart.HeatFlux2D_External_heat_flux_Auto1",
107+
"variable_name" : "FACE_HEAT_FLUX",
108+
"interval" : [0.0,0.0],
109+
"constrained" : false,
110+
"value" : 50000000.0
111+
}
112+
}],
113+
"loads_process_list" : [{
114+
"python_module" : "assign_vector_by_direction_process",
115+
"kratos_module" : "KratosMultiphysics",
116+
"check" : "DirectorVectorNonZero direction",
117+
"process_name" : "AssignVectorByDirectionProcess",
118+
"Parameters" : {
119+
"model_part_name" : "Structure.SelfWeight2D_Self_weight_Auto1",
120+
"variable_name" : "VOLUME_ACCELERATION",
121+
"interval" : [0.0,"End"],
122+
"constrained" : false,
123+
"modulus" : 9.81,
124+
"direction" : [0.0,-1.0,0.0]
125+
}
126+
}],
127+
"list_other_processes" : [{
128+
"python_module" : "assign_scalar_variable_process",
129+
"kratos_module" : "KratosMultiphysics",
130+
"process_name" : "AssignScalarVariableProcess",
131+
"Parameters" : {
132+
"model_part_name" : "ThermalModelPart.CNVDFFParts_Parts_Auto1",
133+
"variable_name" : "HEAT_FLUX",
134+
"value" : 0.0,
135+
"constrained" : false
136+
}
137+
}]
138+
},
139+
"output_processes" : {
140+
"gid_output" : [{
141+
"python_module" : "gid_output_process",
142+
"kratos_module" : "KratosMultiphysics",
143+
"process_name" : "GiDOutputProcess",
144+
"help" : "This process writes postprocessing files for GiD",
145+
"Parameters" : {
146+
"model_part_name" : "Structure",
147+
"output_name" : "coupled_problem",
148+
"postprocess_parameters" : {
149+
"result_file_configuration" : {
150+
"gidpost_flags" : {
151+
"GiDPostMode" : "GiD_PostBinary",
152+
"WriteDeformedMeshFlag" : "WriteDeformed",
153+
"WriteConditionsFlag" : "WriteElementsOnly",
154+
"MultiFileFlag" : "SingleFile"
155+
},
156+
"file_label" : "step",
157+
"output_control_type" : "step",
158+
"output_frequency" : 5,
159+
"body_output" : true,
160+
"node_output" : false,
161+
"skin_output" : false,
162+
"plane_output" : [],
163+
"nodal_results" : ["TEMPERATURE", "DISPLACEMENT","VELOCITY","MESH_VELOCITY"],
164+
"gauss_point_results" : ["CAUCHY_STRESS_VECTOR", "REFERENCE_TEMPERATURE"]
165+
},
166+
"point_data_configuration" : []
167+
}
168+
}
169+
}],
170+
"vtk_output" : []
171+
},
172+
"restart_options" : {
173+
"SaveRestart" : "False",
174+
"RestartFrequency" : 0,
175+
"LoadRestart" : "False",
176+
"Restart_Step" : 0
177+
}
178+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"properties" : [{
3+
"model_part_name" : "Structure.Parts_Solid_Solid_Auto1",
4+
"properties_id" : 1,
5+
"Material" : {
6+
"constitutive_law" : {
7+
"name" : "ThermalLinearPlaneStrain"
8+
9+
},
10+
"Variables" : {
11+
"DENSITY" : 7850.0,
12+
"YOUNG_MODULUS" : 2.1e11,
13+
"POISSON_RATIO" : 0.29,
14+
"THERMAL_EXPANSION_COEFFICIENT" : 7.2e-6,
15+
"REFERENCE_TEMPERATURE" : 22.5
16+
},
17+
"Tables" : {
18+
"TEMPERATURE_vs_E" : {
19+
"input_variable" : "TEMPERATURE",
20+
"output_variable" : "YOUNG_MODULUS",
21+
"data" : [[-1, 2.1e11],
22+
[3500, 2.1e8 ],
23+
[1e6, 2.1e8 ]]
24+
}
25+
}
26+
}
27+
}]
28+
}

0 commit comments

Comments
 (0)