@@ -178,8 +178,10 @@ proc Fluid::write::getSolverSettingsDict { } {
178178 dict set solverSettingsDict model_part_name [GetAttribute model_part_name]
179179 set nDim [expr [string range [write::getValue nDim] 0 0]]
180180 dict set solverSettingsDict domain_size $nDim
181- set currentStrategyId [write::getValue FLSolStrat]
182- set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId ] getAttribute " ImplementedInPythonFile" ]
181+ set currentStrategyId [write::getValue FLSolStrat " " force]
182+ set strategy [::Model::GetSolutionStrategy $currentStrategyId ]
183+ set strategy_write_name [$strategy getAttribute " ImplementedInPythonFile" ]
184+ set strategy_type [$strategy getAttribute " Type" ]
183185 dict set solverSettingsDict solver_type $strategy_write_name
184186
185187 # model import settings
@@ -207,7 +209,7 @@ proc Fluid::write::getSolverSettingsDict { } {
207209 dict set solverSettingsDict no_skin_parts [getNoSkinConditionMeshId]
208210
209211 # Time scheme settings
210- if {$currentStrategyId eq " Monolithic " } {
212+ if {$strategy_type eq " monolithic " } {
211213 dict set solverSettingsDict time_scheme [write::getValue FLScheme]
212214 }
213215
@@ -225,23 +227,14 @@ proc Fluid::write::getSolverSettingsDict { } {
225227 dict set solverSettingsDict time_stepping $timeSteppingDict
226228
227229 # For monolithic schemes, set the formulation settings
228- if {$currentStrategyId eq " Monolithic " } {
230+ if {$strategy_type eq " monolithic " } {
229231 # Create formulation dictionary
230232 set formulationSettingsDict [dict create]
231233
232234 # Set formulation dictionary element type
233235 set elements [Fluid::write::GetUsedElements]
234236 if {[llength $elements ] ne 1} {error " You must select 1 element" } {set element_name [lindex $elements 0]}
235- if {$element_name eq " QSVMS2D" || $element_name eq " QSVMS3D" } {
236- set element_type " qsvms"
237- } elseif {$element_name eq " DVMS2D" || $element_name eq " DVMS3D" } {
238- set element_type " dvms"
239- } elseif {$element_name eq " FIC2D" || $element_name eq " FIC3D" } {
240- set element_type " fic"
241- } else {
242- set err [concat " Wrong monolithic element type: " $element_name ]
243- error $err
244- }
237+ set element_type [Fluid::write::GetMonolithicElementTypeFromElementName $element_name ]
245238 dict set formulationSettingsDict element_type $element_type
246239
247240 # Set OSS and remove oss_switch from the original dictionary
@@ -252,7 +245,7 @@ proc Fluid::write::getSolverSettingsDict { } {
252245 }
253246
254247 # Set dynamic tau and remove dynamic_tau from the original dictionary
255- if {$element_name eq " QSVMS2D " || $element_name eq " QSVMS3D " } {
248+ if {$element_type eq " qsvms " } {
256249 dict set formulationSettingsDict dynamic_tau [dict get $solverSettingsDict dynamic_tau]
257250 dict unset solverSettingsDict dynamic_tau
258251 # Include the formulation settings in the solver settings dict
@@ -261,4 +254,11 @@ proc Fluid::write::getSolverSettingsDict { } {
261254 }
262255
263256 return $solverSettingsDict
257+ }
258+
259+ proc Fluid::write::GetMonolithicElementTypeFromElementName {element_name} {
260+ set element [Model::getElement $element_name ]
261+ if {![$element hasAttribute FormulationElementType]} {error " Your monolithic element $element_name need to define the FormulationElementType field" }
262+ set formulation_element_type [$element getAttribute FormulationElementType]
263+ return {*}$formulation_element_type
264264}
0 commit comments