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
Make melt models work with free surface #1765
Conversation
I don't know the ins and outs of the melt system, so forgive a couple of basic questions:
|
We do not solve for the melt velocities, they are just computed as a postprocessor, using the solid velocity and the fluid pressure. So we cannot set boundary conditions for them directly.
|
ba171cc
to
9702445
Compare
Is the fluid pressure fully determined, or is there a free constant? |
I am looking at your melt paper, equation 9. It seems to me that if you set |
There is a free constant, same as for the solid pressure. Because we solve for the fluid pressure instead of the solid pressure, we just reuse the pressure normalization we use for models without melt for the solid pressure, but apply it to the fluid pressure instead. |
You are right, I did not write that down correctly. What we want to use as a boundary condition is that the boundary integral of some constant times |
Yeah, I can see how that might collide with the stabilization term. You could check this by making the stabilization parameter |
That is interesting to know, thanks! |
@anne-glerum
to the input file, the the solid velocity and melt velocity should be the same at the boundaries in the output (and I do not think they are at the moment, so maybe that would be a first good thing to look at). I also added another test case to this pull request ( It might also make sense to see if what I saw is just a resolution issue (if the velocity converges to the correct solution for mesh size --> 0). I remember that changing the resolution made a difference for the solution, but I did not yet do a systematic test. What confuses me about this is that we used the fluid pressure boundary conditions for all the test cases we have in our paper (or for example the melt_transport_adaptive test in the tests directory), and we converged to the analytical solution in those cases. So before seeing the results of these tests here, I was pretty sure that our fluid pressure boundary conditions worked as intended. |
Okay, coming back to this after a very long time... Refinement 3: u_f (surface) = 0.281 |
I also redid the Initial mass: 5.94762824e+08 Mass after 2e4 years: |
So are you saying that this is now working as expected and should be merged as-is? If so, can you rebase and force push again so that the tester will run again? |
I've done all of the testing with a rebased version of the branch that @gassmoeller made, and it seems to me that this is now working as intended. But I want to look through all the changes again to make sure everything looks good after the rebase before I force push again. |
13ece20
to
e57a6bd
Compare
e57a6bd
to
0a570b4
Compare
Okay, I pushed the rebased version and updated all of the test results, and I think everything works as intended now (see below). So it would be great if someone could have a look at this! If melt transport is switched on, but there is no melt, we get the same results as without melt transport (only higher linear iterations numbers, which will then hopefully be fixed by our new melt solver). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to hear that it works! I just noticed a few tiny things, otherwise it looks good to go to me!
source/simulator/melt.cc
Outdated
const Tensor<1,dim> n_hat = scratch.face_finite_element_values.normal_vector(q_point); | ||
const Tensor<1,dim> g_hat = (g_norm == 0.0 ? Tensor<1,dim>() : gravity/g_norm); | ||
|
||
double pressure_perturbation = scratch.face_material_model_outputs.densities[q_point] * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make const
source/simulator/melt.cc
Outdated
|
||
const Tensor<1,dim> | ||
gravity = this->get_gravity_model().gravity_vector(scratch.face_finite_element_values.quadrature_point(q_point)); | ||
double g_norm = gravity.norm(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make const
tests/free_surface_blob_melt.cc
Outdated
|
||
for (unsigned int i=0; i < in.position.size(); ++i) | ||
{ | ||
double porosity = std::max(in.composition[i][porosity_idx],0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make porosity const
# with melt transport = on and nonzero porosity. | ||
# The test is the same as free_surface_blob_melt, except that melt | ||
# has a nonzero initial condition. | ||
# We test if the boundary coditions for melt are set correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coditions -> conditions
end | ||
end | ||
|
||
#subsection Termination criteria |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove lines that are commented out?
# with melt transport = on and nonzero porosity. | ||
# The test is the same as free_surface_blob_melt, except that melt | ||
# has a nonzero initial condition. | ||
# We test if the boundary coditions for melt are set correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coditions -> conditions
# has a nonzero initial condition. | ||
# We test if the boundary coditions for melt are set correctly | ||
# (no melt flowing in/out at the free surface) by checking if the | ||
# mass of the porosity field is conserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test has no free surface (top is free slip), so the description and name are a bit confusing to me. Also there is no test output.
source/simulator/melt.cc
Outdated
if (this->get_parameters().free_surface_boundary_indicators.find(boundary_indicator) | ||
!= this->get_parameters().free_surface_boundary_indicators.end()) | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to explain this change: Even if the boundary is a free surface, someone may still want melt to flow in or out, in particular once we have the option to combine other types of surface evolution with a free surface as suggested in #2071. One example (where we noticed this would have been a problem) is modelling compaction of a partially molten layer with sedimentation from above: In this case the added pressure can squish melt out of the model.
Thanks for the review @anne-glerum, I think I addressed all of your comments. |
So is this ready to merge? |
Looks good to me. |
This is work in progress, and I basically opened the pull request so that @anne-glerum and @naliboff could have a look.
The idea is that if you have a model with melt, a new function (
apply_free_surface_stabilization_with_melt
) is called in the stabilization of the free surface, and it will loop over the correct DoFs (which are different for with and without melt). This is the part that I think already works.The second point is that we also want to automatically prescribe boundary conditions for the melt velocity at the free surface, and in such a way that melt will not flow in or out of the free surface boundary. To fulfil this condition, we have to set grad p_f = rho_f g at the boundary (according to Darcy's law). We do this by not assembling the melt boundary terms at boundaries that are at the free surface (see code in
melt.cc
inlocal_assemble_stokes_system_melt_boundary
).However, we tested this and melt still seems to flow out at the boundaries, so we're currently trying to figure out why this is. But without melt being at the surface, this should already work in models with melt and free surface (the test we have is without melt at the surface).