Skip to content

Commit d1d6cc0

Browse files
fix bound_fluid.cc
1 parent a8e1323 commit d1d6cc0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cookbooks/2D_subduction_with_two_phase_flow/plugin/bound_fluid_source.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ namespace aspect
4545
{
4646
ReactiveFluidTransport<dim>::evaluate(in, out);
4747
const unsigned int bound_fluid_idx = this->introspection().compositional_index_for_name("bound_fluid");
48+
const std::shared_ptr<ReactionRateOutputs<dim>> reaction_rate_out
49+
= out.template get_additional_output_object<ReactionRateOutputs<dim>>();
4850

49-
// Do not allow the bound fluid content to decrease.
50-
for (unsigned int q=0; q < in.n_evaluation_points(); ++q)
51-
if (out.reaction_terms[q][bound_fluid_idx] <= 0.0)
52-
out.reaction_terms[q][bound_fluid_idx] = 0.0;
51+
if (this->get_parameters().use_operator_splitting && reaction_rate_out != nullptr
52+
&& in.requests_property(MaterialProperties::reaction_rates))
53+
{
54+
for (unsigned int q=0; q < in.n_evaluation_points(); ++q)
55+
if (reaction_rate_out->reaction_rates[q][bound_fluid_idx] <= 0.0)
56+
reaction_rate_out->reaction_rates[q][bound_fluid_idx] = 0.0;
57+
}
5358
}
54-
5559
}
5660
}
5761

0 commit comments

Comments
 (0)