Exemplo n.º 1
0
    def __init__(self, name="graphite"):
        """Initalizes a material

        :param name: The name of the material (i.e., "fuel" or "cool")
        :type name: str.
        """
        Material.__init__(
            self, name=name, k=self.thermal_conductivity(), cp=self.specific_heat_capacity(), dm=self.density()
        )
Exemplo n.º 2
0
 def __init__(self, name='fhrfuel'):
     """Initalizes a material based on the fuel kernel in a TRISO particle.
     A material has intensive (as opposed to extensive) material properties.
     :param name: The name of the material (i.e., "fuel" or "cool")
     :type name: str.
     """
     Material.__init__(self,
                       name=name,
                       k=self.thermal_conductivity(),
                       cp=self.specific_heat_capacity(),
                       dm=self.density())
Exemplo n.º 3
0
Arquivo: sodium.py Projeto: joosm/pyrk
    def __init__(self, name="sodium"):
        """Initalizes a material, specifically sodium

        :param name: The name of the component (i.e., "fuel" or "cool")
        :type name: str.
        """
        Material.__init__(self,
                          name=name,
                          k=self.thermal_conductivity(),
                          cp=self.specific_heat_capacity(),
                          dm=self.density())
Exemplo n.º 4
0
    def __init__(self, name="graphite"):
        """Initalizes a material

        :param name: The name of the material (i.e., "fuel" or "cool")
        :type name: str.
        """
        Material.__init__(self,
                          name=name,
                          k=self.thermal_conductivity(),
                          cp=self.specific_heat_capacity(),
                          dm=self.density())
Exemplo n.º 5
0
    def __init__(self, name="sodium"):
        """Initalizes a material, specifically sodium

        :param name: The name of the component (i.e., "fuel" or "cool")
        :type name: str.
        """
        Material.__init__(self,
                          name=name,
                          k=self.thermal_conductivity(),
                          cp=self.specific_heat_capacity(),
                          dm=self.density())
Exemplo n.º 6
0
    def __init__(self, name, T0, sub_comp=[], timer=Timer()):
        """Initalizes a thermal hydraulic super component.

        :param name: The name of the supercomponent (i.e., "fuel" or "cool")
        :type name: str.
        :param T0: The initial temperature of the supercomponent
        :type T0: float.
        :param sub_comp: List of components that makes up the supercomponent.
        The sub_components should be in order from the center to the outside
        :type sub_comp: list of THComponent
        :param timer: The timer instance for the sim
        :type timer: Timer object
        """
        THComponent.__init__(self, name=name,
                             mat=Material(),
                             vol=0.0*units.meter**3,
                             T0=T0,
                             alpha_temp=0*units.delta_k/units.kelvin,
                             timer=timer,
                             heatgen=False,
                             power_tot=0*units.watt,
                             sph=False,
                             ri=0*units.meter,
                             ro=0*units.meter)
        self.sub_comp = sub_comp
        self.T = units.Quantity(np.zeros(shape=(timer.timesteps(),),
                                         dtype=float), 'kelvin')
        self.T[0] = T0
        self.conv = {}
        self.add_conduction_in_mesh()
        self.alpha_temp = 0.0*units.delta_k/units.kelvin
Exemplo n.º 7
0
    def initialize(self):
        print("Initializing program...")

        self.renderer = Renderer()
        self.scene = Scene()
        self.camera = Camera()
        # pull camera towards viewer
        self.camera.setPosition(0, 0, 7)

        geometry = SphereGeometry(radius=3)

        vsCode = """
        in vec3 vertexPosition;
        out vec3 position;
        uniform mat4 modelMatrix;
        uniform mat4 viewMatrix;
        uniform mat4 projectionMatrix;
        
        void main()
        {
            
            vec4 pos = vec4(vertexPosition, 1);
            gl_Position = projectionMatrix * viewMatrix * modelMatrix * pos;
            position = vertexPosition;
        }
        """

        fsCode = """
        in vec3 position;
        out vec4 fragColor;
        
        void main()
        {
            vec3 color = fract(position);
            fragColor = vec4(color,1);
        }
        """
        material = Material(vsCode, fsCode)
        material.locateUniforms()

        self.mesh = Mesh(geometry, material)

        self.scene.add(self.mesh)
Exemplo n.º 8
0
    def __init__(self, name="kernel"):
        """Initalizes a material based on the fuel kernel in a TRISO particle.
        A material has intensive (as opposed to extensive) material properties.

        :param name: The name of the material (i.e., "fuel" or "cool")
        :type name: str.
        :param vol: The volume of the material
        :param T0: The initial temperature of the material
        :type T0: float.
        :param alpha_temp: temperature coefficient of reactivity
        :type alpha_temp: float
        :param timer: The timer instance for the sim
        :type timer: Timer object
        :param heatgen: is this material a heat generator (fuel)
        :type heatgen: bool
        """
        Material.__init__(self,
                          name=name,
                          k=self.thermal_conductivity(),
                          cp=self.specific_heat_capacity(),
                          dm=self.density())
Exemplo n.º 9
0
Arquivo: ss316.py Projeto: joosm/pyrk
    def __init__(self, name="ss316"):
        """Initalizes a material based on stainless steel 316, a common nuclear
        grade steel.

        :param name: The name of the material (i.e., "fuel" or "cool")
        :type name: str.
        :param vol: The volume of the material
        :param T0: The initial temperature of the material
        :type T0: float.
        :param alpha_temp: temperature coefficient of reactivity
        :type alpha_temp: float
        :param timer: The timer instance for the sim
        :type timer: Timer object
        :param heatgen: is this material a heat generator (fuel)
        :type heatgen: bool
        """
        Material.__init__(self,
                          name=name,
                          k=self.thermal_conductivity(),
                          cp=self.specific_heat_capacity(),
                          dm=self.density())
Exemplo n.º 10
0
    def __init__(self, name="ss316"):
        """Initalizes a material based on stainless steel 316, a common nuclear
        grade steel.

        :param name: The name of the material (i.e., "fuel" or "cool")
        :type name: str.
        :param vol: The volume of the material
        :param T0: The initial temperature of the material
        :type T0: float.
        :param alpha_temp: temperature coefficient of reactivity
        :type alpha_temp: float
        :param timer: The timer instance for the sim
        :type timer: Timer object
        :param heatgen: is this material a heat generator (fuel)
        :type heatgen: bool
        """
        Material.__init__(self,
                          name=name,
                          k=self.thermal_conductivity(),
                          cp=self.specific_heat_capacity(),
                          dm=self.density())
Exemplo n.º 11
0
def test_wakao_model():
    mat = Material(k=1 * units.watt / units.meter / units.kelvin,
                   cp=1 * units.joule / units.kg / units.kelvin,
                   mu=2 * units.pascal * units.second)
    h_wakao = ConvectiveModel(mat=mat,
                              m_flow=1 * units.kg / units.g,
                              a_flow=1 * units.meter**2,
                              length_scale=1 * units.meter,
                              model='wakao')
    assert_equal(h_wakao.mu, 2 * units.pascal * units.second)
    rho = 100 * units.kg / units.meter**3
    assert_equal(h_wakao.h(rho, 0 * units.pascal * units.second),
                 h_wakao.h(rho, 2 * units.pascal * units.second))
Exemplo n.º 12
0
    def __init__(self,
                 name=None,
                 k=0*units.watt/units.meter/units.kelvin,
                 cp=0*units.joule/units.kg/units.kelvin,
                 dm=DensityModel(),
                 mu=0*units.pascal*units.seconds):
        """Initalizes a material

        :param name: The name of the component (i.e., "fuel" or "cool")
        :type name: str.
        :param k: The thermal conductivity of the component
        :type k: float, pint.unit.Quantity :math:'watt/meter/K'
        :param cp: specific heat capacity, :math:`c_p`, in :math:`J/kg-K`
        :type cp: float, pint.unit.Quantity :math:`J/kg-K`
        :param dm: The density of the material
        :type dm: DensityModel object
        :param mu: dynamic viscosity(for fluid), :math:`mu`, in :math:`Pa.s`
        :type mu: float, pint.unit.Quantity :math:`Pa.s`
        """
        Material.__init__(self, name, k, cp, dm)
        self.mu = mu.to('pascal*seconds')
        validation.validate_ge("mu", mu, 0*units.pascal*units.seconds)
Exemplo n.º 13
0
def test_conduction_slab():
    mat = Material(k=1 * units.watt / units.meter / units.kelvin)
    components = [
        th_component.THComponent(mat=mat, T0=700 * units.kelvin),
        th_component.THComponent(mat=mat, T0=700 * units.kelvin)
    ]
    th = th_system.THSystem(0, components)
    assert_equal(
        th.conduction_slab(components[0], components[1], 0, 1 * units.meter,
                           1 * units.meter**2), 0)
    components = [
        th_component.THComponent(mat=mat, T0=800 * units.kelvin),
        th_component.THComponent(mat=mat, T0=700 * units.kelvin)
    ]
    th = th_system.THSystem(0, components)
    assert (th.conduction_slab(components[0], components[1], 0,
                               1 * units.meter, 1 * units.meter**2) > 0)
Exemplo n.º 14
0
    def __init__(self,
                 h0=0 * units.watt / units.meter**2 / units.kelvin,
                 mat=Material(),
                 m_flow=None,
                 a_flow=None,
                 length_scale=None,
                 model="constant"):
        """
        Initializes the DensityModel object.

        :param h0: convective heat transfer coefficient when it's a constant
        :type h0: double
        :param mat: material of the fluid
        :type mat: Material object
        :param m_flow: mass flow rate
        :type m_flow: double
        :param a_flow: flow cross section surface area
        :type a_flow: double
        :param length_scale: heat transfer length scale
        :type length_scale: double
        :param model: The keyword for a model type, implemented types are
        'constant' and 'wakao'
        :type model: string
        """
        self.h0 = h0
        self.k = mat.k
        self.cp = mat.cp
        self.mu = mat.mu
        self.m_flow = m_flow
        self.a_flow = a_flow
        self.length_scale = length_scale

        self.implemented = {'constant': self.constant, 'wakao': self.wakao}

        if model in self.implemented.keys():
            self.model = model
        else:
            self.model = NotImplemented
            msg = "Convective heat transfer model type "
            msg += model
            msg += " is not an implemented convective model. Options are:"
            for m in self.implemented.keys():
                msg += m
            raise ValueError(msg)
Exemplo n.º 15
0
    def initialize(self):
        print("Initializing program...")

        self.renderer = Renderer()
        self.scene = Scene()
        self.camera = Camera()
        # pull camera towards viewer
        self.camera.setPosition(0, 0, 7)

        geometry = SphereGeometry(radius=3)

        vsCode = """
        in vec3 vertexPosition;
        in vec3 vertexColor;
        uniform mat4 modelMatrix;
        uniform mat4 viewMatrix;
        uniform mat4 projectionMatrix;
        out vec3 color;
        uniform float time;
        
        void main()
        {
            float offset = 0.2 * sin(2.0 * vertexPosition.x + time);
            vec3 pos = vertexPosition + vec3(0, offset, 0);
            gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(pos, 1);
            color = vertexColor;
        }
        """

        fsCode = """
        in vec3 color;
        uniform float time;
        out vec4 fragColor;
        
        void main()
        {
            float r = abs(sin(time));
            vec4 c = vec4(r, -0.5*r, -0.5*r, 0);
            fragColor = vec4(color , 1) + c;
        }
        """

        material = Material(vsCode, fsCode)
        material.addUniform("float", "time", 0)
        material.locateUniforms()

        self.time = 0

        self.mesh = Mesh(geometry, material)

        self.scene.add(self.mesh)
Exemplo n.º 16
0
k_fuel = 15 * units.watt / (units.meter * units.kelvin)
cp_fuel = 1818.0 * units.joule / units.kg / units.kelvin
rho_fuel = DensityModel(a=2220.0 * units.kg / (units.meter ** 3), model="constant")
Fuel = Material("fuel", k_fuel, cp_fuel, mu0, rho_fuel)

k_shell = 17 * units.watt / (units.meter * units.kelvin)
cp_shell = 1650.0 * units.joule / (units.kg * units.kelvin)
rho_shell = DensityModel(a=1740.0 * units.kg / (units.meter ** 3), model="constant")
Shell = Material("shell", k_shell, cp_shell, mu0, rho_shell)

k_cool = 1 * units.watt / (units.meter * units.kelvin)
cp_cool = 2415.78 * units.joule / (units.kg * units.kelvin)
rho_cool = DensityModel(
    a=2415.6 * units.kg / (units.meter ** 3), b=0.49072 * units.kg / (units.meter ** 3) / units.kelvin, model="linear"
)
cool = Material("cool", k_cool, cp_cool, mu0, rho_cool)

mod = th.THComponent(
    name="mod",
    mat=Moderator,
    vol=vol_mod,
    T0=t_mod,
    alpha_temp=alpha_mod,
    timer=ti,
    sph=True,
    ri=0.0 * units.meter,
    ro=r_mod,
)

fuel = th.THComponent(
    name="fuel",
Exemplo n.º 17
0
    def __init__(self, name=None,
                 mat=Material(),
                 vol=0.0*units.meter**3,
                 T0=0.0*units.kelvin,
                 alpha_temp=0*units.delta_k/units.kelvin,
                 timer=Timer(),
                 heatgen=False,
                 power_tot=0*units.watt,
                 sph=False,
                 ri=0*units.meter,
                 ro=0*units.meter):
        """Initalizes a thermal hydraulic component.
        A thermal-hydraulic component will be treated as one "lump" in the
        lumped capacitance model.

        :param name: The name of the component (i.e., "fuel" or "cool")
        :type name: str.
        :param mat: The material of this component
        :type mat: Material object
        :param vol: The volume of the component
        :type vol: float meter**3
        :param T0: The initial temperature of the component
        :type T0: float.
        :param alpha_temp: temperature coefficient of reactivity
        :type alpha_temp: float
        :param timer: The timer instance for the sim
        :type timer: Timer object
        :param heatgen: is this component a heat generator (fuel)
        :type heatgen: bool
        :param power_tot: power generated in this component
        :type power_tot: float
        :param sph: is this component a spherical component, spherical
        equations for heatgen, conduction are different,
        post-processing is different too
        :type sph: bool
        :param ri: inner radius of the sph/annular component, ri=0 for sphere
        :type ri: float
        :param ro: outer radius of the sph/annular component,
        ro=radius for sphere
        :type ro: float
        """
        self.name = name
        self.vol = vol.to('meter**3')
        self.mat = mat
        self.k = mat.k
        self.cp = mat.cp
        self.dm = mat.dm
        self.timer = timer
        self.T = units.Quantity(np.zeros(shape=(timer.timesteps(),),
                                         dtype=float), 'kelvin')
        self.T[0] = T0
        self.T0 = T0
        self.alpha_temp = alpha_temp.to('delta_k/kelvin')
        self.heatgen = heatgen
        self.power_tot = power_tot
        self.cond = {}
        self.conv = {}
        self.adv = {}
        self.mass = {}
        self.cust = {}
        self.prev_t_idx = 0
        self.convBC = {}
        self.sph = sph
        self.ri = ri.to('meter')
        self.ro = ro.to('meter')
Exemplo n.º 18
0
# External Reactivity
from reactivity_insertion import RampReactivityInsertion
rho_ext = RampReactivityInsertion(timer=ti,
                                  t_start=t_feedback + 10.0 * units.seconds,
                                  t_end=t_feedback + 20.0 * units.seconds,
                                  rho_init=0.0 * units.delta_k,
                                  rho_rise=650.0 * units.pcm,
                                  rho_final=650.0 * units.pcm)

# maximum number of internal steps that the ode solver will take
nsteps = 5000

k_mod = 17 * units.watt / (units.meter * units.kelvin)
cp_mod = 1650.0 * units.joule / (units.kg * units.kelvin)
rho_mod = DensityModel(a=1740. * units.kg / (units.meter**3), model="constant")
Moderator = Material('mod', k_mod, cp_mod, rho_mod)

k_fuel = 15 * units.watt / (units.meter * units.kelvin)
cp_fuel = 1818.0 * units.joule / units.kg / units.kelvin
rho_fuel = DensityModel(a=2220.0 * units.kg / (units.meter**3),
                        model="constant")
Fuel = Material('fuel', k_fuel, cp_fuel, rho_fuel)

k_shell = 17 * units.watt / (units.meter * units.kelvin)
cp_shell = 1650.0 * units.joule / (units.kg * units.kelvin)
rho_shell = DensityModel(a=1740. * units.kg / (units.meter**3),
                         model="constant")
Shell = Material('shell', k_shell, cp_shell, rho_shell)

k_cool = 1 * units.watt / (units.meter * units.kelvin)
cp_cool = 2415.78 * units.joule / (units.kg * units.kelvin)
Exemplo n.º 19
0
Arquivo: inpRmp.py Projeto: pyrk/pyrk
k_shell = 17 * units.watt / (units.meter * units.kelvin)
cp_shell = 1650.0 * units.joule / (units.kg * units.kelvin)
rho_shell = DensityModel(a=1740. * units.kg /
                         (units.meter**3), model="constant")
Shell = Material('shell', k_shell, cp_shell, rho_shell)

k_cool = 1 * units.watt / (units.meter * units.kelvin)
cp_cool = 2415.78 * units.joule / (units.kg * units.kelvin)
rho_cool = DensityModel(a=2415.6 *
                        units.kg /
                        (units.meter**3), b=0.49072 *
                        units.kg /
                        (units.meter**3) /
                        units.kelvin, model="linear")
cool = Material('cool', k_cool, cp_cool, rho_cool)
cool.mu = 4.638 * 10**5 / (650**2.79) * units.pascal * units.second
h_cool = ConvectiveModel(
    h0=4700.0 *
    units.watt /
    units.kelvin /
    units.meter**2,
    mat=cool,
    m_flow=m_flow,
    a_flow=a_flow,
    length_scale=dp,
    model='wakao')
mod = th.THComponent(name="mod",
                     mat=Moderator,
                     vol=vol_mod,
                     T0=t_mod,
Exemplo n.º 20
0
import th_component as th
from db import database
from utilities.ur import units
from timer import Timer
from materials.material import Material
import density_model

name = "testname"
vol = 20*units.meter**3
k = 10*units.watt/units.meter/units.kelvin
cp = 10*units.joule/units.kg/units.kelvin
dm = density_model.DensityModel(a=0*units.kg/units.meter**3,
                                b=100*units.kg/units.meter**3,
                                model='constant')
mat = Material(k=k, cp=cp, dm=dm)


kappa = 0
T0 = 700*units.kelvin
t0 = 0*units.seconds
tf = 10*units.seconds
tfeedback = 5*units.seconds
dt = 0.1*units.seconds
ti = Timer(t0=t0, tf=tf, dt=dt, t_feedback=tfeedback)
tester = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti)
tester_sph = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti,
                            sph=True, ri=0*units.meter, ro=1*units.meter)


def test_constructor():
Exemplo n.º 21
0
# External Reactivity
from reactivity_insertion import StepReactivityInsertion
rho_ext = StepReactivityInsertion(timer=ti,
                                  t_step=t_feedback + 10.0 * units.seconds,
                                  rho_init=0.0 * units.delta_k,
                                  rho_final=650.0 * 2 * units.pcm)

# maximum number of internal steps that the ode solver will take
nsteps = 5000

mu0 = 0 * units.pascal * units.second
k_mod = 17 * units.watt / (units.meter * units.kelvin)
cp_mod = 1650.0 * units.joule / (units.kg * units.kelvin)
rho_mod = DensityModel(a=1740. * units.kg / (units.meter**3), model="constant")
Moderator = Material('mod', k_mod, cp_mod, mu0, rho_mod)

k_fuel = 15 * units.watt / (units.meter * units.kelvin)
cp_fuel = 1818.0 * units.joule / units.kg / units.kelvin
rho_fuel = DensityModel(a=2220.0 * units.kg / (units.meter**3),
                        model="constant")
Fuel = Material('fuel', k_fuel, cp_fuel, mu0, rho_fuel)

k_shell = 17 * units.watt / (units.meter * units.kelvin)
cp_shell = 1650.0 * units.joule / (units.kg * units.kelvin)
rho_shell = DensityModel(a=1740. * units.kg / (units.meter**3),
                         model="constant")
Shell = Material('shell', k_shell, cp_shell, mu0, rho_shell)

k_cool = 1 * units.watt / (units.meter * units.kelvin)
cp_cool = 2415.78 * units.joule / (units.kg * units.kelvin)
Exemplo n.º 22
0
from reactivity_insertion import RampReactivityInsertion
rho_ext = RampReactivityInsertion(timer=ti,
                                  t_start=60.0 * units.seconds,
                                  t_end=70.0 * units.seconds,
                                  rho_init=0.0 * units.delta_k,
                                  rho_rise=600.0 * units.pcm,
                                  rho_final=600.0 * units.pcm)

# maximum number of internal steps that the ode solver will take
nsteps = 5000

k_mod = random.gauss(17, 17 * 0.05) * units.watt / (units.meter * units.kelvin)
cp_mod = random.gauss(1650.0, 1650.0 * 0.05) * \
    units.joule / (units.kg * units.kelvin)
rho_mod = DensityModel(a=1740. * units.kg / (units.meter**3), model="constant")
Moderator = Material('mod', k_mod, cp_mod, dm=rho_mod)

k_fuel = random.uniform(15.0, 19.0) * units.watt / (units.meter * units.kelvin)
cp_fuel = random.gauss(
    1818.0, 1818 * 0.05) * units.joule / units.kg / units.kelvin  # [J/kg/K]
rho_fuel = DensityModel(a=2220.0 * units.kg / (units.meter**3),
                        model="constant")
Fuel = Material('fuel', k_fuel, cp_fuel, dm=rho_fuel)

k_shell = random.gauss(17, 17 * 0.05) * units.watt / \
    (units.meter * units.kelvin)
cp_shell = random.gauss(
    1650.0, 1650.0 * 0.05) * units.joule / (units.kg * units.kelvin)
rho_shell = DensityModel(a=1740. * units.kg / (units.meter**3),
                         model="constant")
Shell = Material('shell', k_shell, cp_shell, dm=rho_shell)
Exemplo n.º 23
0
Arquivo: input.py Projeto: joosm/pyrk
Fuel = Material('fuel', k_fuel, cp_fuel, mu0, rho_fuel)

k_shell = 17*units.watt/(units.meter*units.kelvin)
cp_shell = 1650.0*units.joule/(units.kg*units.kelvin)
rho_shell = DensityModel(a=1740.*units.kg/(units.meter**3), model="constant")
Shell = Material('shell', k_shell, cp_shell, mu0, rho_shell)

k_cool = 1*units.watt/(units.meter*units.kelvin)
cp_cool = 2415.78*units.joule/(units.kg*units.kelvin)
rho_cool = DensityModel(a=2415.6 *
                        units.kg /
                        (units.meter**3), b=0.49072 *
                        units.kg /
                        (units.meter**3) /
                        units.kelvin, model="linear")
cool = Material('cool', k_cool, cp_cool, mu0, rho_cool)

mod = th.THComponent(name="mod",
                     mat=Moderator,
                     vol=vol_mod,
                     T0=t_mod,
                     alpha_temp=alpha_mod,
                     timer=ti,
                     sph=True,
                     ri=0.0*units.meter,
                     ro=r_mod)

fuel = th.THComponent(name="fuel",
                      mat=Fuel,
                      vol=vol_fuel,
                      T0=t_fuel,