ukaea/neutronics_material_maker

Additional properties required for stress and thermal simulations

shimwell opened this issue · 0 comments

FEA for stress and temperature fields will need some additional properties.

Poisson's ratio
Young's modulus
thermal conductivity
specific heat capacity
density
yield stress

Perhaps we a new repository should be made that allows the creation of materials for FEA analysis.

I will need to think about how FENICS accesses these properties, but here is a potential skeleton layout

import numpy as np

class Base():
    def __init__(self):
        pass


class Material(Base):
    def __init__(self):
        super().__init__()

    def print_mat_card(self):
        raise NotImplementedError


class Property(object):
    def __init__(self, values, temperatures):
        self.values = values
        self.temperatures = temperatures

    @classmethod
    def from_file(cls, dic):
        return cls(dic['data'], dic['temp'])

    def interpolate(self, temperature):
        return np.interp(temperature, self.values, self.temperatures)




class Poissons_Ratio(Property):
    def __init__(self, values=None, temperatures=None):
        if len(values) != len(temperatures):
            raise ValueError('error')
        super().__init__(values, temperatures)

class Youngs_Modulus(Property):
    def __init__(self, values=None, temperatures=None):
        if len(values) != len(temperatures):
            raise ValueError('error')
        super().__init__(values, temperatures)

class Thermal_Conductivity(Property):
    def __init__(self, values=None, temperatures=None):
        if len(values) != len(temperatures):
            raise ValueError('error')
        super().__init__(values, temperatures)

class Specific_Heat_Capacity(Property):
    def __init__(self, values=None, temperatures=None):
        if len(values) != len(temperatures):
            raise ValueError('error')
        super().__init__(values, temperatures)

class Density(Property):
    def __init__(self, values=None, temperatures=None):
        if len(values) != len(temperatures):
            raise ValueError('error')
        super().__init__(values, temperatures)

class Yield_Stress(Property):
    def __init__(self, values=None, temperatures=None):
        if len(values) != len(temperatures):
            raise ValueError('error')
        super().__init__(values, temperatures)


class Eurofer(Material):
    pr = Poissons_Ratio(values=[50,60,70,80,70], temperatures=[0, 20, 40, 60, 80])

e = Eurofer()
print(e.pr.values)
print(e.pr.temperatures)
print(e.pr.interpolate(55))