Skip to content
2 changes: 1 addition & 1 deletion kratos.gid/apps/PfemLauncher/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"start_script":"::PfemLauncher::Init",
"requirements":{
"display_apps":["PfemFluid", "DEMPFEM", "PfemThermic", "PfemMelting"],
"display_apps":["PfemFluid", "DEMPFEM", "PfemThermic", "PfemMelting", "PfemSw"],
"minimum_gid_version":"15.1.3d"
},
"permissions": {
Expand Down
50 changes: 50 additions & 0 deletions kratos.gid/apps/PfemSw/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"id": "PfemSw",
"name": "Pfem SW Coupling",
"prefix": "PfemSw_",
"themed": false,
"kratos_name": "PfemShallowWaterApplication",
"python_packages": [
"KratosPfemFluidDynamicsApplication",
"KratosShallowWaterApplication",
"KratosMappingApplication"
],
"dimensions": [
"2D"
],
"script_files": [
"start.tcl",
"xml/XmlController.tcl",
"write/write.tcl",
"write/writeProjectParameters.tcl"
],
"start_script": "::PfemSw::Init",
"requirements":{
"apps":["ShallowWater", "PfemFluid"],
"minimum_gid_version": "15.1.3d"
},
"permissions": {
"open_tree": true,
"show_toolbar": true,
"intervals": true,
"wizard": false
},
"unique_names": {
// "parts": "STParts",
// "initial_conditions": "STInitialConditions",
// "nodal_conditions": "STNodalConditions",
// "conditions": "STLoads",
// "time_parameters": "STTimeParameters",
// "results": "STResults",
// "materials": "STMaterials"
},
"write": {
"coordinates": "all",
"materials_file": "StructuralMaterials.json",
"properties_location": "json",
"model_part_name": "Structure",
"enable_dynamic_substepping": false
},
"main_launch_file": "../../exec/MainKratos.py",
"examples": "examples/examples.xml"
}
Binary file added kratos.gid/apps/PfemSw/images/coupling.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/PfemSw/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.
23 changes: 23 additions & 0 deletions kratos.gid/apps/PfemSw/start.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace eval ::PfemSw {
Kratos::AddNamespace [namespace current]

# Variable declaration
variable dir
variable _app

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 ::PfemSw::Init { app } {
# Variable initialization
variable dir
variable _app

set _app $app
set dir [apps::getMyDir "PfemSw"]

::PfemSw::xml::Init
::PfemSw::write::Init
}
39 changes: 39 additions & 0 deletions kratos.gid/apps/PfemSw/write/write.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace eval ::PfemSw::write {
namespace path ::PfemSw
Kratos::AddNamespace [namespace current]

variable pfem_project_parameters
variable sw_project_parameters
variable mdpa_names
}

proc ::PfemSw::write::Init { } {
variable pfem_project_parameters
variable sw_project_parameters
set pfem_project_parameters [dict create ]
set sw_project_parameters [dict create ]

variable mdpa_names
set mdpa_names [dict create ]
}

# Events
proc ::PfemSw::write::writeModelPartEvent { } {
variable mdpa_names
set filename [Kratos::GetModelName]

# check folder exists

PfemFluid::write::Init
PfemFluid::write::InitConditionsMap
PfemFluid::write::SetCoordinatesByGroups 1
write::writeAppMDPA PfemFluid
dict set mdpa_names PfemFluid "${filename}_PFEM"
write::RenameFileInModel "$filename.mdpa" "pfem/[dict get $mdpa_names PfemFluid].mdpa"

ShallowWater::write::Init
ShallowWater::write::SetCoordinatesByGroups 1
write::writeAppMDPA ShallowWater
dict set mdpa_names ShallowWater "${filename}_SW"
write::RenameFileInModel "$filename.mdpa" "sw/[dict get $mdpa_names ShallowWater].mdpa"
}
47 changes: 47 additions & 0 deletions kratos.gid/apps/PfemSw/write/writeProjectParameters.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Project Parameters
proc ::PfemSw::write::getParametersDict { } {
set projectParametersDict [dict create]

return $projectParametersDict
}

proc ::PfemSw::write::writeParametersEvent { } {
set projectParametersDict [getParametersDict]
InitExternalProjectParameters
write::WriteJSON $PfemSw::write::pfem_project_parameters
write::WriteJSON $PfemSw::write::sw_project_parameters
}

proc ::PfemSw::write::GetProcessesDict { } {
set processes_dict [dict create]

return $processes_dict
}

proc ::PfemSw::write::GetOutputProcessesDict { } {
set output_processes_dict [dict create]

return $output_processes_dict
}

proc ::PfemSw::write::UpdateUniqueNames { appid } {
set unList [list "Results"]
foreach un $unList {
set current_un [apps::getAppUniqueName $appid $un]
spdAux::setRoute $un [spdAux::getRoute $current_un]
}
}

proc ::PfemSw::write::InitExternalProjectParameters { } {
# Pfem Fluid section
UpdateUniqueNames PfemFluid
apps::setActiveAppSoft PfemFluid
set PfemSw::write::pfem_project_parameters [PfemFluid::write::getParametersDict]

# Shallow water section
UpdateUniqueNames ShallowWater
apps::setActiveAppSoft ShallowWater
set PfemSw::write::sw_project_parameters [ShallowWater::write::getParametersDict]

apps::setActiveAppSoft PfemSw
}
64 changes: 64 additions & 0 deletions kratos.gid/apps/PfemSw/xml/CouplingConditions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<ConditionList>

<ConditionItem
n="ToSW"
pn="To SW"
Interval="Total"
App="PfemSw"
Type="PfemCouplingCondition"
ElementType="Line"
ProcessName="DepthIntegrationOutputProcess"
help="This process performs a depth integration in the direction of the grevity and stores the average values in order to trigger a shallow water simulation.">
<TopologyFeatures>
<item GeometryType="Line" nodes="2" KratosName="LineCondition2D2N"/>
</TopologyFeatures>
</ConditionItem>

<ConditionItem
n="FromPfem"
pn="From Pfem"
Interval="Total"
App="PfemSw"
Type="SwCouplingCondition"
ElementType="Line"
ProcessName="DepthIntegrationInputProcess"
help="This process reads the depth integrated values from a PFEM simulation and imposes them as a boundary condition.">
<TopologyFeatures>
<item GeometryType="Line" nodes="2" KratosName="LineCondition2D2N"/>
</TopologyFeatures>
</ConditionItem>

<ConditionItem
n="FromSW"
pn="From SW"
state="disabled"
Interval="Total"
App="PfemSw"
Type="PfemCouplingCondition"
ElementType="Line"
ProcessName="DepthExtrapolationOutputProcess"
help="This process records the depth integrated values from a shallow water simulation in order to feed a PFEM simulation.">
<!-- state="[checkStateByUniqueName PfemSw_SolStrat FromWsToPfem]" -->
<TopologyFeatures>
<item GeometryType="Line" nodes="2" KratosName="LineCondition2D2N"/>
</TopologyFeatures>
</ConditionItem>

<ConditionItem
n="ToPfem"
pn="To Pfem"
state="disabled"
Interval="Total"
App="PfemSw"
Type="SwCouplingCondition"
ElementType="Line"
ProcessName="DepthExtrapolationInputProcess"
help="This process extrapolate the depth integrated values over the vertical column as a PFEM boundary condition.">
<!-- state="[checkStateByUniqueName PfemSw_SolStrat FromWsToPfem]" -->
<TopologyFeatures>
<item GeometryType="Line" nodes="2" KratosName="LineCondition2D2N"/>
</TopologyFeatures>
</ConditionItem>

</ConditionList>
33 changes: 33 additions & 0 deletions kratos.gid/apps/PfemSw/xml/Main.spd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>

<container n="PfemSw" pn="Pfem SW Coupling" icon="app" prefix="PfemSw" tree_state="open" open_window="0">

<container n="PfemFluid" pn="PFEM Fluid Data" icon="pfemData" prefix="PFEMFLUID_" tree_state="open" open_window="0">
<include n="ModelType" active="1" path="apps/PfemFluid/xml/ModelType.spd"/>
<include n="Bodies" active="1" path="apps/PfemFluid/xml/Bodies.spd"/>
<include n="BoundaryConditions" active="1" path="apps/PfemFluid/xml/NodalConditions.spd"/>
<include n="CouplingConditions" active="1" path="apps/PfemSw/xml/PfemCouplingConditions.spd"/>
<include n="TimeSettings" active="1" icon="timeParams" path="apps/PfemFluid/xml/TimeSettings.spd"/>
<include n="Gravity" active="1" icon="gravityForce" path="apps/PfemFluid/xml/Gravity.spd"/>
<include n="MeshBoxes" active="1" icon="boundingBox" path="apps/PfemFluid/xml/MeshBoxes.spd"/>
<include n="SolutionStrategy" active="1" icon="linear_solver" path="apps/PfemFluid/xml/SolutionStrategy.spd"/>
<include n="Parallelism" active="1" icon="parallel_type" path="apps/Common/xml/Parallelism.spd"/>
<include n="Results" active="1" path="apps/PfemFluid/xml/Results.spd"/>
<include n="materials" active="0" path="apps/PfemFluid/xml/Materials.spd"/>
</container>

<container n="ShallowWater" pn="Shallow Water" icon="app" prefix="SW" tree_state="open" open_window="0">
<include n="AnalysisType" active="1" path="apps/ShallowWater/xml/Strategy.spd"/>
<include n="Parts" active="1" path="apps/ShallowWater/xml/Parts.spd"/>
<include n="TopographicData" active="1" path="apps/ShallowWater/xml/TopographicData.spd"/>
<include n="InitialConditions" active="1" path="apps/ShallowWater/xml/InitialConditions.spd"/>
<include n="BoundaryConditions" active="1" path="apps/ShallowWater/xml/BoundaryConditions.spd"/>
<include n="CouplingConditions" active="1" path="apps/PfemSw/xml/SwCouplingConditions.spd"/>
<include n="SolutionStrategy" active="1" path="apps/ShallowWater/xml/SolutionStrategy.spd"/>
<include n="Results" active="1" path="apps/Common/xml/Results.spd"/>
<include n="GenericSubModelPart" active="1" path="apps/Common/xml/GenericSubModelPart.spd"/>
<include n="Intervals" active="1" path="apps/Common/xml/Intervals.spd"/>
<include n="Materials" active="1" path="apps/ShallowWater/xml/Materials.spd"/>
</container>

</container>
4 changes: 4 additions & 0 deletions kratos.gid/apps/PfemSw/xml/PfemCouplingConditions.spd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<container n="CouplingConditions" pn="Coupling conditions" un="PfemSw_PfemConditions" icon="coupling" open_window="0">
<dynamicnode command="spdAux::injectConditions" args="App PfemSw Type PfemCouplingCondition"/>
</container>
63 changes: 63 additions & 0 deletions kratos.gid/apps/PfemSw/xml/Processes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>

<ProcessList>

<Process
n="DepthIntegrationOutputProcess"
pn="DepthIntegrationOutputProcess"
python_module="depth_integration_output_process"
kratos_module="KratosMultiphysics.ShallowWaterApplication.coupling">
<inputs>
<!-- <parameter n="volume_model_part_name" pn="Volume model part" help="This is the computing part, doesnt need to be selected by the user"/> -->
<!-- <parameter n="interface_model_part_name" pn="Interface model part" help="An interface belonging to the PFEM structure/fixed domain"/> -->
<parameter n="output_model_part_name" pn="Output model part name" v="Interface" help="This name must be in accordance with the shallow water input model part name. It is an auxiliary name and the corresponding model part mustnt exist"/>
<parameter n="store_historical_database" pn="Store historical database" type="bool" v="0"/>
<parameter n="extrapolate_boundaries" pn="Extrapolate boundaries" type="bool" v="0"/>
<parameter n="print_velocity_profile" pn="Print velocity profile" type="bool" v="0"/>
<!-- <parameter n="file_settings" pn="File settings" help="container of output file settings"/> -->
<!-- <parameter n="file_name" pn="File name" v="hdf5/<model_part_name>-<time>.h5" help="The path must be in accordance with the shallow water simulation"/> -->
<!-- <parameter n="output_time_settings" pn="Output time settings" help="container of output time settings"/> -->
<parameter n="step_frequency" pn="step_frequency" v="10" />
</inputs>
</Process>

<Process
n="DepthIntegrationInputProcess"
pn="DepthIntegrationInputProcess"
python_module="depth_integration_input_process"
kratos_module="KratosMultiphysics.ShallowWaterApplication.coupling">
<inputs>
<!-- <parameter n="interface_model_part_name" pn="Interface model part" help="The boundary condition belonging to the shallow water domain."/> -->
<parameter n="input_model_part_name" pn="Input model part name" v="Interface" help="This name must be in accordance with the PFEM output model part name. It is an auxiliary name and the corresponding model part mustnt exist"/>
<parameter n="read_historical_database" pn="Read historical database" type="bool" v="0" help="This option must be the same than the one selected on the PFEM settings."/>
<!-- <parameter n="list_of_variables" pn="List of variables" v="MOMENTUM"/> -->
<!-- <parameter n="list_of_variables_to_fix" pn="List of variables to fix" v="MOMENTUM_X,MOMENTUM_Y"/> -->
<parameter n="smooth_solution_after_interval" pn="Smooth solution after interval" type="bool" v="1"/>
<parameter n="default_time_after_interval" pn="Default time after interval" type="double" v="0.0" help="This time step will be applied after the interval."/>
<parameter n="semi_period_after_interval" pn="Semi period after interval" type="double" v="1.0" help="The exponential decay between the last value read and the default value."/>
<parameter n="swap_yz_axis" pn="Swap YZ axis" type="bool" v="0" help="Select this option whether the gravity vector is orthogonal among the PFEM and SW simulations"/>
<parameter n="ignore_vertical_component" pn="Ignore vertical component" type="bool" v="1" help="Ignore the Z component of the vector applied a SW BC."/>
<!-- <parameter n="file_settings" pn="File settings" help="container of output file settings"/> -->
<!-- <parameter n="file_name" pn="File name" v="../pfem/hdf5/<model_part_name>-<time>.h5" help="The path must be in accordance with the PFEM simulation"/> -->
</inputs>
</Process>

<Process
n="DepthExtrapolationOutputProcess"
pn="DepthExtrapolationOutputProcess"
python_module="depth_extrapolation_output_process"
kratos_module="KratosMultiphysics.ShallowWaterApplication.coupling">
<inputs>
</inputs>
</Process>

<Process
n="DepthExtrapolationInputProcess"
pn="DepthExtrapolationInputProcess"
python_module="DepthExtrapolationInputProcess"
kratos_module="KratosMultiphysics.ShallowWaterApplication.coupling">
<inputs>
</inputs>
</Process>

</ProcessList>
8 changes: 8 additions & 0 deletions kratos.gid/apps/PfemSw/xml/Procs.spd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<container n="procs" pn="procs" includeContainer="No">
<proc n='CheckNodalConditionStatePFEM' args='args'>
<![CDATA[
return [PfemFluid::xml::ProcCheckNodalConditionStatePFEM $domNode $args]
]]>
</proc>
</container>
4 changes: 4 additions & 0 deletions kratos.gid/apps/PfemSw/xml/SwCouplingConditions.spd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<container n="CouplingConditions" pn="Copling conditions" un="PfemSw_SwConditions" icon="coupling" open_window="0">
<dynamicnode command="spdAux::injectConditions" args="App PfemSw Type SwCouplingCondition"/>
</container>
Loading