Skip to content

Commit

Permalink
Fix parameter assembly bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Mar 2, 2024
1 parent bd61485 commit 5dbd9ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
11 changes: 3 additions & 8 deletions examples/Example430_ParameterDerivativesStationary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,9 @@ end
using Test
function runtests()
testval = 489.3432830184927
xf = runf()
xg = rung()
xh = runh()
# xg2 = rung(; factorization = :ilu0, iteration = :cg)
@test xf testval &&
xg testval &&
# xg2 ≈ testval &&
xh testval
@test runf() testval
@test rung() testval
@test runh() testval
end

end
27 changes: 13 additions & 14 deletions src/vfvm_assemblydata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ Assemble residual and jacobian for node functions. Parameters:
asm_jac(idof, jdof, ispec, jspec)
end
end
end
for iparam = 1:(system.num_parameters)
asm_param(idof, ispec, iparam)
for iparam = 1:(system.num_parameters)
asm_param(idof, ispec, iparam)
end
end
end
end
Expand Down Expand Up @@ -282,11 +282,11 @@ See [`assemble_res_jac`](@ref) for more explanations.
if isnodespecies(system, jspec, K)
asm_jac(idof, jdof, ispec, jspec)
end
for iparam = 1:(system.num_parameters)
asm_param(idof, ispec, iparam)
end
end
end
for iparam = 1:(system.num_parameters)
asm_param(idof, ispec, iparam)
end
end
end

Expand Down Expand Up @@ -329,7 +329,7 @@ $(SIGNATURES)
Assemble residual and jacobian for edge (flux) functions. Parameters:
- `system`: System to be worked with
- `node`: node
- `edge`: edge
- `asm_res(idofK,idofL,ispec)`: e.g. assemble local ispec to global degrees of freedom in unknowns
- `asm_jac(idofK,jdofK,idofL,jdofL,ispec,jspec)`: e.g. assemble entry `ispec,jspec` of local jacobian into entry four entries defined by `idofK` and `idofL` of global matrix
- `asm_param(idofK,idofL,ispec,iparam)` shall assemble parameter derivatives
Expand All @@ -344,7 +344,6 @@ Assemble residual and jacobian for edge (flux) functions. Parameters:
K = edge.node[1]
L = edge.node[2]
ireg = edge.region

for idofK = firstnodedof(system, K):lastnodedof(system, K)
ispec = getspecies(system, idofK)
if isregionspecies(system, ispec, ireg)
Expand All @@ -360,12 +359,12 @@ Assemble residual and jacobian for edge (flux) functions. Parameters:
end
end
end
for iparam = 1:(system.num_parameters)
asm_param(idofK, idofL, ispec, iparam)
end
end
end

for iparam = 1:(system.num_parameters)
asm_param(idofK, idofL, ispec, iparam)
end
end
end

Expand Down Expand Up @@ -422,13 +421,13 @@ See [`assemble_res_jac`](@ref) for more explanations.
end
end
end
for iparam = 1:(system.num_parameters)
asm_param(idofK, idofL, ispec, iparam)
end
end
end
end

for iparam = 1:(system.num_parameters)
asm_param(idofK, idofL, ispec, iparam)
end
end

"""
Expand Down

0 comments on commit 5dbd9ab

Please sign in to comment.