Hello,
I have conditions (e.g: extremities hinges) applied over lines. But these conditions apply on the lines extremities only. When I mesh the structure, the lines are divided into several meshed elements. Each element has the condition that is applied on the line but only the first and the last one must have it. I can write a procedure to unassign the condition from the unnecessary elements but I have to know the origin line of a meshed element.
So my question is: when I have a meshed element id, is there a way to know the line id (geometry) that was used to generate this element ?
Thanks.
Origin line number of a meshed element?
Moderator: GiD Team
Re: Origin line number of a meshed element?
It is possible to do a trick,
use a self-filled field of a condition to store the 'source geometric entity id', with #FUNC#(NumEntity) (this field could be set as hidden if do you prefer)
Condition:
...
QUESTION: my_question#FUNC#(NumEntity)
Have a look also to this topic: http://www.gidhome.com/forum/viewtopic.php?f=9&t=3684
use a self-filled field of a condition to store the 'source geometric entity id', with #FUNC#(NumEntity) (this field could be set as hidden if do you prefer)
Condition:
...
QUESTION: my_question#FUNC#(NumEntity)
Have a look also to this topic: http://www.gidhome.com/forum/viewtopic.php?f=9&t=3684
Re: Origin line number of a meshed element?
I think that I already have done some similar that do you want, in an 'academic problemtype' for matricial analysis of frames, to represent a punctual load on a bar. Study my code:
This is part of my problemtype: .cnd
and part of the Tcl that do the trick that you suggest (automatically replace the condition applied on all elements of the line by only one condition applied on the element and its relative location where the load is applied)
This is part of my problemtype: .cnd
Code: Select all
CONDITION: line_Interior_point_load
CONDTYPE: over lines
CONDMESHTYPE: over body elements
CANREPEAT: yes
QUESTION: Id#FUNC#(NumEntity)
VALUE: 0
STATE: HIDDEN
HELP: auxiliary hidden field to identify the geometri line id source of each the mesh element
QUESTION: Coordinates_system#CB#(Global,Local)
VALUE: Global
HELP: To allow specify the force in global XYZ axes or local bar axes
QUESTION: Relative_position
VALUE: 0.5
HELP: Relative coordinates (0.0 to 1.0) along the line element to define the location
TKWIDGET: GidUtils::TkwidgetPickRelativePointInElement
QUESTION: Force_x#UNITS#
VALUE: 0.0 N
HELP: x-component of concentrated load
QUESTION: Force_y#UNITS#
VALUE: 0.0 N
HELP: y-component of concentrated load
QUESTION: Force_z#UNITS#
VALUE: 0.0 N
HELP: z-component of concentrated load
END CONDITION
Code: Select all
proc AfterMeshGeneration { fail } {
if { !$fail } {
Frame3DD::TransferSpecialConditions
}
return ""
}
namespace eval Frame3DD {
}
proc Frame3DD::TransferSpecialConditions { } {
#line_Interior_point_load must replace all elements of the same geometric entiy
#by a single element where the parameters lies
set condition_names {line_Interior_point_load}
set element_level line
foreach condition_name $condition_names {
array unset geometry_elements
foreach item [GiD_Info Conditions $condition_name mesh] {
set element_id [lindex $item 1]
#use as key all applied values instead geometry_id, because allow repeat the condition, then the geometry_id is not enough
#the values are then stored in the key
set key [lrange $item 3 end]
lappend geometry_elements($key) $element_id
}
GiD_UnAssignData Condition $condition_name Elements all
foreach key [array names geometry_elements] {
if { $condition_name == "line_Interior_point_load" } {
lassign $key geometry_id coordinates_system parameters fx fy fz ;#Id hidden field to identify geometry parent
set xyz [GiD_Info Parametric $element_level $geometry_id coord {*}$parameters]
set element_id [GidUtils::GetClosestElement $element_level $xyz $geometry_elements($key)]
if { $element_id != "" } {
set res [GidUtils::GetElementRelativeCoordinatesFromCoord $element_level $xyz $element_id]
set relative_coordinates [lrange $res 0 end-1]
set new_values [list $geometry_id $coordinates_system $relative_coordinates $fx $fy $fz]
GiD_AssignData condition $condition_name Elements $new_values $element_id
} else {
W "projection $element_level element not found"
}
} elseif { $condition_name == "line_Trapezoidal_load" } {
lassign $key geometry_id coordinates_system start_parameters start_fx start_fy start_fz \
end_parameters end_fx end_fy end_fz;#Id hidden field to identify geometry parent
#take into account units
foreach axis {x y z} {
lassign [GidConvertValueUnit [set start_f$axis]] start_f$axis strength_linear_unit
lassign [GidConvertValueUnit [set end_f$axis]] end_f$axis strength_linear_unit
}
set start_xyz [GiD_Info Parametric $element_level $geometry_id coord {*}$start_parameters]
set end_xyz [GiD_Info Parametric $element_level $geometry_id coord {*}$end_parameters]
array unset node_t
foreach element_id $geometry_elements($key) {
foreach node_id [lrange [GiD_Mesh get element $element_id] 3 4] {
if { ![info exists node_t($node_id)] } {
set xyz [lrange [GiD_Mesh get node $node_id] 1 3]
set node_t($node_id) [GiD_Info Parametric $element_level $geometry_id t_fromcoord {*}$xyz]
}
}
}
foreach element_id $geometry_elements($key) {
lassign [lrange [GiD_Mesh get element $element_id] 3 4] n0 n1
if { $node_t($n0)<$end_parameters && $node_t($n1)>$start_parameters} {
if { $node_t($n0)<$start_parameters } {
#start_parameters is inside this element
set line_t0 $start_parameters
set element_t0 [expr {($line_t0-$node_t($n0))/($node_t($n1)-$node_t($n0))}]
} else {
set line_t0 $node_t($n0)
set element_t0 0.0
}
if { $node_t($n1)>$end_parameters } {
#start_parameters is inside this element
set line_t1 $end_parameters
set element_t1 [expr {($line_t1-$node_t($n0))/($node_t($n1)-$node_t($n0))}]
} else {
set line_t1 $node_t($n1)
set element_t1 1.0
}
foreach axis {x y z} {
set data [list $start_parameters [set start_f${axis}] $end_parameters [set end_f${axis}]]
set start_element_f${axis} [math::interpolate::interp-linear $data $line_t0]$strength_linear_unit
set end_element_f${axis} [math::interpolate::interp-linear $data $line_t1]$strength_linear_unit
}
set new_values [list $geometry_id $coordinates_system \
$element_t0 $start_element_fx $start_element_fy $start_element_fz \
$element_t1 $end_element_fx $end_element_fy $end_element_fz]
GiD_AssignData condition $condition_name Elements $new_values $element_id
}
}
} else {
W "unexpected condition_name=$condition_name"
}
}
}
}
Re: Origin line number of a meshed element?
Hi Escelano,
Thanks for your answer. It Works. I also had the problem for punctual and trapezoidal loads.
Thanks for your answer. It Works. I also had the problem for punctual and trapezoidal loads.