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

Dem volume insertion initial velocities #1078

Merged
merged 4 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
All notable changes to the Lethe project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## [Master] - 2024-03-20
## [Master] - 2024-03-28

### Fixed
### Changed

- MINOR The ``velocity x/y/z`` parameters have been replaced by one parameter named ``initial velocity``. The ``omega x/y/z`` parameters have been replaced by one parameter named ``initial angular velocity``. [#1078](https://github.com/lethe-cfd/lethe/pull/1078)
[#1078](https://github.com/lethe-cfd/lethe/pull/1078)

- MINOR The ``insertion box minimum/maximum x/y/z`` parameters have been replaced by one parameter named ``insertion box points coordinates`` [#1074](https://github.com/lethe-cfd/lethe/pull/1074)

- MINOR The ``insertion first/second/third direction `` parameters have been replaced by one parameter named ``insertion direction sequence`` [#1074](https://github.com/lethe-cfd/lethe/pull/1074)
## [Master] - 2024-03-20

### Changed

- MINOR The ``insertion box minimum/maximum x/y/z`` parameters have been replaced by one parameter named ``insertion box points coordinates``. The ``insertion first/second/third direction `` parameters have been replaced by one parameter named ``insertion direction sequence``. [#1074](https://github.com/lethe-cfd/lethe/pull/1074)

## [Master] - 2024-03-19

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ subsection insertion info
set insertion distance threshold = 1.01
set insertion maximum offset = 0.
set insertion prn seed = 19

set velocity y = 10.0
set initial velocity = 0, 10.0, 0
end

#---------------------------------------------------
Expand Down
12 changes: 4 additions & 8 deletions doc/source/parameters/dem/insertion_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ In this subsection, insertion methods which are ``volume``, ``plane``, ``list``

set insertion order of direction = 0, 1, 2

set velocity x = 0.0
set velocity y = 0.0
set velocity z = 0.0
set omega x = 0.0
set omega y = 0.0
set omega z = 0.0
set initial velocity = 0.0, 0.0, 0.0
set initial angular velocity = 0.0, 0.0, 0.0

set insertion distance threshold = 2

Expand Down Expand Up @@ -77,9 +73,9 @@ The ``volume`` insertion method uses an insertion box where particles will be in

* The ``insertion order of direction`` parameter defines the directions of insertion. For example, if the parameter is equal to ``0, 1, 2``, the particles are inserted in priority in the x, in y, and then in z directions. This is the default configuration. This is useful to specify the insertion directions to cover a specific area of the insertion box with the first and second direction parameters.

* The ``velocity x``, ``velocity y``, and ``velocity z`` determine the initial translational velocity (in :math:`\frac{m}{s}`) at which particles are inserted in the x, y, and z directions, respectively.
* The ``initial velocity`` determine the initial translational velocity (in :math:`\frac{m}{s}`) at which particles are inserted in the x, y, and z directions.

* The ``omega x``, ``omega y``, and ``omega z`` determine the initial rotational velocity (in :math:`\frac{rad}{s}`) at which particles are inserted in the x, y, and z directions, respectively.
* The ``initial angular velocity`` determine the initial rotational velocity (in :math:`\frac{rad}{s}`) at which particles are inserted in the x, y, and z directions.

.. note::
Since the ``insertion info`` subsection is valid for all particle types, by using ``velocity x``, ``velocity y``, ``velocity z``, ``omega x``, ``omega y``, or ``omega z``, the given condition is applied to all particles, indistinctively.
Expand Down
4 changes: 2 additions & 2 deletions include/core/parameters_lagrangian.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ namespace Parameters
// Insertion box info (xmin,xmax,ymin,ymax,zmin,zmax)
Point<3> insertion_box_point_1, insertion_box_point_2;

// Insertion initial conditions
double vel_x, vel_y, vel_z, omega_x, omega_y, omega_z;
// Insertion initial velocity conditions
Tensor<1, 3> initial_vel, initial_ang_vel;

// Insertion distance threshold
double distance_threshold;
Expand Down
42 changes: 11 additions & 31 deletions source/core/parameters_lagrangian.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ namespace Parameters
"0,1,2",
Patterns::List(Patterns::Integer(), 2, 3),
"First direction of particle insertion");

prm.declare_entry(
"insertion box points coordinates",
"0. , 0. , 0. : 1. , 1. , 1.",
Expand Down Expand Up @@ -359,30 +358,14 @@ namespace Parameters
"-1.0",
Patterns::List(Patterns::Double()),
"List of diameters");
prm.declare_entry("velocity x",
"0.0",
Patterns::Double(),
"Initial velocity x");
prm.declare_entry("velocity y",
"0.0",
Patterns::Double(),
"Initial velocity y");
prm.declare_entry("velocity z",
"0.0",
Patterns::Double(),
"Initial velocity z");
prm.declare_entry("omega x",
"0.0",
Patterns::Double(),
"Initial omega x");
prm.declare_entry("omega y",
"0.0",
Patterns::Double(),
"Initial omega y");
prm.declare_entry("omega z",
"0.0",
Patterns::Double(),
"Initial omega z");
prm.declare_entry("initial velocity",
"0.0, 0.0, 0.0",
Patterns::List(Patterns::Double()),
"Initial velocity (x, y, z)");
prm.declare_entry("initial angular velocity",
"0.0, 0.0, 0.0",
Patterns::List(Patterns::Double()),
"Initial angular velocity (x, y, z)");
prm.declare_entry("insertion file name",
"particles.input",
Patterns::FileName(),
Expand Down Expand Up @@ -460,12 +443,9 @@ namespace Parameters
insertion_maximum_offset = prm.get_double("insertion maximum offset");
seed_for_insertion = prm.get_integer("insertion prn seed");

vel_x = prm.get_double("velocity x");
vel_y = prm.get_double("velocity y");
vel_z = prm.get_double("velocity z");
omega_x = prm.get_double("omega x");
omega_y = prm.get_double("omega y");
omega_z = prm.get_double("omega z");
initial_vel = entry_string_to_tensor3(prm, "initial velocity");
initial_ang_vel =
entry_string_to_tensor3(prm, "initial angular velocity");

// Read x, y and z lists
list_x = convert_string_to_vector<double>(prm, "list x");
Expand Down
12 changes: 6 additions & 6 deletions source/dem/insertion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ Insertion<dim>::assign_particle_properties(
->particle_sizes[particle_counter]);
double density =
physical_properties.density_particle[current_inserting_particle_type];
double vel_x = dem_parameters.insertion_info.vel_x;
double vel_y = dem_parameters.insertion_info.vel_y;
double vel_z = dem_parameters.insertion_info.vel_z;
double omega_x = dem_parameters.insertion_info.omega_x;
double omega_y = dem_parameters.insertion_info.omega_y;
double omega_z = dem_parameters.insertion_info.omega_z;
double vel_x = dem_parameters.insertion_info.initial_vel[0];
double vel_y = dem_parameters.insertion_info.initial_vel[1];
double vel_z = dem_parameters.insertion_info.initial_vel[2];
double omega_x = dem_parameters.insertion_info.initial_ang_vel[0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the new parameter name, but I think I would rather keep dem_parameters.insertion_info.omega[0], because the rest of the code uses omega. Otherwise it is all clear to me :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, and you don't need initial, since this is insertion info

Copy link
Collaborator Author

@OGaboriault OGaboriault Mar 29, 2024

Choose a reason for hiding this comment

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

I think the initial is useful. This way, there's not confusion with the velocity at a given time step.

I can do initial_omega. I agree, omega is more coherent with the rest of code.

What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In general, I tend to prefer long meaningful names instead of confusing abbreviations, but in this case I found it slightly redundant, hence, not necessary. This is not a strong opinion, though. So this is really up to you :)

double omega_y = dem_parameters.insertion_info.initial_ang_vel[1];
double omega_z = dem_parameters.insertion_info.initial_ang_vel[2];
double fem_force_x = 0.;
double fem_force_y = 0.;
double fem_force_z = 0.;
Expand Down
Loading