Merge pull request #161 from PhasicFlow/develop
AB5 is added and bug is resolved when particles are being inserted
This commit is contained in:
commit
cb6d567dab
|
@ -50,7 +50,7 @@ bool intAllActive(
|
||||||
"AdamsBashforth2::correct",
|
"AdamsBashforth2::correct",
|
||||||
rpIntegration (activeRng.start(), activeRng.end()),
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
LAMBDA_HD(uint32 i){
|
LAMBDA_HD(uint32 i){
|
||||||
d_y[i] = damping*(d_y[i] + dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]));
|
d_y[i] += damping * dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]);
|
||||||
d_dy1[i] = d_dy[i];
|
d_dy1[i] = d_dy[i];
|
||||||
});
|
});
|
||||||
Kokkos::fence();
|
Kokkos::fence();
|
||||||
|
@ -80,7 +80,7 @@ bool intScattered
|
||||||
LAMBDA_HD(uint32 i){
|
LAMBDA_HD(uint32 i){
|
||||||
if( activeP(i))
|
if( activeP(i))
|
||||||
{
|
{
|
||||||
d_y[i] = damping*(d_y[i] + dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]));
|
d_y[i] += damping * dt*(static_cast<real>(1.5) * d_dy[i] - static_cast<real>(0.5) * d_dy1[i]);
|
||||||
d_dy1[i] = d_dy[i];
|
d_dy1[i] = d_dy[i];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -155,11 +155,11 @@ bool pFlow::AdamsBashforth2::correct
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if(dy1l.isAllActive())
|
if(dy1l.isAllActive())
|
||||||
{
|
{
|
||||||
success = intAllActive(dt, y.field(), dy, dy1l, damping);
|
success = intAllActive(dt, y.field(), dy, dy1(), damping);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
success = intScattered(dt, y.field(), dy, dy1l, damping);
|
success = intScattered(dt, y.field(), dy, dy1(), damping);
|
||||||
}
|
}
|
||||||
|
|
||||||
success = success && boundaryList_.correct(dt, y, dy);
|
success = success && boundaryList_.correct(dt, y, dy);
|
||||||
|
@ -177,11 +177,11 @@ bool pFlow::AdamsBashforth2::correctPStruct(
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if(dy1l.isAllActive())
|
if(dy1l.isAllActive())
|
||||||
{
|
{
|
||||||
success = intAllActive(dt, pStruct.pointPosition(), vel, dy1l);
|
success = intAllActive(dt, pStruct.pointPosition(), vel, dy1());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
success = intScattered(dt, pStruct.pointPosition(), vel, dy1l);
|
success = intScattered(dt, pStruct.pointPosition(), vel, dy1());
|
||||||
}
|
}
|
||||||
|
|
||||||
success = success && boundaryList_.correctPStruct(dt, pStruct, vel);
|
success = success && boundaryList_.correctPStruct(dt, pStruct, vel);
|
||||||
|
@ -189,7 +189,7 @@ bool pFlow::AdamsBashforth2::correctPStruct(
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth2::hearChanges
|
/*bool pFlow::AdamsBashforth2::hearChanges
|
||||||
(
|
(
|
||||||
const timeInfo &ti,
|
const timeInfo &ti,
|
||||||
const message &msg,
|
const message &msg,
|
||||||
|
@ -206,4 +206,4 @@ bool pFlow::AdamsBashforth2::hearChanges
|
||||||
return realx3PointField_D::hearChanges(ti, msg, varList);
|
return realx3PointField_D::hearChanges(ti, msg, varList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
|
@ -124,12 +124,12 @@ public:
|
||||||
pointStructure& pStruct,
|
pointStructure& pStruct,
|
||||||
realx3PointField_D& vel) override;
|
realx3PointField_D& vel) override;
|
||||||
|
|
||||||
bool hearChanges
|
/*bool hearChanges
|
||||||
(
|
(
|
||||||
const timeInfo& ti,
|
const timeInfo& ti,
|
||||||
const message& msg,
|
const message& msg,
|
||||||
const anyList& varList
|
const anyList& varList
|
||||||
) override;
|
) override;*/
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,9 @@ bool intAllActive(
|
||||||
"AdamsBashforth3::correct",
|
"AdamsBashforth3::correct",
|
||||||
rpIntegration (activeRng.start(), activeRng.end()),
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
LAMBDA_HD(uint32 i){
|
LAMBDA_HD(uint32 i){
|
||||||
d_y[i] = damping*( d_y[i]+ dt*( static_cast<real>(23.0 / 12.0) * d_dy[i]
|
d_y[i] += damping* dt*( static_cast<real>(23.0 / 12.0) * d_dy[i]
|
||||||
- static_cast<real>(16.0 / 12.0) * d_dy1[i]
|
- static_cast<real>(16.0 / 12.0) * d_dy1[i]
|
||||||
+ static_cast<real>(5.0 / 12.0) * d_dy2[i]) );
|
+ static_cast<real>(5.0 / 12.0) * d_dy2[i]) ;
|
||||||
|
|
||||||
d_dy2[i] = d_dy1[i];
|
d_dy2[i] = d_dy1[i];
|
||||||
d_dy1[i] = d_dy[i];
|
d_dy1[i] = d_dy[i];
|
||||||
|
@ -81,14 +81,14 @@ bool intScattered
|
||||||
const auto& activeP = dy1.activePointsMaskDevice();
|
const auto& activeP = dy1.activePointsMaskDevice();
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
Kokkos::parallel_for(
|
||||||
"AdamsBashforth2::correct",
|
"AdamsBashforth3::correct",
|
||||||
rpIntegration (activeRng.start(), activeRng.end()),
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
LAMBDA_HD(uint32 i){
|
LAMBDA_HD(uint32 i){
|
||||||
if( activeP(i))
|
if( activeP(i))
|
||||||
{
|
{
|
||||||
d_y[i] = damping * (d_y[i] + dt*( static_cast<real>(23.0 / 12.0) * d_dy[i]
|
d_y[i] += damping * dt*( static_cast<real>(23.0 / 12.0) * d_dy[i]
|
||||||
- static_cast<real>(16.0 / 12.0) * d_dy1[i]
|
- static_cast<real>(16.0 / 12.0) * d_dy1[i]
|
||||||
+ static_cast<real>(5.0 / 12.0) * d_dy2[i]));
|
+ static_cast<real>(5.0 / 12.0) * d_dy2[i]);
|
||||||
|
|
||||||
d_dy2[i] = d_dy1[i];
|
d_dy2[i] = d_dy1[i];
|
||||||
d_dy1[i] = d_dy[i];
|
d_dy1[i] = d_dy[i];
|
||||||
|
@ -184,7 +184,7 @@ bool pFlow::AdamsBashforth3::correctPStruct(
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth3::hearChanges
|
/*bool pFlow::AdamsBashforth3::hearChanges
|
||||||
(
|
(
|
||||||
const timeInfo &ti,
|
const timeInfo &ti,
|
||||||
const message &msg,
|
const message &msg,
|
||||||
|
@ -200,4 +200,4 @@ bool pFlow::AdamsBashforth3::hearChanges
|
||||||
{
|
{
|
||||||
return realx3PointField_D::hearChanges(ti, msg, varList);
|
return realx3PointField_D::hearChanges(ti, msg, varList);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
|
@ -108,12 +108,12 @@ public:
|
||||||
realx3PointField_D& vel) override;
|
realx3PointField_D& vel) override;
|
||||||
|
|
||||||
|
|
||||||
bool hearChanges
|
/*bool hearChanges
|
||||||
(
|
(
|
||||||
const timeInfo& ti,
|
const timeInfo& ti,
|
||||||
const message& msg,
|
const message& msg,
|
||||||
const anyList& varList
|
const anyList& varList
|
||||||
) override;
|
) override;*/
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,15 +48,15 @@ bool intAllActive(
|
||||||
auto activeRng = dy1.activeRange();
|
auto activeRng = dy1.activeRange();
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
Kokkos::parallel_for(
|
||||||
"AdamsBashforth3::correct",
|
"AdamsBashforth4::correct",
|
||||||
rpIntegration (activeRng.start(), activeRng.end()),
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
LAMBDA_HD(uint32 i){
|
LAMBDA_HD(uint32 i){
|
||||||
d_y[i] = damping *(d_y[i] + dt*(
|
d_y[i] += damping * dt*(
|
||||||
static_cast<real>(55.0 / 24.0) * d_dy[i]
|
static_cast<real>(55.0 / 24.0) * d_dy[i]
|
||||||
- static_cast<real>(59.0 / 24.0) * d_dy1[i]
|
- static_cast<real>(59.0 / 24.0) * d_dy1[i]
|
||||||
+ static_cast<real>(37.0 / 24.0) * d_dy2[i]
|
+ static_cast<real>(37.0 / 24.0) * d_dy2[i]
|
||||||
- static_cast<real>( 9.0 / 24.0) * d_dy3[i]
|
- static_cast<real>( 9.0 / 24.0) * d_dy3[i]);
|
||||||
));
|
|
||||||
d_dy3[i] = d_dy2[i];
|
d_dy3[i] = d_dy2[i];
|
||||||
d_dy2[i] = d_dy1[i];
|
d_dy2[i] = d_dy1[i];
|
||||||
d_dy1[i] = d_dy[i];
|
d_dy1[i] = d_dy[i];
|
||||||
|
@ -87,17 +87,16 @@ bool intScattered
|
||||||
const auto& activeP = dy1.activePointsMaskDevice();
|
const auto& activeP = dy1.activePointsMaskDevice();
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
Kokkos::parallel_for(
|
||||||
"AdamsBashforth2::correct",
|
"AdamsBashforth4::correct",
|
||||||
rpIntegration (activeRng.start(), activeRng.end()),
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
LAMBDA_HD(uint32 i){
|
LAMBDA_HD(uint32 i){
|
||||||
if( activeP(i))
|
if( activeP(i))
|
||||||
{
|
{
|
||||||
d_y[i] = damping* ( d_y[i] + dt*(
|
d_y[i] += damping* dt*(
|
||||||
static_cast<real>(55.0 / 24.0) * d_dy[i]
|
static_cast<real>(55.0 / 24.0) * d_dy[i]
|
||||||
- static_cast<real>(59.0 / 24.0) * d_dy1[i]
|
- static_cast<real>(59.0 / 24.0) * d_dy1[i]
|
||||||
+ static_cast<real>(37.0 / 24.0) * d_dy2[i]
|
+ static_cast<real>(37.0 / 24.0) * d_dy2[i]
|
||||||
- static_cast<real>( 9.0 / 24.0) * d_dy3[i]
|
- static_cast<real>( 9.0 / 24.0) * d_dy3[i] );
|
||||||
));
|
|
||||||
d_dy3[i] = d_dy2[i];
|
d_dy3[i] = d_dy2[i];
|
||||||
d_dy2[i] = d_dy1[i];
|
d_dy2[i] = d_dy1[i];
|
||||||
d_dy1[i] = d_dy[i];
|
d_dy1[i] = d_dy[i];
|
||||||
|
@ -133,11 +132,7 @@ pFlow::AdamsBashforth4::AdamsBashforth4
|
||||||
zero3,
|
zero3,
|
||||||
zero3
|
zero3
|
||||||
)
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void pFlow::AdamsBashforth4::updateBoundariesSlaveToMasterIfRequested()
|
void pFlow::AdamsBashforth4::updateBoundariesSlaveToMasterIfRequested()
|
||||||
{
|
{
|
||||||
|
@ -190,7 +185,7 @@ bool pFlow::AdamsBashforth4::correctPStruct(
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth4::hearChanges
|
/*bool pFlow::AdamsBashforth4::hearChanges
|
||||||
(
|
(
|
||||||
const timeInfo &ti,
|
const timeInfo &ti,
|
||||||
const message &msg,
|
const message &msg,
|
||||||
|
@ -207,4 +202,4 @@ bool pFlow::AdamsBashforth4::hearChanges
|
||||||
{
|
{
|
||||||
return realx3PointField_D::hearChanges(ti, msg, varList);
|
return realx3PointField_D::hearChanges(ti, msg, varList);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
|
@ -104,50 +104,17 @@ public:
|
||||||
pointStructure& pStruct,
|
pointStructure& pStruct,
|
||||||
realx3PointField_D& vel) override;
|
realx3PointField_D& vel) override;
|
||||||
|
|
||||||
bool hearChanges
|
/*bool hearChanges
|
||||||
(
|
(
|
||||||
const timeInfo& ti,
|
const timeInfo& ti,
|
||||||
const message& msg,
|
const message& msg,
|
||||||
const anyList& varList
|
const anyList& varList
|
||||||
) override;
|
) override;*/
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*template<typename activeFunctor>
|
|
||||||
bool pFlow::AdamsBashforth4::intRange(
|
|
||||||
real dt,
|
|
||||||
realx3Vector_D& y,
|
|
||||||
realx3Vector_D& dy,
|
|
||||||
activeFunctor activeP )
|
|
||||||
{
|
|
||||||
auto d_dy = dy.deviceViewAll();
|
|
||||||
auto d_y = y.deviceViewAll();
|
|
||||||
auto d_history = history_.deviceViewAll();
|
|
||||||
auto activeRng = activeP.activeRange();
|
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
|
||||||
"AdamsBashforth4::correct",
|
|
||||||
rpIntegration (activeRng.first, activeRng.second),
|
|
||||||
LAMBDA_HD(int32 i){
|
|
||||||
if( activeP(i))
|
|
||||||
{
|
|
||||||
|
|
||||||
d_y[i] += dt*(
|
|
||||||
static_cast<real>(55.0 / 24.0) * d_dy[i]
|
|
||||||
- static_cast<real>(59.0 / 24.0) * d_history[i].dy1_
|
|
||||||
+ static_cast<real>(37.0 / 24.0) * d_history[i].dy2_
|
|
||||||
- static_cast<real>( 9.0 / 24.0) * d_history[i].dy3_
|
|
||||||
);
|
|
||||||
d_history[i].dy3_ = d_history[i].dy2_;
|
|
||||||
d_history[i].dy2_ = d_history[i].dy1_;
|
|
||||||
d_history[i].dy1_ = d_dy[i];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Kokkos::fence();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
} // pFlow
|
} // pFlow
|
||||||
|
|
||||||
|
|
|
@ -20,93 +20,178 @@ Licence:
|
||||||
|
|
||||||
#include "AdamsBashforth5.hpp"
|
#include "AdamsBashforth5.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
|
||||||
pFlow::AdamsBashforth5::AdamsBashforth5
|
|
||||||
(
|
|
||||||
const word& baseName,
|
|
||||||
repository& owner,
|
|
||||||
const pointStructure& pStruct,
|
|
||||||
const word& method
|
|
||||||
)
|
|
||||||
:
|
|
||||||
integration(baseName, owner, pStruct, method),
|
|
||||||
history_(
|
|
||||||
owner.emplaceObject<pointField<VectorSingle,AB5History>>(
|
|
||||||
objectFile(
|
|
||||||
groupNames(baseName,"AB5History"),
|
|
||||||
"",
|
|
||||||
objectFile::READ_IF_PRESENT,
|
|
||||||
objectFile::WRITE_ALWAYS),
|
|
||||||
pStruct,
|
|
||||||
AB5History({zero3,zero3, zero3})))
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
/// Range policy for integration kernel (alias)
|
||||||
|
using rpIntegration = Kokkos::RangePolicy<
|
||||||
|
DefaultExecutionSpace,
|
||||||
|
Kokkos::Schedule<Kokkos::Static>,
|
||||||
|
Kokkos::IndexType<uint32>
|
||||||
|
>;
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth5::predict
|
bool intAllActive(
|
||||||
(
|
|
||||||
real UNUSED(dt),
|
|
||||||
realx3Vector_D& UNUSED(y),
|
|
||||||
realx3Vector_D& UNUSED(dy)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth5::correct
|
|
||||||
(
|
|
||||||
real dt,
|
real dt,
|
||||||
realx3Vector_D& y,
|
realx3Field_D& y,
|
||||||
realx3Vector_D& dy
|
realx3PointField_D& dy,
|
||||||
)
|
realx3PointField_D& dy1,
|
||||||
|
realx3PointField_D& dy2,
|
||||||
|
realx3PointField_D& dy3,
|
||||||
|
realx3PointField_D& dy4,
|
||||||
|
real damping = 1.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(this->pStruct().allActive())
|
auto d_dy = dy.deviceView();
|
||||||
{
|
auto d_y = y.deviceView();
|
||||||
return intAll(dt, y, dy, this->pStruct().activeRange());
|
auto d_dy1= dy1.deviceView();
|
||||||
}
|
auto d_dy2= dy2.deviceView();
|
||||||
else
|
auto d_dy3= dy3.deviceView();
|
||||||
{
|
auto d_dy4= dy4.deviceView();
|
||||||
return intRange(dt, y, dy, this->pStruct().activePointsMaskD());
|
auto activeRng = dy1.activeRange();
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth5::setInitialVals(
|
|
||||||
const int32IndexContainer& newIndices,
|
|
||||||
const realx3Vector& y)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pFlow::AdamsBashforth5::intAll(
|
|
||||||
real dt,
|
|
||||||
realx3Vector_D& y,
|
|
||||||
realx3Vector_D& dy,
|
|
||||||
range activeRng)
|
|
||||||
{
|
|
||||||
auto d_dy = dy.deviceViewAll();
|
|
||||||
auto d_y = y.deviceViewAll();
|
|
||||||
auto d_history = history_.deviceViewAll();
|
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
Kokkos::parallel_for(
|
||||||
"AdamsBashforth5::correct",
|
"AdamsBashforth5::correct",
|
||||||
rpIntegration (activeRng.first, activeRng.second),
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
LAMBDA_HD(int32 i){
|
LAMBDA_HD(uint32 i){
|
||||||
d_y[i] += dt*(
|
d_y[i] += damping* dt*(
|
||||||
static_cast<real>(1901.0 / 720.0) * d_dy[i]
|
static_cast<real>(1901.0 / 720.0) * d_dy[i]
|
||||||
- static_cast<real>(2774.0 / 720.0) * d_history[i].dy1_
|
- static_cast<real>(2774.0 / 720.0) * d_dy1[i]
|
||||||
+ static_cast<real>(2616.0 / 720.0) * d_history[i].dy2_
|
+ static_cast<real>(2616.0 / 720.0) * d_dy2[i]
|
||||||
- static_cast<real>(1274.0 / 720.0) * d_history[i].dy3_
|
- static_cast<real>(1274.0 / 720.0) * d_dy3[i]
|
||||||
+ static_cast<real>( 251.0 / 720.0) * d_history[i].dy4_
|
+ static_cast<real>( 251.0 / 720.0) * d_dy4[i]);
|
||||||
);
|
|
||||||
d_history[i] = {d_dy[i] ,d_history[i].dy1_, d_history[i].dy2_, d_history[i].dy3_};
|
d_dy4[i] = d_dy3[i];
|
||||||
|
d_dy3[i] = d_dy2[i];
|
||||||
|
d_dy2[i] = d_dy1[i];
|
||||||
|
d_dy1[i] = d_dy[i];
|
||||||
});
|
});
|
||||||
Kokkos::fence();
|
Kokkos::fence();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool intScattered
|
||||||
|
(
|
||||||
|
real dt,
|
||||||
|
realx3Field_D& y,
|
||||||
|
realx3PointField_D& dy,
|
||||||
|
realx3PointField_D& dy1,
|
||||||
|
realx3PointField_D& dy2,
|
||||||
|
realx3PointField_D& dy3,
|
||||||
|
realx3PointField_D& dy4,
|
||||||
|
real damping = 1.0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto d_dy = dy.deviceView();
|
||||||
|
auto d_y = y.deviceView();
|
||||||
|
auto d_dy1 = dy1.deviceView();
|
||||||
|
auto d_dy2 = dy2.deviceView();
|
||||||
|
auto d_dy3 = dy3.deviceView();
|
||||||
|
auto d_dy4 = dy4.deviceView();
|
||||||
|
auto activeRng = dy1.activeRange();
|
||||||
|
const auto& activeP = dy1.activePointsMaskDevice();
|
||||||
|
|
||||||
|
Kokkos::parallel_for(
|
||||||
|
"AdamsBashforth5::correct",
|
||||||
|
rpIntegration (activeRng.start(), activeRng.end()),
|
||||||
|
LAMBDA_HD(uint32 i){
|
||||||
|
if( activeP(i))
|
||||||
|
{
|
||||||
|
d_y[i] += damping* dt*(
|
||||||
|
static_cast<real>(1901.0 / 720.0) * d_dy[i]
|
||||||
|
- static_cast<real>(2774.0 / 720.0) * d_dy1[i]
|
||||||
|
+ static_cast<real>(2616.0 / 720.0) * d_dy2[i]
|
||||||
|
- static_cast<real>(1274.0 / 720.0) * d_dy3[i]
|
||||||
|
+ static_cast<real>( 251.0 / 720.0) * d_dy4[i]);
|
||||||
|
|
||||||
|
d_dy4[i] = d_dy3[i];
|
||||||
|
d_dy3[i] = d_dy2[i];
|
||||||
|
d_dy2[i] = d_dy1[i];
|
||||||
|
d_dy1[i] = d_dy[i];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Kokkos::fence();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pFlow::AdamsBashforth5::AdamsBashforth5
|
||||||
|
(
|
||||||
|
const word &baseName,
|
||||||
|
pointStructure &pStruct,
|
||||||
|
const word &method,
|
||||||
|
const realx3Field_D &initialValField
|
||||||
|
)
|
||||||
|
:
|
||||||
|
AdamsBashforth4(baseName, pStruct, method, initialValField),
|
||||||
|
dy4_
|
||||||
|
(
|
||||||
|
objectFile
|
||||||
|
(
|
||||||
|
groupNames(baseName,"dy4"),
|
||||||
|
pStruct.time().integrationFolder(),
|
||||||
|
objectFile::READ_IF_PRESENT,
|
||||||
|
objectFile::WRITE_ALWAYS
|
||||||
|
),
|
||||||
|
pStruct,
|
||||||
|
zero3,
|
||||||
|
zero3
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void pFlow::AdamsBashforth5::updateBoundariesSlaveToMasterIfRequested()
|
||||||
|
{
|
||||||
|
AdamsBashforth4::updateBoundariesSlaveToMasterIfRequested();
|
||||||
|
dy4_.updateBoundariesSlaveToMasterIfRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::AdamsBashforth5::correct
|
||||||
|
(
|
||||||
|
real dt,
|
||||||
|
realx3PointField_D &y,
|
||||||
|
realx3PointField_D &dy,
|
||||||
|
real damping
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
bool success = false;
|
||||||
|
if(y.isAllActive())
|
||||||
|
{
|
||||||
|
success = intAllActive(dt, y.field(), dy, dy1(), dy2(), dy3(), dy4(), damping);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
success = intScattered(dt, y.field(), dy, dy1(), dy2(), dy3(), dy4(), damping);
|
||||||
|
}
|
||||||
|
|
||||||
|
success = success && boundaryList().correct(dt, y, dy);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pFlow::AdamsBashforth5::correctPStruct
|
||||||
|
(
|
||||||
|
real dt,
|
||||||
|
pointStructure &pStruct,
|
||||||
|
realx3PointField_D &vel
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
if(dy2().isAllActive())
|
||||||
|
{
|
||||||
|
success = intAllActive(dt, pStruct.pointPosition(), vel, dy1(), dy2(), dy3(), dy4());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
success = intScattered(dt, pStruct.pointPosition(), vel, dy1(), dy2(), dy3(), dy4());
|
||||||
|
}
|
||||||
|
|
||||||
|
success = success && boundaryList().correctPStruct(dt, pStruct, vel);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,54 +22,12 @@ Licence:
|
||||||
#define __AdamsBashforth5_hpp__
|
#define __AdamsBashforth5_hpp__
|
||||||
|
|
||||||
|
|
||||||
#include "integration.hpp"
|
#include "AdamsBashforth4.hpp"
|
||||||
#include "pointFields.hpp"
|
#include "pointFields.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
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};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
INLINE_FUNCTION
|
|
||||||
iIstream& operator>>(iIstream& str, AB5History& ab5)
|
|
||||||
{
|
|
||||||
str.readBegin("AB5History");
|
|
||||||
|
|
||||||
str >> ab5.dy1_;
|
|
||||||
str >> ab5.dy2_;
|
|
||||||
str >> ab5.dy3_;
|
|
||||||
str >> ab5.dy4_;
|
|
||||||
|
|
||||||
str.readEnd("AB5History");
|
|
||||||
|
|
||||||
str.check(FUNCTION_NAME);
|
|
||||||
|
|
||||||
return str;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
INLINE_FUNCTION
|
|
||||||
iOstream& operator<<(iOstream& str, const AB5History& ab5)
|
|
||||||
{
|
|
||||||
str << token::BEGIN_LIST << ab5.dy1_
|
|
||||||
<< token::SPACE << ab5.dy2_
|
|
||||||
<< token::SPACE << ab5.dy3_
|
|
||||||
<< token::SPACE << ab5.dy4_
|
|
||||||
<< token::END_LIST;
|
|
||||||
|
|
||||||
str.check(FUNCTION_NAME);
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fifth order Adams-Bashforth integration method for solving ODE
|
* Fifth order Adams-Bashforth integration method for solving ODE
|
||||||
|
@ -78,19 +36,25 @@ iOstream& operator<<(iOstream& str, const AB5History& ab5)
|
||||||
*/
|
*/
|
||||||
class AdamsBashforth5
|
class AdamsBashforth5
|
||||||
:
|
:
|
||||||
public integration
|
public AdamsBashforth4
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class processorAB4BoundaryIntegration;
|
||||||
|
|
||||||
|
realx3PointField_D dy4_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// Integration history
|
const auto& dy4()const
|
||||||
pointField<VectorSingle,AB5History>& history_;
|
{
|
||||||
|
return dy4_;
|
||||||
|
}
|
||||||
|
|
||||||
/// Range policy for integration kernel
|
auto& dy4()
|
||||||
using rpIntegration = Kokkos::RangePolicy<
|
{
|
||||||
DefaultExecutionSpace,
|
return dy4_;
|
||||||
Kokkos::Schedule<Kokkos::Static>,
|
}
|
||||||
Kokkos::IndexType<int32>
|
|
||||||
>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -99,20 +63,19 @@ public:
|
||||||
|
|
||||||
// - Constructors
|
// - Constructors
|
||||||
|
|
||||||
|
/// Construct from components
|
||||||
AdamsBashforth5(
|
AdamsBashforth5(
|
||||||
const word& baseName,
|
const word& baseName,
|
||||||
repository& owner,
|
pointStructure& pStruct,
|
||||||
const pointStructure& pStruct,
|
const word& method,
|
||||||
const word& method);
|
const realx3Field_D& initialValField);
|
||||||
|
|
||||||
uniquePtr<integration> clone()const override
|
|
||||||
{
|
|
||||||
return makeUnique<AdamsBashforth5>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~AdamsBashforth5()=default;
|
|
||||||
|
|
||||||
/// Add this to the virtual constructor table
|
/// Destructor
|
||||||
|
~AdamsBashforth5() override =default;
|
||||||
|
|
||||||
|
/// Add a this to the virtual constructor table
|
||||||
add_vCtor(
|
add_vCtor(
|
||||||
integration,
|
integration,
|
||||||
AdamsBashforth5,
|
AdamsBashforth5,
|
||||||
|
@ -121,44 +84,29 @@ public:
|
||||||
|
|
||||||
// - Methods
|
// - Methods
|
||||||
|
|
||||||
bool predict(
|
void updateBoundariesSlaveToMasterIfRequested()override;
|
||||||
real UNUSED(dt),
|
|
||||||
realx3Vector_D & UNUSED(y),
|
/// return integration method
|
||||||
realx3Vector_D& UNUSED(dy)) override;
|
word method()const override
|
||||||
|
{
|
||||||
|
return "AdamsBashforth5";
|
||||||
|
}
|
||||||
|
|
||||||
bool correct(
|
bool correct(
|
||||||
real dt,
|
real dt,
|
||||||
realx3Vector_D & y,
|
realx3PointField_D& y,
|
||||||
realx3Vector_D& dy) override;
|
realx3PointField_D& dy,
|
||||||
|
real damping = 1.0) override;
|
||||||
|
|
||||||
bool setInitialVals(
|
bool correctPStruct(
|
||||||
const int32IndexContainer& newIndices,
|
|
||||||
const realx3Vector& y) override;
|
|
||||||
|
|
||||||
bool needSetInitialVals()const override
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Integrate on all points in the active range
|
|
||||||
bool intAll(
|
|
||||||
real dt,
|
real dt,
|
||||||
realx3Vector_D& y,
|
pointStructure& pStruct,
|
||||||
realx3Vector_D& dy,
|
realx3PointField_D& vel) override;
|
||||||
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 );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<typename activeFunctor>
|
/*template<typename activeFunctor>
|
||||||
bool pFlow::AdamsBashforth5::intRange(
|
bool pFlow::AdamsBashforth5::intRange(
|
||||||
real dt,
|
real dt,
|
||||||
realx3Vector_D& y,
|
realx3Vector_D& y,
|
||||||
|
@ -190,7 +138,7 @@ bool pFlow::AdamsBashforth5::intRange(
|
||||||
Kokkos::fence();
|
Kokkos::fence();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
} // pFlow
|
} // pFlow
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ boundaries/boundaryIntegrationList.cpp
|
||||||
AdamsBashforth2/AdamsBashforth2.cpp
|
AdamsBashforth2/AdamsBashforth2.cpp
|
||||||
AdamsBashforth3/AdamsBashforth3.cpp
|
AdamsBashforth3/AdamsBashforth3.cpp
|
||||||
AdamsBashforth4/AdamsBashforth4.cpp
|
AdamsBashforth4/AdamsBashforth4.cpp
|
||||||
#AdamsBashforth5/AdamsBashforth5.cpp
|
AdamsBashforth5/AdamsBashforth5.cpp
|
||||||
|
|
||||||
#AdamsMoulton3/AdamsMoulton3.cpp
|
#AdamsMoulton3/AdamsMoulton3.cpp
|
||||||
#AdamsMoulton4/AdamsMoulton4.cpp
|
#AdamsMoulton4/AdamsMoulton4.cpp
|
||||||
|
|
|
@ -60,9 +60,9 @@ private:
|
||||||
bool force = false) override
|
bool force = false) override
|
||||||
{
|
{
|
||||||
|
|
||||||
const auto& position = Particles().pointPosition().deviceViewAll();
|
auto position = Particles().pointPosition().deviceViewAll();
|
||||||
const auto& flags = Particles().dynPointStruct().activePointsMaskDevice();
|
auto flags = Particles().dynPointStruct().activePointsMaskDevice();
|
||||||
const auto& diam = Particles().boundingSphere().deviceViewAll();
|
auto diam = Particles().boundingSphere().deviceViewAll();
|
||||||
|
|
||||||
return ppwContactSearch_().broadSearch(
|
return ppwContactSearch_().broadSearch(
|
||||||
ti.iter(),
|
ti.iter(),
|
||||||
|
|
|
@ -22,7 +22,6 @@ Licence:
|
||||||
|
|
||||||
#include "mapperNBSKernels.hpp"
|
#include "mapperNBSKernels.hpp"
|
||||||
|
|
||||||
|
|
||||||
void pFlow::mapperNBSKernels::findPointExtends
|
void pFlow::mapperNBSKernels::findPointExtends
|
||||||
(
|
(
|
||||||
const deviceViewType1D<realx3>& points,
|
const deviceViewType1D<realx3>& points,
|
||||||
|
@ -154,6 +153,7 @@ bool pFlow::mapperNBSKernels::buildLists
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto aRange = flags.activeRange();
|
auto aRange = flags.activeRange();
|
||||||
|
auto pp = points;
|
||||||
if(flags.isAllActive() )
|
if(flags.isAllActive() )
|
||||||
{
|
{
|
||||||
Kokkos::parallel_for
|
Kokkos::parallel_for
|
||||||
|
@ -162,7 +162,7 @@ bool pFlow::mapperNBSKernels::buildLists
|
||||||
deviceRPolicyStatic(aRange.start(), aRange.end()),
|
deviceRPolicyStatic(aRange.start(), aRange.end()),
|
||||||
LAMBDA_HD(uint32 i)
|
LAMBDA_HD(uint32 i)
|
||||||
{
|
{
|
||||||
auto ind = searchCell.pointIndex(points[i]);
|
auto ind = searchCell.pointIndex(pp[i]);
|
||||||
uint32 old = Kokkos::atomic_exchange(&head(ind.x(), ind.y(), ind.z()), i);
|
uint32 old = Kokkos::atomic_exchange(&head(ind.x(), ind.y(), ind.z()), i);
|
||||||
next[i] = old;
|
next[i] = old;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ Licence:
|
||||||
template<class T, class MemorySpace>
|
template<class T, class MemorySpace>
|
||||||
bool pFlow::internalField<T, MemorySpace>::insert(const anyList& varList)
|
bool pFlow::internalField<T, MemorySpace>::insert(const anyList& varList)
|
||||||
{
|
{
|
||||||
|
|
||||||
const word eventName = message::eventName(message::ITEMS_INSERT);
|
const word eventName = message::eventName(message::ITEMS_INSERT);
|
||||||
|
|
||||||
if(!varList.checkObjectType<uint32IndexContainer>(eventName))
|
if(!varList.checkObjectType<uint32IndexContainer>(eventName))
|
||||||
|
|
|
@ -304,7 +304,8 @@ pFlow::internalPoints::insertPoints(
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//output<<" points \n"<<points<<endl;
|
||||||
|
//output<<pointPosition_<<endl;
|
||||||
if(!notify(
|
if(!notify(
|
||||||
time().TimeInfo(),
|
time().TimeInfo(),
|
||||||
msg,
|
msg,
|
||||||
|
|
Loading…
Reference in New Issue