|
14 | 14 | # permissions and limitations under the License.
|
15 | 15 | ########################################################################
|
16 | 16 | """
|
17 |
| -date: 2022-03-16 |
| 17 | +date: 2022-12-19 |
18 | 18 | author: matz
|
19 | 19 | Generate power distributions in assembly components based on neutron
|
20 | 20 | flux; object to assign to individual assemblies
|
@@ -1508,82 +1508,33 @@ def _integrate(pp_pins, pp_duct, pp_cool, n_terms):
|
1508 | 1508 | return avg_power[:, 1] - avg_power[:, 0]
|
1509 | 1509 |
|
1510 | 1510 |
|
1511 |
| -######################################################################## |
| 1511 | +def _integrate_pin_power(asm_power): |
| 1512 | + """Integrate the pin power distributions |
1512 | 1513 |
|
1513 |
| - # def renormalize(self, z, dz): |
1514 |
| - # """Need to normalize the power based on the discretization that |
1515 |
| - # DASSH will make during the sweep in order to accurately deliver |
1516 |
| - # the correct power |
1517 |
| - # |
1518 |
| - # Parameters |
1519 |
| - # ---------- |
1520 |
| - # z : numpy.ndarray |
1521 |
| - # Absolute axial points (m) |
1522 |
| - # dz : numpy.ndarray |
1523 |
| - # Mesh step sizes (m) |
1524 |
| - # |
1525 |
| - # Returns |
1526 |
| - # ------- |
1527 |
| - # numpy.ndarray |
1528 |
| - # Array of correction factors for each fine mesh interval |
1529 |
| - # |
1530 |
| - # """ |
1531 |
| - # # Preprocess the axial mesh points |
1532 |
| - # z = z[1:] * 100 # m --> cm |
1533 |
| - # z = z - 0.5 * dz # get the axial mesh midpoints |
1534 |
| - # # Get the fine mesh intervals and the transformed z values for |
1535 |
| - # # each of the axial mesh points where power is evaluated. |
1536 |
| - # # kf = get_kfint2(self, z) |
1537 |
| - # # zm = transform_z2(self, kf, z) |
1538 |
| - # kf = self.get_kfint2(z) |
1539 |
| - # zm = self.transform_z2(kf, z) |
1540 |
| - # zm = np.expand_dims(zm, 1) |
1541 |
| - # |
1542 |
| - # # Raise those transformed z values to the monomial exponent |
1543 |
| - # z_exp = np.power(zm, np.arange(self.n_terms)) |
1544 |
| - # z_exp = np.expand_dims(z_exp, 1) |
1545 |
| - # |
1546 |
| - # # Multiply the coefficients through and sum to get the total |
1547 |
| - # # power in each axial step: do this for pins, duct, and coolant |
1548 |
| - # mult_terms = self.pin_power[kf] * z_exp |
1549 |
| - # sum_terms = np.sum(mult_terms, axis=(1, 2)) |
1550 |
| - # mult_terms = self.duct_power[kf] * z_exp |
1551 |
| - # sum_terms += np.sum(mult_terms, axis=(1, 2)) |
1552 |
| - # mult_terms = self.coolant_power[kf] * z_exp |
1553 |
| - # sum_terms += np.sum(mult_terms, axis=(1, 2)) |
1554 |
| - # |
1555 |
| - # # Dimension is equal to n_step x 1; equals total in each step |
1556 |
| - # sum_terms = sum_terms * 100 # W/cm --> W/m |
1557 |
| - # |
1558 |
| - # # Normalize each step linear power by step size |
1559 |
| - # dz_fint = self.z_finemesh[1:] - self.z_finemesh[:-1] |
1560 |
| - # dz_fint = dz_fint[kf] # cm |
1561 |
| - # sum_terms = sum_terms * dz / dz_fint # W/m * m / cm = W/cm |
1562 |
| - # |
1563 |
| - # # Determine the corrective factor in each kfint |
1564 |
| - # x = np.zeros(len(self.z_finemesh) - 1) |
1565 |
| - # for i in range(len(x)): |
1566 |
| - # # self.avg_power has units of W/cm; so does sum_terms |
1567 |
| - # x[i] = self.avg_power[i] / np.sum(sum_terms[kf == i]) |
1568 |
| - # # x[i] = self.avg_power[i] * 100 / np.average(sum_terms[kf == i]) |
1569 |
| - # return x |
| 1514 | + Parameters |
| 1515 | + ---------- |
| 1516 | + asm_power : DASSH AssemblyPower object |
| 1517 | +
|
| 1518 | + Returns |
| 1519 | + ------- |
| 1520 | + numpy.ndarray |
| 1521 | + Total power in each pin |
1570 | 1522 |
|
| 1523 | + """ |
| 1524 | + z_bnds = np.array([-0.5, 0.5]) |
| 1525 | + z_bnds = z_bnds.reshape(2, 1) |
| 1526 | + int_exponents = np.arange(1, asm_power.n_terms + 1) |
| 1527 | + z_int = np.power(z_bnds, int_exponents) |
| 1528 | + # Integrate in each region, evaluate at lower/upper bound |
| 1529 | + # shape is n_region x n_pin x 2 (upper/lower bound) |
| 1530 | + integrated = np.dot(asm_power.pin_power / int_exponents, z_int.T) |
| 1531 | + # Take the difference across the region |
| 1532 | + # shape is n_region x n_pin |
| 1533 | + diff_across_region = integrated[:, :, 1] - integrated[:, :, 0] |
| 1534 | + # multiply linear power by z-bounds and sum to get total power |
| 1535 | + # in each pin |
| 1536 | + dz_finemesh = asm_power.z_finemesh[1:] - asm_power.z_finemesh[:-1] |
| 1537 | + power_per_pin = np.dot(dz_finemesh, diff_across_region) |
| 1538 | + return power_per_pin |
1571 | 1539 |
|
1572 | 1540 | ########################################################################
|
1573 |
| -# Old |
1574 |
| -# def calculate_total_power(self): |
1575 |
| -# """Calculate the total power (W) produced by the assembly using |
1576 |
| -# the linear power (W/m) shape functions.""" |
1577 |
| -# |
1578 |
| -# dz = [self.z_finemesh[k] - self.z_finemesh[k - 1] |
1579 |
| -# for k in range(1, len(self.z_finemesh))] |
1580 |
| -# p_total = 0.0 |
1581 |
| -# for k in range(len(dz)): |
1582 |
| -# zc = self.z_finemesh[k] + dz[k] / 2 # center of mesh cell |
1583 |
| -# if k < self.k_bnds[0] or k >= self.k_bnds[1]: |
1584 |
| -# p_total += dz[k] * self.get_refl_power(zc) |
1585 |
| -# else: |
1586 |
| -# p_total += dz[k] * (np.sum(self.get_pin_power(zc)) |
1587 |
| -# + np.sum(self.get_duct_power(zc)) |
1588 |
| -# + np.sum(self.get_coolant_power(zc))) |
1589 |
| -# return p_total |
0 commit comments