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

consistency_rkgc #588

Merged
merged 4 commits into from
Jun 12, 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
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void Integration1stHalf<Inner<>, RiemannSolverType, KernelCorrectionType>::inter
Real dW_ijV_j = inner_neighborhood.dW_ij_[n] * Vol_[index_j];
const Vecd &e_ij = inner_neighborhood.e_ij_[n];

force -= (p_[index_i] * correction_(index_i) + p_[index_j] * correction_(index_j)) * dW_ijV_j * e_ij;
force -= (p_[index_i] * correction_(index_j) + p_[index_j] * correction_(index_i)) * dW_ijV_j * e_ij;
rho_dissipation += riemann_solver_.DissipativeUJump(p_[index_i] - p_[index_j]) * dW_ijV_j;
}
force_[index_i] += force * Vol_[index_i];
Expand Down Expand Up @@ -159,7 +159,7 @@ void Integration1stHalf<Contact<>, RiemannSolverType, KernelCorrectionType>::
Vecd &e_ij = contact_neighborhood.e_ij_[n];
Real dW_ijV_j = contact_neighborhood.dW_ij_[n] * Vol_k[index_j];

force -= riemann_solver_k.AverageP(this->p_[index_i] * correction_(index_i), p_k[index_j] * correction_k(index_j)) *
force -= riemann_solver_k.AverageP(this->p_[index_i] * correction_(index_j), p_k[index_j] * correction_k(index_i)) *
2.0 * e_ij * dW_ijV_j;
rho_dissipation += riemann_solver_k.DissipativeUJump(this->p_[index_i] - p_k[index_j]) * dW_ijV_j;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ void LinearGradientCorrectionMatrix<Inner<>>::interaction(size_t index_i, Real d
const Neighborhood &inner_neighborhood = inner_configuration_[index_i];
for (size_t n = 0; n != inner_neighborhood.current_size_; ++n)
{
Vecd gradW_ij = inner_neighborhood.dW_ij_[n] * Vol_[index_i] * inner_neighborhood.e_ij_[n];
size_t index_j = inner_neighborhood.j_[n];
Vecd gradW_ij = inner_neighborhood.dW_ij_[n] * Vol_[index_j] * inner_neighborhood.e_ij_[n];
Vecd r_ji = inner_neighborhood.r_ij_[n] * inner_neighborhood.e_ij_[n];
local_configuration -= r_ji * gradW_ij.transpose();
}
Expand All @@ -19,9 +20,11 @@ void LinearGradientCorrectionMatrix<Inner<>>::interaction(size_t index_i, Real d
//=================================================================================================//
void LinearGradientCorrectionMatrix<Inner<>>::update(size_t index_i, Real dt)
{
Real det_sqr = SMAX(alpha_ - B_[index_i].determinant(), Real(0));
Matd inverse = B_[index_i].inverse();
Real weight = alpha_ / (B_[index_i].determinant() + alpha_);
B_[index_i] = weight * Matd::Identity() + (1.0 - weight) * inverse;
Real weight1_ = B_[index_i].determinant() / (B_[index_i].determinant() + det_sqr);
Real weight2_ = det_sqr / (B_[index_i].determinant() + det_sqr);
B_[index_i] = weight1_ * inverse + weight2_ * Matd::Identity();
}
//=================================================================================================//
LinearGradientCorrectionMatrix<Contact<>>::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ namespace SPH
template <typename... InteractionTypes>
class LinearGradientCorrectionMatrix;


// WKGC1 will be used for calculate the KGC matrix.
// The difference between WKGC1 and WKGC2 can refer to https://doi.org/10.1016/j.cma.2023.116460

template <class DataDelegationType>
class LinearGradientCorrectionMatrix<DataDelegationType>
: public LocalDynamics, public DataDelegationType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ template <class LocalDynamicsType, class ExecutionPolicy = ParallelPolicy>
class ReduceDynamics : public LocalDynamicsType,
public BaseDynamics<typename LocalDynamicsType::ReturnType>
{
using ReturnType = typename LocalDynamicsType::ReturnType;
public:
template <class DynamicsIdentifier, typename... Args>
ReduceDynamics(DynamicsIdentifier &identifier, Args &&...args)
: LocalDynamicsType(identifier, std::forward<Args>(args)...),
BaseDynamics<ReturnType>(identifier.getSPHBody()){};
virtual ~ReduceDynamics(){};

using ReturnType = typename LocalDynamicsType::ReturnType;
std::string QuantityName() { return this->quantity_name_; };
std::string DynamicsIdentifierName() { return this->identifier_.getName(); };

Expand Down
2 changes: 1 addition & 1 deletion tests/2d_examples/test_2d_impact_patch/impact_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int main(int ac, char *av[])
// Define the numerical methods used in the simulation.
// Note that there may be data dependence on the sequence of constructions.
//----------------------------------------------------------------------
InteractionWithUpdate<LinearGradientCorrectionMatrixInner> corrected_configuration_fluid(water_body_inner, 0.3);
InteractionWithUpdate<LinearGradientCorrectionMatrixInner> corrected_configuration_fluid(water_body_inner, 0.5);
InteractionWithUpdate<SpatialTemporalFreeSurfaceIndicationInner> free_surface_indicator(water_body_inner);

Dynamics1Level<fluid_dynamics::Integration1stHalfCorrectionInnerRiemann> fluid_pressure_relaxation_correct(water_body_inner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int main(int ac, char *av[])
// boundary condition and other constraints should be defined.
//----------------------------------------------------------------------
InteractionWithUpdate<SpatialTemporalFreeSurfaceIndicationInner> free_surface_indicator(water_body_inner);
InteractionWithUpdate<LinearGradientCorrectionMatrixInner> corrected_configuration_fluid(water_body_inner, 0.3);
InteractionWithUpdate<LinearGradientCorrectionMatrixInner> corrected_configuration_fluid(water_body_inner, 0.5);
Dynamics1Level<fluid_dynamics::Integration1stHalfCorrectionInnerRiemann> fluid_pressure_relaxation_correct(water_body_inner);
Dynamics1Level<fluid_dynamics::Integration2ndHalfInnerRiemann> fluid_density_relaxation(water_body_inner);
InteractionWithUpdate<fluid_dynamics::DensitySummationInnerFreeStream> update_density_by_summation(water_body_inner);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<result>
<Snapshot_Element>
<Snapshot number_of_snapshot_for_local_result_="41" />
<Snapshot number_of_snapshot_for_local_result_="102" />
</Snapshot_Element>
<Result_Element>
<Particle_0 snapshot_0="9860.5411200000017" snapshot_1="9854.3377912566084" snapshot_2="9856.412521796552" snapshot_3="9849.9745631393653" snapshot_4="9849.875881888398" snapshot_5="9848.0485171646869" snapshot_6="9849.6633934938327" snapshot_7="9850.9211894169821" snapshot_8="9848.9059287328346" snapshot_9="9848.2706285393087" snapshot_10="9846.4683056369413" snapshot_11="9851.1637041579179" snapshot_12="9849.0433292272028" snapshot_13="9851.2888835873582" snapshot_14="9848.5766476226745" snapshot_15="9844.4278922520407" snapshot_16="9851.1757115328983" snapshot_17="9851.8565392569071" snapshot_18="9848.4155946622814" snapshot_19="9846.2298237424548" snapshot_20="9846.6823697458749" snapshot_21="9847.9403427029138" snapshot_22="9847.713810812118" snapshot_23="9845.7252335939374" snapshot_24="9844.7029666050275" snapshot_25="9849.1442342035098" snapshot_26="9848.2261767313721" snapshot_27="9845.5781891098486" snapshot_28="9844.1456476525309" snapshot_29="9843.2154729112845" snapshot_30="9848.4223259882929" snapshot_31="9844.6249195310684" snapshot_32="9843.2234566174156" snapshot_33="9840.3243834915811" snapshot_34="9843.0935348223975" snapshot_35="9845.0356216928667" snapshot_36="9845.4532047318153" snapshot_37="9843.1453291531307" snapshot_38="9840.4839260993031" snapshot_39="9844.5673114101464" snapshot_40="9842.0003651305506" />
<Particle_0 snapshot_0="9860.5411200000017" snapshot_1="9828.8997905246997" snapshot_2="9862.5179988723685" snapshot_3="9840.7925036461093" snapshot_4="9862.1819867580925" snapshot_5="9853.1389528027066" snapshot_6="9852.0675918951001" snapshot_7="9852.433546090424" snapshot_8="9847.7487452810929" snapshot_9="9850.0789024654077" snapshot_10="9847.5887050234069" snapshot_11="9851.0449560811958" snapshot_12="9845.6001174880439" snapshot_13="9850.7533000893982" snapshot_14="9844.4479725072233" snapshot_15="9849.1394783432388" snapshot_16="9849.5207131532607" snapshot_17="9852.6879574472532" snapshot_18="9850.6656390418102" snapshot_19="9847.7143097333174" snapshot_20="9849.4034669404646" snapshot_21="9852.7900969713464" snapshot_22="9851.7400025743518" snapshot_23="9853.0688964105102" snapshot_24="9850.9956838431026" snapshot_25="9852.4360327762915" snapshot_26="9852.9732212349591" snapshot_27="9856.845869693012" snapshot_28="9852.660614958806" snapshot_29="9855.4890015262081" snapshot_30="9855.7093207147664" snapshot_31="9853.2305948369285" snapshot_32="9853.2715768211183" snapshot_33="9852.2762002387699" snapshot_34="9854.0332405817826" snapshot_35="9851.3957354719969" snapshot_36="9852.5285124512702" snapshot_37="9851.7432275521442" snapshot_38="9853.107142176028" snapshot_39="9855.4396377657649" snapshot_40="9856.1790856338848" snapshot_41="9855.6472334555983" snapshot_42="9855.3369055312232" snapshot_43="9853.8234705066225" snapshot_44="9854.5663755893838" snapshot_45="9856.6889988865005" snapshot_46="9854.6328625285532" snapshot_47="9855.1769328121172" snapshot_48="9853.4866089616626" snapshot_49="9853.6775508104784" snapshot_50="9854.8162057270711" snapshot_51="9857.2587833787475" snapshot_52="9855.387675199745" snapshot_53="9856.7966887010716" snapshot_54="9852.1774626628885" snapshot_55="9853.0449757232454" snapshot_56="9855.9752112903079" snapshot_57="9853.4564564202792" snapshot_58="9854.2401147061992" snapshot_59="9854.0429977537879" snapshot_60="9854.85512820855" snapshot_61="9852.7209961391345" snapshot_62="9854.8597948848546" snapshot_63="9855.0229404406946" snapshot_64="9856.0771094564079" snapshot_65="9855.8680544270374" snapshot_66="9855.2733246616444" snapshot_67="9855.3164114027531" snapshot_68="9856.5724514489884" snapshot_69="9855.4699901189742" snapshot_70="9857.8941861669045" snapshot_71="9852.1982870389547" snapshot_72="9856.5639668581753" snapshot_73="9855.6343315172453" snapshot_74="9855.2812961257405" snapshot_75="9855.8426062812741" snapshot_76="9856.1850872894447" snapshot_77="9854.6603248731863" snapshot_78="9856.933256591823" snapshot_79="9856.0894863442336" snapshot_80="9859.4470530862163" snapshot_81="9855.1993195417908" snapshot_82="9853.9797512540936" snapshot_83="9854.6020387077697" snapshot_84="9854.7262741568447" snapshot_85="9856.0166502193679" snapshot_86="9857.1786820471789" snapshot_87="9857.4903420515766" snapshot_88="9859.3382328846201" snapshot_89="9857.2928559855136" snapshot_90="9854.5132990763341" snapshot_91="9859.1692309447717" snapshot_92="9857.3448367682086" snapshot_93="9855.5492009887239" snapshot_94="9854.9818261717046" snapshot_95="9854.1457151838295" snapshot_96="9853.8257534962286" snapshot_97="9856.9609096189197" snapshot_98="9855.8643688386837" snapshot_99="9855.4842658789094" snapshot_100="9857.2175359565626" snapshot_101="9855.2181441207249" />
</Result_Element>
</result>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<result>
<Snapshot_Element>
<Snapshot number_of_snapshot_for_local_result_="102" />
</Snapshot_Element>
<Result_Element>
<Particle_0 snapshot_0="9860.5411200000017" snapshot_1="9828.8997905246979" snapshot_2="9862.5179988723685" snapshot_3="9840.7925036461238" snapshot_4="9862.1819867580434" snapshot_5="9853.1389528028285" snapshot_6="9852.0675918942143" snapshot_7="9852.4335460866787" snapshot_8="9847.748745304445" snapshot_9="9850.0789052651162" snapshot_10="9847.5894438112846" snapshot_11="9851.040340869833" snapshot_12="9845.6087743796888" snapshot_13="9850.7932524862081" snapshot_14="9844.7556659748097" snapshot_15="9849.0394025425667" snapshot_16="9850.0763074843198" snapshot_17="9852.5003246927499" snapshot_18="9850.451829028616" snapshot_19="9850.3527993938915" snapshot_20="9850.2987316105246" snapshot_21="9851.5727296134319" snapshot_22="9853.6293290909962" snapshot_23="9853.5897875910468" snapshot_24="9850.8703415713426" snapshot_25="9852.3969250466034" snapshot_26="9851.703660769741" snapshot_27="9852.9021778067909" snapshot_28="9855.9979757585133" snapshot_29="9853.6974714166699" snapshot_30="9852.3076773523644" snapshot_31="9852.0975812121433" snapshot_32="9853.5504630622454" snapshot_33="9852.6026468718101" snapshot_34="9854.8479192754457" snapshot_35="9851.1293136409113" snapshot_36="9853.7768125920375" snapshot_37="9850.4440329034551" snapshot_38="9855.180451737433" snapshot_39="9856.6109625778481" snapshot_40="9858.4752139494558" snapshot_41="9855.4524851732185" snapshot_42="9855.0073297310228" snapshot_43="9854.0889103650625" snapshot_44="9854.9571416244253" snapshot_45="9854.075376394776" snapshot_46="9854.6389344908675" snapshot_47="9856.1072650576207" snapshot_48="9851.8266214168216" snapshot_49="9854.3894602366054" snapshot_50="9855.8564678346156" snapshot_51="9854.7103784122119" snapshot_52="9857.7697353963995" snapshot_53="9855.532088849297" snapshot_54="9853.3881577582833" snapshot_55="9857.0605679448272" snapshot_56="9854.9558934810884" snapshot_57="9853.9200919362811" snapshot_58="9852.577453673608" snapshot_59="9853.1841928391586" snapshot_60="9854.5449751542037" snapshot_61="9853.1187096693793" snapshot_62="9857.7460801049292" snapshot_63="9855.8707840408551" snapshot_64="9855.8676308690374" snapshot_65="9853.674429344961" snapshot_66="9856.5459096957147" snapshot_67="9855.5917687395631" snapshot_68="9855.0703362008062" snapshot_69="9855.3454574725365" snapshot_70="9855.131519069666" snapshot_71="9854.7283482249732" snapshot_72="9853.9678554609873" snapshot_73="9854.6551267758696" snapshot_74="9854.8220805641067" snapshot_75="9858.6747314740605" snapshot_76="9858.6389017357942" snapshot_77="9854.1263029875881" snapshot_78="9856.4738468640608" snapshot_79="9856.159554810245" snapshot_80="9853.9713960820718" snapshot_81="9853.2323378452584" snapshot_82="9854.5389167363046" snapshot_83="9850.9974913181268" snapshot_84="9853.0603548953331" snapshot_85="9853.5958392741668" snapshot_86="9856.7378084765332" snapshot_87="9857.4022664167624" snapshot_88="9857.5287940287053" snapshot_89="9855.61820929225" snapshot_90="9853.5401645419952" snapshot_91="9858.2264928470304" snapshot_92="9855.6650492149347" snapshot_93="9856.0847445541949" snapshot_94="9856.6923092204906" snapshot_95="9852.6222513224748" snapshot_96="9858.4213795132382" snapshot_97="9858.0283412679892" snapshot_98="9856.8098784988342" snapshot_99="9857.0182124901621" snapshot_100="9855.3067614137617" snapshot_101="9854.8165601482451" />
</Result_Element>
</result>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<result>
<Snapshot_Element>
<Snapshot number_of_snapshot_for_local_result_="102" />
</Snapshot_Element>
<Result_Element>
<Particle_0 snapshot_0="9860.5411200000017" snapshot_1="9828.8997905246979" snapshot_2="9862.5179988723648" snapshot_3="9840.7925036461202" snapshot_4="9862.1819867581144" snapshot_5="9853.1389528025411" snapshot_6="9852.0675918949873" snapshot_7="9852.4335460932307" snapshot_8="9847.7487451707821" snapshot_9="9850.0789297589472" snapshot_10="9847.7029515477006" snapshot_11="9851.5910538218213" snapshot_12="9845.3829885840896" snapshot_13="9851.4789911276093" snapshot_14="9844.4647615990216" snapshot_15="9849.6116621629262" snapshot_16="9848.0591723389807" snapshot_17="9853.6562056066796" snapshot_18="9849.9771345781446" snapshot_19="9850.1125965498613" snapshot_20="9849.925718323535" snapshot_21="9852.2915309050022" snapshot_22="9854.2085777586944" snapshot_23="9851.3318390573149" snapshot_24="9851.9980845192658" snapshot_25="9852.9718276363383" snapshot_26="9851.0204337196737" snapshot_27="9855.0156052594284" snapshot_28="9854.7704201501838" snapshot_29="9857.4202359060619" snapshot_30="9854.1139132084936" snapshot_31="9853.5341016729435" snapshot_32="9851.3495205003419" snapshot_33="9852.5332757803335" snapshot_34="9854.4279389080148" snapshot_35="9852.5166109888596" snapshot_36="9854.8792010715351" snapshot_37="9850.9824581484663" snapshot_38="9855.8965288527143" snapshot_39="9855.3489350971977" snapshot_40="9857.1102798930151" snapshot_41="9857.7093606873277" snapshot_42="9855.6708620105601" snapshot_43="9853.8234341695897" snapshot_44="9858.2454564796772" snapshot_45="9855.129958455811" snapshot_46="9852.5852050458398" snapshot_47="9853.7933881650479" snapshot_48="9853.5151491140496" snapshot_49="9852.4085591552721" snapshot_50="9855.5635270847524" snapshot_51="9856.0865608656914" snapshot_52="9859.1701705130472" snapshot_53="9856.4059848820762" snapshot_54="9856.4247909783699" snapshot_55="9855.0156436174348" snapshot_56="9852.7263918362496" snapshot_57="9856.3122459666101" snapshot_58="9853.1480905809967" snapshot_59="9853.0680471801861" snapshot_60="9851.0497793558097" snapshot_61="9853.6537143919377" snapshot_62="9855.1640737626603" snapshot_63="9856.3176545735005" snapshot_64="9856.9512156523815" snapshot_65="9853.8708099957475" snapshot_66="9855.7218555001164" snapshot_67="9854.2075108788049" snapshot_68="9857.7731744774883" snapshot_69="9853.5590999027791" snapshot_70="9857.9034798988996" snapshot_71="9854.1010733090861" snapshot_72="9855.1137347333479" snapshot_73="9854.5518270876273" snapshot_74="9858.3024041102581" snapshot_75="9854.5295997047251" snapshot_76="9858.4817532345896" snapshot_77="9854.9737750572531" snapshot_78="9858.4210991712571" snapshot_79="9853.5649701706097" snapshot_80="9857.2396958269965" snapshot_81="9855.8471411214687" snapshot_82="9854.4984617206683" snapshot_83="9855.3325191225831" snapshot_84="9854.2873700684886" snapshot_85="9856.2752664762993" snapshot_86="9858.9557925388217" snapshot_87="9859.01478791105" snapshot_88="9857.7592196335227" snapshot_89="9857.1195573180557" snapshot_90="9856.9927002538097" snapshot_91="9858.972795591224" snapshot_92="9857.9996250628028" snapshot_93="9856.3427362436687" snapshot_94="9855.854211255375" snapshot_95="9855.2957926045765" snapshot_96="9857.9976300116086" snapshot_97="9857.7723226046292" snapshot_98="9861.3574314921152" snapshot_99="9858.0564437743633" snapshot_100="9858.8893756943562" snapshot_101="9856.312978323218" />
</Result_Element>
</result>
Loading
Loading