I am a novice programmer, and I am trying to implement a finite element solution. I think I am trying to solve a common algorithm, but I am not sure what it is called. I will try my best to describe it.
The problem:
We are given a steel cross section. The section is discretized into elements. Each element has two nodes, start of 'i' and end of 'j'.
This is the example I am working with:
https://imgur.com/gNCNICN
I am trying to describe the "Element Area" at each node, I'm calling this
W[i]
.
W[i]
stores the area at each node, from node 1 to n.
Each element has a variation of "Element Area", I'm calling it
Delta_W[i]
.
Delta_W[i]
stores the variation for each element, from element 1 to n
We know
Delta_W[i]
(the variation) for each element. However, I don't know the
W[i]
at each particular node.
By definition the start node(i) of the first element has area of 0:
W[0]=0;
Since the variation of W is known for the first element, the area at the end node j can be calculated:
W[1] = W[0]+Delta_W[0];
Now, I want to try and calculate the "Element Area" at each node. However, some nodes depend on the values of previous end nodes of previous elements.
I was able to draw this logic flow diagram based on the example above:
https://imgur.com/vjgTUxz
Is there an algorithm I can study to help translate what I want into code?
Thank you.
By the way, this is what I originally had:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
void TorsionalProperties::Sectorial_Element_Variation() {
//Establish variation in sectorial area
for (int i = 0; i < Number_Elements; i++) {
int Node_m = Ji[i] - 1; //Returns the first node of the element
int Node_n = Jj[i] - 1; //Returns the second node of the element
//Use node coordinates with respect to center of gravity.
double Node_m_X = X[Node_m];
double Node_n_X = X[Node_n];
double Node_m_Y = Y[Node_m];
double Node_n_Y = Y[Node_n];
Delta_W[i] = Node_m_X * Node_n_Y - Node_m_Y * Node_n_X;
//If xi to xj increases, then we are going CW (So positive Delta W)
//If xi to xj decreases, then we are going CCW (So negative Delta W)
//If yi to yj increases, then we are going CCW (So negative Delta W)
//If yi to ji decreases, then we are going CW (So positive Delta W)
if (Node_n_X > Node_m_Y)
Delta_W[i] = abs(Delta_W[i]) * -1;
else Delta_W[i] = abs(Delta_W[i]);
if (Node_n_Y > Node_m_Y)
Delta_W[i] = abs(Delta_W[i]) * -1;
else Delta_W[i] = abs(Delta_W[i]);
}
}
void TorsionalProperties::Sectorial_Node_Diagram(){
for (int i = 0; i < Number_Elements; i++) {
int Node_m = Ji[i] ; //Returns the first node of element i
int Node_n = Jj[i] ; //Returns the second node value of element i
if (i == 0) {
W[i] = 0;
W[i + 1] = W[i] + Delta_W[i];
}
for (int x = 0; x < Number_Elements; x++) {
int Connecting_Next_Node = Ji[x] ; //Returns the second node value of element i
if (Connecting_Next_Node == Node_n) {
W[Node_n-1] = W[i+1];
W[Node_n] = W[Node_n - 1] + Delta_W[x];
}
}
}
}
| |