Commit 02f3e082 authored by Salko Jr, Robert's avatar Salko Jr, Robert
Browse files

Add ability to set nonuniform inlet flow/temp distributions in nodal models

Description:

CASL Ticket # - N/A
parent 732493c7
Loading
Loading
Loading
Loading
+35 −3
Original line number Diff line number Diff line
@@ -809,6 +809,9 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core):
      model.is_nodal = True
      me.chMapObj = chMapObj
      me.nodalGeom = nodalGeom
      me.outletPressure = None
      me.mdotTotal = None
      me.tempInitial = None

   def setEditOptions(me, chanVTK=None, rodVTK=None, ctfHDF5=None, veracsHDF5=None, chanASCII=None,
         rodEdits=None, dnbEdits=None):
@@ -896,7 +899,7 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core):
      rodMap = list([list(rodRow) for rodRow in rodMap])
      return rodMap, me.chMapObj.chAssemIdx, me.chMapObj.assemIdx, me.core_sym

   def setCoreInletBC(me, massflux, temperature, flowRamp=None):
   def setCoreInletBC(me, massflux, temperature, flowRamp=None, massflowShape=None, temperatureShape=None):
      """ Sets the mass flux and temperature uniformly at the inlet of the core.

      Args:
@@ -906,11 +909,37 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core):
           of two lists, [time, flow], where "time" is a list of times in the forcing function and "flow" is a
           list of flow factors (enter as a fraction of the massflux).  The lists must match in size.
           If not provided, no ramp is set.
         massflowShape (list): Takes assembly index and returns a multiplier on the nominal mass flux provided.
           Can be used to create an inlet flow distribution.  If not included, defaults to uniform.
         temperatureShape (list): Takes assembly index and returns an adder on the nominal inlet temperature
           provided in C.  Can be used to create an inlet temperature distribution.  If not included, defaults
           to a uniform inlet temperature distribution.
      """
      me.mdotTotal = 0.0
      me.tempInitial = 0.0
      coreArea = 0.0
      for chIdx in me.chMapObj.getChIdxs():
         [i, j] = me.chMapObj.getLoc(chIdx)
         me.model.addBoundaryCondition(bc=BoundaryCondition.MassTemperature(mdot=massflux*me.nodalGeom.getNodalChannelArea(i, j),
            T=temperature, mdotRamp=flowRamp), chID=chIdx, lev=1)
         if massflowShape is not None:
            assert len(massflowShape)==len(me.chMapObj.getAssemIdxs())
            mult = massflowShape[me.chMapObj.getAssemIndex(chIdx)-1]
            assert mult>0.0
            mdot = massflux*me.nodalGeom.getNodalChannelArea(i, j)*mult
         else:
            mdot = massflux*me.nodalGeom.getNodalChannelArea(i, j)
         if temperatureShape is not None:
            assert len(temperatureShape)==len(me.chMapObj.getAssemIdxs())
            temp = temperature+temperatureShape[me.chMapObj.getAssemIndex(chIdx)-1]
         else:
            temp = temperature
         me.mdotTotal = me.mdotTotal+mdot
         me.tempInitial = me.tempInitial+temp*me.nodalGeom.getNodalChannelArea(i, j)
         coreArea = coreArea+me.nodalGeom.getNodalChannelArea(i, j)
         me.model.addBoundaryCondition(bc=BoundaryCondition.MassTemperature(mdot=mdot,
            T=temp, mdotRamp=flowRamp), chID=chIdx, lev=1)
      me.tempInitial = me.tempInitial/coreArea
      if me.outletPressure:
         me.model.setInitialConditions(me.mdotTotal, me.tempInitial, me.outletPressure)

   def setCoreOutletBC(me, pressure, temperature):
      """ Sets the core outlet pressure.
@@ -923,6 +952,9 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core):
         [i, j] = me.chMapObj.getLoc(chIdx)
         me.model.addBoundaryCondition(bc=BoundaryCondition.PressureTemperature(pressure, temperature), chID=chIdx,
            lev=me.sec.nLev+2)
      me.outletPressure = pressure
      if me.tempInitial and me.mdotTotal:
         me.model.setInitialConditions(me.mdotTotal, me.tempInitial, me.outletPressure)

   def setCorePowerShape(me, radialPower=None, axialPower=None, coreStart=0.0):
      """ Use to set a power shape in the core region.
+291 −0
Original line number Diff line number Diff line
#!/usr/bin/env python
# Author: Bob Salko
# Date: 1/23/19
# Description:
# Makes a model of CASL problem 7 using 4 subchannels per assembly
#
import sys
sys.path.insert(0, '../../')
import SubKit.build as cdb
import SubKit.utils.UnitConversions as units
from   SubKit.build.SquareLatticeLWR_Nodal import SquareLatticeLWR_Nodal
import copy
import math
import numpy as np


def main():

   dFuelOuter = 0.475e-2*2 # m
   dFuelInner = 0.418e-2*2 # m
   dFuelPellet = 0.4096e-2*2 # m
   dGuideTubeOuter = 0.602e-2*2 # m
   dGuideTubeInner = 0.561e-2*2 # m
   assemPitch = 21.5e-2 # m
   pitch = 1.26e-2 # m
   baffleGap = 0.19e-2 # m
   inletMassFlux = 0.3483429E+04 # kg/m**2/s
   inletTemp = 291.85 # C
   outletPressure = 155.132039 # bar
   linearHeatRate = 16.71977 # kW/m
   directHeat = 0.026
   gridLocations = list(np.array([13.884,  75.2, 127.4, 179.6, 231.8, 284.0, 336.2])*units.t_cm_m)
   gridHeights =   list(np.array([3.866 , 3.810, 3.810, 3.810, 3.810, 3.810, 3.810])*units.t_cm_m)
   axial_edit_bounds = list(np.array([11.951, 15.817, 24.028, 32.239, 40.45, 48.662, 56.873, 65.084, 73.295, 77.105 , 85.17,
      93.235, 101.3, 109.365, 117.43, 125.495, 129.305, 137.37, 145.435, 153.5, 161.565, 169.63, 177.695,
      181.505, 189.57, 197.635, 205.7, 213.765, 221.83, 229.895, 233.705, 241.77, 249.835, 257.9, 265.965, 274.03,
      282.095, 285.905, 293.97, 302.035, 310.1, 318.165, 326.23, 334.295, 338.105, 346.0262, 353.9474, 361.8686,
      369.7898, 377.711])*units.t_cm_m)
   formLoss = 0.9070

   # Setup axial mesh
   gridLocations = list(np.array(gridLocations)-axial_edit_bounds[0])
   axial_edit_bounds = list(np.array(axial_edit_bounds)-axial_edit_bounds[0])
   dz = []
   for j in range(1, len(axial_edit_bounds)):
      dz.append(axial_edit_bounds[j]-axial_edit_bounds[j-1])
   numLevels = len(dz)
   gridBottoms = list(np.array(gridLocations)-np.array(gridHeights)/2.0)
   gridLevels = []
   for grid in gridBottoms:
      found = False
      for level, z in enumerate(axial_edit_bounds):
         if np.isclose(grid, z):
            gridLevels.append(level+1)
            found = True
      assert(found)
   assert(len(gridLevels)==len(gridLocations))


   # The map of the core.  Each 1 represents an assembly
   coreMap = [[ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
              [ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
              [ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
              [ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
              [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
              [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
              [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
              [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
              [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
              [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
              [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
              [ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
              [ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
              [ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
              [ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]]


   # Fuel rod is type 1, but mark it with an "f" to make it more visible
   # Guide tube is type 2
   f=1
   pwr17x17 = [
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, f, f, f, 2, f, f, 2, f, f, 2, f, f, f, f, f],
           [f, f, f, 2, f, f, f, f, f, f, f, f, f, 2, f, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, 2, f, f, 2, f, f, 2, f, f, 2, f, f, 2, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, 2, f, f, 2, f, f, 2, f, f, 2, f, f, 2, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, 2, f, f, 2, f, f, 2, f, f, 2, f, f, 2, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, f, 2, f, f, f, f, f, f, f, f, f, 2, f, f, f],
           [f, f, f, f, f, 2, f, f, 2, f, f, 2, f, f, f, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
           [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f]]

   # The multiple gap connects are not working with CTF parallel for some reason
   rodDomains = [[ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0],
                 [ 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0],
                 [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
                 [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
                 [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
                 [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
                 [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
                 [ 3, 3, 3, 3, 3, 3, 3, 4, 2, 2, 2, 2, 2, 2, 2],
                 [ 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4],
                 [ 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4],
                 [ 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4],
                 [ 0, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 0],
                 [ 0, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 0],
                 [ 0, 0, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 0, 0],
                 [ 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 4, 0, 0, 0, 0]]
   #rodDomains = [[ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0],
   #              [ 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0],
   #              [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
   #              [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
   #              [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2],
   #              [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
   #              [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
   #              [ 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0],
   #              [ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0]]
   #rodDomains = [[ 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 0, 0, 0, 0],
   #              [ 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 0, 0],
   #              [ 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 0],
   #              [ 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 0],
   #              [ 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3],
   #              [ 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3],
   #              [ 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3],
   #              [ 1, 1, 1, 1, 1, 1, 2, 2, 2, 6, 6, 6, 6, 6, 6],
   #              [ 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6],
   #              [ 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6],
   #              [ 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6],
   #              [ 0, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 0],
   #              [ 0, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 0],
   #              [ 0, 0, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 0, 0],
   #              [ 0, 0, 0, 0, 4, 4, 5, 5, 5, 6, 6, 0, 0, 0, 0]]
   #rodDomains = [[ 0, 0, 0, 0, 1, 2, 2, 2, 2, 3, 3, 0, 0, 0, 0],
   #              [ 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 0, 0],
   #              [ 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 0],
   #              [ 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 0],
   #              [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3],
   #              [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3],
   #              [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3],
   #              [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6],
   #              [ 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6],
   #              [ 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6],
   #              [ 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6],
   #              [ 0, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 0],
   #              [ 0, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 0],
   #              [ 0, 0, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 0, 0],
   #              [ 0, 0, 0, 0, 4, 5, 5, 5, 5, 5, 6, 0, 0, 0, 0]]
   rodDomains = [[ 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 3, 0, 0, 0, 0],
                 [ 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 0, 0],
                 [ 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 0],
                 [ 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 0],
                 [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3],
                 [ 1, 1, 1, 1, 7, 7, 7, 2, 2, 2, 3, 3, 3, 3, 3],
                 [ 1, 1, 1, 1, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3],
                 [ 1, 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6],
                 [ 4, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6],
                 [ 4, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6],
                 [ 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6],
                 [ 0, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 0],
                 [ 0, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 0],
                 [ 0, 0, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 0, 0],
                 [ 0, 0, 0, 0, 4, 5, 5, 5, 5, 5, 6, 0, 0, 0, 0]]
   #rodDomains = [[ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0],
   #              [ 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0],
   #              [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
   #              [ 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 0],
   #              [ 1, 1, 1, 1, 1, 1, 5, 5, 5, 2, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2],
   #              [ 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2],
   #              [ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2],
   #              [ 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4],
   #              [ 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4],
   #              [ 3, 3, 3, 3, 3, 3, 5, 5, 5, 4, 4, 4, 4, 4, 4],
   #              [ 0, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 0],
   #              [ 0, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 0],
   #              [ 0, 0, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 0, 0],
   #              [ 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 4, 0, 0, 0, 0]]

   print np.unique(np.array(rodDomains), return_counts=True)

   model = cdb.Model()

   model.setTitle("4-Loop nodal mesh loss of flow")

   solidGeoms = {1: cdb.FuelRod(d_outer=dFuelOuter, d_inner=dFuelInner, d_pellet=dFuelPellet), # Fuel rod
                 2: cdb.Tube(d_outer=dGuideTubeOuter, d_inner=dGuideTubeInner)}                # Guide tube

   # Radial power shape
   radPow= [[0.00, 0.00, 0.00, 0.00, 0.75, 0.76, 0.77, 0.78, 0.77, 0.76, 0.75, 0.00, 0.00, 0.00, 0.00],
            [0.00, 0.00, 0.00, 0.75, 1.10, 0.93, 1.10, 0.91, 1.10, 0.93, 1.10, 0.75, 0.00, 0.00, 0.00],
            [0.00, 0.00, 0.74, 1.12, 0.93, 1.17, 0.97, 1.18, 0.97, 1.17, 0.93, 1.12, 0.74, 0.00, 0.00],
            [0.00, 0.75, 1.12, 0.93, 1.12, 0.94, 1.19, 0.93, 1.19, 0.94, 1.12, 0.93, 1.12, 0.75, 0.00],
            [0.75, 1.10, 0.93, 1.12, 0.95, 1.19, 0.95, 1.22, 0.95, 1.19, 0.95, 1.12, 0.93, 1.10, 0.75],
            [0.76, 0.93, 1.17, 0.94, 1.19, 0.98, 1.19, 0.94, 1.19, 0.98, 1.19, 0.94, 1.17, 0.93, 0.76],
            [0.77, 1.10, 0.97, 1.19, 0.95, 1.19, 0.94, 1.12, 0.94, 1.19, 0.95, 1.19, 0.97, 1.10, 0.77],
            [0.78, 0.91, 1.18, 0.93, 1.22, 0.94, 1.12, 0.90, 1.12, 0.94, 1.22, 0.93, 1.18, 0.91, 0.78],
            [0.77, 1.10, 0.97, 1.19, 0.95, 1.19, 0.94, 1.12, 0.94, 1.19, 0.95, 1.19, 0.97, 1.10, 0.77],
            [0.76, 0.93, 1.17, 0.94, 1.19, 0.98, 1.19, 0.94, 1.19, 0.98, 1.19, 0.94, 1.17, 0.93, 0.76],
            [0.75, 1.10, 0.93, 1.12, 0.95, 1.19, 0.95, 1.22, 0.95, 1.19, 0.95, 1.12, 0.93, 1.10, 0.75],
            [0.00, 0.75, 1.12, 0.93, 1.12, 0.94, 1.19, 0.93, 1.19, 0.94, 1.12, 0.93, 1.12, 0.75, 0.00],
            [0.00, 0.00, 0.74, 1.12, 0.93, 1.17, 0.97, 1.18, 0.97, 1.17, 0.93, 1.12, 0.74, 0.00, 0.00],
            [0.00, 0.00, 0.00, 0.75, 1.10, 0.93, 1.10, 0.91, 1.10, 0.93, 1.10, 0.75, 0.00, 0.00, 0.00],
            [0.00, 0.00, 0.00, 0.00, 0.75, 0.76, 0.77, 0.78, 0.77, 0.76, 0.75, 0.00, 0.00, 0.00, 0.00]]

   builder = SquareLatticeLWR_Nodal(model, coreMap, pwr17x17, pitch, dz, solidGeoms, assemPitch=assemPitch,\
      baffleGap=baffleGap, assemLosses=formLoss, assemLossLevels=gridLevels, rodDomains=rodDomains, \
      modelGuideTubes=True)

   # Run to 1 second to let the solution reach steady state
   model.addTransientGroup(tEnd=1.0)
   # Run a 10 second transient
   model.addTransientGroup(tEnd=11.0, editInterval=1.0)

   # Ramp the power down over time
   time = [1.0, 4.0, 4.3, 4.6, 4.9, 5.2, 5.5, 5.8, 6.1, 6.4, 6.7, 7.0, 11.0]
   power = [1.0, 1.0, 0.99, 0.95, 0.90, 0.80, 0.68, 0.44, 0.27, 0.21, 0.19, 0.18, 0.16]
   model.addTotalPowerRamp(time, power)

   # Set the core boundary conditions
   # Apply a flow ramp to represent the loss of flow
   time = [ 1.0,  1.1,  1.2,  1.4,  1.6,  1.9,  2.2,  2.5,  2.8,  3.1,  3.4,  3.8,  4.0,  4.6,  5.4,  6.5,  7.9,  9.2, 10.0]
   flow = [1.00, 1.00, 0.90, 0.83, 0.78, 0.75, 0.71, 0.70, 0.67, 0.66, 0.64, 0.62, 0.61, 0.58, 0.55, 0.51, 0.46, 0.43, 0.40]

   tempDist = [
                                 7,      6,      6,      7,      8,      8,      9,
                 4,      3,      3,      3,      3,      4,      4,      6,      9,     10,     11,
         -2,     0,      0,     -2,     -1,      0,      0,      1,      5,      7,      9,     11,     12,
         -5,    -5,     -5,     -5,     -8,     -6,     -3,      0,      2,      7,      9,     11,     12,
 -9,     -9,   -11,    -10,    -12,    -11,    -10,     -7,     -1,      3,      6,     10,     11,     12,     13,
-13,    -14,   -16,    -16,    -15,    -11,    -11,     -8,     -1,      3,      7,     10,     11,     12,     13,
-17,    -18,   -18,    -18,    -14,    -10,     -6,     -2,      0,      5,      6,      9,     11,     12,     13,
-22,    -22,   -20,    -17,    -15,     -8,     -1,     -1,     -1,      5,      8,     10,     11,     12,     13,
-26,    -25,   -21,    -18,    -12,     -6,      0,      0,      4,      8,      9,     11,     12,     13,     13,
-28,    -26,   -22,    -15,    -10,     -3,      2,      5,      9,      9,     11,     11,     13,     13,     13,
-27,    -27,   -20,    -15,     -6,     -2,      3,      8,      9,     11,     11,     12,     13,     13,     13,
        -24,   -20,    -12,     -5,     -1,      4,      8,     10,     11,     12,     12,     12,     13,
        -18,   -17,     -9,     -5,      0,      4,      7,      9,     10,     11,     11,     12,     12,
               -10,     -7,     -4,     -1,      2,      4,      7,      9,      9,     10,     10,
                                -3,     -1,      1,      3,      5,      7,      7]

   flowDist = [
                                0.85,   0.89,   0.88,   0.88,   0.86,   0.88,   0.80,
                0.80,   0.79,   0.89,   0.96,   1.04,   0.95,   0.90,   0.94,   0.81,   0.82,   0.76,
        0.79,   0.85,   0.80,   0.93,   1.11,   1.03,   1.08,   1.04,   1.14,   0.96,   0.73,   0.83,   0.82,
        0.83,   0.83,   0.98,   1.07,   1.07,   1.19,   1.06,   1.25,   1.10,   1.15,   1.00,   0.89,   0.87,
0.82,   0.87,   0.95,   1.14,   1.08,   1.29,   1.11,   1.19,   1.09,   1.28,   1.09,   1.12,   0.99,   0.96,   0.85,
0.83,   0.91,   1.03,   1.07,   1.32,   1.15,   1.28,   1.10,   1.19,   1.11,   1.20,   1.05,   1.05,   0.93,   0.87,
0.85,   0.89,   0.99,   1.19,   1.12,   1.27,   1.13,   1.16,   1.09,   1.29,   1.07,   1.15,   1.00,   0.91,   0.85,
0.85,   0.90,   0.88,   1.09,   1.27,   1.08,   1.15,   1.29,   1.12,   1.06,   1.15,   1.06,   0.86,   0.88,   0.84,
0.85,   0.90,   0.95,   1.24,   1.10,   1.20,   1.07,   1.18,   1.12,   1.24,   1.10,   1.16,   0.93,   0.93,   0.87,
0.83,   0.91,   0.98,   1.05,   1.25,   1.11,   1.22,   1.10,   1.26,   1.12,   1.26,   1.08,   1.06,   0.91,   0.85,
0.83,   0.93,   0.95,   1.10,   1.09,   1.22,   1.12,   1.25,   1.11,   1.27,   1.08,   1.15,   0.95,   0.89,   0.85,
        0.86,   0.88,   0.99,   1.08,   1.08,   1.16,   1.09,   1.19,   1.06,   1.08,   0.94,   0.83,   0.83,
        0.81,   0.83,   0.86,   0.96,   1.03,   1.01,   1.05,   0.97,   0.98,   0.95,   0.78,   0.80,   0.80,
                0.80,   0.87,   0.90,   0.92,   0.98,   0.94,   0.97,   0.87,   0.85,   0.81,   0.79,
                                0.85,   0.88,   0.91,   0.94,   0.90,   0.85,   0.82]

   builder.setCoreInletBC(inletMassFlux, inletTemp, flowRamp=[time, flow], massflowShape=flowDist, temperatureShape=tempDist)
   builder.setCoreOutletBC(outletPressure, inletTemp)

   # Set the nominal power and direct heating to coolant
   model.setAveragePower(qprime=linearHeatRate, dhfrac=directHeat)

   # Turn on rod VTK and DNB edits.  They are both off by default.
   model.setEditOptions(dnbEdits=True)

   coreHeight = np.sum(np.array(dz))
   def axPow(z):
      return np.cos((z-coreHeight/2)*np.pi/2/coreHeight)

   # Pass to the core builder
   builder.setCorePowerShape(radialPower=radPow, axialPower=axPow)


   model.generateModel()

if __name__=='__main__':
   main()
+25980 −0

File added.

Preview size limit exceeded, changes collapsed.