MCPcopy Create free account
hub / github.com/AMReX-Astro/Castro / ambient_fill

Function ambient_fill

Source/problems/ambient_fill.cpp:63–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61
62
63void
64ambient_fill(const Box& bx, Array4<Real> const& state,
65 Geometry const& geom, const Vector<BCRec>& bcr)
66{
67
68 // Make a copy of the BC that can be passed by value to the ParallelFor.
69 // even though this fills all components, we only check the density BCs
70
71 if (! castro::fill_ambient_bc) {
72 return;
73 }
74
75 const BCRec bc = bcr[URHO];
76
77 const auto domlo = geom.Domain().loVect3d();
78 const auto domhi = geom.Domain().hiVect3d();
79
80 const bool ambient_x_lo = (castro::ambient_fill_dir == 0 || castro::ambient_fill_dir == -1) &&
81 (bc.lo(0) == amrex::BCType::foextrap || bc.lo(0) == amrex::BCType::hoextrap);
82 const bool ambient_x_hi = (castro::ambient_fill_dir == 0 || castro::ambient_fill_dir == -1) &&
83 (bc.hi(0) == amrex::BCType::foextrap || bc.hi(0) == amrex::BCType::hoextrap);
84
85#if AMREX_SPACEDIM >= 2
86 const bool ambient_y_lo = (castro::ambient_fill_dir == 1 || castro::ambient_fill_dir == -1) &&
87 (bc.lo(1) == amrex::BCType::foextrap || bc.lo(1) == amrex::BCType::hoextrap);
88 const bool ambient_y_hi = (castro::ambient_fill_dir == 1 || castro::ambient_fill_dir == -1) &&
89 (bc.hi(1) == amrex::BCType::foextrap || bc.hi(1) == amrex::BCType::hoextrap);
90#endif
91
92#if AMREX_SPACEDIM == 3
93 const bool ambient_z_lo = (castro::ambient_fill_dir == 2 || castro::ambient_fill_dir == -1) &&
94 (bc.lo(2) == amrex::BCType::foextrap || bc.lo(2) == amrex::BCType::hoextrap);
95 const bool ambient_z_hi = (castro::ambient_fill_dir == 2 || castro::ambient_fill_dir == -1) &&
96 (bc.hi(2) == amrex::BCType::foextrap || bc.hi(2) == amrex::BCType::hoextrap);
97#endif
98
99
100 amrex::ParallelFor(bx,
101 [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
102 {
103 if ((ambient_x_lo && i < domlo[0]) ||
104 (ambient_x_hi && i > domhi[0])
105#if AMREX_SPACEDIM >= 2
106 ||
107 (ambient_y_lo && j < domlo[1]) ||
108 (ambient_y_hi && j > domhi[1])
109#endif
110#if AMREX_SPACEDIM == 3
111 ||
112 (ambient_z_lo && k < domlo[2]) ||
113 (ambient_z_hi && k > domhi[2])
114#endif
115 ) {
116 for (int n = 0; n < NUM_STATE; ++n) {
117 state(i,j,k,n) = ambient::ambient_state[n];
118 }
119
120 if (castro::ambient_outflow_vel == 1) {

Callers 1

ca_statefillFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected