MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lslb.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//#define COUPLING_DEBUG_
8#include "lslb.h"
9#include <algorithm>
10#include <stack>
11#include <vector>
13#include "IO/parallelio.h"
14#include "MEMORY/alloc.h"
15#include "UTIL/functions.h"
16#include "globals.h"
17
18#include "globalvariables.h"
19
20using namespace std;
21
22template <MInt nDim, MInt nDist, class SysEqn>
24 : Coupling(couplingId), CouplingLS<nDim>(couplingId, ls), CouplingLB<nDim, nDist, SysEqn>(couplingId, lb) {
25 TRACE();
26
27 initData();
31}
32
36template <MInt nDim, MInt nDist, class SysEqn>
38 TRACE();
39
40 // solver-specific data:
41 m_lbSolverId = lbSolver().solverId();
42 m_lsSolverId = lsSolver().solverId();
43
52 if(Context::propertyLength("transferRegion", m_lbSolverId) > 0) {
53 if(Context::propertyLength("transferRegion", m_lbSolverId) == 2 * nDim) {
54 mAlloc(m_transferBoundingBox, 2 * nDim, "m_transferBoundingBox", AT_);
55 for(MInt d = 0; d < 2 * nDim; d++) {
56 m_transferBoundingBox[d] = Context::getSolverProperty<MFloat>("transferRegion", m_lbSolverId, AT_, d);
57 }
58 } else {
59 stringstream errorMessage;
60 errorMessage << "ERROR: Wrong number of array entries in transferRegion. Must be 2 * nDim!!";
61 mTerm(1, AT_, errorMessage.str());
62 }
63 }
64}
65
69template <MInt nDim, MInt nDist, class SysEqn>
71 TRACE();
72
73 lbSolver().m_noEmbeddedBodies = lsSolver().m_noEmbeddedBodies;
74
75 if(lsSolver().m_maxNoSets > 0) lbSolver().m_noLevelSetsUsedForMb = lsSolver().m_maxNoSets;
76 if(lbSolver().m_useOnlyCollectedLS) lbSolver().m_noLevelSetsUsedForMb = 1;
77
78 lbSolver().m_maxNoSets = lbSolver().m_noLevelSetsUsedForMb;
79
80 lbSolver().m_constructGField = lsSolver().m_constructGField;
81}
82
86template <MInt nDim, MInt nDist, class SysEqn>
88 TRACE();
89
104 m_outsideDefault = true;
105 if(Context::propertyExists("outsideDefault", m_lbSolverId)) {
106 m_outsideDefault = Context::getSolverProperty<MBool>("outsideDefault", m_lbSolverId, AT_, &m_outsideDefault);
107 }
108}
109
113template <MInt nDim, MInt nDist, class SysEqn>
115 TRACE();
116
117 if(lsSolver().m_constructGField) return;
118
119 for(MInt lbCellId = 0; lbCellId < a_noLbCells(); lbCellId++) {
120 ASSERT(lbSolver().grid().tree().solver2grid(lbCellId) >= 0, "");
121 ASSERT(lbSolver().grid().solverFlag(lbSolver().grid().tree().solver2grid(lbCellId), m_lbSolverId), "");
122#ifdef COUPLING_DEBUG_
123 if(lsSolver().grid().solverFlag(lbSolver().grid().tree().solver2grid(lbCellId), m_lsSolverId)) {
124 ASSERT(ls2lbId(lb2lsId(lbCellId)) == lbCellId,
125 to_string(lbCellId) + " " + to_string(lb2lsId(lbCellId)) + " " + to_string(ls2lbId(lb2lsId(lbCellId))));
126 }
127#endif
128 }
129
130 for(MInt cellId = 0; cellId < a_noLsCells(); cellId++) {
131 ASSERT(lsSolver().grid().tree().solver2grid(cellId) >= 0, "");
132 ASSERT(lsSolver().grid().solverFlag(lsSolver().grid().tree().solver2grid(cellId), m_lsSolverId), "");
133#ifdef COUPLING_DEBUG_
134 if(lbSolver().grid().solverFlag(lsSolver().grid().tree().solver2grid(cellId), m_lbSolverId)) {
135 ASSERT(lb2lsId(ls2lbId(cellId)) == cellId,
136 to_string(cellId) + " " + to_string(ls2lbId(cellId)) + " " + to_string(lb2lsId(ls2lbId(cellId))));
137 }
138#endif
139 }
140
141 if(!lsSolver().m_levelSetLb) return;
142
143#ifdef COUPLING_DEBUG_
144 for(MInt lbCellId = 0; lbCellId < a_noLbCells(); lbCellId++) {
145 for(MInt dir = 0; dir < nDim; dir++) {
146 if(lsSolver().grid().solverFlag(lbSolver().grid().tree().solver2grid(lbCellId), m_lsSolverId)) {
147 ASSERT(abs(lbSolver().c_coordinate(lbCellId, dir) - a_coordinateG(lb2lsId(lbCellId), dir)) < 0.00000001, "");
148 }
149 }
150 }
151#endif
152}
153
158template <MInt nDim, MInt nDist, class SysEqn>
160 TRACE();
161
162 const MInt noRfJumps = mMax(0, lbSolver().maxLevel() - lsSolver().maxRefinementLevel());
163
164 // Nothing to transfer if lbSolver is inactive!
165 if(!lbSolver().isActive()) return;
166
167 if(exchangeLVS) {
168 if(lsSolver().isActive()) {
169 lsSolver().exchangeAllLevelSetData();
170 lsSolver().checkHaloCells();
171 }
172 }
173
174 if(lsSolver().isActive()) {
175 std::list<MInt> interpolationParents;
176 interpolationParents.clear();
177
178 for(MInt cellId = 0; cellId < a_noLbCells(); cellId++) {
179 // reset values with invalid/defaults
180 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
181 if(m_outsideDefault) {
182 lbSolver().a_levelSetFunctionMB(cellId, set) = a_outsideGValue();
183 } else {
184 lbSolver().a_levelSetFunctionMB(cellId, set) = -a_outsideGValue();
185 }
186 lbSolver().a_associatedBodyIds(cellId, set) = -2;
187 }
188 if(m_transferBoundingBox != nullptr) {
189 if(m_transferBoundingBox[0] > lbSolver().c_coordinate(cellId, 0)
190 || m_transferBoundingBox[0 + nDim] < lbSolver().c_coordinate(cellId, 0)) {
191 continue;
192 }
193 if(m_transferBoundingBox[1] > lbSolver().c_coordinate(cellId, 1)
194 || m_transferBoundingBox[1 + nDim] < lbSolver().c_coordinate(cellId, 1)) {
195 continue;
196 }
197 IF_CONSTEXPR(nDim == 3) {
198 if(m_transferBoundingBox[2] > lbSolver().c_coordinate(cellId, 2)
199 || m_transferBoundingBox[2 + nDim] < lbSolver().c_coordinate(cellId, 2)) {
200 continue;
201 }
202 }
203 }
204 const MInt gCellId = lb2lsId(cellId);
205 // direct transfer of matching cells
206 if(gCellId > -1) {
207 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
208 lbSolver().a_levelSetFunctionMB(cellId, set) = a_levelSetFunctionG(gCellId, set);
209 lbSolver().a_associatedBodyIds(cellId, set) = a_bodyIdG(gCellId, set);
210 }
211 } else {
212 if(!g_multiSolverGrid) {
213 ASSERT(cellId >= a_noLbCells(), "");
214 } else {
215 // multiSolverGrid, where the level and the grid-extension might differ!
216 if(cellId <= a_noLbCells()) { // grid-cell!
217 const MInt gCellParent = lb2lsIdParent(cellId);
218
219 if(gCellParent > -1) { // just a different level
220
221 if(noRfJumps == 0) {
222 // same maxRefinementLevel, meaning just a difference due to different refinement-widths
223 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
224 lbSolver().a_associatedBodyIds(cellId, set) = a_bodyIdG(gCellParent, set);
225 // ASSERT(!lsSolver().a_inBandG( gCellParent , set ), "");
226 lbSolver().a_levelSetFunctionMB(cellId, set) = a_levelSetFunctionG(gCellParent, set);
227 }
228 } else {
229 // ls-interpolation towards higher lb-level
230 if(lbSolver().a_isHalo(cellId) || lsSolver().a_isHalo(gCellParent)) continue;
231 // simple transfer if not a band-cell
232 if(lsSolver().m_buildCollectedLevelSetFunction && !lsSolver().a_inBandG(gCellParent, 0)) {
233 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
234 lbSolver().a_levelSetFunctionMB(cellId, set) = a_levelSetFunctionG(gCellParent, set);
235 lbSolver().a_associatedBodyIds(cellId, set) = a_bodyIdG(gCellParent, set);
236 }
237 continue;
238 }
239 const MInt levelDifference = lbSolver().c_level(cellId) - lsSolver().a_level(gCellParent);
240 if(levelDifference == 1) {
241 // direct interpolation from ls to fv for only 1 level difference
242 MFloat point[3] = {lbSolver().a_coordinate(cellId, 0), lbSolver().a_coordinate(cellId, 1),
243 lbSolver().a_coordinate(cellId, 2)};
244 MInt interpolationCells[8] = {0, 0, 0, 0, 0, 0, 0, 0};
245 MInt position = lsSolver().setUpLevelSetInterpolationStencil(gCellParent, interpolationCells, point);
246
247 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
248 lbSolver().a_associatedBodyIds(cellId, set) = a_bodyIdG(gCellParent, set);
249 if(position < 0) {
250 // no valid interpolation stencil found
251 lbSolver().a_levelSetFunctionMB(cellId, set) = a_levelSetFunctionG(gCellParent, set);
252 } else { // interpolation for all sets
253 const MFloat phi = lsSolver().interpolateLevelSet(interpolationCells, point, set);
254
255 lbSolver().a_levelSetFunctionMB(cellId, set) = phi;
256 }
257 }
258 // build collected levelset data
259 buildCollectedLevelSet(cellId);
260
261 } else {
262 // add cells based on which the fv-interpolation needs to start
263 // that is cells for which the level difference is above 1
264 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
265 lbSolver().a_associatedBodyIds(cellId, set) = a_bodyIdG(gCellParent, set);
266 }
267 MInt parent = cellId;
268 for(MInt i = 0; i < levelDifference - 1; i++) {
269 parent = lbSolver().c_parentId(parent);
270 }
271 ASSERT(parent > -1, "");
272 // parent of this parent has a direct link, meaning that the values for the parent
273 // are set above!
274 ASSERT(lb2lsId(lbSolver().c_parentId(parent)) == gCellParent, "");
275 interpolationParents.push_back(parent);
276 }
277 }
278 }
279 }
280 }
281 }
282 }
283
284 // now interpolate through all childs
285 // iterate downwards level by level and exchange values in between!
286 if(!interpolationParents.empty()) {
287 cerr << "This part is not tested yet!!!" << endl;
288 std::list<MInt> newInterpolationParents;
289
290 for(MInt lvl = lsSolver().maxUniformRefinementLevel(); lvl < lbSolver().maxRefinementLevel(); lvl++) {
291 lbSolver().exchangeData(&(lbSolver().a_levelSetFunctionMB(0, 0)), lbSolver().m_maxNoSets);
292 lbSolver().exchangeData(&(lbSolver().a_associatedBodyIds(0, 0)), lbSolver().m_maxNoSets);
293
294 MInt noInterpolationCells = (MInt)interpolationParents.size();
295 MPI_Allreduce(MPI_IN_PLACE, &noInterpolationCells, 1, MPI_INT, MPI_MAX, lbSolver().mpiComm(), AT_, "INPLACE",
296 "noInterpolationCells");
297 if(noInterpolationCells == 0) break;
298
299 if(interpolationParents.empty()) continue;
300
301 ASSERT(noRfJumps > 1, "");
302
303 interpolationParents.sort();
304 interpolationParents.unique();
305 newInterpolationParents.clear();
306
307 for(auto it = interpolationParents.begin(); it != interpolationParents.end(); it++) {
308 const MInt parent = (*it);
309 for(MInt c = 0; c < lbSolver().grid().m_maxNoChilds; c++) {
310 const MInt childId = lbSolver().c_childId(parent, c);
311 if(childId < 0) continue;
312 // interpolateLsLb(parent, childId);
313 if(!lbSolver().c_isLeafCell(childId)) {
314 newInterpolationParents.push_back(childId);
315 }
316 }
317 }
318 interpolationParents.clear();
319 for(auto it = newInterpolationParents.begin(); it != newInterpolationParents.end(); it++) {
320 const MInt cellId = (*it);
321 interpolationParents.push_back(cellId);
322 }
323 }
324 }
325 } else {
326 for(MInt cellId = 0; cellId < a_noLbCells(); cellId++) {
327 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
328 if(m_outsideDefault) {
329 lbSolver().a_levelSetFunctionMB(cellId, set) = a_outsideGValue();
330 } else {
331 lbSolver().a_levelSetFunctionMB(cellId, set) = -a_outsideGValue();
332 }
333 lbSolver().a_associatedBodyIds(cellId, set) = -2;
334 }
335 }
336 }
337}
338
343template <MInt nDim, MInt nDist, class SysEqn>
345 TRACE();
346 IF_CONSTEXPR(nDim == 3) { updateGeometry(); }
347}
348
349//---------------------------------------------------------------------------
350
351template <MInt nDim, MInt nDist, class SysEqn>
353 MInt noLevelSetFieldData = 0;
354
355 if(lsSolver().m_writeOutAllLevelSetFunctions) {
356 noLevelSetFieldData += noLevelSetFieldData + 2 * a_noSets();
357 } else {
358 noLevelSetFieldData += 1;
359 }
360 if(lsSolver().m_writeOutAllCurvatures) {
361 noLevelSetFieldData += a_noSets();
362 } else {
363 noLevelSetFieldData += 1;
364 }
365
366 return noLevelSetFieldData;
367}
368
369
373template <MInt nDim, MInt nDist, class SysEqn>
375 TRACE();
376
377 lbSolver().m_geometryIntersection->m_noEmbeddedBodies = lbSolver().m_noEmbeddedBodies;
378 lbSolver().m_geometryIntersection->m_noLevelSetsUsedForMb = lbSolver().m_noLevelSetsUsedForMb;
379 lbSolver().m_geometryIntersection->m_bodyToSetTable = lsSolver().m_bodyToSetTable;
380 lbSolver().m_geometryIntersection->m_setToBodiesTable = lsSolver().m_setToBodiesTable;
381 lbSolver().m_geometryIntersection->m_noBodiesInSet = lsSolver().m_noBodiesInSet;
382}
383
388template <MInt nDim, MInt nDist, class SysEqn>
390 TRACE();
391
392 if(lbSolver().m_constructGField) return;
393
394 MBool& firstRun = m_static_updateLevelSetFlowSolver_firstRun;
395
396 if(firstRun
397 || (lbSolver().m_trackMovingBndry && globalTimeStep >= lbSolver().m_trackMbStart
398 && globalTimeStep < lbSolver().m_trackMbEnd)) {
399 testCoupling();
400
401 // 1) transfer the levelSet Data to the flow solver
402 transferLevelSetFieldValues(true);
403 }
404
405 firstRun = false;
406}
407
408//-----
409
410template <MInt nDim, MInt nDist, class SysEqn>
412 TRACE();
413
414 if(lbSolver().isActive()) {
415 lbSolver().initializeMovingBoundaries();
416 lbBndCnd().initializeBndMovingBoundaries();
417 }
418 updateLevelSetFlowSolver();
419}
420
421template <MInt nDim, MInt nDist, class SysEqn>
423 TRACE();
424 lsSolver().m_timeStep = F1;
425}
426
427template <MInt nDim, MInt nDist, class SysEqn>
429 TRACE();
430 std::ignore = couplingStep;
431}
432
433template <MInt nDim, MInt nDist, class SysEqn>
435 TRACE();
436
437 switch(step) {
438 case 0: {
439 break;
440 }
441 case 1: {
442 updateLevelSetFlowSolver();
443 std::vector<MInt> maxGCellLevels(lsSolver().m_maxNoSets);
444 for(MInt set = 0; set < lsSolver().m_maxNoSets; set++) {
445 maxGCellLevels[set] = lsSolver().a_maxGCellLevel(set);
446 }
447
448 lbSolver().preCoupleLs(maxGCellLevels);
449
450 lbSolver().createBndryToBodyMapping(bndryToBodyMapping, bodyToBndryMapping);
451
452 lbBndCnd().createMBComm();
453
454 initializeSolidDomain();
455
456 MFloatScratchSpace bodyVelocities(m_maxNoEmbeddedBodies, nDim, AT_, "bodyVelocities");
457 for(MInt body = 0; body < m_maxNoEmbeddedBodies; body++) {
458 lsSolver().computeBodyPropertiesForced(2, &bodyVelocities(body, 0), body, globalTimeStep);
459 }
460
461 for(MInt mbCell = 0; mbCell < a_mbCell().size(); mbCell++) {
462 for(auto body : bndryToBodyMapping[mbCell]) {
463 for(MInt n = 0; n < nDim; n++) {
464 a_mbCell().velocity(mbCell, n) = bodyVelocities(body, n);
465 }
466 }
467 }
468
469 break;
470 }
471 default: {
472 break;
473 }
474 }
475}
476
477template <MInt nDim, MInt nDist, class SysEqn>
479 TRACE();
480
481 switch(step) {
482 case 0: {
483 break;
484 }
485 case 1: {
486 lbBndCnd().postCouple();
487 lsSolver().m_timeStep = F1;
488 break;
489 }
490 default: {
491 break;
492 }
493 }
494}
495
499template <MInt nDim, MInt nDist, class SysEqn>
501 TRACE();
502}
503
504template <MInt nDim, MInt nDist, class SysEqn>
506 TRACE();
507
508 if(solverId == 1) {
509 if(lbSolver().isActive()) {
510 lbSolver().initializeMovingBoundaries();
511 lbBndCnd().initializeBndMovingBoundaries();
512 }
513 updateLevelSetFlowSolver();
514 }
515}
516
517// Attempt to move initSolidDomain to coupler ...
518template <MInt nDim, MInt nDist, class SysEqn>
520 TRACE();
521
522 if(!lbSolver().isActive()) {
523 return;
524 }
525
526 MFloatScratchSpace bodyVelocities(a_noEmbeddedBodies(), nDim, AT_, "bodyVelocities");
527
528 // Get the body Velocity for each embedded body
529 for(MInt body = 0; body < a_noEmbeddedBodies(); body++) {
530 lsSolver().computeBodyPropertiesForced(2, &bodyVelocities(body, 0), body, globalTimeStep);
531 }
532
533 for(MInt i = 0; i < lbSolver().a_noCells(); i++) {
534 // Regular fluid cell
535 if(a_isActive(i) && a_wasActive(i)) {
536 continue;
537 }
538
539 // Regular Solid cell
540 if(!a_isActive(i)) {
541 // TODO labels:COUPLER,toremove Skip non-leaf cells ...
542 /*if(!lbSolver().c_isLeafCell(i)){
543 continue;
544 }*/
545
546 // determine the LS-Body to which the cell belongs, to set the right body velocity
547 MInt bodyId = -1;
548 MInt setOfBody = 0;
549 for(MInt set = lbSolver().m_levelSetId; set < lbSolver().m_maxNoSets; set++) {
550 if(a_associatedBodyIdsMb(i, set) >= 0) {
551 bodyId = a_associatedBodyIdsMb(i, set);
552 setOfBody = set;
553 break;
554 }
555 }
556
557 // the Velocity of the deactivated cell is set to the body velocity
558 // the Density is set to 1.0
559 if((bodyId >= 0) && (bodyId < a_noEmbeddedBodies()) && (a_levelSetFunctionMb(i, setOfBody) < 0)) {
560 for(MInt j = 0; j < nDim; j++) {
561 a_variable(i, j) = bodyVelocities(bodyId, j);
562 a_oldVariable(i, j) = bodyVelocities(bodyId, j);
563 }
564 MFloat squaredVelocity = 0.0;
565 for(MInt n = 0; n < nDim; n++) {
566 squaredVelocity += bodyVelocities(bodyId, n) * bodyVelocities(bodyId, n);
567 }
568 lbSolver().setEqDists(i, 1.0, &bodyVelocities(bodyId, 0));
569 if(a_isThermal()) {
570 a_variable(i, a_pvt()) = a_initTemperatureKelvin();
571 lbSolver().setEqDistsThermal(i, a_initTemperatureKelvin(), F1, squaredVelocity, &bodyVelocities(bodyId, 0));
572 }
573 } else {
574 for(MInt j = 0; j < a_noVariables(); j++) {
575 a_variable(i, j) = F0;
576 a_oldVariable(i, j) = F0;
577 }
578 MFloat squaredVelocity = 0.0;
579 MFloat bodyVelocitiesOutsideLs[nDim] = {F0};
580 lbSolver().setEqDists(i, 1.0, bodyVelocitiesOutsideLs);
581 if(a_isThermal()) {
582 a_variable(i, a_pvt()) = a_initTemperatureKelvin();
583 lbSolver().setEqDistsThermal(i, a_initTemperatureKelvin(), F1, squaredVelocity, bodyVelocitiesOutsideLs);
584 }
585 }
586 a_variable(i, a_pvrho()) = 1.0;
587 a_oldVariable(i, a_pvrho()) = 1.0;
588 } else {
589 lbBndCnd().refillEmergedCell(i);
590 }
591 }
592}
593
597template <MInt nDim, MInt nDist, class SysEqn>
599 TRACE();
600
601 lbSolver().a_levelSetFunctionMB(cellId, 0) = lbSolver().a_levelSetFunctionMB(cellId, 1);
602 lbSolver().a_associatedBodyIds(cellId, 0) = lbSolver().a_associatedBodyIds(cellId, 1);
603 for(MInt set = 2; set < a_noLevelSetsMb(); set++) {
604 MFloat phi0 = lbSolver().a_levelSetFunctionMB(cellId, 0);
605 MFloat phi1 = lbSolver().a_levelSetFunctionMB(cellId, set);
606 MInt body0 = lbSolver().a_associatedBodyIds(cellId, 0);
607 MInt body1 = lbSolver().a_associatedBodyIds(cellId, set);
608
609 //
610 if(phi0 >= F0 && phi1 >= F0) {
611 if(phi1 < phi0) {
612 body0 = body1;
613 }
614 phi0 = mMin(phi0, phi1);
615 } else if(phi0 <= F0 && phi1 <= F0) {
616 if(abs(phi1) > abs(phi0)) {
617 body0 = body1;
618 }
619 phi0 = -sqrt(phi0 * phi0 + phi1 * phi1);
620 } else if(phi0 * phi1 <= F0) {
621 if(phi0 < F0) {
622 // phi0 = phi0;
623 } else {
624 phi0 = phi1;
625 body0 = body1;
626 }
627 }
628
629 lbSolver().a_levelSetFunctionMB(cellId, 0) = phi0;
630 lbSolver().a_associatedBodyIds(cellId, 0) = body0;
631 }
632}
633
639template <MInt nDim, MInt nDist, class SysEqn>
641 TRACE();
642
643 MInt interpolationCells[8] = {0, 0, 0, 0, 0, 0, 0, 0};
644 MFloat point[3] = {lbSolver().a_coordinate(to, 0), lbSolver().a_coordinate(to, 1), lbSolver().a_coordinate(to, 2)};
645
646 const MInt position = lbSolver().setUpLbInterpolationStencil(from, interpolationCells, point);
647
648 for(MInt set = 0; set < a_noLevelSetsMb(); set++) {
649 if(position < 0) {
650 lbSolver().a_levelSetFunctionMB(to, set) = lbSolver().a_levelSetFunctionMB(from, set);
651 } else {
652 MFloat phi = interpolateLevelSet(interpolationCells, point, set);
653 lbSolver().a_levelSetFunctionMB(to, set) = phi;
654 }
655 }
656 buildCollectedLevelSet(to);
657}
658
662template <MInt nDim, MInt nDist, class SysEqn>
664 TRACE();
665
666 std::function<MFloat(const MInt, const MInt)> scalarField = [&](const MInt cellId, const MInt refSet) {
667 return static_cast<MFloat>(lbSolver().a_levelSetFunctionMB(cellId, refSet));
668 };
669
670 std::function<MFloat(const MInt, const MInt)> coordinate = [&](const MInt cellId, const MInt id) {
671 return static_cast<MFloat>(lbSolver().a_coordinate(cellId, id));
672 };
673
674 return lbSolver().interpolateFieldDataLb(&interpolationCells[0], &point[0], set, scalarField, coordinate);
675}
676
677
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
Definition: alloc.h:173
static MInt propertyLength(const MString &name, MInt solverId=m_noSolvers)
Returns the number of elements of a property.
Definition: context.cpp:538
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
Definition: context.cpp:494
This class represents all LB models.
Definition: lbsolverdxqy.h:29
Definition: lslb.h:25
void interpolateLsLb(const MInt from, const MInt to)
interpolate levelset values on the lb-grid
Definition: lslb.cpp:640
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
LsLb(MInt couplingId, LsSolver *ls, LbSolver *lb)
Definition: lslb.cpp:23
void finalizeSubCoupleInit(MInt couplingStep) override
Definition: lslb.cpp:428
void updateGeometry()
Updates the member-variables in the geometry-intersection class.
Definition: lslb.cpp:374
void init() override
Definition: lslb.cpp:411
void preCouple(MInt step) override
Definition: lslb.cpp:434
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 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
void readProperties()
void postCouple(MInt step) override
Definition: lslb.cpp:478
void updateLevelSetFlowSolver()
Updates the fv-mb-solver flow solver (after a completed levelSet TimeStep and finalizeLevelSet() )
Definition: lslb.cpp:389
MInt noLevelSetFieldData()
Definition: lslb.cpp:352
void initData()
void createBodyTree()
transfers the LevelSetValues from the levelset to the moving boundary Part
Definition: lslb.cpp:344
This class is a ScratchSpace.
Definition: scratch.h:758
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29
constexpr T mMin(const T &x, const T &y)
Definition: functions.h:90
constexpr T mMax(const T &x, const T &y)
Definition: functions.h:94
MInt globalTimeStep
MBool g_multiSolverGrid
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52
bool MBool
Definition: maiatypes.h:58
MInt id
Definition: maiatypes.h:71
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce