@@ -7,6 +7,8 @@ namespace eval ::ConjugateHeatTransfer::write {
77 variable writeAttributes
88 variable fluid_domain_solver_settings
99 variable solid_domain_solver_settings
10+
11+ variable mdpa_files
1012}
1113
1214proc ::ConjugateHeatTransfer::write::Init { } {
@@ -20,6 +22,7 @@ proc ::ConjugateHeatTransfer::write::Init { } {
2022 SetAttribute model_part_name [::ConjugateHeatTransfer::GetWriteProperty model_part_name]
2123
2224 SetAttribute coordinates [::ConjugateHeatTransfer::GetWriteProperty coordinates]
25+ SetAttribute write_mdpa_mode [::ConvectionDiffusion::GetWriteProperty write_mdpa_mode]
2326
2427 SetAttribute fluid_mdpa_suffix Fluid
2528 SetAttribute solid_mdpa_suffix Solid
@@ -28,10 +31,14 @@ proc ::ConjugateHeatTransfer::write::Init { } {
2831 variable solid_domain_solver_settings
2932 set fluid_domain_solver_settings [dict create]
3033 set solid_domain_solver_settings [dict create]
34+
35+ variable mdpa_files
36+ set mdpa_files []
3137}
3238
3339# Events
3440proc ::ConjugateHeatTransfer::write::writeModelPartEvent { } {
41+ variable mdpa_files
3542 # Validation
3643 set err [Validate]
3744 if {$err ne " " } {error $err }
@@ -41,13 +48,22 @@ proc ::ConjugateHeatTransfer::write::writeModelPartEvent { } {
4148 # Buoyancy mdpa
4249 ::ConjugateHeatTransfer::write::PrepareBuoyancy
4350 write::writeAppMDPA Buoyancy
44- write::RenameFileInModel " $filename .mdpa" " ${filename} _[ GetAttribute fluid_mdpa_suffix] .mdpa"
51+ set buoyancy_mdpa " ${filename} _[ GetAttribute fluid_mdpa_suffix] "
52+ write::RenameFileInModel " $filename .mdpa" ${buoyancy_mdpa} .mdpa
53+ lappend mdpa_files $buoyancy_mdpa
4554
4655 # Convection diffusion mdpa
4756 ConvectionDiffusion::write::Init
4857 ConvectionDiffusion::write::SetAttribute writeCoordinatesByGroups [GetAttribute coordinates]
58+
59+ set base_root_xpath [spdAux::getRoute CHTCNVDFF]
60+ set base_root [[customlib::GetBaseRoot] selectNodes $base_root_xpath ]
61+ set ::ConvectionDiffusion::write::base_root $base_root
62+
4963 write::writeAppMDPA ConvectionDiffusion
50- write::RenameFileInModel " $filename .mdpa" " ${filename} _[ GetAttribute solid_mdpa_suffix] .mdpa"
64+ set convdif_mdpa " ${filename} _[ GetAttribute solid_mdpa_suffix] "
65+ write::RenameFileInModel " $filename .mdpa" ${convdif_mdpa} .mdpa
66+ lappend mdpa_files $convdif_mdpa
5167}
5268
5369proc ::ConjugateHeatTransfer::write::writeCustomFilesEvent { } {
@@ -72,13 +88,31 @@ proc ::ConjugateHeatTransfer::write::PrepareBuoyancy { } {
7288}
7389
7490proc ::ConjugateHeatTransfer::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } {
75- Buoyancy ::write::WriteMaterialsFile $write_const_law $include_modelpart_name
91+ ConjugateHeatTransfer ::write::WriteBuoyancyMaterialsFile $write_const_law $include_modelpart_name
7692 ConvectionDiffusion::write::WriteMaterialsFile False $include_modelpart_name
7793}
7894
95+ proc ::ConjugateHeatTransfer::write::WriteBuoyancyMaterialsFile { {write_const_law True} {include_modelpart_name True} } {
96+ # # Write fluid material file
97+ set model_part_name " "
98+ if {[write::isBooleanTrue $include_modelpart_name ]} {set model_part_name [GetAttribute model_part_name]}
99+ set fluid_materials [Fluid::write::GetMaterialsFile $write_const_law $include_modelpart_name ]
100+ write::writePropertiesJsonFileDone [::Fluid::write::GetAttribute materials_file] $fluid_materials
101+
102+ # Write Buoyancy materials file
103+ set buoyancy_material [::Buoyancy::write::GetBuoyancyMaterialsFile $write_const_law $include_modelpart_name FluidThermalModelPart]
104+ set clear_mat [dict get $buoyancy_material properties]
105+ set clear_mat [lindex $clear_mat 0]
106+ dict set clear_mat model_part_name FluidThermalModelPart
107+ set clear_mat [dict create properties [list $clear_mat ]]
108+ write::writePropertiesJsonFileDone " BuoyancyMaterials.json" $clear_mat
109+ }
79110
80111proc ::ConjugateHeatTransfer::write::GetAttribute {att} {
81112 variable writeAttributes
113+ if {![dict exists $writeAttributes $att ]} {
114+ return " "
115+ }
82116 return [dict get $writeAttributes $att ]
83117}
84118
0 commit comments