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

[MPM] Cleanup set and fill buffer size #11650

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

ncrescenzio
Copy link
Contributor

Buffer size is now assigned to model parts using the function SetAndFillBuffer from auxiliary_solver_utilities (similarly to other applications).

This also solves a problem related to the vtk output of the background grid: variables TIME and STEP where not found in ModelPart.ProcessInfo when calling VtkOutput.Check().

@ncrescenzio ncrescenzio requested a review from a team as a code owner October 3, 2023 10:37
Comment on lines 449 to +451
else:
current_buffer_size = self.material_point_model_part.GetBufferSize()
if self.min_buffer_size > current_buffer_size:
self.material_point_model_part.SetBufferSize(self.min_buffer_size)
else:
self.material_point_model_part.SetBufferSize(current_buffer_size)
required_buffer_size = self.material_point_model_part.GetBufferSize()
auxiliary_solver_utilities.SetAndFillBuffer(self.grid_model_part, required_buffer_size, delta_time)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I'm saying something stupid, but shouldn't the database of self.grid_model_part be already filled if you're restarting the Model container?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only self.material_point_model_part is imported using the RestartUtility, while self.grid_model_part is imported as usual using the mdpa file. So it is necessary to set again the buffer size of the grid model part, no?

Copy link
Member

Choose a reason for hiding this comment

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

But, as far as I understand, in a standard case (no restart) the self.grid_model_part is imported once at the beginning of the simulation from its corresponding mdpa. Assuming this, the self.grid_model_part will be part of the Model container meaning that it will be serialized, together with all its data when doing the save of the restart. Hence, when loading from the restart data file the self.grid_model_part will be there with its corresponding data. With your current implementation you are wiping the data of self.grid_model_part.

In any case, I'm not aware of the particularities of your application so this is maybe the behavior you intend to achieve.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not the one who implemented the restart in the ParticleMechanicsApplication, so I'm not really familiar with it. But I think that in the current implementation only the self.material_point_model_part is serialized with all its data when doing the save of the restart through the SaveRestartProcess. The self.grid_model_part and self.initial_mesh_model_part (both part of the Model container) are not serialized and data is not saved. And I think it makes sense because the self.initial_mesh_model_part is used only at the very beginning of the simulation (not needed and not loaded in the restart) while the self.grid_model_part is only used for the computations (and thus it is loaded using the mdpa file as in the standard case).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rubenzorrilla was my last comment clear? Can we merge this?

I am not changing the behavior of the application, I only need to define the variables TIME and STEP otherwise the VtkOutput process is not working and I am doing it by using auxiliary_solver_utilities.SetAndFillBuffer like it is done in other applications.

If something is not clear about how the restart is implemented in our application I think we can discuss it separately

Copy link
Member

Choose a reason for hiding this comment

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

Please go ahead. I was just pointing that the good way to go would be to serialize the Model. If you already have a working implementation I've no objections about.

@ncrescenzio ncrescenzio merged commit e9f5970 into master Nov 1, 2023
@ncrescenzio ncrescenzio deleted the mpm/clean-up-setbuffersize branch November 1, 2023 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants