module Drasil.SWHS.GenDefs (genDefs, htFluxWaterFromCoil, htFluxPCMFromWater,
  rocTempSimp, rocTempSimpDeriv, rocTempSimpRC) where

import Language.Drasil
import Utils.Drasil (weave)
import Theory.Drasil (GenDefn, gd, gdNoRefs, deModel', equationalModel')
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S

import Data.Drasil.Concepts.Math (rOfChng, unit_)
import Data.Drasil.Concepts.Thermodynamics (lawConvCooling)

import Data.Drasil.Quantities.Math (uNormalVect, surface, gradient)
import Data.Drasil.Quantities.PhysicalProperties as QPP (vol, mass, density)
import Data.Drasil.Quantities.Physics as QP (time)
import Data.Drasil.Quantities.Thermodynamics as QT (heatCapSpec, temp)

import Drasil.SWHS.Assumptions (assumpCWTAT, assumpLCCCW, assumpLCCWP,
  assumpTPCAV, assumpDWPCoV, assumpSHECoV, assumpTHCCoT)
import Drasil.SWHS.Concepts (coil, gaussDiv, phaseChangeMaterial)
import Drasil.SWHS.References (koothoor2013)
import Drasil.SWHS.TMods (consThermE, nwtnCooling)
import Drasil.SWHS.Unitals (coilHTC, htFluxC, htFluxIn, htFluxOut, htFluxP,
  inSA, outSA, pcmHTC, tempC, tempPCM, tempW, thFluxVect, volHtGen)

-------------------------
-- General Definitions --
-------------------------

--FIXME: genDefs, nwtnCoolingGD, and rocTempSimpGD were added--
--since referencing implementation for RelationConcept hasn't--
--stabilized yet (since RelationConcept isn't an instance of --
--the Referable class.                                       --
genDefs :: [GenDefn]
genDefs :: [GenDefn]
genDefs = [GenDefn
rocTempSimp, GenDefn
htFluxWaterFromCoil, GenDefn
htFluxPCMFromWater] 

rocTempSimp :: GenDefn
rocTempSimp :: GenDefn
rocTempSimp = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (RelationConcept -> ModelKind ModelExpr
forall e. RelationConcept -> ModelKind e
deModel' RelationConcept
rocTempSimpRC) (Maybe UnitDefn
forall a. Maybe a
Nothing :: Maybe UnitDefn)
  (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just (Derivation -> Maybe Derivation) -> Derivation -> Maybe Derivation
forall a b. (a -> b) -> a -> b
$ Sentence -> [ConceptInstance] -> Derivation
rocTempSimpDeriv Sentence
rocTempDerivConsFlxSWHS
   [ConceptInstance
assumpCWTAT, ConceptInstance
assumpTPCAV, ConceptInstance
assumpDWPCoV, ConceptInstance
assumpSHECoV])
  String
"rocTempSimp" [{-Notes-}]

rocTempSimpRC :: RelationConcept
rocTempSimpRC :: RelationConcept
rocTempSimpRC = String -> NP -> Sentence -> ModelExpr -> RelationConcept
forall e.
Express e =>
String -> NP -> Sentence -> e -> RelationConcept
makeRC String
"rocTempSimpRC" (String -> NP
nounPhraseSP (String -> NP) -> String -> NP
forall a b. (a -> b) -> a -> b
$ String
"Simplified rate " String -> String -> String
forall a. [a] -> [a] -> [a]
++
  String
"of change of temperature") Sentence
EmptyS ModelExpr
rocTempSimpRel

rocTempSimpRel :: ModelExpr
rocTempSimpRel :: ModelExpr
rocTempSimpRel = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.heatCapSpec ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* 
  ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.temp) UnitalChunk
QP.time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxIn ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
inSA ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$-
  (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxOut ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
outSA)) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
volHtGen ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.vol)

----

htFluxWaterFromCoil :: GenDefn
htFluxWaterFromCoil :: GenDefn
htFluxWaterFromCoil = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
gd (QDefinition ModelExpr -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' QDefinition ModelExpr
htFluxWaterFromCoilQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
htFluxC) Maybe Derivation
forall a. Maybe a
Nothing
  [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
koothoor2013] String
"htFluxWaterFromCoil"
  [UnitalChunk -> ConceptInstance -> ConceptChunk -> Sentence
newtonLawNote UnitalChunk
htFluxC ConceptInstance
assumpLCCCW ConceptChunk
coil, ConceptInstance -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
assumpTHCCoT]

htFluxWaterFromCoilQD :: ModelQDef
htFluxWaterFromCoilQD :: QDefinition ModelExpr
htFluxWaterFromCoilQD = UnitalChunk -> ModelExpr -> QDefinition ModelExpr
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
htFluxC ModelExpr
htFluxWaterFromCoilExpr

htFluxWaterFromCoilExpr :: ModelExpr
htFluxWaterFromCoilExpr :: ModelExpr
htFluxWaterFromCoilExpr = UncertQ -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
coilHTC ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* (UncertQ -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
tempC ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- ConstrConcept -> UnitalChunk -> ModelExpr
forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 ConstrConcept
tempW UnitalChunk
time)

--Can't include info in description beyond definition of variables?
----

htFluxPCMFromWater :: GenDefn
htFluxPCMFromWater :: GenDefn
htFluxPCMFromWater = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
gd (QDefinition ModelExpr -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' QDefinition ModelExpr
htFluxPCMFromWaterQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
htFluxP) Maybe Derivation
forall a. Maybe a
Nothing
  [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
koothoor2013] String
"htFluxPCMFromWater"
  [UnitalChunk -> ConceptInstance -> ConceptChunk -> Sentence
newtonLawNote UnitalChunk
htFluxP ConceptInstance
assumpLCCWP ConceptChunk
phaseChangeMaterial]

htFluxPCMFromWaterQD :: ModelQDef
htFluxPCMFromWaterQD :: QDefinition ModelExpr
htFluxPCMFromWaterQD = UnitalChunk -> ModelExpr -> QDefinition ModelExpr
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
htFluxP ModelExpr
htFluxPCMFromWaterExpr

htFluxPCMFromWaterExpr :: ModelExpr
htFluxPCMFromWaterExpr :: ModelExpr
htFluxPCMFromWaterExpr = UncertQ -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmHTC ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* (ConstrConcept -> UnitalChunk -> ModelExpr
forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 ConstrConcept
tempW UnitalChunk
time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- ConstrConcept -> UnitalChunk -> ModelExpr
forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 ConstrConcept
tempPCM UnitalChunk
time)

newtonLawNote :: UnitalChunk -> ConceptInstance -> ConceptChunk -> Sentence
newtonLawNote :: UnitalChunk -> ConceptInstance -> ConceptChunk -> Sentence
newtonLawNote UnitalChunk
u ConceptInstance
a ConceptChunk
c = [Sentence] -> Sentence
foldlSent [UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
u Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"found by assuming that",
  ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
lawConvCooling, String -> Sentence
S String
"applies" Sentence -> Sentence -> Sentence
+:+. Sentence -> Sentence
sParen (ConceptInstance -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
a), String -> Sentence
S String
"This law",
  Sentence -> Sentence
sParen (String -> Sentence
S String
"defined" Sentence -> Sentence -> Sentence
`S.in_` TheoryModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS TheoryModel
nwtnCooling) Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"used on",
  NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk
surface UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThe` ConceptChunk
c)]

------------------------------------
-- General Definitions Derivation --
------------------------------------

rocTempSimpDeriv :: Sentence -> [ConceptInstance] -> Derivation
rocTempSimpDeriv :: Sentence -> [ConceptInstance] -> Derivation
rocTempSimpDeriv Sentence
s [ConceptInstance]
a = Sentence -> [Sentence] -> Derivation
mkDerivName (String -> Sentence
S String
"simplified" Sentence -> Sentence -> Sentence
+:+ NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
rOfChng ConceptChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
temp))
  ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [Sentence -> [ConceptInstance] -> [Sentence]
rocTempSimpDerivSent Sentence
s [ConceptInstance]
a, (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
rocTempSimpDerivEqns])

rocTempSimpDerivSent :: Sentence -> [ConceptInstance] -> [Sentence]
rocTempSimpDerivSent :: Sentence -> [ConceptInstance] -> [Sentence]
rocTempSimpDerivSent Sentence
s [ConceptInstance]
a = ([Sentence] -> Sentence) -> [[Sentence]] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map [Sentence] -> Sentence
foldlSentCol [[Sentence]
rocTempDerivInteg, [Sentence]
rocTempDerivGauss,
  [Sentence]
rocTempDerivArbVol, Sentence -> [ConceptInstance] -> [Sentence]
rocTempDerivConsFlx Sentence
s [ConceptInstance]
a, [Sentence]
rocTempDerivDens]

rocTempDerivInteg :: [Sentence]
rocTempDerivInteg :: [Sentence]
rocTempDerivInteg = [String -> Sentence
S String
"Integrating", TheoryModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS TheoryModel
consThermE, String -> Sentence
S String
"over a",
  UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
vol, Sentence -> Sentence
sParen (UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
vol) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we have"]

rocTempDerivGauss :: [Sentence]
rocTempDerivGauss :: [Sentence]
rocTempDerivGauss = [String -> Sentence
S String
"Applying", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize ConceptChunk
gaussDiv, String -> Sentence
S String
"to the first term over",
  (UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
surface Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
surface Sentence -> Sentence -> Sentence
`S.the_ofThe` UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
vol) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"with",
  UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
thFluxVect, String -> Sentence
S String
"as the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
thFluxVect, String -> Sentence
S String
"for the",
  UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
surface Sentence -> Sentence -> Sentence
`S.and_` DefinedQuantityDict -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch DefinedQuantityDict
uNormalVect, String -> Sentence
S String
"as a", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
unit_,
  String -> Sentence
S String
"outward", DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
uNormalVect, String -> Sentence
S String
"for a", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
surface]

rocTempDerivArbVol :: [Sentence]
rocTempDerivArbVol :: [Sentence]
rocTempDerivArbVol = [String -> Sentence
S String
"We consider an arbitrary" Sentence -> Sentence -> Sentence
+:+. UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
vol,
  NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (UnitalChunk -> NP
forall t. NamedIdea t => t -> NP
the UnitalChunk
volHtGen) Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"assumed constant. Then", Int -> Sentence
eqN Int
1, String -> Sentence
S String
"can be written as"]

rocTempDerivConsFlx :: Sentence -> [ConceptInstance] -> [Sentence]
rocTempDerivConsFlx :: Sentence -> [ConceptInstance] -> [Sentence]
rocTempDerivConsFlx Sentence
s [ConceptInstance]
assumps = [String -> Sentence
S String
"Where", 
  SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ((UnitalChunk -> Sentence) -> [UnitalChunk] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch [UnitalChunk
htFluxIn, UnitalChunk
htFluxOut, UnitalChunk
inSA, UnitalChunk
outSA]),
  String -> Sentence
S String
"are explained in" Sentence -> Sentence -> Sentence
+:+. GenDefn -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS GenDefn
rocTempSimp, Sentence
s, String -> Sentence
S String
"Assuming", 
  SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ((UnitalChunk -> Sentence) -> [UnitalChunk] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch [UnitalChunk
density, UnitalChunk
QT.heatCapSpec, UnitalChunk
QT.temp]),
  String -> Sentence
S String
"are constant over the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
vol Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"which is true in our case by",
  SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List ((ConceptInstance -> Sentence) -> [ConceptInstance] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ConceptInstance -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS [ConceptInstance]
assumps) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we have"]

rocTempDerivConsFlxSWHS :: Sentence
rocTempDerivConsFlxSWHS :: Sentence
rocTempDerivConsFlxSWHS = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"The integral over the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
surface,
  String -> Sentence
S String
"could be simplified because the thermal flux" Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"assumed constant over",
  UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
inSA Sentence -> Sentence -> Sentence
`S.and_` UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
outSA Sentence -> Sentence -> Sentence
`S.and_` ModelExpr -> Sentence
eS (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0), String -> Sentence
S String
"on all other" Sentence -> Sentence -> Sentence
+:+. UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
plural UnitalChunk
surface,
  String -> Sentence
S String
"Outward flux is considered positive"]

rocTempDerivDens :: [Sentence]
rocTempDerivDens :: [Sentence]
rocTempDerivDens = [String -> Sentence
S String
"Using the fact that", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
density Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"=" Sentence -> Sentence -> Sentence
:+: UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
mass Sentence -> Sentence -> Sentence
:+:
  String -> Sentence
S String
"/" Sentence -> Sentence -> Sentence
:+: UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
vol Sentence -> Sentence -> Sentence
`sC` Int -> Sentence
eqN Int
2, String -> Sentence
S String
"can be written as"]

-- TODO: Move the below expressions to a new Expressions.hs file.

rocTempDerivIntegEq, rocTempDerivGaussEq, rocTempDerivArbVolEq,
  rocTempDerivConsFlxEq, rocTempDerivDensEq :: ModelExpr

rocTempDerivIntegEq :: ModelExpr
rocTempDerivIntegEq = ModelExpr -> ModelExpr
forall r. ExprC r => r -> r
neg (Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
intAll (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
vol) (DefinedQuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy DefinedQuantityDict
gradient ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$. UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
thFluxVect)) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+
  Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
intAll (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
vol) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
volHtGen) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$=
  Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
intAll (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
vol) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
density
  ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.heatCapSpec ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
pderiv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.temp) UnitalChunk
time)

rocTempDerivGaussEq :: ModelExpr
rocTempDerivGaussEq = ModelExpr -> ModelExpr
forall r. ExprC r => r -> r
neg (Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
intAll (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
surface) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
thFluxVect ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$. DefinedQuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy DefinedQuantityDict
uNormalVect)) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+
  Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
intAll (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
vol) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
volHtGen) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= 
  Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
intAll (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
vol)
  (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
density ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.heatCapSpec ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
pderiv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.temp) UnitalChunk
time)

rocTempDerivArbVolEq :: ModelExpr
rocTempDerivArbVolEq = (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxIn ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
inSA ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxOut ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* 
  UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
outSA)) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
volHtGen ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
vol) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= 
  Symbol -> ModelExpr -> ModelExpr
forall r. ModelExprC r => Symbol -> r -> r
intAll (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
vol) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
density ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.heatCapSpec ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
pderiv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.temp) UnitalChunk
time)

rocTempDerivConsFlxEq :: ModelExpr
rocTempDerivConsFlxEq = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
density ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.heatCapSpec ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
vol ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv
  (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.temp) UnitalChunk
time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxIn ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
inSA ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxOut ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* 
  UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
outSA)) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
volHtGen ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
vol)

rocTempDerivDensEq :: ModelExpr
rocTempDerivDensEq = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.heatCapSpec ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QT.temp)
  UnitalChunk
time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxIn ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
inSA ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
htFluxOut
  ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
outSA)) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
volHtGen ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
vol)

rocTempSimpDerivEqns :: [ModelExpr]
rocTempSimpDerivEqns :: [ModelExpr]
rocTempSimpDerivEqns = [ModelExpr
rocTempDerivIntegEq, ModelExpr
rocTempDerivGaussEq, ModelExpr
rocTempDerivArbVolEq, ModelExpr
rocTempDerivConsFlxEq,
  ModelExpr
rocTempDerivDensEq]