-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- First-order elastic analysis is now working and is auto-differentiable - Fixed an error in the element elastic stiffness matrix
- Loading branch information
1 parent
00f2f48
commit 97ac9e4
Showing
7 changed files
with
192 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
using Hephaestus | ||
using ForwardDiff | ||
|
||
# Create a new model: | ||
M = Model() | ||
function f(x) | ||
# Create a new model: | ||
M = Model() | ||
|
||
# Add nodes: | ||
add_node!(M, 1, 0 , 0 , 0) | ||
add_node!(M, 2, 0 , 5000, 0) | ||
add_node!(M, 3, 7416 , 8000, 0) | ||
add_node!(M, 4, 11416, 5000, 0) | ||
add_node!(M, 5, 11416, 0 , 0) | ||
# Add nodes: | ||
add_node!(M, 1, (1 - 1) * 1000, 0, 0) | ||
add_node!(M, 2, (2 - 1) * 1000, 0, 0) | ||
add_node!(M, 3, (3 - 1) * 1000, 0, 0) | ||
add_node!(M, 4, (4 - 1) * 1000, 0, 0) | ||
add_node!(M, 5, (5 - 1) * 1000, 0, 0) | ||
add_node!(M, 6, (6 - 1) * 1000, 0, 0) | ||
|
||
# Add materials: | ||
add_material!(M, 1, 200000, 0.3, 9.81 * 7850) | ||
# Add materials: | ||
add_material!(M, 1, 200_000, 0.3, 9.81 * 7850) | ||
|
||
# Add sections: | ||
add_section!(M, 1, 4E3, 50E6 , 0, 0) | ||
add_section!(M, 2, 6E3, 200E6, 0, 0) | ||
# Add sections: | ||
add_section!(M, 1, 4E3, 50E6, 0, 0) | ||
|
||
# Add elements: | ||
add_element!(M, 1, 1, 2, 1, 1) | ||
add_element!(M, 2, 2, 3, 1, 2) | ||
add_element!(M, 3, 3, 4, 1, 1) | ||
add_element!(M, 4, 4, 5, 1, 1) | ||
# Add elements: | ||
add_element!(M, 1, 1, 2, 1, 1) | ||
add_element!(M, 2, 2, 3, 1, 1) | ||
add_element!(M, 3, 3, 4, 1, 1) | ||
add_element!(M, 4, 4, 5, 1, 1) | ||
add_element!(M, 5, 5, 6, 1, 1) | ||
|
||
add_nodal_load!(M, 2, 0, -5000.0, π, 0, 0, 0) | ||
add_nodal_load!(M, 6, 0, x, 0, 0, 0, 0) | ||
|
||
# Add supports: | ||
add_support!(M, 1, true, true, true, true, true, true) | ||
# Add supports: | ||
add_support!(M, 1, true, true , true, true, true, true ) | ||
add_support!(M, 2, true, false, true, true, true, false) | ||
add_support!(M, 3, true, false, true, true, true, false) | ||
add_support!(M, 4, true, false, true, true, true, false) | ||
add_support!(M, 5, true, false, true, true, true, false) | ||
add_support!(M, 6, true, false, true, true, true, false) | ||
|
||
solve(M, :O1E) | ||
U = solve(M, :O1E) | ||
|
||
return U[end] | ||
end | ||
|
||
@time ForwardDiff.derivative(f, -1000) |