mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
All messages are revisited for internal points and boundaries
This commit is contained in:
@ -114,8 +114,11 @@ pFlow::AdamsBashforth2::AdamsBashforth2
|
||||
zero3,
|
||||
zero3
|
||||
),
|
||||
initialValField_(initialValField),
|
||||
boundaryList_(pStruct, method, *this)
|
||||
{}
|
||||
{
|
||||
realx3PointField_D::addEvent(message::ITEMS_INSERT);
|
||||
}
|
||||
|
||||
void pFlow::AdamsBashforth2::updateBoundariesSlaveToMasterIfRequested()
|
||||
{
|
||||
@ -186,11 +189,21 @@ bool pFlow::AdamsBashforth2::correctPStruct(
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::AdamsBashforth2::setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y)
|
||||
bool pFlow::AdamsBashforth2::hearChanges
|
||||
(
|
||||
const timeInfo &ti,
|
||||
const message &msg,
|
||||
const anyList &varList
|
||||
)
|
||||
{
|
||||
return true;
|
||||
if(msg.equivalentTo(message::ITEMS_INSERT))
|
||||
{
|
||||
|
||||
return insertValues(varList, initialValField_.deviceViewAll(), dy1());
|
||||
}
|
||||
else
|
||||
{
|
||||
return realx3PointField_D::hearChanges(ti, msg, varList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@ class AdamsBashforth2
|
||||
{
|
||||
private:
|
||||
|
||||
const realx3Field_D& initialValField_;
|
||||
|
||||
boundaryIntegrationList boundaryList_;
|
||||
|
||||
friend class processorAB2BoundaryIntegration;
|
||||
@ -57,6 +59,11 @@ protected:
|
||||
return static_cast<realx3PointField_D&>(*this);
|
||||
}
|
||||
|
||||
auto& initialValField()
|
||||
{
|
||||
return initialValField_;
|
||||
}
|
||||
|
||||
boundaryIntegrationList& boundaryList()
|
||||
{
|
||||
return boundaryList_;
|
||||
@ -116,25 +123,13 @@ public:
|
||||
real dt,
|
||||
pointStructure& pStruct,
|
||||
realx3PointField_D& vel) override;
|
||||
|
||||
|
||||
/*bool hearChanges
|
||||
bool hearChanges
|
||||
(
|
||||
real t,
|
||||
real dt,
|
||||
uint32 iter,
|
||||
const timeInfo& ti,
|
||||
const message& msg,
|
||||
const anyList& varList
|
||||
) override;*/
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y) override;
|
||||
|
||||
bool needSetInitialVals()const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -184,35 +184,20 @@ bool pFlow::AdamsBashforth3::correctPStruct(
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::AdamsBashforth3::setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y)
|
||||
bool pFlow::AdamsBashforth3::hearChanges
|
||||
(
|
||||
const timeInfo &ti,
|
||||
const message &msg,
|
||||
const anyList &varList
|
||||
)
|
||||
{
|
||||
return true;
|
||||
if(msg.equivalentTo(message::ITEMS_INSERT))
|
||||
{
|
||||
return insertValues(varList, initialValField().deviceViewAll(), dy1()) &&
|
||||
insertValues(varList, initialValField().deviceViewAll(), dy2());
|
||||
}
|
||||
else
|
||||
{
|
||||
return realx3PointField_D::hearChanges(ti, msg, varList);
|
||||
}
|
||||
}
|
||||
|
||||
/*bool pFlow::AdamsBashforth3::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(
|
||||
"AdamsBashforth3::correct",
|
||||
rpIntegration (activeRng.first, activeRng.second),
|
||||
LAMBDA_HD(int32 i){
|
||||
auto ldy = d_dy[i];
|
||||
d_y[i] += dt*( static_cast<real>(23.0 / 12.0) * ldy
|
||||
- static_cast<real>(16.0 / 12.0) * d_history[i].dy1_
|
||||
+ static_cast<real>(5.0 / 12.0) * d_history[i].dy2_);
|
||||
d_history[i] = {ldy ,d_history[i].dy1_};
|
||||
});
|
||||
Kokkos::fence();
|
||||
|
||||
return true;
|
||||
}*/
|
@ -108,23 +108,12 @@ public:
|
||||
realx3PointField_D& vel) override;
|
||||
|
||||
|
||||
/*bool hearChanges
|
||||
bool hearChanges
|
||||
(
|
||||
real t,
|
||||
real dt,
|
||||
uint32 iter,
|
||||
const timeInfo& ti,
|
||||
const message& msg,
|
||||
const anyList& varList
|
||||
) override;*/
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y) override;
|
||||
|
||||
bool needSetInitialVals()const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -190,40 +190,21 @@ bool pFlow::AdamsBashforth4::correctPStruct(
|
||||
return success;
|
||||
}
|
||||
|
||||
bool pFlow::AdamsBashforth4::setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y)
|
||||
bool pFlow::AdamsBashforth4::hearChanges
|
||||
(
|
||||
const timeInfo &ti,
|
||||
const message &msg,
|
||||
const anyList &varList
|
||||
)
|
||||
{
|
||||
return true;
|
||||
if(msg.equivalentTo(message::ITEMS_INSERT))
|
||||
{
|
||||
return insertValues(varList, initialValField().deviceViewAll(), dy1()) &&
|
||||
insertValues(varList, initialValField().deviceViewAll(), dy2()) &&
|
||||
insertValues(varList, initialValField().deviceViewAll(), dy3());
|
||||
}
|
||||
else
|
||||
{
|
||||
return realx3PointField_D::hearChanges(ti, msg, varList);
|
||||
}
|
||||
}
|
||||
|
||||
/*bool pFlow::AdamsBashforth4::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(
|
||||
"AdamsBashforth4::correct",
|
||||
rpIntegration (activeRng.first, activeRng.second),
|
||||
LAMBDA_HD(int32 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;
|
||||
}*/
|
@ -103,17 +103,13 @@ public:
|
||||
real dt,
|
||||
pointStructure& pStruct,
|
||||
realx3PointField_D& vel) override;
|
||||
|
||||
bool setInitialVals(
|
||||
const int32IndexContainer& newIndices,
|
||||
const realx3Vector& y) override;
|
||||
|
||||
bool needSetInitialVals()const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool hearChanges
|
||||
(
|
||||
const timeInfo& ti,
|
||||
const message& msg,
|
||||
const anyList& varList
|
||||
) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -51,9 +51,7 @@ public:
|
||||
);
|
||||
|
||||
bool hearChanges(
|
||||
real t,
|
||||
real dt,
|
||||
uint32 iter,
|
||||
const timeInfo& ti,
|
||||
const message &msg,
|
||||
const anyList &varList) override
|
||||
{
|
||||
|
@ -22,17 +22,39 @@ Licence:
|
||||
#include "pointStructure.hpp"
|
||||
#include "repository.hpp"
|
||||
|
||||
pFlow::integration::integration
|
||||
bool pFlow::integration::insertValues
|
||||
(
|
||||
const word& baseName,
|
||||
pointStructure& pStruct,
|
||||
const word&,
|
||||
const realx3Field_D&
|
||||
const anyList& varList,
|
||||
const deviceViewType1D<realx3>& srcVals,
|
||||
realx3PointField_D& dstFeild
|
||||
)
|
||||
:
|
||||
owner_(*pStruct.owner()),
|
||||
pStruct_(pStruct),
|
||||
baseName_(baseName)
|
||||
{
|
||||
const word eventName = message::eventName(message::ITEMS_INSERT);
|
||||
|
||||
if(!varList.checkObjectType<uint32IndexContainer>(eventName))
|
||||
{
|
||||
fatalErrorInFunction<<"Insertion failed in integration for "<< baseName_<<
|
||||
", variable "<< eventName <<
|
||||
" does not exist or the type is incorrect"<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& indices = varList.getObject<uint32IndexContainer>(
|
||||
eventName);
|
||||
|
||||
dstFeild.field().insertSetElement(indices, srcVals);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::integration::integration(
|
||||
const word &baseName,
|
||||
pointStructure &pStruct,
|
||||
const word &,
|
||||
const realx3Field_D &)
|
||||
: owner_(*pStruct.owner()),
|
||||
pStruct_(pStruct),
|
||||
baseName_(baseName)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -63,6 +63,13 @@ private:
|
||||
/// The base name for integration
|
||||
const word baseName_;
|
||||
|
||||
protected:
|
||||
|
||||
bool insertValues(
|
||||
const anyList& varList,
|
||||
const deviceViewType1D<realx3>& srcVals,
|
||||
realx3PointField_D& dstFeild);
|
||||
|
||||
public:
|
||||
|
||||
/// Type info
|
||||
@ -151,17 +158,6 @@ public:
|
||||
virtual
|
||||
bool correctPStruct(real dt, pointStructure& pStruct, realx3PointField_D& vel) = 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(
|
||||
|
Reference in New Issue
Block a user