36 int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_,
int iC_,
40 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_), iC(iC_),
41 particleLattice(static_cast<
BlockLattice<T, ADEDESCRIPTOR> *>(partners_[0])),
42 soluteLattice(static_cast<
BlockLattice<T, ADEDESCRIPTOR> *>(partners_[1])),
43 loadingLattice(static_cast<
BlockLattice<T, ADEDESCRIPTOR> *>(partners_[2])),
44 adsorptionReaction(adsorptionReaction_),
46 this->
getName() =
"AdsorptionFullCouplingPostProcessor3D";
56 int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_) {
58 int newX0, newX1, newY0, newY1, newZ0, newZ1;
60 x0, x1, y0, y1, z0, z1,
61 x0_, x1_, y0_, y1_, z0_, z1_,
62 newX0, newX1, newY0, newY1, newZ0, newZ1)) {
63 for (
int iX = newX0; iX <= newX1; ++iX) {
64 for (
int iY = newY0; iY <= newY1; ++iY) {
65 for (
int iZ = newZ0; iZ <= newZ1; ++iZ) {
67 auto vel = blockLattice.
get(iX, iY, iZ).template getField<descriptors::VELOCITY>();
68 T forceValue[3] = {0.,0.,0.};
69 if (forces.begin() != forces.end()) {
70 auto velXp = blockLattice.
get(iX+1, iY, iZ).template getField<descriptors::VELOCITY>();
71 auto velXn = blockLattice.
get(iX-1, iY, iZ).template getField<descriptors::VELOCITY>();
72 auto velYp = blockLattice.
get(iX, iY+1, iZ).template getField<descriptors::VELOCITY>();
73 auto velYn = blockLattice.
get(iX, iY-1, iZ).template getField<descriptors::VELOCITY>();
74 auto velZp = blockLattice.
get(iX, iY, iZ+1).template getField<descriptors::VELOCITY>();
75 auto velZn = blockLattice.
get(iX, iY, iZ-1).template getField<descriptors::VELOCITY>();
76 T velGrad[3] = {0., 0., 0.};
77 velGrad[0] = 0.5*(vel[0]*(velXp[0] - velXn[0]) + vel[1]*(velYp[0] - velYn[0]) + vel[2]*(velZp[0] - velZn[0]));
78 velGrad[1] = 0.5*(vel[0]*(velXp[1] - velXn[1]) + vel[1]*(velYp[1] - velYn[1]) + vel[2]*(velZp[1] - velZn[1]));
79 velGrad[2] = 0.5*(vel[0]*(velXp[2] - velXn[2]) + vel[1]*(velYp[2] - velYn[2]) + vel[2]*(velZp[2] - velZn[2]));
81 int latticeR[4] = {iC, iX, iY, iZ};
82 auto nsCell = blockLattice.
get(iX, iY, iZ);
83 auto adCell = particleLattice->get(iX, iY, iZ);
85 f.applyForce(forceValue, &nsCell, &adCell, vel.data(), latticeR);
90 for (
int i=0; i < ADEDESCRIPTOR::d; i++) {
91 newVel[i] = vel[i] + forceValue[i] - velGrad[i];
93 particleLattice->get(iX, iY, iZ).template setField<descriptors::VELOCITY>(newVel);
94 loadingLattice->get(iX, iY, iZ).template setField<descriptors::VELOCITY>(newVel);
97 particleLattice->get(iX, iY, iZ).template setField<descriptors::VELOCITY>(vel);
98 loadingLattice->get(iX, iY, iZ).template setField<descriptors::VELOCITY>(vel);
102 soluteLattice->get(iX, iY, iZ).template setField<descriptors::VELOCITY>(vel);
105 T soluteConcentration = soluteLattice->get(iX, iY, iZ).computeRho();
106 T particleConcentration = particleLattice->get(iX, iY, iZ).computeRho();
107 T particleLoading = loadingLattice->get(iX, iY, iZ).computeRho();
108 Vector<T, 2> reactionRates = adsorptionReaction->getReactionRate(soluteConcentration, particleLoading, particleConcentration);
109 loadingLattice->get(iX, iY, iZ).template setField<descriptors::SOURCE>(reactionRates[1]);
110 soluteLattice->get(iX, iY, iZ).template setField<descriptors::SOURCE>(-reactionRates[0]);
void process(BlockLattice< T, NSDESCRIPTOR > &blockLattice) override
AdsorptionFullCouplingPostProcessor3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int iC, std::vector< BlockStructureD< 3 > * > partners_, AdsorptionReaction< T, ADEDESCRIPTOR > *adsorptionReaction_, std::vector< std::reference_wrapper< AdvectionDiffusionForce3D< T, NSDESCRIPTOR, ADEDESCRIPTOR > > > forces_)
All in one adsorption coupling.
void processSubDomain(BlockLattice< T, NSDESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
AdsorptionFullCouplingPostProcessorGenerator3D(AdsorptionReaction< T, ADEDESCRIPTOR > *reaction, int x0=0, int x1=0, int y0=0, int y1=0, int z0=0, int z1=0)
LatticeCouplingGenerator3D< T, NSDESCRIPTOR > * clone() const override
PostProcessor3D< T, NSDESCRIPTOR > * generate(std::vector< BlockStructureD< 3 > * > partners) const
void addForce(AdvectionDiffusionForce3D< T, NSDESCRIPTOR, ADEDESCRIPTOR > &force)
std::string & getName()
read and write access to name
bool intersect(int x0, int x1, int y0, int y1, int x0_, int x1_, int y0_, int y1_, int &newX0, int &newX1, int &newY0, int &newY1)