AMReX-Codes / amrex

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

How to interpolate a variable field to another grid system. #3995

Open ztdepztdep opened 2 weeks ago

ztdepztdep commented 2 weeks ago

I get the current varaible fields on a 100x100 grids. Now I want to use this for the initial fields on another 180x180 grids. How to interpolate the values.

WeiqunZhang commented 3 days ago

The example you give has a refinement ratio of 1.8. We do not support non-integer refinement ratio. If that's what you need, you could write your own function to do it. You need to create of a temporary MultiFab that has same number of boxes and DistributionMapping as the fine MultiFab. You use that to store the coarse data that can be used to do spatial interpolation. Each Box in that temporary needs to be big enough for the type of interpolation algorithm you choose.

ztdepztdep commented 2 days ago

The example you give has a refinement ratio of 1.8. We do not support non-integer refinement ratio. If that's what you need, you could write your own function to do it. You need to create of a temporary MultiFab that has same number of boxes and DistributionMapping as the fine MultiFab. You use that to store the coarse data that can be used to do spatial interpolation. Each Box in that temporary needs to be big enough for the type of interpolation algorithm you choose.

ok, if i use a refinement ratio of 2. how to do the interplation.

WeiqunZhang commented 2 days ago

Then you can probably use FillPatchSingleLevel and FillPatchTwoLevels. If not, please let us know more details. What are your inputs, what are the outputs you like? What do "the current varaible fields" mean exactly? How are the data stored?