MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lsfv.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 LSFV_H_
8#define LSFV_H_
9
12#include "cartesiansolver.h"
13#include "coupling.h"
14#include "couplingutils.h"
15#include "enums.h"
16
17// Workaround to avoid adding this->func() for every function call to the base class
18template <MInt nDim, class SysEqn>
20
21// template <MInt nDim> class CouplingLS;
22template <MInt nDim, class SysEqn>
23class CouplingFv;
24
25
26template <MInt nDim_, class SysEqn>
27class CouplingLsFv : public CouplingLS<nDim_>, CouplingFv<nDim_, SysEqn> {
28 public:
29 static constexpr MInt nDim = nDim_;
30
31 private:
32 friend class FvCartesianSolverXD<nDim, SysEqn>;
33 friend class LsCartesianSolver<nDim>;
34
35 public:
36 // Simplifications
38 // using FvCartesianSolver = typename maia::lsfv::FvCartesianSolverXD<nDim, SysEqn>::type;
40
41 // Type for cell properties
42 // FvCell is already set in one of the headers and will be used as such here!
44
45 // Constructor
47
48 using CouplingLS<nDim_>::lsSolver;
50 using CouplingLS<nDim_>::a_noSets;
51 using CouplingLS<nDim_>::a_noLsCells;
52 using CouplingLS<nDim_>::a_outsideGValue;
53 using CouplingLS<nDim_>::a_bodyIdG;
54 using CouplingLS<nDim_>::a_bodyToSet;
57 using CouplingLS<nDim_>::a_nearGapG;
58
59 using CouplingFv<nDim, SysEqn>::fvSolver;
60 using CouplingFv<nDim, SysEqn>::noSolvers;
61
62 private:
65
68
71
74
79
80 static constexpr const MInt m_maxNoEmbeddedBodies = 20;
81
82 // ... computeBodyProperties
99
100 // crankAngle
103
104
105 //----------------------------------------- functions --------------------------------------------
106
107 void initData();
108 void checkProperties() override;
109 void readProperties() override;
110
111 public:
112 void init() override;
113 void preCouple(MInt) override;
114 void subCouple(MInt /*recipeStep = 0*/, MInt /*solverId*/, std::vector<MBool>& /*solverCompleted*/) override{};
115 void postCouple(MInt recipeStep = 0) override;
116 void finalizeCouplerInit() override;
117 void finalizeSubCoupleInit(MInt /*solverId*/) override{};
118 void postAdaptation() override;
119 void cleanUp() override{};
120
121 private:
124 void testGapProperty();
126 void computeBodyProperties(MInt returnMode, MFloat* bodyData, MInt body, MFloat time);
127 void testCoupling();
130
131 // Id conversion
132 MInt ls2fvId(const MInt lsId) { return convertId(lsSolver(), fvSolver(), lsId); };
133 MInt ls2fvIdParent(const MInt lsId) { return convertIdParent(lsSolver(), fvSolver(), lsId); };
134 MInt fv2lsId(const MInt fvId) {
135 // TODO labels:COUPLER,FVMB Is this check needed? This functions should never be called for these modes i guess..
136 if(fvSolver().m_levelSetMb && fvSolver().m_constructGField) {
137 return -1;
138 }
139 return convertId(fvSolver(), lsSolver(), fvId);
140 };
141 MInt fv2lsIdParent(const MInt fvId) {
142 // TODO labels:COUPLER,FVMB Is this check needed? This functions should never be called for these modes i guess..
143 if(fvSolver().m_levelSetMb && fvSolver().m_constructGField) {
144 return -1;
145 }
146 return convertIdParent(fvSolver(), lsSolver(), fvId);
147 };
148
150 MFloat interpolateLevelSet(MInt cellId, MFloat* point, MInt set);
151
153 MFloat lsTimeStep() const { return fvSolver().m_timeStep; }
155
156 MFloat a_meanCoord(MInt dir) const { return fvSolver().m_meanCoord[dir]; }
157
160 MFloat a_Ma() const { return fvSolver().a_Ma(); }
161
162 MFloat a_time() const { return fvSolver().m_time; }
163 MFloat a_timeRef() const { return fvSolver().m_timeRef; }
165 MInt a_noFvCells() const { return fvSolver().a_noCells(); }
166 MInt a_noFvGridCells() const { return fvSolver().c_noCells(); }
167 MInt a_G0CellId(MInt id, MInt set) const { return lsSolver().a_G0CellId(id, set); }
168 MInt a_RKStep() const { return fvSolver().m_RKStep; }
169 MInt a_noRKSteps() const { return fvSolver().m_noRKSteps; }
170};
171
172#endif // ifndef LSFV_H_
GridCell
Grid cell Property Labels.
solverType & fvSolver(const MInt solverId=0) const
Definition: coupling.h:386
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
MBool a_nearGapG(const MInt gcellId) const
Definition: coupling.h:219
MInt a_potentialGapCellClose(MInt gcellId) const
Definition: coupling.h:218
MFloat a_outsideGValue() const
Definition: coupling.h:192
MFloat & a_levelSetFunctionG(const MInt cellId, const MInt setId)
Definition: coupling.h:199
MInt a_RKStep() const
Definition: lsfv.h:168
MFloat interpolateLevelSet(MInt cellId, MFloat *point, MInt set)
Definition: lsfv.cpp:268
void finalizeSubCoupleInit(MInt) override
Definition: lsfv.h:117
MInt m_bandWidthRef
Definition: lsfv.h:63
MFloat a_Ma() const
Definition: lsfv.h:160
void finalizeCouplerInit() override
Definition: lsfv.cpp:59
MInt a_noFvGridCells() const
Definition: lsfv.h:166
static constexpr const MInt m_maxNoEmbeddedBodies
Definition: lsfv.h:80
MFloat m_static_computeBodyProperties_rotAngle
Definition: lsfv.h:98
void checkProperties() override
Checks property-data which is read in by both ls-and Fv-Solver.
Definition: lsfv.cpp:137
MFloat a_UInfinity() const
Definition: lsfv.h:158
MInt m_lsSolverId
Definition: lsfv.h:67
MFloat lsTimeStep() const
Definition: lsfv.h:153
void testGapProperty()
transfers the LevelSetValues from the levelset to the moving boundary Part
Definition: lsfv.cpp:560
MFloat m_initialCrankAngle
Definition: lsfv.h:70
MFloat m_cfl
Definition: lsfv.h:75
MBool returnStep()
mimics the behaviour of the rungeKuttaStep() methods with respect to increasing time
Definition: lsfv.cpp:246
void init() override
Definition: lsfv.cpp:43
MFloat m_static_computeBodyProperties_initialBodyCenter[m_maxNoEmbeddedBodies *3]
Definition: lsfv.h:86
MFloat m_static_computeBodyProperties_mu[m_maxNoEmbeddedBodies]
Definition: lsfv.h:88
void computeBodyProperties(MInt returnMode, MFloat *bodyData, MInt body, MFloat time)
MFloat m_static_computeBodyProperties_liftStartAngle2[m_maxNoEmbeddedBodies]
Definition: lsfv.h:92
void cleanUp() override
Definition: lsfv.h:119
void subCouple(MInt, MInt, std::vector< MBool > &) override
Definition: lsfv.h:114
void setLsInList(MIntScratchSpace &)
Definition: lsfv.cpp:304
MString m_solverMethod
Definition: lsfv.h:78
static constexpr MInt nDim
Definition: lsfv.h:29
MInt * m_hasGapCells
Definition: lsfv.h:73
MInt m_fvSolverId
Definition: lsfv.h:66
MFloat a_meanCoord(MInt dir) const
Definition: lsfv.h:156
void returnStep_semiLagrange()
mimics the behaviour of the rungeKuttaStep() methods with respect to increasing time
Definition: lsfv.cpp:259
typename maia::grid::tree::Tree< nDim >::Cell Cell
Definition: lsfv.h:43
MInt ls2fvId(const MInt lsId)
Definition: lsfv.h:132
MInt a_noRKSteps() const
Definition: lsfv.h:169
MInt fv2lsId(const MInt fvId)
Definition: lsfv.h:134
void computeGCellTimeStep()
computes the gcell time step
Definition: lsfv.cpp:214
MInt m_bandWidthRefMax
Definition: lsfv.h:64
MFloat m_static_computeBodyProperties_Strouhal
Definition: lsfv.h:87
MInt fv2lsIdParent(const MInt fvId)
Definition: lsfv.h:141
MFloat m_static_computeBodyProperties_normal[m_maxNoEmbeddedBodies *3]
Definition: lsfv.h:95
MInt a_noFvCells() const
Definition: lsfv.h:165
MFloat m_static_computeBodyProperties_liftStartAngle1[m_maxNoEmbeddedBodies]
Definition: lsfv.h:90
MInt m_static_computeBodyProperties_bodyToFunction[m_maxNoEmbeddedBodies]
Definition: lsfv.h:96
MFloat m_static_computeBodyProperties_liftEndAngle1[m_maxNoEmbeddedBodies]
Definition: lsfv.h:91
void transferGapCellProperty()
Sets the gapcell-property.
Definition: lsfv.cpp:433
void readProperties() override
MInt * m_hadGapCells
Definition: lsfv.h:72
MFloat m_static_computeBodyProperties_liftEndAngle2[m_maxNoEmbeddedBodies]
Definition: lsfv.h:93
MFloat m_static_computeBodyProperties_mu2[m_maxNoEmbeddedBodies]
Definition: lsfv.h:89
MFloat a_physicalTime() const
Definition: lsfv.h:164
MInt a_G0CellId(MInt id, MInt set) const
Definition: lsfv.h:167
MInt noLevelSetFieldData()
Definition: lsfv.cpp:284
MFloat m_static_computeBodyProperties_circleStartAngle[m_maxNoEmbeddedBodies]
Definition: lsfv.h:94
MFloat a_time() const
Definition: lsfv.h:162
void testCoupling()
transfers the LevelSetValues from the levelset to the moving boundary Part
Definition: lsfv.cpp:583
MFloat m_static_computeBodyProperties_omega
Definition: lsfv.h:97
MBool m_static_computeBodyProperties_first
Definition: lsfv.h:83
MFloat m_static_computeBodyProperties_freqFactor[m_maxNoEmbeddedBodies]
Definition: lsfv.h:85
MFloat m_maxVelocity
Definition: lsfv.h:76
void preCouple(MInt) override
Definition: lsfv.cpp:74
MFloat a_timeRef() const
Definition: lsfv.h:163
MInt m_timeStepMethod
Definition: lsfv.h:77
MInt ls2fvIdParent(const MInt lsId)
Definition: lsfv.h:133
MFloat a_TInfinity() const
Definition: lsfv.h:159
void transferLevelSetValues()
Sets the Levelset-Values in fvSolver.
Definition: lsfv.cpp:398
void postAdaptation() override
finalizeAdaptation
Definition: lsfv.cpp:102
MFloat m_static_crankAngle_Strouhal
Definition: lsfv.h:102
MFloat m_static_computeBodyProperties_amplitude[m_maxNoEmbeddedBodies]
Definition: lsfv.h:84
void postCouple(MInt recipeStep=0) override
Definition: lsfv.cpp:86
MInt m_G0regionId
Definition: lsfv.h:69
void initData()
Initialize coupling-class-specific Data.
Definition: lsfv.cpp:120
MFloat crankAngle(MFloat)
help-function for engine calculations which returns the crank-angle for a given time
Definition: lsfv.cpp:1886
MBool m_static_crankAngle_first
Definition: lsfv.h:101
MInt a_noCells() const
Returns the number of cells.
MFloat & a_Ma()
Returns the Mach number of the solver.
This class is a ScratchSpace.
Definition: scratch.h:758
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
std::basic_string< char > MString
Definition: maiatypes.h:55
double MFloat
Definition: maiatypes.h:52
bool MBool
Definition: maiatypes.h:58