Skip to content

Commit

Permalink
Merge pull request #117 from ModiaSim/dae_mode
Browse files Browse the repository at this point in the history
Fix issues with IDA()
  • Loading branch information
MartinOtter authored Jul 12, 2022
2 parents d0e0cc5 + fa510a1 commit 6d3de5b
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 30 deletions.
49 changes: 26 additions & 23 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.7.2"
julia_version = "1.7.3"
manifest_format = "2.0"

[[deps.Adapt]]
Expand Down Expand Up @@ -213,9 +213,9 @@ version = "0.4.0"

[[deps.DiffEqBase]]
deps = ["ArrayInterfaceCore", "ChainRulesCore", "DataStructures", "Distributions", "DocStringExtensions", "FastBroadcast", "ForwardDiff", "FunctionWrappers", "LinearAlgebra", "Logging", "MuladdMacro", "NonlinearSolve", "Parameters", "Printf", "RecursiveArrayTools", "Reexport", "Requires", "SciMLBase", "Setfield", "SparseArrays", "StaticArrays", "Statistics", "ZygoteRules"]
git-tree-sha1 = "f7a479aac5f3917b8472ac5f1b77d6f296fe58f1"
git-tree-sha1 = "da9b5a3f2372682d5de7e08ce01ec008b79f81f8"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
version = "6.92.3"
version = "6.93.0"

[[deps.DiffEqCallbacks]]
deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "LinearAlgebra", "NLsolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArrays"]
Expand Down Expand Up @@ -259,9 +259,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[deps.Distributions]]
deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"]
git-tree-sha1 = "d530092b57aef8b96b27694e51c575b09c7f0b2e"
git-tree-sha1 = "429077fd74119f5ac495857fd51f4120baf36355"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.25.64"
version = "0.25.65"

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
Expand All @@ -276,7 +276,7 @@ uuid = "497a8b3b-efae-58df-a0af-a86822472b78"
version = "1.2.2"

[[deps.Downloads]]
deps = ["ArgTools", "LibCURL", "NetworkOptions"]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"

[[deps.DualNumbers]]
Expand Down Expand Up @@ -319,17 +319,20 @@ git-tree-sha1 = "9267e5f50b0e12fdfd5a2455534345c4cf2c7f7a"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.14.0"

[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"

[[deps.FillArrays]]
deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "246621d23d1f43e3b9c368bf3b72b2331a27c286"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.13.2"

[[deps.FiniteDiff]]
deps = ["ArrayInterfaceCore", "LinearAlgebra", "Requires", "SparseArrays", "StaticArrays"]
git-tree-sha1 = "ee13c773ce60d9e95a6c6ea134f25605dce2eda3"
deps = ["ArrayInterfaceCore", "LinearAlgebra", "Requires", "Setfield", "SparseArrays", "StaticArrays"]
git-tree-sha1 = "cb8c5f0074153ace28ce5100714df4378ad885e0"
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
version = "2.13.0"
version = "2.14.0"

[[deps.FixedPointNumbers]]
deps = ["Statistics"]
Expand Down Expand Up @@ -603,9 +606,9 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[deps.Modia]]
deps = ["DataFrames", "DiffEqBase", "DifferentialEquations", "FiniteDiff", "ForwardDiff", "InteractiveUtils", "JSON", "LinearAlgebra", "Measurements", "ModiaBase", "MonteCarloMeasurements", "OrderedCollections", "Printf", "RecursiveFactorization", "Reexport", "SignalTables", "StaticArrays", "Sundials", "Test", "TimerOutputs", "Unitful"]
git-tree-sha1 = "3740b2a8f0813a7ef12ad9785c3920eeb3216b9e"
git-tree-sha1 = "80438b8826233f50d70370baee57f523788ec332"
uuid = "cb905087-75eb-5f27-8515-1ce0ec8e839e"
version = "0.9.1"
version = "0.9.2"

[[deps.ModiaBase]]
deps = ["DataFrames", "DiffRules", "Measurements", "MonteCarloMeasurements", "OrderedCollections", "StaticArrays", "Unitful"]
Expand Down Expand Up @@ -655,9 +658,9 @@ uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"

[[deps.NonlinearSolve]]
deps = ["ArrayInterfaceCore", "FiniteDiff", "ForwardDiff", "IterativeSolvers", "LinearAlgebra", "RecursiveArrayTools", "RecursiveFactorization", "Reexport", "SciMLBase", "Setfield", "StaticArrays", "UnPack"]
git-tree-sha1 = "8a00c7b9418270f1fa57da319d11febbe5f92101"
git-tree-sha1 = "932bbdc22e6a2e0bae8dec35d32e4c8cb6c50f98"
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
version = "0.3.20"
version = "0.3.21"

[[deps.OffsetArrays]]
deps = ["Adapt"]
Expand Down Expand Up @@ -698,9 +701,9 @@ version = "6.18.1"

[[deps.PDMats]]
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "9351c1a6c0e922cc862bd96822a98c9029a6d142"
git-tree-sha1 = "cf494dca75a69712a72b80bc48f59dcf3dea63ec"
uuid = "90014a1f-27ba-587c-ab20-58faa44d9150"
version = "0.11.15"
version = "0.11.16"

[[deps.Parameters]]
deps = ["OrderedCollections", "UnPack"]
Expand Down Expand Up @@ -815,9 +818,9 @@ version = "1.2.1"

[[deps.RecursiveArrayTools]]
deps = ["Adapt", "ArrayInterfaceCore", "ArrayInterfaceStaticArraysCore", "ChainRulesCore", "DocStringExtensions", "FillArrays", "GPUArraysCore", "LinearAlgebra", "RecipesBase", "StaticArraysCore", "Statistics", "ZygoteRules"]
git-tree-sha1 = "7ddd4f1ac52f9cc1b784212785f86a75602a7e4b"
git-tree-sha1 = "7a5f08bdeb79cf3f8ce60125fe1b2a04041c1d26"
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
version = "2.31.0"
version = "2.31.1"

[[deps.RecursiveFactorization]]
deps = ["LinearAlgebra", "LoopVectorization", "Polyester", "StrideArraysCore", "TriangularSolve"]
Expand Down Expand Up @@ -876,9 +879,9 @@ version = "0.6.33"

[[deps.SciMLBase]]
deps = ["ArrayInterfaceCore", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "RecipesBase", "RecursiveArrayTools", "StaticArraysCore", "Statistics", "Tables", "TreeViews"]
git-tree-sha1 = "3243a883fa422a0a5cfe2d3b6ea6287fc396018f"
git-tree-sha1 = "55f38a183d472deb6893bdc3a962a13ea10c60e4"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
version = "1.42.2"
version = "1.42.4"

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Expand Down Expand Up @@ -938,9 +941,9 @@ version = "0.7.5"

[[deps.StaticArrays]]
deps = ["LinearAlgebra", "Random", "StaticArraysCore", "Statistics"]
git-tree-sha1 = "9f8a5dc5944dc7fbbe6eb4180660935653b0a9d9"
git-tree-sha1 = "e972716025466461a3dc1588d9168334b71aafff"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.5.0"
version = "1.5.1"

[[deps.StaticArraysCore]]
git-tree-sha1 = "66fe9eb253f910fe8cf161953880cfdaef01cdf0"
Expand Down Expand Up @@ -1092,9 +1095,9 @@ version = "1.11.0"

[[deps.VectorizationBase]]
deps = ["ArrayInterface", "CPUSummary", "HostCPUFeatures", "IfElse", "LayoutPointers", "Libdl", "LinearAlgebra", "SIMDTypes", "Static"]
git-tree-sha1 = "39e55018bccc5a858217db32aa3d9e7decbefd0c"
git-tree-sha1 = "953ba1475022a4de16439857a8f79831abf5fa30"
uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
version = "0.21.40"
version = "0.21.42"

[[deps.VertexSafeGraphs]]
deps = ["Graphs"]
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
authors = ["Andrea Neumayr <andrea.neumayr@dlr.de>", "Martin Otter <Martin.Otter@dlr.de>", "Gerhard Hippmann <gerhard.hippmann@dlr.de>"]
name = "Modia3D"
uuid = "07f2c1e0-90b0-56cf-bda7-b44b56e34eed"
version = "0.11.0"
version = "0.11.1"

[compat]
Colors = "0.12, 0.11, 0.10"
Expand All @@ -12,7 +12,7 @@ HTTP = "0.9"
JSON = "0.21"
Measurements = "2"
MeshIO = "0.4.10"
Modia = "0.9.1"
Modia = "0.9.2"
MonteCarloMeasurements = "1"
OrderedCollections = "1"
Reexport = "1.0"
Expand Down
4 changes: 4 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ julia -JModia3D_sysimage.so (otherwise)

## Release Notes

### Version 0.11.1

- Bug fix: integrator IDA() can be used (especially to avoid solving large linear equation systems in the model).\
Extend some test models to use IDA().

### Version 0.11.0

Expand Down
2 changes: 1 addition & 1 deletion src/Composition/dynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ function computeGeneralizedForces!(mbs::MultibodyData{F,TimeType}, qdd_hidden::V
mbs.hiddenCache_h .= mbs.hiddenGenForces
elseif leq_mode == -1
# Store state derivatives
setStateDerivativesHiddenJoints!(instantiatedModel, mbs)
setHiddenStatesDerivatives!(instantiatedModel, mbs)
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/Composition/joints/joints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ function change_rotSequence!(m::Modia.SimulationModel, freeMotion::FreeMotion, x
if m.options.logEvents
println(" ", freeMotion.path * ".rotationXYZ changed to ", freeMotion.isrot123)
println(" ", freeMotion.path * ".rotation changed to ", freeMotion.rot)
println(" ", freeMotion.str_rot2 * " (= ", rotation2ZeroCrossing, ", ) became <= 0")
println(" ", freeMotion.str_rot2 * " (= ", rotation2ZeroCrossing, ") became <= 0")
end

return nothing
Expand Down
4 changes: 2 additions & 2 deletions src/Modia3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
module Modia3D

const path = dirname(dirname(@__FILE__)) # Absolute path of package directory
const Version = "0.11.0"
const Date = "2022-07-07"
const Version = "0.11.1"
const Date = "2022-07-12"

println("\nImporting Modia3D Version $Version ($Date)")

Expand Down
1 change: 1 addition & 0 deletions test/Basic/BouncingSphere3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ showInfo(bouncingSphere)
@usingModiaPlot
plot(bouncingSphere, ["sphere.translation", "sphere.velocity", "sphere.rotationXYZ"], figure=1)

simulate!(bouncingSphere, IDA(), nlinearMinForDAE=1, stopTime=2.2, dtmax=0.1, log=true, logStates=false, requiredFinalStates=requiredFinalStates)
end
2 changes: 2 additions & 0 deletions test/Basic/FreeShaftAdaptiveRotSequence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ showInfo(shaft)
@usingModiaPlot
plot(shaft, ["shaft.rotation", "shaft.rotationXYZ", "shaft.angularVelocity", "shaft.translation", "shaft.velocity"], figure=1)

simulate!(shaft, IDA(), nlinearMinForDAE=1, stopTime=stopTime, dtmax=dtmax, log=true, logEvents=false, logStates=false, requiredFinalStates=requiredFinalStates)

end
2 changes: 2 additions & 0 deletions test/Basic/FreeShaftAdaptiveRotSequenceWithFreeMotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ simulate!(shaft, stopTime=stopTime, dtmax=dtmax, log=true, logEvents=false, logS
@usingModiaPlot
plot(shaft, ["free.rot", "free.isrot123", "free.w", "free.r", "free.v"], figure=1)

simulate!(shaft, IDA(), nlinearMinForDAE=1, stopTime=stopTime, dtmax=dtmax, log=true, logEvents=false, logStates=false, requiredFinalStates=requiredFinalStates)

end
2 changes: 1 addition & 1 deletion test/Basic/Mobile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mobile = @instantiateModel(Mobile, unitless=true, log=false, logDetails=false, l
stopTime = 5.0
tolerance = 1e-5
requiredFinalStates = [-0.009569246139092647, 0.06206606324720822, 0.0010219666026627296, 0.024678616817829752, 0.004218575209138456, 0.028468399940849164, -0.009906941842068384, 0.04296850265297842, 0.0007318009858593783, 0.02017149964438393, 0.003687261686657736, 0.023502975932150394, -0.0448394459612976, 0.026723967721919494, 0.0537435564833799, 0.12331025494664288, 0.05248795026088127, 0.11675479912295675, -0.009264844274058073, 0.06728855030873694, 0.0011992360615969712, 0.025406524349364322, 0.004501037229020791, 0.02917639504873484, -0.00965181608855167, 0.0477780102217653, 0.0008958989126344595, 0.020867265917878713, 0.003946827273570862, 0.024201038339941326, -0.04462421281684384, 0.03746102813853381, 0.05486746017952349, 0.11577048656288175, 0.05363002444778805, 0.11033674247191452, -0.02865814302511715, -0.46249723347164023, 0.02588030023351807, 0.562896850566723, 0.02821667734365895, 0.5623903988440904, -0.009403295780267986, 0.06162802647976917, 0.0010701734591814242, 0.024348108279934208, 0.004222449370467353, 0.028064091478322103, -0.00978017118379629, 0.042937738418303645, 0.0007712669619712274, 0.02000389926557959, 0.0036870480729875752, 0.02329559286742148, -0.04450699270608273, 0.027584416181856048, 0.053512955516200826, 0.1203910664037745, 0.052242780723209266, 0.1148698118645492, -0.00908973848103805, 0.06683238262833087, 0.0012488875262191405, 0.025054556524096706, 0.004506535939791427, 0.02874309504494291, -0.009516262851887764, 0.047741100768557164, 0.0009367831965132963, 0.0206820605278372, 0.003948288304262993, 0.02396953329142854, -0.0442740599719771, 0.03835719168973073, 0.054628209624966825, 0.1126450558374131, 0.053378321393267744, 0.10825519520092068, -0.029248882022186243, -0.45868389528398645, 0.02661598555301995, 0.5585200081021191, 0.02895380855666197, 0.5578643900507765, 0.11057838176009542, -0.4328898557101326, -0.1137607979103064, 0.5023169087131035, -0.11293209024062373, 0.49924136851309536, -0.00949264483432839, 0.06269840391598419, 0.0010594569792564434, 0.024662133036232943, 0.004286395100088604, 0.02844710490443639, -0.009858798739817745, 0.04356190104934767, 0.0007615897059759054, 0.020185339490969664, 0.0037442343747962708, 0.023525248558572666, -0.04490190529834802, 0.02861187090459901, 0.054093472471048135, 0.12121222952180354, 0.05282381817075915, 0.11524012664035016, -0.00918252751200148, 0.06794970842859763, 0.0012381041193024645, 0.02538680700446271, 0.004571342380041327, 0.029148124149157, -0.009598363758120855, 0.048403550630416084, 0.0009271317194699239, 0.020879696023068203, 0.00400620925514733, 0.02421928779134631, -0.044678930789653376, 0.039416625110429974, 0.05521797625599808, 0.11354470175688848, 0.05396904771937769, 0.1087130515149207, -0.029386149298980365, -0.4625396185956002, 0.026768483822850988, 0.5631828688184961, 0.02911172224703885, 0.5626015954247693, -0.009324704028879006, 0.062258112033935976, 0.0011079870888003323, 0.024328333168236824, 0.004290387257149793, 0.028037530012991814, -0.009730064979351052, 0.043535748038149275, 0.0008014306498257068, 0.02001640392846844, 0.0037442737008724775, 0.023314890388120756, -0.04456469081149338, 0.0294911482051167, 0.05385917279095154, 0.11825295160221237, 0.052576102903529355, 0.11332114444600068, -0.00900535540075688, 0.0674898715499478, 0.0012880524022445207, 0.02503113089861741, 0.0045769255979494095, 0.02870901282603822, -0.009460770397544161, 0.04837019570880829, 0.0009683769175080957, 0.020692819349648818, 0.004007904268091745, 0.023984347424616213, -0.04432382727176435, 0.04033007578307317, 0.054974659993453495, 0.11037837031847329, 0.05371447828202559, 0.10659649333068186, -0.029979463641433897, -0.4586694882625391, 0.027508572008452217, 0.5587394516064685, 0.02985302711571344, 0.5580073793505101, 0.10994893558074191, -0.43345695851264765, -0.113030926843198, 0.5031313427136914, -0.11219753434123993, 0.5000032205945514, 0.17883870418449752, -0.3672711553933069, -0.17900124607493148, 0.423658663329383, -0.17837270297492822, 0.424290817579418, 0.011456378191880315, 0.3654620146635912]
simulate!(mobile, stopTime=stopTime, tolerance=tolerance, log=true, useRecursiveFactorizationUptoSize = 500, requiredFinalStates=requiredFinalStates)
simulate!(mobile, IDA(), stopTime=stopTime, tolerance=tolerance, log=true, useRecursiveFactorizationUptoSize = 500, requiredFinalStates=requiredFinalStates)

@usingModiaPlot
plot(mobile, "rev0.rev.phi")
Expand Down

0 comments on commit 6d3de5b

Please sign in to comment.