Skip to content

Conversation

@Djneu
Copy link
Contributor

@Djneu Djneu commented Jan 23, 2025

Here is adding the interface for having topography models and defining them in the .wb file. So far the model is named uniform, though I think this will be changed later on to something better fitted to the lowest feature topography model.

Next steps would be:

  1. Make a function that allows world.cc to return the surface type when called from an outer program.
  2. Combine uniform.cc with an actual topography model.

Copy link
Member

@MFraters MFraters left a comment

Choose a reason for hiding this comment

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

I am on two minds about the naming of the class. Originally I thought just naming it none, to indicate that there is no topography. But uniform, with a default of zero would also work. Opinions?

Copy link
Contributor

@gassmoeller gassmoeller left a comment

Choose a reason for hiding this comment

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

Yes, the structure looks correct to me, but I have a number of suggestions for naming and you will have to update a bunch of comments.

Comment on lines 75 to 79

/**
* Whether to consider a reference or deformed surface.
*/
const std::string surface_type = "reference_surface";
Copy link
Contributor

Choose a reason for hiding this comment

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

while a string is flexible, it is also quite expensive to use. In addition it could contain arbitrary new values. I would suggest to introduce an enum type in the public part of this class (or even outside the class, but inside the Topography namespace. Something like:

  enum SurfaceType
  {
    reference_surface,
    deformed_surface};

This also guarantees that only these two values can be used.

Comment on lines 43 to 45
"Uniform gravity model. It returns the gravity vector in a Cartesian coordinate system at "
"a given position, which has a constant magitude for the whole domain. The vector points "
"down in cartesian coordinates and to the center of the sphere in spherical coordinates.");
Copy link
Contributor

Choose a reason for hiding this comment

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

nothing is parsed below so nothing needs to be declared here either?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the declaration.

@Djneu
Copy link
Contributor Author

Djneu commented Jan 23, 2025

Hi both, I think I've addressed all the previous comments. Next I think I'll need to add a case 7 to world.cc and make sure calling get_topography will return 0 and that I can also return the correct surface type with the get_surface_type function.

Djneu added 2 commits January 23, 2025 17:10
Apply suggestions from code review

Co-authored-by: Rene Gassmoeller <[email protected]>

Address comments.

minor changes
Comment on lines +284 to +286
* A pointers to the topography model. This variable is responsible for
* the topography model and has ownership over it. Therefore a unique
* pointer are used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a random comment as I'm looking at PRs to see what everyone has been working on :)

Suggested change
* A pointers to the topography model. This variable is responsible for
* the topography model and has ownership over it. Therefore a unique
* pointer are used.
* A pointer to the topography model. This variable is responsible for
* the topography model and has ownership over it. Therefore a unique
* pointer is used.

SurfaceType surface_type;

/**
* declare and read in the world builder file into the parameters class
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment doesn't seem right?

get_surface_type() = 0;

/**
* Returns a temperature based on the given position, depth in the model,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Returns a temperature based on the given position, depth in the model,
* Returns a topography based on the given position, depth in the model,

Comment on lines +52 to +63
* declare and read in the world builder file into the topography class
*/
static
void declare_entries(Parameters &prm, const std::string &parent_name = "");

/**
* declare and read in the world builder file into the topography class
*/
void parse_entries(Parameters &prm) override final;

/**
* declare and read in the world builder file into the topography class
Copy link
Contributor

Choose a reason for hiding this comment

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

These comments are all the same, which makes them less informative. Maybe make them more specific to the functions?

Copy link
Contributor

@gassmoeller gassmoeller left a comment

Choose a reason for hiding this comment

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

some comments from my previous review are not addressed yet. but generally closer to being ready.

namespace Topography
{
class Interface;
} // namespace GravityModel
Copy link
Contributor

Choose a reason for hiding this comment

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

Topography

std::unique_ptr<WorldBuilder::GravityModel::Interface> gravity_model;

/**
* A pointers to the topography model. This variable is responsible for
Copy link
Contributor

Choose a reason for hiding this comment

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

pointers -> pointer

/**
* A pointers to the topography model. This variable is responsible for
* the topography model and has ownership over it. Therefore a unique
* pointer are used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* pointer are used.
* pointer is used.

* A pointers to the topography model. This variable is responsible for
* the topography model and has ownership over it. Therefore a unique
* pointer are used.
* @see CoordinateSystem
Copy link
Contributor

Choose a reason for hiding this comment

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

what are you referring to here?

deformed_surface
};

SurfaceType surface_type;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this variable private. The enum type needs to be public, so that calling functions know that this type exists. But the variable itself (surface_type) should still be private as before so that no one accidentally changes this variable and all access has to go through get_surface_type.

Also add documentation what this variable means.

{
/**
* This implements a minimum depth topography. The minimum depth topography
* finds the minimum depth of a feature and uses that for the topography.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* finds the minimum depth of a feature and uses that for the topography.
* finds the minimum depth of all active features at a location and uses that depth as the topography.

Comment on lines -535 to 549



WorldBuilder::grains
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you delete these lines?

double
Uniform::get_topography(const Point<3> &/*position*/,
const Objects::NaturalCoordinate &/*position_in_natural_coordinates*/,
const double /*depth*/) const
Copy link
Member

Choose a reason for hiding this comment

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

Do you expect the depth to be needed? Do you forsee that the returned topography would be different based on the depth?

const Objects::NaturalCoordinate &/*position_in_natural_coordinates*/,
const double /*depth*/) const
{
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

uniform does not mean zero, it just means it is the same everywhere. could you make this variable?

Copy link
Member

@MFraters MFraters left a comment

Choose a reason for hiding this comment

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

I started playing a little bit with it already and I am wondering why we choice the approach of making this one global plugin system for the whole model, instead of a plugin system per feature. I could for example imagine that for different features you might want to have different types of topography, for example on a continent use a digital elevation map and/or different elevation maps for different regions, while in the ocean use fpr exaple a isostatic equilibrium or a analytical solution from the half space cooling or plate model. Do you remember why we went for this approach?

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.

4 participants