Skip to content

Commit ee1ee77

Browse files
authored
Merge pull request #484 from dragos-ana/fix-post-setup-structure-timint
Fix post_setup calls for new structural time integration
2 parents 18ca4d3 + bc0fd8f commit ee1ee77

File tree

70 files changed

+494
-237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+494
-237
lines changed

src/adapter/4C_adapter_str_structure.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ namespace Adapter
147147

148148
//@}
149149

150+
/*!
151+
* @brief Perform all necessary tasks after setting up the object.
152+
*/
153+
virtual void post_setup() = 0;
154+
150155
//! @name Vector access
151156
//@{
152157

src/adapter/4C_adapter_str_wrapper.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ namespace Adapter
5454

5555
//@}
5656

57+
/*!
58+
* @brief Perform all necessary tasks after setting up structure
59+
* wrapper. Currently, the method only calls the post setup routine of the
60+
* underlying structural time integration.
61+
*/
62+
void post_setup() override { structure_->post_setup(); }
63+
5764
//! @name Vector access
5865
//@{
5966

src/contact/4C_contact_nitsche_integrator_ssi.cpp

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -206,46 +206,20 @@ void CONTACT::IntegratorNitscheSsi::so_ele_cauchy_struct(Mortar::Element& mortar
206206
linearizations.solid.d_cauchyndir_ddir = &d_sigma_nt_dt;
207207
linearizations.solid.d_cauchyndir_dxi = &d_sigma_nt_dxi;
208208

209-
if (mortar_ele.mo_data().parent_scalar().empty())
210-
{
211-
// Note: This branch is only needed since the structure is evaluating itself during setup before
212-
// the ssi problem is setup. Once this is fixed, this can be deleted.
213-
sigma_nt = std::invoke(
214-
[&]()
215-
{
216-
auto* solid_scatra_ele =
217-
dynamic_cast<Discret::Elements::SolidScatra*>(mortar_ele.parent_element());
218-
219-
FOUR_C_ASSERT_ALWAYS(solid_scatra_ele,
220-
"Nitsche contact is not implemented for this element (expecting SOLIDSCATRA "
221-
"element)!");
222-
223-
// SSI is not yet setup, so don't set the scalar.
224-
// Note: Once it is fixed in the structure time integration framework, the
225-
// scalars-parameter can be made non-optional
226-
return solid_scatra_ele->get_normal_cauchy_stress_at_xi(
227-
mortar_ele.mo_data().parent_disp(), std::nullopt, parent_xi, gp_normal, test_dir,
228-
linearizations);
229-
});
230-
}
231-
else
232-
{
233-
linearizations.d_cauchyndir_ds = d_sigma_nt_ds;
234-
sigma_nt = std::invoke(
235-
[&]()
236-
{
237-
auto* solid_scatra_ele =
238-
dynamic_cast<Discret::Elements::SolidScatra*>(mortar_ele.parent_element());
239-
240-
FOUR_C_ASSERT_ALWAYS(solid_scatra_ele,
241-
"Nitsche contact is not implemented for this element (expecting SOLIDSCATRA "
242-
"element)!");
243-
244-
return solid_scatra_ele->get_normal_cauchy_stress_at_xi(
245-
mortar_ele.mo_data().parent_disp(), mortar_ele.mo_data().parent_scalar(), parent_xi,
246-
gp_normal, test_dir, linearizations);
247-
});
248-
}
209+
linearizations.d_cauchyndir_ds = d_sigma_nt_ds;
210+
sigma_nt = std::invoke(
211+
[&]()
212+
{
213+
auto* solid_scatra_ele =
214+
dynamic_cast<Discret::Elements::SolidScatra*>(mortar_ele.parent_element());
215+
216+
FOUR_C_ASSERT_ALWAYS(solid_scatra_ele,
217+
"Nitsche contact is not implemented for this element (expecting SOLIDSCATRA "
218+
"element)!");
219+
220+
return solid_scatra_ele->get_normal_cauchy_stress_at_xi(mortar_ele.mo_data().parent_disp(),
221+
mortar_ele.mo_data().parent_scalar(), parent_xi, gp_normal, test_dir, linearizations);
222+
});
249223

250224
cauchy_nt_wgt += nitsche_wgt * sigma_nt;
251225

src/ehl/4C_ehl_base.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "4C_config.hpp"
1313

1414
#include "4C_adapter_algorithmbase.hpp"
15+
#include "4C_adapter_str_structure.hpp"
1516
#include "4C_coupling_adapter.hpp"
1617
#include "4C_ehl_input.hpp"
1718
#include "4C_linalg_utils_sparse_algebra_math.hpp"
@@ -45,6 +46,13 @@ namespace EHL
4546
/// setup
4647
virtual void setup_system() = 0;
4748

49+
/*!
50+
* @brief Perform all necessary tasks after setting up the object.
51+
* Currently, this only calls the post setup routine of the
52+
* structure field.
53+
*/
54+
void post_setup() { structure_->post_setup(); }
55+
4856
/// timeloop of coupled problem
4957
virtual void timeloop() = 0;
5058

src/ehl/4C_ehl_dyn.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,15 @@ void ehl_dyn()
115115

116116
// 3.2- Read restart if needed. (discretization called inside)
117117
const int restart = problem->restart();
118-
if (restart) ehl->read_restart(restart);
118+
if (restart)
119+
{
120+
ehl->read_restart(restart);
121+
}
122+
else
123+
{
124+
// run post_setup
125+
ehl->post_setup();
126+
}
119127

120128
// 4.- Run of the actual problem.
121129

src/fsi/src/4C_fsi_algorithm.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ void FSI::Algorithm::setup()
120120
coupsf_ = std::make_shared<Coupling::Adapter::Coupling>();
121121
}
122122

123+
/*----------------------------------------------------------------------*/
124+
/*----------------------------------------------------------------------*/
125+
void FSI::Algorithm::post_setup()
126+
{
127+
// call post_setup routine of the structural field
128+
structure_->post_setup();
129+
}
130+
131+
123132

124133
/*----------------------------------------------------------------------*/
125134
/*----------------------------------------------------------------------*/

src/fsi/src/4C_fsi_algorithm.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ namespace FSI
5858
/// setup this object
5959
virtual void setup();
6060

61+
/*!
62+
* @brief Perform all necessary tasks after setting up the FSI
63+
* algorithm. Currently, this only calls the post_setup routine of the
64+
* structure field.
65+
*/
66+
void post_setup();
67+
6168
/// access to structure field
6269
const std::shared_ptr<Adapter::FSIStructureWrapper>& structure_field() { return structure_; }
6370

src/fsi/src/4C_fsi_dyn.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ void fsi_immersed_drt()
342342
// read the restart information, set vectors and variables
343343
fsi->read_restart(restart);
344344
}
345+
else
346+
{
347+
fsi->post_setup();
348+
}
345349

346350
fsi->timeloop(Teuchos::rcpFromRef(*fsi));
347351

@@ -548,6 +552,10 @@ void fsi_ale_drt()
548552
{
549553
fsi->read_restart(restart);
550554
}
555+
else
556+
{
557+
fsi->post_setup();
558+
}
551559

552560
// now do the coupling setup and create the combined dofmap
553561
fsi->setup_system();
@@ -595,6 +603,10 @@ void fsi_ale_drt()
595603
{
596604
fsi->read_restart(restart);
597605
}
606+
else
607+
{
608+
fsi->post_setup();
609+
}
598610

599611
// now do the coupling setup and create the combined dofmap
600612
fsi->setup_system();
@@ -646,6 +658,11 @@ void fsi_ale_drt()
646658
// read the restart information, set vectors and variables
647659
fsi->read_restart(restart);
648660
}
661+
else
662+
{
663+
// call post setup tasks
664+
fsi->post_setup();
665+
}
649666

650667
fsi->timeloop(Teuchos::rcpFromRef(*fsi));
651668

@@ -799,6 +816,11 @@ void xfsi_drt()
799816
// read the restart information, set vectors and variables
800817
fsi->read_restart(restart);
801818
}
819+
else
820+
{
821+
// call post setup tasks
822+
fsi->post_setup();
823+
}
802824

803825
fsi->timeloop(Teuchos::rcpFromRef(*fsi));
804826

src/fsi/src/monolithic/4C_fsi_monolithic.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,15 @@ FSI::Monolithic::Monolithic(MPI_Comm comm, const Teuchos::ParameterList& timepar
365365
}
366366
}
367367

368+
/*----------------------------------------------------------------------------*/
369+
/*----------------------------------------------------------------------------*/
370+
void FSI::MonolithicBase::post_setup()
371+
{
372+
// call post_setup of the structure field
373+
structure_->post_setup();
374+
}
375+
376+
368377
/*----------------------------------------------------------------------------*/
369378
/*----------------------------------------------------------------------------*/
370379
void FSI::Monolithic::setup_system()

src/fsi/src/monolithic/4C_fsi_monolithic.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ namespace FSI
105105
explicit MonolithicBase(MPI_Comm comm, const Teuchos::ParameterList& timeparams);
106106

107107

108+
/*!
109+
* @brief Perform all necessary tasks after setting up the object.
110+
* Currently, this only calls the post_setup method of the structure
111+
* field.
112+
*/
113+
void post_setup();
114+
108115
/// read restart data
109116
void read_restart(int step) override;
110117

0 commit comments

Comments
 (0)