MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
fvparticle.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 FVPARTICLE_H_
8#define FVPARTICLE_H_
9
10#include "LPT/lpt.h"
11#include "coupling.h"
12#include "couplinglpt.h"
13#include "couplingutils.h"
14#include "solver.h"
15
16// Forward declarations
17template <MInt nDim>
19
20template <MInt nDim, class SysEqn>
21class CouplerFvParticle : public CouplingLpt<nDim, CouplingFv<nDim, SysEqn>> {
22 private:
23 friend class LPT<nDim>;
24 friend class FvCartesianSolverXD<nDim, SysEqn>;
25
27
31
36
37 using typename BaseLptX::ConversionFactor;
38
41
42 public:
43 // Constructor
44 CouplerFvParticle<nDim, SysEqn>(const MInt couplingId, LPT<nDim>* particle, FvCartesianSolver* fv);
45
46 protected:
47 LPT<nDim>& lpt() const override { return *m_particle; }
49
50 public:
51 void init() override;
52 void finalizeCouplerInit() override;
53 void finalizeSubCoupleInit(MInt /*solverId*/) override{};
54
55 void preCouple(MInt) override;
56 void postCouple(MInt) override;
57 void subCouple(MInt, MInt, std::vector<MBool>&) override;
58
59 void postAdaptation() override{};
60 void finalizeAdaptation(const MInt) override;
61 void prepareAdaptation() override;
62
63 void finalizeBalance(const MInt unused) override;
64 void balancePre() override{};
65 void balancePost() override{};
66
67 void cleanUp() override{};
68
69 void writeRestartFile(const MInt) override{};
70
71 MInt noCouplingTimers(const MBool NotUsed(allTimings)) const override { return 2; }
72
73 void getCouplingTimings(std::vector<std::pair<MString, MFloat>>& timings, const MBool NotUsed(allTimings)) override {
74 const MString namePrefix = "c" + std::to_string(this->couplerId()) + "_";
75
76 timings.emplace_back(namePrefix + "loadCouplerFvParticle", returnLoadRecord());
77 timings.emplace_back(namePrefix + "idleCouplerFvParticle", returnIdleRecord());
78 };
79
80
81 private:
82 void checkProperties() override;
84 void initData();
87
90
92 void updateLPTBndry();
93 void transferFlowField();
94 void transferCellStatus();
96 void transferTimeStep();
97
98 void setExternalSourceInCell(const MInt, const MInt, const MFloat);
99
100 void unifyTimeStep();
101
102 MInt childLoop(MInt cellId);
103
104 // Id conversion
105 MInt lpt2fvId(const MInt lptId) { return convertId(lpt(), fvSolver(), lptId); };
106 MInt lpt2fvIdParent(const MInt lptId) { return convertIdParent(lpt(), fvSolver(), lptId); };
107 MInt fv2lptId(const MInt fvId) { return convertId(fvSolver(), lpt(), fvId); };
108 MInt fv2lptIdParent(const MInt fvId) { return convertIdParent(fvSolver(), lpt(), fvId); };
109
110 void interpolateFVLPT(const MInt from, const MInt to);
111 void interpolateVelocitySlopesFVLPT(const MInt from, const MInt to);
114
115
118
124
127
128 SysEqn m_sysEqn;
129
134};
135
136#endif // ifndef FVPARTICLE_H_
FvCartesianSolverXD< nDim, SysEqn > & fvSolver() const
Definition: fvparticle.h:48
LPT< nDim > * m_particle
Definition: fvparticle.h:116
void finalizeAdaptation(const MInt) override
prepate adaptation
Definition: fvparticle.cpp:930
void postAdaptation() override
Definition: fvparticle.h:59
LPT< nDim > & lpt() const override
Definition: fvparticle.h:47
void getCouplingTimings(std::vector< std::pair< MString, MFloat > > &timings, const MBool NotUsed(allTimings)) override
Definition: fvparticle.h:73
void writeRestartFile(const MInt) override
Definition: fvparticle.h:69
void initConversion()
Calculates the conversion factor for different non-dimensionalisations in the FV and LPT solvers.
void finalizeSubCoupleInit(MInt) override
Definition: fvparticle.h:53
void finalizeBalance(const MInt unused) override
postCouple: exchange source terms after the LPT timeStep
Definition: fvparticle.cpp:418
void transferVelocitySlopes()
transfer the FV velocity slopes to the LPT solver
MInt childLoop(MInt cellId)
compute particle-cell binning and write to file
void initParticleVelocity()
Sets the initial particle velocity based on the flow field velocity in that cell. NOTE: This can not ...
Definition: fvparticle.cpp:227
MFloat interpolateVariable(MInt *, MFloat *, MInt)
interpolates the fv-variable /
void transferCellStatus()
set the isValid status for LPT cells based on the FV-solver cell properties
void transferNoParticlesInCell()
set a_noPart in Fv based on a_noParticlesInCell and a_noEllipsoidsInCell in LPT solver NOTE: this is ...
Definition: fvparticle.cpp:692
void unifyTimeStep()
Find combinded maximum timeStep for Fv and LPT solvers only possible for interleafed execution assumi...
void updateLPTBndry()
transfer all relevant bndryCell-data from FV to LPT solver before the LPT timeStep!
Definition: fvparticle.cpp:607
ConversionFactor & conversionFvLpt
Definition: fvparticle.h:40
void interpolateFVLPT(const MInt from, const MInt to)
interpolate flow variables from the fv-grid to the LPT-cell position
Definition: fvparticle.cpp:962
FvCartesianSolverXD< nDim, SysEqn > * m_fvSolver
Definition: fvparticle.h:117
MBool m_forceFvTimeStep
Definition: fvparticle.h:132
void writeParticleCellStats()
compute particle-cell binning and write to file
ConversionFactor & conversionLptFv
Definition: fvparticle.h:39
void transferFlowField()
transfer flow data from FV to LPT
Definition: fvparticle.cpp:452
void preCouple(MInt) override
preCoupler: reset external source terms before the LPT timestep
Definition: fvparticle.cpp:350
void checkProperties() override
Checks property-data which is read in by both lpt-and Fv-Solver.
Definition: fvparticle.cpp:338
MInt lpt2fvId(const MInt lptId)
Definition: fvparticle.h:105
MInt fv2lptId(const MInt fvId)
Definition: fvparticle.h:107
MFloat interpolateSlope(MInt *, MFloat *, MInt, MInt)
interpolate fv slope
MBool m_lptFvInterpolation
Definition: fvparticle.h:125
void initData()
Initialize coupling-class-specific Data.
Definition: fvparticle.cpp:244
MInt lpt2fvIdParent(const MInt lptId)
Definition: fvparticle.h:106
void transferTimeStep()
transfer/enforce Fv timeStep onto LPT solver
Definition: fvparticle.cpp:830
void subCouple(MInt, MInt, std::vector< MBool > &) override
transfer the FV velocity slopes to the LPT solver
void balancePost() override
Definition: fvparticle.h:65
void postCouple(MInt) override
postCouple: exchange source terms after the LPT timeStep
Definition: fvparticle.cpp:382
MInt noCouplingTimers(const MBool NotUsed(allTimings)) const override
Number of coupling timers.
Definition: fvparticle.h:71
void balancePre() override
Load balancing.
Definition: fvparticle.h:64
void transferExternalSources()
set external sources in Fv solver based on values in the LPT solver
Definition: fvparticle.cpp:736
void prepareAdaptation() override
prepate adaptation
Definition: fvparticle.cpp:871
void interpolateVelocitySlopesFVLPT(const MInt from, const MInt to)
Interpolates the velocity slopes from the fv-grid to the LPT-cell.
MInt fv2lptIdParent(const MInt fvId)
Definition: fvparticle.h:108
void cleanUp() override
Definition: fvparticle.h:67
void init() override
performs the coupling after solver initialization
Definition: fvparticle.cpp:56
void setExternalSourceInCell(const MInt, const MInt, const MFloat)
set external source in FV-solver from LPT fluxes
Definition: fvparticle.cpp:882
void finalizeCouplerInit() override
Definition: fvparticle.cpp:255
MFloat returnIdleRecord() const
Definition: coupling.h:159
void stopLoadTimer(const MString &name) const
Stop the load timer of the coupler.
Definition: coupling.h:152
void startLoadTimer(const MString &name) const
Start the load timer of the coupler.
Definition: coupling.h:148
MFloat returnLoadRecord() const
Definition: coupling.h:158
MInt couplerId() const
Definition: coupling.h:67
ConversionFactor conversionLptFlow
Definition: couplinglpt.h:44
ConversionFactor conversionFlowLpt
Definition: couplinglpt.h:43
Definition: lpt.h:82
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