Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dd73f48
FreeSurface Add initial files
jginternational Jun 27, 2022
d336399
Merge branch 'master' into add/freesurface
jginternational Jul 21, 2022
0fd62a8
Add displacements
jginternational Jul 21, 2022
38997e3
Remove no slip
jginternational Jul 21, 2022
c9a4208
Enable 2d
jginternational Jul 21, 2022
7435868
Add conditions Porosity and coefficient
jginternational Jul 21, 2022
66869fc
simplify
jginternational Jul 21, 2022
52e8c9f
Add strategy Level set
jginternational Jul 21, 2022
5dec819
hotfix displacement
jginternational Jul 21, 2022
aa0aa5c
hotfix set value
jginternational Jul 21, 2022
d3da799
refactor Fluid write
jginternational Jul 21, 2022
209f308
Custom parts, no materials
jginternational Jul 21, 2022
c845869
default values in conditions
jginternational Jul 21, 2022
f46f095
displacement process
jginternational Jul 21, 2022
4bd1d95
Write mdpa
jginternational Jul 21, 2022
59f2430
Custom parts
jginternational Jul 21, 2022
02456ec
Write project parameters
jginternational Jul 21, 2022
4ef1572
DISTANCE
jginternational Jul 21, 2022
c798fee
example create geometry
jginternational Jul 21, 2022
f14e3a7
example create groups
jginternational Jul 21, 2022
7bee7c9
example finished
jginternational Jul 21, 2022
f7dd29d
proper submodelpart mesh
jginternational Jul 21, 2022
05a95fc
model part name is model name
jginternational Jul 21, 2022
4143e9e
Simplify tree and element
jginternational Jul 21, 2022
3681d31
gravity
jginternational Jul 21, 2022
55d107a
fix local version
jginternational Jul 21, 2022
f6ffa61
nodal result
jginternational Jul 21, 2022
37f3bfc
boolean true
jginternational Jul 21, 2022
ed011e5
capital
jginternational Jul 21, 2022
5c857e1
Correct some problems
joaquinirazabal Jul 22, 2022
a5f7706
typo in logo
jginternational Jul 24, 2022
145c290
remove conditions
jginternational Jul 24, 2022
1291ff5
Fix example
joaquinirazabal Jul 26, 2022
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
1 change: 1 addition & 0 deletions kratos.gid/apps/Examples/xml/examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
<link path="apps/PfemFluid/examples/examples.xml"/>
<link path="apps/PfemThermic/examples/examples.xml"/>
<link path="apps/ShallowWater/examples/examples.xml"/>
<link path="apps/FreeSurface/examples/examples.xml"/>
</examples>
23 changes: 14 additions & 9 deletions kratos.gid/apps/Fluid/write/writeProjectParameters.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 { } {
Expand Down Expand Up @@ -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
}

Expand Down
10 changes: 5 additions & 5 deletions kratos.gid/apps/FluidLauncher/start.tcl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
namespace eval ::FluidLauncher {
Kratos::AddNamespace [namespace current]

variable available_apps
}

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" } {
Expand Down Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions kratos.gid/apps/FreeSurface/app.json
Original file line number Diff line number Diff line change
@@ -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"
}
151 changes: 151 additions & 0 deletions kratos.gid/apps/FreeSurface/examples/Box.tcl
Original file line number Diff line number Diff line change
@@ -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


}
14 changes: 14 additions & 0 deletions kratos.gid/apps/FreeSurface/examples/examples.tcl
Original file line number Diff line number Diff line change
@@ -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}
}
}

6 changes: 6 additions & 0 deletions kratos.gid/apps/FreeSurface/examples/examples.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Group id="Fluid" name="Fluid examples">
<Example id="FreeSurfaceBox2D" app="FreeSurface" logo="box2d.png" name="Free surface 2d" dim="2D" cmd="::FreeSurface::examples::Box::Init">
<Description></Description>
</Example>
</Group>
Binary file added kratos.gid/apps/FreeSurface/images/box2d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added kratos.gid/apps/FreeSurface/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions kratos.gid/apps/FreeSurface/start.tcl
Original file line number Diff line number Diff line change
@@ -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

}
43 changes: 43 additions & 0 deletions kratos.gid/apps/FreeSurface/write/write.tcl
Original file line number Diff line number Diff line change
@@ -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
}
Loading