Skip to content

Commit db40cfe

Browse files
Merge pull request #985 from KratosMultiphysics/write-geoms-migration
MIGRATION - Write as geometries
2 parents 441ecbf + e1b96a7 commit db40cfe

54 files changed

Lines changed: 621 additions & 239 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tester.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
- name: Install bins
3434
run: |
35-
pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.3.2
35+
pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==10.3.0
3636
3737
# Copy problemtype to gid and copy exec
3838
- name: Move kratos where it should be

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ If you need the developer version, you are on the right place.
2121
* You don't need to install python. The program will detect if you have any pending package to install.
2222
* If there's any missing package, use the GiD command line and execute:
2323

24-
`-np- W [GiD_Python_PipInstallMissingPackages [list $Kratos::pip_packages_required ] ]`
24+
`-np- W [GiD_Python_PipInstall [list $Kratos::pip_packages_required ] 1 ]`
2525
* 4.1- To execute Kratos using the standard pip packages:
26-
* Python version recommended: 3.8, 3.9, 3.10, 3.11
26+
* Python version recommended: 3.8, 3.9, 3.10, 3.11, 3.12
2727
* Open a terminal and run
28-
- Linux: `python3 -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.5.1`
29-
- Windows: `python -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==9.5.1`
28+
- Linux: `python3 -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==10.3.0`
29+
- Windows: `python -m pip install --upgrade --force-reinstall --no-cache-dir KratosMultiphysics-all==10.3.0`
3030
* 4.2- To execute Kratos using your compiled binaries:
3131
* Fill the Kratos preferences windows with
3232
- Path to the python folder

dockers/create-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
22

33
# Change directory to the specified directory
4-
cd /tmp/dist/kratos-9.5.1/
4+
cd /tmp/dist/kratos-10.3.0/
55
find . -type f -name "*.unix.bat" -print0 | xargs -0 dos2unix
66

77
# Add execute permission to all .bat files in the directory
88
# chmod 755 *.bat
99

1010
# Create a tgz file from the directory
11-
tar -czf ../kratos-9.5.1-linux-64.tgz *
11+
tar -czf ../kratos-10.3.0-linux-64.tgz *
1212

dockers/deploy.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set krversion=9.5.1
1+
set krversion=10.3.0
22
set pyversion=3.11
33
@REM 3.10.10-alpine3.17
44
echo "Building kratos %krversion% on python %pyversion%"

dockers/dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FROM python:$pyversion
88
# Update pip
99
RUN pip install --upgrade pip
1010

11-
ARG krversion=9.5.1
11+
ARG krversion=10.3.0
1212

1313
# WORKDIR /tmp
1414
# COPY ./wheels/ ./wheels/

kratos.gid/apps/Buoyancy/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"coordinates": "all",
3939
"properties_location": "json",
4040
"model_part_name": "ThermalModelPart",
41-
"write_mdpa_mode": "entities"
41+
"write_mdpa_mode": "geometries"
4242
},
4343
"main_launch_file": "../../exec/MainKratos.py",
4444
"examples": "examples/examples.xml"

kratos.gid/apps/Buoyancy/write/write.tcl

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ proc ::Buoyancy::write::Init { } {
1010
# Add thermal unique names to Fluid write variables
1111
Fluid::write::SetAttribute thermal_bc_un [ConvectionDiffusion::write::GetAttribute conditions_un]
1212
Fluid::write::SetAttribute thermal_initial_cnd_un [ConvectionDiffusion::write::GetAttribute nodal_conditions_un]
13+
1314
}
1415

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

21-
# Start Fluid write variables
22-
Fluid::write::Init
23-
# Fluid has implemented the geometry mode, but we do not use it yet in inherited apps
24-
::Fluid::write::SetAttribute write_mdpa_mode [::Buoyancy::GetWriteProperty write_mdpa_mode]
25-
# Start Fluid write conditions map from scratch
26-
Fluid::write::InitConditionsMap
27-
28-
# Init data
29-
write::initWriteConfiguration [Fluid::write::GetAttributes]
30-
31-
# Headers
32-
write::writeModelPartData
33-
Fluid::write::writeProperties
34-
35-
# Nodal coordinates (1: Print only Fluid nodes <inefficient> | 0: the whole mesh <efficient>)
36-
if {[Fluid::write::GetAttribute writeCoordinatesByGroups] ne "all"} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates}
22+
::Fluid::write::Init
3723

38-
# Element connectivities (Groups on FLParts)
39-
write::writeElementConnectivities
24+
set fluid_base_xpath [spdAux::getRoute Buoyancy_FL]
25+
set fluid_base [[customlib::GetBaseRoot] selectNodes $fluid_base_xpath]
26+
set ::Fluid::write::base_root $fluid_base
27+
28+
::Fluid::write::writeModelPartEvent
4029

41-
# Nodal conditions and conditions
42-
Fluid::write::writeConditions
30+
# Write Boussinesq submodel part as nodals
31+
::Buoyancy::write::writeBoussinesqSubModelPart
4332

44-
# SubmodelParts
45-
Fluid::write::writeMeshes
46-
write::writeNodalConditions [GetAttribute thermal_initial_cnd_un]
47-
Buoyancy::write::writeSubModelParts
48-
49-
# Boussinesq nodes
50-
Buoyancy::write::writeBoussinesqSubModelPart
51-
52-
# Custom SubmodelParts
53-
#write::writeBasicSubmodelParts [Fluid::write::getLastConditionId]
5433
}
5534

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

7352
# Write Buoyancy materials file
74-
set model_part_name ""
75-
if {[write::isBooleanTrue $include_modelpart_name]} {set model_part_name [GetModelPartName]}
76-
write::writePropertiesJsonFile [GetAttribute parts_un] "BuoyancyMaterials.json" $write_const_law $model_part_name
53+
set clear_mat [::Buoyancy::write::GetBuoyancyMaterialsFile $write_const_law $include_modelpart_name]
54+
write::writePropertiesJsonFileDone "BuoyancyMaterials.json" $clear_mat
55+
}
56+
57+
proc ::Buoyancy::write::GetBuoyancyMaterialsFile { {write_const_law True} {include_modelpart_name True} {model_part_name ""} } {
58+
59+
if {[write::isBooleanTrue $include_modelpart_name] && $model_part_name eq ""} {set model_part_name [GetModelPartName]}
60+
61+
set mats [write::getPropertiesJson [GetAttribute parts_un] $write_const_law $model_part_name]
62+
63+
# keep only first entry
64+
set clear_mat [dict get $mats properties]
65+
set clear_mat [lindex $clear_mat 0]
66+
dict set clear_mat model_part_name ThermalModelPart
67+
set clear_mat [dict create properties [list $clear_mat]]
68+
return $clear_mat
7769
}
7870

7971
proc ::Buoyancy::write::writeSubModelParts { } {
@@ -100,7 +92,7 @@ proc ::Buoyancy::write::writeBoussinesqSubModelPart { } {
10092
set groupid "_Boussinesq_hidden_"
10193
GiD_Groups create $groupid
10294
GiD_EntitiesGroups assign $groupid nodes [GiD_Mesh list node]
103-
::write::writeGroupSubModelPart Boussinesq $groupid "Nodes"
95+
::write::writeGroupSubModelPartAsGeometry $groupid
10496
GiD_Groups delete $groupid
10597
}
10698

kratos.gid/apps/Buoyancy/write/writeProjectParameters.tcl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Project Parameters
2-
proc ::Buoyancy::write::getParametersDict { } {
2+
proc ::Buoyancy::write::getParametersDict { {stage ""} } {
33
set projectParametersDict [dict create]
44

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

23+
# modelers
24+
set projectParametersDict [::write::GetModelersDict $projectParametersDict $stage]
25+
2326
return $projectParametersDict
2427
}
2528

@@ -78,18 +81,22 @@ proc ::Buoyancy::write::GetSolverSettings_Dict { } {
7881

7982
# Fluid things
8083
write::SetConfigurationAttributes [Fluid::write::GetAttributes]
81-
#Fluid::write::SetAttribute materials_file "BuoyancyMaterials.json"
8284
dict set settings fluid_solver_settings [Fluid::write::getSolverSettingsDict]
85+
dict unset settings fluid_solver_settings model_import_settings
86+
dict set settings fluid_solver_settings model_import_settings input_type "use_input_model_part"
8387

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

8791
# Thermal things
8892
set prev [ConvectionDiffusion::write::GetAttribute materials_file]
8993
ConvectionDiffusion::write::SetAttribute materials_file "BuoyancyMaterials.json"
90-
write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
94+
# write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
9195
dict set settings thermal_solver_settings [ConvectionDiffusion::write::GetSolverSettingsDict]
9296
ConvectionDiffusion::write::SetAttribute materials_file $prev
97+
98+
dict unset settings thermal_solver_settings model_import_settings
99+
dict set settings thermal_solver_settings model_import_settings input_type "use_input_model_part"
93100

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

@@ -101,7 +108,7 @@ proc ::Buoyancy::write::GetProcesses_Dict { } {
101108
write::SetConfigurationAttributes [Fluid::write::GetAttributes]
102109
lappend constraints_process_list {*}[write::getConditionsParametersDict [Fluid::write::GetAttribute conditions_un] ]
103110
lappend constraints_process_list {*}[write::getConditionsParametersDict [Fluid::write::GetAttribute nodal_conditions_un] "Nodal"]
104-
write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
111+
# write::SetConfigurationAttributes [ConvectionDiffusion::write::GetAttributes]
105112
lappend constraints_process_list {*}[write::getConditionsParametersDict [ConvectionDiffusion::write::GetAttribute nodal_conditions_un] "Nodal"]
106113
lappend constraints_process_list {*}[write::getConditionsParametersDict [ConvectionDiffusion::write::GetAttribute conditions_un]]
107114
lappend constraints_process_list [GetBoussinesqProcess]
@@ -123,4 +130,4 @@ proc ::Buoyancy::write::GetBoussinesqProcess { } {
123130
dict set process Parameters $params
124131

125132
return $process
126-
}
133+
}

kratos.gid/apps/Buoyancy/xml/Main.spd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

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

14-
<container n="ConvectionDiffusion" pn="Thermal" icon="app" prefix="CNVDFF" tree_state="open" open_window="0">
14+
<container n="ConvectionDiffusion" pn="Thermal" icon="app" prefix="CNVDFF" un="Buoyancy_CNVDFF" tree_state="open" open_window="0">
1515
<include n="StageInfo" active="1" path="apps/ConvectionDiffusion/xml/StageInfo.spd"/>
1616
<!-- <include n="Parts" active="1" state="hidden" path="apps/ConvectionDiffusion/xml/Parts.spd"/> -->
1717
<include n="InitialConditions" active="1" path="apps/ConvectionDiffusion/xml/InitialConditions.spd"/>

kratos.gid/apps/CompressibleFluid/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"properties_location": "json",
4444
"model_part_name": "FluidModelPart",
4545
"output_model_part_name": "fluid_computational_model_part",
46-
"write_mdpa_mode": "entities"
46+
"write_mdpa_mode": "geometries"
4747
},
4848
"main_launch_file": "python/MainKratos.py",
4949
"examples": "examples/examples.xml",

0 commit comments

Comments
 (0)