Skip to content

Commit

Permalink
to test all
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangyu-Hu committed Jul 27, 2023
1 parent 39a6482 commit c200d58
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class BaseDiffusionRelaxation
explicit BaseDiffusionRelaxation(SPHBody &sph_body);
virtual ~BaseDiffusionRelaxation(){};
StdVec<BaseDiffusion *> &AllDiffusions() { return material_.AllDiffusions(); };
void initialization(size_t index_i, Real dt = 0.0);
void update(size_t index_i, Real dt = 0.0);
};

Expand Down Expand Up @@ -111,7 +112,6 @@ class DiffusionRelaxationInner
{
protected:
KernelGradientType kernel_gradient_;
void initializeDiffusionChangeRate(size_t particle_i);
void getDiffusionChangeRate(size_t particle_i, size_t particle_j, Vecd &e_ij, Real surface_area_ij);

public:
Expand Down Expand Up @@ -280,8 +280,8 @@ class DiffusionRelaxationRK2 : public BaseDynamics<void>
protected:
StdVec<StdLargeVec<Real>> diffusion_species_s_; /**< Intermediate state */
SimpleDynamics<InitializationRK<typename FirstStageType::InnerParticlesType>> rk2_initialization_;
InteractionWithUpdate<FirstStageType> rk2_1st_stage_;
InteractionWithUpdate<SecondStageRK2<FirstStageType>> rk2_2nd_stage_;
Dynamics1Level<FirstStageType> rk2_1st_stage_;
Dynamics1Level<SecondStageRK2<FirstStageType>> rk2_2nd_stage_;
StdVec<BaseDiffusion *> all_diffusions_;

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ BaseDiffusionRelaxation<ParticlesType>::
std::string &diffusion_species_name = all_species_names[diffusion_species_indexes[i]];
diffusion_dt_[i] = this->particles_->template registerSharedVariable<Real>(diffusion_species_name + "ChangeRate");
}
}
}
//=================================================================================================//
template <class ParticlesType>
void BaseDiffusionRelaxation<ParticlesType>::initialization(size_t index_i, Real dt)
{
for (size_t m = 0; m < this->all_diffusions_.size(); ++m)
{
(*this->diffusion_dt_[m])[index_i] = 0;
}
}
//=================================================================================================//
template <class ParticlesType>
void BaseDiffusionRelaxation<ParticlesType>::update(size_t index_i, Real dt)
Expand All @@ -61,16 +70,6 @@ DiffusionRelaxationInner<ParticlesType, KernelGradientType>::
kernel_gradient_(this->particles_) {}
//=================================================================================================//
template <class ParticlesType, class KernelGradientType>
void DiffusionRelaxationInner<ParticlesType, KernelGradientType>::
initializeDiffusionChangeRate(size_t particle_i)
{
for (size_t m = 0; m < this->all_diffusions_.size(); ++m)
{
(*this->diffusion_dt_[m])[particle_i] = 0;
}
}
//=================================================================================================//
template <class ParticlesType, class KernelGradientType>
void DiffusionRelaxationInner<ParticlesType, KernelGradientType>::
getDiffusionChangeRate(size_t particle_i, size_t particle_j, Vecd &e_ij, Real surface_area_ij)
{
Expand All @@ -89,8 +88,6 @@ void DiffusionRelaxationInner<ParticlesType, KernelGradientType>::
interaction(size_t index_i, Real dt)
{
Neighborhood &inner_neighborhood = this->inner_configuration_[index_i];

initializeDiffusionChangeRate(index_i);
for (size_t n = 0; n != inner_neighborhood.current_size_; ++n)
{
size_t index_j = inner_neighborhood.j_[n];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ class DirichletWallBoundaryInitialCondition
size_t phi_;

public:
DirichletWallBoundaryInitialCondition(SolidBody &diffusion_body) : DiffusionReactionInitialCondition<WallParticles>(diffusion_body)
explicit DirichletWallBoundaryInitialCondition(SolidBody &diffusion_body)
: DiffusionReactionInitialCondition<WallParticles>(diffusion_body)
{
phi_ = particles_->diffusion_reaction_material_.AllSpeciesIndexMap()["Phi"];
}
Expand Down Expand Up @@ -157,7 +158,8 @@ class NeumannWallBoundaryInitialCondition
StdLargeVec<Real> &heat_flux_;

public:
NeumannWallBoundaryInitialCondition(SolidBody &diffusion_body) : DiffusionReactionInitialCondition<WallParticles>(diffusion_body),
explicit NeumannWallBoundaryInitialCondition(SolidBody &diffusion_body)
: DiffusionReactionInitialCondition<WallParticles>(diffusion_body),
heat_flux_(*(particles_->getVariableByName<Real>("HeatFlux")))
{
phi_ = particles_->diffusion_reaction_material_.AllSpeciesIndexMap()["Phi"];
Expand Down
17 changes: 9 additions & 8 deletions tests/2d_examples/test_2d_diffusion_RobinBC/diffusion_RobinBC.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ class DirichletWallBoundaryInitialCondition
size_t phi_;

public:
DirichletWallBoundaryInitialCondition(SolidBody &diffusion_body) : DiffusionReactionInitialCondition<WallParticles>(diffusion_body)
explicit DirichletWallBoundaryInitialCondition(SolidBody &diffusion_body)
: DiffusionReactionInitialCondition<WallParticles>(diffusion_body)
{
phi_ = particles_->diffusion_reaction_material_.AllSpeciesIndexMap()["Phi"];
}
Expand Down Expand Up @@ -158,9 +159,10 @@ class RobinWallBoundaryInitialCondition
Real &T_infinity_;

public:
RobinWallBoundaryInitialCondition(SolidBody &diffusion_body) : DiffusionReactionInitialCondition<WallParticles>(diffusion_body),
convection_(*(this->particles_->template getVariableByName<Real>("Convection"))),
T_infinity_(*(this->particles_->template getGlobalVariableByName<Real>("T_infinity")))
explicit RobinWallBoundaryInitialCondition(SolidBody &diffusion_body)
: DiffusionReactionInitialCondition<WallParticles>(diffusion_body),
convection_(*(this->particles_->template getVariableByName<Real>("Convection"))),
T_infinity_(*(this->particles_->template getGlobalVariableByName<Real>("T_infinity")))
{
phi_ = particles_->diffusion_reaction_material_.AllSpeciesIndexMap()["Phi"];
}
Expand Down Expand Up @@ -200,7 +202,7 @@ class DiffusionBodyRelaxation
class TemperatureObserverParticleGenerator : public ObserverParticleGenerator
{
public:
TemperatureObserverParticleGenerator(SPHBody &sph_body) : ObserverParticleGenerator(sph_body)
explicit TemperatureObserverParticleGenerator(SPHBody &sph_body) : ObserverParticleGenerator(sph_body)
{
/** A line of measuring points at the middle line. */
size_t number_of_observation_points = 5;
Expand All @@ -209,9 +211,8 @@ class TemperatureObserverParticleGenerator : public ObserverParticleGenerator

for (size_t i = 0; i < number_of_observation_points; ++i)
{
Vec2d point_coordinate(0.5 * L, range_of_measure * Real(i) /
Real(number_of_observation_points - 1) +
start_of_measure);
Vec2d point_coordinate(
0.5 * L, range_of_measure * Real(i) / Real(number_of_observation_points - 1) + start_of_measure);
positions_.push_back(point_coordinate);
}
}
Expand Down

0 comments on commit c200d58

Please sign in to comment.