Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into thomas/ghaction_compile
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Ulrich committed Sep 27, 2024
2 parents 82d2ee5 + 3264172 commit 85d086f
Show file tree
Hide file tree
Showing 9 changed files with 348 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is. Tell us what the code actually does.

**Expected behavior**
A clear and concise description of what you expected to happen. Tell us what you want the code to do.

**To Reproduce**
Steps to reproduce the behavior:
1. Which version do you use? Provide branch and commit id.
2. Which build settings do you use? Which compiler version do you use?
3. On which machine does your problem occur? If on a cluster: Which modules are loaded?
4. Provide your .toml, .lua files and the PETSc options you used.

**Screenshots/Console output**
If you suspect a problem in the numerics/physics add a screenshot of your output.

If you encounter any errors/warnings/... during execution please provide the console output.

**Additional context**
Add any other context about the problem here.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Feature request
about: Suggest adding a feature that is not yet in tandem
labels: feature

---

<!--*Please add a concise summary of your suggestion here.*-->

### Rationale

<!--*Is your feature request related to a problem? Please describe it!*-->

### Description

<!--*Describe the solution you'd like and the alternatives you have considered.*-->


### Additional information

<!--*Add any other context about the feature request here.*-->


### General information

- [ ] I have searched the issues of this repo and believe this is not a duplicate


Other than that, thanks for taking the time to contribute to tandem!
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/problem_using_tandem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Problem using tandem
about: Any problem, which evolves around how you can use tandem.
labels: discussion

---

If you have a problem using tandem, please open a *discussion*. This could include things like:
* How do I set up a model (mesh, material parameters, ...).
* How do I interpret/visualize results.
* How can I tune tandem for performance on my cluster.

You should open an issue, if you found a possible bug or you want to request a new feature, which is not yet implemented in tandem.

36 changes: 36 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Tandem
message: >-
If you use this software, please cite it using the
metadata from this file, or cite
Uphoff, C., May, D. A., & Gabriel, A. A. (2023).
A discontinuous Galerkin method for sequences of earthquakes
and aseismic slip on multiple faults using unstructured
curvilinear grids. Geophysical Journal International, 233(1), 586-626.
https://doi.org/10.1093/gji/ggac467
type: software
authors:
- given-names: Carsten
family-names: Uphoff
- given-names: Dave
family-names: May
- given-names: Alice-Agnes
family-names: Gabriel
- given-names: Jeena
family-names: Yun
- given-names: Thomas
family-names: Ulrich
- given-names: Nico
family-names: Schliwa
- given-names: Casper
family-names: Pranger
repository-code: 'https://github.com/TEAR-ERC/tandem/'
url: 'https://tandem.readthedocs.io/en/latest/'
abstract: >-
Tandem is a scalable discontinuous Galerkin code on
unstructured curvilinear grids for linear elasticity
problems and sequences of earthquakes and aseismic slip.
license: BSD-3-Clause
129 changes: 129 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement (Alice-Agnes Gabriel, algabriel (at) ucsd (dot) edu, and Dave May, dmay (at) ucsd (dot) edu).

All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

89 changes: 89 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Contributing to tandem
First off, thanks for taking the time to contribute! The following is a set of guidelines for contributing to tandem. We sincerely ask you to read and follow our [**Code of Conduct**](CODE_OF_CONDUCT.md).

## Contributing as a user
### Reporting issues

A great way to contribute to tandem is to send a detailed report when you encounter a problem. Sufficiently detailed reports are highly appreciate. A good report should allow us reproducing the issue.

Go [here](https://github.com/TEAR-ERC/tandem/issues) and click on "New issue". Select either "Bug report" or "Feature request" and click on the corresponding "Get started" button. A new web page will pop up where you will need to fill in a template and give a descriptive title. Once it is done, click on "Submit new issue".

## Contributing as a developer
### Workflow

### Step 1
You need a local fork of the project. Please, go to our [main GitHub page](https://github.com/TEAR-ERC/tandem) and press the “fork” button in GitHub. This will create a copy of the tandem repository in your own GitHub account.

### Step 2
Clone the forked tandem project from GitHub to your PC or laptop:
```
$ git clone --recurse-submodules https://github.com/<your github account>/tandem.git
```

Let's open the new project’s directory:
```
$ cd tandem
```

At this point, your local copy of the tandem project has a single reference to a remote repository i.e., the one that you've just forked in the previous step.

```
$ git remote -v
origin https://github.com/<your_github_account>/tandem.git (fetch)
origin https://github.com/<your_github_account>/tandem.git (push)
```

You need to set up a reference to the original remote tandem repository (referred to as `upstream`) to be able to grab new changes from the tandem main branch. It will allow you to synchronize your contribution with us.
```
$ git remote add upstream https://github.com/TEAR-ERC/tandem.git
$ git remote -v
origin https://github.com/<your_github_account>/tandem.git (fetch)
origin https://github.com/<your_github_account>/tandem.git (push)
upstream https://github.com/TEAR-ERC/tandem.git (fetch)
upstream https://github.com/TEAR-ERC/tandem.git (push)
```

### Step 3
We highly recommend cloning the latest main branch of the tandem project, creating a new branch out of it with a descriptive name and adding your contribution to tandem there.
```
$ git checkout main
$ git pull upstream main
$ git branch <descriptive_branch_name>
$ git checkout <descriptive_branch_name>
```
We also recommend following the following format for your branch names i.e., `<prefix>/<short_name>` where `<prefix>` can be *feature*, *bugfix*, *extension*, etc.

### Step 4
Make a commit once you did some changes in your local copy of tandem

```
$ git add <files_to_be_part_of_the_commit>
$ git commit --message <descriptive_message_of_this_particular_commit>
```
Note that code formatting is enforced in src test and app.
If you change files in these folders, you can enforce a suitable formatting by running:

```
.ci/format.sh $(which clang-format) .
```

Push it to your remote repository
```
git push origin <descriptive_branch_name>
```
Now it is time to make a pull request (PR). Open the following web-page
```
https://github.com/<your_github_account>/tandem/tree/<descriptive_branch_name>
```
and click on "Compare & pull request". Write a descriptive title and a body of your PR, and click on "Create pull request".

You can create a `draft pull request` If your contribution is not ready yet but you still want to show it to tandem maintainers. In this case, click on a green downward arrow next to "Create pull request", select "Create draft pull request" and proceed.

### Step 5
Once you submit your PR, one or two tandem maintainers will review it with you. After that, we may have questions. Please, check back on your PR to keep up with the conversation. Maintainers will start reviewing your contribution if at least the following requirements are fulfilled:

- There is no merge conflict with the latest tandem main branch
- All CI tests are passed

### Step 6
Congratulations, your PR is merged! The whole tandem community thanks you.
6 changes: 6 additions & 0 deletions app/common/PetscDGMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ PetscDGMatrix::PetscDGMatrix(std::size_t blockSize, DGOperatorTopo const& topo)
case HASH_DEF(MATIS):
preallocate_IS(topo);
break;
case HASH_DEF(MATSEQAIJCUSPARSE):
preallocate_SeqAIJ(topo);
break;
case HASH_DEF(MATMPIAIJCUSPARSE):
preallocate_MPIAIJ(topo);
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions app/common/PetscInterplMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ PetscInterplMatrix::PetscInterplMatrix(std::size_t rowBlockSize, std::size_t col
CHKERRTHROW(MatSetSizes(A_, localRows, localCols, PETSC_DETERMINE, PETSC_DETERMINE));
CHKERRTHROW(MatSetBlockSizes(A_, rowBlockSize, columnBlockSize));
CHKERRTHROW(MatSetType(A_, MATAIJ));
CHKERRTHROW(MatSetFromOptions(A_));

// Local to global mapping
PetscInt* l2g;
Expand Down
17 changes: 15 additions & 2 deletions app/common/PetscLinearSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,21 @@ void PetscLinearSolver::setup_mg(AbstractDGOperator<DomainDimension>& dgop, PC p
i_op->assemble(to_degree, from_degree, I);
CHKERRTHROW(PCMGSetInterpolation(pc, l + 1, I.mat()));

Mat A_l;
CHKERRTHROW(MatPtAP(A_lp1, I.mat(), MAT_INITIAL_MATRIX, PETSC_DEFAULT, &A_l));
// Construct coarse level operator via A_c = Pt A P
//Mat A_l;
//CHKERRTHROW(MatPtAP(A_lp1, I.mat(), MAT_INITIAL_MATRIX, PETSC_DEFAULT, &A_l));

// PETSc manpage for MatPtAP() states that For matrix types without a
// special implementation of PtAP, MatPtAP() fallbacks back to
// using MatMatMult() followed by MatTransposeMatMult().
// The following fall back will always work
Mat A_l, AP, Pt;
CHKERRTHROW(MatMatMult(A_lp1, I.mat(), MAT_INITIAL_MATRIX, 1, &AP));
CHKERRTHROW(MatTranspose(I.mat(), MAT_INITIAL_MATRIX, &Pt));
CHKERRTHROW(MatMatMult(Pt, AP, MAT_INITIAL_MATRIX, 1, &A_l));
CHKERRTHROW(MatDestroy(&Pt));
CHKERRTHROW(MatDestroy(&AP));

CHKERRTHROW(PCMGGetSmoother(pc, l, &smooth));
CHKERRTHROW(KSPSetOperators(smooth, A_l, A_l));
mat_cleanup.push_back(A_l);
Expand Down

0 comments on commit 85d086f

Please sign in to comment.