Skip to content

Commit 38e480f

Browse files
committed
changes in readme and solidMaterial.jl
1 parent f53cfa9 commit 38e480f

File tree

3 files changed

+16
-130
lines changed

3 files changed

+16
-130
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## Modia Platform
1212

13-
The *Modia platform* is a prototype system for next generation modeling and simulation of physical systems described by differential and algebraic equations. It consists currently of the following Julia packages that are all under development (not all are yet publicly available):
13+
The *Modia platform* is a prototype system for the next modeling and simulation generation of physical systems described by differential and algebraic equations. It consists currently of the following Julia packages that are all under development (not all are yet publicly available):
1414

1515
- Modia - Equation based modeling
1616
- Modiator - 2D/3D web-app model editor
@@ -27,7 +27,7 @@ directly accessed and utilized in a model. Functions are provided, for example,
2727
mass, and inertia of a geometrical object or the distance between two objects.
2828
Furthermore, Modia3D models 3D mechanical systems and shall be expanded into other domains in the future
2929
(for example to utilize the 3D geometry to model heat flow in buildings or satellites).
30-
In the future it will be possible, for example, to model the 3D mechanical part of a robot with Modia3D and the electrical motors and gearboxes driving the joints with Modia.
30+
In the future it will be possible, for example, to model the 3D mechanical part of a robot with Modia3D and the electrical motors and gearboxes are driving the joints with Modia.
3131

3232
Modia3D uses ideas from modern computer game engines to achieve a highly flexible setup of mechanical systems including collision handling. Other features are utilized from multi-body programs, such as support for closed kinematic loops, and elastic response calculation. The underlying mathematical formulation are hybrid Differential Algebraic Equations (DAEs) that are solved with the variable-step solver IDA via the [Sundials.jl](https://github.com/JuliaDiffEq/Sundials.jl) Julia package.
3333

src/Solids/_module.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ export solidMaterial, solidMaterialPalette, defaultContactMaterial
5555
export regularize, resultantCoefficientOfRestitution, resultantDampingCoefficient
5656
export solidMaterialPairsPalette, CommonCollisionProperties, getCommonCollisionProperties
5757

58-
export SolidMaterial2, solidMaterialPalette2
59-
export SolidMaterial3, solidMaterialPalette3
6058

6159
export contactPairMaterialPalette, ContactPairMaterial, TwoNamesKey
6260

src/Solids/solidMaterial.jl

Lines changed: 14 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -8,123 +8,11 @@
88
#
99
# Material properties of solids
1010

11-
"""
12-
material1 = SolidMaterial(;kwargs...)
13-
material2 = SolidMaterial(name)
14-
15-
`SolidMaterial(;kwargs...)` generates a SolidMaterial object by providing the material properties of a solid with
16-
keyword arguments. Arguments that are not provided have value = NaN.
17-
18-
`SolidMaterial(name)` returns a SolidMaterial object from dictionary Modia3D.solidMaterialPalette using
19-
the name as dictionary key.
20-
21-
# Arguments
22-
- `name::AbstractString`: Name of the material (used as key in dictionary Modia3D.solidMaterialPalette)
23-
24-
# Keyword Arguments
25-
- `density::Float64` in [kg/m^3]: Density, see [Wikipedia](https://en.wikipedia.org/wiki/Density).
26-
- 'YoungsModulus::Float64` in [Pa]: Youngs's modulus, see [Wikipedia](https://en.wikipedia.org/wiki/Young%27s_modulus).
27-
- `PoissonsRatio::Float64`: Poisson's ratio, see [Wikipedia](https://en.wikipedia.org/wiki/Poisson%27s_ratio).
28-
- `meltingPoint::Float64` in [K]: Melting point, see [Wikipedia](https://en.wikipedia.org/wiki/Melting_point).
29-
If the material is destroyed before its melting point (e.g. wood that is burning)
30-
then `meltingPoint` is the temperature when destruction of the solid starts.
31-
- `specificHeatCapacity::Float64` in [J/(kg.K)]: Specific heat capacity, see [Wikipedia](https://en.wikipedia.org/wiki/Heat_capacity).
32-
- `thermalConductivity::Float64` in [W/(m.K)]: Thermal conductivity, see [Wikipedia](https://en.wikipedia.org/wiki/Thermal_conductivity) and
33-
[List of thermal conductivities](https://en.wikipedia.org/wiki/List_of_thermal_conductivities)
34-
- `linearThermalExpansionCoefficient::Float64` in [1/K]: Linear thermal expansion coefficient, see [Wikipedia](https://en.wikipedia.org/wiki/Thermal_expansion).
35-
- `coefficientOfRestitution::Float64`: Coefficient of restitution, see [Wikipedia](https://en.wikipedia.org/wiki/Coefficient_of_restitution).
36-
- `slidingFrictionCoefficient::Float64`: Kinetic/sliding friction coefficient, see [Wikipedia](https://en.wikipedia.org/wiki/Friction)
37-
38-
# Example
39-
```julia
40-
import Modia3D
41-
mat1 = Modia3D.SolidMaterial(density=3000.0, YoungsModulus=2e11)
42-
mat2 = Modia3D.SolidMaterial("Steel") # mat2.density = 8000.0
43-
```
44-
"""
45-
struct SolidMaterial
46-
density::Float64 # [kg/m^3] , https://en.wikipedia.org/wiki/Density
47-
YoungsModulus::Float64 # [Pa] , https://en.wikipedia.org/wiki/Young%27s_modulus
48-
PoissonsRatio::Float64 # [] , https://en.wikipedia.org/wiki/Poisson%27s_ratio
49-
meltingPoint::Float64 # [K] , https://en.wikipedia.org/wiki/Melting_point
50-
# If the material is destroyed before its melting point (e.g. wood that is burning)
51-
# then meltingPoint is the temperature when destruction starts.
52-
heatCapacity::Float64 # [J/(kg.K)], https://en.wikipedia.org/wiki/Heat_capacity
53-
thermalConductivity::Float64 # [W/(m.K)] , https://en.wikipedia.org/wiki/Thermal_conductivity
54-
# https://en.wikipedia.org/wiki/List_of_thermal_conductivities
55-
linearThermalExpansionCoefficient::Float64 # [1/K], https://en.wikipedia.org/wiki/Thermal_expansion
56-
coefficientOfRestitution::Float64 # [] https://en.wikipedia.org/wiki/Coefficient_of_restitution
57-
slidingFrictionCoefficient::Float64 # [] https://en.wikipedia.org/wiki/Friction
58-
rotationalFrictionCoefficient::Float64
59-
SolidMaterial(density, YoungsModulus, PoissonsRatio, meltingPoint, heatCapacity,
60-
thermalConductivity, linearThermalExpansionCoefficient, coefficientOfRestitution, slidingFrictionCoefficient,
61-
rotationalFrictionCoefficient) = new(density, YoungsModulus, PoissonsRatio, meltingPoint, heatCapacity,thermalConductivity, linearThermalExpansionCoefficient, coefficientOfRestitution, slidingFrictionCoefficient,
62-
rotationalFrictionCoefficient)
63-
end
64-
SolidMaterial(;density=NaN, YoungsModulus=NaN, PoissonsRatio=NaN, meltingPoint=NaN,
65-
heatCapacity=NaN, thermalConductivity=NaN, linearThermalExpansionCoefficient=NaN,
66-
coefficientOfRestitution=NaN, slidingFrictionCoefficient=NaN,
67-
rotationalFrictionCoefficient=NaN) =
68-
SolidMaterial(density,YoungsModulus, PoissonsRatio, meltingPoint, heatCapacity,
69-
thermalConductivity, linearThermalExpansionCoefficient,
70-
coefficientOfRestitution, slidingFrictionCoefficient,
71-
rotationalFrictionCoefficient)
72-
73-
74-
#=
75-
const defaultFile = joinpath(Modia3D.path, "src", "Solid", "solidMaterials.json")
76-
#const solidMaterialPalette = JSON.parsefile(defaultFile; dicttype=Dict{String, SolidMaterial})
77-
const solidMaterialPalette = JSON.parsefile(defaultFile)
78-
println("typeof(solidMaterialPalette) = ", typeof(solidMaterialPalette))
79-
80-
81-
solidMaterial(name::AbstractString) = solidMaterialPalette[name]
82-
println("solidMaterial(Aluminium) = ", solidMaterial("Aluminium"))
83-
84-
const mat = Dict{String,SolidMaterial}()https://github.com/JuliaIO/JSON.jl/blob/master/data/jsonchecker/fail01.json
85-
mat["Aluminium1"] = SolidMaterial(1.0,2.0,3.0,4.0,5.0,6.0,7.0)
86-
mat["Aluminium2"] = SolidMaterial(2.0,2.0,3.0,4.0,5.0,6.0,7.0)
87-
import Base
88-
Base.open(joinpath(Modia3D.path, "src", "Solid", "solidMaterials2.json"), "w") do file
89-
JSON.print(file, mat)
90-
end
91-
=#
92-
93-
"""
94-
const solidMaterialPalette
95-
96-
Dictionary of solid material data, see [`Modia3D.SolidMaterial`](@ref)
97-
"""
98-
const solidMaterialPalette = Dict{String, SolidMaterial}()
99-
100-
# Temporary solution
101-
solidMaterialPalette["Steel"] = SolidMaterial(8000.0, 2.0e11, 0.30, 1640.0, 500.0, 50.0 , 1.2e-5 , 0.7, 0.5, 0.001)
102-
solidMaterialPalette["Aluminium"] = SolidMaterial(2700.0, 6.9e10, 0.32, 933.0, 897.0, 237.0, 2.31e-5, 0.1, 1.4, 0.001)
103-
solidMaterialPalette["DryWood"] = SolidMaterial( 700.0, 1.1e10, 0.4 , 570.0, 1700.0, 0.1, 5.0e-6, 0.1, 0.3, 0.002)
104-
105-
# http://dbkcues.ru/articles-2/collision-of-billiard-balls/?lang=en
106-
107-
# E = 5,4 GPA
108-
# cor=0.8, mu_k = 0.1, mu_r = 0.025 # book [Physics for game developers, Bourg, Bywalce, 2013, p. 382]
109-
# attention: meltingPoint, heatCapacity,thermalConductivity, linearThermalExpansionCoefficient are not true!!!
110-
solidMaterialPalette["BilliardBall"] = SolidMaterial(1768.0, 5.4e9, 0.34, NaN, NaN, NaN, NaN, NaN, NaN, NaN)
111-
solidMaterialPalette["BilliardCushion"] = SolidMaterial( 700.0, 1.1e10, 0.4, NaN, NaN, NaN, NaN, NaN, NaN, NaN)
112-
solidMaterialPalette["BilliardTable"] = SolidMaterial( 700.0, 1.1e10, 0.4, NaN, NaN, NaN, NaN, NaN, NaN, NaN)
113-
114-
solidMaterial(name::AbstractString) = solidMaterialPalette[name] # Should be removed
115-
SolidMaterial(name::AbstractString) = solidMaterialPalette[name]
116-
117-
118-
119-
120-
121-
122-
12311

12412
"""
125-
material = SolidMaterial3(;kwargs...)
13+
material = SolidMaterial(;kwargs...)
12614
127-
Generates a SolidMaterial3 object by providing the material properties of a solid with
15+
Generates a SolidMaterial object by providing the material properties of a solid with
12816
keyword arguments. Arguments that are not provided have value = NaN.
12917
13018
# Keyword Arguments
@@ -142,10 +30,10 @@ keyword arguments. Arguments that are not provided have value = NaN.
14230
# Example
14331
```julia
14432
import Modia3D
145-
mat1 = Modia3D.SolidMaterial3(density=3000.0, YoungsModulus=2e11)
33+
mat1 = Modia3D.SolidMaterial(density=3000.0, YoungsModulus=2e11)
14634
```
14735
"""
148-
mutable struct SolidMaterial3
36+
mutable struct SolidMaterial
14937
density::Float64 # [kg/m^3] , https://en.wikipedia.org/wiki/Density
15038
YoungsModulus::Float64 # [Pa] , https://en.wikipedia.org/wiki/Young%27s_modulus
15139
PoissonsRatio::Float64 # [] , https://en.wikipedia.org/wiki/Poisson%27s_ratio
@@ -157,32 +45,32 @@ mutable struct SolidMaterial3
15745
# https://en.wikipedia.org/wiki/List_of_thermal_conductivities
15846
linearThermalExpansionCoefficient::Float64 # [1/K], https://en.wikipedia.org/wiki/Thermal_expansion
15947
end
160-
SolidMaterial3(; density=NaN,
48+
SolidMaterial(; density=NaN,
16149
YoungsModulus=NaN,
16250
PoissonsRatio=NaN,
16351
meltingPoint=NaN,
16452
specificHeatCapacity=NaN,
16553
thermalConductivity=NaN,
16654
linearThermalExpansionCoefficient=NaN) =
167-
SolidMaterial3(density, YoungsModulus, PoissonsRatio, meltingPoint, specificHeatCapacity,
55+
SolidMaterial(density, YoungsModulus, PoissonsRatio, meltingPoint, specificHeatCapacity,
16856
thermalConductivity, linearThermalExpansionCoefficient)
16957

17058

17159
#readSolidMaterialsDict() = Modia3D.readDictOfStructsFromJSON( joinpath(Modia3D.path, "src", "Solids", "solidMaterials.json"),
172-
# SolidMaterial3 )
60+
# SolidMaterial )
17361

17462
"""
175-
readSolidMaterial3FromJSON(fileName)
63+
readSolidMaterialFromJSON(fileName)
17664
177-
Read a JSON file consisting of a dictionary of SolidMaterial3 instances from `fileName` and
178-
return a `Dict{String, SolidMaterial3}` dictionary.
65+
Read a JSON file consisting of a dictionary of SolidMaterial instances from `fileName` and
66+
return a `Dict{String, SolidMaterial}` dictionary.
17967
"""
180-
readSolidMaterial3FromJSON(fileName::AbstractString) = Basics.readDictOfStructsFromJSON(fileName, SolidMaterial3)
68+
readSolidMaterialFromJSON(fileName::AbstractString) = Basics.readDictOfStructsFromJSON(fileName, SolidMaterial)
18169

18270

18371
"""
184-
const solidMaterialPalette3
72+
const solidMaterialPalette
18573
186-
Dictionary of solid material data, see [`Modia3D.SolidMaterial3`](@ref)
74+
Dictionary of solid material data, see [`Modia3D.SolidMaterial`](@ref)
18775
"""
188-
const solidMaterialPalette3 = readSolidMaterial3FromJSON( joinpath(Modia3D.path, "palettes", "solidMaterials.json") )
76+
const solidMaterialPalette = readSolidMaterialFromJSON( joinpath(Modia3D.path, "palettes", "solidMaterials.json") )

0 commit comments

Comments
 (0)