Skip to content
Snippets Groups Projects
Commit e57cb46b authored by MALOU THIBAULT's avatar MALOU THIBAULT
Browse files

improve the update of the source term in the convection diffusion model solver

parent 296bff91
No related branches found
No related tags found
No related merge requests found
...@@ -63,9 +63,10 @@ class DiffusionConvectionReaction2DEquation: ...@@ -63,9 +63,10 @@ class DiffusionConvectionReaction2DEquation:
""" """
# To do: # To do:
# add exceptions in case # - add exceptions in case
# the inv_matrix_implicit_part is not initialized # the inv_matrix_implicit_part is not initialized
# but should have been # but should have been
# - add exceptions to check inputs of __init__
def __init__(self, U, K, coeff_depot, S, msh, time_discretization='semi-implicit', tol_inversion=1e-14): def __init__(self, U, K, coeff_depot, S, msh, time_discretization='semi-implicit', tol_inversion=1e-14):
r""" r"""
...@@ -194,7 +195,7 @@ class DiffusionConvectionReaction2DEquation: ...@@ -194,7 +195,7 @@ class DiffusionConvectionReaction2DEquation:
The associated time array. `None` if the source is stationary. The associated time array. `None` if the source is stationary.
""" """
setattr(self, 'S', Source(self.msh, value, t=t)) self.S = Source(self.msh, value, t=t)
def at_current_time(self, tc): def at_current_time(self, tc):
r""" r"""
...@@ -284,7 +285,7 @@ class DiffusionConvectionReaction2DEquation: ...@@ -284,7 +285,7 @@ class DiffusionConvectionReaction2DEquation:
self.Id + self.msh.dt * (-self.D + self.R + self.A), self.Id + self.msh.dt * (-self.D + self.R + self.A),
c_old + self.msh.dt * self.S.value.ravel(), c_old + self.msh.dt * self.S.value.ravel(),
x0=c_old, x0=c_old,
tol=self.tol_inversion, rtol=self.tol_inversion,
) )
# inverse the linear system resulting the implicit time discretization # inverse the linear system resulting the implicit time discretization
# using the pre-computed inverse matrix # using the pre-computed inverse matrix
...@@ -372,7 +373,7 @@ class DiffusionConvectionReaction2DEquation: ...@@ -372,7 +373,7 @@ class DiffusionConvectionReaction2DEquation:
self.Id + self.msh.dt * (-self.D + self.R + self.A), self.Id + self.msh.dt * (-self.D + self.R + self.A),
c_old + self.msh.dt * self.S.value.ravel(), c_old + self.msh.dt * self.S.value.ravel(),
x0=c_old, x0=c_old,
tol=self.tol_inversion, rtol=self.tol_inversion,
) )
# inverse the linear system resulting the implicit time discretization # inverse the linear system resulting the implicit time discretization
# using the pre-computed inverse matrix # using the pre-computed inverse matrix
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment