Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(_${COMPONENT_NAME}_cu_sources
set(python_files
__init__.py
bond.py
flow.py
pair.py
)

Expand Down
83 changes: 83 additions & 0 deletions src/ConstantFlow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) 2018-2020, Michael P. Howard
// Copyright (c) 2021-2024, Auburn University
// Part of azplugins, released under the BSD 3-Clause License.

#ifndef AZPLUGINS_CONSTANT_FLOW_H_
#define AZPLUGINS_CONSTANT_FLOW_H_

#include "hoomd/HOOMDMath.h"

#ifdef __HIPCC__
#define HOSTDEVICE __host__ __device__
#else
#define HOSTDEVICE
#include <pybind11/pybind11.h>
#endif
namespace hoomd
{
namespace azplugins
{

//! Position-independent flow along a vector
class ConstantFlow
{
public:
//! Constructor
/*!
*\param U_ Flow field
*/
ConstantFlow(Scalar3 U_) : U(U_) { }
//! Evaluate the flow field
/*!
* \param r position to evaluate flow
*
* This is just a constant, independent of \a r.
*/
HOSTDEVICE Scalar3 operator()(const Scalar3& r) const
{
return U;
}

HOSTDEVICE Scalar3 getVelocity() const
{
return U;
}

HOSTDEVICE void setVelocity(const Scalar3& U_)
{
U = U_;
}

private:
Scalar3 U; //!< Flow field
};

namespace detail
{
void export_ConstantFlow(pybind11::module& m)
{
namespace py = pybind11;
py::class_<ConstantFlow, std::shared_ptr<ConstantFlow>>(m, "ConstantFlow")
.def(py::init<Scalar3>())
.def_property(
"mean_velocity",
[](const ConstantFlow& U)
{
const auto field = U.getVelocity();
return pybind11::make_tuple(field.x, field.y, field.z);
},
[](ConstantFlow& U, const pybind11::tuple& field)
{
U.setVelocity(make_scalar3(pybind11::cast<Scalar>(field[0]),
pybind11::cast<Scalar>(field[1]),
pybind11::cast<Scalar>(field[2])));
});
}
} // end namespace detail

} // namespace azplugins
} // namespace hoomd

#undef HOSTDEVICE

#endif // AZPLUGINS_CONSTANT_FLOW_H_
153 changes: 0 additions & 153 deletions src/FlowFields.h

This file was deleted.

85 changes: 85 additions & 0 deletions src/ParabolicFlow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2018-2020, Michael P. Howard
// Copyright (c) 2021-2024, Auburn University
// Part of azplugins, released under the BSD 3-Clause License.

/*!
* \file ParabolicFlow.h
* \brief Declaration of ParabolicFlow
*/

#ifndef AZPLUGINS_PARABOLIC_FLOW_H_
#define AZPLUGINS_PARABOLIC_FLOW_H_

#include "hoomd/HOOMDMath.h"

#ifdef __HIPCC__
#define HOSTDEVICE __host__ __device__
#else
#define HOSTDEVICE
#include <pybind11/pybind11.h>
#endif
namespace hoomd
{
namespace azplugins
{
class ParabolicFlow
{
public:
//! Construct parabolic flow profile
/*!
* \param U_ Mean velocity
* \param L_ Separation
*/
ParabolicFlow(Scalar U_, Scalar L_) : Umax(Scalar(1.5) * U_), L(Scalar(0.5) * L_) { }

//! Evaluate the flow field
/*!
* \param r position to evaluate flow
*/
HOSTDEVICE Scalar3 operator()(const Scalar3& r) const
{
const Scalar zr = (r.z / L);
return make_scalar3(Umax * (1. - zr * zr), 0.0, 0.0);
}

HOSTDEVICE Scalar getVelocity() const
{
return Scalar(0.6666666667) * Umax;
}

HOSTDEVICE void setVelocity(const Scalar& U)
{
Umax = Scalar(1.5) * U;
}

HOSTDEVICE Scalar getLength() const
{
return Scalar(2.0) * L;
}

HOSTDEVICE void setLength(const Scalar& L_)
{
L = Scalar(0.5) * L_;
}

private:
Scalar Umax; //<! Mean velocity
Scalar L; //!< Full width
};

namespace detail
{
void export_ParabolicFlow(pybind11::module& m)
{
namespace py = pybind11;
py::class_<ParabolicFlow, std::shared_ptr<ParabolicFlow>>(m, "ParabolicFlow")
.def(py::init<Scalar, Scalar>())
.def_property("mean_velocity", &ParabolicFlow::getVelocity, &ParabolicFlow::setVelocity)
.def_property("separation", &ParabolicFlow::getLength, &ParabolicFlow::setLength);
}
} // namespace detail
} // namespace azplugins
} // namespace hoomd
#undef HOSTDEVICE

#endif // AZPLUGINS_PARABOLIC_FLOW_H_
19 changes: 12 additions & 7 deletions src/RNGIdentifiers.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@
#ifndef AZPLUGINS_RNG_IDENTIFIERS_H_
#define AZPLUGINS_RNG_IDENTIFIERS_H_

#include <cstdint>

namespace hoomd
{
namespace azplugins
{

namespace detail
{
struct RNGIdentifier
{
// hoomd's identifiers, changed by +/- 1
static const uint32_t DPDEvaluatorGeneralWeight = 0x4a84f5d1;
static const uint32_t TwoStepBrownianFlow = 0x431287fe;
static const uint32_t TwoStepLangevinFlow = 0x89abcdee;
static const uint32_t ParticleEvaporator = 0x3eb8536f;
static const uint8_t DPDEvaluatorGeneralWeight = 200;
static const uint8_t TwoStepBrownianFlow = 201;
static const uint8_t TwoStepLangevinFlow = 202;
static const uint8_t ParticleEvaporator = 203;
};

} // end namespace detail
} // end namespace azplugins
} // end namespace hoomd

#endif // AZPLUGINS_RNG_IDENTIFIERS_H_
Loading