MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lblpt.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef LBLPT_H_
8#define LBLPT_H_
9
10#include "LPT/lpt.h"
11#include "coupling.h"
12#include "couplinglpt.h"
13#include "solver.h"
14
15// Forward declarations
16template <MInt nDim>
18
19class LbSolverD2Q9;
20template <MInt nDim, MInt nDist, class SysEqn>
21class LbSolverDxQy;
22template <MInt nDim, MInt nDist, class SysEqn>
23class CouplingLB;
24
25namespace maia {
26namespace lblpt {} // namespace lblpt
27} // namespace maia
28
29template <MInt nDim, MInt nDist, class SysEqn>
30class LbLpt : public CouplingLpt<nDim, CouplingLB<nDim, nDist, SysEqn>> {
31 public:
33 using LbSolver = typename BaseLb::solverType;
34
38
39 // Constructor
40 LbLpt(const MInt couplingId, LPT<nDim>* particle, LbSolver* lb);
41
42 protected:
43 LPT<nDim>& lpt() const override { return *m_particle; }
44
47 using BaseLb::a_Ma;
50 using BaseLb::lbBndCnd;
51 using BaseLb::lbSolver;
52
53 using typename BaseLptX::ConversionFactor;
54
57
58 public:
59 void init() override;
60 void finalizeCouplerInit() override;
61 void finalizeSubCoupleInit(MInt /*unused*/) override{};
62
63 void preCouple(MInt) override;
64 void postCouple(MInt) override;
65
66 void finalizeBalance(const MInt /*unused*/) override;
67 void balancePre() override{};
68
69 void cleanUp() override{};
70
71 // pass-through calls in the LPT-solver
72 // TODO: remove these coupler calls in the next step!
73 MFloat a_lbVariable(const MInt lptCellId, const MInt varId, const MInt mode) {
74 MInt lbCellId = lpt2lbIdParent(lptCellId);
75 if(lbCellId < 0 || lbCellId > lbSolver().a_noCells()) return -99;
76 if(mode == 0) {
77 return lbSolver().a_variable(lbCellId, varId);
78 } else {
79 return lbSolver().a_oldVariable(lbCellId, varId);
80 }
81 }
82
83 MFloat a_lbCellCoordinate(const MInt lptCellId, const MInt dir) {
84 MInt lbCellId = lpt2lbIdParent(lptCellId);
85 if(lbCellId < 0 || lbCellId > lbSolver().a_noCells()) return -99;
86 return lbSolver().a_coordinate(lbCellId, dir);
87 }
88
89 private:
90 void checkProperties() override;
92 void initData();
96
97 void updateLbSolver();
98
99 // void updateFractions();
100 // void updateForcing();
101 void updateLPTBndry();
102 void transferFlowField();
103 void transferCellStatus();
104 void transferTimeStep();
105
107
108 MInt lpt2lbId(const MInt lptId) { return convertId(lpt(), lbSolver(), lptId); };
109 MInt lpt2lbIdParent(const MInt lptId) { return convertIdParent(lpt(), lbSolver(), lptId); };
110 MInt lb2lptId(const MInt lbId) { return convertId(lbSolver(), lpt(), lbId); };
111 MInt lb2lptIdParent(const MInt lbId) { return convertIdParent(lbSolver(), lpt(), lbId); };
112
115
120 std::array<MFloat, 2 * nDim> m_gridBoundaries{};
121
122 // Properties
126};
127
128#endif // ifndef LBLPT_H_
LbSolverDxQy< nDim, nDist, SysEqn > solverType
Definition: coupling.h:430
MFloat a_cellLengthAtLevel(MInt level, const MInt id=0)
Definition: coupling.h:518
MInt a_noBndCells(const MInt id=0)
Definition: coupling.h:539
MInt a_bndCellId(const MInt bndCell, const MInt id=0)
Definition: coupling.h:537
solverType & lbSolver(const MInt solverId=0) const
Definition: coupling.h:454
MInt a_noCells(const MInt id=0) const
Definition: coupling.h:516
MFloat a_Ma(const MInt id=0) const
Definition: coupling.h:472
LbBndCnd & lbBndCnd(const MInt id=0)
Definition: coupling.h:461
LPT< nDim > solverType
Definition: coupling.h:560
Definition: lpt.h:82
Definition: lblpt.h:30
void preCouple(MInt) override
Coupling before each solver.
Definition: lblpt.cpp:302
LPT< nDim > & lpt() const override
Definition: lblpt.h:43
LbSolver * m_lbSolver
Definition: lblpt.h:114
MInt lb2lptIdParent(const MInt lbId)
Definition: lblpt.h:111
MInt lb2lptId(const MInt lbId)
Definition: lblpt.h:110
void checkProperties() override
Check coupler properties for validity.
Definition: lblpt.cpp:275
void initParticleVelocity()
Sets the initial particle velocity based on the flow field velocity in that cell. NOTE: This can not ...
Definition: lblpt.cpp:186
solverType & lbSolver(const MInt solverId=0) const
Definition: coupling.h:454
void postCouple(MInt) override
Coupling after each solver.
Definition: lblpt.cpp:341
void readProperties()
typename BaseLpt::solverType LptSolver
Definition: lblpt.h:37
std::array< MFloat, 2 *nDim > m_gridBoundaries
Definition: lblpt.h:120
MBool m_lptlbInterpolation
Definition: lblpt.h:123
void transferCellStatus()
set the isValid status for LPT cells based on the FV-solver cell properties
Definition: lblpt.cpp:828
ConversionFactor & conversionLbLpt
Definition: lblpt.h:55
ConversionFactor & conversionLptLb
Definition: lblpt.h:56
void initData()
void balancePre() override
Load balancing.
Definition: lblpt.h:67
void transferFlowField()
Transfer the momentum source (forcing) from LPT to LB.
Definition: lblpt.cpp:571
MInt m_lbSolverId
Definition: lblpt.h:117
MBool m_CalcSurface
Definition: lblpt.h:125
void updateLbSolver()
Transfer all relevant data from LPT to LB solver.
Definition: lblpt.cpp:406
void transferTimeStep()
transfer/enforce Fv timeStep onto LPT solver
Definition: lblpt.cpp:817
void init() override
Init coupling class.
Definition: lblpt.cpp:40
MInt m_lptSolverOrder
Definition: lblpt.h:118
MInt lpt2lbId(const MInt lptId)
Definition: lblpt.h:108
MInt m_lptSolverId
Definition: lblpt.h:116
void finalizeSubCoupleInit(MInt) override
Definition: lblpt.h:61
void finalizeBalance(const MInt) override
postCouple: exchange source terms after the LPT timeStep
Definition: lblpt.cpp:381
void finalizeCouplerInit() override
Finalize coupler initialization, coupler is ready after this.
Definition: lblpt.cpp:212
MInt a_noCells(const MInt id=0) const
Definition: coupling.h:516
LPT< nDim > * m_particle
Definition: lblpt.h:113
void initConversion()
void calculateGridBoundaries()
calculate Boundaries of box-shaped Grid for calculation of boundaryCellData
Definition: lblpt.cpp:158
void updateLPTBndry()
Transfer all relevant bndryCell-data from LB to LPT.
Definition: lblpt.cpp:614
MInt m_noSolverSteps
Definition: lblpt.h:119
void computeParticleInterphaseExchangeRate()
MFloat a_lbVariable(const MInt lptCellId, const MInt varId, const MInt mode)
Definition: lblpt.h:73
MFloat a_lbCellCoordinate(const MInt lptCellId, const MInt dir)
Definition: lblpt.h:83
void cleanUp() override
Definition: lblpt.h:69
MInt lpt2lbIdParent(const MInt lptId)
Definition: lblpt.h:109
MBool m_forceLbTimeStep
Definition: lblpt.h:124
This class represents all LB models.
Definition: lbsolverdxqy.h:29
MInt convertId(SolverA &solverA, SolverB &solverB, const MInt solverAId)
Conversion from solverA id to the solverB id on the same-level only!
Definition: couplingutils.h:21
MInt convertIdParent(SolverA &solverA, SolverB &solverB, const MInt solverAId)
Conversion from solverA id to the solverB id If no cell on the same level is found,...
Definition: couplingutils.h:46
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52
bool MBool
Definition: maiatypes.h:58
Namespace for auxiliary functions/classes.