{-# LANGUAGE PostfixOperators #-}
module Drasil.SWHS.TMods (PhaseChange(Liquid), consThermE, latentHtE,
  nwtnCooling, sensHtE, sensHtETemplate, tMods) where

import qualified Data.List.NonEmpty as NE

import Language.Drasil
import Control.Lens ((^.))
import Theory.Drasil (ConstraintSet, mkConstraintSet,
  TheoryModel, tm, equationalModel', equationalConstraints',
  ModelKind, equationalModel)
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S

import Data.Drasil.Concepts.Documentation (system)
import Data.Drasil.Concepts.Math (equation, rate, rOfChng)
import Data.Drasil.Concepts.Physics (mechEnergy)
import Data.Drasil.Concepts.Thermodynamics (heatTrans, lawConsEnergy,
  lawConvCooling, phaseChange, thermalEnergy)

import Data.Drasil.Quantities.Math (gradient)
import Data.Drasil.Quantities.PhysicalProperties (density, mass)
import Data.Drasil.Quantities.Physics (energy, time)
import Data.Drasil.Quantities.Thermodynamics (boilPt, heatCapSpec,
  htFlux, latentHeat, meltPt, sensHeat, temp)

import Drasil.SWHS.Assumptions (assumpHTCC, assumpTEO)
import Drasil.SWHS.Concepts (transient)
import Drasil.SWHS.DataDefs (ddMeltFrac)
import Drasil.SWHS.References (incroperaEtAl2007)
import Drasil.SWHS.Unitals (deltaT, htCapL, htCapS, htCapV, htTransCoeff,
  meltFrac, tau, tempEnv, thFluxVect, volHtGen)

tMods :: [TheoryModel]
tMods :: [TheoryModel]
tMods = [TheoryModel
consThermE, TheoryModel
sensHtE, TheoryModel
latentHtE, TheoryModel
nwtnCooling]

-------------------------
-- Theoretical Model 1 --
-------------------------
consThermE :: TheoryModel
consThermE :: TheoryModel
consThermE = forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm (forall e. ConstraintSet e -> ModelKind e
equationalConstraints' ConstraintSet ModelExpr
consThermECS)
  [forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
thFluxVect, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw DefinedQuantityDict
gradient, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
volHtGen,
    forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
density, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
heatCapSpec, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
temp, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
time] ([] :: [ConceptChunk])
  [] [forall c. Express c => c -> ModelExpr
express ModelExpr
consThermERel] [] [forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Reference
consThemESrc] String
"consThermE" [Sentence]
consThermENotes

consThermECS :: ConstraintSet ModelExpr
consThermECS :: ConstraintSet ModelExpr
consThermECS = forall e. ConceptChunk -> NonEmpty e -> ConstraintSet e
mkConstraintSet ConceptChunk
consCC NonEmpty ModelExpr
rels
  where consCC :: ConceptChunk
consCC = String -> NP -> Sentence -> ConceptChunk
dccWDS String
"consThermECS"
          (String -> NP
nounPhraseSP String
"Conservation of thermal energy") (ConceptChunk
lawConsEnergy forall s a. s -> Getting a s a -> a
^. forall c. Definition c => Lens' c Sentence
defn)
        rels :: NonEmpty ModelExpr
rels   = forall a. [a] -> NonEmpty a
NE.fromList [ModelExpr
consThermERel]

consThermERel :: ModelExpr
consThermERel :: ModelExpr
consThermERel = forall r. ExprC r => r -> r
negVec (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy DefinedQuantityDict
gradient) forall r. ExprC r => r -> r -> r
$. forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
thFluxVect forall r. ExprC r => r -> r -> r
`addRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
volHtGen forall r. ExprC r => r -> r -> r
$=
  forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
density forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
heatCapSpec forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
pderiv (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
temp) UnitalChunk
time

-- the second argument is a 'ShortName'...
consThemESrc :: Reference
consThemESrc :: Reference
consThemESrc = String -> String -> ShortName -> Reference
makeURI String
"consThemESrc"
  String
"http://www.efunda.com/formulae/heat_transfer/conduction/overview_cond.cfm" forall a b. (a -> b) -> a -> b
$
  Sentence -> ShortName
shortname' forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"Fourier Law of Heat Conduction and Heat Equation"

consThermENotes :: [Sentence]
consThermENotes :: [Sentence]
consThermENotes = forall a b. (a -> b) -> [a] -> [b]
map [Sentence] -> Sentence
foldlSent [
  [String -> Sentence
S String
"The above", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation, String -> Sentence
S String
"gives the", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
lawConsEnergy,
   String -> Sentence
S String
"for", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
transient, forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
heatTrans, String -> Sentence
S String
"in a given material"],
  [String -> Sentence
S String
"For this", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation, String -> Sentence
S String
"to apply" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"other forms" Sentence -> Sentence -> Sentence
`S.of_`
   forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
energy Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"such as", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
mechEnergy Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"are assumed",
   String -> Sentence
S String
"to be negligible" Sentence -> Sentence -> Sentence
`S.inThe` forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
system, Sentence -> Sentence
sParen (forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
assumpTEO)]]

-------------------------
-- Theoretical Model 2 --
-------------------------
sensHtE :: TheoryModel
sensHtE :: TheoryModel
sensHtE = PhaseChange -> Sentence -> TheoryModel
sensHtETemplate PhaseChange
AllPhases Sentence
sensHtEdesc

data PhaseChange = AllPhases
                 | Liquid

sensHtETemplate :: PhaseChange -> Sentence -> TheoryModel
sensHtETemplate :: PhaseChange -> Sentence -> TheoryModel
sensHtETemplate PhaseChange
pc Sentence
desc = forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm (forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
qd)
  [forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
sensHeat, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
htCapS, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
mass,
    forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
deltaT, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
meltPt, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
temp, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
htCapL, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
boilPt, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
htCapV] ([] :: [ConceptChunk])
  [ModelQDef
qd] [] [] [forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Reference
sensHtESrc] String
"sensHtE" [Sentence
desc]
    where
      qd :: ModelQDef
qd = PhaseChange -> ModelExpr -> Sentence -> ModelQDef
sensHtEQD PhaseChange
pc ModelExpr
eqn Sentence
desc
      eqn :: ModelExpr
eqn = PhaseChange -> ModelExpr
sensHtEEqn PhaseChange
pc


sensHtEQD :: PhaseChange -> ModelExpr -> Sentence -> ModelQDef
sensHtEQD :: PhaseChange -> ModelExpr -> Sentence -> ModelQDef
sensHtEQD PhaseChange
pc ModelExpr
eqn Sentence
desc = forall e.
String
-> NP
-> Sentence
-> (Stage -> Symbol)
-> Space
-> e
-> QDefinition e
fromEqnSt'' String
"sensHeat" NP
np Sentence
desc (forall c. HasSymbol c => c -> Stage -> Symbol
symbol UnitalChunk
sensHeat) (UnitalChunk
sensHeat forall s a. s -> Getting a s a -> a
^. forall c. HasSpace c => Getter c Space
typ) ModelExpr
eqn
  where np :: NP
np = String -> NP
nounPhraseSP (String
"Sensible heat energy" forall a. [a] -> [a] -> [a]
++ case PhaseChange
pc of
                                                       PhaseChange
Liquid -> String
" (no state change)"
                                                       PhaseChange
AllPhases -> String
"")

sensHtESrc :: Reference
sensHtESrc :: Reference
sensHtESrc = String -> String -> ShortName -> Reference
makeURI String
"sensHtESrc"
  String
"http://en.wikipedia.org/wiki/Sensible_heat" forall a b. (a -> b) -> a -> b
$
  Sentence -> ShortName
shortname' forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"Definition of Sensible Heat"

sensHtEEqn :: PhaseChange -> ModelExpr
sensHtEEqn :: PhaseChange -> ModelExpr
sensHtEEqn PhaseChange
pChange = case PhaseChange
pChange of
  PhaseChange
Liquid -> ModelExpr
liquidFormula
  PhaseChange
AllPhases -> forall r. ExprC r => [(r, r)] -> r
incompleteCase [(forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htCapS forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mass forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
deltaT,
      forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
temp forall r. ExprC r => r -> r -> r
$< forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
meltPt), (ModelExpr
liquidFormula, forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
meltPt forall r. ExprC r => r -> r -> r
$< forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
temp forall r. ExprC r => r -> r -> r
$<
      forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
boilPt), (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htCapV forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mass forall r. ExprC r => r -> r -> r
`mulRe`
      forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
deltaT, forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
boilPt forall r. ExprC r => r -> r -> r
$< forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
temp)]
  where
    liquidFormula :: ModelExpr
liquidFormula = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htCapL forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mass forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
deltaT

--When to call with C? When to call with U, S, Sy, etc? Sometimes confusing.

--Figured out why so many were defn and others were term. The unitals
-- were implemented incorrectly.
sensHtEdesc :: Sentence
sensHtEdesc :: Sentence
sensHtEdesc = [Sentence] -> Sentence
foldlSent [
  forall n. NamedIdea n => n -> Sentence
atStart UnitalChunk
sensHeat Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"ing occurs as long as the material does not reach a",
  forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
temp, String -> Sentence
S String
"where a", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
phaseChange, (String -> Sentence
S String
"occurs" !.), forall n. NounPhrase n => n -> Sentence
atStartNP (forall c. NamedIdea c => c -> NP
a_ ConceptChunk
phaseChange),
  String -> Sentence
S String
"occurs if" Sentence -> Sentence -> Sentence
+:+. (ModelExpr -> Sentence
eS (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
temp forall r. ExprC r => r -> r -> r
$= forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
boilPt) Sentence -> Sentence -> Sentence
`S.or_` ModelExpr -> Sentence
eS (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
temp forall r. ExprC r => r -> r -> r
$= forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
meltPt)),
  String -> Sentence
S String
"If this is the case" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"refer to", forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS TheoryModel
latentHtE]

--How to have new lines in the description?
--Can't have relation and eqn chunks together since they are called in a list
----You can, you just can't map "Definition" over a list
---- you have to do each separately
--How to have multiple possible equations?
--How to have conditions in the equation section?

-------------------------
-- Theoretical Model 3 --
-------------------------
latentHtE :: TheoryModel
latentHtE :: TheoryModel
latentHtE = forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm ModelKind ModelExpr
latentHtEMK
  [forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
latentHeat, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
time, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
tau] ([] :: [ConceptChunk])
  [] [forall c. Express c => c -> ModelExpr
express ModelQDef
latentHtEFD] [] [forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Reference
latHtESrc] String
"latentHtE" [Sentence]
latentHtENotes

latentHtEMK :: ModelKind ModelExpr
latentHtEMK :: ModelKind ModelExpr
latentHtEMK = forall e. String -> NP -> QDefinition e -> ModelKind e
equationalModel String
"latentHtETM"
  (String -> NP
nounPhraseSP String
"Latent heat energy") ModelQDef
latentHtEFD

latentHtEFD :: ModelQDef
latentHtEFD :: ModelQDef
latentHtEFD = forall c i e.
(Quantity c, MayHaveUnit c, HasSpace c, Quantity i, HasSpace i) =>
c -> [i] -> e -> QDefinition e
mkFuncDefByQ UnitalChunk
latentHeat [UnitalChunk
time] ModelExpr
latentHtEExpr

latentHtEExpr :: ModelExpr
latentHtEExpr :: ModelExpr
latentHtEExpr = forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
tau) (forall r. LiteralC r => Integer -> r
exactDbl Integer
0) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time) (forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv (forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 UnitalChunk
latentHeat UnitalChunk
tau) UnitalChunk
tau)

-- Integrals need dTau at end

latHtESrc :: Reference
latHtESrc :: Reference
latHtESrc = String -> String -> ShortName -> Reference
makeURI String
"latHtESrc" String
"http://en.wikipedia.org/wiki/Latent_heat" forall a b. (a -> b) -> a -> b
$
  Sentence -> ShortName
shortname' forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"Definition of Latent Heat"

latentHtENotes :: [Sentence]
latentHtENotes :: [Sentence]
latentHtENotes = forall a b. (a -> b) -> [a] -> [b]
map [Sentence] -> Sentence
foldlSent [
  [forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
latentHeat Sentence -> Sentence -> Sentence
`S.isThe` String -> Sentence
S String
"change" Sentence -> Sentence -> Sentence
`S.in_` forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
thermalEnergy,
   Sentence -> Sentence
sParen (forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
latentHeat Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
energy)],
  [forall t. Express t => t -> Sentence
eS' ModelQDef
latentHtEFD Sentence -> Sentence -> Sentence
`S.isThe` forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
rOfChng Sentence -> Sentence -> Sentence
`S.of_` forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
latentHeat Sentence -> Sentence -> Sentence
`S.wrt` 
   forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
time, forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
tau],
  [forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
time Sentence -> Sentence -> Sentence
`S.isThe` forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
time, String -> Sentence
S String
"elapsed" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"as long as the",
   forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
phaseChange, String -> Sentence
S String
"is not complete"],
  [String -> Sentence
S String
"status" Sentence -> Sentence -> Sentence
`S.the_ofTheC` forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
phaseChange, String -> Sentence
S String
"depends on the",
   forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
meltFrac, Sentence -> Sentence
sParen (String -> Sentence
S String
"from" Sentence -> Sentence -> Sentence
+:+ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS DataDefinition
ddMeltFrac)],
  [forall n. NamedIdea n => n -> Sentence
atStart UnitalChunk
latentHeat Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"ing stops when all material has changed to the new phase"]]

-------------------------
-- Theoretical Model 4 --
-------------------------
nwtnCooling :: TheoryModel
nwtnCooling :: TheoryModel
nwtnCooling = forall q c.
(Quantity q, MayHaveUnit q, Concept c) =>
ModelKind ModelExpr
-> [q]
-> [c]
-> [ModelQDef]
-> [ModelExpr]
-> [ModelQDef]
-> [DecRef]
-> String
-> [Sentence]
-> TheoryModel
tm ModelKind ModelExpr
nwtnCoolingMK
  [forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
latentHeat, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
time, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
htTransCoeff, forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw UnitalChunk
deltaT] ([] :: [ConceptChunk])
  [] [forall c. Express c => c -> ModelExpr
express ModelQDef
nwtnCoolingFD] [] [forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> RefInfo -> DecRef
dRefInfo Citation
incroperaEtAl2007 forall a b. (a -> b) -> a -> b
$ [Int] -> RefInfo
Page [Int
8]]
  String
"nwtnCooling" [Sentence]
nwtnCoolingNotes

nwtnCoolingMK :: ModelKind ModelExpr
nwtnCoolingMK :: ModelKind ModelExpr
nwtnCoolingMK = forall e. String -> NP -> QDefinition e -> ModelKind e
equationalModel String
"nwtnCoolingTM"
  (String -> NP
nounPhraseSP String
"Newton's law of cooling") ModelQDef
nwtnCoolingFD

nwtnCoolingFD :: ModelQDef
nwtnCoolingFD :: ModelQDef
nwtnCoolingFD = forall c i e.
(Quantity c, MayHaveUnit c, HasSpace c, Quantity i, HasSpace i) =>
c -> [i] -> e -> QDefinition e
mkFuncDefByQ UnitalChunk
htFlux [UnitalChunk
time] ModelExpr
nwtnCoolingExpr

nwtnCoolingExpr :: ModelExpr
nwtnCoolingExpr :: ModelExpr
nwtnCoolingExpr = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htTransCoeff forall r. ExprC r => r -> r -> r
`mulRe` forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 UnitalChunk
deltaT UnitalChunk
time

nwtnCoolingNotes :: [Sentence]
nwtnCoolingNotes :: [Sentence]
nwtnCoolingNotes = forall a b. (a -> b) -> [a] -> [b]
map [Sentence] -> Sentence
foldlSent [
  [forall n. NamedIdea n => n -> Sentence
atStart ConceptChunk
lawConvCooling Sentence -> Sentence -> Sentence
+:+. String -> Sentence
S String
"describes convective cooling from a surface" Sentence -> Sentence -> Sentence
+:
   String -> Sentence
S String
"The law is stated as", String -> Sentence
S String
"the", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
rate Sentence -> Sentence -> Sentence
`S.of_` String -> Sentence
S String
"heat loss from a body" Sentence -> Sentence -> Sentence
`S.is`
   String -> Sentence
S String
"proportional to the difference in", forall n. NamedIdea n => n -> Sentence
plural UnitalChunk
temp, String -> Sentence
S String
"between the body and its surroundings"],
  [forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
htTransCoeff, String -> Sentence
S String
"is assumed to be independent" Sentence -> Sentence -> Sentence
`S.of_` forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
temp,
   Sentence -> Sentence
sParen (String -> Sentence
S String
"from" Sentence -> Sentence -> Sentence
+:+ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
assumpHTCC)],
  [ModelExpr -> Sentence
E (forall r. ModelExprC r => r -> r -> r
defines (forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 UnitalChunk
deltaT UnitalChunk
time) (forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 UnitalChunk
temp UnitalChunk
time forall r. ExprC r => r -> r -> r
$- forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 UnitalChunk
tempEnv UnitalChunk
time)) Sentence -> Sentence -> Sentence
`S.isThe`
   String -> Sentence
S String
"time-dependant thermal gradient between the environment and the object"]]