add reaction diffusion - #96
Closed
weiwongg wants to merge 2 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a Gray–Scott reaction–diffusion example to the examples/ suite and introduces a small LinearForm-side helper to assemble the nonlinear reaction term needed by the example. It extends the examples build list accordingly and exposes the new helper through the public Bembel/LinearForm module include.
Changes:
- Add new
examples/GrayScott.cppreaction–diffusion (Gray–Scott) example and VTK export. - Add
Bembel/src/LinearForm/ReactionTerm.hppwith a helper to assemble the reaction linear form. - Register
GrayScottinexamples/CMakeLists.txtand export the new header viaBembel/LinearForm.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| examples/GrayScott.cpp | New Gray–Scott reaction–diffusion example using Laplace–Beltrami + mass matrix time stepping and VTK output. |
| examples/CMakeLists.txt | Adds GrayScott to the examples target list. |
| Bembel/src/LinearForm/ReactionTerm.hpp | Introduces reaction-term linear form assembly helper used by the example. |
| Bembel/LinearForm | Exposes the new reaction-term header through the LinearForm module include. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (int i = 0; i < 20000; ++i) { | ||
| // Right hand side | ||
| Eigen::VectorXd reaction_term; | ||
| reactionLinearFrom(ansatz_space_lb, u, v, reaction, &reaction_term); |
| geometry, refinement_level, polynomial_degree); | ||
| // Gray Scott Model | ||
| // u_t = r_u * \laplacian u -uv^2 + f(1-u) | ||
| // v_y = r_v * \laplacian v +uv^2 - (f+k)v |
| #include <Eigen/Dense> | ||
| #include <iostream> | ||
|
|
||
| #include <Bembel/src/util/surfaceL2error.hpp> |
Comment on lines
+18
to
+22
| * \brief This class takes care of the | ||
| * assembly of the linear form of the reaction term, i.e., uv^2. | ||
| */ | ||
| template <typename Derived, typename Scalar, typename Functor> | ||
| void reactionLinearFrom(const AnsatzSpace<Derived> &ansatz_space, |
Comment on lines
+49
to
+53
| const auto &s = qp.segment<2>(0); | ||
| // get quadrature weights | ||
| Scalar ws = qp(2); | ||
| // get points on geometry and tangential derivatives | ||
| const auto &x_f = qp.segment<3>(3); |
Collaborator
|
I have moved this pull request to #106 and am closing this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.