Skip to content

MIGRATION - Write as geometries #985

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

Draft
wants to merge 80 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
07f7e89
Remove write mode from properties
jginternational Jul 11, 2024
ddb4e8a
Fluid gives no more chances to use old style by preferences
jginternational Jul 11, 2024
e2c64db
Write mdpa as geometries for buoyancy using fluid
jginternational Jul 11, 2024
3df6c3c
Make common code
jginternational Jul 11, 2024
34384e4
call modelers
jginternational Jul 11, 2024
0d75024
Fluid use common modelers func
jginternational Jul 11, 2024
18db6fa
Make common code
jginternational Jul 11, 2024
09743d5
Fluid use common modelers func
jginternational Jul 11, 2024
ca2543c
Enable write as geometries in potential flow app
jginternational Jul 18, 2024
d1ed236
modelers only in geom mode
jginternational Jul 18, 2024
fe05d6a
modelers only in geom mode
jginternational Jul 18, 2024
fbbd618
modelers only in geom mode
jginternational Jul 18, 2024
6c80229
Migrate structural
jginternational Jul 18, 2024
d7e4ad2
embedded working
jginternational Jul 18, 2024
a795465
free surface writes geometries
jginternational Jul 18, 2024
fa7c7c8
Only write geoms if there is at least 1 element
jginternational Jul 18, 2024
86d1b0d
Write compressible fluid as geometries
jginternational Jul 18, 2024
bc94236
Only write geoms if there is at least 1 element
jginternational Jul 18, 2024
6cc00a6
convection diffussion writes as geoms
jginternational Jul 18, 2024
5133366
material 0
jginternational Jul 19, 2024
b99f19b
material 0
jginternational Jul 19, 2024
48997c6
Merge branch 'write-geoms-migration' into compressible-migration-geoms
jginternational Jul 19, 2024
a33f174
Merge branch 'write-geoms-migration' into potential-geom-migration
jginternational Jul 19, 2024
638e092
Merge branch 'write-geoms-migration' into structural-migration-write-…
jginternational Jul 19, 2024
1d25c6b
comment
jginternational Jul 19, 2024
fd63405
comment
jginternational Jul 19, 2024
e3a4233
Merge branch 'write-geoms-migration' into freesurface-migration-geoms
jginternational Jul 19, 2024
ef6396c
Merge branch 'write-geoms-migration' into buoyancy-migration-as-geoms
jginternational Jul 19, 2024
1b22a19
Correct writing process
jginternational Jul 19, 2024
b0e653d
hotfix fluid write
jginternational Jul 19, 2024
6bbecaa
hotfix fluid write
jginternational Jul 19, 2024
f2d7526
Merge branch 'write-geoms-migration' into potential-geom-migration
jginternational Jul 19, 2024
40ed0f0
Merge pull request #986 from KratosMultiphysics/buoyancy-migration-as…
jginternational Jul 26, 2024
8caca1b
Merge pull request #988 from KratosMultiphysics/structural-migration-…
jginternational Jul 26, 2024
d167359
Merge branch 'write-geoms-migration' into convectiondiff-migration-geom
jginternational Jul 26, 2024
b92d409
Merge pull request #992 from KratosMultiphysics/convectiondiff-migrat…
jginternational Jul 26, 2024
a241c08
Merge pull request #991 from KratosMultiphysics/compressible-migratio…
jginternational Jul 26, 2024
9348ea9
Merge pull request #989 from KratosMultiphysics/embedded-migrate-geoms
jginternational Jul 26, 2024
58cffdf
protect
jginternational Jul 26, 2024
1fdc088
No need to write base
jginternational Jul 26, 2024
064636e
migrate shallow water
jginternational Jul 26, 2024
9767aff
Geometries for single node dont print geoms
jginternational Oct 9, 2024
6e624c8
config
jginternational Oct 9, 2024
7fc507d
comment
jginternational Oct 9, 2024
41c0d75
modeler
jginternational Oct 9, 2024
0d1dad9
Merge pull request #995 from KratosMultiphysics/shallowwater-migrate-…
jginternational Oct 9, 2024
4602a1c
Merge pull request #987 from KratosMultiphysics/potential-geom-migration
jginternational Oct 9, 2024
a70930e
Merge branch 'write-geoms-migration' into freesurface-migration-geoms
jginternational Oct 9, 2024
d6b9d9d
replace conditions name
jginternational Oct 10, 2024
ac96d70
reorder filters
jginternational Oct 10, 2024
20c449d
Merge pull request #990 from KratosMultiphysics/freesurface-migration…
jginternational Oct 10, 2024
49ed74b
Merge branch 'write-geoms-migration' into conjugate-migration
jginternational Oct 10, 2024
37949af
cht mdpa write split by domain
jginternational Oct 10, 2024
5182209
Write properly modelers and submodelparts
jginternational Oct 10, 2024
3923dbc
mdpa and proj params
jginternational Oct 11, 2024
63a2dcb
use_input_model_part
jginternational Oct 11, 2024
63b9943
minor fix
jginternational Oct 14, 2024
ab225bf
Adding QS-VMS axisymmetric element
rubenzorrilla Dec 9, 2024
8230ef3
Merge branch 'master' into conjugate-migration
jginternational Dec 13, 2024
66c63cf
Merge branch 'master' into write-geoms-migration
jginternational Dec 13, 2024
84acb28
Merge branch 'master' into fsi-geoms-migration
jginternational Dec 13, 2024
ba45c88
add ConnectivityPreserveModeler
jginternational Jan 17, 2025
ca0824a
fluid_interface
jginternational Jan 17, 2025
ccaa138
Change interface condition name
jginternational Jan 20, 2025
90302d6
check pair
jginternational Jan 21, 2025
3f73f40
prepare the proper modelparts
jginternational Jan 23, 2025
914b257
write ok
jginternational Jan 23, 2025
ab61e03
before mesh
jginternational Jan 24, 2025
ba6b287
missing check
jginternational Jan 24, 2025
c3220db
comment
jginternational Apr 24, 2025
82c9b79
safety check
jginternational Apr 24, 2025
f00d497
Merge branch 'write-geoms-migration' into conjugate-migration
jginternational Apr 24, 2025
4632125
missing UN
jginternational Apr 24, 2025
92991d8
Fluid materials in cht
jginternational Apr 24, 2025
1719687
ñapa final
jginternational Apr 24, 2025
6bf7ed7
typo
jginternational Apr 25, 2025
d6c6e95
Merge pull request #994 from KratosMultiphysics/conjugate-migration
jginternational Apr 26, 2025
71255b2
Merge branch 'write-geoms-migration' into fsi-geoms-migration
jginternational Apr 26, 2025
bb07382
variable name
jginternational Apr 26, 2025
de5c5e8
Merge pull request #996 from KratosMultiphysics/fsi-geoms-migration
jginternational Apr 26, 2025
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
2 changes: 1 addition & 1 deletion kratos.gid/apps/Buoyancy/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"coordinates": "all",
"properties_location": "json",
"model_part_name": "ThermalModelPart",
"write_mdpa_mode": "entities"
"write_mdpa_mode": "geometries"
},
"main_launch_file": "../../exec/MainKratos.py",
"examples": "examples/examples.xml"
Expand Down
60 changes: 26 additions & 34 deletions kratos.gid/apps/Buoyancy/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ proc ::Buoyancy::write::Init { } {
# Add thermal unique names to Fluid write variables
Fluid::write::SetAttribute thermal_bc_un [ConvectionDiffusion::write::GetAttribute conditions_un]
Fluid::write::SetAttribute thermal_initial_cnd_un [ConvectionDiffusion::write::GetAttribute nodal_conditions_un]

}

# Events
Expand All @@ -18,39 +19,17 @@ proc ::Buoyancy::write::writeModelPartEvent { } {
set err [Validate]
if {$err ne ""} {error $err}

# Start Fluid write variables
Fluid::write::Init
# Fluid has implemented the geometry mode, but we do not use it yet in inherited apps
::Fluid::write::SetAttribute write_mdpa_mode [::Buoyancy::GetWriteProperty write_mdpa_mode]
# Start Fluid write conditions map from scratch
Fluid::write::InitConditionsMap

# Init data
write::initWriteConfiguration [Fluid::write::GetAttributes]

# Headers
write::writeModelPartData
Fluid::write::writeProperties

# Nodal coordinates (1: Print only Fluid nodes <inefficient> | 0: the whole mesh <efficient>)
if {[Fluid::write::GetAttribute writeCoordinatesByGroups] ne "all"} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates}
::Fluid::write::Init

# Element connectivities (Groups on FLParts)
write::writeElementConnectivities
set fluid_base_xpath [spdAux::getRoute Buoyancy_FL]
set fluid_base [[customlib::GetBaseRoot] selectNodes $fluid_base_xpath]
set ::Fluid::write::base_root $fluid_base

::Fluid::write::writeModelPartEvent

# Nodal conditions and conditions
Fluid::write::writeConditions
# Write Boussinesq submodel part as nodals
::Buoyancy::write::writeBoussinesqSubModelPart

# SubmodelParts
Fluid::write::writeMeshes
write::writeNodalConditions [GetAttribute thermal_initial_cnd_un]
Buoyancy::write::writeSubModelParts

# Boussinesq nodes
Buoyancy::write::writeBoussinesqSubModelPart

# Custom SubmodelParts
#write::writeBasicSubmodelParts [Fluid::write::getLastConditionId]
}

proc ::Buoyancy::write::writeCustomFilesEvent { } {
Expand All @@ -71,9 +50,22 @@ proc ::Buoyancy::write::WriteMaterialsFile {{write_const_law True} {include_mode
Fluid::write::WriteMaterialsFile $write_const_law $include_modelpart_name

# Write Buoyancy materials file
set model_part_name ""
if {[write::isBooleanTrue $include_modelpart_name]} {set model_part_name [GetModelPartName]}
write::writePropertiesJsonFile [GetAttribute parts_un] "BuoyancyMaterials.json" $write_const_law $model_part_name
set clear_mat [::Buoyancy::write::GetBuoyancyMaterialsFile $write_const_law $include_modelpart_name]
write::writePropertiesJsonFileDone "BuoyancyMaterials.json" $clear_mat
}

proc ::Buoyancy::write::GetBuoyancyMaterialsFile { {write_const_law True} {include_modelpart_name True} {model_part_name ""} } {

if {[write::isBooleanTrue $include_modelpart_name] && $model_part_name eq ""} {set model_part_name [GetModelPartName]}

set mats [write::getPropertiesJson [GetAttribute parts_un] $write_const_law $model_part_name]

# keep only first entry
set clear_mat [dict get $mats properties]
set clear_mat [lindex $clear_mat 0]
dict set clear_mat model_part_name ThermalModelPart
set clear_mat [dict create properties [list $clear_mat]]
return $clear_mat
}

proc ::Buoyancy::write::writeSubModelParts { } {
Expand All @@ -100,7 +92,7 @@ proc ::Buoyancy::write::writeBoussinesqSubModelPart { } {
set groupid "_Boussinesq_hidden_"
GiD_Groups create $groupid
GiD_EntitiesGroups assign $groupid nodes [GiD_Mesh list node]
::write::writeGroupSubModelPart Boussinesq $groupid "Nodes"
::write::writeGroupSubModelPartAsGeometry $groupid
GiD_Groups delete $groupid
}

Expand Down
17 changes: 12 additions & 5 deletions kratos.gid/apps/Buoyancy/write/writeProjectParameters.tcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project Parameters
proc ::Buoyancy::write::getParametersDict { } {
proc ::Buoyancy::write::getParametersDict { {stage ""} } {
set projectParametersDict [dict create]

# Analysis stage field
Expand All @@ -20,6 +20,9 @@ proc ::Buoyancy::write::getParametersDict { } {
# processes
dict set projectParametersDict processes [Buoyancy::write::GetProcesses_Dict]

# modelers
set projectParametersDict [::write::GetModelersDict $projectParametersDict $stage]

return $projectParametersDict
}

Expand Down Expand Up @@ -78,18 +81,22 @@ proc ::Buoyancy::write::GetSolverSettings_Dict { } {

# Fluid things
write::SetConfigurationAttributes [Fluid::write::GetAttributes]
#Fluid::write::SetAttribute materials_file "BuoyancyMaterials.json"
dict set settings fluid_solver_settings [Fluid::write::getSolverSettingsDict]
dict unset settings fluid_solver_settings model_import_settings
dict set settings fluid_solver_settings model_import_settings input_type "use_input_model_part"

set nDim [expr [string range [write::getValue nDim] 0 0]]
dict set settings fluid_solver_settings domain_size $nDim

# Thermal things
set prev [ConvectionDiffusion::write::GetAttribute materials_file]
ConvectionDiffusion::write::SetAttribute materials_file "BuoyancyMaterials.json"
write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
# write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
dict set settings thermal_solver_settings [ConvectionDiffusion::write::GetSolverSettingsDict]
ConvectionDiffusion::write::SetAttribute materials_file $prev

dict unset settings thermal_solver_settings model_import_settings
dict set settings thermal_solver_settings model_import_settings input_type "use_input_model_part"

dict set settings thermal_solver_settings problem_domain_sub_model_part_list [list [dict get $settings fluid_solver_settings volume_model_part_name]]

Expand All @@ -101,7 +108,7 @@ proc ::Buoyancy::write::GetProcesses_Dict { } {
write::SetConfigurationAttributes [Fluid::write::GetAttributes]
lappend constraints_process_list {*}[write::getConditionsParametersDict [Fluid::write::GetAttribute conditions_un] ]
lappend constraints_process_list {*}[write::getConditionsParametersDict [Fluid::write::GetAttribute nodal_conditions_un] "Nodal"]
write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
# write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
lappend constraints_process_list {*}[write::getConditionsParametersDict [ConvectionDiffusion::write::GetAttribute nodal_conditions_un] "Nodal"]
lappend constraints_process_list {*}[write::getConditionsParametersDict [ConvectionDiffusion::write::GetAttribute conditions_un]]
lappend constraints_process_list [GetBoussinesqProcess]
Expand All @@ -123,4 +130,4 @@ proc ::Buoyancy::write::GetBoussinesqProcess { } {
dict set process Parameters $params

return $process
}
}
4 changes: 2 additions & 2 deletions kratos.gid/apps/Buoyancy/xml/Main.spd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<container n="Buoyancy" pn="Buoyancy" icon="app" prefix="Buoyancy_" tree_state="open" open_window="0">

<container n="Fluid" pn="Fluid" icon="units" prefix="FL" tree_state="open" open_window="0">
<container n="Fluid" pn="Fluid" icon="units" prefix="FL" un="Buoyancy_FL" tree_state="open" open_window="0">
<include n="AnalysisType" active="1" path="apps/Fluid/xml/AnalysisType.spd"/>
<include n="Parts" active="1" path="apps/Fluid/xml/Parts.spd"/>
<include n="InitialConditions" active="1" path="apps/Fluid/xml/InitialConditions.spd"/>
Expand All @@ -11,7 +11,7 @@
<include n="Materials" active="1" path="apps/Fluid/xml/Materials.spd"/>
</container>

<container n="ConvectionDiffusion" pn="Thermal" icon="app" prefix="CNVDFF" tree_state="open" open_window="0">
<container n="ConvectionDiffusion" pn="Thermal" icon="app" prefix="CNVDFF" un="Buoyancy_CNVDFF" tree_state="open" open_window="0">
<include n="StageInfo" active="1" path="apps/ConvectionDiffusion/xml/StageInfo.spd"/>
<!-- <include n="Parts" active="1" state="hidden" path="apps/ConvectionDiffusion/xml/Parts.spd"/> -->
<include n="InitialConditions" active="1" path="apps/ConvectionDiffusion/xml/InitialConditions.spd"/>
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/CompressibleFluid/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"properties_location": "json",
"model_part_name": "FluidModelPart",
"output_model_part_name": "fluid_computational_model_part",
"write_mdpa_mode": "entities"
"write_mdpa_mode": "geometries"
},
"main_launch_file": "python/MainKratos.py",
"examples": "examples/examples.xml",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
proc ::CompressibleFluid::write::writeParametersEvent { } {
set projectParametersDict [Fluid::write::getParametersDict]
set projectParametersDict [::write::GetModelersDict $projectParametersDict]

set shock_capturing_type [dict get $projectParametersDict solver_settings shock_capturing_type]
dict set projectParametersDict solver_settings shock_capturing_settings type $shock_capturing_type
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/CompressibleFluid/xml/Conditions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
unit_magnitude="M/T/L^2">
<TopologyFeatures>
<item GeometryType="Line" nodes="2" KratosName="WallCondition2D2N"/>
<item GeometryType="Point" nodes="1" KratosName="WallCondition2D1N"/>
<item GeometryType="Point" nodes="1" KratosName="PointCondition3D1N"/>
</TopologyFeatures>
<DegreesOfFreedom></DegreesOfFreedom>
<inputs></inputs>
Expand Down
3 changes: 2 additions & 1 deletion kratos.gid/apps/ConjugateHeatTransfer/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"write": {
"coordinates": "groups",
"properties_location": "json",
"model_part_name": "ThermalModelPart"
"model_part_name": "ThermalModelPart",
"write_mdpa_mode": "geometries"
},
"main_launch_file": "../../exec/MainKratos.py",
"examples": "examples/examples.xml"
Expand Down
43 changes: 40 additions & 3 deletions kratos.gid/apps/ConjugateHeatTransfer/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace eval ::ConjugateHeatTransfer::write {
variable writeAttributes
variable fluid_domain_solver_settings
variable solid_domain_solver_settings

variable mdpa_files
}

proc ::ConjugateHeatTransfer::write::Init { } {
Expand All @@ -20,6 +22,7 @@ proc ::ConjugateHeatTransfer::write::Init { } {
SetAttribute model_part_name [::ConjugateHeatTransfer::GetWriteProperty model_part_name]

SetAttribute coordinates [::ConjugateHeatTransfer::GetWriteProperty coordinates]
SetAttribute write_mdpa_mode [::ConvectionDiffusion::GetWriteProperty write_mdpa_mode]

SetAttribute fluid_mdpa_suffix Fluid
SetAttribute solid_mdpa_suffix Solid
Expand All @@ -28,10 +31,14 @@ proc ::ConjugateHeatTransfer::write::Init { } {
variable solid_domain_solver_settings
set fluid_domain_solver_settings [dict create]
set solid_domain_solver_settings [dict create]

variable mdpa_files
set mdpa_files []
}

# Events
proc ::ConjugateHeatTransfer::write::writeModelPartEvent { } {
variable mdpa_files
# Validation
set err [Validate]
if {$err ne ""} {error $err}
Expand All @@ -41,13 +48,22 @@ proc ::ConjugateHeatTransfer::write::writeModelPartEvent { } {
# Buoyancy mdpa
::ConjugateHeatTransfer::write::PrepareBuoyancy
write::writeAppMDPA Buoyancy
write::RenameFileInModel "$filename.mdpa" "${filename}_[GetAttribute fluid_mdpa_suffix].mdpa"
set buoyancy_mdpa "${filename}_[GetAttribute fluid_mdpa_suffix]"
write::RenameFileInModel "$filename.mdpa" ${buoyancy_mdpa}.mdpa
lappend mdpa_files $buoyancy_mdpa

# Convection diffusion mdpa
ConvectionDiffusion::write::Init
ConvectionDiffusion::write::SetAttribute writeCoordinatesByGroups [GetAttribute coordinates]

set base_root_xpath [spdAux::getRoute CHTCNVDFF]
set base_root [[customlib::GetBaseRoot] selectNodes $base_root_xpath]
set ::ConvectionDiffusion::write::base_root $base_root

write::writeAppMDPA ConvectionDiffusion
write::RenameFileInModel "$filename.mdpa" "${filename}_[GetAttribute solid_mdpa_suffix].mdpa"
set convdif_mdpa "${filename}_[GetAttribute solid_mdpa_suffix]"
write::RenameFileInModel "$filename.mdpa" ${convdif_mdpa}.mdpa
lappend mdpa_files $convdif_mdpa
}

proc ::ConjugateHeatTransfer::write::writeCustomFilesEvent { } {
Expand All @@ -69,16 +85,37 @@ proc ::ConjugateHeatTransfer::write::PrepareBuoyancy { } {
Fluid::write::SetAttribute thermal_bc_un Buoyancy_CNVDFFBC
Fluid::write::SetAttribute thermal_initial_cnd_un Buoyancy_CNVDFFNodalConditions
Fluid::write::SetCoordinatesByGroups [GetAttribute coordinates]
set base_root_xpath [spdAux::getRoute CHTBuoyancy]
set base_root [[customlib::GetBaseRoot] selectNodes $base_root_xpath]
set ::Fluid::write::base_root $base_root
}

proc ::ConjugateHeatTransfer::write::WriteMaterialsFile { {write_const_law True} {include_modelpart_name True} } {
Buoyancy::write::WriteMaterialsFile $write_const_law $include_modelpart_name
ConjugateHeatTransfer::write::WriteBuoyancyMaterialsFile $write_const_law $include_modelpart_name
ConvectionDiffusion::write::WriteMaterialsFile False $include_modelpart_name
}

proc ::ConjugateHeatTransfer::write::WriteBuoyancyMaterialsFile { {write_const_law True} {include_modelpart_name True} } {
## Write fluid material file
set model_part_name ""
if {[write::isBooleanTrue $include_modelpart_name]} {set model_part_name [GetAttribute model_part_name]}
set fluid_materials [Fluid::write::GetMaterialsFile $write_const_law $include_modelpart_name]
write::writePropertiesJsonFileDone [::Fluid::write::GetAttribute materials_file] $fluid_materials

# Write Buoyancy materials file
set buoyancy_material [::Buoyancy::write::GetBuoyancyMaterialsFile $write_const_law $include_modelpart_name FluidThermalModelPart]
set clear_mat [dict get $buoyancy_material properties]
set clear_mat [lindex $clear_mat 0]
dict set clear_mat model_part_name FluidThermalModelPart
set clear_mat [dict create properties [list $clear_mat]]
write::writePropertiesJsonFileDone "BuoyancyMaterials.json" $clear_mat
}

proc ::ConjugateHeatTransfer::write::GetAttribute {att} {
variable writeAttributes
if {![dict exists $writeAttributes $att]} {
return ""
}
return [dict get $writeAttributes $att]
}

Expand Down
Loading