From f17f199b804182d4ff9a9f88b99608e44c5dc119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Mart=C3=ADnez?= Date: Fri, 20 Mar 2026 14:41:59 +0100 Subject: [PATCH] Fix initial assembly for nonlinear models Use 1.0 instead of 0.0 as the time parameter when instantiating algebraic operators for static and dynamic nonlinear models to ensure correct initial assembly. --- src/ComputationalModels/Drivers.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ComputationalModels/Drivers.jl b/src/ComputationalModels/Drivers.jl index 667901f..024431b 100644 --- a/src/ComputationalModels/Drivers.jl +++ b/src/ComputationalModels/Drivers.jl @@ -101,8 +101,8 @@ struct StaticNonlinearModel{A,B,C,D,E} <: ComputationalModel x = get_free_dof_values(xh) x⁻ = get_free_dof_values(xh⁻) # x⁻ = zero_free_values(U) - _res = res(0.0) - _jac = jac(0.0) + _res = res(1.0) + _jac = jac(1.0) op = get_algebraic_operator(FEOperator(_res, _jac, U, V, assem_U)) nls_cache = instantiate_caches(x, nls, op) caches = (nls, nls_cache, x, x⁻, assem_U) @@ -265,8 +265,8 @@ struct DynamicNonlinearModel{A,B,C,D,E,F} <: ComputationalModel x⁻ = zero_free_values(Uold) uh⁻ = FEFunction(Uold, x⁻) vuh = velocity() - _res = res(0.0, uh⁻, vuh) - _jac = jac(0.0, uh⁻, vuh) + _res = res(1.0, uh⁻, vuh) + _jac = jac(1.0, uh⁻, vuh) op = get_algebraic_operator(FEOperator(_res, _jac, U, V, assem_U)) nls_cache = instantiate_caches(x, nls, op) caches = (nls, nls_cache, x, x⁻, assem_U, uh⁻)