-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Gravity with subcycling #499
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 143. Check the log or trigger a new build to see more.
@@ -139,6 +141,7 @@ template <typename problem_t> class RadhydroSimulation : public AMRSimulation<pr | |||
amrex::Long radiationCellUpdates_ = 0; // total number of radiation cell-updates | |||
|
|||
amrex::Real Gconst_ = C::Gconst; // gravitational constant G | |||
std::unique_ptr<Gravity<problem_t>> gravitySolver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created the gravity solver object here, but I apparently never initialized it. In the test problem in test_poisson.cpp
, I create a separate Gravity<problem_t>
object just for testing purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do I remove this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed in either AMRSimulation
or RadhydroSimulation
. Which one is up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay lets keep it here as it is then.
// solve Poisson equation | ||
amrex::Print() << "Initializing gravity solver..." << std::endl; | ||
|
||
Gravity<PoissonProblem> grav(&sim, phys_bc, sim.coordCenter_, HydroSystem<PoissonProblem>::density_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I created a Gravity<PoissonProblem>
object for testing purposes. For real usage, it should all be contained within AMRSimulation/RadhydroSimulation.
// Fill data from the level below if we're not doing a solve on this level | ||
|
||
if (level > gravity::max_solve_level) { | ||
sim->FillCoarsePatch(level, time, grav_vector, g_old_, g_new_, 0, 3, quokka::direction::na); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we dont need g_old_
and g_new_
here anymore? This function expects integers as arguments at the 4th and 5th positions, and I think these integer arguments are 0 and 3.
I would recommend reading this (and the referenced Castro paper) before going much farther: #334. The algorithm is non-trivial. |
Ah, I thought this was not going to be hard because of all the modifications to quokka in the last 2 years. If it remains non-trivial I wouldn't have the time to implement it either. Let's leave it here for now - at least a lot of the code in this PR (originally from #20 ) has caught up with the current version of quokka. |
It's easier, but not totally trivial. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 124. Check the log or trigger a new build to see more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 114. Check the log or trigger a new build to see more.
#ifndef GRAVITY_HPP_ | ||
#define GRAVITY_HPP_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: header guard does not follow preferred style [llvm-header-guard]
#ifndef GRAVITY_HPP_ | |
#define GRAVITY_HPP_ | |
#ifndef GITHUB_WORKSPACE_SRC_GRAVITY_HPP | |
#define GITHUB_WORKSPACE_SRC_GRAVITY_HPP |
src/Gravity.hpp:467:
- #endif // GRAVITY_HPP_
+ #endif // GITHUB_WORKSPACE_SRC_GRAVITY_HPP
|
||
static const int test_solves; | ||
static amrex::Real mass_offset; | ||
static amrex::Real Ggravity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'Ggravity' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static amrex::Real Ggravity;
^
static const int test_solves; | ||
static amrex::Real mass_offset; | ||
static amrex::Real Ggravity; | ||
static int stencil_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'stencil_type' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int stencil_type;
^
@@ -0,0 +1,653 @@ | |||
//============================================================================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: header is missing header guard [llvm-header-guard]
//============================================================================== | |
#ifndef GITHUB_WORKSPACE_SRC_GRAVITY_IMPL_HPP | |
#define GITHUB_WORKSPACE_SRC_GRAVITY_IMPL_HPP | |
//============================================================================== |
src/Gravity_impl.hpp:-1:
+
+ #endif
|
||
#include "Gravity.hpp" | ||
|
||
template <typename T> Real Gravity<T>::mass_offset = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redefinition of 'mass_offset' [clang-diagnostic-error]
template <typename T> Real Gravity<T>::mass_offset = 0.0;
^
Additional context
src/Gravity.hpp:463: '/github/workspace/src/Gravity_impl.hpp' included multiple times, additional include site here
#include "Gravity_impl.hpp"
^
src/Gravity_impl.hpp:20: unguarded header; consider using #ifdef guards or #pragma once
template <typename T> Real Gravity<T>::mass_offset = 0.0;
^
|
||
#include "Gravity.hpp" | ||
|
||
template <typename T> Real Gravity<T>::mass_offset = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'mass_offset' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
template <typename T> Real Gravity<T>::mass_offset = 0.0;
^
#include "Gravity.hpp" | ||
|
||
template <typename T> Real Gravity<T>::mass_offset = 0.0; | ||
template <typename T> Real Gravity<T>::Ggravity = 0.; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redefinition of 'Ggravity' [clang-diagnostic-error]
template <typename T> Real Gravity<T>::Ggravity = 0.;
^
Additional context
src/Gravity.hpp:463: '/github/workspace/src/Gravity_impl.hpp' included multiple times, additional include site here
#include "Gravity_impl.hpp"
^
src/Gravity_impl.hpp:21: unguarded header; consider using #ifdef guards or #pragma once
template <typename T> Real Gravity<T>::Ggravity = 0.;
^
#include "Gravity.hpp" | ||
|
||
template <typename T> Real Gravity<T>::mass_offset = 0.0; | ||
template <typename T> Real Gravity<T>::Ggravity = 0.; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'Ggravity' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
template <typename T> Real Gravity<T>::Ggravity = 0.;
^
template <typename T> Real Gravity<T>::mass_offset = 0.0; | ||
template <typename T> Real Gravity<T>::Ggravity = 0.; | ||
|
||
template <typename T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: constructor does not initialize these fields: mlmg_lobc, mlmg_hibc [cppcoreguidelines-pro-type-member-init]
template <typename T>
^
template <typename T> Real Gravity<T>::Ggravity = 0.; | ||
|
||
template <typename T> | ||
Gravity<T>::Gravity(AMRSimulation<T> *_sim, BCRec &_phys_bc, amrex::GpuArray<Real, AMREX_SPACEDIM> &_coordCenter, int Density_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redefinition of 'Gravity' [clang-diagnostic-error]
Gravity<T>::Gravity(AMRSimulation<T> *_sim, BCRec &_phys_bc, amrex::GpuArray<Real, AMREX_SPACEDIM> &_coordCenter, int Density_,
^
Additional context
src/Gravity_impl.hpp:24: previous definition is here
Gravity<T>::Gravity(AMRSimulation<T> *_sim, BCRec &_phys_bc, amrex::GpuArray<Real, AMREX_SPACEDIM> &_coordCenter, int Density_,
^
Description
Continues #20 to add gravity with subcycling
Related issues
#20
Checklist
Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an
x
inside the square brackets[ ]
in the Markdown source below:/azp run
.