-
Notifications
You must be signed in to change notification settings - Fork 65
Add quadrature #269
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
Open
rouson
wants to merge
7
commits into
csrc-sdsu:dev/fortran
Choose a base branch
from
rouson:add-quadrature
base: dev/fortran
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add quadrature #269
Conversation
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
This commit adopts a newer version of the Julienne dependency for a fix in reporting test execution times when compiling with LLVM flang.
Given properly initialized `vector_1D_t v` and `scalar_1D_t f` objects,
this commit adds types, type-bound functions, and operators supporting
the evaluation of the following residual formed from the extended
Gauss Divergence Theorem of Castillo & Miranda (2013):
```fortran
associate(dV => f%dV, dA => v%dA())
residual = .SSS. (v .dot. .grad. f)*dV + .SSS. (f * .div. v)*dV - .SS. (f .x. (v .dot. dA))
end associate
```
where `.SS.` and `.SSS.` represent double and triple integrals over the problem domain
and its bounding surface, respectively.
feat(tensors_1D_t): add dV, dA calculators
This commit
1. Adds a dV generic binding to tensor_1D_t for computing
differential volumes for volume integration. In 1D,
volume integrals are calculated on a per-unit-of-normal-
surface-area basis so dV = dx*dy*dz = dx(1)(1).
2. Adds a dA procedure binding to vector_1D_t for computing
surface-area differentials for surface integrals involving
the dot product of a vector with a surface-normal. In 1D,
surface integrals are calculated on a per-unit-of-normal-
surface basis so dA = dy*dz = 1.
build(ifx): work around ifx bugs
1. Symptom: crashing surface-integral unit test at grid resolutions
above ~413 points. Fix: when ifx is detected, reduce grid points
to 400 and slightly increase the error tolerance.
2. Symptom: test hangs if the `gradient_1D_t` type has a `weights`
generic binding associated with the grandparent `tensor_1D_t`
type's `gradient_1D_weights` binding. Fix: when ifx is detected,
move the generic binding up to the parent `vector_1D_t` type.
build(gfortran): work around gfortran issues
1. To eliminate gfortran 13-14 internal compiler errors on Ubuntu in CI,
replace two `weights` generic binding invocations with invocations of
the corresponding type-bound functions: `gradient_1D_weights` and
`divergence_1D_weights`.
2. To work around missing featuers in gfortran 13-14, remove do-concurrent
type-specs and locality specifiers when gfortran is detected.
The tests exhibit the following numerical integration behaviors:
1. At 500-cell resolution,
a. 2nd-order quadrature converges quadratically: O(dx^2),
b. 4th-order quadrature converges linearly: O(dx), and
c. 4th-order quadrature yields maximum absolute errors roughly,
three orders of magnitude smaller than the 2nd-order scheme.
2. At even just a 20-cell resolution, 2nd- and 4th-order schemes
satisfy the discrete Extended Gauss Divergence Theorem down to
a residual near machine zero: ~10^-14.
This commit adds passing tests that check the 1D equivalents of
the following three integral terms in the extended Gauss divergence
theorem using 2nd & 4th-order mimetic quadratures.
refact(tensors_1D): absorb child procs
This commit moves the gradient_1D_weights and divergence_1D_weights
type-bound procedures up to the parent tensor_1D_t type, making
these procedures accessible via any tensor_1D_t child type. This
facilitates assembly of the B boundary matrix required for
inner products corresponding to surface integrals of the form
.SS. (v*f) = <Bv,f>
for a vector_1D_t v and a scalar_1D_t f. Previously, the weights
functions were bound to the gradient_1D_t and divergence_1D_t
types and were thus inaccessible in a calculation not involving
those types. Now the multiplication operator above can query its
operands for the weights and use them to consturct B via
B = QD + (G^T)*P, Eq. (6) of Corbino & Castillo (2020)
This commit adds optional arguments that can be used to print only
specific terms in the extended Gauss Divergence Theorem example.
The default behavior is still that all terms are computed, printed,
and summed to produce a residual.
Usage:
fpm run \
--example extended-gauss-divergence \
--compiler flang-new \
--flag "-O3" \
-- [--help|-h] | [[--cells <integer>] [--order <integer>] [--xmin <double precision>] [--xmax <double precision>] [--div|d] [--grad|g] [--vf|f]]
where pipes (|) separate square-bracketed optional arguments and angular brackets indicate user input values.
fix(integral): .SSS. (f * .div. v)*dV
This commit zero-extends divergence_1D_t values when computing
f * .div. v to match the array sizes of the operands.
feat(example): increase resolution, fmt output, work around gfortran bug
This commit edits print-assembled-1D-operators.F90 to
1. Raise the grid resolution above the new minimum of 16 as
required for computing the gradient quadrature weights
when constructing a `gradient_1D_t` object and
2. Adds a `stop` statement to work arounnd an apparent
gfortran bug: a malloc error.
This commit edits div-grad-laplacian-1D.F90 to
1. Raise the grid resolution above the new minimum of 16 for
as reqiured for computing the quadrature weights (which are not
used in this program) when defining a `gradient_1D_t` object and
2. Improve the program output format.
doc(example): Gauss divergence theorem AI prompt
This commit adds optional arguments that can be used to print only
specific terms in the extended Gauss Divergence Theorem example.
The default behavior is still that all terms are computed, printed,
and summed to produce a residual.
Usage:
fpm run \
--example extended-gauss-divergence \
--compiler flang-new \
--flag "-O3" \
-- [--help|-h] | [[--cells <integer>] [--order <integer>] [--xmin <double precision>] [--xmax <double precision>] [--div|d] [--grad|g] [--vf|f]]
where pipes (|) separate square-bracketed optional arguments and angular brackets indicate user input values.
fix(integral): .SSS. (f * .div. v)*dV
This commit zero-extends divergence_1D_t values when computing
f * .div. v to match the array sizes of the operands.
feat(example): increase resolution, fmt output, work around gfortran bug
This commit edits print-assembled-1D-operators.F90 to
1. Raise the grid resolution above the new minimum of 16 as
required for computing the gradient quadrature weights
when constructing a `gradient_1D_t` object and
2. Adds a `stop` statement to work arounnd an apparent
gfortran bug: a malloc error.
This commit edits div-grad-laplacian-1D.F90 to
1. Raise the grid resolution above the new minimum of 16 for
as reqiured for computing the quadrature weights (which are not
used in this program) when defining a `gradient_1D_t` object and
2. Improve the program output format.
doc(example): Gauss divergence theorem AI prompt
Author
|
@joehellmers this is ready for review. I don't have the ability designate you as a reviewer. @jbrzensk please resend the invitation to collaborate on this repository. I just tried to accept the previous invitation, but I think it has expired. |
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.
What type of PR is this? (check all applicable)
Description
This PR
where
.SS.and.SSS.represent double and triple integrals over the problem domain and its bounding surface, respectively, where theresidualvanishes in exact representation; and where other operators perform the like-named operations.2. Adds unit tests verifying the accuracy and convergence of the added quadratures,
3. Adds an example demonstrating the evaluation of the EGDT residual.
4. Works around bugs in the Intel
ifx, GNUgfortran, and LLVMflangcompilers.5. Adds new types to the UML class diagram in
doc/fortran-classes.md.Related Issues & Documents
N.A.
QA Instructions, Screenshots, Recordings
or see
src/fortran/README.mdcorrespondingfpmcommands with other compilers.Added/updated tests?
have not been included
Read Contributing Guide and Code of Conduct
[optional] What gif best describes this PR or how it makes you feel?
🐈⬛