2022-10-21 02:05:01 +03:30
|
|
|
/*------------------------------- 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.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
|
2022-12-10 01:32:54 +03:30
|
|
|
#ifndef __AdamsBashforth4_hpp__
|
|
|
|
#define __AdamsBashforth4_hpp__
|
2022-10-21 02:05:01 +03:30
|
|
|
|
|
|
|
|
2025-01-20 14:55:12 +03:30
|
|
|
#include "AdamsBashforth3.hpp"
|
2022-12-10 01:32:54 +03:30
|
|
|
#include "pointFields.hpp"
|
2025-01-20 14:55:12 +03:30
|
|
|
#include "boundaryIntegrationList.hpp"
|
2022-10-21 02:05:01 +03:30
|
|
|
|
|
|
|
|
2025-01-20 14:55:12 +03:30
|
|
|
namespace pFlow
|
2022-10-21 02:05:01 +03:30
|
|
|
{
|
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
/**
|
|
|
|
* Fourth order Adams-Bashforth integration method for solving ODE
|
|
|
|
*
|
|
|
|
* This is a one-step integration method and does not have prediction step.
|
|
|
|
*/
|
2022-10-21 02:05:01 +03:30
|
|
|
class AdamsBashforth4
|
|
|
|
:
|
2025-01-20 14:55:12 +03:30
|
|
|
public AdamsBashforth3
|
2022-10-21 02:05:01 +03:30
|
|
|
{
|
2025-01-20 14:55:12 +03:30
|
|
|
private:
|
|
|
|
|
|
|
|
friend class processorAB4BoundaryIntegration;
|
|
|
|
|
|
|
|
realx3PointField_D dy3_;
|
|
|
|
|
2022-10-21 02:05:01 +03:30
|
|
|
protected:
|
|
|
|
|
2025-01-20 14:55:12 +03:30
|
|
|
const auto& dy3()const
|
|
|
|
{
|
|
|
|
return dy3_;
|
|
|
|
}
|
2022-10-21 02:05:01 +03:30
|
|
|
|
2025-01-20 14:55:12 +03:30
|
|
|
auto& dy3()
|
|
|
|
{
|
|
|
|
return dy3_;
|
|
|
|
}
|
2022-10-21 02:05:01 +03:30
|
|
|
|
|
|
|
public:
|
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
/// Type info
|
2022-12-10 01:32:54 +03:30
|
|
|
TypeInfo("AdamsBashforth4");
|
2022-10-21 02:05:01 +03:30
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
// - Constructors
|
|
|
|
|
|
|
|
/// Construct from components
|
2022-10-21 02:05:01 +03:30
|
|
|
AdamsBashforth4(
|
|
|
|
const word& baseName,
|
2025-01-20 14:55:12 +03:30
|
|
|
pointStructure& pStruct,
|
|
|
|
const word& method,
|
|
|
|
const realx3Field_D& initialValField);
|
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
|
2022-10-21 02:05:01 +03:30
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
/// Destructor
|
2025-01-20 14:55:12 +03:30
|
|
|
~AdamsBashforth4() override =default;
|
2022-10-21 02:05:01 +03:30
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
/// Add a this to the virtual constructor table
|
2022-10-21 02:05:01 +03:30
|
|
|
add_vCtor(
|
|
|
|
integration,
|
|
|
|
AdamsBashforth4,
|
|
|
|
word);
|
|
|
|
|
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
// - Methods
|
|
|
|
|
2025-01-20 14:55:12 +03:30
|
|
|
void updateBoundariesSlaveToMasterIfRequested()override;
|
|
|
|
|
|
|
|
/// return integration method
|
|
|
|
word method()const override
|
|
|
|
{
|
|
|
|
return "AdamsBashforth4";
|
|
|
|
}
|
2022-10-21 02:05:01 +03:30
|
|
|
|
2023-04-23 12:47:12 -07:00
|
|
|
bool correct(
|
|
|
|
real dt,
|
2025-01-20 14:55:12 +03:30
|
|
|
realx3PointField_D& y,
|
2025-01-20 21:02:50 +03:30
|
|
|
realx3PointField_D& dy,
|
|
|
|
real damping = 1.0) override;
|
2025-01-20 14:55:12 +03:30
|
|
|
|
|
|
|
bool correctPStruct(
|
|
|
|
real dt,
|
|
|
|
pointStructure& pStruct,
|
|
|
|
realx3PointField_D& vel) override;
|
2022-10-21 02:05:01 +03:30
|
|
|
|
2022-10-25 19:30:57 +03:30
|
|
|
bool setInitialVals(
|
|
|
|
const int32IndexContainer& newIndices,
|
|
|
|
const realx3Vector& y) override;
|
|
|
|
|
|
|
|
bool needSetInitialVals()const override
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2025-01-20 14:55:12 +03:30
|
|
|
|
2022-10-21 02:05:01 +03:30
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2025-01-20 14:55:12 +03:30
|
|
|
/*template<typename activeFunctor>
|
2022-10-21 02:05:01 +03:30
|
|
|
bool pFlow::AdamsBashforth4::intRange(
|
|
|
|
real dt,
|
|
|
|
realx3Vector_D& y,
|
|
|
|
realx3Vector_D& dy,
|
|
|
|
activeFunctor activeP )
|
|
|
|
{
|
2024-01-29 07:57:19 -08:00
|
|
|
auto d_dy = dy.deviceViewAll();
|
|
|
|
auto d_y = y.deviceViewAll();
|
|
|
|
auto d_history = history_.deviceViewAll();
|
2022-10-21 02:05:01 +03:30
|
|
|
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_
|
|
|
|
);
|
2022-10-21 02:54:08 +03:30
|
|
|
d_history[i].dy3_ = d_history[i].dy2_;
|
|
|
|
d_history[i].dy2_ = d_history[i].dy1_;
|
|
|
|
d_history[i].dy1_ = d_dy[i];
|
2022-10-21 02:05:01 +03:30
|
|
|
}
|
|
|
|
});
|
|
|
|
Kokkos::fence();
|
|
|
|
|
|
|
|
return true;
|
2025-01-20 14:55:12 +03:30
|
|
|
}*/
|
2022-10-21 02:05:01 +03:30
|
|
|
|
|
|
|
} // pFlow
|
|
|
|
|
2022-12-10 01:32:54 +03:30
|
|
|
#endif //__integration_hpp__
|