MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lslb.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 LSLB_H_
8#define LSLB_H_
9
10#include <algorithm>
11#include "UTIL/pointbox.h"
12#include "cartesiansolver.h"
13#include "enums.h"
14
15#include "coupling.h"
16#include "couplingutils.h"
17#include "surfacecoupling.h"
18
19template <MInt nDim>
20class CouplingLS;
21template <MInt nDim, MInt nDist, class SysEqn>
22class CouplingLB;
23
24template <MInt nDim_, MInt nDist, class SysEqn>
25class LsLb : public CouplingLS<nDim_>, public CouplingLB<nDim_, nDist, SysEqn> {
26 public:
27 static constexpr MInt nDim = nDim_;
28
29 public:
30 // Simplifications
33
34 // Constructor
35 LsLb(MInt couplingId, LsSolver* ls, LbSolver* lb);
36
37 private:
40
42
45
46 static constexpr const MInt m_maxNoEmbeddedBodies = 1;
47 static constexpr const MInt m_noCorners = (nDim == 2) ? 4 : 8;
48
49 // ... computeBodyProperties
51 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_amplitude{};
52 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_freqFactor{};
53 std::array<MFloat, m_maxNoEmbeddedBodies * 3> m_static_computeBodyProperties_initialBodyCenter{};
55 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_mu{};
56 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_mu2{};
57 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_liftStartAngle1{};
58 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_liftEndAngle1{};
59 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_liftStartAngle2{};
60 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_liftEndAngle2{};
61 std::array<MFloat, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_circleStartAngle{};
62 std::array<MFloat, m_maxNoEmbeddedBodies * 3> m_static_computeBodyProperties_normal{};
63 std::array<MInt, m_maxNoEmbeddedBodies> m_static_computeBodyProperties_bodyToFunction{};
66
67
69
70 public:
71 using CouplingLS<nDim_>::lsSolver;
73 using CouplingLS<nDim_>::a_noSets;
74 using CouplingLS<nDim_>::a_noLsCells;
75 using CouplingLS<nDim_>::a_outsideGValue;
76 using CouplingLS<nDim_>::a_bodyIdG;
77 using CouplingLS<nDim_>::a_bodyToSet;
79
80 using CouplingLB<nDim, nDist, SysEqn>::lbSolver;
81 using CouplingLB<nDim, nDist, SysEqn>::lbBndCnd;
82 using CouplingLB<nDim, nDist, SysEqn>::a_noLbCells;
83 using CouplingLB<nDim, nDist, SysEqn>::a_noLevelSetsMb;
84 using CouplingLB<nDim, nDist, SysEqn>::a_levelSetFunctionMb;
85 using CouplingLB<nDim, nDist, SysEqn>::a_associatedBodyIdsMb;
86 using CouplingLB<nDim, nDist, SysEqn>::a_parentId;
87 using CouplingLB<nDim, nDist, SysEqn>::a_childId;
88 using CouplingLB<nDim, nDist, SysEqn>::minCell;
89 using CouplingLB<nDim, nDist, SysEqn>::noMinCells;
90 using CouplingLB<nDim, nDist, SysEqn>::a_noCells;
91 using CouplingLB<nDim, nDist, SysEqn>::a_cellLengthAtLevel;
92 using CouplingLB<nDim, nDist, SysEqn>::a_noEmbeddedBodiesLB;
93 using CouplingLB<nDim, nDist, SysEqn>::a_noVariables;
94 using CouplingLB<nDim, nDist, SysEqn>::a_variable;
95 using CouplingLB<nDim, nDist, SysEqn>::a_oldVariable;
96 using CouplingLB<nDim, nDist, SysEqn>::a_isActive;
97 using CouplingLB<nDim, nDist, SysEqn>::a_wasActive;
98 using CouplingLB<nDim, nDist, SysEqn>::a_Ma;
99 using CouplingLB<nDim, nDist, SysEqn>::a_Re;
100 using CouplingLB<nDim, nDist, SysEqn>::a_noDistributions;
101 using CouplingLB<nDim, nDist, SysEqn>::a_initTemperatureKelvin;
102 using CouplingLB<nDim, nDist, SysEqn>::a_pvu;
103 using CouplingLB<nDim, nDist, SysEqn>::a_pvv;
104 using CouplingLB<nDim, nDist, SysEqn>::a_pvw;
105 using CouplingLB<nDim, nDist, SysEqn>::a_pvrho;
106 using CouplingLB<nDim, nDist, SysEqn>::a_isThermal;
107 using CouplingLB<nDim, nDist, SysEqn>::a_pvt;
108 using CouplingLB<nDim, nDist, SysEqn>::a_mbCell;
109
110 static constexpr const MBool m_constructGField = false;
112 //--------------------------------- functions ------------------------------------------------------
113
114 private:
115 void initData();
116 void checkProperties();
118
119 void updateGeometry();
120
121 public:
122 void init() override;
123 void preCouple(MInt step) override;
124 void postCouple(MInt step) override;
125 void finalizeCouplerInit() override;
126 void finalizeSubCoupleInit(MInt couplingStep) override;
127 void subCouple(MInt /*recipeStep*/, MInt /*solverId*/, std::vector<MBool>& /*solverCompleted*/) override{};
128 void cleanUp() override{};
129
130 void postAdaptation() override;
131 void finalizeAdaptation(const MInt solverId) override;
132
133 // Id conversion
134
135 MInt ls2lbId(const MInt lsId) { return convertId(lsSolver(), lbSolver(), lsId); };
136 MInt ls2lbIdParent(const MInt lsId) { return convertIdParent(lsSolver(), lbSolver(), lsId); };
137 MInt lb2lsId(const MInt lbId) { return convertId(lbSolver(), lsSolver(), lbId); };
138 MInt lb2lsIdParent(const MInt lbId) { return convertIdParent(lbSolver(), lsSolver(), lbId); };
139
140 void testCoupling();
141
143
144 void createBodyTree();
145
149 void buildCollectedLevelSet(const MInt cellId);
150 MFloat interpolateLevelSet(MInt* interpolationCells, MFloat* point, const MInt set);
151 void interpolateLsLb(const MInt from, const MInt to);
152
154
156
158 template <MInt bodyType>
160 template <MInt bodyType>
161 void descendLevelSetValue(const MInt cellId, const MInt* bodyId, const MInt bodyCnt);
162};
163
164#endif // ifndef LSLB_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
solverType & lsSolver() const
Definition: coupling.h:188
MInt a_bodyIdG(const MInt cellId, const MInt set) const
Definition: coupling.h:203
MInt a_noLsCells() const
Definition: coupling.h:191
MInt a_noSets() const
Definition: coupling.h:222
MInt a_bodyToSet(const MInt bodyId) const
Definition: coupling.h:220
MInt a_noEmbeddedBodies() const
Definition: coupling.h:221
MFloat a_outsideGValue() const
Definition: coupling.h:192
MFloat & a_levelSetFunctionG(const MInt cellId, const MInt setId)
Definition: coupling.h:199
This class represents all LB models.
Definition: lbsolverdxqy.h:29
Definition: lslb.h:25
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_liftStartAngle2
Definition: lslb.h:59
void interpolateLsLb(const MInt from, const MInt to)
interpolate levelset values on the lb-grid
Definition: lslb.cpp:640
std::array< MInt, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_bodyToFunction
Definition: lslb.h:63
MInt lb2lsIdParent(const MInt lbId)
Definition: lslb.h:138
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_amplitude
Definition: lslb.h:51
void initializeSolidDomain()
Definition: lslb.cpp:519
void transferLevelSetFieldValues(MBool)
transfers the LevelSetValues for all cells from the levelset to the moving boundary Part
Definition: lslb.cpp:159
void constructGField_()
maia::coupling::Mapping bodyToBndryMapping
Definition: lslb.h:44
MInt ls2lbId(const MInt lsId)
Definition: lslb.h:135
void updateFlowSolverLevelSet()
void finalizeSubCoupleInit(MInt couplingStep) override
Definition: lslb.cpp:428
void updateGeometry()
Updates the member-variables in the geometry-intersection class.
Definition: lslb.cpp:374
MBool m_static_computeBodyProperties_first
Definition: lslb.h:50
void init() override
Definition: lslb.cpp:411
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_circleStartAngle
Definition: lslb.h:61
static constexpr const MInt m_maxNoEmbeddedBodies
Definition: lslb.h:46
std::array< MFloat, m_maxNoEmbeddedBodies *3 > m_static_computeBodyProperties_normal
Definition: lslb.h:62
MInt m_lbSolverId
Definition: lslb.h:38
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_mu2
Definition: lslb.h:56
MFloat m_static_computeBodyProperties_rotAngle
Definition: lslb.h:65
void constructGField()
MFloat m_static_computeBodyProperties_omega
Definition: lslb.h:64
void cleanUp() override
Definition: lslb.h:128
void preCouple(MInt step) override
Definition: lslb.cpp:434
static constexpr const MInt m_noCorners
Definition: lslb.h:47
static constexpr const MBool m_constructGField
Definition: lslb.h:110
void finalizeAdaptation(const MInt solverId) override
Definition: lslb.cpp:505
void finalizeCouplerInit() override
Definition: lslb.cpp:422
void buildCollectedLevelSet(const MInt cellId)
build the combined levelSet for the given cellId
Definition: lslb.cpp:598
MFloat interpolateLevelSet(MInt *interpolationCells, MFloat *point, const MInt set)
Definition: lslb.cpp:663
void updateBoundaryCellsFromGField()
MFloat m_static_computeBodyProperties_Strouhal
Definition: lslb.h:54
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_freqFactor
Definition: lslb.h:52
MBool m_outsideDefault
Definition: lslb.h:41
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_liftStartAngle1
Definition: lslb.h:57
void testCoupling()
transfers the LevelSetValues from the levelset to the moving boundary Part
Definition: lslb.cpp:114
void postAdaptation() override
finalizeAdaptation
Definition: lslb.cpp:500
void checkProperties()
Checks property-data which is read in by both ls-and Lb-Solver.
Definition: lslb.cpp:70
MInt m_lsSolverId
Definition: lslb.h:39
void readProperties()
maia::coupling::Mapping bndryToBodyMapping
Definition: lslb.h:43
void postCouple(MInt step) override
Definition: lslb.cpp:478
static constexpr MInt nDim
Definition: lslb.h:27
void updateLevelSetFlowSolver()
Updates the fv-mb-solver flow solver (after a completed levelSet TimeStep and finalizeLevelSet() )
Definition: lslb.cpp:389
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_mu
Definition: lslb.h:55
MInt ls2lbIdParent(const MInt lsId)
Definition: lslb.h:136
MInt noLevelSetFieldData()
Definition: lslb.cpp:352
void subCouple(MInt, MInt, std::vector< MBool > &) override
Definition: lslb.h:127
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_liftEndAngle1
Definition: lslb.h:58
void descendLevelSetValue(const MInt cellId, const MInt *bodyId, const MInt bodyCnt)
MInt lb2lsId(const MInt lbId)
Definition: lslb.h:137
void initData()
MBool m_static_updateLevelSetFlowSolver_firstRun
Definition: lslb.h:68
void createBodyTree()
transfers the LevelSetValues from the levelset to the moving boundary Part
Definition: lslb.cpp:344
std::array< MFloat, m_maxNoEmbeddedBodies > m_static_computeBodyProperties_liftEndAngle2
Definition: lslb.h:60
std::array< MFloat, m_maxNoEmbeddedBodies *3 > m_static_computeBodyProperties_initialBodyCenter
Definition: lslb.h:53
MFloat * m_transferBoundingBox
Definition: lslb.h:111
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
Multi-to-multi mapping class.