monitor functions #5508
Replies: 5 comments 4 replies
|
https://amrex-codes.github.io/amrex/doxygen/namespaceamrex.html#a77c1d037f86dc7d1fcfe255428503c99 You can try the |
|
I asked codex to write a function using amrex::get_cell_data and amrex::KeyValue<int,Real>. Here is what it wrote. I think it's correct. |
|
I have trouble understanding what you are trying to do, so I chatted with codex. Me: do you understand what the user is asking in AMReX Discussion 5508? Codex: • Yes. They are trying to write a monitor/free-surface locator in IAMReX/NavierStokes. The practical request is: They want to find where phi crosses zero along the left boundary, on the finest AMR level, then convert that AMR cell/index location into physical coordinates. The latest issue is not really get_cell_data anymore. It is two things:
So the answer should probably explain: use parent->Geom(finest_level) for finest-level physical coordinates, and do not index MultiFab by global BoxArray index unless the FAB is local. Me: › What does phi crosses zero mean? Codex: • “phi crosses zero” means the scalar field phi changes sign between two neighboring sample points. For example, if along a vertical line: phi(i,j,k) = -0.2 then the product is negative: phi(i,j,k) * phi(i,j+1,k) < 0 so somewhere between those two points, phi = 0. In their code, that zero location is being treated as the free surface/interface location. They then linearly interpolate between the two neighboring values to estimate the physical y Me: › What if there are k's that satisfies the condition? Codex: • Then the current code is ambiguous and likely wrong. Right now it does: int jFace = -1; for (int k = lo.z; k <= hi.z; ++k) { If multiple k values satisfy the condition, jFace just gets overwritten. The final value is the last crossing found in loop order, and the code later uses lo.z instead of the k where the They need to decide what quantity they actually want:
At minimum, the search should track both indices: int jFace = -1; if ((a(i,j,k,phicomp) * a(i,j+1,k,phicomp)) < 0) { and then interpolate using kFace, not lo.z. |
|
So maybe instead of trying to fix the code (your assumed solution), you can explain what you try to do (the underlying goal)? |
|
To fix the segfault, I think you should use
Here the reduce should be on fab not multifab. fab.min(amrex::makeSlab(box,0,lo.x), phicomp) |
Uh oh!
There was an error while loading. Please reload this page.
First of all can I apologise for accidentally posting this as an issue #5505,
I want to write a function which can interrogate the AMR data structure to evaluate one of the variables at a point closest to a specified co-ordinate. I'm new to AMREX and am working with IAMReX. The function needs to be called at every coarse time step but find the variable on the finest grid. I'm having problems with the approach of getting the data using
causing a segmentation fault in find_level when it starts to loop over the patches in the MultiFab
All reactions