Skip to content

Add mathematical documentation for 2D elliptic boundary-condition examples - #524

Open
susan-bronco wants to merge 4 commits into
csrc-sdsu:mainfrom
susan-bronco:docs/issue-510-mathematical-examples
Open

susan-bronco wants to merge 4 commits into
csrc-sdsu:mainfrom
susan-bronco:docs/issue-510-mathematical-examples

Conversation

@susan-bronco

Copy link
Copy Markdown

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Example
  • [ X] Documentation

Description

This draft pull request adds mathematical documentation for the elliptic2DXDirichletYDirichlet.m example.

The documentation explains the Laplace equation being solved, the domain, the Dirichlet boundary conditions, the exact solution, how the example uses MOLE, and the numerical error. The remaining four 2D boundary-condition examples from Issue #510 will be added in follow-up commits.

Related Issues & Documents

  • [X ] I have created an Issue that is paired with this PR
  • Closes #

QA Instructions, Screenshots, Recordings

I tested this documentation by running make doc-html from the doc/sphinx directory. I then opened the generated HTML page and checked that it rendered correctly and that it accurately described the code, including the equation, domain,
boundary conditions, exact solution, and numerical errors.

I also ran the Octave example successfully, and the output was:

Maximum error: 0.0003
Relative error: 0.0006%

I previewed the page locally in Google Chrome on Windows.

Keep-open request

  • [ X] I am requesting maintainer review for keep-open.

Reason: This is a work-in-progress pull request for Issue #510. The remaining four mathematical example pages will be added in follow-up commits.

Added/updated tests?

_We encourage you to test all code included with MOLE, including examples.

  • Yes
  • [ X] No, and this is why: this is a documentation only change.
  • I need help with writing tests

Read Contributing Guide and Code of Conduct

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

@valeriabarra valeriabarra added student project Documentation Improvements or additions to documentation labels Nov 23, 2026
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jbrzensk jbrzensk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @susan-bronco, thanks for this. One small change for readability.

u(x,y) = e^x\cos(y).
$$

This corresponds to the call to `addScalarBC2D(A,b,k,m,dx,n,dy,dc,nc,v)`, with

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the corresponding call for addScalar before the exact solution. This makes it seem like the exact solution is the call to addScalarBC.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I pushed the update in commit 95cd49e. The updated HTML version looks right.

@susan-bronco

Copy link
Copy Markdown
Author

I noticed the canceled/failed macOSX check. Do I need to do something about that? I'm using an HP/windows laptop. Thanks for any help.

@susan-bronco

Copy link
Copy Markdown
Author

I tested examples/octave/elliptic2DCurvPeriodic.m and got an error (see below). Should I continue with writing the documentation for this one, or wait?
Here is the terminal output:
warning: The Jacobian is negative everywhere, so the grid is left-handed and the domain is mirrored.
The curvilinear operators read [n, m] = size(X): rows are eta, columns are xi.
If X and Y came from gridGen, they have xi-nodes as ROWS -- pass X.' and Y.' instead.
grad and div are self-consistent either way, so this will not show up as an error; it matters
for anything that assumes a physical orientation (buoyancy, volume weights, sqrt(J)).
Silence with: warning('off', 'jacobian2D:leftHandedGrid')
warning: called from
checkGridOrientation at line 67 column 9
jacobian2D at line 93 column 5
grad2DCurv at line 83 column 21
elliptic2DCurvPeriodic at line 38 column 3

error: product: nonconformant arguments (op1 is 2700x1, op2 is 2700x2700)
error: called from
grad2DCurv at line 85 column 8
elliptic2DCurvPeriodic at line 38 column 3

@jbrzensk

Copy link
Copy Markdown
Collaborator

Wait for that one. Looking into it.

@jbrzensk

Copy link
Copy Markdown
Collaborator

Yeah, working on it. See issue #531

@susan-bronco

Copy link
Copy Markdown
Author

I noticed that elliptic2DPeriodic.m and elliptic2DXPeriodicYPeriodic.m solve essentially the same problem: the 2D Poisson equation with periodic boundary conditions in both directions. Both also call addScalarBC2D, though elliptic2DPeriodic.m has a comment at the top that says it does not use it. The main difference I can see is different grid resolutions (m=49 in elliptic2DPeriodic.m vs m=299 in the other). So my documentation is basically the same for both. Should I go ahead and commit/push both, or...? At this point I submitted the description for elliptic2DXPeriodicYPeriodic.m already. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation student project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants