-
Notifications
You must be signed in to change notification settings - Fork 54
Implements partitioned Fluid-Structure Interaction (FSI) coupling in svMultiPhysics #554
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
base: main
Are you sure you want to change the base?
Changes from all commits
c5efb59
b324b1f
c4609d5
7eec430
d095026
1d7c5cf
fbe9c34
d3d942f
0113997
9955e3d
8dbde2f
7065339
f2ee520
98d09f0
8e2f9d6
bbb88d6
9b52ad5
316d6da
63e5753
4407dc1
65d3eec
22459d8
39f0b94
e4f88d3
ccf7ecd
ec07838
ca653bb
1f4acb8
695f9d6
75db517
f0eacd7
5917389
c49aff3
7309075
a73c528
7bd5223
d6919af
3b23497
7716ab5
93a60f6
eb75141
b5ca973
a662804
0ddd574
770ade1
dbe71cc
6b15c85
c0442e0
0d3a664
c740b98
c45225f
13c452d
1276447
3a33c69
1a33822
6a78870
8ed9348
f967ce0
7dbc639
1057b2d
808b3ff
4f31b40
4ce07ee
d773e1c
f148872
1df0adf
9bc4767
8c6d95e
f4dcf49
dd312fa
a2a5da8
6939090
6859f63
12d4a1a
06fa5b6
fd17bf6
92bf528
c12d2e7
9233ceb
72063dc
d79fc23
72c7f76
7d5eaf2
2f0be30
b747671
fb643c7
6ee9f85
9e035e5
1cac5ae
047d7fe
5bd2b80
7db9ff8
deeaa08
09fa221
611d0e4
d78da16
1ca09fc
b08717c
0311766
778853f
8a110c0
6ec04f5
bf5ebcc
21fcabb
49735ef
899f0b5
c09500d
9f15007
c750449
9d94c76
f55bb14
318aed0
e1d5b10
f9a0a01
07a7b50
c84d5be
54bf014
7cf93d7
270bf31
1b1c53c
9b03ef6
bb8a220
72c9101
07157eb
0aa9580
69546f2
c0d5875
2c33943
6d58898
668f0d7
a4aed3d
83dd1d0
bbdb98a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1571,9 +1571,14 @@ class ComMod { | |
| /// @brief Whether there is a requirement to update mesh and Dn-Do variables | ||
| bool dFlag = false; | ||
|
|
||
| /// @brief Whether mesh is moving | ||
| /// @brief Whether mesh is moving (monolithic FSI: mesh velocity in DOFs nsd+1..2*nsd) | ||
| bool mvMsh = false; | ||
|
|
||
| /// @brief ALE mesh velocity for partitioned FSI (nsd, tnNo). | ||
| /// When non-empty, the fluid assembly subtracts this from the convective | ||
| /// velocity, providing the ALE correction without expanding tDof. | ||
| Array<double> ale_mesh_velocity; | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove verbose comments |
||
| /// @brief Whether to averaged results | ||
| bool saveAve = false; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| #include "utils.h" | ||
|
|
||
| #include <algorithm> | ||
| #include <cmath> | ||
| #include <iostream> | ||
| #include <set> | ||
|
|
||
|
|
@@ -171,6 +172,94 @@ bool Integrator::step() { | |
| } // End of Newton iteration loop | ||
| } | ||
|
|
||
| //------------------------ | ||
| // step_equation | ||
| //------------------------ | ||
| /// @brief Solve a single equation to convergence without cycling to other equations | ||
| bool Integrator::step_equation(int iEq, std::function<void()> post_assembly) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this function called anywhere besides partitioned fsi? |
||
| using namespace consts; | ||
|
|
||
| auto& com_mod = simulation_->com_mod; | ||
| auto& cm_mod = simulation_->cm_mod; | ||
|
|
||
| int& cTS = com_mod.cTS; | ||
|
|
||
| // Set up for this equation | ||
| com_mod.cEq = iEq; | ||
| auto& eq = com_mod.eq[iEq]; | ||
| eq.itr = 0; | ||
| eq.ok = false; | ||
| eq.iNorm = 0.0; | ||
|
|
||
| newton_count_ = 1; | ||
|
|
||
| while (true) { | ||
| istr_ = "_" + std::to_string(cTS) + "_" + std::to_string(newton_count_); | ||
| auto& eq = com_mod.eq[iEq]; | ||
|
|
||
| // Coupled BC handling (same as step()) | ||
| if (com_mod.cplBC.coupled && iEq == 0) { | ||
| set_bc::set_bc_cpl(com_mod, cm_mod, solutions_); | ||
| set_bc::set_bc_dir(com_mod, solutions_); | ||
| } | ||
|
|
||
| // Initiator step for Generalized α-Method | ||
| initiator_step(); | ||
|
|
||
| if (com_mod.Rd.size() != 0) { | ||
| com_mod.Rd = 0.0; | ||
| com_mod.Kd = 0.0; | ||
| } | ||
|
|
||
| // Allocate, assemble, apply BCs | ||
| allocate_linear_system(eq); | ||
| set_body_forces(); | ||
| assemble_equations(); | ||
| apply_boundary_conditions(); | ||
|
|
||
| // Optional post-assembly callback (e.g., for injecting interface traction) | ||
| if (post_assembly) { | ||
| post_assembly(); | ||
| } | ||
|
|
||
| // Synchronize R across processes | ||
| if (!eq.assmTLS) { | ||
| all_fun::commu(com_mod, com_mod.R); | ||
| } | ||
|
|
||
| // Update residual in displacement equation for USTRUCT phys | ||
| if (com_mod.sstEq) { | ||
| ustruct::ustruct_r(com_mod, solutions_); | ||
| } | ||
|
|
||
| // Set the residual of the continuity equation to 0 on edge nodes | ||
| if (std::set<EquationType>{Equation_stokes, Equation_fluid, Equation_ustruct, Equation_FSI}.count(eq.phys) != 0) { | ||
| fs::thood_val_rc(com_mod); | ||
| } | ||
|
|
||
| set_bc::set_bc_undef_neu(com_mod); | ||
| update_residual_arrays(eq); | ||
|
|
||
| // Solve linear system | ||
| solve_linear_system(); | ||
|
|
||
| // Update solution and check convergence (no equation cycling) | ||
| update_solution(); | ||
|
|
||
| if (eq.ok) { | ||
| return true; | ||
| } | ||
|
|
||
| // Abort on NaN in residual norm (indicates divergence). | ||
| if (newton_count_ > 1 && std::isnan(eq.FSILS.RI.iNorm)) { | ||
| return false; | ||
| } | ||
|
|
||
| output::output_result(simulation_, com_mod.timeP, 2, iEq); | ||
| newton_count_ += 1; | ||
| } | ||
| } | ||
|
|
||
| //------------------------ | ||
| // initiator_step | ||
| //------------------------ | ||
|
|
@@ -374,8 +463,8 @@ void Integrator::update_residual_arrays(eqType& eq) { | |
| // 1. Bazilevs, et al. "Isogeometric fluid-structure interaction: | ||
| // theory, algorithms, and computations.", Computational Mechanics, | ||
| // 43 (2008): 3-37. doi: 10.1007/s00466-008-0315-x | ||
| // 2. Bazilevs, et al. "Variational multiscale residual-based | ||
| // turbulence modeling for large eddy simulation of incompressible | ||
| // 2. Bazilevs, et al. "Variational multiscale residual-based | ||
| // turbulence modeling for large eddy simulation of incompressible | ||
| // flows.", CMAME (2007) | ||
| //------------------------ | ||
| // predictor (picp) | ||
|
|
@@ -621,11 +710,13 @@ void Integrator::initiator(SolutionStates& solutions) | |
| } | ||
| } | ||
| //------------------------ | ||
| // corrector | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undo comment changes |
||
| // update_solution | ||
| //------------------------ | ||
| /// @brief Corrector with convergence check | ||
| /// @brief Update solution from linear solve result and check convergence | ||
| /// | ||
| /// Decision for next eqn is also made here (modifies cEq global). | ||
| /// Performs the corrector update of An, Yn, Dn from the Newton solve result | ||
| /// and checks convergence norms. Sets eq.ok if converged. | ||
| /// Does NOT handle equation cycling (that is done by corrector()). | ||
| /// | ||
| /// Modifies: | ||
| /// \code {.cpp} | ||
|
|
@@ -637,13 +728,12 @@ void Integrator::initiator(SolutionStates& solutions) | |
| /// com_mod.pS0 | ||
| /// com_mod.pSa | ||
| /// com_mod.pSn | ||
| /// | ||
| /// com_mod.cEq | ||
| /// eq.FSILS.RI.iNorm | ||
| /// eq.pNorm | ||
| /// eq.ok | ||
| /// \endcode | ||
| // | ||
| void Integrator::corrector() | ||
| void Integrator::update_solution() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the renaming? |
||
| { | ||
| using namespace consts; | ||
|
|
||
|
|
@@ -853,10 +943,42 @@ void Integrator::corrector() | |
| dmsg << "com_mod.eq[1].ok: " << com_mod.eq[1].ok; | ||
| #endif | ||
| } | ||
| } | ||
|
|
||
| //------------------------ | ||
| // corrector | ||
| //------------------------ | ||
| /// @brief Corrector with convergence check and equation cycling | ||
| /// | ||
| /// Calls update_solution() to update the solution and check convergence, | ||
| /// then handles equation switching for coupled problems (modifies cEq global). | ||
| // | ||
| void Integrator::corrector() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this extra function? |
||
| { | ||
| using namespace consts; | ||
|
|
||
| auto& com_mod = simulation_->com_mod; | ||
| const int tnNo = com_mod.tnNo; | ||
| auto& cEq = com_mod.cEq; | ||
| auto& eq = com_mod.eq[cEq]; | ||
|
|
||
| auto& An = solutions_.current.get_acceleration(); | ||
| auto& Dn = solutions_.current.get_displacement(); | ||
| auto& Yn = solutions_.current.get_velocity(); | ||
|
|
||
| #define n_debug_corrector_cycling | ||
| #ifdef debug_corrector_cycling | ||
| DebugMsg dmsg(__func__, com_mod.cm.idcm()); | ||
| dmsg.banner(); | ||
| #endif | ||
|
|
||
| // Update solution and check convergence | ||
| update_solution(); | ||
|
|
||
| // Check if all equations converged - if so, skip equation cycling | ||
| auto& eqs = com_mod.eq; | ||
| if (std::count_if(eqs.begin(),eqs.end(),[](eqType& eq){return eq.ok;}) == eqs.size()) { | ||
| #ifdef debug_corrector | ||
| #ifdef debug_corrector_cycling | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't rename |
||
| dmsg << "all ok"; | ||
| #endif | ||
| return; | ||
|
|
@@ -868,7 +990,7 @@ void Integrator::corrector() | |
| // For coupled equations, if explicit geometric coupling is not used, | ||
| // increment the equation counter after each linear solve | ||
| cEq = cEq + 1; | ||
| #ifdef debug_corrector | ||
| #ifdef debug_corrector_cycling | ||
| dmsg << "eq " << " coupled "; | ||
| dmsg << "1st update cEq: " << cEq; | ||
| #endif | ||
|
|
@@ -929,7 +1051,7 @@ void Integrator::corrector() | |
| cEq = cEq + 1; | ||
| } | ||
| } | ||
| #ifdef debug_corrector | ||
| #ifdef debug_corrector_cycling | ||
| dmsg << "eq " << " coupled "; | ||
| dmsg << "2nd update cEq: " << cEq; | ||
| #endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?