MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
couplerlbfv.cpp
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#include "couplerlbfv.h"
8#include "coupling.h"
9
10template <MInt nDim, MInt nDist, class SysEqnLb, class SysEqnFv>
12 : Coupling(couplingId),
13 CouplingFv<nDim, SysEqnFv>(couplingId, fv),
14 CouplingLB<nDim, nDist, SysEqnLb>(couplingId, lb) {
15 initData();
17
18 // calculation of cfl to sync the timesteps of the FV to the LB
19 const MFloat newCFL = (1.0 + fvSolver().a_Ma()) / sqrt(3.0);
20 fvSolver().a_cfl() = newCFL;
21
22 if(fvSolver().domainId() == 0) {
23 std::cerr << "CFL number calculated and set to: " << newCFL << std::endl;
24 m_log << "CFL number calculated and set to: " << newCFL << std::endl;
25 }
26
28}
29
30template <MInt nDim, MInt nDist, class SysEqnLb, class SysEqnFv>
32 const MFloat lbL2FvL = fvSolver().m_referenceLength / fvSolver().c_cellLengthAtLevel(fvSolver().maxLevel());
33 conversionLbFv.length = lbL2FvL;
34 conversionFvLb.length = 1.0 / lbL2FvL;
35
36 const MFloat lbU2FvU = sqrt(3.0 / (1.0 + (fvSolver().m_gamma - 1.0) / 2.0 * fvSolver().a_Ma() * fvSolver().a_Ma()));
37 conversionLbFv.velocity = lbU2FvU;
38 conversionFvLb.velocity = 1.0 / lbU2FvU;
39
40 MFloat lbP2FvP = pow(fvSolver().m_TInfinity, fvSolver().m_gamma / (fvSolver().m_gamma - 1.0));
41 if(std::isnan(lbP2FvP)) {
42 const MFloat TInf = fvSolver().m_initialCondition == 465 || fvSolver().m_initialCondition == 9465
43 ? 1.0
44 : 1.0 / (1.0 + 0.5 * (fvSolver().m_gamma - 1.0) * POW2(fvSolver().m_Ma));
45 lbP2FvP = pow(TInf, fvSolver().m_gamma / (fvSolver().m_gamma - 1.0));
46 }
47 conversionLbFv.pressure = lbP2FvP;
48 conversionFvLb.pressure = 1.0 / lbP2FvP;
49
50 MFloat lbNu2FvNu = fvSolver().c_cellLengthAtLevel(fvSolver().maxLevel()) * sqrt(fvSolver().m_TInfinity * 3.0)
51 * fvSolver().sysEqn().m_Re0;
52 if(std::isnan(lbNu2FvNu)) {
53 const MFloat TInf = fvSolver().m_initialCondition == 465 || fvSolver().m_initialCondition == 9465
54 ? 1.0
55 : 1.0 / (1.0 + 0.5 * (fvSolver().m_gamma - 1.0) * POW2(fvSolver().m_Ma));
56 lbNu2FvNu = fvSolver().c_cellLengthAtLevel(fvSolver().maxLevel()) * sqrt(TInf * 3.0) * fvSolver().sysEqn().m_Re0;
57 }
58 conversionLbFv.viscosity = lbNu2FvNu;
59 conversionFvLb.viscosity = 1.0 / lbNu2FvNu;
60}
61
62template <MInt nDim, MInt nDist, class SysEqnLb, class SysEqnFv>
64 m_fvSolverId = fvSolver().solverId();
65 m_lbSolverId = lbSolver().solverId();
66}
67
68template <MInt nDim, MInt nDist, class SysEqnLb, class SysEqnFv>
70
71template <MInt nDim, MInt nDist, class SysEqnLb, class SysEqnFv>
73
virtual void initConversionFactors()
Definition: couplerlbfv.cpp:31
virtual void checkProperties()
Definition: couplerlbfv.cpp:69
CouplerLbFv(const MInt couplingId, LbSolver *lb, FvCartesianSolver *fv)
Definition: couplerlbfv.cpp:11
void initData()
Definition: couplerlbfv.cpp:63
virtual void readProperties()
Definition: couplerlbfv.cpp:72
solverType & fvSolver(const MInt solverId=0) const
Definition: coupling.h:386
This class represents all LB models.
Definition: lbsolverdxqy.h:29
constexpr Real POW2(const Real x)
Definition: functions.h:119
InfoOutFile m_log
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52