Skip to content
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

Add time-dependent isotropic goal-oriented demo #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

acse-ej321
Copy link
Collaborator

@jwallwork23 - I found the cause of #107 : it was in how I was declaring my meshes passed into the GoalOrientedMeshSeq. I was declaring meshes = [UnitSquareMesh[n,n, diagonal="left"] * n_meshes which worked when the enrichment_method was set to 'p' but produced an error when accessing the transfer method between meshes when the enrichment_method was set to 'h'. Presumably the mesh is a shallow copy with the above expression.

Even though this turned into a user error, I found this while compiling the MFC for burger's demo using goal-oriented isotropic adaptation which may partially address #28 instead?

Creating a pull request here to get feedback on the additional demo.

@jwallwork23 jwallwork23 added the documentation Improvements or additions to documentation label Feb 28, 2024
@jwallwork23 jwallwork23 added this to the Version 1 milestone Feb 28, 2024
Copy link
Member

@jwallwork23 jwallwork23 left a comment

Choose a reason for hiding this comment

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

Thanks very much for the new demo, @acse-ej321 - this is great! A few fairly minor comments.

I see what you mean about the bug. I'll see if I can get Goalie to raise an exception when the user asks it to enrich shallow copies and (if successful) will raise a separate PR.

demos/burgers-isotropic.py Show resolved Hide resolved
# more densely distributed near to the right-hand boundary. This can be seen by
# comparing the second mesh against the first.
#
# .. rubric:: Exercise
Copy link
Member

Choose a reason for hiding this comment

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

Is there meant to be an exercise here?


# At each timestep, recover metric of the solution
# vector. Then time integrate over the contributions
_metrics = []
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if metrics_i might be a clearer name for this list? (I know I've used a similar approach before.)

# get local indicator
indi = indicators["u"][i][j]
# local instance of Riemanian metric
_metric = RiemannianMetric(P1_ten)
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, metric_j?

Comment on lines +190 to +192
metric = _metrics[0]
# all the other metrics
metric.average(*_metrics[1:], weights=[dt] * len(_metrics))
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now but I think we should implement a driver function for averaging on the Animate side to make this clearer. i.e., a function that effectively does this.

fig.savefig(f"burgers-hessian_mesh{iteration + 1}.jpg")
plt.close()

# Since we have two subintervals, we should check if the target complexity has been
Copy link
Member

Choose a reason for hiding this comment

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

Maybe put 'multiple' rather than 'two', to keep things general.

#
# Recall that the Burgers problem is quasi-1D, since the analytical solution varies in
# the :math:`x`-direction, but is constant in the :math:`y`-direction. As such, we can
# affort to have lower resolution in the :math:`y`-direction in adapted meshes. That
Copy link
Member

Choose a reason for hiding this comment

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

'affort'

#
# Recall that the Burgers problem is quasi-1D, since the analytical solution varies in
# the :math:`x`-direction, but is constant in the :math:`y`-direction. As such, we can
# affort to have lower resolution in the :math:`y`-direction in adapted meshes. That
Copy link
Member

Choose a reason for hiding this comment

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

I find this a bit misleading. To me, having lower resolution in the y-direction would mean anisotropy. But these meshes are isotropic. Did I misunderstand something?

@@ -0,0 +1,274 @@
# Burgers equation with Hessian-based mesh adaptation
Copy link
Member

Choose a reason for hiding this comment

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

Title needs updating

@jwallwork23 jwallwork23 changed the title time dependent heirarchy transfer issue Add time-dependent isotropic goal-oriented demo Apr 15, 2024
@jwallwork23 jwallwork23 linked an issue Apr 15, 2024 that may be closed by this pull request
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time-dependent goal-oriented mesh adaptation demo
3 participants