-
Notifications
You must be signed in to change notification settings - Fork 191
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
Add BnsInitialData System #6054
Add BnsInitialData System #6054
Conversation
@nilsvu whenever you get a chance! |
src/Elliptic/Systems/IrrotationalBns/BoundaryConditions/Neumann.cpp
Outdated
Show resolved
Hide resolved
src/Elliptic/Systems/IrrotationalBns/BoundaryConditions/Neumann.hpp
Outdated
Show resolved
Hide resolved
* formulated as a set of coupled first-order PDEs. | ||
* | ||
* \details This system formulates the Irrotational Bns HSE equations for the | ||
* velocity potential \f$\Phi\f$. For a background matter distribution (given |
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.
(optional) note that you can write standard latex $\Phi$
and \begin{align}...\end{align}
; you don't need those \f
.
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.
Oh huh, that makes things easier. I'll start doing that from now on
::tenex::update(source_for_potential, | ||
(*source_for_potential)() + | ||
flux_for_potential(ti::I) * | ||
(log_deriv_of_lapse_over_specific_enthalpy(ti::i) - |
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.
Does this include the factor of \rho
as well in D_i \ln(\alpha\rho / h)
?
Also I think the Christoffels should be added, not subtracted? The equation is -\partial_i F^i + S = f
please check.
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.
Yes, it does include the factor of \rho
, I'll change the variable name to make that obvious but maybe we can condense it in the future.
Hm, I would think the Christoffel should be be subtracted, we have the equation which looks like -D_i F^i + S_flat = f
and then we expand the term D_i F^i = \partial_i F^i + Gamma^i_{ij}F^j
so -Gamma^i_{ij} F^j
gets added to the sources
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.
Yes you're right it should be subtracted, but the other term as well if I did the math correctly
* \f] | ||
*/ | ||
template <typename DataType> | ||
struct AuxiliaryVelocity : db::SimpleTag { |
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.
You can delete this tag, and also some or all of the tags below this (at least for now).
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 basically If I deleted these now they would get added back in when the executable is added?
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.
You can keep the ones you surely will need, like the Euler constant. But e.g. the FixedSources
tag you don't need because there's already one in DataStructures/DataBox/Prefixes.hpp
.
// The constant term on the RHS is nonlinear with respect to the | ||
// operator, so the linearized form of the RHS is zero. |
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.
"The term on the RHS is constant w.r.t. the variables, so the linearized form of the RHS is zero."
class Neumann : public elliptic::BoundaryConditions::BoundaryCondition<3> { | ||
/// Impose StarSurface boundary conditions | ||
/// \f[ | ||
/// n_i F^i = \frac{1}{\sqrt{\partial_i \rho \partial_j \rho \gamma^{ij}} |
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 should be just n_i F^i = C/square(alpha) B^i n_i
, right?
set_number_of_grid_points(n_dot_auxiliary_velocity, *velocity_potential); | ||
get(*n_dot_auxiliary_velocity) = 0.0; | ||
tenex::evaluate<>(n_dot_auxiliary_velocity, | ||
-euler_enthalpy_constant / square(lapse()) * |
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 the minus sign is incorrect?
@@ -47,6 +47,8 @@ void fluxes_on_face( | |||
const tnsr::I<DataVector, 3>& face_normal_vector, | |||
const tnsr::II<DataVector, 3>& rotational_shift_stress, | |||
const Scalar<DataVector>& velocity_potential) { | |||
// potential optimization : precompute the produce of the `face_normal` |
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.
produce -> product
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.
🥦 -> ✖️ 👍
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.
ping
source_for_potential, | ||
(*source_for_potential)() + | ||
flux_for_potential(ti::I) * | ||
(log_deriv_lapse_times_density_over_specific_enthalpy(ti::i) - |
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 both of these terms should have a minus sign. Please check.
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.
still a minus sign to fix (unless I got the math wrong)
* velocity potential \f$\Phi\f$. For a background matter distribution (given | ||
* by the specific enthalpy h) and a background metric \f$\gamma_{ij}\f$. | ||
* The velocity potential is defined by \f$D_i \Phi = h u_i\f$ with \f$u_i\f$ | ||
(the spatial part of) the four velocity |
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.
fix this line (and more below that don't start with *
)
* | ||
* The system can be formulated in terms of these fluxes and sources (see | ||
* `elliptic::protocols::FirstOrderSystem`): | ||
* | ||
* | ||
* \f{align*} | ||
* D_i F^i + S = f |
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.
-\partial_i F^i + S = f
(note the minus sign and \partial_i
). This means some minus signs in the equations below need to be fixed too.
* F^i_{v_j} &= u \delta^i_j \\ | ||
* S_{v_j} &= v_j \\ | ||
* f_{v_j} &= 0 \text{.} | ||
* F^i &= h u^i - \frac{B^j h u_j}{\alpha^2}B^i \\ |
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.
h u^i
-> \partial_i \phi
to make clear that the flux depends on the gradient of the potential
I think everything should be done except removing the "flat" things. I'll do that in a separate commit after squashing all of this because I plan on keeping it around on a branch just in case it becomes useful for checking that the executable is working |
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.
You can squash everything
source_for_potential, | ||
(*source_for_potential)() + | ||
flux_for_potential(ti::I) * | ||
(log_deriv_lapse_times_density_over_specific_enthalpy(ti::i) - |
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.
still a minus sign to fix (unless I got the math wrong)
* | ||
* \f{align*} | ||
* F^i &= D_i \phi - \frac{B^j D_j \phi}{\alpha^2}B^i \\ | ||
* S &= -F^iD_i \left( \ln \frac{\alpha \rho}{h}\right) -\Gamma^i_{ij}F^j \\ |
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.
Can you add spin terms already? This probably also means we should name the executable something other than "irrotational".
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'd like to have the irrotational case merged first, at that point it should be straightforward to extend to the spin case but also at that point things stop being "exact". I'd like to go through the sources and understand what's going on and write up notes before I add that though.
The minus sign is my bad I have confused myself thoroughly with signs.
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.
Ok that's fine. Probably still we should not name things "irrotational", don't you think? That seems confusing once we add the spin terms (and we don't want to rename everything later).
d7efda3
to
a3d4259
Compare
src/Elliptic/Systems/IrrotationalBns/BoundaryConditions/CMakeLists.txt
Outdated
Show resolved
Hide resolved
HEADERS | ||
Equations.hpp | ||
FirstOrderSystem.hpp | ||
Geometry.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.
remove Geometry.hpp
@@ -47,6 +47,8 @@ void fluxes_on_face( | |||
const tnsr::I<DataVector, 3>& face_normal_vector, | |||
const tnsr::II<DataVector, 3>& rotational_shift_stress, | |||
const Scalar<DataVector>& velocity_potential) { | |||
// potential optimization : precompute the produce of the `face_normal` |
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.
ping
tests/Unit/Elliptic/Systems/IrrotationalBns/BoundaryConditions/CMakeLists.txt
Outdated
Show resolved
Hide resolved
const double euler_enthalpy_constant = 1.0; | ||
apply_neumann_boundary_condition<false>( | ||
make_not_null(&n_dot_auxilliary_velocity)); | ||
CHECK(get(n_dot_auxilliary_velocity) == |
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.
You aren't actually comparing to the Python implementation I think?
* | ||
* \f{align*} | ||
* F^i &= D_i \phi - \frac{B^j D_j \phi}{\alpha^2}B^i \\ | ||
* S &= -F^iD_i \left( \ln \frac{\alpha \rho}{h}\right) -\Gamma^i_{ij}F^j \\ |
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.
Ok that's fine. Probably still we should not name things "irrotational", don't you think? That seems confusing once we add the spin terms (and we don't want to rename everything later).
@nilsvu I renamed everything to |
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.
You can squash everything
src/Elliptic/Systems/BnsInitialData/BoundaryConditions/Factory.hpp
Outdated
Show resolved
Hide resolved
tests/Unit/Elliptic/Systems/BnsInitialData/BoundaryConditions/Test_StarSurface.cpp
Outdated
Show resolved
Hide resolved
/*! | ||
* Impose StarSurface boundary conditions: | ||
* \f[ | ||
* n_i F^i = \frac{C}{\alpha^2} B^i n_i. |
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.
Question: Since this is a Neumann boundary condition, it leaves the freedom for a constant offset in \Phi
. I think the equations also leave this freedom. Have you thought about how to fix this freedom?
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 haven't, I would think a reasonable choice would be that Phi should be zero at the center of the star or something like that, we probably can't set Phi=0 at the surface because I'm almost sure it's not "equipotential"
5b4b7e0
to
5a3fd8a
Compare
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.
Just have to appease CI :)
393e308
to
7af735e
Compare
7af735e
to
5981b40
Compare
Proposed changes
This PR adds the system for generating BNS Irrotational Initial data. To do this, an elliptic system is introduced to solve for the velocity potential using the framework of Baumgarte + Shapiro Ch. 15. The background consists of a matter profile which is not yet implemented (as it is contained in the initial data).
Upgrade instructions
Code review checklist
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
bugfix
ornew feature
if appropriate.Further comments