Esempio n. 1
0
def generatePorousEquationOfStateBindings(x, ndim):

    me = "Spheral::PorousEquationOfState%id" % ndim
    solideos = "Spheral::EquationOfState%id" % ndim
    scalarfield = "Spheral::ScalarField%id" % ndim

    # Constructors.
    x.add_constructor([constrefparam(solideos, "solidEOS")])

    # Generic EOS interface.
    generateEquationOfStateVirtualBindings(x, ndim, False)

    # Methods.
    const_ref_return_value(x, me, "%s::solidEOS" % me, solideos, [],
                           "solidEOS")
    const_ref_return_value(x, me, "%s::alpha" % me, scalarfield, [], "alpha")

    # Attributes.
    x.add_instance_attribute("alpha0",
                             "double",
                             getter="alpha0",
                             setter="alpha0")
    x.add_instance_attribute("c0", "double", getter="c0", setter="c0")

    return
Esempio n. 2
0
def generateGeodynBindings(x, ndim):

    dim = "Spheral::Dim< %i >" % ndim
    me = "Spheral::Geodyn%id" % ndim

    # Constructors.
    x.add_constructor([
        constrefparam("PhysicalConstants", "constants"),
        param("double",
              "minimumPressure",
              default_value="-std::numeric_limits<double>::max()"),
        param("double",
              "maximumPressure",
              default_value="std::numeric_limits<double>::max()"),
        param("MaterialPressureMinType",
              "minPressureType",
              default_value="MaterialPressureMinType::PressureFloor")
    ])

    # Generic parent interfaces.
    generateEquationOfStateVirtualBindings(x, ndim, False)
    generatePhysicsVirtualBindings(x, ndim, False)
    generateStrengthModelVirtualBindings(x, ndim, False)

    # Methods.

    # Attributes.

    return
Esempio n. 3
0
def generateMurnahanEquationOfStateBindings(x, ndim):

    # Constructors.
    x.add_constructor([param("double", "referenceDensity"),
                       param("double", "etamin"),
                       param("double", "etamax"),
                       param("double", "n"),
                       param("double", "K"),
                       param("double", "atomicWeight"),
                       constrefparam("PhysicalConstants", "constants"),
                       param("double", "externalPressure", default_value="0.0"),
                       param("double", "minimumPressure", default_value="-std::numeric_limits<double>::max()"),
                       param("double", "maximumPressure", default_value="std::numeric_limits<double>::max()"),
                       param("MaterialPressureMinType", "minPressureType", default_value="MaterialPressureMinType::PressureFloor")])

    # Generic EOS interface.
    generateEquationOfStateVirtualBindings(x, ndim, False)

    # Methods.
    x.add_method("computeDPDrho", "double", [param("double", "rho"),
                                             param("double", "specificThermalEnergy")], is_const=True)
    x.add_method("valid", "bool", [], is_const=True, is_virtual=True)
    x.add_method("pressure", "double", [param("double", "massDensity"),
                                        param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("temperature", "double", [param("double", "massDensity"),
                                           param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("specificThermalEnergy", "double", [param("double", "massDensity"),
                                                     param("double", "temperature")],
                 is_const=True)
    x.add_method("specificHeat", "double", [param("double", "massDensity"),
                                            param("double", "tempernature")],
                 is_const=True)
    x.add_method("soundSpeed", "double", [param("double", "massDensity"),
                                          param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("gamma", "double", [param("double", "massDensity"),
                                     param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("bulkModulus", "double", [param("double", "massDensity"),
                                           param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("entropy", "double", [param("double", "massDensity"),
                                       param("double", "specificThermalEnergy")],
                 is_const=True)

    # Attributes.
    x.add_instance_attribute("n", "double", getter="n", setter="n")
    x.add_instance_attribute("K", "double", getter="K", setter="K")
    x.add_instance_attribute("atomicWeight", "double", getter="atomicWeight", setter="atomicWeight")
    x.add_instance_attribute("externalPressure", "double", getter="externalPressure", setter="externalPressure")
    x.add_instance_attribute("minimumPressure", "double", getter="minimumPressure", setter="minimumPressure")

    return
Esempio n. 4
0
def generateOsborneEquationOfStateBindings(x, ndim):

    # Constructors.
    x.add_constructor([param("double", "referenceDensity"),
                       param("double", "etamin"),
                       param("double", "etamax"),
                       param("double", "a1"),
                       param("double", "a2pos"),
                       param("double", "a2neg"),
                       param("double", "b0"),
                       param("double", "b1"),
                       param("double", "b2pos"),
                       param("double", "b2neg"),
                       param("double", "c0"),
                       param("double", "c1"),
                       param("double", "c2pos"),
                       param("double", "c2neg"),
                       param("double", "E0"),
                       param("double", "atomicWeight"),
                       constrefparam("PhysicalConstants", "constants"),
                       param("double", "externalPressure", default_value="0.0"),
                       param("double", "minimumPressure", default_value="-std::numeric_limits<double>::max()"),
                       param("double", "maximumPressure", default_value="std::numeric_limits<double>::max()"),
                       param("MaterialPressureMinType", "minPressureType", default_value="MaterialPressureMinType::PressureFloor")])

    # Generic EOS interface.
    generateEquationOfStateVirtualBindings(x, ndim, False)

    # Methods.
    x.add_method("DPDrho", "double", [param("double", "rho"),
                                      param("double", "specificThermalEnergy")], is_const=True)
    x.add_method("valid", "bool", [], is_const=True, is_virtual=True)

    # Attributes.
    x.add_instance_attribute("a1", "double", getter="a1", setter="a1")
    x.add_instance_attribute("a2pos", "double", getter="a2pos", setter="a2pos")
    x.add_instance_attribute("a2neg", "double", getter="a2neg", setter="a2neg")
    x.add_instance_attribute("b0", "double", getter="b0", setter="b0")
    x.add_instance_attribute("b1", "double", getter="b1", setter="b1")
    x.add_instance_attribute("b2pos", "double", getter="b2pos", setter="b2pos")
    x.add_instance_attribute("b2neg", "double", getter="b2neg", setter="b2neg")
    x.add_instance_attribute("c0", "double", getter="c0", setter="c0")
    x.add_instance_attribute("c1", "double", getter="c1", setter="c1")
    x.add_instance_attribute("c2pos", "double", getter="c2pos", setter="c2pos")
    x.add_instance_attribute("c2neg", "double", getter="c2neg", setter="c2neg")
    x.add_instance_attribute("E0", "double", getter="E0", setter="E0")
    x.add_instance_attribute("atomicWeight", "double", getter="atomicWeight", setter="atomicWeight")
    x.add_instance_attribute("Cv", "double", getter="Cv", is_const=True)
    x.add_instance_attribute("externalPressure", "double", getter="externalPressure", setter="externalPressure")

    return
Esempio n. 5
0
    def generateHelmholtzEquationOfStateBindings(self, x, ndim):

        scalarfield = "Spheral::ScalarField%id" % ndim
        nodelist = "Spheral::NodeList%id" % ndim

        # Constructor.
        x.add_constructor([
            constrefparam("PhysicalConstants", "constants"),
            param("double",
                  "minimumPressure",
                  default_value="-std::numeric_limits<double>::max()"),
            param("double",
                  "maximumPressure",
                  default_value="std::numeric_limits<double>::max()"),
            param("double",
                  "minimumTemperature",
                  default_value="-std::numeric_limits<double>::min()"),
            param(
                "MaterialPressureMinType",
                "minPressureType",
                default_value="Spheral::MaterialPressureMinType::PressureFloor"
            ),
            param("double", "abar0", default_value="13.6"),
            param("double", "zbar0", default_value="6.8")
        ])

        # Attributes.
        x.add_instance_attribute("needUpdate",
                                 "bool",
                                 getter="getUpdateStatus",
                                 setter="setUpdateStatus",
                                 is_const=False)

        # Methods

        generateEquationOfStateVirtualBindings(x, ndim, False)

        return
Esempio n. 6
0
def generateANEOSBindings(x, ndim):

    dim = "Spheral::Dim< %i >" % ndim
    me = "Spheral::ANEOS%id" % ndim

    # Constructors.
    x.add_constructor([
        param("int", "materialNumber"),
        param("unsigned int", "numRhoVals"),
        param("unsigned int", "numTvals"),
        param("double", "rhoMin"),
        param("double", "rhoMax"),
        param("double", "Tmin"),
        param("double", "Tmax"),
        constrefparam("PhysicalConstants", "constants"),
        param("double", "externalPressure", default_value="0.0"),
        param("double",
              "minimumPressure",
              default_value="-std::numeric_limits<double>::max()"),
        param("double",
              "maximumPressure",
              default_value="std::numeric_limits<double>::max()"),
        param("MaterialPressureMinType",
              "minPressureType",
              default_value="Spheral::MaterialPressureMinType::PressureFloor")
    ])

    # Generic EOS interface.
    generateEquationOfStateVirtualBindings(x, ndim, False)

    # Methods.
    x.add_function_as_method("ANEOS_STEvals",
                             "vector_of_vector_of_double", [param(me, "self")],
                             template_parameters=[dim],
                             custom_name="specificThermalEnergyVals")
    x.add_method("pressure",
                 "double", [
                     param("double", "massDensity"),
                     param("double", "specificThermalEnergy")
                 ],
                 is_const=True)
    x.add_method("temperature",
                 "double", [
                     param("double", "massDensity"),
                     param("double", "specificThermalEnergy")
                 ],
                 is_const=True)
    x.add_method(
        "specificThermalEnergy",
        "double",
        [param("double", "massDensity"),
         param("double", "temperature")],
        is_const=True)
    x.add_method(
        "specificHeat",
        "double",
        [param("double", "massDensity"),
         param("double", "tempernature")],
        is_const=True)
    x.add_method("soundSpeed",
                 "double", [
                     param("double", "massDensity"),
                     param("double", "specificThermalEnergy")
                 ],
                 is_const=True)
    x.add_method("gamma",
                 "double", [
                     param("double", "massDensity"),
                     param("double", "specificThermalEnergy")
                 ],
                 is_const=True)
    x.add_method("bulkModulus",
                 "double", [
                     param("double", "massDensity"),
                     param("double", "specificThermalEnergy")
                 ],
                 is_const=True)
    x.add_method("entropy",
                 "double", [
                     param("double", "massDensity"),
                     param("double", "specificThermalEnergy")
                 ],
                 is_const=True)

    # Attributes.
    x.add_instance_attribute("materialNumber",
                             "int",
                             getter="materialNumber",
                             is_const=True)
    x.add_instance_attribute("numRhoVals",
                             "unsigned int",
                             getter="numRhoVals",
                             is_const=True)
    x.add_instance_attribute("numTvals",
                             "unsigned int",
                             getter="numTvals",
                             is_const=True)
    x.add_instance_attribute("rhoMin",
                             "double",
                             getter="rhoMin",
                             is_const=True)
    x.add_instance_attribute("rhoMax",
                             "double",
                             getter="rhoMax",
                             is_const=True)
    x.add_instance_attribute("Tmin", "double", getter="Tmin", is_const=True)
    x.add_instance_attribute("Tmax", "double", getter="Tmax", is_const=True)
    x.add_instance_attribute("externalPressure",
                             "double",
                             getter="externalPressure",
                             setter="externalPressure")
    x.add_instance_attribute("atomicWeight",
                             "double",
                             getter="atomicWeight",
                             is_const=True)

    return
Esempio n. 7
0
def generateTillotsonEquationOfStateBindings(x, ndim):

    # Constructors.
    x.add_constructor([param("double", "referenceDensity"),
                       param("double", "etamin"),
                       param("double", "etamax"),
                       param("double", "etamin_solid"),
                       param("double", "etamax_solid"),
                       param("double", "a"),
                       param("double", "b"),
                       param("double", "A"),
                       param("double", "B"),
                       param("double", "alpha"),
                       param("double", "beta"),
                       param("double", "eps0"),
                       param("double", "epsLiquid"),
                       param("double", "epsVapor"),
                       param("double", "atomicWeight"),
                       constrefparam("PhysicalConstants", "constants"),
                       param("double", "externalPressure", default_value="0.0"),
                       param("double", "minimumPressure", default_value="-std::numeric_limits<double>::max()"),
                       param("double", "maximumPressure", default_value="std::numeric_limits<double>::max()"),
                       param("MaterialPressureMinType", "minPressureType", default_value="MaterialPressureMinType::PressureFloor")])

    # Generic EOS interface.
    generateEquationOfStateVirtualBindings(x, ndim, False)

    # Methods.
    x.add_method("computeDPDrho", "double", [param("double", "rho"),
                                             param("double", "specificThermalEnergy")], is_const=True)
    x.add_method("computePhi", "double", [param("double", "eta"), param("double", "eps")], is_const=True)
    x.add_method("computeP1", "double", [param("double", "mu"), param("double", "P2")], is_const=True)
    x.add_method("computeP2", "double", [param("double", "phi"), param("double", "mu"), param("double", "rho"), param("double", "eps")], is_const=True)
    x.add_method("computeP4", "double", [param("double", "phi"), param("double", "mu"), param("double", "eta"), param("double", "rho"), param("double", "eps")], is_const=True)
    x.add_method("compute_dphidrho_eps", "double", [param("double", "rho0"), param("double", "eta"), param("double", "eps")], is_const=True)
    x.add_method("compute_dP1drho_eps", "double", [param("double", "rho0"), param("double", "mu"), param("double", "dP2drho_eps")], is_const=True)
    x.add_method("compute_dP2drho_eps", "double", [param("double", "phi"), param("double", "dphidrho_eps"), param("double", "rho0"), param("double", "rho"), param("double", "eps")], is_const=True)
    x.add_method("compute_dP4drho_eps", "double", [param("double", "phi"), param("double", "dphidrho_eps"), param("double", "rho0"), param("double", "eta"), param("double", "mu"), param("double", "rho"), param("double", "eps")], is_const=True)
    x.add_method("compute_dphideps_rho", "double", [param("double", "eta"), param("double", "eps")], is_const=True)
    x.add_method("compute_dP2deps_rho", "double", [param("double", "phi"), param("double", "dphideps_rho"), param("double", "rho"), param("double", "eps")], is_const=True)
    x.add_method("compute_dP4deps_rho", "double", [param("double", "phi"), param("double", "dphideps_rho"), param("double", "eta"), param("double", "rho"), param("double", "eps")], is_const=True)

    x.add_method("pressure", "double", [param("double", "massDensity"),
                                        param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("temperature", "double", [param("double", "massDensity"),
                                           param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("specificThermalEnergy", "double", [param("double", "massDensity"),
                                                     param("double", "temperature")],
                 is_const=True)
    x.add_method("specificHeat", "double", [param("double", "massDensity"),
                                            param("double", "tempernature")],
                 is_const=True)
    x.add_method("soundSpeed", "double", [param("double", "massDensity"),
                                          param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("gamma", "double", [param("double", "massDensity"),
                                     param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("bulkModulus", "double", [param("double", "massDensity"),
                                           param("double", "specificThermalEnergy")],
                 is_const=True)
    x.add_method("entropy", "double", [param("double", "massDensity"),
                                       param("double", "specificThermalEnergy")],
                 is_const=True)

    # Attributes.
    x.add_instance_attribute("etamin_solid", "double", getter="etamin_solid", setter="etamin_solid")
    x.add_instance_attribute("etamax_solid", "double", getter="etamax_solid", setter="etamax_solid")
    x.add_instance_attribute("a", "double", getter="a", setter="a")
    x.add_instance_attribute("b", "double", getter="b", setter="b")
    x.add_instance_attribute("A", "double", getter="A", setter="A")
    x.add_instance_attribute("B", "double", getter="B", setter="B")
    x.add_instance_attribute("alpha", "double", getter="alpha", setter="alpha")
    x.add_instance_attribute("beta", "double", getter="beta", setter="beta")
    x.add_instance_attribute("eps0", "double", getter="eps0", setter="eps0")
    x.add_instance_attribute("epsLiquid", "double", getter="epsLiquid", setter="epsLiquid")
    x.add_instance_attribute("epsVapor", "double", getter="epsVapor", setter="epsVapor")
    x.add_instance_attribute("atomicWeight", "double", getter="atomicWeight", setter="atomicWeight")
    x.add_instance_attribute("externalPressure", "double", getter="externalPressure", setter="externalPressure")

    return