Skip to content

Commit

Permalink
Add mass to rop calc for film domain
Browse files Browse the repository at this point in the history
  • Loading branch information
hwpang committed Aug 9, 2023
1 parent 8ed2426 commit 4d455a1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function rops(ssys::SystemSimulation, t)
for inter in ssys.interfaces
if inter isa FragmentBasedReactiveFilmGrowthInterfaceConstantT
kfs, krevs = getkfskrevs(inter)
rops!(ropmat, inter.rxnarray, inter.fragmentbasedrxnarray, cstot, kfs, krevs, vV[inter.domaininds[1]], start)
rops!(ropmat, inter.rxnarray, inter.fragmentbasedrxnarray, cstot, kfs, krevs, vV[inter.domaininds[1]], inter.Mws, inter.domainfilm.indexes[1]:inter.domainfilm.indexes[2], inter.domainfilm.indexes[3], start)

Check warning on line 289 in src/Simulation.jl

View check run for this annotation

Codecov / codecov/patch

src/Simulation.jl#L289

Added line #L289 was not covered by tests
start += length(kfs)
elseif hasproperty(inter, :reactions)
kfs, krevs = getkfskrevs(inter, vT[inter.domaininds[1]], vT[inter.domaininds[2]], vphi[inter.domaininds[1]], vphi[inter.domaininds[2]], vGs[inter.domaininds[1]], vGs[inter.domaininds[2]], cstot)
Expand Down Expand Up @@ -423,21 +423,27 @@ function rops!(ropvec, rarray::Array{Int64,2}, cs, kfs, krevs, V, start, ind)
end


function rops!(ropmat, rarray::Array{Int64,2}, fragmentbasedrxnarray::Array{Int64,2}, cs, kfs, krevs, V, start)
function rops!(ropmat, rarray::Array{Int64,2}, fragmentbasedrxnarray::Array{Int64,2}, cs, kfs, krevs, V, Mws, fragmentindexes, massindex, start)

Check warning on line 426 in src/Simulation.jl

View check run for this annotation

Codecov / codecov/patch

src/Simulation.jl#L426

Added line #L426 was not covered by tests
numfragmentbasedreacprod, numrxns = size(fragmentbasedrxnarray)
half = Int(numfragmentbasedreacprod / 2)
for i = 1:length(kfs)
R = getrate(rarray, cs, kfs, krevs, V, i)

for j = 1:half
if fragmentbasedrxnarray[j, i] != 0
@fastmath ropmat[fragmentbasedrxnarray[j, i]] -= R
@fastmath ropmat[i+start, fragmentbasedrxnarray[j, i]] -= R
if !(fragmentbasedrxnarray[j, i] in fragmentindexes)
ropmat[i+start, massindex] += R * Mws[fragmentbasedrxnarray[j, i]]

Check warning on line 436 in src/Simulation.jl

View check run for this annotation

Codecov / codecov/patch

src/Simulation.jl#L434-L436

Added lines #L434 - L436 were not covered by tests
end
end
end

for j = half+1:numfragmentbasedreacprod
if fragmentbasedrxnarray[j, i] != 0
@fastmath ropmat[fragmentbasedrxnarray[j, i]] += R
@fastmath ropmat[i+start, fragmentbasedrxnarray[j, i]] += R
if !(fragmentbasedrxnarray[j, i] in fragmentindexes)
ropmat[i+start, massindex] -= R * Mws[fragmentbasedrxnarray[j, i]]

Check warning on line 445 in src/Simulation.jl

View check run for this annotation

Codecov / codecov/patch

src/Simulation.jl#L443-L445

Added lines #L443 - L445 were not covered by tests
end
end
end
end
Expand Down

0 comments on commit 4d455a1

Please sign in to comment.