AMReX-Codes / amrex

AMReX: Software Framework for Block Structured AMR
https://amrex-codes.github.io/amrex
Other
506 stars 337 forks source link

how to get the averaged value from the mutlilevel MultiFabs? #3891

Closed ztdepztdep closed 2 months ago

ztdepztdep commented 3 months ago

I want to get the total averaged value from the mutlilevel MultiFabs? Which function does this job?

WeiqunZhang commented 3 months ago

There is a function called volumeWeightedSum in AMReX_MultiFabUtil.H that probably does what you want. It returns a volume weighted sum of all "leaf" cells.

ztdepztdep commented 3 weeks ago

I got this error:"error: invalid initialization of reference of type ‘const amrex::Vector<const amrex::MultiFab*>&’ from expression of type ‘amrex::Vector<amrex::MultiFab, std::allocator >’ Real average=volumeWeightedSum(Rho,1,geom,nsubsteps);" I declar the first parameter as amrex::Vector Rho;