# PhasicFlow: src/Integration/AdamsBashforth5/AdamsBashforth5.cpp Source File

AdamsBashforth5.cpp
Go to the documentation of this file.
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#include "AdamsBashforth5.hpp"
pFlow::AdamsBashforth5::AdamsBashforth5
(
const word& baseName,
repository& owner,
const pointStructure& pStruct,
const word& method
)
:
integration(baseName, owner, pStruct, method),
history_(
owner.emplaceObject<HistoryFieldType>(
objectFile(
groupNames(baseName,"AB5History"),
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS),
pStruct,
AB5History({zero3,zero3, zero3})))
{
}
bool pFlow::AdamsBashforth5::predict
(
real UNUSED(dt),
realx3Vector_D& UNUSED(y),
realx3Vector_D& UNUSED(dy)
)
{
return true;
}
bool pFlow::AdamsBashforth5::correct
(
real dt,
realx3Vector_D& y,
realx3Vector_D& dy
)
{
if(this->pStruct().allActive())
{
return intAll(dt, y, dy, this->pStruct().activeRange());
}
else
{
return intRange(dt, y, dy, this->pStruct().activePointsMaskD());
}
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.deviceVectorAll();
auto d_y = y.deviceVectorAll();
auto d_history = history_.deviceVectorAll();
Kokkos::parallel_for(
"AdamsBashforth5::correct",
rpIntegration (activeRng.first, activeRng.second),
LAMBDA_HD(int32 i){
d_y[i] += dt*(
static_cast< real >(1901.0 / 720.0) * d_dy[i]
- static_cast< real >(2774.0 / 720.0) * d_history[i].dy1_
+ static_cast< real >(2616.0 / 720.0) * d_history[i].dy2_
- static_cast< real >(1274.0 / 720.0) * d_history[i].dy3_
+ static_cast< real >( 251.0 / 720.0) * d_history[i].dy4_
);
d_history[i] = {d_dy[i] ,d_history[i].dy1_, d_history[i].dy2_, d_history[i].dy3_};
});
Kokkos::fence();
return true;
}
pFlow::real
float real
Definition: builtinTypes.hpp:46
UNUSED
#define UNUSED(x)
Definition: pFlowMacros.hpp:35
pFlow::AdamsBashforth5::AdamsBashforth5
AdamsBashforth5(const word &baseName, repository &owner, const pointStructure &pStruct, const word &method)
Definition: AdamsBashforth5.cpp:26
pFlow::integration
Definition: integration.hpp:35
pFlow::AdamsBashforth5::setInitialVals
bool setInitialVals(const int32IndexContainer &newIndices, const realx3Vector &y) override
Definition: AdamsBashforth5.cpp:79
AdamsBashforth5.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::zero3
const realx3 zero3(0.0)
Definition: types.hpp:97
pFlow::repository::emplaceObject
T & emplaceObject(const objectFile &objf, Args &&... args)
Definition: repositoryTemplates.cpp:38
pFlow::baseName
word baseName(const word &w, char sep='.')
Definition: bTypesFunctions.cpp:156
pFlow::AB5History
Definition: AdamsBashforth5.hpp:31
pFlow::pointField
Definition: pointField.hpp:35
pFlow::pointStructure
Definition: pointStructure.hpp:44
pFlow::AdamsBashforth5::intAll
bool intAll(real dt, realx3Vector_D &y, realx3Vector_D &dy, range activeRng)
Definition: AdamsBashforth5.cpp:86
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::AdamsBashforth5::correct
bool correct(real dt, realx3Vector_D &y, realx3Vector_D &dy) override
Definition: AdamsBashforth5.cpp:60
pFlow::VectorSingle
Definition: VectorSingle.hpp:45
pFlow::objectFile
Definition: objectFile.hpp:33
pStruct
auto & pStruct
Definition: setPointStructure.hpp:24
LAMBDA_HD
#define LAMBDA_HD
Definition: pFlowMacros.hpp:54
pFlow::groupNames
word groupNames(const word &bw, const word &tw, char sep='.')
Definition: bTypesFunctions.cpp:151
pFlow::repository
Definition: repository.hpp:34
pFlow::VectorSingle::deviceVectorAll
INLINE_FUNCTION_H viewType & deviceVectorAll()
Definition: VectorSingle.hpp:295
pFlow::Vector< realx3 >
pFlow::AdamsBashforth5::rpIntegration
Kokkos::RangePolicy< DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< int32 > > rpIntegration
Definition: AdamsBashforth5.hpp:90
pFlow::AdamsBashforth5::predict
bool predict(real UNUSED(dt), realx3Vector_D &UNUSED(y), realx3Vector_D &UNUSED(dy)) override
Definition: AdamsBashforth5.cpp:49
pFlow::range
kPair< int, int > range
Definition: KokkosTypes.hpp:54
pFlow::indexContainer< int32 >