Skip to content

2D Julia Operators#331

Open
bewagner1 wants to merge 25 commits intocsrc-sdsu:mainfrom
bewagner1:bpw/jl2D
Open

2D Julia Operators#331
bewagner1 wants to merge 25 commits intocsrc-sdsu:mainfrom
bewagner1:bpw/jl2D

Conversation

@bewagner1
Copy link
Copy Markdown
Collaborator

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

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Example
  • Documentation

Description

Implementation of the 2-D operators div, grad, curl, and lap in julia as well as their periodic, mixed periodicity, and non uniform variants.

Related Issues & Documents

QA Instructions, Screenshots, Recordings

Compare relevant code and examples to MATLAB implementaiton

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Nullity tests for all operators

Read Contributing Guide and Code of Conduct

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

None that I can think of

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

@bewagner1

This comment was marked as outdated.

@bewagner1 bewagner1 marked this pull request as ready for review April 16, 2026 05:01
@bewagner1

This comment was marked as outdated.

Comment thread julia/MOLE.jl/src/BCs/scalarBC.jl Outdated
Comment thread julia/MOLE.jl/src/BCs/scalarBC.jl Outdated
@jbrzensk
Copy link
Copy Markdown
Collaborator

@bewagner1 The curl operator seems wrong, and will be a point of contention for many. I suggest removing it (also it doesn't have a test) to speed up the approval.

@bewagner1
Copy link
Copy Markdown
Collaborator Author

Yea I was wondering how it is mimetic operator. Doesn't seem to fit in with the rest


pa = heatmap(xc, yc, ua, title = "Approximate Solution", xlabel = "X", ylabel = "Y", colorbar_title = "u(x,y)", aspect_ratio = :equal)
display(pa)
println("Press Enter to close the plot and open the next.")
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 @bewagner1 , thank you so much for your contribution!

I know we used this interactive display of figures in the existing Julia example so far, but I think it would be best to move to a system where we dynamically create an output directory for every experiment/example, use string concatenation, and save the figure (in .png file format), suing the Plots.png command.

Please see any example for instance in ClimaCore.jl

Please update this system for all examples. Thank you!

pe = heatmap(xc, yc, ue, title = "Exact Solution", xlabel = "X", ylabel = "Y", colorbar_title = "u(x,y)", aspect_ratio = :equal)
display(pe)
println("Press Enter to close the plot and exit.")
readline() No newline at end of file
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.

Does this example have an analytic solution to compare with for the error calculation?

xlims = (0, 2),
ylims = (0, 2),
clims = (0, 2),
colorbar = true,
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.

Not a huge fan of the colormap used. Can you choose a nicer palette/scheme? See examples from Plots.jl docs

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.

Also, does this example have an analytic solution we can use to compute the error?

@valeriabarra
Copy link
Copy Markdown
Collaborator

Hi @bewagner1 , thank you so much for your contribution!

Now that we have a few more examples, I would like them to be organized in a directory structure that reflects the same organization and categories we have chosen for our documentation. See the examples/ directory in our docs. Please update the structure of the mole/julia/MOLE.jl/examples/ directory accordingly.
Please, also use the same directory structure in the mole/julia/MOLE.jl/docs/src/ directory (where we currently do not have an examples/ subdirectory - you would need to create one)

m = 2*k + 1 # minimum number of cells to attain desired accuracy
dx = (east-west)/m # step length

path = joinpath(@__DIR__, "imgs") # Output path to store generated plots
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.

Thank you! Can we please call it output? I think it's more explicit and might contain different data in different formats, not necessarily images only.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2D operators for MOLE.jl

3 participants