/home/runner/work/amr-wind/amr-wind/amr-wind/fvm/fvm_utils.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/fvm/fvm_utils.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
fvm_utils.H
Go to the documentation of this file.
1#ifndef FVM_UTILS_H
2#define FVM_UTILS_H
3
6
7#include "AMReX_MFIter.H"
8
10
13template <typename FvmOp, typename FType>
14inline void apply(const FvmOp& fvmop, const FType& fld)
15{
16 namespace stencil = amr_wind::fvm::stencil;
17 const int nlevels = fld.repo().num_active_levels();
18 for (int lev = 0; lev < nlevels; ++lev) {
19 const auto& domain = fld.repo().mesh().Geom(lev).Domain();
20 const auto& mfab = fld(lev);
21
22#ifdef AMREX_USE_OMP
23#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
24#endif
25 for (amrex::MFIter mfi(mfab, amrex::TilingIfNotGPU()); mfi.isValid();
26 ++mfi) {
27
28 fvmop.template apply<stencil::StencilInterior>(lev, mfi);
29
30 // Check if the box touches any of the physical domain boundaries.
31 // If not, short circuit the rest of the code and move on to the
32 // next multifab.
33 if (domain.strictly_contains(mfi.tilebox())) {
34 continue;
35 }
36
37 // faces
38 fvmop.template apply<stencil::StencilILO>(lev, mfi);
39 fvmop.template apply<stencil::StencilJLO>(lev, mfi);
40 fvmop.template apply<stencil::StencilKLO>(lev, mfi);
41 fvmop.template apply<stencil::StencilIHI>(lev, mfi);
42 fvmop.template apply<stencil::StencilJHI>(lev, mfi);
43 fvmop.template apply<stencil::StencilKHI>(lev, mfi);
44
45 // edges
46 fvmop.template apply<stencil::StencilIhiJlo>(lev, mfi);
47 fvmop.template apply<stencil::StencilIhiJhi>(lev, mfi);
48
49 fvmop.template apply<stencil::StencilIhiKlo>(lev, mfi);
50 fvmop.template apply<stencil::StencilIhiKhi>(lev, mfi);
51
52 fvmop.template apply<stencil::StencilJhiKlo>(lev, mfi);
53 fvmop.template apply<stencil::StencilJhiKhi>(lev, mfi);
54
55 fvmop.template apply<stencil::StencilIloJlo>(lev, mfi);
56 fvmop.template apply<stencil::StencilIloJhi>(lev, mfi);
57
58 fvmop.template apply<stencil::StencilIloKlo>(lev, mfi);
59 fvmop.template apply<stencil::StencilIloKhi>(lev, mfi);
60
61 fvmop.template apply<stencil::StencilJloKlo>(lev, mfi);
62 fvmop.template apply<stencil::StencilJloKhi>(lev, mfi);
63
64 // corners
65 fvmop.template apply<stencil::StencilIloJloKlo>(lev, mfi);
66 fvmop.template apply<stencil::StencilIloJloKhi>(lev, mfi);
67 fvmop.template apply<stencil::StencilIloJhiKlo>(lev, mfi);
68 fvmop.template apply<stencil::StencilIloJhiKhi>(lev, mfi);
69 fvmop.template apply<stencil::StencilIhiJloKlo>(lev, mfi);
70 fvmop.template apply<stencil::StencilIhiJloKhi>(lev, mfi);
71 fvmop.template apply<stencil::StencilIhiJhiKlo>(lev, mfi);
72 fvmop.template apply<stencil::StencilIhiJhiKhi>(lev, mfi);
73 }
74 }
75}
76
77} // namespace amr_wind::fvm::impl
78
79#endif /* FVM_UTILS_H */
Definition fvm_utils.H:9
void apply(const FvmOp &fvmop, const FType &fld)
Definition fvm_utils.H:14
Definition stencils.H:43
Second-order finite volume discretization stencil coefficients.