Skip to content

Commit

Permalink
added Carbon Sequestration (CS) to DMR
Browse files Browse the repository at this point in the history
  • Loading branch information
goujou committed Aug 6, 2021
1 parent ec667af commit b1a9492
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/CompartmentalSystems/discrete_model_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def reconstruct_B(cls, x, F, R):
if x[j] != 0:
B[j, j] = 1 - (sum(B[:, j]) - B[j, j] + R[j] / x[j])
if B[j, j] < 0:
if np.abs(B[j, j]) < 1e-08:
if np.abs(B[j, j]) < 1e-03: # TODO: arbitrary value
B[j, j] = 0
else:
pass
Expand Down Expand Up @@ -1245,6 +1245,10 @@ def backward_transit_time_quantiles(self, q, P0):

return res * self.dt

def CS(self, k0, n):
Phi = self._state_transition_operator_matrix
return sum([(Phi(n, k) @ self.net_Us[k]).sum() for k in range(k0, n+1, 1)])

# # return value in unit "time steps x dt[0]"
# def backward_transit_time_quantiles_from_masses(self, q, start_age_masses_at_age_bin):
# R = self.acc_net_external_output_vector()
Expand Down

0 comments on commit b1a9492

Please sign in to comment.