Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert changes done to Name #128

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ authors = ["Boris Kaus <kaus@uni-mainz.de>, Albert De Montserrat <albertdemontse
version = "0.5.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
BibTeX = "7b0aa2c9-049f-5cec-894a-2b6b781bb25e"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand Down Expand Up @@ -34,7 +33,6 @@ GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
GeoParamsGLMakieExt = "GLMakie"

[compat]
Adapt = "3.6.2"
BibTeX = "0.1"
DelimitedFiles = "1.0"
ForwardDiff = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion src/ConstitutiveRelationships.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import GeoParams: second_invariant, second_invariant_staggered, value_and_partia
using BibTeX
using ..MaterialParameters: MaterialParamsInfo
import Base.show
using ForwardDiff, StaticArrays, Static, Adapt
using ForwardDiff, StaticArrays, Static

const AxialCompression, SimpleShear, Invariant = 1, 2, 3

Expand Down
12 changes: 6 additions & 6 deletions src/CreepLaw/DiffusionCreep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ julia> x2 = DiffusionCreep(Name="test")
DiffusionCreep: Name = test, n=1.0, r=0.0, p=-3.0, A=1.5 m³·⁰ MPa⁻¹·⁰ s⁻¹·⁰, E=500.0 kJ mol⁻¹·⁰, V=2.4e-5 m³·⁰ mol⁻¹·⁰, FT=1.7320508075688772, FE=1.1547005383792517)
```
"""
struct DiffusionCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::S
struct DiffusionCreep{T,N,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::NTuple{N,Char}
n::GeoUnit{T,U1} # powerlaw exponent
r::GeoUnit{T,U1} # exponent of water-fugacity
p::GeoUnit{T,U1} # grain size exponent
Expand Down Expand Up @@ -90,9 +90,11 @@ struct DiffusionCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
U3 = typeof(EU).types[2]
U4 = typeof(VU).types[2]
U5 = typeof(RU).types[2]
N = length(Name)
name = ntuple(i -> Name[i], Val(N))
# Create struct
return new{T,String,U1,U2,U3,U4,U5}(
Name, nU, rU, pU, AU, EU, VU, RU, Int8(Apparatus), FT, FE
return new{T,N,U1,U2,U3,U4,U5}(
name, nU, rU, pU, AU, EU, VU, RU, Int8(Apparatus), FT, FE
)
end

Expand All @@ -104,8 +106,6 @@ function DiffusionCreep(Name, n, r, p, A, E, V, R, Apparatus, FT, FE)
)
end

Adapt.@adapt_structure DiffusionCreep

"""
Transform_DiffusionCreep(name)
Transforms units from MPa, kJ etc. to basic units such as Pa, J etc.
Expand Down
13 changes: 6 additions & 7 deletions src/CreepLaw/DislocationCreep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ julia> x2 = DislocationCreep(n=3)
DislocationCreep: n=3, r=0.0, A=1.5 MPa^-3 s^-1, E=476.0 kJ mol^-1, V=6.0e-6 m^3 mol^-1, Apparatus=AxialCompression
```
"""
struct DislocationCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::S
# Name::NTuple
struct DislocationCreep{T,N,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::NTuple{N,Char}
n::GeoUnit{T,U1} # power-law exponent
r::GeoUnit{T,U1} # exponent of water-fugacity
A::GeoUnit{T,U2} # material specific rheological parameter
Expand Down Expand Up @@ -80,9 +79,11 @@ struct DislocationCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
U3 = typeof(EU).types[2]
U4 = typeof(VU).types[2]
U5 = typeof(RU).types[2]
N = length(Name)
name = ntuple(i -> Name[i], Val(N))
# Create struct
return new{T,String,U1,U2,U3,U4,U5}(
Name, nU, rU, AU, EU, VU, RU, Int8(Apparatus), FT, FE
return new{T,N,U1,U2,U3,U4,U5}(
name, nU, rU, AU, EU, VU, RU, Int8(Apparatus), FT, FE
)
end

Expand All @@ -93,8 +94,6 @@ struct DislocationCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
end
end

Adapt.@adapt_structure DislocationCreep

"""
Transforms units from MPa, kJ etc. to basic units such as Pa, J etc.
"""
Expand Down
12 changes: 6 additions & 6 deletions src/CreepLaw/GrainBoundarySliding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ GrainBoundarySliding: Name = test, n=1.0, p=-3.0, A=1.5 m³·⁰ MPa⁻¹·⁰ s
```
"""

struct GrainBoundarySliding{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::S
struct GrainBoundarySliding{T,N,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::NTuple{N,Char}
n::GeoUnit{T,U1} # powerlaw exponent
p::GeoUnit{T,U1} # grain size exponent
A::GeoUnit{T,U2} # material specific rheological parameter
Expand Down Expand Up @@ -84,9 +84,11 @@ struct GrainBoundarySliding{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
U3 = typeof(EU).types[2]
U4 = typeof(VU).types[2]
U5 = typeof(RU).types[2]
N = length(Name)
name = ntuple(i -> Name[i], Val(N))
# Create struct
return new{T,String,U1,U2,U3,U4,U5}(
Name, nU, pU, AU, EU, VU, RU, Int8(Apparatus), FT, FE
return new{T,N,U1,U2,U3,U4,U5}(
name, nU, pU, AU, EU, VU, RU, Int8(Apparatus), FT, FE
)
end

Expand All @@ -97,8 +99,6 @@ struct GrainBoundarySliding{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
end
end

Adapt.@adapt_structure GrainBoundarySliding

"""
Transform_GrainBoundarySliding(name)
Transforms units from MPa, kJ etc. to basic units such as Pa, J etc.
Expand Down
13 changes: 6 additions & 7 deletions src/CreepLaw/NonLinearPeierlsCreep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ julia> x2 = NonLinearPeierlsCreep(n=1)
NonLinearPeierlsCreep: n=1, A=1.5 MPa^-3 s^-1, E=476.0 kJ mol^-1, Apparatus=AxialCompression
```
"""
struct NonLinearPeierlsCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::S
struct NonLinearPeierlsCreep{T,N,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::NTuple{N,Char}
n::GeoUnit{T,U1} # power-law exponent
q::GeoUnit{T,U1} # stress relation exponent
o::GeoUnit{T,U1} # ... (normally called p but used as 'o' since p already exists)
Expand Down Expand Up @@ -76,10 +76,11 @@ struct NonLinearPeierlsCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
U3 = typeof(AU).types[2]
U4 = typeof(EU).types[2]
U5 = typeof(RU).types[2]

N = length(Name)
name = ntuple(i -> Name[i], Val(N))
# Create struct
return new{T,String,U1,U2,U3,U4,U5}(
Name, nU, qU, oU, TauPU, AU, EU, RU, Int8(Apparatus), FT, FE
return new{T,N,U1,U2,U3,U4,U5}(
name, nU, qU, oU, TauPU, AU, EU, RU, Int8(Apparatus), FT, FE
)
end

Expand All @@ -90,8 +91,6 @@ struct NonLinearPeierlsCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
end
end

Adapt.@adapt_structure NonLinearPeierlsCreep

"""
Transforms units from GPa, MPa, kJ etc. to basic units such as Pa, J etc.
"""
Expand Down
13 changes: 6 additions & 7 deletions src/CreepLaw/PeierlsCreep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ julia> x2 = PeierlsCreep(n=1)
PeierlsCreep: Name = , n=1.0, q=2.0, o=1.0, TauP=8.5e9 Pa, A=5.7e11 s^-1.0, E=476.0 kJ mol^-1.0, FT=1.7320508075688772, FE=1.1547005383792517, Apparatus=1
```
"""
struct PeierlsCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::S
struct PeierlsCreep{T,N,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
Name::NTuple{N,Char}
n::GeoUnit{T,U1} # power-law exponent
q::GeoUnit{T,U1} # stress relation exponent
o::GeoUnit{T,U1} # ... (normally called p but used as 'o' since p already exists)
Expand Down Expand Up @@ -76,10 +76,11 @@ struct PeierlsCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
U3 = typeof(AU).types[2]
U4 = typeof(EU).types[2]
U5 = typeof(RU).types[2]

N = length(Name)
name = ntuple(i -> Name[i], Val(N))
# Create struct
return new{T,String,U1,U2,U3,U4,U5}(
Name, nU, qU, oU, TauPU, AU, EU, RU, Int8(Apparatus), FT, FE
return new{T,N,U1,U2,U3,U4,U5}(
name, nU, qU, oU, TauPU, AU, EU, RU, Int8(Apparatus), FT, FE
)
end

Expand All @@ -90,8 +91,6 @@ struct PeierlsCreep{T,S,U1,U2,U3,U4,U5} <: AbstractCreepLaw{T}
end
end

Adapt.@adapt_structure PeierlsCreep

"""
Transforms units from GPa, MPa, kJ etc. to basic units such as Pa, J etc.
"""
Expand Down
12 changes: 5 additions & 7 deletions src/MaterialParameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ using Unitful: Energy
using Unitful
using Parameters, LaTeXStrings, BibTeX
using ..Units
using Static, Adapt
using Static

import Base.show, Base.convert
using GeoParams:
AbstractMaterialParam, AbstractMaterialParamsStruct, AbstractPhaseDiagramsStruct, AbstractComposite


# Define an "empty" Material parameter structure
struct No_MaterialParam{_T} <: AbstractMaterialParam end
No_MaterialParam() = No_MaterialParam{Float64}()
Expand Down Expand Up @@ -64,7 +63,7 @@ Structure that holds all material parameters for a given phase

"""
@with_kw_noshow struct MaterialParams{
S,
N,
Vdensity<:Tuple,
Vgravity<:Tuple,
Vcreep<:Tuple,
Expand All @@ -79,7 +78,7 @@ Structure that holds all material parameters for a given phase
Vmelting<:Tuple,
Vseismvel<:Tuple,
} <: AbstractMaterialParamsStruct
Name::S # Phase name
Name::NTuple{N,Char} # Phase name
Phase::Int64 = 1 # Number of the phase (optional)
Nondimensional::Bool = false # Are all fields non-dimensionalized or not?
Density::Vdensity = () # Density equation of state
Expand All @@ -97,8 +96,6 @@ Structure that holds all material parameters for a given phase
SeismicVelocity::Vseismvel = () # Seismic velocity
end

Adapt.@adapt_structure MaterialParams

"""
SetMaterialParams(; Name::String="", Phase::Int64=1,
Density = nothing,
Expand Down Expand Up @@ -242,9 +239,10 @@ function SetMaterialParams(
CharDim,
)

name = ntuple(i -> Name[i], length(Name))
# define struct for phase, while also specifying the maximum number of definitions for every field
phase = MaterialParams(
Name,
name,
Phase,
false,
Density,
Expand Down