{-# LANGUAGE PostfixOperators #-}
module Drasil.SSP.TMods (tMods, factOfSafety, equilibrium, mcShrStrgth, effStress)
where
import Control.Lens ((^.))
import Prelude hiding (tan)
import qualified Data.List.NonEmpty as NE
import Language.Drasil
import Theory.Drasil
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S
import Data.Drasil.Quantities.Physics (distance, force)
import Data.Drasil.Concepts.Documentation (model)
import Data.Drasil.Concepts.Physics (friction, linear)
import Data.Drasil.Theories.Physics (newtonSL)
import Drasil.SSP.Assumptions (assumpENSL, assumpSBSBISL)
import Drasil.SSP.Defs (factorOfSafety)
import Drasil.SSP.References (fredlund1977)
import Drasil.SSP.Unitals (effCohesion, effNormStress, effectiveStress,
fricAngle, fs, fx, fy, genericM, mobilizedShear, nrmFSubWat, porePressure,
resistiveShear, shrStress, totNormStress)
import Drasil.SSP.DataDefs (normStressDD)
tMods :: [TheoryModel]
tMods :: [TheoryModel]
tMods = [TheoryModel
factOfSafety, TheoryModel
equilibrium, TheoryModel
mcShrStrgth, TheoryModel
effStress, TheoryModel
newtonSL]
factOfSafety :: TheoryModel
factOfSafety :: TheoryModel
factOfSafety = ModelKind ModelExpr
-> [QuantityDict]
-> [ConceptChunk]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm (String -> ModelQDef -> ModelKind ModelExpr
forall e. String -> QDefinition e -> ModelKind e
equationalModelU String
"factOfSafetyTM" ModelQDef
factOfSafetyQD)
[ConstrConcept -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw ConstrConcept
fs, UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
resistiveShear, UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
mobilizedShear] ([] :: [ConceptChunk])
[ModelQDef
factOfSafetyQD] [] [] [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
fredlund1977] String
"factOfSafety" []
factOfSafetyQD :: ModelQDef
factOfSafetyQD :: ModelQDef
factOfSafetyQD = ConstrConcept -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' ConstrConcept
fs NP
factorOfSafety ModelExpr
PExpr
factOfSafetyExpr
factOfSafetyExpr :: PExpr
factOfSafetyExpr :: PExpr
factOfSafetyExpr = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
resistiveShear r -> r -> r
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mobilizedShear
equilibrium :: TheoryModel
equilibrium :: TheoryModel
equilibrium = ModelKind ModelExpr
-> [QuantityDict]
-> [ConceptChunk]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm (ConstraintSet ModelExpr -> ModelKind ModelExpr
forall e. ConstraintSet e -> ModelKind e
equationalConstraints' ConstraintSet ModelExpr
equilibriumCS)
[UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
fx] ([] :: [ConceptChunk])
[] ((ModelExpr -> ModelExpr) -> [ModelExpr] -> [ModelExpr]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> ModelExpr
forall c. Express c => c -> ModelExpr
express [ModelExpr]
equilibriumRels) [] [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
fredlund1977] String
"equilibrium" [Sentence
eqDesc]
equilibriumRels :: [ModelExpr]
equilibriumRels :: [ModelExpr]
equilibriumRels = (UnitalChunk -> ModelExpr) -> [UnitalChunk] -> [ModelExpr]
forall a b. (a -> b) -> [a] -> [b]
map ((ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
int Integer
0) (ModelExpr -> ModelExpr)
-> (UnitalChunk -> ModelExpr) -> UnitalChunk -> ModelExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
sumAll (String -> Symbol
variable String
"i") (ModelExpr -> ModelExpr)
-> (UnitalChunk -> ModelExpr) -> UnitalChunk -> ModelExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy) [UnitalChunk
fx, UnitalChunk
fy, UnitalChunk
genericM]
equilibriumCS :: ConstraintSet ModelExpr
equilibriumCS :: ConstraintSet ModelExpr
equilibriumCS = ConceptChunk -> NonEmpty ModelExpr -> ConstraintSet ModelExpr
forall e. ConceptChunk -> NonEmpty e -> ConstraintSet e
mkConstraintSet
(String -> NP -> Sentence -> ConceptChunk
dccWDS String
"equilibriumCS" (String -> NP
nounPhraseSP String
"equilibrium") Sentence
eqDesc) (NonEmpty ModelExpr -> ConstraintSet ModelExpr)
-> NonEmpty ModelExpr -> ConstraintSet ModelExpr
forall a b. (a -> b) -> a -> b
$
[ModelExpr] -> NonEmpty ModelExpr
forall a. HasCallStack => [a] -> NonEmpty a
NE.fromList [ModelExpr]
equilibriumRels
eqDesc :: Sentence
eqDesc :: Sentence
eqDesc = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"For a body in static equilibrium" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"the net",
NP -> Sentence
forall n. NounPhrase n => n -> Sentence
pluralNP (UnitalChunk
force UnitalChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`and_PP` UnitalChunk
genericM) Sentence -> Sentence -> Sentence
+:+. (String -> Sentence
S String
"acting" Sentence -> Sentence -> Sentence
`S.onThe` String -> Sentence
S String
"body will cancel out"),
String -> Sentence
S String
"Assuming a 2D problem", Sentence -> Sentence
sParen (ConceptInstance -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
assumpENSL) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"the", UnitalChunk -> Sentence
forall a. Quantity a => a -> Sentence
getTandS UnitalChunk
fx Sentence -> Sentence -> Sentence
`S.and_`
UnitalChunk -> Sentence
forall a. Quantity a => a -> Sentence
getTandS UnitalChunk
fy, String -> Sentence
S String
"will be equal to" Sentence -> Sentence -> Sentence
+:+. ModelExpr -> Sentence
eS (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0), String -> Sentence
S String
"All", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
plural UnitalChunk
force,
String -> Sentence
S String
"and their", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
distance, String -> Sentence
S String
"from the chosen point" Sentence -> Sentence -> Sentence
`S.of_` String -> Sentence
S String
"rotation",
String -> Sentence
S String
"will create a net", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
genericM, String -> Sentence
S String
"equal to" Sentence -> Sentence -> Sentence
+:+ ModelExpr -> Sentence
eS (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0)]
mcShrStrgth :: TheoryModel
mcShrStrgth :: TheoryModel
mcShrStrgth = ModelKind ModelExpr
-> [QuantityDict]
-> [ConceptChunk]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm (String -> ModelQDef -> ModelKind ModelExpr
forall e. String -> QDefinition e -> ModelKind e
equationalModelU String
"mcShrSrgth" ModelQDef
mcShrStrgthQD)
[UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
shrStress, UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
effNormStress, UncertQ -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UncertQ
fricAngle, UncertQ -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UncertQ
effCohesion]
([] :: [ConceptChunk])
[ModelQDef
mcShrStrgthQD] [] [] [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
fredlund1977] String
"mcShrStrgth" [Sentence
mcShrStrgthDesc]
mcShrStrgthQD :: ModelQDef
mcShrStrgthQD :: ModelQDef
mcShrStrgthQD = UID
-> NP
-> Sentence
-> (Stage -> Symbol)
-> Space
-> ModelExpr
-> ModelQDef
forall e.
UID
-> NP
-> Sentence
-> (Stage -> Symbol)
-> Space
-> e
-> QDefinition e
fromEqnSt' (UnitalChunk
shrStress UnitalChunk -> Getting UID UnitalChunk UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID UnitalChunk UID
forall c. HasUID c => Getter c UID
Getter UnitalChunk UID
uid) (String -> NP
nounPhraseSP String
"Mohr-Coulumb shear strength")
Sentence
mcShrStrgthDesc (UnitalChunk -> Stage -> Symbol
forall c. HasSymbol c => c -> Stage -> Symbol
symbol UnitalChunk
shrStress) Space
Real ModelExpr
PExpr
mcShrStrgthExpr
mcShrStrgthExpr :: PExpr
mcShrStrgthExpr :: PExpr
mcShrStrgthExpr = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
effNormStress r -> r -> r
forall r. ExprC r => r -> r -> r
$* r -> r
forall r. ExprC r => r -> r
tan (UncertQ -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
fricAngle) r -> r -> r
forall r. ExprC r => r -> r -> r
$+ UncertQ -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
effCohesion
mcShrStrgthDesc :: Sentence
mcShrStrgthDesc :: Sentence
mcShrStrgthDesc = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"In this", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
model, String -> Sentence
S String
"the",
UnitalChunk -> Sentence
forall a. Quantity a => a -> Sentence
getTandS UnitalChunk
shrStress Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"proportional to the product" Sentence -> Sentence -> Sentence
`S.ofThe` UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
effNormStress,
UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
effNormStress Sentence -> Sentence -> Sentence
`S.onThe` String -> Sentence
S String
"plane",
String -> Sentence
S String
"with its static", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
friction Sentence -> Sentence -> Sentence
`S.inThe` String -> Sentence
S String
"angular form" Sentence -> Sentence -> Sentence
+:+.
ModelExpr -> Sentence
eS (ModelExpr -> ModelExpr
forall r. ExprC r => r -> r
tan (ModelExpr -> ModelExpr) -> ModelExpr -> ModelExpr
forall a b. (a -> b) -> a -> b
$ UncertQ -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
fricAngle),
String -> Sentence
S String
"The", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
shrStress, String -> Sentence
S String
"versus", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
effNormStress,
String -> Sentence
S String
"relationship" Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"not truly",
ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
linear Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"but assuming the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
nrmFSubWat,
String -> Sentence
S String
"is strong enough" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"it can be approximated with a", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
linear,
String -> Sentence
S String
"fit", Sentence -> Sentence
sParen (ConceptInstance -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
assumpSBSBISL), String -> Sentence
S String
"where the", UncertQ -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UncertQ
effCohesion,
UncertQ -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UncertQ
effCohesion, String -> Sentence
S String
"represents the", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
shrStress,
String -> Sentence
S String
"intercept" Sentence -> Sentence -> Sentence
`S.ofThe` String -> Sentence
S String
"fitted line"]
effStress :: TheoryModel
effStress :: TheoryModel
effStress = ModelKind ModelExpr
-> [QuantityDict]
-> [ConceptChunk]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm (String -> ModelQDef -> ModelKind ModelExpr
forall e. String -> QDefinition e -> ModelKind e
equationalModelU String
"effectiveStressTM" ModelQDef
effStressQD)
[UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
effectiveStress, UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
totNormStress, UnitalChunk -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
porePressure]
([] :: [ConceptChunk])
[ModelQDef
effStressQD] [] [] [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
fredlund1977] String
"effStress" [Sentence
effStressDesc]
effStressQD :: ModelQDef
effStressQD :: ModelQDef
effStressQD = UID
-> NP
-> Sentence
-> (Stage -> Symbol)
-> Space
-> ModelExpr
-> ModelQDef
forall e.
UID
-> NP
-> Sentence
-> (Stage -> Symbol)
-> Space
-> e
-> QDefinition e
fromEqnSt' (UnitalChunk
effectiveStress UnitalChunk -> Getting UID UnitalChunk UID -> UID
forall s a. s -> Getting a s a -> a
^. Getting UID UnitalChunk UID
forall c. HasUID c => Getter c UID
Getter UnitalChunk UID
uid) (String -> NP
nounPhraseSP String
"effective stress")
Sentence
effStressDesc (UnitalChunk -> Stage -> Symbol
forall c. HasSymbol c => c -> Stage -> Symbol
symbol UnitalChunk
effectiveStress) Space
Real ModelExpr
PExpr
effStressExpr
effStressExpr :: PExpr
effStressExpr :: PExpr
effStressExpr = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
totNormStress r -> r -> r
forall r. ExprC r => r -> r -> r
$- UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
porePressure
effStressDesc :: Sentence
effStressDesc :: Sentence
effStressDesc = (UnitalChunk
totNormStress UnitalChunk -> DataDefinition -> Sentence
forall q r.
(HasSymbol q, HasUID q, Referable r, HasShortName r) =>
q -> r -> Sentence
`definedIn'''` DataDefinition
normStressDD !.)