Skip to content

Commit

Permalink
Merge branch 'solver/two-phase-explicit' of https://github.com/cb-geo…
Browse files Browse the repository at this point in the history
…/mpm into solver/two-phase-explicit
  • Loading branch information
tianchiTJ committed Nov 4, 2020
2 parents 2b195ee + 32f1c5a commit 689d9fb
Show file tree
Hide file tree
Showing 10 changed files with 560 additions and 536 deletions.
28 changes: 22 additions & 6 deletions include/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ class Cell {
//! Return the status of a cell: active (if a particle is present)
bool status() const { return particles_.size(); }

//! Assign solving status
void assign_solving_status(bool status) { solving_status_ = status; }

//! Return solving status
bool solving_status() const { return solving_status_; }

//! Return particles_
std::vector<Index> particles() const { return particles_; }

Expand Down Expand Up @@ -223,28 +217,50 @@ class Cell {
//! Return previous mpi rank
unsigned previous_mpirank() const;

/**
* \defgroup MultiPhase Functions dealing with multi-phase MPM
*/
/**@{*/

//! Assign solving status
//! \ingroup MultiPhase
//! \param[in] status Cell solving status for parallel free-surface detection
void assign_solving_status(bool status) { solving_status_ = status; }

//! Return solving status of a cell: active (if a particle is present in all
//! MPI rank)
//! \ingroup MultiPhase
bool solving_status() const { return solving_status_; }

//! Assign free surface
//! \ingroup MultiPhase
//! \param[in] free_surface boolean indicating free surface cell
void assign_free_surface(bool free_surface) { free_surface_ = free_surface; };

//! Return free surface bool
//! \ingroup MultiPhase
//! \retval free_surface_ indicating free surface cell
bool free_surface() const { return free_surface_; };

//! Assign volume traction to node
//! \ingroup MultiPhase
//! \param[in] volume_fraction cell volume fraction
void assign_volume_fraction(double volume_fraction) {
volume_fraction_ = volume_fraction;
};

//! Return cell volume fraction
//! \ingroup MultiPhase
//! \retval volume_fraction_ cell volume fraction
double volume_fraction() const { return volume_fraction_; };

//! Map cell volume to the nodes
//! \ingroup MultiPhase
//! \param[in] phase to map volume
void map_cell_volume_to_nodes(unsigned phase);

/**@}*/

private:
//! Approximately check if a point is in a cell
//! \param[in] point Coordinates of point
Expand Down
2 changes: 1 addition & 1 deletion include/cell.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ template <unsigned Tdim>
void mpm::Cell<Tdim>::map_cell_volume_to_nodes(unsigned phase) {
if (this->status()) {
// Check if cell volume is set
if (volume_ == std::numeric_limits<double>::lowest())
if (volume_ <= std::numeric_limits<double>::lowest())
this->compute_volume();

for (unsigned i = 0; i < nodes_.size(); ++i) {
Expand Down
27 changes: 21 additions & 6 deletions include/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,19 @@ class Mesh {
//! Inject particles
void inject_particles(double current_time);

// Create the nodal properties' map
void create_nodal_properties();

// Initialise the nodal properties' map
void initialise_nodal_properties();

/**
* \defgroup MultiPhase Functions dealing with multi-phase MPM
*/
/**@{*/

//! Compute free surface
//! \ingroup MultiPhase
//! \param[in] method Type of method to use
//! \param[in] volume_tolerance for volume_fraction approach
//! \retval status Status of compute_free_surface
Expand All @@ -490,6 +502,7 @@ class Mesh {
double volume_tolerance = std::numeric_limits<unsigned>::epsilon());

//! Compute free surface by density method
//! \ingroup MultiPhase
//! \details Using simple approach of volume fraction approach as (Kularathna
//! & Soga, 2017) and density ratio comparison (Hamad, 2015). This method is
//! fast, but less accurate.
Expand All @@ -499,6 +512,7 @@ class Mesh {
double volume_tolerance = std::numeric_limits<unsigned>::epsilon());

//! Compute free surface by geometry method
//! \ingroup MultiPhase
//! \details Using a more expensive approach using neighbouring particles and
//! current geometry. This method combine multiple checks in order to simplify
//! and fasten the process: (1) Volume fraction approach as (Kularathna & Soga
Expand All @@ -510,30 +524,30 @@ class Mesh {
double volume_tolerance = std::numeric_limits<unsigned>::epsilon());

//! Get free surface node set
//! \ingroup MultiPhase
//! \retval id_set Set of free surface node ids
std::set<mpm::Index> free_surface_nodes();

//! Get free surface cell set
//! \ingroup MultiPhase
//! \retval id_set Set of free surface cell ids
std::set<mpm::Index> free_surface_cells();

//! Get free surface particle set
//! \ingroup MultiPhase
//! \retval status Status of compute_free_surface
//! \retval id_set Set of free surface particle ids
std::set<mpm::Index> free_surface_particles();

// Create the nodal properties' map
void create_nodal_properties();

// Initialise the nodal properties' map
void initialise_nodal_properties();

//! Assign particles pore pressures
//! \ingroup MultiPhase
//! \param[in] particle_pore_pressure Initial pore pressure of particle
bool assign_particles_pore_pressures(
const std::vector<std::tuple<mpm::Index, double>>&
particle_pore_pressures);

/**@}*/

private:
// Read particles from file
//! \param[in] pset_id Set ID of the particles
Expand Down Expand Up @@ -606,5 +620,6 @@ class Mesh {
} // namespace mpm

#include "mesh.tcc"
#include "mesh_multiphase.tcc"

#endif // MPM_MESH_H_
Loading

0 comments on commit 689d9fb

Please sign in to comment.