sxs-collaboration / spectre

SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gravitational physics.
https://spectre-code.org
Other
162 stars 191 forks source link

Domain diagnostics #4382

Open nilsvu opened 2 years ago

nilsvu commented 2 years ago

We need to improve our capabilities to analyze where our computational grids need more or less resolution. This is important for many reasons:

Here's a list of useful diagnostics. We should evaluate the strengths and limitations of these quantities carefully while implementing them. This knowledge will be important for implementing AMR algorithms, so please document your findings!

nilsdeppe commented 2 years ago

I think another reasonable diagnostic is to compare the analytic Jacobian compared to the numerical logical partial derivative of the inertial coordinates. Specifically the (relative) difference between the too should give a good indication of how resolved the maps are

nilsdeppe commented 1 year ago

Thinking more about the Jacobian metric, you want to look at

$$ C{\hat{\imath}} = 1 - \frac{\sum{i} \partial{\hat{\imath}} x^i }{\sum{i} D_{\hat{\imath}} x^i}. $$

You want to do the sums in the numerator and denominator to avoid any division by zero. Another alternative is

$$ C{\hat{\imath}} = 1 - \sum{i} \frac{\partial{\hat{\imath}} x^i }{D{\hat{\imath}} x^i + \epsilon} $$

where $\epsilon$ is a parameter to avoid division by zero and should be small (e.g. 1e-20 or so). In both forms $\partial{\hat{\imath}}x^i$ is the analytic Jacobian while $D{\hat{\imath}} x^i$ is the numerical Jacobian computed using logical_partial_derivatives.

nilsdeppe commented 1 year ago

There is also a power monitor/AMR implementation in dg-charm on bitbucket, so when someone starts working on that, please ask to have access to that code.

guilara commented 1 year ago

Hi @nilsdeppe. I've started looking into this. Could you please give me access to the code you are mentioning? Thanks!