diff --git a/include/base/NekInterface.h b/include/base/NekInterface.h index 14bc07cc4..b572622e7 100644 --- a/include/base/NekInterface.h +++ b/include/base/NekInterface.h @@ -684,13 +684,13 @@ struct usrwrkIndices /// z-velocity of moving boundary (for mesh blending solver) int mesh_velocity_z; - /// x-velocity of moving boundary (for mesh elasticity) + /// filtered x-velocity of moving boundary int filtered_velocity_x; - /// y-velocity of moving boundary (for mesh elasticity) + /// filtered y-velocity of moving boundary int filtered_velocity_y; - /// z-velocity of moving boundary (for mesh elasticity) + /// filtered z-velocity of moving boundary int filtered_velocity_z; /// boundary velocity (for separate domain coupling) diff --git a/include/base/NekRSProblemBase.h b/include/base/NekRSProblemBase.h index 527062272..7cd1dd564 100644 --- a/include/base/NekRSProblemBase.h +++ b/include/base/NekRSProblemBase.h @@ -328,8 +328,11 @@ class NekRSProblemBase : public CardinalProblem /// Reference isobaric specific heat capacity const Real & _Cp_0; - /// If Nek is being run with fixed point iterations - bool _fp_iteration; + /** + * If Nek is being run with fixed point iterations; this means that the NekRS + * runs themselves are repeated in a fixed point loop (for purposes of FSI). + */ + const bool & _fp_iteration; /** * Whether to disable output file writing by NekRS and replace it by output diff --git a/src/base/NekRSProblem.C b/src/base/NekRSProblem.C index a4b6abc51..16d22da74 100644 --- a/src/base/NekRSProblem.C +++ b/src/base/NekRSProblem.C @@ -118,6 +118,7 @@ NekRSProblem::NekRSProblem(const InputParameters & params) _usrwrk_indices.push_back("mesh_velocity_x"); _usrwrk_indices.push_back("mesh_velocity_y"); _usrwrk_indices.push_back("mesh_velocity_z"); + if (_calc_filtered_velocity) { indices.filtered_velocity_x = start++ * nekrs::scalarFieldOffset(); @@ -128,6 +129,8 @@ NekRSProblem::NekRSProblem(const InputParameters & params) _usrwrk_indices.push_back("filtered_velocity_z"); } } + else + checkUnusedParam(params, "calculate_filtered_velocity", "not using the blending mesh solver"); _minimum_scratch_size_for_coupling = _usrwrk_indices.size() - _first_reserved_usrwrk_slot; @@ -341,7 +344,14 @@ NekRSProblem::sendBoundaryDeformationToNek() if (!_volume) { - const PostprocessorValue * iter = &getPostprocessorValueByName("fp_iteration"); + bool apply_new_mesh_velocity = true; + + if (_fp_iteration) + { + const PostprocessorValue * iter = &getPostprocessorValueByName("fp_iteration"); + apply_new_mesh_velocity = *iter != 1 || _t_step == 1; + } + for (unsigned int e = 0; e < _n_surface_elems; e++) { // We can only write into the nekRS scratch space if that face is "owned" by the current process @@ -350,26 +360,22 @@ NekRSProblem::sendBoundaryDeformationToNek() mapFaceDataToNekFace(e, _disp_x_var, 1.0, &_displacement_x); calculateMeshVelocity(e, field::mesh_velocity_x); - if (*iter != 1 || !_fp_iteration || - _t_step == - 1) // DR: We dont want to update the mesh velocity on the first iteration it will be - // 0, instead we want to assume the velocity from the previous calculation + if (apply_new_mesh_velocity) writeBoundarySolution(e, field::mesh_velocity_x, _mesh_velocity_elem); mapFaceDataToNekFace(e, _disp_y_var, 1.0, &_displacement_y); calculateMeshVelocity(e, field::mesh_velocity_y); - if (*iter != 1 || !_fp_iteration || _t_step == 1) + if (apply_new_mesh_velocity) writeBoundarySolution(e, field::mesh_velocity_y, _mesh_velocity_elem); mapFaceDataToNekFace(e, _disp_z_var, 1.0, &_displacement_z); calculateMeshVelocity(e, field::mesh_velocity_z); - if (*iter != 1 || !_fp_iteration || _t_step == 1) + if (apply_new_mesh_velocity) writeBoundarySolution(e, field::mesh_velocity_z, _mesh_velocity_elem); } + if (_calc_filtered_velocity) - { calculateFilteredVelocity(*_boundary); - } } else { @@ -827,7 +833,6 @@ NekRSProblem::calculateMeshVelocity(int e, const field::NekWriteEnum & field) { int len = _volume? _n_vertices_per_volume : _n_vertices_per_surface; double dt = _timestepper->getCurrentDT(); - const PostprocessorValue * iter = &getPostprocessorValueByName("fp_iteration"); double * displacement = nullptr, *prev_disp = nullptr; field::NekWriteEnum disp_field; @@ -852,12 +857,17 @@ NekRSProblem::calculateMeshVelocity(int e, const field::NekWriteEnum & field) default: mooseError("Unhandled NekWriteEnum in NekRSProblem::calculateMeshVelocity!\n"); } - if (*iter == 1 && _fp_iteration) + + if (_fp_iteration) { - _nek_mesh->updateDisplacement(e, displacement, disp_field); + const PostprocessorValue * iter = &getPostprocessorValueByName("fp_iteration"); + if (*iter == 1) + _nek_mesh->updateDisplacement(e, displacement, disp_field); } + for (int i=0; i updateDisplacement(e, displacement, disp_field); } diff --git a/src/base/NekRSProblemBase.C b/src/base/NekRSProblemBase.C index 97cff0828..e0717cb89 100644 --- a/src/base/NekRSProblemBase.C +++ b/src/base/NekRSProblemBase.C @@ -112,8 +112,8 @@ NekRSProblemBase::validParams() params.addParam( "fixed_point_iterations", false, - "Whether or not fixed point iterations will be used. Cardinal will look for a Postprocessor " - "called " + "Whether or not fixed point iterations will be used within the NekRS solve level. " + "Cardinal will look for a Postprocessor called " " 'fp_iteration' that receives the current iteration number from the top-level application."); return params; }