Skip to content

Commit d5b47f0

Browse files
committed
still does not work
1 parent 467c909 commit d5b47f0

File tree

4 files changed

+129
-35
lines changed

4 files changed

+129
-35
lines changed

src/Domain.jl

Lines changed: 70 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ function ConstantTVGasDomain(;phase::E2,initialconds::Dict{X,X2},constantspecies
144144
y0[ind] = val
145145
end
146146
end
147-
148-
149147
@assert T != 0.0
150148
@assert V != 0.0
151149
ns = y0[1:end-1]
@@ -173,7 +171,7 @@ function ConstantTVGasDomain(;phase::E2,initialconds::Dict{X,X2},constantspecies
173171
C = P/(R*T)
174172

175173
y0[end] = P
176-
kfs,krevs = getkfkrevs(phase,T,V,C,N,ns,Gs,diffs,P,0.0)
174+
kfs,krevs = getkfkrevs(phase,T,P,C,N,ns,Gs,diffs,V,0.0)
177175
kfsp = deepcopy(kfs)
178176
for ind in efficiencyinds
179177
kfsp[ind] = 1.0
@@ -185,21 +183,12 @@ function ConstantTVGasDomain(;phase::E2,initialconds::Dict{X,X2},constantspecies
185183
jacobian=zeros(typeof(T),length(phase.species),length(phase.species))
186184
end
187185
rxnarray = getreactionindices(phase)
188-
return ConstantTPDomain(phase,[1,length(phase.species),length(phase.species)+1],[1,length(phase.species)+length(phase.reactions)],constspcinds,
186+
return ConstantTVGasDomain(phase,[1,length(phase.species),length(phase.species)+1],[1,length(phase.species)+length(phase.reactions)],constspcinds,
189187
T,V,kfs,krevs,efficiencyinds,Gs,rxnarray,mu,diffs,jacobian,sensitivity,false,MVector(false),MVector(0.0),p, Dict("P"=>length(phase.species)+1)), y0, p
190188
end
191189
export ConstantTVGasDomain
192-
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::J,t::Q,p::W3=SciMLBase.NullParameters()) where {W3<:SciMLBase.NullParameters,W<:IdealGas,Y<:Integer,J<:Array{Float64,1},Q} #no parameter input
193-
ns = y[d.indexes[1]:d.indexes[2]]
194-
P = y[d.indexes[3]]
195-
N = P*d.V/(R*d.T)
196-
cs = ns./d.V
197-
C = N/d.V
198-
for ind in d.efficiencyinds #efficiency related rates may have changed
199-
d.kfs[ind],d.krevs[ind] = getkfkrev(d.phase.reactions[ind],d.phase,d.T,P,C,N,ns,d.Gs,d.diffusivity,d.V,0.0)
200-
end
201-
return ns,cs,d.T,P,d.V,C,N,d.mu,d.kfs,d.krevs,Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
202-
end
190+
191+
203192

204193

205194
struct ConstantVDomain{N<:AbstractPhase,S<:Integer,W<:Real,W2<:Real,I<:Integer,Q<:AbstractArray} <: AbstractVariableKDomain
@@ -1162,10 +1151,21 @@ end
11621151
end
11631152

11641153

1154+
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::J,t::Q,p::W3=SciMLBase.NullParameters()) where {W3<:SciMLBase.NullParameters,W<:IdealGas,Y<:Integer,J<:Array{Float64,1},Q} #no parameter input
1155+
ns = y[d.indexes[1]:d.indexes[2]]
1156+
P = y[d.indexes[3]]
1157+
N = P * d.V / (R * d.T)
1158+
cs = ns./d.V
1159+
C = N/d.V
1160+
for ind in d.efficiencyinds #efficiency related rates may have changed
1161+
d.kfs[ind],d.krevs[ind] = getkfkrev(d.phase.reactions[ind], d.phase, d.T, P, C, N, ns, d.Gs, d.diffusivity, d.V, 0.0)
1162+
end
1163+
return ns, cs, d.T, P, d.V, C, N, d.mu, d.kfs, d.krevs, Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
1164+
end
11651165
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::J,t::Q,p::W2=SciMLBase.NullParameters()) where {W2<:Array{Float64,1},W<:IdealGas,Y<:Integer,J<:Array{Float64,1},Q<:Float64} #uses parameter input
11661166
ns = y[d.indexes[1]:d.indexes[2]]
11671167
P = y[d.indexes[3]]
1168-
N = P*d.V/(R*d.T)
1168+
N = P * d.V / (R * d.T)
11691169
cs = ns./d.V
11701170
C = N/d.V
11711171
if !d.alternativepformat
@@ -1180,13 +1180,13 @@ end
11801180
for ind in d.efficiencyinds #efficiency related rates may have changed
11811181
d.kfs[ind],d.krevs[ind] = getkfkrev(d.phase.reactions[ind],d.phase,d.T,P,C,N,ns,d.Gs,d.diffusivity,d.V,0.0;f=kfps[ind])
11821182
end
1183-
return ns,cs,d.T,d.P,V,C,N,d.mu,d.kfs,d.krevs,Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
1183+
return ns, cs, d.T, P, d.V, C, N, d.mu, d.kfs, d.krevs, Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
11841184
elseif nothermochg
11851185
d.kfs = kfps
11861186
for ind in d.efficiencyinds #efficiency related rates may have changed
11871187
d.kfs[ind],d.krevs[ind] = getkfkrev(d.phase.reactions[ind],d.phase,d.T,P,C,N,ns,d.Gs,d.diffusivity,d.V,0.0;f=kfps[ind])
11881188
end
1189-
return ns,cs,d.T,P,d.V,C,N,d.mu,d.kfs,d.krevs,Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
1189+
return ns, cs, d.T, P, d.V, C, N, d.mu, d.kfs, d.krevs, Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
11901190
else #need to handle thermo changes
11911191
d.kfs .= kfps
11921192
if !d.alternativepformat
@@ -1198,14 +1198,15 @@ end
11981198
for ind in d.efficiencyinds #efficiency related rates may have changed
11991199
d.kfs[ind],d.krevs[ind] = getkfkrev(d.phase.reactions[ind],d.phase,d.T,P,C,N,ns,d.Gs,d.diffusivity,d.V,0.0;f=kfps[ind])
12001200
end
1201-
return ns,cs,d.T,P,d.V,C,N,d.mu,d.kfs,d.krevs,Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
1201+
return ns, cs, d.T, P, d.V, C, N, d.mu, d.kfs, d.krevs, Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
12021202
end
12031203
end
12041204

12051205
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::Array{W3,1},t::Q,p::W2=SciMLBase.NullParameters()) where {W2,W<:IdealGas,Y<:Integer,W3<:ForwardDiff.Dual,Q} #Autodiff y
12061206
ns = y[d.indexes[1]:d.indexes[2]]
12071207
P = y[d.indexes[3]]
1208-
N = P*d.V/(R*d.T)
1208+
N = P * d.V / (R * d.T)
1209+
12091210
cs = ns./d.V
12101211
C = N/d.V
12111212
if !d.alternativepformat
@@ -1225,7 +1226,7 @@ end
12251226
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::J,t::Q,p::W2=SciMLBase.NullParameters()) where {W2,W<:IdealGas,Y<:Integer,J,Q} #Autodiff p
12261227
ns = y[d.indexes[1]:d.indexes[2]]
12271228
P = y[d.indexes[3]]
1228-
N = P*d.V/(R*d.T)
1229+
N = P * d.V / (R * d.T)
12291230
cs = ns./d.V
12301231
C = N/d.V
12311232
if !d.alternativepformat
@@ -1239,13 +1240,13 @@ end
12391240
for ind in d.efficiencyinds #efficiency related rates may have changed
12401241
kfs[ind],krevs[ind] = getkfkrev(d.phase.reactions[ind],d.phase,d.T,P,C,N,ns,Gs,d.diffusivity,d.V,0.0;f=kfs[ind])
12411242
end
1242-
return ns,cs,d.T,d.P,V,C,N,d.mu,kfs,krevs,Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
1243+
return ns,cs,d.T,P,d.V,C,N,d.mu,kfs,krevs,Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),Array{Float64,1}(),0.0,Array{Float64,1}(),0.0
12431244
end
12441245

12451246
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::J,t::Q,p::W2=SciMLBase.NullParameters()) where {W2,W<:IdealGas,Y<:Integer,J<:Union{ReverseDiff.TrackedArray,Tracker.TrackedArray},Q} #Autodiff p
12461247
ns = y[d.indexes[1]:d.indexes[2]]
12471248
P = y[d.indexes[3]]
1248-
N = P*d.V/(R*d.T)
1249+
N = P * d.V / (R * d.T)
12491250
cs = ns./d.V
12501251
C = N/d.V
12511252
kfs = similar(y,length(d.phase.reactions))
@@ -1267,7 +1268,7 @@ end
12671268
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::J,t::Q,p::W2=SciMLBase.NullParameters()) where {W2<:Union{ReverseDiff.TrackedArray,Tracker.TrackedArray},W<:IdealGas,Y<:Integer,J,Q} #Tracker/reversediff
12681269
ns = y[d.indexes[1]:d.indexes[2]]
12691270
P = y[d.indexes[3]]
1270-
N = P*d.V/(R*d.T)
1271+
N = P * d.V / (R * d.T)
12711272
cs = ns./d.V
12721273
C = N/d.V
12731274
if !d.alternativepformat
@@ -1284,7 +1285,7 @@ end
12841285
@inline function calcthermo(d::ConstantTVGasDomain{W,Y},y::J,t::Q,p::W2=SciMLBase.NullParameters()) where {W2<:Union{ReverseDiff.TrackedArray,Tracker.TrackedArray},W<:IdealGas,Y<:Integer,J<:Union{ReverseDiff.TrackedArray,Tracker.TrackedArray},Q} #Tracker/reversediff
12851286
ns = y[d.indexes[1]:d.indexes[2]]
12861287
P = y[d.indexes[3]]
1287-
N = P*d.V/(R*d.T)
1288+
N = P * d.V / (R * d.T)
12881289
cs = ns./d.V
12891290
C = N/d.V
12901291
if !d.alternativepformat
@@ -2138,6 +2139,44 @@ end
21382139
end
21392140
end
21402141

2142+
@inline function calcdomainderivatives!(d::Q, dydt::Z7, interfaces::Z12; t::Z10, T::Z4, P::Z9, Us::Array{Z,1}, Hs::Array{Z11,1}, V::Z2, C::Z3, ns::Z5, N::Z6, Cvave::Z8) where {Q<:ConstantTVGasDomain,Z12,Z11,Z10,Z9,Z8<:Real,Z7,W<:IdealGas,Y<:Integer,Z6,Z,Z2,Z3,Z4,Z5}
2143+
@views @fastmath @inbounds dydt[d.indexes[3]] = sum(dydt[d.indexes[1]:d.indexes[2]]) * R * T / V
2144+
for ind in d.constantspeciesinds #make dydt zero for constant species
2145+
@inbounds dydt[ind] = 0.0
2146+
end
2147+
for inter in interfaces
2148+
if isa(inter, Inlet) && d == inter.domain
2149+
dydt[d.indexes[1]:d.indexes[2]] .+= inter.y .* inter.F(t)
2150+
dydt[d.indexes[3]] += inter.F(t) * R * T / P
2151+
elseif isa(inter, Outlet) && d == inter.domain
2152+
dydt[d.indexes[1]:d.indexes[2]] .-= inter.F(t) .* ns ./ N
2153+
dydt[d.indexes[3]] -= inter.F(t) * R * T / P
2154+
elseif isa(inter, kLAkHCondensationEvaporationWithReservoir) && d == inter.domain
2155+
kLAs = map.(inter.kLAs, inter.T)
2156+
kHs = map.(inter.kHs, inter.T)
2157+
evap = kLAs .* inter.V .* inter.cs
2158+
cond = kLAs .* inter.V .* cs * R * T ./ kHs
2159+
net_evap = evap .- cond
2160+
dydt[d.indexes[1]:d.indexes[2]] .+= net_evap
2161+
dydt[d.indexes[3]] += sum(net_evap) * R * T / P
2162+
elseif isa(inter, VolumetricFlowRateInlet) && d == inter.domain
2163+
dydt[d.indexes[1]:d.indexes[2]] .+= inter.Vin(t) * inter.cs
2164+
dydt[d.indexes[3]] += inter.Vin(t)
2165+
elseif isa(inter, VolumetricFlowRateOutlet) && d == inter.domain
2166+
dydt[d.indexes[1]:d.indexes[2]] .-= inter.Vout(t) * ns / V
2167+
dydt[d.indexes[3]] -= inter.Vout(t)
2168+
end
2169+
end
2170+
for inter in interfaces
2171+
if isa(inter, VolumeMaintainingOutlet) && d == inter.domain #VolumeMaintainingOutlet has to be evaluated after dVdt has been modified by everything else
2172+
@inbounds dVdt = dydt[d.indexes[3]]
2173+
@inbounds flow = P * dVdt / (R * T)
2174+
@views @inbounds dydt[d.indexes[1]:d.indexes[2]] .-= flow * ns / N
2175+
@inbounds dydt[d.indexes[3]] -= dVdt
2176+
end
2177+
end
2178+
end
2179+
21412180
@inline function calcdomainderivatives!(d::ConstantVDomain{W,Y}, dydt::K, interfaces::Z12; t::Z10, T::Z4, P::Z9, Us::Z, Hs::Z11, V::Z2, C::Z3, ns::Z5, N::Z6, Cvave::Z7) where {Z12,Z11,Z10,Z9,W<:IdealGas,Z7,K,Y<:Integer,Z6,Z,Z2,Z3,Z4,Z5}
21422181
@views @fastmath @inbounds dydt[d.indexes[3]] = -dot(Us, dydt[d.indexes[1]:d.indexes[2]]) / (N * Cvave) #divide by V to cancel ωV to ω
21432182
@views @fastmath @inbounds dydt[d.indexes[4]] = sum(dydt[d.indexes[1]:d.indexes[2]]) * R * T / V + P / T * dydt[d.indexes[3]]
@@ -2441,6 +2480,8 @@ end
24412480
end
24422481
end
24432482

2483+
2484+
24442485
@inline function jacobiany!(jac::Q, y::U, p::W, t::Z, domain::D, interfaces::Q3, colorvec::Q2=nothing) where {Q3<:AbstractArray,Q2,Q<:AbstractArray,U<:AbstractArray,W,Z<:Real,D<:ConstantTPDomain}
24452486
ns, cs, T, P, V, C, N, mu, kfs, krevs, Hs, Us, Gs, diffs, Cvave, cpdivR = calcthermo(domain, y, t, p)
24462487
jacobianynsderiv!(jac, domain, domain.rxnarray, domain.efficiencyinds, cs, kfs, krevs, T, V, C)
@@ -2534,6 +2575,7 @@ end
25342575
end
25352576
end
25362577

2578+
25372579
@inline function jacobiany!(jac::Q, y::U, p::W, t::Z, domain::D, interfaces::Q3, colorvec::Q2=nothing) where {Q3<:AbstractArray,Q2,Q<:AbstractArray,U<:AbstractArray,W,Z<:Real,D<:ConstantVDomain}
25382580
ns, cs, T, P, V, C, N, mu, kfs, krevs, Hs, Us, Gs, diffs, Cvave, cpdivR = calcthermo(domain, y, t, p)
25392581
jacobianynsderiv!(jac, domain, domain.rxnarray, domain.efficiencyinds, cs, kfs, krevs, T, V, C)
@@ -2693,6 +2735,9 @@ end
26932735
return jac
26942736
end
26952737

2738+
2739+
2740+
26962741
@inline function jacobiany!(jac::Q, y::U, p::W, t::Z, domain::D, interfaces::Q3, colorvec::Q2=nothing) where {Q3<:AbstractArray,Q2,Q<:AbstractArray,U<:AbstractArray,W,Z<:Real,D<:ConstantPDomain}
26972742
ns, cs, T, P, V, C, N, mu, kfs, krevs, Hs, Us, Gs, diffs, Cvave, cpdivR = calcthermo(domain, y, t, p)
26982743
jacobianynsderiv!(jac, domain, domain.rxnarray, domain.efficiencyinds, cs, kfs, krevs, T, V, C)

src/Interface.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,15 @@ function getkLAkHs(vl::VaporLiquidMassTransferInternalInterfaceConstantT, Tgas,
403403
end
404404

405405
function evaluate(vl::VaporLiquidMassTransferInternalInterfaceConstantT, dydt, Vgas, Vliq, Tgas, Tliq, N1, N2, P1, P2, Cvave1, Cvave2, ns1, ns2, Us1, Us2, cstot, p)
406-
kLAs, kHs = getkLAkHs(vl, Tgas, Tliq)
407-
@views @inbounds @fastmath evap = kLAs * Vliq .* cstot[vl.domainliq.indexes[1]:vl.domainliq.indexes[2]] #evap_i = kLA_i * Vliq * cliq_i
408-
@views @inbounds @fastmath cond = kLAs * Vliq .* cstot[vl.domaingas.indexes[1]:vl.domaingas.indexes[2]] * R * Tgas ./ kHs #cond_i = kLA_i * Vliq * Pgas_i / kH_i, Pgas_i = cgas_i * R * Tgas
409-
netevap = (evap .- cond)
406+
kLAs, kHs = getkLAkHs(vl, vl.domaingas.T, vl.domainliq.T)
407+
@views @fastmath evap = kLAs * vl.domainliq.V .* cstot[vl.domainliq.indexes[1]:vl.domainliq.indexes[2]] #evap_i = kLA_i * Vliq * cliq_i
408+
@views @fastmath cond = kLAs * vl.domainliq.V .* cstot[vl.domaingas.indexes[1]:vl.domaingas.indexes[2]] * R * vl.domaingas.T ./ kHs #cond_i = kLA_i * Vliq * Pgas_i / kH_i, Pgas_i = cgas_i * R * Tgas
409+
net_evap = (evap .- cond)
410410
@simd for ind in vl.ignoremasstransferspcinds
411-
@inbounds netevap[ind] = 0.0
411+
net_evap[ind] = 0.0
412412
end
413-
@views @inbounds @fastmath dydt[vl.domaingas.indexes[1]:vl.domaingas.indexes[2]] .+= netevap
414-
@views @inbounds @fastmath dydt[vl.domainliq.indexes[1]:vl.domainliq.indexes[2]] .-= netevap
413+
@views @fastmath dydt[vl.domaingas.indexes[1]:vl.domaingas.indexes[2]] .+= net_evap
414+
@views @fastmath dydt[vl.domainliq.indexes[1]:vl.domainliq.indexes[2]] .-= net_evap
415415
end
416416
export evaluate
417417

src/Reactor.jl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,54 @@ end
13951395
end
13961396
end
13971397

1398+
1399+
@inline function _jacobianynswrtP!(jac::S, Pind::Int64, rxnarray::Array{Int64,2}, rxnind::Int64, cs::Array{Float64,1}, kf::Float64, krev::Float64) where {S<:AbstractArray}
1400+
k = kf
1401+
if rxnarray[2, rxnind] == 0
1402+
nothing
1403+
elseif rxnarray[3, rxnind] == 0
1404+
@inbounds @fastmath deriv = -k * cs[rxnarray[1, rxnind]] * cs[rxnarray[2, rxnind]]
1405+
@inbounds jac[rxnarray[1, rxnind], Pind] -= deriv
1406+
@inbounds jac[rxnarray[2, rxnind], Pind] -= deriv
1407+
_spreadreactantpartials!(jac, deriv, rxnarray, rxnind, Pind)
1408+
elseif rxnarray[4, rxnind] == 0
1409+
@inbounds @fastmath deriv = -2.0 * k * cs[rxnarray[1, rxnind]] * cs[rxnarray[2, rxnind]] * cs[rxnarray[3, rxnind]]
1410+
@inbounds jac[rxnarray[1, rxnind], Pind] -= deriv
1411+
@inbounds jac[rxnarray[2, rxnind], Pind] -= deriv
1412+
@inbounds jac[rxnarray[3, rxnind], Pind] -= deriv
1413+
_spreadreactantpartials!(jac, deriv, rxnarray, rxnind, Pind)
1414+
else
1415+
@inbounds @fastmath deriv = -3.0 * k * cs[rxnarray[1, rxnind]] * cs[rxnarray[2, rxnind]] * cs[rxnarray[3, rxnind]] * cs[rxnarray[4, rxnind]]
1416+
@inbounds jac[rxnarray[1, rxnind], Pind] -= deriv
1417+
@inbounds jac[rxnarray[2, rxnind], Pind] -= deriv
1418+
@inbounds jac[rxnarray[3, rxnind], Pind] -= deriv
1419+
@inbounds jac[rxnarray[4, rxnind], Pind] -= deriv
1420+
_spreadreactantpartials!(jac, deriv, rxnarray, rxnind, Pind)
1421+
end
1422+
k = krev
1423+
if rxnarray[6, rxnind] == 0
1424+
nothing
1425+
elseif rxnarray[7, rxnind] == 0
1426+
@inbounds @fastmath deriv = -k * cs[rxnarray[5, rxnind]] * cs[rxnarray[6, rxnind]]
1427+
@inbounds jac[rxnarray[5, rxnind], Pind] -= deriv
1428+
@inbounds jac[rxnarray[6, rxnind], Pind] -= deriv
1429+
_spreadproductpartials!(jac, deriv, rxnarray, rxnind, Pind)
1430+
elseif rxnarray[8, rxnind] == 0
1431+
@inbounds @fastmath deriv = -2.0 * k * cs[rxnarray[5, rxnind]] * cs[rxnarray[6, rxnind]] * cs[rxnarray[7, rxnind]]
1432+
@inbounds jac[rxnarray[5, rxnind], Pind] -= deriv
1433+
@inbounds jac[rxnarray[6, rxnind], Pind] -= deriv
1434+
@inbounds jac[rxnarray[7, rxnind], Pind] -= deriv
1435+
_spreadproductpartials!(jac, deriv, rxnarray, rxnind, Pind)
1436+
else
1437+
@inbounds @fastmath deriv = -3.0 * k * cs[rxnarray[5, rxnind]] * cs[rxnarray[6, rxnind]] * cs[rxnarray[7, rxnind]] * cs[rxnarray[8, rxnind]]
1438+
@inbounds jac[rxnarray[5, rxnind], Pind] -= deriv
1439+
@inbounds jac[rxnarray[6, rxnind], Pind] -= deriv
1440+
@inbounds jac[rxnarray[7, rxnind], Pind] -= deriv
1441+
@inbounds jac[rxnarray[8, rxnind], Pind] -= deriv
1442+
_spreadproductpartials!(jac, deriv, rxnarray, rxnind, Pind)
1443+
end
1444+
end
1445+
13981446
"""
13991447
This function calculates the ns partials in jacobiany involving k derivatives. dkdx is either dkdni and dkdV. x is either ni or V.
14001448
"""

src/Simulation.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,24 @@ end
203203

204204
export concentrations
205205

206-
getT(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantTPDomain,ConstantTVDomain,FragmentBasedConstantTrhoDomain},K<:Real,Q,G,L} = bsol.domain.T
206+
getT(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantTPDomain,ConstantTVDomain,ConstantTVGasDomain,FragmentBasedConstantTrhoDomain},K<:Real,Q,G,L} = bsol.domain.T
207207
getT(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantVDomain,ParametrizedVDomain,ConstantPDomain,ParametrizedPDomain},K<:Real,Q,G,L} = bsol.sol(t)[bsol.domain.indexes[3]]
208208
getT(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ParametrizedTConstantVDomain,ParametrizedTPDomain},K<:Real,Q,G,L} = bsol.domain.T(t)
209209
export getT
210-
getV(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantVDomain,ConstantTVDomain,ParametrizedTConstantVDomain},K<:Real,Q,G,L} = bsol.domain.V
210+
getV(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantVDomain,ConstantTVDomain,ConstantTVGasDomain,ParametrizedTConstantVDomain},K<:Real,Q,G,L} = bsol.domain.V
211211
getV(bsol::Simulation{Q,W,L,G}, t::K) where {W<:ParametrizedVDomain,K<:Real,Q,G,L} = bsol.domain.V(t)
212212
getV(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantTPDomain,ParametrizedTPDomain},K<:Real,Q,G,L} = bsol.sol(t)[bsol.domain.indexes[3]]
213213
getV(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ParametrizedPDomain,ConstantPDomain},K<:Real,Q,G,L} = bsol.sol(t)[bsol.domain.indexes[4]]
214214
getV(bsol::Simulation{Q,W,L,G}, t::K) where {W<:FragmentBasedConstantTrhoDomain,K<:Real,Q,G,L} = bsol.sol(t)[bsol.domain.indexes[3]] / bsol.domain.rho
215215
export getV
216216
getP(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantTPDomain,ConstantPDomain},K<:Real,Q,G,L} = bsol.domain.P
217217
getP(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantTVDomain,ParametrizedTConstantVDomain,FragmentBasedConstantTrhoDomain},K<:Real,Q,G,L} = 1.0e6
218+
getP(bsol::Simulation{Q,W,L,G}, t::K) where {W<:ConstantTVGasDomain,K<:Real,Q,G,L} = bsol.sol(t)[bsol.domain.indexes[3]]
218219
getP(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ParametrizedTPDomain,ParametrizedPDomain},K<:Real,Q,G,L} = bsol.domain.P(t)
219220
getP(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantVDomain,ParametrizedVDomain},K<:Real,Q,G,L} = bsol.sol(t)[bsol.domain.indexes[4]]
220221
export getP
221222
getC(bsol::Simulation{Q,W,L,G}, t::K) where {W<:ConstantTPDomain,K<:Real,Q,G,L} = bsol.domain.P / (R * bsol.domain.T)
222-
getC(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantVDomain,ConstantTVDomain,ParametrizedTConstantVDomain},K<:Real,Q,G,L} = bsol.N(t) / bsol.domain.V
223+
getC(bsol::Simulation{Q,W,L,G}, t::K) where {W<:Union{ConstantVDomain,ConstantTVDomain,ConstantTVGasDomain,ParametrizedTConstantVDomain},K<:Real,Q,G,L} = bsol.N(t) / bsol.domain.V
223224
getC(bsol::Simulation{Q,W,L,G}, t::K) where {W<:FragmentBasedConstantTrhoDomain,K<:Real,Q,G,L} = bsol.N(t) / getV(bsol, t)
224225
getC(bsol::Simulation{Q,W,L,G}, t::K) where {W<:ParametrizedVDomain,K<:Real,Q,G,L} = bsol.N(t) / bsol.domain.V(t)
225226
getC(bsol::Simulation{Q,W,L,G}, t::K) where {W<:ParametrizedTPDomain,K<:Real,Q,G,L} = bsol.domain.P(t) / (R * bsol.domain.T(t))

0 commit comments

Comments
 (0)