Comments (14)
Are you talking about the error estimate is done on the finest level first and then down to the base level? Could you explain why you want the other way?
from amrex.
Yes, exactly.
As far as I see, the regrid process is always called within a loop from the base level up to the current top level. So, one regrids some levels multiple time. I don't know the reason why it's done like this ... but I think there is one for sure.
However, in my application I will regrid always from the coarsest level up to the finest, thus, it would be faster just to regrid every level once.
from amrex.
So I think what's need to be changed is not MakeNewGrids
but how regrid
, which calls NakeNewGrids
, is called. Could you show us the code how regrid
is called inside time stepping loops?
from amrex.
In case of my application is just call regrid(0, time)
assuming all levels are initialized. In case of AMReX it's called in AMReX_Amr.cpp in a loop.
The for-loop downwards is implemented in MakeNewGrids
, thus, I'm not sure if one can change the behaviour if one calls regrid
differently.
from amrex.
The regrid downwards ensures that each levels ends up properly nested. How would you propose to guarantee that otherwise?
from amrex.
I thought you are not using Amr
and AmrLevel
and instead you have own class derived from AmrCore
. Have you switched?
from amrex.
@WeiqunZhang I'm using my own class, you're right. But it's now derived from AmrMesh
instead of AmrCore
.
@drummerdoc In order to set up the grids of level l+1
the grids of level l
need to be set up first. Therefore, going "upwards" shouldn't give bad results, since level l+1
grids can't exist without level l
grids.
In the loops of AMReX the base level is increased in every iteration, thus, all grids from the finest to the base level are rebuilt. One actually performs a double loop, where the outer loop goes upwards and inner loop downwards.
from amrex.
Are you sure your class is derived from AmrMesh
, not AmrCore
? Note that regrid
function does not even exist in AmrMesh
. Do you have your own version? Also Particle class depends on AmrCore
, not AmrMesh
.
Again, #70 (comment)
from amrex.
Yes, I'm sure that it's AmrMesh
. Since we use the OPAL particle class I thought it's better to inherit from AmrMesh
. I then copied the regrid
function into my Amr class.
from amrex.
Here is my guess of what you need and why. All your particles are on the finest level. Other than particles, there are no other data that cannot be generated from particles. You want to call error estimate function on the finest level and only on the finest level, because error estimate is expensive. Then coarse level grids are generated based on the finest level grids. Is that correct? If that's the case, I think all you need is for virtual void ErrorEst (int lev, TagBoxArray& tags, Real time, int ngrow)
to return immediately if lev
is not max_level-1
.
from amrex.
Depending on the tagging strategy the particles do not necessarily live on the finest level.
Since the finest levels are tagged first, I basically agree with you on the fact that coarse level grids are generated based on the finest level grids -- but couldn't it done the other way around?
However, I'll try your approach and will let you know.
from amrex.
I ran two short tests on 4 cores each, where I perform 2000 steps (overall CPU total time around 1000s). After each step I perform a regrid. I had following regrid strategies:
1st approach (as done in AMReX)
for (int i = 0; i <= lev_top; ++i)
amrobj_mp->regrid(i, time);
Total regrid time: 137s
2nd approach
for (int i = lev_start; i <= lev_top; ++i)
amrobj_mp->regrid(i, time);
where lev_start
is the first level with particles.
Total regrid time: 100s
from amrex.
The loop in AMReX is not like what's in your comment. If that's the real code in your application without any simplification, you are indeed calling regrid too many times and that's why we wanted to see your code in #70 (comment) and #70 (comment).
But I believe Andrew has already suggested in his correspondence with you you can just do amrobj_mpi->regrid(0,time)
(except during initialization)?
And as suggested in #70 (comment), your virtual void EstError
can be like,
if (lev < std:min(finest_level,max_level-1)) return;
from amrex.
Except to the call to okToRegrid(i)
you also perform a loop in Amr::timeStep
over the levels incrementing the base level ...
How it's currently implemented:
int lev_top = std::min(amrobj_mp->finestLevel(), maxLevel - 1);
*gmsg << "* Start regriding:" << endl
<< "* Old finest level: "
<< amrobj_mp->finestLevel() << endl;
for (int i = 0; i <= lev_top; ++i)
amrobj_mp->regrid(i, lev_top, t_m * 1.0e9 /*time [ns] */);
*gmsg << "* New finest level: "
<< amrobj_mp->finestLevel() << endl
<< "* Finished regriding" << endl;
I initialize all levels at the beginning, thus, the call amrobj_mp->regrid(0, time)
should be fine.
from amrex.
Related Issues (20)
- Segfault using FillPatcher with recent AMReX versions HOT 3
- Question about clear AMReX Particle HOT 4
- CMake: Update CUDA Logic to 3.24+
- Suspected Repeated data in MLCellLinOp HOT 8
- Add more support for N dimensions HOT 2
- Implicit Solution for Advection Problem: Does it support it? HOT 4
- AMReX Build Errors Windows Visual Studio 2022 (CUDA Enabled) - With Latest Development branch Pull HOT 3
- use HIP stream-ordered allocator HOT 1
- tests fail if only 1 GPU on compute node HOT 1
- Choose a base code for 3D BN equation HOT 2
- How to interpolate a variable field to another grid system. HOT 4
- which function calls the ParallelCopy_nowait() , it consumes 58.44 % of cose in my program HOT 2
- HDF5 + managed memory off HOT 3
- AMReX_FPE is not equivalent to `amrex.fpe_trap_*` options
- Ability to set AMREX_CUDA_ARCH to sm_80 HOT 1
- does fextract support extract values at a points. HOT 4
- FMM using Amrex (or pyamrex) HOT 4
- efficient parallelism with ParticleContainer HOT 7
- HDF5 error on WriteSingleLevelPlotfileHDF5 HOT 6
- Periodicity with multiple layers of ghost nodes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amrex.