Traction boundary conditions in spd/tcl files

Moderator: GiD Team

Post Reply
waseda
Posts: 13
Joined: Thu Dec 24, 2015 4:31 am
Location: Japan
Contact:

Traction boundary conditions in spd/tcl files

Post by waseda »

Hi,
I would like to set traction boundary conditions (ts1, ts2, tn) for a 3D problem. The traction is applied to element surface and, in spd file, I specify:

[spd file]
<!-- Traction boundary conditions -->
<condition n="Trac_Bc" pn="Traction boundary conditions" ov="surface" ovm="" icon="darkorange-weight-18" groups_icon="yelowish-group" help="Concentrated mass">
<value n="Ts1" pn="Shear Traction 1" v="0.0" help="Specify Ts1"/>
<symbol proc="gid_groups_conds::draw_symbol_image weight-18.png" orientation="global"/>
<value n="Ts2" pn="Shear Traction 2" v="0.0" help="Specify Ts2"/>
<symbol proc="gid_groups_conds::draw_symbol_image weight-18.png" orientation="global"/>
<value n="Tn" pn="Normal Traction" v="0.0" help="Specify Tn"/>
<symbol proc="gid_groups_conds::draw_symbol_image weight-18.png" orientation="global"/>
</condition>

For my input file, I need to write the following information:
* Number of elements (element faces) specified by traction boundary conditions.
* Node numbers (connectivity information) on the loaded face
* Value of normal traction

[tcl file]
customlib::WriteString "Traction Boundary Conditions"
customlib::WriteString "nsurface/ie connectivites Tn "
set list2 [list "Trac_Bc"]
set condition_formats [list {"%10d" "element" "id"} {"%10d" "element" "connectivities"} {"%13.5e" "property" "Tn"}]
set format_tn [customlib::GetElementsFormats $list2 $condition_formats]
set number_of_loaded_elements [GiD_WriteCalculationFile elements -count $format_tn]
customlib::WriteConnectivities $list2 $format_tn "" active

Could you please point out what I am missing here?

Kenji Furui
waseda
Posts: 13
Joined: Thu Dec 24, 2015 4:31 am
Location: Japan
Contact:

Re: Traction boundary conditions in spd/tcl files

Post by waseda »

=== SOLVED ===
I've solved the problem I posted on the forum. In the spd file, I set ovm = "face_element" as follows:

<!-- Traction boundary conditions -->
<condition n="Trac_Bc" pn="Traction boundary conditions" ov="surface" ovm="face_element" icon="darkorange-weight-18" groups_icon="yelowish-group" help="Surface loading">
<value n="Ts1" pn="Shear Traction 1" v="0.0" help="Specify Ts1"/>
<symbol proc="gid_groups_conds::draw_symbol_image weight-18.png" orientation="global"/>
<value n="Ts2" pn="Shear Traction 2" v="0.0" help="Specify Ts2"/>
<symbol proc="gid_groups_conds::draw_symbol_image weight-18.png" orientation="global"/>
<value n="Tn" pn="Normal Traction" v="0.0" help="Specify Tn"/>
<symbol proc="gid_groups_conds::draw_symbol_image weight-18.png" orientation="global"/>
</condition>

Then, in the tcl file, the following code is used for writing # of element faces loaded by Trac_Bc,the element number, node ids, and associated traction values (Ts1,Ts2, and Tn) in the input file.

customlib::WriteString "(X) Traction Boundary Conditions"
customlib::WriteString "nsurface/ie Tn "
set list2 [list "Trac_Bc"]
set condition_formats_trac [list {"%10d" "element" "id"} {"%13.5e" "property" "Tn"}]
set formats_trac [customlib::GetElementsFormats $list2 $condition_formats_trac]
set number_of_elements_trac [GiD_WriteCalculationFile elements -count $formats_trac]
customlib::WriteString $number_of_elements_trac
set document [$::gid_groups_conds::doc documentElement]
set xpath "./condition\[@n = 'Trac_Bc' \]/group"
set groups [$document selectNodes $xpath]
foreach group $groups {
set group_name [get_domnode_attribute $group n]
set Ts1_node [$group selectNodes "./value\[@n = 'Ts1'\]"]
set Ts1_value [get_domnode_attribute $Ts1_node v]
set Ts2_node [$group selectNodes "./value\[@n = 'Ts2'\]"]
set Ts2_value [get_domnode_attribute $Ts2_node v]
set Tn_node [$group selectNodes "./value\[@n = 'Tn'\]"]
set Tn_value [get_domnode_attribute $Tn_node v]
GiD_WriteCalculationFile elements -elements_faces faces -print_faces_conecs [dict create $group_name "%d %d %d %d %d $Ts1_value $Ts2_value $Tn_value\n"]
}
Post Reply