def calculateTimeSteppingCoeffs(self, s): Inv_c = s["cosmogenic inventory"] # initialize (first time step) or read in coefficients if s["age"] == self.timestep: s["psi_spallation_coeff"] = 0.0 s["slowMuonContrib"] = 0.0 s["fastMuonContrib"] = 0.0 # Initial RHS_1 == Inv_c (or Inv_m - Inv_r) s["RHS_1"] = Inv_c # Set the decay time for the current nuclide self.LAMBDA_36 = Nuclide.decay[self.experiment['nuclide']] exp1 = math.exp(-(self.LAMBDA_36) * s["age"]) #Stable isotopes have no exponential decreasing effect if Nuclide.stable(self.experiment['nuclide']): exp1 = 1.0 mul0 = -1.0 * self.LAMBDA_36 * self.timestep min0 = 1.0 - math.exp(mul0) #Stable isotopes have no exponential decreasing effect if Nuclide.stable(self.experiment['nuclide']): div1 = self.timestep mul1 = self.S_el * self.timestep * exp1 else: div1 = min0 / self.LAMBDA_36 mul1 = self.S_el * div1 * exp1 mul2 = self.shielding_factor * self.Q_s s["psi_spallation_coeff"] += mul1 * mul2 s["slowMuonContrib"] += self.S_mu * div1 * exp1 * self.Q_mu * self.Pmu_slow * self.shielding_factor s["fastMuonContrib"] += self.S_mu * div1 * exp1 * self.Q_mu * self.Pmu_fast * self.shielding_factor # Calculate RHS below. Note that this is really # RHS = InvC - muonContrib # As it appears in the time averaing procedure (OutputFor36clCalibration) # but from time step to time step it takes away the individual contribution from # that time step # print s["RHS_1"] # print self.Pmu_0 s["RHS_1"] -= self.S_mu * div1 * exp1 * self.Q_mu * self.Pmu_slow * self.shielding_factor s["RHS_1"] -= self.S_mu_fast * div1 * exp1 * self.Q_mu * self.Pmu_fast * self.shielding_factor
def calculate_age(self, s): #print #print "Entering calculate_age" #print " age : " + str(s["age"]) #print " Inv_c_mod: " + str(s["Inv_c_mod"]) #print # calculate how much the inventory has changed over the timestep # also wind the age back timestep years (10) # Set the decay time for the current nuclide self.LAMBDA_36 = Nuclide.decay[self.experiment['nuclide']] prod0 = -1.0 * self.LAMBDA_36 * self.timestep minu0 = 1.0 - math.exp(prod0) #Stable isotopes have no exponential decreasing effect if Nuclide.stable(self.experiment['nuclide']): divi1 = self.timestep else: divi1 = minu0 / self.LAMBDA_36 prod1 = s["P_total"] * divi1 #prod1 = s["P_total"] * self.timestep prod2 = -1.0 * self.LAMBDA_36 * s["age"] prod3 = math.exp(prod2) prod4 = prod3 * prod1 #Stable isotopes have no exponential decreasing effect if Nuclide.stable(self.experiment['nuclide']): prod4 = prod1 s["Inv_c_mod"] -= prod4 prod5 = s["P_total_uncertainty"] * self.timestep prod6 = prod3 * prod5 #Stable isotopes have no exponential decreasing effect if Nuclide.stable(self.experiment['nuclide']): prod6 = prod5 s["Inv_c_uncertainty"] += prod6
def calculatePinv(self, s): self.LAMBDA_36 = Nuclide.decay[self.experiment["nuclide"]] # calculate time invariant production rate prod0 = -1.0 * self.LAMBDA_36 * s["age"] denom = 1.0 - math.exp(prod0) num = s["cosmogenic inventory"] * self.LAMBDA_36 # Stable isotopes have no exponential decreasing effect if Nuclide.stable(self.experiment["nuclide"]): num = s["cosmogenic inventory"] denom = s["age"] s["production rate invariant"] = num / denom