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

Fix ascii data initial for two merged chunks #5041

Merged
merged 4 commits into from Feb 4, 2023

Conversation

gassmoeller
Copy link
Member

This PR improves upon #4490 by moving the slice operation into the AsciiDataInitial class. This specifically improves three aspects:

  • Slicing a 3d dataset for a 2D model is now also supported for temperature (previously only composition)
  • The AsciiDataInitial class previously had to be adjusted for new geometry models, because it couldnt use the cartesian_to_natural_coordinates of the geometry model (because if a slice of a dataset was used the number of dimensions of a point was not equal to the number of dimensions of the model). This limitation is now gone, which in particular means TwoMergedBoxes and EllipsoidalChunk should now work with AsciiDataInitial. I will add a test for them to this PR tomorrow.
  • We can now remove the awkward spacedim template that is not used in the rest of ASPECT and makes AsciiDataInitial harder to understand.

@bobmyhill
Copy link
Member

Looks great. I have no suggestions regarding coding style or comments.

Is specifying points in Cartesian coordinates the most natural choice for your use case? And is specifying two points (plus the origin) better than specifying the unit normal? Just thoughts; not suggestions :)

I'll have another look after the test(s) is(are) added.

@gassmoeller
Copy link
Member Author

Ok, I think this is ready. I added tests for all the new features (support for initial ascii data for two merged chunks and ellipsoidal chunk and slicing for initial temperature datasets) which also found and fixed one bug from the previous version: ellipsoidal chunk also uses latitude instead of colatitude as natural coordinate, which requires special treatment when looking up the ascii data file.

Let me know what you think.

@tjhei
Copy link
Member

tjhei commented Feb 3, 2023

--- a/tests/ascii_data_slice_temperature.prm
+++ b/tests/ascii_data_slice_temperature.prm
@@ -29,7 +29,7 @@ end
 
 
 subsection Boundary velocity model
-  set Tangential velocity boundary indicators = bottom, top, 
+  set Tangential velocity boundary indicators = bottom, top,
 end

Comment on lines +551 to +556
/**
* The matrix that describes the rotation by which a 2D model
* needs to be transformed to a plane that contains the origin and
* the two prescribed points given in the input.
*/
Tensor<2,3> rotation_matrix;
Copy link
Contributor

Choose a reason for hiding this comment

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

This means that the slice has to go through the origin, right? I think this might be worth documenting. (But it shouldn't hold up the patch.)

Comment on lines +1452 to +1459
// Unfortunately, the chunk model uses latitude as natural coordinate. We need to convert this
// to colatitude to be consistent with the input files for spherical shells and spheres.
if (Plugins::plugin_type_matches<const GeometryModel::Chunk<dim>> (this->get_geometry_model()) ||
Plugins::plugin_type_matches<const GeometryModel::TwoMergedChunks<dim>> (this->get_geometry_model()) ||
Plugins::plugin_type_matches<const GeometryModel::EllipsoidalChunk<dim>> (this->get_geometry_model()))
{
internal_position[2] = numbers::PI/2. - internal_position[2];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

That's awkward :-(

@bangerth bangerth merged commit 7fd8750 into geodynamics:main Feb 4, 2023
@gassmoeller gassmoeller deleted the fix_ascii_coordinate_systems branch February 6, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants