Skip to content

Commit c58037a

Browse files
committed
use deadend radical algorithm to identify objects
1 parent 1a761f0 commit c58037a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/EdgeAnalysis.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ function identifyobjects!(sim,corespcsinds,corerxninds,edgespcsinds,
689689
return (false,true,0.0)
690690
end
691691

692+
if deadendradicaltolerance != 0.0 && !firsttime
693+
radconstermratios = calcradconstermratios(sim,reactantinds,productinds,corespcsinds,corerxninds,edgerxninds,edgereactionrates,corespeciesnetconsumptionrates,coreradicalnetterminationrates)
694+
end
695+
692696
if branchfactor != 0.0 && !firsttime
693697
branchingnums = calcbranchingnumbers(sim,reactantinds,productinds,corespcsinds,corerxninds,edgerxninds,edgereactionrates,
694698
corespeciesrateratios,corespeciesconsumptionrates,branchfactor,branchingratiomax,branchingindex)
@@ -771,6 +775,38 @@ function identifyobjects!(sim,corespcsinds,corerxninds,edgespcsinds,
771775
tempnewobjecttype = []
772776
end
773777

778+
# dead-end radical species selection algorithm should be evaluated before branching algorithm as
779+
# branching algorithm tends to pick up propagation reactions first, and if these propagation reactions are added
780+
# into the core for many iterations in a row, it can create dead-end radicals
781+
if deadendradicaltolerance != 0.0 && !firsttime
782+
for (i,ind) in enumerate(edgerxninds)
783+
drr = radconstermratios[i]
784+
if drr > deadendradicaltolerance
785+
obj = sim.reactions[ind]
786+
if !(obj in newobjects || obj in invalidobjects)
787+
push!(tempnewobjects,obj)
788+
push!(tempnewobjectinds,ind)
789+
push!(tempnewobjectvals,drr)
790+
push!(tempnewobjecttype,"deadendradical")
791+
end
792+
end
793+
end
794+
795+
sortedinds = reverse(sortperm(tempnewobjectvals))
796+
797+
for q in sortedinds
798+
push!(newobjects,tempnewobjects[q])
799+
push!(newobjectinds,tempnewobjectinds[q])
800+
push!(newobjectvals,tempnewobjectvals[q])
801+
push!(newobjecttype,tempnewobjecttype[q])
802+
end
803+
804+
tempnewobjects = []
805+
tempnewobjectinds = Array{Int64,1}()
806+
tempnewobjectvals = Array{Float64,1}()
807+
tempnewobjecttype = []
808+
end
809+
774810
if !ignoreoverallfluxcriterion #radical rate ratios
775811
for (i,ind) in enumerate(edgerxninds)
776812
rr = edgerxnradrateratios[i]
@@ -902,6 +938,9 @@ function identifyobjects!(sim,corespcsinds,corerxninds,edgespcsinds,
902938
@inbounds spcname = transitoryoutdict[ind]
903939
@inbounds tol = transitorydict[spcname]
904940
@info "at time $t sec, reaction $rstr at a normalized transitory sensitivity from $spcname of $sens exceeded the threshold of $tol for moving to model core"
941+
elseif newobjecttype[i] == "deadendradical"
942+
tol = deadendradicaltolerance
943+
@info "at time $t sec, reaction $rstr at a net radical consumption/termination ratio of $val exceeded the threshold of $tol for moving to model core"
905944
end
906945
end
907946
end

0 commit comments

Comments
 (0)