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

Function main

Diagnostics/Sedov/main.cpp:118–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118int main(int argc, char* argv[])
119{
120
121 amrex::Initialize(argc, argv, false);
122
123 // timer for profiling
124 BL_PROFILE_VAR("main()", pmain);
125
126 // Input arguments
127 std::string pltfile, slcfile;
128 bool sphr = false;
129
130 GetInputArgs (argc, argv, pltfile, slcfile, sphr);
131
132 auto center = GetCenter(pltfile);
133 double xctr = center[0];
134 double yctr = center[1];
135 double zctr = center[2];
136
137 PlotFileData pf(pltfile);
138
139 int fine_level = pf.finestLevel();
140 const int dim = pf.spaceDim();
141
142 // get the index bounds and dx.
143 Box domain = pf.probDomain(fine_level);
144 auto dx = pf.cellSize(fine_level);
145 auto problo = pf.probLo();
146 auto probhi = pf.probHi();
147 int coord = pf.coordSys();
148
149 // compute the size of the radially-binned array -- we'll do it to
150 // the furtherest corner of the domain
151
152#if (AMREX_SPACEDIM == 1)
153 double maxdist = std::abs(probhi[0] - problo[0]);
154
155#elif (AMREX_SPACEDIM == 2)
156 double x_maxdist = amrex::max(std::abs(probhi[0] - xctr),
157 std::abs(problo[0] - xctr));
158 double y_maxdist = amrex::max(std::abs(probhi[1] - yctr),
159 std::abs(problo[1] - yctr));
160 double maxdist = std::sqrt(x_maxdist*x_maxdist +
161 y_maxdist*y_maxdist);
162
163 // For spherical 2D, the max distance away from blast center
164 // always happens at max(θ - θ_0) for 0 < θ < π.
165 if (coord == 2) {
166 Real theta_maxdist = amrex::max(std::abs(problo[1] - yctr),
167 std::abs(probhi[1] - yctr));
168 maxdist = probhi[0] * probhi[0] + xctr * xctr -
169 2.0_rt * probhi[0] * xctr * std::cos(theta_maxdist);
170 }
171#else
172 double x_maxdist = amrex::max(std::abs(probhi[0] - xctr),
173 std::abs(problo[0] - xctr));
174 double y_maxdist = amrex::max(std::abs(probhi[1] - yctr),
175 std::abs(problo[1] - yctr));

Callers

nothing calls this directly

Calls 6

distanceFunction · 0.85
get_coord_infoFunction · 0.85
isValidMethod · 0.80
closeMethod · 0.80
GetInputArgsFunction · 0.70
GetCenterFunction · 0.70

Tested by

no test coverage detected