-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wcsmo files * move files and add to tests * fix and add examples * comment out 3d benchmarks * split CI * matrix group name * comment out some wcsmo demo * comment out wcsmo demo
- Loading branch information
1 parent
8ba374b
commit 1706bdd
Showing
44 changed files
with
1,711 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
[deps] | ||
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97" | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
Ferrite = "c061ca5d-56c9-439f-9c0e-210fe06d3992" | ||
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000" | ||
FromFile = "ff7dd447-1dcb-4ce3-b8ac-22a812192de7" | ||
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9" | ||
Juniper = "2ddba703-00a4-53a7-87a5-e8b9971dde84" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
Nonconvex = "01bcebdf-4d21-426d-b5c4-6132c1619978" | ||
NonconvexIpopt = "bf347577-a06d-49ad-a669-8c0e005493b8" | ||
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c" | ||
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" | ||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"unit": "meter", "materials": [{"G12": 80760000.0, "E": 1.0, "name": "DummyMaterial", "family": "DummyMaterial", "density": 78.5, "elem_tags": [], "E_unit": "kN/m2", "type_name": "ISO", "fy": 235000.0, "density_unit": "kN/m3", "fy_unit": "kN/m2", "G12_unit": "kN/m2"}], "dimension": 2, "generate_time": "05/21/2019 07:40:59", "elements": [{"end_node_inds": [0, 2], "elem_tag": ""}, {"end_node_inds": [0, 3], "elem_tag": ""}, {"end_node_inds": [2, 3], "elem_tag": ""}, {"end_node_inds": [2, 1], "elem_tag": ""}, {"end_node_inds": [2, 4], "elem_tag": ""}, {"end_node_inds": [2, 5], "elem_tag": ""}, {"end_node_inds": [4, 5], "elem_tag": ""}, {"end_node_inds": [4, 3], "elem_tag": ""}, {"end_node_inds": [4, 6], "elem_tag": ""}, {"end_node_inds": [4, 7], "elem_tag": ""}, {"end_node_inds": [6, 7], "elem_tag": ""}, {"end_node_inds": [6, 5], "elem_tag": ""}, {"end_node_inds": [6, 8], "elem_tag": ""}, {"end_node_inds": [6, 9], "elem_tag": ""}, {"end_node_inds": [8, 9], "elem_tag": ""}, {"end_node_inds": [8, 7], "elem_tag": ""}, {"end_node_inds": [8, 10], "elem_tag": ""}, {"end_node_inds": [8, 11], "elem_tag": ""}, {"end_node_inds": [10, 11], "elem_tag": ""}, {"end_node_inds": [10, 9], "elem_tag": ""}, {"end_node_inds": [10, 12], "elem_tag": ""}, {"end_node_inds": [10, 13], "elem_tag": ""}, {"end_node_inds": [12, 13], "elem_tag": ""}, {"end_node_inds": [12, 11], "elem_tag": ""}, {"end_node_inds": [12, 14], "elem_tag": ""}, {"end_node_inds": [12, 15], "elem_tag": ""}, {"end_node_inds": [14, 15], "elem_tag": ""}, {"end_node_inds": [14, 13], "elem_tag": ""}, {"end_node_inds": [14, 16], "elem_tag": ""}, {"end_node_inds": [14, 17], "elem_tag": ""}, {"end_node_inds": [16, 17], "elem_tag": ""}, {"end_node_inds": [16, 15], "elem_tag": ""}, {"end_node_inds": [16, 18], "elem_tag": ""}, {"end_node_inds": [18, 17], "elem_tag": ""}, {"end_node_inds": [1, 3], "elem_tag": ""}, {"end_node_inds": [3, 5], "elem_tag": ""}, {"end_node_inds": [5, 7], "elem_tag": ""}, {"end_node_inds": [7, 9], "elem_tag": ""}, {"end_node_inds": [9, 11], "elem_tag": ""}, {"end_node_inds": [11, 13], "elem_tag": ""}, {"end_node_inds": [13, 15], "elem_tag": ""}, {"end_node_inds": [15, 17], "elem_tag": ""}], "supports": [{"node_ind": 0, "condition": [1, 1]}, {"node_ind": 1, "condition": [1, 1]}], "node_num": 19, "TO_model_type": "ground_mesh", "_info": "TTObuckling example used in PENLAB.", "model_name": "tim", "element_num": 42, "model_type": "truss", "loadcases": {"1": {"ploads": [{"node_ind": 18, "force": [0, -1], "loadcase": 1, "force_unit": "kN"}], "lc_ind": 1}, "0": {"ploads": [{"node_ind": 18, "force": [-1, 0], "loadcase": 0, "force_unit": "kN"}], "lc_ind": 0}}, "cross_secs": [{"A": 1.0, "name": "", "family": "DummyCroSec", "elem_tags": [], "A_unit": "m2"}], "nodes": [{"node_ind": 0, "point": [0, 0]}, {"node_ind": 1, "point": [0, 1]}, {"node_ind": 2, "point": [1, 0]}, {"node_ind": 3, "point": [1, 1]}, {"node_ind": 4, "point": [2, 0]}, {"node_ind": 5, "point": [2, 1]}, {"node_ind": 6, "point": [3, 0]}, {"node_ind": 7, "point": [3, 1]}, {"node_ind": 8, "point": [4, 0]}, {"node_ind": 9, "point": [4, 1]}, {"node_ind": 10, "point": [5, 0]}, {"node_ind": 11, "point": [5, 1]}, {"node_ind": 12, "point": [6, 0]}, {"node_ind": 13, "point": [6, 1]}, {"node_ind": 14, "point": [7, 0]}, {"node_ind": 15, "point": [7, 1]}, {"node_ind": 16, "point": [8, 0]}, {"node_ind": 17, "point": [8, 1]}, {"node_ind": 18, "point": [8.5, 0.5]}]} |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using TopOpt, LinearAlgebra, StatsFuns | ||
# using Makie | ||
# using TopOpt.TrussTopOptProblems.TrussVisualization: visualize | ||
|
||
Nonconvex.@load Juniper | ||
|
||
# 2D | ||
ndim = 2 | ||
node_points, elements, mats, crosssecs, fixities, load_cases = | ||
load_truss_json(joinpath(@__DIR__, "tim_$(ndim)d.json")); | ||
ndim, nnodes, ncells = length(node_points[1]), length(node_points), length(elements) | ||
loads = load_cases["0"] | ||
problem = TrussProblem( | ||
Val{:Linear}, node_points, elements, | ||
loads, fixities, mats, crosssecs, | ||
); | ||
|
||
xmin = 0.0001 # minimum density | ||
x0 = fill(1.0, ncells) # initial design | ||
p = 1.0 # penalty | ||
V = 0.5 # maximum volume fraction | ||
|
||
solver = FEASolver(Direct, problem, xmin = xmin) | ||
comp = TopOpt.Compliance(problem, solver) | ||
|
||
function obj(x) | ||
# minimize compliance | ||
return comp(x) | ||
end | ||
function constr(x) | ||
# volume fraction constraint | ||
return sum(x) / length(x) - V | ||
end | ||
|
||
m = Model(obj) | ||
addvar!(m, zeros(length(x0)), ones(length(x0)), integer = trues(length(x0))) | ||
Nonconvex.add_ineq_constraint!(m, constr) | ||
|
||
options = JuniperIpoptOptions() | ||
TopOpt.setpenalty!(solver, p) | ||
@time r = Nonconvex.optimize(m, JuniperIpoptAlg(), x0, options = options); | ||
|
||
@show obj(r.minimizer) | ||
@show constr(r.minimizer) | ||
# fig = visualize( | ||
# problem, solver.u; topology = r.minimizer, | ||
# default_exagg_scale=0.0 | ||
# ) | ||
# Makie.display(fig) |
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,40 +1,71 @@ | ||
using Test, SafeTestsets | ||
|
||
@safetestset "InpParser Tests" begin | ||
include("inp_parser/parser.jl") | ||
end | ||
@safetestset "TopOptProblems Tests" begin | ||
include("topopt_problems/problems.jl") | ||
include("topopt_problems/metadata.jl") | ||
end | ||
@safetestset "Functions" begin | ||
include("Functions/test_common_fns.jl") | ||
include("Functions/test_buckling_fns.jl") | ||
end | ||
@safetestset "Solver" begin | ||
include("fea/solvers.jl") | ||
end | ||
@safetestset "Truss Problem Tests" begin | ||
include("truss_topopt_problems/test_problem.jl") | ||
include("truss_topopt_problems/test_fea.jl") | ||
include("truss_topopt_problems/test_buckling.jl") | ||
include("truss_topopt_problems/test_buckling_optimize.jl") | ||
const GROUP = get(ENV, "GROUP", "All") | ||
|
||
if GROUP == "All" || GROUP == "Tests" | ||
@safetestset "InpParser Tests" begin | ||
include("inp_parser/parser.jl") | ||
end | ||
@safetestset "TopOptProblems Tests" begin | ||
include("topopt_problems/problems.jl") | ||
include("topopt_problems/metadata.jl") | ||
end | ||
@safetestset "Functions" begin | ||
include("Functions/test_common_fns.jl") | ||
include("Functions/test_buckling_fns.jl") | ||
end | ||
@safetestset "Solver" begin | ||
include("fea/solvers.jl") | ||
end | ||
@safetestset "Truss Problem Tests" begin | ||
include("truss_topopt_problems/test_problem.jl") | ||
include("truss_topopt_problems/test_fea.jl") | ||
include("truss_topopt_problems/test_buckling.jl") | ||
include("truss_topopt_problems/test_buckling_optimize.jl") | ||
end | ||
end | ||
|
||
@safetestset "Examples" begin | ||
@safetestset "CSIMP" begin | ||
if GROUP == "All" || GROUP == "Examples" | ||
@safetestset "CSIMP example" begin | ||
include("examples/csimp.jl") | ||
end | ||
@safetestset "Global Stress" begin | ||
@safetestset "Global stress example" begin | ||
include("examples/global_stress.jl") | ||
end | ||
@safetestset "Local Stress" begin | ||
@safetestset "Local stress example" begin | ||
include("examples/local_stress.jl") | ||
end | ||
@safetestset "More examples" begin | ||
include("examples/test_examples.jl") | ||
end | ||
@safetestset "Neural networks" begin | ||
@safetestset "Neural network example" begin | ||
include("examples/neural.jl") | ||
end | ||
@safetestset "Integer nonlinear programming for truss optimization example" begin | ||
include("examples/mixed_integer_truss/truss_compliance_2d1.jl") | ||
end | ||
end | ||
|
||
if GROUP == "All" || GROUP == "WCSMO14" | ||
# This was originlly part of https://github.com/JuliaTopOpt/TopOpt.jl_WCSMO21 | ||
@safetestset "Continuum demos" begin | ||
include("wcsmo14/demos/continuum/cont_compliance1.jl") | ||
include("wcsmo14/demos/continuum/cont_compliance2.jl") | ||
include("wcsmo14/demos/continuum/cont_stress.jl") | ||
end | ||
@safetestset "Truss 2d demos" begin | ||
include("wcsmo14/demos/truss/truss_compliance_2d1.jl") | ||
include("wcsmo14/demos/truss/truss_compliance_2d2.jl") | ||
end | ||
@safetestset "Truss 3d demos" begin | ||
include("wcsmo14/demos/truss/truss_compliance_3d1.jl") | ||
include("wcsmo14/demos/truss/truss_compliance_3d2.jl") | ||
end | ||
@safetestset "WCSMO Benchmarks" begin | ||
include("wcsmo14/jl_benchmarks/compare_neo99_2D.jl") | ||
#include("wcsmo14/jl_benchmarks/compare_polytop.jl") | ||
#include("wcsmo14/jl_benchmarks/compare_top3d.jl") | ||
#include("wcsmo14/jl_benchmarks/compare_top3d125.jl") | ||
#include("wcsmo14/jl_benchmarks/new_problems.jl") | ||
end | ||
end |
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[deps] | ||
Ferrite = "c061ca5d-56c9-439f-9c0e-210fe06d3992" | ||
GLFW = "f7f18e0c-5ee9-5ccd-a5bf-e8befd85ed98" | ||
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" | ||
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" | ||
Nonconvex = "01bcebdf-4d21-426d-b5c4-6132c1619978" | ||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" | ||
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c" | ||
TopOpt = "53a1e1a5-51bb-58a9-8a02-02056cc81109" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.