Skip to content

Commit 920c090

Browse files
committed
ensure coverage dependent indices get assigned for interface reactions
1 parent c9775b8 commit 920c090

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/Interface.jl

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct ReactiveInternalInterface{T,B,C,C2,N,Q<:AbstractReaction,X} <: AbstractRe
3535
forwardability::Array{Bool,1}
3636
end
3737
function ReactiveInternalInterface(domain1, domain2, reactions, A)
38+
reactions = upgradekinetics(reactions, domain1, domain2)
3839
vectuple, vecinds, otherrxns, otherrxninds, posinds = getveckinetics(reactions)
3940
rxns = vcat(reactions[vecinds], reactions[otherrxninds])
4041
rxns = [ElementaryReaction(index=i, reactants=rxn.reactants, reactantinds=rxn.reactantinds, products=rxn.products,
@@ -269,6 +270,31 @@ function upgradekinetics(rxns, domain1, domain2)
269270
end
270271
newrxns = Array{ElementaryReaction,1}(undef, length(rxns))
271272
for (i, rxn) in enumerate(rxns)
273+
if hasproperty(rxn.kinetics,:covdep) && !(rxn.kinetics.covdep isa EmptyRateCoverageDependence)
274+
if domain1.phase isa IdealSurface && !(domain2.phase isa IdealSurface)
275+
names = getfield.(domain1.phase.species,:name)
276+
elseif domain2.phase isa IdealSurface && !(domain1.phase isa IdealSurface)
277+
names = getfield.(domain2.phase.species,:name)
278+
else
279+
throw(DomainError(rxn.kinetics.covdep,"Unsure which surface domain should be used for coverage dependence"))
280+
end
281+
if rxn.kinetics.covdep isa PolynomialRateCoverageDependence
282+
for (name,v) in rxn.kinetics.covdep.Epolys
283+
ind = findfirst(isequal(name),names)
284+
rxn.kinetics.covdep.indEpolys[ind] = v
285+
end
286+
for (name,v) in rxn.kinetics.covdep.avals
287+
ind = findfirst(isequal(name),names)
288+
rxn.kinetics.covdep.indavals[ind] = v
289+
end
290+
for (name,v) in rxn.kinetics.covdep.ms
291+
ind = findfirst(isequal(name),names)
292+
rxn.kinetics.covdep.indms[ind] = v
293+
end
294+
else
295+
throw(TypeError(rxn.kinetics.covdep,"Kinetic Coverage Dependence Type Not Understood"))
296+
end
297+
end
272298
if isa(rxn.kinetics, StickingCoefficient)
273299
spc = [spc for spc in rxn.reactants if !(spc in surfdomain.phase.species)]
274300
@assert length(spc) == 1
@@ -293,7 +319,7 @@ function stickingcoefficient2arrhenius(sc, sitedensity, N, mw; Tmin=300.0, Tmax=
293319
@assert fit.converged
294320
p = fit.param
295321
p[1] = abs(p[1])
296-
return Arrhenius(; A=p[1], n=p[2], Ea=p[3])
322+
return Arrhenius(; A=p[1], n=p[2], Ea=p[3], covdep=sc.covdep)
297323
end
298324

299325
struct Inlet{Q<:Real,S,V<:AbstractArray,U<:Real,X<:Real,FF<:Function} <: AbstractBoundaryInterface

0 commit comments

Comments
 (0)