MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lbrb.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 LBRB_H_
8#define LBRB_H_
9
10#include "UTIL/pointbox.h"
11#include "UTIL/timer.h"
12#include "cartesiansolver.h"
13#include "enums.h"
14
15#include "coupling.h"
16#include "lslb.h"
17#include "surfacecoupling.h"
18
19#include <algorithm>
20
21template <MInt nDim>
23
24template <MInt nDim, MInt nDist, class SysEqn>
25class CouplingLB;
26
27template <MInt nDim, MInt nDist, class SysEqn>
28class LbRb : public CouplingLB<nDim, nDist, SysEqn>, public CouplingRigidBodies<nDim> {
29 public:
30 // Simplifications
33
35 using RBodies = typename CouplingRb::RBodies;
36
37 // Constructor
38 LbRb<nDim, nDist, SysEqn>(MInt couplingId, LbSolver* lb, RBodies* rb);
40
43
46 MFloat** forces = nullptr;
47
48 static constexpr MInt m_noCorners = (nDim == 2) ? 4 : 8;
49 static constexpr MInt nRot = (nDim == 3) ? 3 : 1;
50
52
60 using CouplingLb::a_Ma;
75 using CouplingLb::a_Re;
82
85
86 private:
87 // Conversion-Factors
95 };
96
99
100 struct Timers {
101 enum {
104
108
111
118
121
122 _count
123 };
124 };
125
126 std::array<MInt, Timers::_count> m_timers;
127
128 //--------------------------------- functions
129 //------------------------------------------------------
130
131 private:
132 void initData();
133 void initTimers();
134 void averageTimer();
135 void checkProperties();
136 void readProperties();
137
138 void updateGeometry();
139
140 public:
141 void init() override;
142 void finalizeSubCoupleInit(MInt /*solverId*/) override{};
143 void finalizeCouplerInit() override{};
144
145 void preCouple(MInt /*recipeStep = 0*/) override{};
146 void subCouple(MInt /*recipeStep = 0*/, MInt /*solverId*/, std::vector<MBool>& /*solverCompleted*/) override;
147 void postCouple(MInt /*recipeStep = 0*/) override{};
148
149 void postAdaptation() override;
150 void finalizeAdaptation(const MInt solverId) override;
151
152 void cleanUp() override{};
154 void getDomainDecompositionInformation(std::vector<std::pair<MString, MInt>>& /*domainInfo*/) override{};
155
156 // LB stuff
158
159 // Body stuff
160 void getBodyVelocity(const MInt body, MFloat* const velocity);
161 void getBodyAngularVelocity(const MInt body, MFloat* const angularVelocity);
163
165
167
168 // LS stuff
174
175 void constructGField();
176 template <MInt bodyType>
177 void constructGField_();
178 template <MInt bodyType>
179 void descendLevelSetValue(const MInt cellId, const MInt* bodyId, const MInt bodyCnt);
180};
181
182#endif // ifndef LBRB_H_
MInt a_noDistributions(const MInt id=0) const
Definition: coupling.h:481
MInt a_isThermal(const MInt id=0) const
Definition: coupling.h:479
MBool a_isActive(const MInt cellId, const MInt id=0) const
Definition: coupling.h:522
MFloat a_Re(const MInt id=0) const
Definition: coupling.h:473
MFloat a_cellLengthAtLevel(MInt level, const MInt id=0)
Definition: coupling.h:518
MFloat & a_oldVariable(const MInt cellId, const MInt varId, const MInt id=0)
Definition: coupling.h:533
solverType & lbSolver(const MInt solverId=0) const
Definition: coupling.h:454
MInt a_pvt(const MInt id=0) const
Definition: coupling.h:478
MInt a_pvrho(const MInt id=0) const
Definition: coupling.h:477
MInt a_childId(const MInt cellId, const MInt child, const MInt id=0)
Definition: coupling.h:508
MInt & a_associatedBodyIdsMb(const MInt cellId, const MInt set, const MInt id=0)
Definition: coupling.h:498
MInt a_noLevelSetsMb(const MInt id=0) const
Definition: coupling.h:471
MBool a_wasActive(const MInt cellId, const MInt id=0) const
Definition: coupling.h:524
MFloat a_initTemperatureKelvin(const MInt id=0) const
Definition: coupling.h:482
MInt a_pvv(const MInt id=0) const
Definition: coupling.h:475
MInt a_pvu(const MInt id=0) const
Definition: coupling.h:474
MInt a_pvw(const MInt id=0) const
Definition: coupling.h:476
MInt a_noCells(const MInt id=0) const
Definition: coupling.h:516
MFloat a_Ma(const MInt id=0) const
Definition: coupling.h:472
MFloat & a_variable(const MInt cellId, const MInt varId, const MInt id=0)
Definition: coupling.h:528
LbBndCnd & lbBndCnd(const MInt id=0)
Definition: coupling.h:461
MInt a_noEmbeddedBodiesLB(const MInt id=0) const
Definition: coupling.h:520
MInt noMinCells(const MInt id=0) const
Definition: coupling.h:514
MInt a_noVariables(const MInt id=0) const
Definition: coupling.h:526
MbCellCollector & a_mbCell(const MInt id=0)
Definition: coupling.h:486
MInt a_noLbCells(const MInt id=0) const
Definition: coupling.h:470
MInt a_parentId(const MInt cellId, const MInt id=0)
Definition: coupling.h:506
MInt minCell(const MInt index, const MInt id=0) const
Definition: coupling.h:512
MFloat & a_levelSetFunctionMb(const MInt cellId, const MInt set, const MInt id=0)
Definition: coupling.h:490
MInt a_noCollectorBodies() const
Definition: coupling.h:591
RigidBodies< nDim > RBodies
Definition: coupling.h:586
RBodies & bodies() const
Definition: coupling.h:594
Definition: lbrb.h:28
void postCouple(MInt) override
Definition: lbrb.h:147
void finalizeSubCoupleInit(MInt) override
Definition: lbrb.h:142
typename CouplingRb::RBodies RBodies
Definition: lbrb.h:35
void transferLevelSetFieldValues(MBool)
void initTimers()
Creates all timers and subtimers.
Definition: lbrb.cpp:65
MInt noLevelSetFieldData()
void reinitAfterBalance()
Definition: lbrb.h:153
void init() override
Initialize solver data needed for this coupling.
Definition: lbrb.cpp:173
static constexpr MInt nRot
Definition: lbrb.h:49
void returnLevelSetSignForFluidCellCorners(MInt, MIntScratchSpace *levelSetCornerSigns, MInt set=0)
std::array< MInt, Timers::_count > m_timers
Definition: lbrb.h:126
void descendLevelSetValue(const MInt cellId, const MInt *bodyId, const MInt bodyCnt)
Descend the level set value to the cells children.
Definition: lbrb.cpp:546
void checkProperties()
Checks property-data which is read in by both ls-and Lb-Solver.
Definition: lbrb.cpp:152
ConversionFactors conversionRbLb
Definition: lbrb.h:97
maia::coupling::Mapping bodyToBndryMapping
Definition: lbrb.h:45
MString m_timerType
Definition: lbrb.h:42
void initializeSolidDomain()
Initialize cells which are inisde the solid domain or just entered the fluid domain.
Definition: lbrb.cpp:357
void averageTimer()
Definition: lbrb.cpp:580
void constructGField_()
Constructs the level-set field after each time step.
Definition: lbrb.cpp:466
MFloat ** forces
Definition: lbrb.h:46
void subCouple(MInt, MInt, std::vector< MBool > &) override
Definition: lbrb.cpp:222
void initData()
Initializes coupler specific data.
Definition: lbrb.cpp:105
void finalizeCouplerInit() override
Definition: lbrb.h:143
void cleanUp() override
Definition: lbrb.h:152
MInt returnLevelSetSignForFluidFaceCentroid(MInt, MInt, MInt set=0)
ConversionFactors conversionLbRb
Definition: lbrb.h:98
void readProperties()
Read all relevant properties.
Definition: lbrb.cpp:165
void computeGCellTimeStep()
void getBodyVelocity(const MInt body, MFloat *const velocity)
Get body velocity converted to LB units.
Definition: lbrb.cpp:316
void preCouple(MInt) override
Definition: lbrb.h:145
void getDomainDecompositionInformation(std::vector< std::pair< MString, MInt > > &) override
Definition: lbrb.h:154
void constructGField()
Dispatch function for the body specific construction of the level set.
Definition: lbrb.cpp:442
void finalizeAdaptation(const MInt solverId) override
Coupling between solver substeps.
Definition: lbrb.cpp:213
maia::coupling::Mapping bndryToBodyMapping
Definition: lbrb.h:44
MInt returnNoActiveCorners(MInt)
void updateGeometry()
Updates the member-variables in the geometry-intersection class.
Definition: lbrb.cpp:343
static constexpr MInt m_noCorners
Definition: lbrb.h:48
void getBodyAngularVelocity(const MInt body, MFloat *const angularVelocity)
Get angular body velocity converted to LB units.
Definition: lbrb.cpp:331
MInt m_lbSolverId
Definition: lbrb.h:41
void postAdaptation() override
Definition: lbrb.cpp:192
void bc3060(MInt)
MBool m_static_updateLevelSetFlowSolver_firstRun
Definition: lbrb.h:51
void createBodyTree()
This class represents all LB models.
Definition: lbsolverdxqy.h:29
This class is a ScratchSpace.
Definition: scratch.h:758
int32_t MInt
Definition: maiatypes.h:62
std::basic_string< char > MString
Definition: maiatypes.h:55
double MFloat
Definition: maiatypes.h:52
bool MBool
Definition: maiatypes.h:58
@ Constructor
Definition: lbrb.h:105
@ SetBoundaryVelocity
Definition: lbrb.h:114
@ ConstructGField
Definition: lbrb.h:109
@ _count
Definition: lbrb.h:122
@ CreateComm
Definition: lbrb.h:115
@ ComputeBodyForces
Definition: lbrb.h:117
@ FindBoundaryMapping
Definition: lbrb.h:120
@ PreCouple
Definition: lbrb.h:119
@ InitSolidDomain
Definition: lbrb.h:113
@ FindBoundaryCells
Definition: lbrb.h:112
@ ApplyBC
Definition: lbrb.h:116
@ CouplePostLb
Definition: lbrb.h:106
@ CouplePostRb
Definition: lbrb.h:107
@ TimerGroup
Definition: lbrb.h:102
@ Preparation
Definition: lbrb.h:110
Multi-to-multi mapping class.