|
1 | | -namespace eval Fluid::xml { |
2 | | - # Namespace variables declaration |
3 | | - variable dir |
4 | | -} |
5 | | - |
6 | | -proc Fluid::xml::Init { } { |
7 | | - # Namespace variables inicialization |
8 | | - variable dir |
9 | | - Model::InitVariables dir $Fluid::dir |
10 | | - |
11 | | - Model::getSolutionStrategies Strategies.xml |
12 | | - Model::getElements Elements.xml |
13 | | - Model::getMaterials Materials.xml |
14 | | - Model::getNodalConditions NodalConditions.xml |
15 | | - Model::getConstitutiveLaws ConstitutiveLaws.xml |
16 | | - Model::getProcesses "../../Common/xml/Processes.xml" |
17 | | - Model::getProcesses Processes.xml |
18 | | - Model::getConditions Conditions.xml |
19 | | - Model::getSolvers "../../Common/xml/Solvers.xml" |
20 | | - |
21 | | -} |
22 | | - |
23 | | -proc Fluid::xml::getUniqueName {name} { |
24 | | - return ${::Fluid::prefix}${name} |
25 | | -} |
26 | | - |
27 | | -proc Fluid::xml::CustomTree { args } { |
28 | | - set root [customlib::GetBaseRoot] |
29 | | - |
30 | | - # Output control in output settings |
31 | | - spdAux::SetValueOnTreeItem v time FLResults FileLabel |
32 | | - spdAux::SetValueOnTreeItem v time FLResults OutputControlType |
33 | | - |
34 | | - # Drag in output settings |
35 | | - set xpath "[spdAux::getRoute FLResults]/container\[@n='GiDOutput'\]" |
36 | | - if {[$root selectNodes "$xpath/condition\[@n='Drag'\]"] eq ""} { |
37 | | - gid_groups_conds::addF $xpath include [list n Drag active 1 path {apps/Fluid/xml/Drag.spd}] |
38 | | - } |
39 | | - |
40 | | - customlib::ProcessIncludes $::Kratos::kratos_private(Path) |
41 | | - spdAux::parseRoutes |
42 | | - |
43 | | - # Nodal reactions in output settings |
44 | | - if {[$root selectNodes "$xpath/container\[@n='OnNodes'\]"] ne ""} { |
45 | | - gid_groups_conds::addF "$xpath/container\[@n='OnNodes'\]" value [list n REACTION pn "Reaction" v No values "Yes,No"] |
46 | | - } |
47 | | - |
48 | | - # TODO: remove when Non newtonian is implemented for 2d |
49 | | - if {$::Model::SpatialDimension eq "2D"} { Model::ForgetConstitutiveLaw HerschelBulkley } |
50 | | -} |
51 | | - |
52 | | -# Usage |
53 | | -# Fluid::xml::CreateNewInlet Inlet {new false name Total} true "6*y*(1-y)" |
54 | | -proc Fluid::xml::CreateNewInlet { base_group_name {interval_data {new true name inlet1 ini 0 end "End"}} {uses_formula false} {value 10.0} {direction automatic_inwards_normal} {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { |
55 | | - # Fluid Inlet |
56 | | - set nd $::Model::SpatialDimension |
57 | | - set condtype line |
58 | | - if {$nd eq "3D"} { set condtype surface } |
59 | | - |
60 | | - set fluidConditions [spdAux::getRoute $fluid_conditions_UN] |
61 | | - set fluidInlet "$fluidConditions/condition\[@n='$inlet_condition_name_base$nd'\]" |
62 | | - |
63 | | - set interval_name [dict get $interval_data name] |
64 | | - if {[write::isBooleanTrue [dict get $interval_data new]]} { |
65 | | - spdAux::CreateInterval $interval_name [dict get $interval_data ini] [dict get $interval_data end] |
66 | | - |
67 | | - } |
68 | | - GiD_Groups create "$base_group_name//$interval_name" |
69 | | - GiD_Groups edit state "$base_group_name//$interval_name" hidden |
70 | | - spdAux::AddIntervalGroup $base_group_name "$base_group_name//$interval_name" |
71 | | - set inletNode [customlib::AddConditionGroupOnXPath $fluidInlet "$base_group_name//$interval_name"] |
72 | | - $inletNode setAttribute ov $condtype |
73 | | - if {[write::isBooleanTrue $uses_formula]} { |
74 | | - set function $value |
75 | | - set props [list ByFunction Yes function_modulus $function direction $direction Interval $interval_name] |
76 | | - } else { |
77 | | - set props [list ByFunction No modulus $value direction $direction Interval $interval_name] |
78 | | - } |
79 | | - foreach {prop val} $props { |
80 | | - set propnode [$inletNode selectNodes "./value\[@n = '$prop'\]"] |
81 | | - if {$propnode ne "" } { |
82 | | - $propnode setAttribute v $val |
83 | | - } else { |
84 | | - W "Warning - Couldn't find property Inlet $prop" |
85 | | - } |
86 | | - } |
87 | | - |
88 | | -} |
89 | | - |
90 | | - |
91 | | -proc Fluid::xml::ClearInlets { delete_groups {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { |
92 | | - |
93 | | - set nd $::Model::SpatialDimension |
94 | | - set fluidConditions [spdAux::getRoute $fluid_conditions_UN] |
95 | | - set fluidInlets "$fluidConditions/condition\[@n='$inlet_condition_name_base$nd'\]/group" |
96 | | - foreach inlet [[customlib::GetBaseRoot] selectNodes $fluidInlets] { |
97 | | - set group_name [$inlet @n] |
98 | | - if {[GiD_Groups exists $group_name]} {set group_name [GiD_Groups get parent $group_name]} |
99 | | - $inlet delete |
100 | | - if {$delete_groups} { |
101 | | - if {[GiD_Groups exists $group_name]} {GiD_Groups delete $group_name} |
102 | | - } |
103 | | - } |
104 | | -} |
105 | | - |
106 | | -Fluid::xml::Init |
| 1 | +namespace eval Fluid::xml { |
| 2 | + # Namespace variables declaration |
| 3 | + variable dir |
| 4 | +} |
| 5 | + |
| 6 | +proc Fluid::xml::Init { } { |
| 7 | + # Namespace variables inicialization |
| 8 | + variable dir |
| 9 | + Model::InitVariables dir $Fluid::dir |
| 10 | + |
| 11 | + Model::getSolutionStrategies Strategies.xml |
| 12 | + Model::getElements Elements.xml |
| 13 | + Model::getMaterials Materials.xml |
| 14 | + Model::getNodalConditions NodalConditions.xml |
| 15 | + Model::getConstitutiveLaws ConstitutiveLaws.xml |
| 16 | + Model::getProcesses "../../Common/xml/Processes.xml" |
| 17 | + Model::getProcesses Processes.xml |
| 18 | + Model::getConditions Conditions.xml |
| 19 | + Model::getSolvers "../../Common/xml/Solvers.xml" |
| 20 | + |
| 21 | +} |
| 22 | + |
| 23 | +proc Fluid::xml::getUniqueName {name} { |
| 24 | + return ${::Fluid::prefix}${name} |
| 25 | +} |
| 26 | + |
| 27 | +proc Fluid::xml::CustomTree { args } { |
| 28 | + set root [customlib::GetBaseRoot] |
| 29 | + |
| 30 | + # Output control in output settings |
| 31 | + spdAux::SetValueOnTreeItem v time FLResults FileLabel |
| 32 | + spdAux::SetValueOnTreeItem v time FLResults OutputControlType |
| 33 | + |
| 34 | + # Drag in output settings |
| 35 | + set xpath "[spdAux::getRoute FLResults]/container\[@n='GiDOutput'\]" |
| 36 | + if {[$root selectNodes "$xpath/condition\[@n='Drag'\]"] eq ""} { |
| 37 | + gid_groups_conds::addF $xpath include [list n Drag active 1 path {apps/Fluid/xml/Drag.spd}] |
| 38 | + } |
| 39 | + |
| 40 | + customlib::ProcessIncludes $::Kratos::kratos_private(Path) |
| 41 | + spdAux::parseRoutes |
| 42 | + |
| 43 | + # Nodal reactions in output settings |
| 44 | + if {[$root selectNodes "$xpath/container\[@n='OnNodes'\]"] ne ""} { |
| 45 | + gid_groups_conds::addF "$xpath/container\[@n='OnNodes'\]" value [list n REACTION pn "Reaction" v No values "Yes,No"] |
| 46 | + } |
| 47 | + |
| 48 | + # TODO: remove when Non newtonian is implemented for 2d |
| 49 | + if {$::Model::SpatialDimension eq "2D"} { Model::ForgetConstitutiveLaw HerschelBulkley } |
| 50 | +} |
| 51 | + |
| 52 | +# Usage |
| 53 | +# Fluid::xml::CreateNewInlet Inlet {new false name Total} true "6*y*(1-y)" |
| 54 | +proc Fluid::xml::CreateNewInlet { base_group_name {interval_data {new true name inlet1 ini 0 end "End"}} {uses_formula false} {value 10.0} {direction automatic_inwards_normal} {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { |
| 55 | + # Fluid Inlet |
| 56 | + set nd $::Model::SpatialDimension |
| 57 | + set condtype line |
| 58 | + if {$nd eq "3D"} { set condtype surface } |
| 59 | + |
| 60 | + set fluidConditions [spdAux::getRoute $fluid_conditions_UN] |
| 61 | + set fluidInlet "$fluidConditions/condition\[@n='$inlet_condition_name_base$nd'\]" |
| 62 | + |
| 63 | + set interval_name [dict get $interval_data name] |
| 64 | + if {[write::isBooleanTrue [dict get $interval_data new]]} { |
| 65 | + spdAux::CreateInterval $interval_name [dict get $interval_data ini] [dict get $interval_data end] |
| 66 | + |
| 67 | + } |
| 68 | + GiD_Groups create "$base_group_name//$interval_name" |
| 69 | + GiD_Groups edit state "$base_group_name//$interval_name" hidden |
| 70 | + spdAux::AddIntervalGroup $base_group_name "$base_group_name//$interval_name" |
| 71 | + set inletNode [customlib::AddConditionGroupOnXPath $fluidInlet "$base_group_name//$interval_name"] |
| 72 | + $inletNode setAttribute ov $condtype |
| 73 | + if {[write::isBooleanTrue $uses_formula]} { |
| 74 | + set function $value |
| 75 | + set props [list ByFunction Yes function_modulus $function direction $direction Interval $interval_name] |
| 76 | + } else { |
| 77 | + set props [list ByFunction No modulus $value direction $direction Interval $interval_name] |
| 78 | + } |
| 79 | + foreach {prop val} $props { |
| 80 | + set propnode [$inletNode selectNodes "./value\[@n = '$prop'\]"] |
| 81 | + if {$propnode ne "" } { |
| 82 | + $propnode setAttribute v $val |
| 83 | + } else { |
| 84 | + W "Warning - Couldn't find property Inlet $prop" |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | +} |
| 89 | + |
| 90 | + |
| 91 | +proc Fluid::xml::ClearInlets { delete_groups {fluid_conditions_UN FLBC} {inlet_condition_name_base AutomaticInlet} } { |
| 92 | + |
| 93 | + set nd $::Model::SpatialDimension |
| 94 | + set fluidConditions [spdAux::getRoute $fluid_conditions_UN] |
| 95 | + set fluidInlets "$fluidConditions/condition\[@n='$inlet_condition_name_base$nd'\]/group" |
| 96 | + foreach inlet [[customlib::GetBaseRoot] selectNodes $fluidInlets] { |
| 97 | + set group_name [$inlet @n] |
| 98 | + if {[GiD_Groups exists $group_name]} {set group_name [GiD_Groups get parent $group_name]} |
| 99 | + $inlet delete |
| 100 | + if {$delete_groups} { |
| 101 | + if {[GiD_Groups exists $group_name]} {GiD_Groups delete $group_name} |
| 102 | + } |
| 103 | + } |
| 104 | +} |
| 105 | + |
| 106 | +Fluid::xml::Init |
0 commit comments