MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lbinterface.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 "lbinterface.h"
8
9#include "IO/context.h"
10#include "IO/infoout.h"
11#include "lbinterfacecell.h"
12#include "lbsolver.h"
13#include "property.h"
14
15using namespace std;
16
24template <MInt nDim>
26 : m_noDistributions(solver->m_noDistributions),
27 m_interfaceChildren(solver->m_interfaceChildren),
28 m_interfaceParents(solver->m_interfaceParents),
29 m_externalForcing(solver->m_externalForcing),
30 m_methodId(solver->m_methodId),
31 m_nu(solver->m_nu),
32 m_isThermal(solver->m_isThermal),
33 m_innerEnergy(solver->m_innerEnergy) {
34 TRACE();
35 m_solver = solver;
36 PV = solver->PV;
37
38 m_Fext = solver->m_Fext;
40 cerr << " Using external forcing at Interfaces!" << endl;
41 m_log << " Using external forcing at Interfaces!" << endl;
42 }
43 m_isEELiquid = solver->m_isEELiquid;
45 m_Fg = solver->m_EELiquid.Fg;
46}
47
53template <MInt nDim>
55 TRACE();
56}
57
58// A debug function to print out all interface cells to the log
59template <MInt nDim>
61 TRACE();
62 MInt noNghbrs = 0, noParentNghbrs = 0;
63 for(MInt i = m_solver->minLevel(); i < m_solver->maxLevel(); i++) {
64 m_log << m_interfaceChildren[i - m_solver->minLevel()]->size() << " Interface cells on level: " << i
65 << " ----------" << endl;
66 for(MInt j = 0; j < m_interfaceChildren[i - m_solver->minLevel()]->size(); j++) {
67 for(MInt x = 0; x < m_noDistributions - 1; x++) {
68 noNghbrs += m_solver->a_hasNeighbor(m_interfaceChildren[i - m_solver->minLevel()]->a[j].m_cellId, x);
69 noParentNghbrs += m_solver->a_hasNeighbor(
70 m_solver->c_parentId(m_interfaceChildren[i - m_solver->minLevel()]->a[j].m_cellId), x);
71 }
72 m_log << " cellID " << m_interfaceChildren[i - m_solver->minLevel()]->a[j].m_cellId
73 << " position: " << m_interfaceChildren[i - m_solver->minLevel()]->a[j].m_position
74 << " level: " << m_solver->a_level(m_interfaceChildren[i - m_solver->minLevel()]->a[j].m_cellId)
75 << " neighbors: " << noNghbrs << " parentNghbrs: " << noParentNghbrs << endl;
76 m_log << " interpolation Neighbors: ";
77 for(MInt m = 0; m < IPOW2(nDim); m++) {
78 m_log << m_interfaceChildren[i - m_solver->minLevel()]->a[j].m_interpolationNeighbors[m] << " ("
79 << m_interfaceChildren[i - m_solver->minLevel()]->a[j].m_interpolationCoefficients[m] << "), ";
80 }
81 m_log << endl << " - - - - -" << endl;
82 noNghbrs = 0;
83 noParentNghbrs = 0;
84 }
85 }
86 TERMM(0, AT_);
87}
88
89// A debug function for making the interface cells visible
90template <MInt nDim>
92 TRACE();
93 MBool interfaceParent;
94 MBool nonOverlapping;
95 for(MInt parentId = 0; parentId < m_solver->grid().noCells(); parentId++) {
96 interfaceParent = false;
97 nonOverlapping = false;
98 for(MInt k = 0; k < IPOW2(nDim); k++) {
99 if(m_solver->c_childId(parentId, k) == -1) continue;
100 if(m_solver->a_isInterfaceChild(m_solver->c_childId(parentId, k))) {
101 nonOverlapping = true;
102 break;
103 }
104 }
105 if(nonOverlapping) continue;
106 // Check if neighbor is interface parent
107 for(MInt n = 0; n < m_noDistributions - 1; n++) {
108 for(MInt nk = 0; nk < IPOW2(nDim); nk++) {
109 if(m_solver->c_childId(parentId, nk) == -1) continue;
110 if(m_solver->a_isInterfaceChild(m_solver->c_childId(m_solver->c_neighborId(parentId, n), nk))) {
111 interfaceParent = true;
112 break;
113 }
114 }
115 if(interfaceParent) break;
116 }
117 if(!interfaceParent) continue;
118 for(MInt nk = 0; nk < IPOW2(nDim); nk++) {
119 if(m_solver->c_childId(parentId, nk) == -1) continue;
120 m_solver->a_variable(m_solver->c_childId(parentId, nk), 1) = -1.1;
121 }
122 }
123}
124
125// Explicit instantiations for 2D and 3D
126template class LbInterface<2>;
127template class LbInterface<3>;
LbInterface(LbSolver< nDim > *solver)
Base class for the concrete interface treatment.
Definition: lbinterface.cpp:25
void colorInterface()
Sets the interface cells to defined values (to be watched e.g. in DX)
Definition: lbinterface.cpp:91
MPrimitiveVariables< nDim > * PV
Definition: lbinterface.h:67
MBool m_cellDependentForcing
Definition: lbinterface.h:58
MBool m_externalForcing
Definition: lbinterface.h:59
virtual ~LbInterface()
Destructor.
Definition: lbinterface.cpp:54
MBool m_isEELiquid
Definition: lbinterface.h:60
MFloat * m_Fg
Definition: lbinterface.h:65
MFloat * m_Fext
Definition: lbinterface.h:64
virtual void printInterfaceCells()
Definition: lbinterface.cpp:60
LbSolver< nDim > * m_solver
Definition: lbinterface.h:80
InfoOutFile m_log
constexpr MLong IPOW2(MInt x)
int32_t MInt
Definition: maiatypes.h:62
bool MBool
Definition: maiatypes.h:58