diff --git a/kratos.gid/apps/Examples/xml/examples.xml b/kratos.gid/apps/Examples/xml/examples.xml
index 7ca5de691..cb20933ec 100644
--- a/kratos.gid/apps/Examples/xml/examples.xml
+++ b/kratos.gid/apps/Examples/xml/examples.xml
@@ -22,4 +22,5 @@
+
diff --git a/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl b/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl
index fae554fe7..72d4dc9d2 100644
--- a/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl
+++ b/kratos.gid/apps/Fluid/write/writeProjectParameters.tcl
@@ -6,26 +6,31 @@ proc ::Fluid::write::getParametersDict { } {
dict set projectParametersDict analysis_stage "KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis"
# Problem data
- dict set projectParametersDict problem_data [write::GetDefaultProblemDataDict [::Fluid::GetAttribute id]]
+ dict set projectParametersDict problem_data [::Fluid::write::GetProblemData_Dict]
# output configuration
dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict [::Fluid::GetAttribute id]]
# Solver settings
- set solver_settings_dict [Fluid::write::getSolverSettingsDict]
- dict set solver_settings_dict "reform_dofs_at_each_step" false
- dict set projectParametersDict solver_settings $solver_settings_dict
+ dict set projectParametersDict solver_settings [Fluid::write::getSolverSettingsDict]
# Boundary conditions processes
+ dict set projectParametersDict processes [Fluid::write::GetProcesses_Dict]
+
+ return $projectParametersDict
+}
+
+proc ::Fluid::write::GetProblemData_Dict { } {
+ return [write::GetDefaultProblemDataDict [::Fluid::GetAttribute id]]
+}
+
+proc ::Fluid::write::GetProcesses_Dict { } {
set processesDict [dict create]
dict set processesDict initial_conditions_process_list [write::getConditionsParametersDict [::Fluid::GetUniqueName nodal_conditions] "Nodal"]
dict set processesDict boundary_conditions_process_list [write::getConditionsParametersDict [::Fluid::GetUniqueName conditions]]
dict set processesDict gravity [list [getGravityProcessDict] ]
dict set processesDict auxiliar_process_list [getAuxiliarProcessList]
-
- dict set projectParametersDict processes $processesDict
-
- return $projectParametersDict
+ return $processesDict
}
proc ::Fluid::write::writeParametersEvent { } {
@@ -258,7 +263,7 @@ proc ::Fluid::write::getSolverSettingsDict { } {
# Include the formulation settings in the solver settings dict
dict set solverSettingsDict formulation $formulationSettingsDict
}
-
+ dict set solverSettingsDict "reform_dofs_at_each_step" false
return $solverSettingsDict
}
diff --git a/kratos.gid/apps/FluidLauncher/start.tcl b/kratos.gid/apps/FluidLauncher/start.tcl
index 2a80afa3b..69d24bf6d 100644
--- a/kratos.gid/apps/FluidLauncher/start.tcl
+++ b/kratos.gid/apps/FluidLauncher/start.tcl
@@ -1,6 +1,6 @@
namespace eval ::FluidLauncher {
Kratos::AddNamespace [namespace current]
-
+
variable available_apps
}
@@ -8,14 +8,14 @@ proc ::FluidLauncher::Init { app } {
variable available_apps
# TODO: Get apps from json
- set available_apps [list Fluid EmbeddedFluid PotentialFluid Buoyancy ConjugateHeatTransfer FluidDEM]
-
+ set available_apps [list Fluid EmbeddedFluid PotentialFluid Buoyancy ConjugateHeatTransfer FluidDEM FreeSurface]
+
::FluidLauncher::FluidAppSelectorWindow
}
proc ::FluidLauncher::FluidAppSelectorWindow { } {
variable available_apps
-
+
set root [customlib::GetBaseRoot]
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
if { $nd ne "undefined" } {
@@ -69,7 +69,7 @@ proc ::FluidLauncher::FluidAppSelectorWindow { } {
# Information panel
set spdAux::info_main_window_text ""
- ttk::labelframe $w.info -text " Information " -relief ridge
+ ttk::labelframe $w.info -text " Information " -relief ridge
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
grid $w.info.text
grid $w.info -sticky we
diff --git a/kratos.gid/apps/FreeSurface/app.json b/kratos.gid/apps/FreeSurface/app.json
new file mode 100644
index 000000000..8d642cecc
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/app.json
@@ -0,0 +1,42 @@
+{
+ "id": "FreeSurface",
+ "name": "FreeSurface",
+ "prefix": "FL",
+ "themed": false,
+ "kratos_name": "FreeSurfaceapplication",
+ "python_packages": [
+ "KratosFluidDynamicsApplication",
+ "KratosConvectionDiffusionApplication"
+ ],
+ "dimensions": [
+ "2D","3D"
+ ],
+ "script_files": [
+ "start.tcl",
+ "examples/examples.tcl",
+ "examples/Box.tcl",
+ "xml/XmlController.tcl",
+ "write/write.tcl",
+ "write/writeProjectParameters.tcl"
+ ],
+ "start_script": "::FreeSurface::Init",
+ "requeriments": {
+ "apps": [
+ "Fluid"
+ ],
+ "minimum_gid_version": "15.1.3d"
+ },
+ "permissions": {
+ "open_tree": true,
+ "show_toolbar": true,
+ "intervals": true,
+ "wizard": false
+ },
+ "write": {
+ "coordinates": "all",
+ "properties_location": "json",
+ "model_part_name": "FluidModelPart",
+ "output_model_part_name": ""
+ },
+ "main_launch_file": "../../exec/MainKratos.py"
+}
\ No newline at end of file
diff --git a/kratos.gid/apps/FreeSurface/examples/Box.tcl b/kratos.gid/apps/FreeSurface/examples/Box.tcl
new file mode 100644
index 000000000..9adbd966a
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/examples/Box.tcl
@@ -0,0 +1,151 @@
+
+namespace eval ::FreeSurface::examples::Box {
+ namespace path ::FreeSurface::examples
+ Kratos::AddNamespace [namespace current]
+}
+
+proc ::FreeSurface::examples::Box::Init {args} {
+ if {![Kratos::IsModelEmpty]} {
+ set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
+ set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
+ if { $retval == "cancel" } { return }
+ }
+ DrawGeometry$::Model::SpatialDimension
+ AssignGroups$::Model::SpatialDimension
+ TreeAssignation$::Model::SpatialDimension
+
+ GiD_Process 'Redraw
+ GidUtils::UpdateWindow GROUPS
+ GidUtils::UpdateWindow LAYER
+ GiD_Process 'Zoom Frame
+ spdAux::RequestRefresh
+}
+
+
+# Draw Geometry
+proc ::FreeSurface::examples::Box::DrawGeometry2D {args} {
+ Kratos::ResetModel
+ GiD_Layers create Fluid
+ GiD_Layers edit to_use Fluid
+
+ # Geometry creation
+ ## Points ##
+ set coordinates [list -3.91362 -3.3393 0 -2.91362 -3.3393 0 -2.91362 -3.1393 0 -2.91362 -2.7393 0 -2.71362 -2.7393 0]
+ lappend coordinates {*}[list -2.71362 -2.5393 0 -3.91362 -2.5393 0 -3.91362 -3.1393 0 -4.11362 -3.1393 0 -4.11362 -3.3393 0 ]
+ set fluidPoints [list ]
+ foreach {x y z} $coordinates {
+ lappend fluidPoints [GiD_Geometry create point append Fluid $x $y $z]
+ }
+
+ ## Lines ##
+ set fluidLines [list ]
+ set initial [lindex $fluidPoints 0]
+ foreach point [lrange $fluidPoints 1 end] {
+ lappend fluidLines [GiD_Geometry create line append stline Fluid $initial $point]
+ set initial $point
+ }
+ lappend fluidLines [GiD_Geometry create line append stline Fluid $initial [lindex $fluidPoints 0]]
+
+ ## Surface ##
+ GiD_Process Mescape Geometry Create NurbsSurface {*}$fluidLines escape escape
+
+ ## Points ##
+ set coordinates [list -3.91362 -3.5393 0 -2.91362 -3.5393 0 ]
+ set fluidPoints [list ]
+ foreach {x y z} $coordinates {
+ lappend fluidPoints [GiD_Geometry create point append Fluid $x $y $z]
+ }
+
+ ## Lines ##
+ set fluidLines [list ]
+ set initial 1
+ foreach point [list {*}$fluidPoints 2] {
+ lappend fluidLines [GiD_Geometry create line append stline Fluid $initial $point]
+ set initial $point
+ }
+
+ ## Surface ##
+ GiD_Process Mescape Geometry Create NurbsSurface 1 {*}$fluidLines escape escape
+
+
+}
+
+# Group assign
+proc ::FreeSurface::examples::Box::AssignGroups2D {args} {
+ # Create the groups
+ GiD_Groups create Fluid
+ GiD_Groups edit color Fluid "#26d1a8ff"
+ GiD_EntitiesGroups assign Fluid surfaces {1 2}
+
+ GiD_Groups create Inlet
+ GiD_Groups edit color Inlet "#e0210fff"
+ GiD_EntitiesGroups assign Inlet lines 9
+
+ GiD_Groups create Outlet
+ GiD_Groups edit color Outlet "#42eb71ff"
+ GiD_EntitiesGroups assign Outlet lines {5 12}
+
+ GiD_Groups create Slip_Walls
+ GiD_Groups edit color Slip_Walls "#3b3b3bff"
+ GiD_EntitiesGroups assign Slip_Walls lines {2 3 4 6 7 8 10 11 13}
+
+ GiD_Groups create Surface_Bottom
+ GiD_Groups edit color Surface_Bottom "#3b3b3bff"
+ GiD_EntitiesGroups assign Surface_Bottom surfaces 2
+}
+
+# Tree assign
+proc ::FreeSurface::examples::Box::TreeAssignation2D {args} {
+ set nd $::Model::SpatialDimension
+ set root [customlib::GetBaseRoot]
+
+ set condtype line
+
+ # Fluid Parts
+ set fluidParts [spdAux::getRoute "FLParts"]
+ set fluidNode [customlib::AddConditionGroupOnXPath $fluidParts Fluid]
+
+ set fluidConditions [spdAux::getRoute "FLNodalConditions"]
+ [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='DISTANCE'\]" Inlet] setAttribute ov line
+ [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='DISTANCE'\]" Surface_Bottom] setAttribute ov surface
+ [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='LIN_DARCY_COEF'\]" Surface_Bottom] setAttribute ov surface
+ [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='NONLIN_DARCY_COEF'\]" Surface_Bottom] setAttribute ov surface
+ [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='POROSITY'\]" Surface_Bottom] setAttribute ov surface
+
+ set fluidConditions [spdAux::getRoute "FLBC"]
+ ::Fluid::examples::ErasePreviousIntervals
+
+ # Fluid Inlet
+ Fluid::xml::CreateNewInlet Inlet {new true name inlet1 ini 0 end End} true "1"
+
+ # Fluid Outlet
+ set fluidOutlet "$fluidConditions/condition\[@n='Outlet$nd'\]"
+ set outletNode [customlib::AddConditionGroupOnXPath $fluidOutlet Outlet]
+ $outletNode setAttribute ov $condtype
+ set props [list value 0.0]
+ spdAux::SetValuesOnBaseNode $outletNode $props
+
+ # Fluid Conditions
+ [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='Slip$nd'\]" Slip_Walls] setAttribute ov $condtype
+
+ # [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='Lin_Darcy_Coef_$nd'\]" Surface_Bottom] setAttribute ov $condtype
+ # [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='Non_Lin_Darcy_Coef_$nd'\]" Surface_Bottom] setAttribute ov $condtype
+ # [customlib::AddConditionGroupOnXPath "$fluidConditions/condition\[@n='Porosity$nd'\]" Surface_Bottom] setAttribute ov $condtype
+
+ # Time parameters
+ set parameters [list EndTime 5 DeltaTime 0.1]
+ set xpath [spdAux::getRoute "FLTimeParameters"]
+ spdAux::SetValuesOnBasePath $xpath $parameters
+
+ # Output
+ set parameters [list OutputControlType time OutputDeltaTime 0.1]
+ set xpath "[spdAux::getRoute FLResults]/container\[@n='GiDOutput'\]/container\[@n='GiDOptions'\]"
+ spdAux::SetValuesOnBasePath $xpath $parameters
+
+ # Parallelism
+ set parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
+ set xpath [spdAux::getRoute "Parallelization"]
+ spdAux::SetValuesOnBasePath $xpath $parameters
+
+
+}
diff --git a/kratos.gid/apps/FreeSurface/examples/examples.tcl b/kratos.gid/apps/FreeSurface/examples/examples.tcl
new file mode 100644
index 000000000..53f1d4331
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/examples/examples.tcl
@@ -0,0 +1,14 @@
+namespace eval ::FreeSurface::examples {
+ namespace path ::FreeSurface
+ Kratos::AddNamespace [namespace current]
+}
+
+# Common functions for all examples that uses Fluid App
+proc ::FreeSurface::examples::ErasePreviousIntervals { } {
+ set root [customlib::GetBaseRoot]
+ set interval_base [spdAux::getRoute "Intervals"]
+ foreach int [$root selectNodes "$interval_base/blockdata\[@n='Interval'\]"] {
+ if {[$int @name] ni [list Initial Total Custom1]} {$int delete}
+ }
+}
+
diff --git a/kratos.gid/apps/FreeSurface/examples/examples.xml b/kratos.gid/apps/FreeSurface/examples/examples.xml
new file mode 100644
index 000000000..041a7778f
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/examples/examples.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/kratos.gid/apps/FreeSurface/images/box2d.png b/kratos.gid/apps/FreeSurface/images/box2d.png
new file mode 100644
index 000000000..c24fac7a0
Binary files /dev/null and b/kratos.gid/apps/FreeSurface/images/box2d.png differ
diff --git a/kratos.gid/apps/FreeSurface/images/logo.png b/kratos.gid/apps/FreeSurface/images/logo.png
new file mode 100644
index 000000000..277800ac3
Binary files /dev/null and b/kratos.gid/apps/FreeSurface/images/logo.png differ
diff --git a/kratos.gid/apps/FreeSurface/start.tcl b/kratos.gid/apps/FreeSurface/start.tcl
new file mode 100644
index 000000000..1d07fb007
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/start.tcl
@@ -0,0 +1,24 @@
+namespace eval ::FreeSurface {
+ # Variable declaration
+ variable dir
+ variable _app
+ Kratos::AddNamespace [namespace current]
+
+ proc GetAttribute {name} {variable _app; return [$_app getProperty $name]}
+ proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]}
+ proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]}
+}
+
+proc ::FreeSurface::Init { app } {
+ # Variable initialization
+ variable dir
+ variable _app
+
+ #W "Sourced FSI"
+ set dir [apps::getMyDir "FreeSurface"]
+ set _app $app
+
+ ::FreeSurface::xml::Init
+ ::FreeSurface::write::Init
+
+}
diff --git a/kratos.gid/apps/FreeSurface/write/write.tcl b/kratos.gid/apps/FreeSurface/write/write.tcl
new file mode 100644
index 000000000..d78e91f76
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/write/write.tcl
@@ -0,0 +1,43 @@
+namespace eval ::FreeSurface::write {
+ namespace path ::FreeSurface::write
+ Kratos::AddNamespace [namespace current]
+
+ variable writeAttributes
+}
+
+proc ::FreeSurface::write::Init { } {
+ ::Fluid::write::Init
+}
+
+# Events
+proc ::FreeSurface::write::writeModelPartEvent { } {
+ ::Fluid::write::writeModelPartEvent
+}
+
+proc ::FreeSurface::write::writeCustomFilesEvent { } {
+ # Materials
+ #FreeSurface::write::WriteMaterialsFile True
+ #write::SetConfigurationAttribute main_launch_file [ConvectionDiffusion::write::GetAttribute main_launch_file]
+}
+
+
+proc ::FreeSurface::write::GetModelPartName { } {
+ return [Fluid::write::getFluidModelPartFilename]
+}
+
+proc ::FreeSurface::write::GetAttribute {att} {
+ return [Fluid::write::GetAttribute $att]
+}
+
+proc ::FreeSurface::write::GetAttributes {} {
+ return [Fluid::write::GetAttributes]
+}
+
+proc ::FreeSurface::write::AddAttributes {configuration} {
+ variable writeAttributes
+ set writeAttributes [dict merge $writeAttributes $configuration]
+}
+
+proc ::FreeSurface::write::AddValidApps {appid} {
+ AddAttribute validApps $appid
+}
diff --git a/kratos.gid/apps/FreeSurface/write/writeProjectParameters.tcl b/kratos.gid/apps/FreeSurface/write/writeProjectParameters.tcl
new file mode 100644
index 000000000..bc9618442
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/write/writeProjectParameters.tcl
@@ -0,0 +1,62 @@
+# Project Parameters
+proc ::FreeSurface::write::getParametersDict { } {
+ set projectParametersDict [dict create]
+
+ ::write::SetConfigurationAttribute model_part_name [::FreeSurface::write::GetModelPartName]
+
+ # # Analysis stage field
+ dict set projectParametersDict analysis_stage "KratosMultiphysics.FreeSurfaceApplication.free_surface_analysis"
+
+ # # problem data
+ dict set projectParametersDict problem_data [::Fluid::write::GetProblemData_Dict]
+
+ # # output configuration
+ ::write::SetConfigurationAttribute output_model_part_name [::FreeSurface::GetWriteProperty output_model_part_name]
+ dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict [::Fluid::GetAttribute id]]
+
+ # # restart options
+ #dict set projectParametersDict restart_options [Fluid::write::GetRestart_Dict]
+
+ # # solver settings
+ dict set projectParametersDict solver_settings [FreeSurface::write::getSolverSettingsDict]
+
+ # # processes
+ dict set projectParametersDict processes [::Fluid::write::GetProcesses_Dict]
+
+ return $projectParametersDict
+}
+
+proc ::FreeSurface::write::getSolverSettingsDict { } {
+ set solverSettingsDict [dict create]
+ # model_part_name
+ dict set solverSettingsDict model_part_name [::FreeSurface::write::GetModelPartName]
+
+ # domain_size
+ set nDim [expr [string range [write::getValue nDim] 0 0]]
+ dict set solverSettingsDict domain_size $nDim
+
+ # solver_type
+ set currentStrategyId [write::getValue FLSolStrat "" force]
+ set strategy [::Model::GetSolutionStrategy $currentStrategyId]
+ set strategy_write_name [$strategy getAttribute "ImplementedInPythonFile"]
+ set strategy_type [$strategy getAttribute "Type"]
+ dict set solverSettingsDict solver_type $strategy_write_name
+
+ # model import settings
+ set modelDict [dict create]
+ dict set modelDict input_type "mdpa"
+ set model_name [Fluid::write::getFluidModelPartFilename]
+ dict set modelDict input_filename $model_name
+ dict set solverSettingsDict model_import_settings $modelDict
+
+ set solverSettingsDict [dict merge $solverSettingsDict [write::getSolutionStrategyParametersDict FLSolStrat FLScheme FLStratParams] ]
+ set solverSettingsDict [dict merge $solverSettingsDict [write::getSolversParametersDict Fluid] ]
+
+ return $solverSettingsDict
+}
+
+proc ::FreeSurface::write::writeParametersEvent { } {
+ set projectParametersDict [getParametersDict]
+ write::SetParallelismConfiguration
+ write::WriteJSON $projectParametersDict
+}
diff --git a/kratos.gid/apps/FreeSurface/xml/Conditions.xml b/kratos.gid/apps/FreeSurface/xml/Conditions.xml
new file mode 100644
index 000000000..72d270719
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/Conditions.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/kratos.gid/apps/FreeSurface/xml/Elements.xml b/kratos.gid/apps/FreeSurface/xml/Elements.xml
new file mode 100644
index 000000000..ba11a6f5a
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/Elements.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/FreeSurface/xml/Main.spd b/kratos.gid/apps/FreeSurface/xml/Main.spd
new file mode 100644
index 000000000..ad5deec5e
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/Main.spd
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/FreeSurface/xml/NodalConditions.xml b/kratos.gid/apps/FreeSurface/xml/NodalConditions.xml
new file mode 100644
index 000000000..27a7d0a9f
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/NodalConditions.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/kratos.gid/apps/FreeSurface/xml/Parts.spd b/kratos.gid/apps/FreeSurface/xml/Parts.spd
new file mode 100644
index 000000000..b86a61714
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/Parts.spd
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/FreeSurface/xml/Procs.spd b/kratos.gid/apps/FreeSurface/xml/Procs.spd
new file mode 100644
index 000000000..e9fe3edae
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/Procs.spd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/kratos.gid/apps/FreeSurface/xml/Strategies.xml b/kratos.gid/apps/FreeSurface/xml/Strategies.xml
new file mode 100644
index 000000000..8879e9045
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/Strategies.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/FreeSurface/xml/XmlController.tcl b/kratos.gid/apps/FreeSurface/xml/XmlController.tcl
new file mode 100644
index 000000000..22c41053c
--- /dev/null
+++ b/kratos.gid/apps/FreeSurface/xml/XmlController.tcl
@@ -0,0 +1,58 @@
+namespace eval ::FreeSurface::xml {
+ namespace path ::FreeSurface
+ Kratos::AddNamespace [namespace current]
+ # Namespace variables declaration
+ variable dir
+}
+
+proc ::FreeSurface::xml::Init { } {
+ # Namespace variables initialization
+ variable dir
+ Model::InitVariables dir $::FreeSurface::dir
+
+
+ Model::ForgetSolutionStrategies
+ Model::getSolutionStrategies Strategies.xml
+ Model::ForgetElements
+ Model::getElements Elements.xml
+
+ Model::getNodalConditions NodalConditions.xml
+ Model::getConditions Conditions.xml
+
+
+ # Remove No splip
+ Model::ForgetCondition NoSlip2D
+ Model::ForgetCondition NoSlip3D
+}
+
+proc ::FreeSurface::xml::getUniqueName {name} {
+ return [::FreeSurface::GetAttribute prefix]${name}
+}
+
+proc ::FreeSurface::xml::CustomTree { args } {
+ spdAux::parseRoutes
+
+ apps::setActiveAppSoft Fluid
+ Fluid::xml::CustomTree
+
+ apps::setActiveAppSoft FreeSurface
+
+ spdAux::SetValueOnTreeItem v 9.8 FLGravity GravityValue
+
+ set root [customlib::GetBaseRoot]
+ foreach {n pn} [list LIN_DARCY_COEF "Linear darcy coefficient" NONLIN_DARCY_COEF "Nonlinear darcy coefficient" POROSITY "Porosity" BODY_FORCE "Body force"] {
+ if {[$root selectNodes "[spdAux::getRoute NodalResults]/value\[@n='$n'\]"] eq ""} {
+ gid_groups_conds::addF [spdAux::getRoute NodalResults] value [list n $n pn $pn v Yes values "Yes,No"]
+ }
+ }
+
+}
+
+proc ::FreeSurface::xml::UpdateParts {domNode args} {
+ set childs [$domNode getElementsByTagName group]
+ if {[llength $childs] > 1} {
+ foreach group [lrange $childs 1 end] {$group delete}
+ gid_groups_conds::actualize_conditions_window
+ error "You can only set one part"
+ }
+}
diff --git a/kratos.gid/kratos_default.spd b/kratos.gid/kratos_default.spd
index ecb12b856..044f736f5 100644
--- a/kratos.gid/kratos_default.spd
+++ b/kratos.gid/kratos_default.spd
@@ -12,6 +12,7 @@
+
diff --git a/kratos.gid/scripts/Controllers/TreeInjections.tcl b/kratos.gid/scripts/Controllers/TreeInjections.tcl
index 3313a2085..3019658a5 100644
--- a/kratos.gid/scripts/Controllers/TreeInjections.tcl
+++ b/kratos.gid/scripts/Controllers/TreeInjections.tcl
@@ -4,7 +4,7 @@
proc spdAux::SetValueOnTreeItem { field value unique_name {it "" } } {
set root [customlib::GetBaseRoot]
- #W "$field $value $name $it"
+ # W "$field $value $unique_name $it"
set node ""
set xp [spdAux::getRoute $unique_name]
@@ -15,8 +15,6 @@ proc spdAux::SetValueOnTreeItem { field value unique_name {it "" } } {
if {$node ne ""} {
gid_groups_conds::setAttributes [$node toXPath] [list $field $value]
- } {
- error "$name $it not found - Check GetFromXML.tcl file"
}
}
diff --git a/kratos.gid/scripts/Launch.tcl b/kratos.gid/scripts/Launch.tcl
index de74f9715..cb791ffea 100644
--- a/kratos.gid/scripts/Launch.tcl
+++ b/kratos.gid/scripts/Launch.tcl
@@ -150,10 +150,10 @@ proc Kratos::CheckDependenciesPipMode {} {
return $ret
}
proc Kratos::CheckDependenciesLocalPipMode {} {
-
+ return 0
}
proc Kratos::CheckDependenciesLocalMode {} {
-
+ return 0
}
proc Kratos::CheckDependenciesDockerMode {} {
set ret 0
diff --git a/kratos.gid/scripts/Logs.tcl b/kratos.gid/scripts/Logs.tcl
index 251d5d2bb..78dcce0ba 100644
--- a/kratos.gid/scripts/Logs.tcl
+++ b/kratos.gid/scripts/Logs.tcl
@@ -21,14 +21,14 @@ proc Kratos::InitLog { } {
if {[info exists Kratos::kratos_private(allow_logs)] && $Kratos::kratos_private(allow_logs)>0} {
- set kratos_private(LogFilename) [clock format [clock seconds] -format "%Y%m%d%H%M%S"].log
+ set kratos_private(LogFilename) [clock format [clock seconds] -format "%Y%m%d%H%M%S"].log
set logpath [Kratos::GetLogFilePath]
file mkdir [file dirname $logpath]
set logfile [open $logpath "a+"];
puts $logfile "Kratos Log Session"
close $logfile
set kratos_private(Log) [list ]
-
+
Kratos::AutoFlush
}
}
@@ -37,11 +37,11 @@ proc Kratos::Log {msg} {
variable kratos_private
if {[info exists kratos_private(Log)] && $Kratos::kratos_private(allow_logs) > 0} {
-
+
if {[info exists kratos_private(Log)]} {
lappend kratos_private(Log) "*~* [clock format [clock seconds] -format {%Z %Y-%m-%d %H:%M:%S }] | $msg"
- # One of the triggers is to flush if we've stored more than 5
+ # One of the triggers is to flush if we've stored more than 5
if {[llength $kratos_private(Log)] > 5} {
Kratos::FlushLog
}
@@ -51,21 +51,25 @@ proc Kratos::Log {msg} {
proc Kratos::FlushLog { } {
variable kratos_private
-
+return ""
if {[info exists kratos_private(Log)] && $Kratos::kratos_private(allow_logs) > 0} {
# only disturb the disk if we have something new to write
if {[llength $kratos_private(Log)] > 0} {
set logpath [Kratos::GetLogFilePath]
- set logfile [open $logpath "a+"];
-
+ set logfile ""
try {
+ set logfile [open $logpath "a+"];
foreach msg $kratos_private(Log) {
puts $logfile $msg
}
-
- } finally {
- close $logfile
+
+ }
+ on error {msg} {
+ W $msg
+ }
+ finally {
+ if {$logfile ne ""} {close $logfile}
}
set kratos_private(Log) [list ]
@@ -97,7 +101,7 @@ if { [GiD_Set SaveGidDefaults] } {
Kratos::InitLog
proc Kratos::MoveLogsToFolder {folder {flush_log 1}} {
-
+
if {[info exists Kratos::kratos_private(allow_logs)] && $Kratos::kratos_private(allow_logs)>0} {
if {$flush_log} {FlushLog}
if {![file exists $folder]} {file mkdir $folder}
diff --git a/kratos.gid/scripts/Writing/WriteProjectParameters.tcl b/kratos.gid/scripts/Writing/WriteProjectParameters.tcl
index 8daca4407..1955787d4 100644
--- a/kratos.gid/scripts/Writing/WriteProjectParameters.tcl
+++ b/kratos.gid/scripts/Writing/WriteProjectParameters.tcl
@@ -330,7 +330,7 @@ proc write::GetResultsByXPathList { xpath } {
set xp1 "$xpath/value"
set resultxml [$root selectNodes $xp1]
foreach res $resultxml {
- if {[get_domnode_attribute $res v] in [list "Yes" "True" "1"] && [get_domnode_attribute $res state] ne "hidden"} {
+ if {[write::isBooleanTrue [get_domnode_attribute $res v]] && [get_domnode_attribute $res state] ne "hidden"} {
set name [get_domnode_attribute $res n]
lappend result $name
}