doc for integration
This commit is contained in:
parent
ad1a948f5f
commit
06a431f689
|
@ -4,7 +4,7 @@
|
|||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||
<meta name="description" content="PhasicFlow is an open-source parallel DEM package for simulating granular flow developed in C++ and can be exectued on both GPU (like cuda) and CPU.">
|
||||
<meta name="description" content="PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.">
|
||||
<!--BEGIN PROJECT_NAME-->
|
||||
<title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||
<!--BEGIN !PROJECT_NAME-->
|
||||
|
|
|
@ -28,45 +28,68 @@ Licence:
|
|||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Second order Adams-Bashforth integration method for solving ODE
|
||||
*
|
||||
* This is a one-step integration method and does not have prediction step.
|
||||
*
|
||||
*/
|
||||
class AdamsBashforth2
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
/// dy at t-dt
|
||||
realx3PointField_D& dy1_;
|
||||
|
||||
/// Range policy for integration kernel (alias)
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
Kokkos::IndexType<int32>
|
||||
>;
|
||||
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("AdamsBashforth2");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
/// Construct from components
|
||||
AdamsBashforth2(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth2>(*this);
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
virtual ~AdamsBashforth2()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
/// Add this to the virtual constructor table
|
||||
add_vCtor(
|
||||
integration,
|
||||
AdamsBashforth2,
|
||||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
bool predict(real UNUSED(dt), realx3Vector_D& UNUSED(y), realx3Vector_D& UNUSED(dy)) override;
|
||||
// - Methods
|
||||
|
||||
bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
bool predict(
|
||||
real UNUSED(dt),
|
||||
realx3Vector_D& UNUSED(y),
|
||||
realx3Vector_D& UNUSED(dy)) override;
|
||||
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
|
@ -76,16 +99,21 @@ public:
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Integrate on all points in the active range
|
||||
bool intAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth2>(*this);
|
||||
}
|
||||
|
||||
bool intAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
|
||||
/// Integrate on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP );
|
||||
bool intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -31,26 +31,8 @@ pFlow::AdamsBashforth3::AdamsBashforth3
|
|||
)
|
||||
:
|
||||
integration(baseName, owner, pStruct, method),
|
||||
/*dy1_(
|
||||
owner.emplaceObject<realx3PointField_D>(
|
||||
objectFile(
|
||||
groupNames(baseName,"dy1"),
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
pStruct,
|
||||
zero3)),
|
||||
dy2_(
|
||||
owner.emplaceObject<realx3PointField_D>(
|
||||
objectFile(
|
||||
groupNames(baseName,"dy2"),
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
pStruct,
|
||||
zero3))*/
|
||||
history_(
|
||||
owner.emplaceObject<HistoryFieldType>(
|
||||
owner.emplaceObject<pointField<VectorSingle,AB3History>>(
|
||||
objectFile(
|
||||
groupNames(baseName,"AB3History"),
|
||||
"",
|
||||
|
|
|
@ -30,10 +30,10 @@ namespace pFlow
|
|||
|
||||
struct AB3History
|
||||
{
|
||||
TypeInfoNV("AB3History");
|
||||
|
||||
realx3 dy1_={0,0,0};
|
||||
realx3 dy2_={0,0,0};
|
||||
|
||||
TypeInfoNV("AB3History");
|
||||
};
|
||||
|
||||
|
||||
|
@ -65,21 +65,21 @@ iOstream& operator<<(iOstream& str, const AB3History& ab3)
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Third order Adams-Bashforth integration method for solving ODE
|
||||
*
|
||||
* This is a one-step integration method and does not have prediction step.
|
||||
*/
|
||||
class AdamsBashforth3
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
/// Integration history
|
||||
pointField<VectorSingle,AB3History>& history_;
|
||||
|
||||
using HistoryFieldType = pointField<VectorSingle,AB3History>;
|
||||
//realx3PointField_D& dy1_;
|
||||
|
||||
//realx3PointField_D& dy2_;
|
||||
|
||||
// this is a device
|
||||
HistoryFieldType& history_;
|
||||
|
||||
/// Range policy for integration kernel
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
|
@ -91,23 +91,32 @@ public:
|
|||
// type info
|
||||
TypeInfo("AdamsBashforth3");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
/// Construct from components
|
||||
AdamsBashforth3(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth3>(*this);
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
virtual ~AdamsBashforth3()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
/// Add this to the virtual constructor table
|
||||
add_vCtor(
|
||||
integration,
|
||||
AdamsBashforth3,
|
||||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
// - Methods
|
||||
|
||||
bool predict(
|
||||
real UNUSED(dt),
|
||||
realx3Vector_D & UNUSED(y),
|
||||
|
@ -126,18 +135,17 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth3>(*this);
|
||||
}
|
||||
|
||||
bool intAll(real dt,
|
||||
/// Integrate on all points in the active range
|
||||
bool intAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Integrate on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt,
|
||||
bool intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP );
|
||||
|
|
|
@ -32,7 +32,7 @@ pFlow::AdamsBashforth4::AdamsBashforth4
|
|||
:
|
||||
integration(baseName, owner, pStruct, method),
|
||||
history_(
|
||||
owner.emplaceObject<HistoryFieldType>(
|
||||
owner.emplaceObject<pointField<VectorSingle,AB4History>>(
|
||||
objectFile(
|
||||
groupNames(baseName,"AB4History"),
|
||||
"",
|
||||
|
|
|
@ -30,11 +30,12 @@ namespace pFlow
|
|||
|
||||
struct AB4History
|
||||
{
|
||||
TypeInfoNV("AB4History");
|
||||
|
||||
realx3 dy1_={0,0,0};
|
||||
realx3 dy2_={0,0,0};
|
||||
realx3 dy3_={0,0,0};
|
||||
|
||||
TypeInfoNV("AB4History");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,23 +69,21 @@ iOstream& operator<<(iOstream& str, const AB4History& ab4)
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fourth order Adams-Bashforth integration method for solving ODE
|
||||
*
|
||||
* This is a one-step integration method and does not have prediction step.
|
||||
*/
|
||||
class AdamsBashforth4
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
using HistoryFieldType = pointField<VectorSingle,AB4History>;
|
||||
//realx3PointField_D& dy1_;
|
||||
|
||||
//realx3PointField_D& dy2_;
|
||||
|
||||
|
||||
|
||||
// this is a device
|
||||
HistoryFieldType& history_;
|
||||
/// Integration history
|
||||
pointField<VectorSingle,AB4History>& history_;
|
||||
|
||||
/// Range policy for integration kernel
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
|
@ -93,32 +92,42 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("AdamsBashforth4");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
/// Construct from components
|
||||
AdamsBashforth4(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth4>(*this);
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
virtual ~AdamsBashforth4()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
/// Add a this to the virtual constructor table
|
||||
add_vCtor(
|
||||
integration,
|
||||
AdamsBashforth4,
|
||||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
// - Methods
|
||||
|
||||
bool predict(
|
||||
real UNUSED(dt),
|
||||
realx3Vector_D & UNUSED(y),
|
||||
realx3Vector_D& UNUSED(dy)) override;
|
||||
|
||||
bool correct(real dt,
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3Vector_D & y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
|
@ -131,18 +140,17 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth4>(*this);
|
||||
}
|
||||
|
||||
bool intAll(real dt,
|
||||
/// Integrate on all points in the active range
|
||||
bool intAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Integrate on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt,
|
||||
bool intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP );
|
||||
|
|
|
@ -32,7 +32,7 @@ pFlow::AdamsBashforth5::AdamsBashforth5
|
|||
:
|
||||
integration(baseName, owner, pStruct, method),
|
||||
history_(
|
||||
owner.emplaceObject<HistoryFieldType>(
|
||||
owner.emplaceObject<pointField<VectorSingle,AB5History>>(
|
||||
objectFile(
|
||||
groupNames(baseName,"AB5History"),
|
||||
"",
|
||||
|
|
|
@ -30,12 +30,12 @@ namespace pFlow
|
|||
|
||||
struct AB5History
|
||||
{
|
||||
TypeInfoNV("AB5History");
|
||||
|
||||
realx3 dy1_={0,0,0};
|
||||
realx3 dy2_={0,0,0};
|
||||
realx3 dy3_={0,0,0};
|
||||
realx3 dy4_={0,0,0};
|
||||
|
||||
TypeInfoNV("AB5History");
|
||||
};
|
||||
|
||||
|
||||
|
@ -71,18 +71,21 @@ iOstream& operator<<(iOstream& str, const AB5History& ab5)
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fifth order Adams-Bashforth integration method for solving ODE
|
||||
*
|
||||
* This is a one-step integration method and does not have prediction step.
|
||||
*/
|
||||
class AdamsBashforth5
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
using HistoryFieldType = pointField<VectorSingle,AB5History>;
|
||||
|
||||
// this is a device
|
||||
HistoryFieldType& history_;
|
||||
/// Integration history
|
||||
pointField<VectorSingle,AB5History>& history_;
|
||||
|
||||
/// Range policy for integration kernel
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
|
@ -91,32 +94,40 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("AdamsBashforth5");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
AdamsBashforth5(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth5>(*this);
|
||||
}
|
||||
|
||||
virtual ~AdamsBashforth5()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
/// Add this to the virtual constructor table
|
||||
add_vCtor(
|
||||
integration,
|
||||
AdamsBashforth5,
|
||||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
// - Methods
|
||||
|
||||
bool predict(
|
||||
real UNUSED(dt),
|
||||
realx3Vector_D & UNUSED(y),
|
||||
realx3Vector_D& UNUSED(dy)) override;
|
||||
|
||||
bool correct(real dt,
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3Vector_D & y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
|
@ -129,18 +140,17 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsBashforth5>(*this);
|
||||
}
|
||||
|
||||
bool intAll(real dt,
|
||||
/// Integrate on all points in the active range
|
||||
bool intAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Integrate on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt,
|
||||
bool intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP );
|
||||
|
@ -184,4 +194,4 @@ bool pFlow::AdamsBashforth5::intRange(
|
|||
|
||||
} // pFlow
|
||||
|
||||
#endif //__integration_hpp__
|
||||
#endif //
|
||||
|
|
|
@ -28,19 +28,27 @@ Licence:
|
|||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Third order Adams-Moulton integration method for solving ODE
|
||||
*
|
||||
* This is a predictor-corrector integration method.
|
||||
*/
|
||||
class AdamsMoulton3
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
/// y at time t
|
||||
realx3PointField_D& y0_;
|
||||
|
||||
/// dy at time t
|
||||
realx3PointField_D& dy0_;
|
||||
|
||||
/// dy at time t-dt
|
||||
realx3PointField_D& dy1_;
|
||||
|
||||
/// Range policy for integration kernel
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
|
@ -48,29 +56,44 @@ protected:
|
|||
>;
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("AdamsMoulton3");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
/// Construct from components
|
||||
AdamsMoulton3(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsMoulton3>(*this);
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
virtual ~AdamsMoulton3()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
/// Add this to the virtual constructor table
|
||||
add_vCtor(
|
||||
integration,
|
||||
AdamsMoulton3,
|
||||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
bool predict(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
// - Methods
|
||||
|
||||
bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
bool predict(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
|
@ -81,20 +104,35 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsMoulton3>(*this);
|
||||
}
|
||||
|
||||
bool predictAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
/// Prediction step on all points in the active range
|
||||
bool predictAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Prediction step on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool predictRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP);
|
||||
bool predictRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP);
|
||||
|
||||
bool intAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
/// Integrate on all points in the active range
|
||||
bool intAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Integrate on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP );
|
||||
bool intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP);
|
||||
|
||||
};
|
||||
|
||||
|
@ -104,7 +142,7 @@ bool AdamsMoulton3::predictRange(
|
|||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
activeFunctor activeP)
|
||||
{
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
auto d_y = y.deviceVectorAll();
|
||||
|
@ -141,7 +179,7 @@ bool pFlow::AdamsMoulton3::intRange(
|
|||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP )
|
||||
activeFunctor activeP)
|
||||
{
|
||||
|
||||
auto d_dy = dy.deviceVectorAll();
|
||||
|
@ -176,4 +214,4 @@ bool pFlow::AdamsMoulton3::intRange(
|
|||
|
||||
} // pFlow
|
||||
|
||||
#endif //__integration_hpp__
|
||||
#endif //
|
||||
|
|
|
@ -28,21 +28,30 @@ Licence:
|
|||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Fourth order Adams-Moulton integration method for solving ODE
|
||||
*
|
||||
* This is a predictor-corrector integration method.
|
||||
*/
|
||||
class AdamsMoulton4
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
/// y at time t
|
||||
realx3PointField_D& y0_;
|
||||
|
||||
/// dy at time t
|
||||
realx3PointField_D& dy0_;
|
||||
|
||||
/// dy at time t-dt
|
||||
realx3PointField_D& dy1_;
|
||||
|
||||
/// dy at time t-2*dt
|
||||
realx3PointField_D& dy2_;
|
||||
|
||||
/// Range policy for integration kernel
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
|
@ -50,29 +59,44 @@ protected:
|
|||
>;
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("AdamsMoulton4");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
/// Construct from components
|
||||
AdamsMoulton4(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsMoulton4>(*this);
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
virtual ~AdamsMoulton4()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
// Add this to the virtual constructor table
|
||||
add_vCtor(
|
||||
integration,
|
||||
AdamsMoulton4,
|
||||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
bool predict(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
// - Methods
|
||||
|
||||
bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
bool predict(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
|
@ -83,20 +107,35 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsMoulton4>(*this);
|
||||
}
|
||||
|
||||
bool predictAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
/// Prediction step on all points in the active range
|
||||
bool predictAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Prediction step on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool predictRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP);
|
||||
bool predictRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP);
|
||||
|
||||
bool intAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
/// Integrate on all points in the active range
|
||||
bool intAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Integrate on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP );
|
||||
bool intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP );
|
||||
|
||||
};
|
||||
|
||||
|
@ -182,4 +221,4 @@ bool pFlow::AdamsMoulton4::intRange(
|
|||
|
||||
} // pFlow
|
||||
|
||||
#endif //__integration_hpp__
|
||||
#endif //
|
||||
|
|
|
@ -28,23 +28,33 @@ Licence:
|
|||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Fifth order Adams-Moulton integration method for solving ODE
|
||||
*
|
||||
* This is a predictor-corrector integration method.
|
||||
*/
|
||||
class AdamsMoulton5
|
||||
:
|
||||
public integration
|
||||
{
|
||||
protected:
|
||||
|
||||
/// y at time t
|
||||
realx3PointField_D& y0_;
|
||||
|
||||
/// dy at time t
|
||||
realx3PointField_D& dy0_;
|
||||
|
||||
/// dy at time t-dt
|
||||
realx3PointField_D& dy1_;
|
||||
|
||||
/// dy at time t-2*dt
|
||||
realx3PointField_D& dy2_;
|
||||
|
||||
/// dy at time t-3*dt
|
||||
realx3PointField_D& dy3_;
|
||||
|
||||
/// Range policy for integration kernel
|
||||
using rpIntegration = Kokkos::RangePolicy<
|
||||
DefaultExecutionSpace,
|
||||
Kokkos::Schedule<Kokkos::Static>,
|
||||
|
@ -52,16 +62,24 @@ protected:
|
|||
>;
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("AdamsMoulton5");
|
||||
|
||||
//// - Constructors
|
||||
// - Constructors
|
||||
|
||||
/// Construct from components
|
||||
AdamsMoulton5(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsMoulton5>(*this);
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
virtual ~AdamsMoulton5()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
|
@ -71,10 +89,17 @@ public:
|
|||
word);
|
||||
|
||||
|
||||
//// - Methods
|
||||
bool predict(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
// - Methods
|
||||
|
||||
bool predict(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) override;
|
||||
bool correct(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy) override;
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
|
@ -85,20 +110,35 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
uniquePtr<integration> clone()const override
|
||||
{
|
||||
return makeUnique<AdamsMoulton5>(*this);
|
||||
}
|
||||
|
||||
bool predictAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
/// Prediction step on all points in the active range
|
||||
bool predictAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Prediction step on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool predictRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP);
|
||||
bool predictRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP);
|
||||
|
||||
bool intAll(real dt, realx3Vector_D& y, realx3Vector_D& dy, range activeRng);
|
||||
/// Integrate on all points in the active range
|
||||
bool intAll(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
range activeRng);
|
||||
|
||||
/// Integrate on active points in the active range
|
||||
template<typename activeFunctor>
|
||||
bool intRange(real dt, realx3Vector_D& y, realx3Vector_D& dy, activeFunctor activeP );
|
||||
bool intRange(
|
||||
real dt,
|
||||
realx3Vector_D& y,
|
||||
realx3Vector_D& dy,
|
||||
activeFunctor activeP );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -31,32 +31,71 @@ Licence:
|
|||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Base class for integrating the first order ODE (IVP)
|
||||
*
|
||||
* The ODE should be in the following form:
|
||||
*\f[
|
||||
\frac{dy}{dt} = f(y,t)
|
||||
\f]
|
||||
* for example the equation of motion is in the following form:
|
||||
*\f[
|
||||
m\frac{d\vec{v}}{dt} = m\vec{g} + \sum \vec{f_c}(\vec{v},t)
|
||||
\f]
|
||||
*
|
||||
* The integration method can be either one-step or predictor-corrector type.
|
||||
*
|
||||
*/
|
||||
class integration
|
||||
{
|
||||
protected:
|
||||
|
||||
repository& owner_;
|
||||
// - Protected data members
|
||||
|
||||
const word baseName_;
|
||||
/// The owner repository that all fields are storred in
|
||||
repository& owner_;
|
||||
|
||||
const pointStructure& pStruct_;
|
||||
/// The base name for integration
|
||||
const word baseName_;
|
||||
|
||||
/// A reference to pointStructure
|
||||
const pointStructure& pStruct_;
|
||||
|
||||
public:
|
||||
|
||||
// type info
|
||||
/// Type info
|
||||
TypeInfo("integration");
|
||||
|
||||
//// - Constructors
|
||||
|
||||
// - Constructors
|
||||
|
||||
/// Construct from components
|
||||
integration(
|
||||
const word& baseName,
|
||||
repository& owner,
|
||||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
/// Copy constructor
|
||||
integration(const integration&) = default;
|
||||
|
||||
/// Move constructor
|
||||
integration(integration&&) = default;
|
||||
|
||||
/// Copy assignment
|
||||
integration& operator = (const integration&) = default;
|
||||
|
||||
/// Move assignment
|
||||
integration& operator = (integration&&) = default;
|
||||
|
||||
/// Polymorphic copy/cloning
|
||||
virtual
|
||||
uniquePtr<integration> clone()const=0;
|
||||
|
||||
/// Destructor
|
||||
virtual ~integration()=default;
|
||||
|
||||
// - add a virtual constructor
|
||||
/// Add a virtual constructor
|
||||
create_vCtor(
|
||||
integration,
|
||||
word,
|
||||
|
@ -67,35 +106,49 @@ public:
|
|||
(baseName, owner, pStruct, method) );
|
||||
|
||||
|
||||
//// - Methods
|
||||
// - Methods
|
||||
|
||||
/// Const ref to pointStructure
|
||||
inline
|
||||
const auto& pStruct()const
|
||||
{
|
||||
return pStruct_;
|
||||
}
|
||||
|
||||
virtual bool predict(real dt, realx3Vector_D& y, realx3Vector_D& dy) = 0;
|
||||
|
||||
virtual bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) = 0;
|
||||
|
||||
virtual bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y) = 0;
|
||||
|
||||
virtual bool needSetInitialVals()const = 0;
|
||||
|
||||
virtual uniquePtr<integration> clone()const=0;
|
||||
|
||||
/// Base name
|
||||
inline
|
||||
const word& baseName()const
|
||||
{
|
||||
return baseName_;
|
||||
}
|
||||
|
||||
/// Ref to the owner repository
|
||||
inline
|
||||
repository& owner()
|
||||
{
|
||||
return owner_;
|
||||
}
|
||||
|
||||
/// Prediction step in integration
|
||||
virtual
|
||||
bool predict(real dt, realx3Vector_D& y, realx3Vector_D& dy) = 0;
|
||||
|
||||
/// Correction/main integration step
|
||||
virtual
|
||||
bool correct(real dt, realx3Vector_D& y, realx3Vector_D& dy) = 0;
|
||||
|
||||
/// Set the initial values for new indices
|
||||
virtual
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y) = 0;
|
||||
|
||||
/// Check if the method requires any set initial vals
|
||||
virtual
|
||||
bool needSetInitialVals()const = 0;
|
||||
|
||||
|
||||
/// Create the polymorphic object based on inputs
|
||||
static
|
||||
uniquePtr<integration> create(
|
||||
const word& baseName,
|
||||
|
@ -103,7 +156,7 @@ public:
|
|||
const pointStructure& pStruct,
|
||||
const word& method);
|
||||
|
||||
};
|
||||
}; // integration
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/*------------------------------- phasicFlow ---------------------------------
|
||||
O C enter of
|
||||
O O E ngineering and
|
||||
O O M ultiscale modeling of
|
||||
OOOOOOO F luid flow
|
||||
------------------------------------------------------------------------------
|
||||
Copyright (C): www.cemf.ir
|
||||
email: hamid.r.norouzi AT gmail.com
|
||||
------------------------------------------------------------------------------
|
||||
Licence:
|
||||
This file is part of phasicFlow code. It is a free software for simulating
|
||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||
the terms of GNU General Public License v3 or any other later versions.
|
||||
|
||||
phasicFlow is distributed to help others in their research in the field of
|
||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __integrations_hpp__
|
||||
#define __integrations_hpp__
|
||||
|
||||
#include "integration.hpp"
|
||||
#include "AdamsBashforth2.hpp"
|
||||
#include "AdamsBashforth3.hpp"
|
||||
|
||||
#endif
|
|
@ -24,7 +24,7 @@ Licence:
|
|||
|
||||
#include "Time.hpp"
|
||||
#include "pointFields.hpp"
|
||||
#include "integrations.hpp"
|
||||
#include "integration.hpp"
|
||||
#include "uniquePtr.hpp"
|
||||
|
||||
namespace pFlow
|
||||
|
@ -57,17 +57,6 @@ public:
|
|||
|
||||
dynamicPointStructure(const dynamicPointStructure& ps) = default;
|
||||
|
||||
/*dynamicPointStructure(const dynamicPointStructure& ps):
|
||||
pointStructure(ps),
|
||||
time_(ps.time_),
|
||||
integrationMethod_(ps.integrationMethod_),
|
||||
velocity_(ps.velocity_),
|
||||
integrationPos_(ps.integrationPos_->clone()),
|
||||
integrationVel_(ps.integrationVel_->clone())
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
// - no move construct
|
||||
dynamicPointStructure(dynamicPointStructure&&) = delete;
|
||||
|
|
|
@ -28,70 +28,132 @@ Licence:
|
|||
namespace pFlow
|
||||
{
|
||||
|
||||
/**
|
||||
* A base class for every main component of DEM system.
|
||||
*
|
||||
* This class provides abstraction at a very high level for any solver/utility
|
||||
* that forces the derived component (i.e. particles, geometry, and etc) to
|
||||
* advance over time when iterate is called in time a loop.
|
||||
*
|
||||
*/
|
||||
class demComponent
|
||||
{
|
||||
protected:
|
||||
|
||||
word componentName_;
|
||||
// - Protected data members
|
||||
|
||||
/// Name of the DEM component
|
||||
word componentName_;
|
||||
|
||||
systemControl& control_;
|
||||
/// Reference to systemControl
|
||||
systemControl& control_;
|
||||
|
||||
|
||||
Timers timers_;
|
||||
/// All timers (if any) of this component
|
||||
Timers timers_;
|
||||
|
||||
public:
|
||||
|
||||
/// Type info
|
||||
TypeInfo("demComponent");
|
||||
|
||||
demComponent(const word& name, systemControl& control)
|
||||
:
|
||||
componentName_(name),
|
||||
control_(control),
|
||||
timers_(name, &control.timers())
|
||||
{}
|
||||
// - Constructors
|
||||
|
||||
/// construct from components
|
||||
demComponent(const word& name, systemControl& control)
|
||||
:
|
||||
componentName_(name),
|
||||
control_(control),
|
||||
timers_(name, &control.timers())
|
||||
{}
|
||||
|
||||
virtual ~demComponent() = default;
|
||||
/// No copy constructor
|
||||
demComponent(const demComponent&) = delete;
|
||||
|
||||
/// No move constructor
|
||||
demComponent(demComponent&&) = delete;
|
||||
|
||||
const auto& control()const
|
||||
{
|
||||
return control_;
|
||||
}
|
||||
/// No copy assignment
|
||||
demComponent& operator = (const demComponent&) = delete;
|
||||
|
||||
auto& control()
|
||||
{
|
||||
return control_;
|
||||
}
|
||||
/// No move assignment
|
||||
demComponent& operator =(demComponent&&) = delete;
|
||||
|
||||
inline
|
||||
real dt()const
|
||||
{
|
||||
return control_.time().dt();
|
||||
}
|
||||
/// destructor
|
||||
virtual ~demComponent() = default;
|
||||
|
||||
inline
|
||||
real currentTime()const
|
||||
{
|
||||
return control_.time().currentTime();
|
||||
}
|
||||
|
||||
// - Member functions
|
||||
|
||||
auto& timers(){
|
||||
return timers_;
|
||||
}
|
||||
/// Const ref to systemControl
|
||||
inline
|
||||
const auto& control()const
|
||||
{
|
||||
return control_;
|
||||
}
|
||||
|
||||
const auto& timers() const{
|
||||
return timers_;
|
||||
}
|
||||
/// Ref to systemControl
|
||||
inline
|
||||
auto& control()
|
||||
{
|
||||
return control_;
|
||||
}
|
||||
|
||||
/// Time step of integration
|
||||
inline
|
||||
real dt()const
|
||||
{
|
||||
return control_.time().dt();
|
||||
}
|
||||
|
||||
virtual bool beforeIteration() = 0;
|
||||
/// Current simulation time
|
||||
inline
|
||||
real currentTime()const
|
||||
{
|
||||
return control_.time().currentTime();
|
||||
}
|
||||
|
||||
/// Const ref to timers
|
||||
inline
|
||||
const auto& timers() const
|
||||
{
|
||||
return timers_;
|
||||
}
|
||||
|
||||
virtual bool iterate() = 0;
|
||||
/// Ref to timers
|
||||
inline
|
||||
auto& timers()
|
||||
{
|
||||
return timers_;
|
||||
}
|
||||
|
||||
/// This is called before the start of time loop
|
||||
virtual
|
||||
bool beforeTimeLoop()
|
||||
{
|
||||
notImplementedFunction;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool afterIteration() = 0;
|
||||
/// This is called in time loop, before iterate
|
||||
virtual
|
||||
bool beforeIteration() = 0;
|
||||
|
||||
/// This is called in time loop. Perform the main calculations
|
||||
/// when the component should evolve along time.
|
||||
virtual
|
||||
bool iterate() = 0;
|
||||
|
||||
/// This is called in time loop, after iterate.
|
||||
virtual
|
||||
bool afterIteration() = 0;
|
||||
|
||||
/// This is called after the time loop
|
||||
virtual
|
||||
bool afterTimeLoop()
|
||||
{
|
||||
notImplementedFunction;
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue