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

Skipping Zero-Weighted Elements in HROM #12268

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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 @@ -503,7 +503,9 @@ class GlobalROMBuilderAndSolver : public ResidualBasedBlockBuilderAndSolver<TSpa
[&](Element::Pointer p_element)
{
if (p_element->Has(HROM_WEIGHT)) {
element_queue.enqueue(std::move(p_element));
if (p_element->GetValue(HROM_WEIGHT) != 0.0) {
element_queue.enqueue(std::move(p_element));
}
} else {
p_element->SetValue(HROM_WEIGHT, 1.0);
}
Expand All @@ -515,7 +517,9 @@ class GlobalROMBuilderAndSolver : public ResidualBasedBlockBuilderAndSolver<TSpa
[&](Condition::Pointer p_condition)
{
if (p_condition->Has(HROM_WEIGHT)) {
condition_queue.enqueue(std::move(p_condition));
if (p_condition->GetValue(HROM_WEIGHT) != 0.0) {
condition_queue.enqueue(std::move(p_condition));
}
} else {
p_condition->SetValue(HROM_WEIGHT, 1.0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
SizeType GetNumberOfROMModes() const noexcept
{
return mNumberOfRomModes;
}
}

void ProjectToFineBasis(
const TSystemVectorType& rRomUnkowns,
Expand Down Expand Up @@ -280,7 +280,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
r_root_mp.GetValue(ROM_SOLUTION_INCREMENT) = ZeroVector(GetNumberOfROMModes());
}


void BuildAndSolve(
typename TSchemeType::Pointer pScheme,
ModelPart &rModelPart,
Expand Down Expand Up @@ -414,7 +414,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
///@}
///@name Protected operators
///@{

void BuildRHSNoDirichlet(
ModelPart& rModelPart,
TSystemVectorType& rb)
Expand Down Expand Up @@ -453,7 +453,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
AtomicAdd(r_bi, r_rhs_cond[i]); // Building RHS.
}
});
}
}

KRATOS_CATCH("")

Expand Down Expand Up @@ -497,7 +497,9 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
[&](Element::Pointer p_element)
{
if (p_element->Has(HROM_WEIGHT)) {
element_queue.enqueue(std::move(p_element));
if (p_element->GetValue(HROM_WEIGHT) != 0.0) {
element_queue.enqueue(std::move(p_element));
}
} else {
p_element->SetValue(HROM_WEIGHT, 1.0);
}
Expand All @@ -509,7 +511,9 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
[&](Condition::Pointer p_condition)
{
if (p_condition->Has(HROM_WEIGHT)) {
condition_queue.enqueue(std::move(p_condition));
if (p_condition->GetValue(HROM_WEIGHT) != 0.0) {
condition_queue.enqueue(std::move(p_condition));
}
} else {
p_condition->SetValue(HROM_WEIGHT, 1.0);
}
Expand All @@ -536,7 +540,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T

KRATOS_CATCH("")
}

static DofQueue ExtractDofSet(
typename TSchemeType::Pointer pScheme,
ModelPart& rModelPart)
Expand Down Expand Up @@ -626,7 +630,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
RomSystemMatrixType aux = {}; // Auxiliary: romA = phi.t * (LHS * phi) := phi.t * aux
};


/**
* Class to sum-reduce matrices and vectors.
*/
Expand Down Expand Up @@ -681,7 +685,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
}

/**
* Builds the reduced system of equations on rank 0
* Builds the reduced system of equations on rank 0
*/
virtual void BuildROM(
typename TSchemeType::Pointer pScheme,
Expand Down Expand Up @@ -712,7 +716,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
if(!elements.empty())
{
std::tie(rA, rb) =
block_for_each<SystemSumReducer>(elements, assembly_tls_container,
block_for_each<SystemSumReducer>(elements, assembly_tls_container,
[&](Element& r_element, AssemblyTLS& r_thread_prealloc)
{
return CalculateLocalContribution(r_element, r_thread_prealloc, *pScheme, r_current_process_info);
Expand All @@ -726,7 +730,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
RomSystemVectorType bconditions;

std::tie(Aconditions, bconditions) =
block_for_each<SystemSumReducer>(conditions, assembly_tls_container,
block_for_each<SystemSumReducer>(conditions, assembly_tls_container,
[&](Condition& r_condition, AssemblyTLS& r_thread_prealloc)
{
return CalculateLocalContribution(r_condition, r_thread_prealloc, *pScheme, r_current_process_info);
Expand Down Expand Up @@ -754,7 +758,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
KRATOS_TRY

RomSystemVectorType dxrom(GetNumberOfROMModes());

const auto solving_timer = BuiltinTimer();
MathUtils<double>::Solve(rA, dxrom, rb);
// KRATOS_WATCH(dxrom)
Expand Down Expand Up @@ -791,7 +795,7 @@ class ROMBuilderAndSolver : public BuilderAndSolver<TSparseSpace, TDenseSpace, T
SizeType mNumberOfRomModes;

///@}
///@name Private operations
///@name Private operations
///@{

/**
Expand Down
Loading