Skip to content

Commit

Permalink
Take out Neumann from SuperposedBoostedBinary
Browse files Browse the repository at this point in the history
  • Loading branch information
joaorebelo-megum committed Jan 24, 2025
1 parent 01eac03 commit e64e1e9
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,57 +224,6 @@ void implement_apply_dirichlet(
}
}

template <typename IsolatedObjectBase, typename IsolatedObjectClasses>
void implement_apply_neumann(
const gsl::not_null<Scalar<DataVector>*> n_dot_conformal_factor_gradient,
const gsl::not_null<Scalar<DataVector>*>
n_dot_lapse_times_conformal_factor_gradient,
const gsl::not_null<tnsr::I<DataVector, 3>*>
n_dot_longitudinal_shift_excess,
const std::array<std::optional<std::unique_ptr<IsolatedObjectBase>>, 2>&
/*superposed_objects*/,
const tnsr::I<DataVector, 3>& /*x*/,
const tnsr::i<DataVector, 3>& /*face_normal*/) {
/*
using analytic_tags = tmpl::list<
::Tags::deriv<Xcts::Tags::ConformalFactorMinusOne<DataVector>,
tmpl::size_t<3>, Frame::Inertial>,
::Tags::deriv<Xcts::Tags::LapseTimesConformalFactorMinusOne<DataVector>,
tmpl::size_t<3>, Frame::Inertial>,
::Tags::deriv<Xcts::Tags::ShiftExcess<DataVector, 3, Frame::Inertial>,
tmpl::size_t<3>, Frame::Inertial>>;
const auto solution_vars =
variables_from_tagged_tuple((*solution)->variables(x, analytic_tags{}));
const auto& deriv_conformal_factor_minus_one =
get<::Tags::deriv<Xcts::Tags::ConformalFactorMinusOne<DataVector>,
tmpl::size_t<3>, Frame::Inertial>>(solution_vars);
const auto& deriv_lapse_times_conformal_factor_minus_one = get<
::Tags::deriv<Xcts::Tags::LapseTimesConformalFactorMinusOne<DataVector>,
tmpl::size_t<3>, Frame::Inertial>>(solution_vars);
const auto& deriv_shift_excess =
get<::Tags::deriv<Xcts::Tags::ShiftExcess<DataVector, 3, Frame::Inertial>,
tmpl::size_t<3>, Frame::Inertial>>(solution_vars);
*/
get(*n_dot_conformal_factor_gradient) = 0.;
get(*n_dot_lapse_times_conformal_factor_gradient) = 0.;
std::fill(n_dot_longitudinal_shift_excess->begin(),
n_dot_longitudinal_shift_excess->end(), 0.);
/*
for (size_t i = 0; i < 3; ++i) {
get(*n_dot_conformal_factor_gradient) +=
face_normal.get(i) * deriv_conformal_factor_minus_one.get(i);
get(*n_dot_lapse_times_conformal_factor_gradient) +=
face_normal.get(i) *
deriv_lapse_times_conformal_factor_minus_one.get(i);
for (size_t j = 0; j < 3; ++j) {
n_dot_longitudinal_shift_excess->get(i) +=
face_normal.get(j) * deriv_shift_excess.get(i, j);
}
}
*/
}

} // namespace

template <typename IsolatedObjectBase, typename IsolatedObjectClasses>
Expand All @@ -283,28 +232,21 @@ void SuperposedBoostedBinary<IsolatedObjectBase, IsolatedObjectClasses>::apply(
const gsl::not_null<Scalar<DataVector>*>
lapse_times_conformal_factor_minus_one,
const gsl::not_null<tnsr::I<DataVector, 3>*> shift_excess,
const gsl::not_null<Scalar<DataVector>*> n_dot_conformal_factor_gradient,
const gsl::not_null<
Scalar<DataVector>*> /*n_dot_conformal_factor_gradient*/,
const gsl::not_null<Scalar<DataVector>*>
n_dot_lapse_times_conformal_factor_gradient,
/*n_dot_lapse_times_conformal_factor_gradient*/,
const gsl::not_null<tnsr::I<DataVector, 3>*>
n_dot_longitudinal_shift_excess,
/*n_dot_longitudinal_shift_excess*/,
const tnsr::i<DataVector, 3>& /*deriv_conformal_factor_correction1*/,
const tnsr::i<DataVector,
3>& /*deriv_lapse_times_conformal_factor_correction1*/,
const tnsr::iJ<DataVector, 3>& /*deriv_shift_excess_correction1*/,
const tnsr::I<DataVector, 3>& x,
const tnsr::i<DataVector, 3>& face_normal) const {
if (boundary_ == elliptic::BoundaryConditionType::Dirichlet) {
implement_apply_dirichlet<IsolatedObjectBase, IsolatedObjectClasses>(
conformal_factor_minus_one, lapse_times_conformal_factor_minus_one,
shift_excess, superposed_objects_, xcoords_, masses_, momentum_left_,
momentum_right_, y_offset_, z_offset_, x);
} else if (boundary_ == elliptic::BoundaryConditionType::Neumann) {
implement_apply_neumann<IsolatedObjectBase, IsolatedObjectClasses>(
n_dot_conformal_factor_gradient,
n_dot_lapse_times_conformal_factor_gradient,
n_dot_longitudinal_shift_excess, superposed_objects_, x, face_normal);
}
const tnsr::I<DataVector, 3>& x) const {
implement_apply_dirichlet<IsolatedObjectBase, IsolatedObjectClasses>(
conformal_factor_minus_one, lapse_times_conformal_factor_minus_one,
shift_excess, superposed_objects_, xcoords_, masses_, momentum_left_,
momentum_right_, y_offset_, z_offset_, x);
}

template <typename IsolatedObjectBase, typename IsolatedObjectClasses>
Expand All @@ -315,28 +257,20 @@ void SuperposedBoostedBinary<IsolatedObjectBase, IsolatedObjectClasses>::
lapse_times_conformal_factor_correction,
const gsl::not_null<tnsr::I<DataVector, 3>*> shift_excess_correction,
const gsl::not_null<Scalar<DataVector>*>
n_dot_conformal_factor_gradient_correction,
/*n_dot_conformal_factor_gradient_correction*/,
const gsl::not_null<Scalar<DataVector>*>
n_dot_lapse_times_conformal_factor_gradient_correction,
/*n_dot_lapse_times_conformal_factor_gradient_correction*/,
const gsl::not_null<tnsr::I<DataVector, 3>*>
n_dot_longitudinal_shift_excess_correction,
/*n_dot_longitudinal_shift_excess_correction*/,
const tnsr::i<DataVector, 3>& /*deriv_conformal_factor_correction*/,
const tnsr::i<DataVector, 3>&
/*deriv_lapse_times_conformal_factor_correction*/,
const tnsr::iJ<DataVector, 3>& /*deriv_shift_excess_correction*/,
const tnsr::I<DataVector, 3>& /*x*/,
const tnsr::i<DataVector, 3>& /*face_normal*/) const {
if (boundary_ == elliptic::BoundaryConditionType::Dirichlet) {
get(*conformal_factor_correction) = 0.;
get(*lapse_times_conformal_factor_correction) = 0.;
std::fill(shift_excess_correction->begin(), shift_excess_correction->end(),
0.);
} else if (boundary_ == elliptic::BoundaryConditionType::Neumann) {
get(*n_dot_conformal_factor_gradient_correction) = 0.;
get(*n_dot_lapse_times_conformal_factor_gradient_correction) = 0.;
std::fill(n_dot_longitudinal_shift_excess_correction->begin(),
n_dot_longitudinal_shift_excess_correction->end(), 0.);
}
const tnsr::iJ<DataVector, 3>& /*deriv_shift_excess_correction*/)
const {
get(*conformal_factor_correction) = 0.;
get(*lapse_times_conformal_factor_correction) = 0.;
std::fill(shift_excess_correction->begin(), shift_excess_correction->end(),
0.);
}

template <typename IsolatedObjectBase, typename IsolatedObjectClasses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ namespace Xcts::BoundaryConditions {
*
* This takes two isolated objects and after applying a boost to each of them,
* superposes them. The superposed system is then imposed on the boundary, with
* Dirichlet or Neumann boundary conditions.
*
* \warning The Neumann boundary conditions is not yet implemented.
* Dirichlet boundary conditions.
*
*/

Expand Down Expand Up @@ -85,16 +83,11 @@ class SuperposedBoostedBinary
"The object placed on the positive x-axis.";
using type = std::unique_ptr<IsolatedObjectBase>;
};
struct BoundaryCondition {
static constexpr Options::String help = "Boundary Condition Type.";
using type = elliptic::BoundaryConditionType;
};

using options = tmpl::list<XCoords, Masses, MomentumLeft, MomentumRight,
CenterOfMassOffset, ObjectLeft, ObjectRight,
BoundaryCondition>;
CenterOfMassOffset, ObjectLeft, ObjectRight>;
static constexpr Options::String help =
"Impose flat spacetime at this boundary.";
"Impose supperposed boosted binary system on the boundary.";

SuperposedBoostedBinary() = default;
SuperposedBoostedBinary(const SuperposedBoostedBinary&) = delete;
Expand Down Expand Up @@ -125,8 +118,7 @@ class SuperposedBoostedBinary
? std::make_optional(
deserialize<std::unique_ptr<IsolatedObjectBase>>(
serialize(superposed_objects_[1].value()).data()))
: std::nullopt,
boundary_);
: std::nullopt);
}

SuperposedBoostedBinary(
Expand All @@ -136,16 +128,14 @@ class SuperposedBoostedBinary
const std::array<double, 2> center_of_mass_offset,
std::optional<std::unique_ptr<IsolatedObjectBase>> object_left,
std::optional<std::unique_ptr<IsolatedObjectBase>> object_right,
elliptic::BoundaryConditionType boundary,
const Options::Context& context = {})
: xcoords_(xcoords),
masses_(masses),
momentum_left_(momentum_left),
momentum_right_(momentum_right),
y_offset_(center_of_mass_offset[0]),
z_offset_(center_of_mass_offset[1]),
superposed_objects_({std::move(object_left), std::move(object_right)}),
boundary_(boundary) {
superposed_objects_({std::move(object_left), std::move(object_right)}) {
if (masses_[0] <= 0. || masses_[1] <= 0.) {
PARSE_ERROR(context, "The masses must be positive.");
}
Expand All @@ -157,16 +147,17 @@ class SuperposedBoostedBinary
std::vector<elliptic::BoundaryConditionType> boundary_condition_types()
const override {
return {// Conformal factor
boundary_,
elliptic::BoundaryConditionType::Dirichlet,
// Lapse times conformal factor
boundary_,
elliptic::BoundaryConditionType::Dirichlet,
// Shift
boundary_, boundary_, boundary_};
elliptic::BoundaryConditionType::Dirichlet,
elliptic::BoundaryConditionType::Dirichlet,
elliptic::BoundaryConditionType::Dirichlet};
}

using argument_tags =
tmpl::flatten<tmpl::list<domain::Tags::Coordinates<3, Frame::Inertial>,
domain::Tags::FaceNormal<3, Frame::Inertial>>>;
tmpl::flatten<tmpl::list<domain::Tags::Coordinates<3, Frame::Inertial>>>;
using volume_tags = tmpl::list<>;

void apply(
Expand All @@ -181,12 +172,9 @@ class SuperposedBoostedBinary
const tnsr::i<DataVector, 3>&
deriv_lapse_times_conformal_factor_correction,
const tnsr::iJ<DataVector, 3>& deriv_shift_excess_correction,
const tnsr::I<DataVector, 3>& x,
const tnsr::i<DataVector, 3>& face_normal) const;
const tnsr::I<DataVector, 3>& x) const;

using argument_tags_linearized =
tmpl::flatten<tmpl::list<domain::Tags::Coordinates<3, Frame::Inertial>,
domain::Tags::FaceNormal<3, Frame::Inertial>>>;
using argument_tags_linearized = tmpl::list<>;
using volume_tags_linearized = tmpl::list<>;

void apply_linearized(
Expand All @@ -203,9 +191,7 @@ class SuperposedBoostedBinary
const tnsr::i<DataVector, 3>& deriv_conformal_factor_correction,
const tnsr::i<DataVector, 3>&
deriv_lapse_times_conformal_factor_correction,
const tnsr::iJ<DataVector, 3>& deriv_shift_excess_correction,
const tnsr::I<DataVector, 3>& x,
const tnsr::i<DataVector, 3>& face_normal) const;
const tnsr::iJ<DataVector, 3>& deriv_shift_excess_correction) const;

// NOLINTNEXTLINE(google-runtime-references)
void pup(PUP::er& p) override {
Expand All @@ -217,7 +203,6 @@ class SuperposedBoostedBinary
p | momentum_left_;
p | momentum_right_;
p | superposed_objects_;
p | boundary_;
}

private:
Expand All @@ -229,7 +214,6 @@ class SuperposedBoostedBinary
double z_offset_{};
std::array<std::optional<std::unique_ptr<IsolatedObjectBase>>, 2>
superposed_objects_{};
elliptic::BoundaryConditionType boundary_{};
};

template <typename IsolatedObjectBase, typename IsolatedObjectClasses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,3 @@ def shift_excess(x):
shift_right = shift(boosted_spacetime_metric_right)

return shift_left + shift_right


def n_dot_conformal_factor_gradient(x, face_normal):
return 0.0


def n_dot_lapse_times_conformal_factor_gradient(x, face_normal):
return 0.0


def n_dot_longitudinal_shift_excess(x, face_normal):
return np.zeros(3)
Loading

0 comments on commit e64e1e9

Please sign in to comment.