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 output for subvolumes #184

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Conversation

streeve
Copy link
Collaborator

@streeve streeve commented Feb 3, 2025

  • Generalize boundary condition geometry infrastructure
  • Add time series output for subvolumes (example for force-displacement)
  • Unify 1d spatial output profiles with geometry updates and simplify api

Closes #183

@streeve streeve added the enhancement New feature or request label Feb 3, 2025
@streeve streeve requested a review from pabloseleson February 3, 2025 15:22
@streeve streeve self-assigned this Feb 3, 2025
@@ -114,8 +114,7 @@ void elasticWaveExample( const std::string filename )
// Outputs
// ====================================================
// Output x-displacement along the x-axis
createDisplacementProfile( MPI_COMM_WORLD, "displacement_profile.txt",
*particles, num_cells[0], 0 );
createDisplacementProfile( "displacement_profile.txt", *particles, 0 );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Two questions:
(1) "0" is for axis. Does the function automatically output displacement magnitude by default?
(2) We are not passing "num_cells[0]" now as input. Is it automatically computed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, that function is createDisplacementMagnitudeProfile, used in one of the thermal examples. And the function was rewritten in a way that's it's no longer needed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean written in a way that "num_cells[0]" is no longer needed?

Region( const double profile_dim, const ArrayType dx )
{
_dims = getDim( profile_dim );
_dx[0] = dx[_dims[0]] / 2.0;
Copy link
Collaborator

@pabloseleson pabloseleson Feb 3, 2025

Choose a reason for hiding this comment

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

Notation here is confusing. On the left we have "dx" but on the right "dx/2"
Also dx[0] may not be dx along the x-direction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggestion? I'm just using dx to represent any dimension and avoiding doing the division for every particle

Copy link
Collaborator

Choose a reason for hiding this comment

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

(1) For the comment: On the left we have "dx" but on the right "dx/2", perhaps using:

_half_dx[0] = dx[_dims[0]] / 2.0;
or
_halfdx[0] = dx[_dims[0]] / 2.0;

(2) For the comment: Also dx[0] may not be dx along the x-direction, I am not sure. Perhaps adding a comment above line 144. Something like:
// In this case, _dx[0] and _dx[1] do not necessarily refer to the x- and y-directions.
Note the comment would change based on (1) above.

}

// Given a dimension, returns the other two
Kokkos::Array<int, 2> getDim( const int x )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Notation here could be confusing, since x is dimension not position. Similarly, yz may not be related to the zy plane.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggestion? As the comment says, given one dimsion, return the other two

Copy link
Collaborator

Choose a reason for hiding this comment

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

How about:

// Given a dimension, returns the other two dimensions
Kokkos::Array<int, 2> getOtherDims( const int dim )
{
Kokkos::Array<int, 2> otherDims;
otherDims[0] = (dim + 1) % 3;
otherDims[1] = (dim + 2) % 3;
return otherDims;
}

// FIXME: not in order.
auto measure_profile = KOKKOS_LAMBDA( const int b )
{
auto p = indices( b );
Copy link
Collaborator

Choose a reason for hiding this comment

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

How do these lines work exactly?

    auto p = indices( b );
    profile( b, 0 ) = x( p, profile_dim );
    profile( b, 1 ) = user( p );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't understand what you're asking really. Get a particle index and extract the position and whatever user quantity was requested

Copy link
Collaborator

Choose a reason for hiding this comment

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

What would be an example for "b" here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create capability for load-displacement output.
2 participants