Skip to content

Commit 348122c

Browse files
hwpangmjohnson541
authored andcommitted
Incorporate forwardable and reversible in rate calculations
1 parent d5e344d commit 348122c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/PhaseState.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,27 +217,25 @@ Maintains diffusion limitations if the phase has diffusionlimited=true
217217
end
218218
end
219219
end
220-
if rxn.reversible
221-
return (kf,krev)
222-
else
223-
return (kf,0.0)
224-
end
220+
kf *= rxn.forwardable
221+
krev *= rxn.reversible
222+
return (kf,krev)
225223
end
226224
export getkfkrev
227225

228226
@inline function getkfkrevs(phase::U,T::W1,P::W2,C::W3,N::W4,ns::Q1,Gs::Q2,diffs::Q3,V::W5,phi::W7;kfs::W6=nothing) where {U,W7,W6,W5<:Real,W1<:Real,W2<:Real,W3,W4,Q1<:AbstractArray,Q2,Q3<:AbstractArray}
229227
if !phase.diffusionlimited && kfs === nothing
230228
kfs = getkfs(phase,T,P,C,ns,V,phi)
231229
if phi == 0.0
232-
krev = @fastmath kfs./getKcs(phase,T,Gs).*phase.reversibility
230+
krev = @fastmath kfs./getKcs(phase,T,Gs)
233231
else
234-
krev = @fastmath kfs./getKcs(phase,T,Gs,phi).*phase.reversibility
232+
krev = @fastmath kfs./getKcs(phase,T,Gs,phi)
235233
end
236234
elseif !phase.diffusionlimited && !(kfs === nothing)
237235
if phi == 0.0
238-
krev = @fastmath kfs./getKcs(phase,T,Gs).*phase.reversibility
236+
krev = @fastmath kfs./getKcs(phase,T,Gs)
239237
else
240-
krev = @fastmath kfs./getKcs(phase,T,Gs,phi).*phase.reversibility
238+
krev = @fastmath kfs./getKcs(phase,T,Gs,phi)
241239
end
242240
elseif phase.diffusionlimited && !(kfs === nothing)
243241
len = length(phase.reactions)
@@ -253,6 +251,8 @@ export getkfkrev
253251
@fastmath @inbounds kfs[i],krev[i] = getkfkrev(phase.reactions[i],phase,T,P,C,N,ns,Gs,diffs,V,phi)
254252
end
255253
end
254+
kfs .*= phase.forwardability
255+
krev .*= phase.reversibility
256256
return kfs,krev
257257
end
258258

@@ -317,6 +317,8 @@ end
317317
@fastmath @inbounds kfs[i],krev[i] = getkfkrev(phase.reactions[i],phase,T,P,C,N,ns,Gs,diffs,V,phi)
318318
end
319319
end
320+
kfs .*= phase.forwardability
321+
krev .*= phase.reversibility
320322
return kfs,krev
321323
end
322324

0 commit comments

Comments
 (0)