Skip to content

Commit b09d435

Browse files
committed
First refactoring of set_velocity_field
- rename method that takes no arguments to what it actually does, i.e. set_velocity_field_from_function - remove unused set_velocity_field method from levelset algorithm - remove unused argument setpressure from set_velocity_field method
1 parent 80b8cc4 commit b09d435

16 files changed

+56
-108
lines changed

src/elch/4C_elch_dyn.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ void elch_dyn(int restart)
108108
if (restart) scatraonly.scatra_field()->read_restart(restart);
109109

110110
// set velocity field
111-
// note: The order read_restart() before set_velocity_field() is important here!!
112-
// for time-dependent velocity fields, set_velocity_field() is additionally called in each
113-
// prepare_time_step()-call
114-
scatraonly.scatra_field()->set_velocity_field();
111+
// note: The order read_restart() before set_velocity_field_from_function() is important
112+
// here!! for time-dependent velocity fields, set_velocity_field_from_function() is
113+
// additionally called in each prepare_time_step()-call
114+
scatraonly.scatra_field()->set_velocity_field_from_function();
115115

116116
// enter time loop to solve problem with given convective velocity
117117
scatraonly.scatra_field()->time_loop();

src/fs3i/4C_fs3i_fps3i_partitioned.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,9 @@ void FS3I::PartFPS3I::set_velocity_fields()
637637
case Inpar::ScaTra::velocity_zero:
638638
case Inpar::ScaTra::velocity_function:
639639
{
640-
for (unsigned i = 0; i < scatravec_.size(); ++i)
640+
for (auto scatra : scatravec_)
641641
{
642-
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra = scatravec_[i];
643-
scatra->scatra_field()->set_velocity_field();
642+
scatra->scatra_field()->set_velocity_field_from_function();
644643
}
645644
break;
646645
}

src/levelset/4C_levelset_algorithm.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@ namespace ScaTra
6666
//! set the velocity field (zero or field by function) (pure level-set problems)
6767
void set_velocity_field(bool init = false);
6868

69-
/// set convective velocity field (+ pressure and acceleration field as
70-
/// well as fine-scale velocity field, if required) (function for coupled fluid problems)
71-
void set_velocity_field(std::shared_ptr<const Core::LinAlg::Vector<double>> convvel,
72-
std::shared_ptr<const Core::LinAlg::Vector<double>> acc,
73-
std::shared_ptr<const Core::LinAlg::Vector<double>> vel,
74-
std::shared_ptr<const Core::LinAlg::Vector<double>> fsvel, bool setpressure = false,
75-
bool init = false);
76-
77-
7869
// output position of center of mass assuming a smoothed interfaces
7970
void mass_center_using_smoothing();
8071

src/levelset/4C_levelset_algorithm_utils.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ FOUR_C_NAMESPACE_OPEN
2929
void ScaTra::LevelSetAlgorithm::set_velocity_field(bool init)
3030
{
3131
// call function of base class
32-
ScaTraTimIntImpl::set_velocity_field();
32+
ScaTraTimIntImpl::set_velocity_field_from_function();
3333

3434
// note: This function is only called from the level-set dyn. This is ok, since
3535
// we only want to initialize conveln_ at the beginning of the simulation.
@@ -38,29 +38,6 @@ void ScaTra::LevelSetAlgorithm::set_velocity_field(bool init)
3838
}
3939

4040

41-
/*----------------------------------------------------------------------*
42-
| set convective velocity field (+ pressure and acceleration field as |
43-
| well as fine-scale velocity field, if required) rasthofer 11/13 |
44-
*----------------------------------------------------------------------*/
45-
void ScaTra::LevelSetAlgorithm::set_velocity_field(
46-
std::shared_ptr<const Core::LinAlg::Vector<double>> convvel,
47-
std::shared_ptr<const Core::LinAlg::Vector<double>> acc,
48-
std::shared_ptr<const Core::LinAlg::Vector<double>> vel,
49-
std::shared_ptr<const Core::LinAlg::Vector<double>> fsvel, bool setpressure, bool init)
50-
{
51-
// call routine of base class
52-
ScaTraTimIntImpl::set_velocity_field(convvel, acc, vel, fsvel, setpressure);
53-
54-
// manipulate velocity field away from the interface
55-
if (extract_interface_vel_) manipulate_fluid_field_for_gfunc();
56-
57-
// estimate velocity at contact points, i.e., intersection points of interface and (no-slip) walls
58-
if (cpbc_) apply_contact_point_boundary_condition();
59-
60-
return;
61-
}
62-
63-
6441
/*----------------------------------------------------------------------*
6542
| add problem depended params for assemble_mat_and_rhs rasthofer 09/13 |
6643
*----------------------------------------------------------------------*/

src/loma/4C_loma_algorithm.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,6 @@ void LowMach::Algorithm::mono_loop()
532532
// check convergence and stop iteration loop if convergence is achieved
533533
stopnonliniter = convergence_check(itnum);
534534
}
535-
536-
return;
537535
}
538536

539537

@@ -548,21 +546,19 @@ void LowMach::Algorithm::set_fluid_values_in_scatra()
548546
case Inpar::FLUID::timeint_afgenalpha:
549547
{
550548
scatra_field()->set_velocity_field(
551-
fluid_field()->velaf(), fluid_field()->accam(), nullptr, fluid_field()->fs_vel(), true);
549+
fluid_field()->velaf(), fluid_field()->accam(), nullptr, fluid_field()->fs_vel());
552550
}
553551
break;
554552
case Inpar::FLUID::timeint_one_step_theta:
555553
case Inpar::FLUID::timeint_bdf2:
556554
{
557555
scatra_field()->set_velocity_field(
558-
fluid_field()->velnp(), fluid_field()->hist(), nullptr, fluid_field()->fs_vel(), true);
556+
fluid_field()->velnp(), fluid_field()->hist(), nullptr, fluid_field()->fs_vel());
559557
}
560558
break;
561559
default:
562560
FOUR_C_THROW("Time integration scheme not supported");
563-
break;
564561
}
565-
return;
566562
}
567563

568564

src/loma/4C_loma_dyn.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ void loma_dyn(int restart)
104104
if (restart) (scatraonly.scatra_field())->read_restart(restart);
105105

106106
// set initial velocity field
107-
// note: The order read_restart() before set_velocity_field() is important here!!
108-
// for time-dependent velocity fields, set_velocity_field() is additionally called in each
109-
// prepare_time_step()-call
110-
(scatraonly.scatra_field())->set_velocity_field();
107+
// note: The order read_restart() before set_velocity_field_from_function() is important
108+
// here!! for time-dependent velocity fields, set_velocity_field_from_function() is
109+
// additionally called in each prepare_time_step()-call
110+
(scatraonly.scatra_field())->set_velocity_field_from_function();
111111

112112
// enter time loop to solve problem with given convective velocity field
113113
(scatraonly.scatra_field())->time_loop();

src/mat/4C_mat_scatra_multiscale_gp.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ void Mat::ScatraMultiScaleGP::init()
237237
global_micro_state().microdisnum_microtimint_map_[microdisnum_]->setup();
238238

239239
// set initial velocity field
240-
global_micro_state().microdisnum_microtimint_map_[microdisnum_]->set_velocity_field();
240+
global_micro_state()
241+
.microdisnum_microtimint_map_[microdisnum_]
242+
->set_velocity_field_from_function();
241243

242244
// create counter for number of macro-scale Gauss points associated with micro-scale time
243245
// integrator

src/poroelast_scatra/4C_poroelast_scatra_base.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,7 @@ void PoroElastScaTra::PoroScatraBase::set_velocity_fields()
179179
velnp = volcoupl_fluidscatra_->apply_vector_mapping21(*poro_->fluid_field()->velnp());
180180
}
181181

182-
scatra_->scatra_field()->set_velocity_field(convel, // convective vel.
183-
nullptr, // acceleration
184-
velnp, // velocity
185-
nullptr, // fsvel
186-
true // set pressure
187-
);
182+
scatra_->scatra_field()->set_velocity_field(convel, nullptr, velnp, nullptr);
188183
}
189184

190185
/*----------------------------------------------------------------------*

src/scatra/4C_scatra_cardiac_monodomain_dyn.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ void scatra_cardiac_monodomain_dyn(int restart)
172172
if (restart) scatraonly.scatra_field()->read_restart(restart);
173173

174174
// set initial velocity field
175-
// note: The order read_restart() before set_velocity_field() is important here!!
176-
// for time-dependent velocity fields, set_velocity_field() is additionally called in each
177-
// prepare_time_step()-call
178-
(scatraonly.scatra_field())->set_velocity_field();
175+
// note: The order read_restart() before set_velocity_field_from_function() is important
176+
// here!! for time-dependent velocity fields, set_velocity_field_from_function() is
177+
// additionally called in each prepare_time_step()-call
178+
(scatraonly.scatra_field())->set_velocity_field_from_function();
179179

180180
// enter time loop to solve problem with given convective velocity
181181
(scatraonly.scatra_field())->time_loop();

src/scatra/4C_scatra_dyn.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ void scatra_dyn(int restart)
169169
if (restart) scatraonly.scatra_field()->read_restart(restart);
170170

171171
// set initial velocity field
172-
// note: The order read_restart() before set_velocity_field() is important here!!
173-
// for time-dependent velocity fields, set_velocity_field() is additionally called in each
174-
// prepare_time_step()-call
175-
scatraonly.scatra_field()->set_velocity_field();
172+
// note: The order read_restart() before set_velocity_field_from_function() is important
173+
// here!! for time-dependent velocity fields, set_velocity_field_from_function() is
174+
// additionally called in each prepare_time_step()-call
175+
scatraonly.scatra_field()->set_velocity_field_from_function();
176176

177177
// set external force
178178
if (scatraonly.scatra_field()->has_external_force())

0 commit comments

Comments
 (0)