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

Sliding mesh for incompressible flows + Cleaning of transfer routines #638

Merged
merged 21 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e91168a
Add sliding states to incompressible flow solver.
rsanfer Jan 23, 2019
7c230fa
Add test cases.
rsanfer Jan 28, 2019
b800f6d
Edited travis.yml for branch testing.
rsanfer Jan 28, 2019
84e3352
Merge branch 'develop' into feature_sliding_incompressible
rsanfer Jan 28, 2019
b8830f4
Remove some warnings from this and previous PRs.
rsanfer Jan 28, 2019
7644bd1
Change travis.yml to test on the local branch TestCases folder.
rsanfer Jan 28, 2019
1fa0823
Add structure for initialization of target variable.
rsanfer Jan 28, 2019
84956a0
Move sliding-mesh specific initialization case to its own constructor.
rsanfer Jan 28, 2019
d654c17
Remove check for FSI.
rsanfer Jan 28, 2019
4c3cedc
Use polymorphism to avoid physics-based statements in the base transf…
rsanfer Jan 28, 2019
6a669ef
Remove alternative transfer methods, make broadcast default.
rsanfer Jan 28, 2019
82456ab
Remove MATCHING_MESH keyword and methods, as it is a subcase of NN in…
rsanfer Jan 28, 2019
bdbb9e5
Merged with develop.
rsanfer Jan 28, 2019
befffe5
Temporarily disable new test-case for unsteady incompressible sliding…
rsanfer Jan 28, 2019
56dd44f
Fix merge issues.
rsanfer Jan 28, 2019
0aecc73
Removed unnecessary option to define the transfer method.
rsanfer Jan 29, 2019
9cbd8b0
Revert changes to travis.yml.
rsanfer Jan 29, 2019
0da7698
Merged with develop and solved conflicts.
rsanfer Jan 30, 2019
35f8ced
Merge branch 'develop' into feature_sliding_incompressible
rsanfer Feb 1, 2019
423a6a8
Merge branch 'develop' into feature_sliding_incompressible
economon Feb 2, 2019
b7e0dbb
Remove unused MatchZone method.
rsanfer Feb 4, 2019
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
19 changes: 1 addition & 18 deletions Common/include/config_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,7 @@ class CConfig {
Kind_Matrix_Coloring, /*!< \brief Type of matrix coloring for sparse Jacobian computation. */
Kind_Solver_Fluid_FSI, /*!< \brief Kind of solver for the fluid in FSI applications. */
Kind_Solver_Struc_FSI, /*!< \brief Kind of solver for the structure in FSI applications. */
Kind_BGS_RelaxMethod, /*!< \brief Kind of relaxation method for Block Gauss Seidel method in FSI problems. */
Kind_TransferMethod; /*!< \brief Iterative scheme for nonlinear structural analysis. */
Kind_BGS_RelaxMethod; /*!< \brief Kind of relaxation method for Block Gauss Seidel method in FSI problems. */
bool Energy_Equation; /*!< \brief Solve the energy equation for incompressible flows. */
bool MUSCL, /*!< \brief MUSCL scheme .*/
MUSCL_Flow, /*!< \brief MUSCL scheme for the flow equations.*/
Expand Down Expand Up @@ -956,7 +955,6 @@ class CConfig {
long ExtraHeatOutputZone; /*!< \brief Heat solver zone with extra screen output */
bool DeadLoad; /*!< Application of dead loads to the FE analysis */
bool PseudoStatic; /*!< Application of dead loads to the FE analysis */
bool MatchingMesh; /*!< Matching mesh (while implementing interpolation procedures). */
bool SteadyRestart; /*!< Restart from a steady state for FSI problems. */
su2double Newmark_beta, /*!< \brief Parameter alpha for Newmark method. */
Newmark_gamma; /*!< \brief Parameter delta for Newmark method. */
Expand Down Expand Up @@ -4378,14 +4376,6 @@ class CConfig {
*/
unsigned short GetKind_SpaceIteScheme_FEA(void);

/*!
* \brief Get the kind of transfer method we want to use for multiphysics problems
* \note This value is obtained from the config file, and it is constant
* during the computation.
* \return Kind of transfer method for multiphysics problems
*/
unsigned short GetKind_TransferMethod(void);

/*!
* \brief Get the kind of convective numerical scheme for the flow
* equations (centered or upwind).
Expand Down Expand Up @@ -8556,13 +8546,6 @@ class CConfig {

bool GetPseudoStatic(void);

/*!
* \brief Identifies if the mesh is matching or not (temporary, while implementing interpolation procedures).
* \return <code>TRUE</code> if the mesh is matching, <code>FALSE</code> otherwise.
*/

bool GetMatchingMesh(void);

/*!
* \brief Identifies if we want to restart from a steady or an unsteady solution.
* \return <code>TRUE</code> if we restart from steady state solution, <code>FALSE</code> otherwise.
Expand Down
6 changes: 1 addition & 5 deletions Common/include/config_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,6 @@ inline unsigned short CConfig::GetKind_TimeIntScheme_FEA(void) { return Kind_Tim

inline unsigned short CConfig::GetKind_SpaceIteScheme_FEA(void) { return Kind_SpaceIteScheme_FEA; }

inline unsigned short CConfig::GetKind_TransferMethod(void) { return Kind_TransferMethod; }

inline unsigned short CConfig::GetKind_ConvNumScheme_Flow(void) { return Kind_ConvNumScheme_Flow; }

inline unsigned short CConfig::GetKind_ConvNumScheme_FEM_Flow(void) { return Kind_ConvNumScheme_FEM_Flow; }
Expand Down Expand Up @@ -1844,8 +1842,6 @@ inline bool CConfig::GetDeadLoad(void) { return DeadLoad; }

inline bool CConfig::GetPseudoStatic(void) { return PseudoStatic; }

inline bool CConfig::GetMatchingMesh(void) { return MatchingMesh; }

inline bool CConfig::GetSteadyRestart(void) { return SteadyRestart; }

inline unsigned short CConfig::GetDynamic_Analysis(void) { return Dynamic_Analysis; }
Expand Down Expand Up @@ -2075,4 +2071,4 @@ inline unsigned short CConfig::GetEig_Val_Comp(void) {return eig_val_comp; }

inline su2double CConfig::GetUQ_URLX(void) {return uq_urlx; }

inline bool CConfig::GetUQ_Permute(void) { return uq_permute; }
inline bool CConfig::GetUQ_Permute(void) { return uq_permute; }
13 changes: 0 additions & 13 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,19 +997,6 @@ static const map<string, ENUM_SPACE_ITE_FEA> Space_Ite_Map_FEA = CCreateMap<stri
("NEWTON_RAPHSON", NEWTON_RAPHSON)
("MODIFIED_NEWTON_RAPHSON", MODIFIED_NEWTON_RAPHSON);

/*!
* \brief types of transfer methods
*/
enum ENUM_TRANSFER_METHOD {
BROADCAST_DATA = 1, /*!< \brief Gather data on one processor and broadcast it into all of them, relating to global nodes. */
SCATTER_DATA = 2, /*!< \brief Gather data on one processor and scatter it into the one that needs it. */
ALLGATHER_DATA = 3, /*!< \brief All processors gather data (this will be useful for operations over a group of data - averaging) */
};
static const map<string, ENUM_TRANSFER_METHOD> Transfer_Method_Map = CCreateMap<string, ENUM_TRANSFER_METHOD>
("BROADCAST_DATA", BROADCAST_DATA)
("SCATTER_DATA", SCATTER_DATA)
("ALLGATHER_DATA", ALLGATHER_DATA);

/*!
* \brief types of schemes to compute the flow gradient
*/
Expand Down
7 changes: 0 additions & 7 deletions Common/src/config_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2051,9 +2051,6 @@ void CConfig::SetConfig_Options(unsigned short val_iZone, unsigned short val_nZo
/* DESCRIPTION: Order of the predictor */
addUnsignedShortOption("PREDICTOR_ORDER", Pred_Order, 0);

/* DESCRIPTION: Transfer method used for multiphysics problems */
addEnumOption("MULTIPHYSICS_TRANSFER_METHOD", Kind_TransferMethod, Transfer_Method_Map, BROADCAST_DATA);

/* DESCRIPTION: Topology optimization options */
addBoolOption("TOPOLOGY_OPTIMIZATION", topology_optimization, false);
addStringOption("TOPOL_OPTIM_OUTFILE", top_optim_output_file, string("element_derivatives.dat"));
Expand Down Expand Up @@ -2095,10 +2092,6 @@ void CConfig::SetConfig_Options(unsigned short val_iZone, unsigned short val_nZo
/* DESCRIPTION: Restart from a steady state (sets grid velocities to 0 when loading the restart). */
addBoolOption("RESTART_STEADY_STATE", SteadyRestart, false);

/* DESCRIPTION: Apply dead loads
* Options: NO, YES \ingroup Config */
addBoolOption("MATCHING_MESH", MatchingMesh, false);

/*!\par CONFIG_CATEGORY: Multizone definition \ingroup Config*/
/*--- Options related to multizone problems ---*/

Expand Down
56 changes: 56 additions & 0 deletions SU2_CFD/include/solver_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7122,6 +7122,11 @@ class CIncEulerSolver : public CSolver {
CFluidModel *FluidModel; /*!< \brief fluid model used in the solver */
su2double **Preconditioner; /*!< \brief Auxiliary matrix for storing the low speed preconditioner. */

/* Sliding meshes variables */

su2double ****SlidingState;
int **SlidingStateNodes;

public:

/*!
Expand Down Expand Up @@ -7478,6 +7483,16 @@ class CIncEulerSolver : public CSolver {
void BC_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
CConfig *config, unsigned short val_marker);

/*!
* \brief Impose the interface state across sliding meshes.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver_container - Container vector with all the solutions.
* \param[in] conv_numerics - Description of the numerical method.
* \param[in] visc_numerics - Description of the numerical method.
* \param[in] config - Definition of the particular problem.
*/
void BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config);

/*!
* \brief compare to values.
* \param[in] a - value 1.
Expand Down Expand Up @@ -8312,6 +8327,47 @@ class CIncEulerSolver : public CSolver {
* \brief A virtual member.
*/
void GetOutlet_Properties(CGeometry *geometry, CConfig *config, unsigned short iMesh, bool Output);

/*!
* \brief Allocates the final pointer of SlidingState depending on how many donor vertex donate to it. That number is stored in SlidingStateNodes[val_marker][val_vertex].
* \param[in] val_marker - marker index
* \param[in] val_vertex - vertex index
*/
void SetSlidingStateStructure(unsigned short val_marker, unsigned long val_vertex);

/*!
* \brief Set the outer state for fluid interface nodes.
* \param[in] val_marker - marker index
* \param[in] val_vertex - vertex index
* \param[in] val_state - requested state component
* \param[in] donor_index - index of the donor node to set
* \param[in] component - set value
*/
void SetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index, su2double component);

/*!
* \brief Set the number of outer state for fluid interface nodes.
* \param[in] val_marker - marker index
* \param[in] val_vertex - vertex index
* \param[in] value - number of outer states
*/
void SetnSlidingStates(unsigned short val_marker, unsigned long val_vertex, int value);

/*!
* \brief Get the number of outer state for fluid interface nodes.
* \param[in] val_marker - marker index
* \param[in] val_vertex - vertex index
*/
int GetnSlidingStates(unsigned short val_marker, unsigned long val_vertex);

/*!
* \brief Get the outer state for fluid interface nodes.
* \param[in] val_marker - marker index
* \param[in] val_vertex - vertex index
* \param[in] val_state - requested state component
*/
su2double GetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index);


};

Expand Down
23 changes: 23 additions & 0 deletions SU2_CFD/include/solver_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2378,18 +2378,28 @@ inline void CEulerSolver::SetSlidingState(unsigned short val_marker, unsigned lo
SlidingState[val_marker][val_vertex][val_state][donor_index] = component;
}

inline void CIncEulerSolver::SetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index, su2double component){
SlidingState[val_marker][val_vertex][val_state][donor_index] = component;
}

inline void CSolver::SetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index, su2double component){ }

inline su2double CEulerSolver::GetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index) { return SlidingState[val_marker][val_vertex][val_state][donor_index]; }

inline su2double CIncEulerSolver::GetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index) { return SlidingState[val_marker][val_vertex][val_state][donor_index]; }

inline su2double CSolver::GetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index) { return 0; }

inline int CEulerSolver::GetnSlidingStates(unsigned short val_marker, unsigned long val_vertex){ return SlidingStateNodes[val_marker][val_vertex]; }

inline int CIncEulerSolver::GetnSlidingStates(unsigned short val_marker, unsigned long val_vertex){ return SlidingStateNodes[val_marker][val_vertex]; }

inline int CSolver::GetnSlidingStates(unsigned short val_marker, unsigned long val_vertex){ return 0; }

inline void CEulerSolver::SetnSlidingStates(unsigned short val_marker, unsigned long val_vertex, int value){ SlidingStateNodes[val_marker][val_vertex] = value; }

inline void CIncEulerSolver::SetnSlidingStates(unsigned short val_marker, unsigned long val_vertex, int value){ SlidingStateNodes[val_marker][val_vertex] = value; }

inline void CSolver::SetnSlidingStates(unsigned short val_marker, unsigned long val_vertex, int value){}

inline void CSolver::SetSlidingStateStructure(unsigned short val_marker, unsigned long val_vertex){}
Expand All @@ -2407,6 +2417,19 @@ inline void CEulerSolver::SetSlidingStateStructure(unsigned short val_marker, un
}


inline void CIncEulerSolver::SetSlidingStateStructure(unsigned short val_marker, unsigned long val_vertex){
int iVar;

for( iVar = 0; iVar < nPrimVar+1; iVar++){
if( SlidingState[val_marker][val_vertex][iVar] != NULL )
delete [] SlidingState[val_marker][val_vertex][iVar];
}

for( iVar = 0; iVar < nPrimVar+1; iVar++)
SlidingState[val_marker][val_vertex][iVar] = new su2double[ GetnSlidingStates(val_marker, val_vertex) ];
}



inline void CTurbSolver::SetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index, su2double component){
SlidingState[val_marker][val_vertex][val_state][donor_index] = component;
Expand Down
85 changes: 42 additions & 43 deletions SU2_CFD/include/transfer_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CTransfer {
su2double *Physical_Constants;
su2double *Donor_Variable;
su2double *Target_Variable;
bool valAggregated;

/*--- Mixing Plane interface variable ---*/
su2double *SpanValueCoeffTarget;
Expand Down Expand Up @@ -102,32 +103,6 @@ class CTransfer {
*/
virtual ~CTransfer(void);

/*!
* \brief Interpolate data and scatter it into different processors, for matching meshes.
* \param[in] donor_solution - Solution from the donor mesh.
* \param[in] target_solution - Solution from the target mesh.
* \param[in] donor_geometry - Geometry of the donor mesh.
* \param[in] target_geometry - Geometry of the target mesh.
* \param[in] donor_config - Definition of the problem at the donor mesh.
* \param[in] target_config - Definition of the problem at the target mesh.
*/
void Scatter_InterfaceData(CSolver *donor_solution, CSolver *target_solution,
CGeometry *donor_geometry, CGeometry *target_geometry,
CConfig *donor_config, CConfig *target_config);

/*!
* \brief Interpolate data and broadcast it into all processors, for matching meshes.
* \param[in] donor_solution - Solution from the donor mesh.
* \param[in] target_solution - Solution from the target mesh.
* \param[in] donor_geometry - Geometry of the donor mesh.
* \param[in] target_geometry - Geometry of the target mesh.
* \param[in] donor_config - Definition of the problem at the donor mesh.
* \param[in] target_config - Definition of the problem at the target mesh.
*/
void Broadcast_InterfaceData_Matching(CSolver *donor_solution, CSolver *target_solution,
CGeometry *donor_geometry, CGeometry *target_geometry,
CConfig *donor_config, CConfig *target_config);

/*!
* \brief Interpolate data and broadcast it into all processors, for nonmatching meshes.
* \param[in] donor_solution - Solution from the donor mesh.
Expand All @@ -137,23 +112,9 @@ class CTransfer {
* \param[in] donor_config - Definition of the problem at the donor mesh.
* \param[in] target_config - Definition of the problem at the target mesh.
*/
void Broadcast_InterfaceData_Interpolate(CSolver *donor_solution, CSolver *target_solution,
CGeometry *donor_geometry, CGeometry *target_geometry,
CConfig *donor_config, CConfig *target_config);

/*!
* \brief Interpolate data, operate over it and broadcast it into all processors, for nonmatching meshes.
* \param[in] donor_solution - Solution from the donor mesh.
* \param[in] target_solution - Solution from the target mesh.
* \param[in] donor_geometry - Geometry of the donor mesh.
* \param[in] target_geometry - Geometry of the target mesh.
* \param[in] donor_config - Definition of the problem at the donor mesh.
* \param[in] target_config - Definition of the problem at the target mesh.
*/
void Allgather_InterfaceData(CSolver *donor_solution, CSolver *target_solution,
CGeometry *donor_geometry, CGeometry *target_geometry,
CConfig *donor_config, CConfig *target_config);

void Broadcast_InterfaceData(CSolver *donor_solution, CSolver *target_solution,
CGeometry *donor_geometry, CGeometry *target_geometry,
CConfig *donor_config, CConfig *target_config);
/*!
* \brief A virtual member.
*/
Expand All @@ -173,6 +134,25 @@ class CTransfer {
CConfig *donor_config, unsigned long Marker_Donor,
unsigned long Vertex_Donor, unsigned long Point_Donor);

/*!
* \brief Initializes the target variable.
* \param[in] target_solution - Solution from the target mesh.
* \param[in] Marker_Target - Index of the target marker.
* \param[in] Vertex_Target - Index of the target vertex.
* \param[in] nDonorPoints - Number of donor points.
*/
virtual void InitializeTarget_Variable(CSolver *target_solution, unsigned long Marker_Target,
unsigned long Vertex_Target, unsigned short nDonorPoints);

/*!
* \brief Recovers the target variable from the buffer of su2doubles that was broadcasted.
* \param[in] indexPoint_iVertex - index of the vertex in the buffer array.
* \param[in] Buffer_Bcast_Variables - full broadcasted buffer array of doubles.
* \param[in] donorCoeff - value of the donor coefficient.
*/
virtual void RecoverTarget_Variable(long indexPoint_iVertex, su2double *Buffer_Bcast_Variables,
su2double donorCoeff);

/*!
* \brief A virtual member.
* \param[in] target_solution - Solution from the target mesh.
Expand Down Expand Up @@ -724,6 +704,25 @@ class CTransfer_SlidingInterface : public CTransfer {
void GetDonor_Variable(CSolver *donor_solution, CGeometry *donor_geometry, CConfig *donor_config,
unsigned long Marker_Donor, unsigned long Vertex_Donor, unsigned long Point_Donor);

/*!
* \brief A virtual member, initializes the target variable for sliding mesh.
* \param[in] target_solution - Solution from the target mesh.
* \param[in] Marker_Target - Index of the target marker.
* \param[in] Vertex_Target - Index of the target vertex.
* \param[in] nDonorPoints - Number of donor points.
*/
void InitializeTarget_Variable(CSolver *target_solution, unsigned long Marker_Target,
unsigned long Vertex_Target, unsigned short nDonorPoints);

/*!
* \brief Recovers the target variable from the buffer of su2doubles that was broadcasted.
* \param[in] indexPoint_iVertex - index of the vertex in the buffer array.
* \param[in] Buffer_Bcast_Variables - full broadcasted buffer array of doubles.
* \param[in] donorCoeff - value of the donor coefficient.
*/
void RecoverTarget_Variable(long indexPoint_iVertex, su2double *Buffer_Bcast_Variables,
su2double donorCoeff);

/*!
* \brief Set the variable that has been received from the target mesh into the target mesh.
* \param[in] target_solution - Solution from the target mesh.
Expand Down
11 changes: 11 additions & 0 deletions SU2_CFD/include/transfer_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ inline void CTransfer::GetDonor_Variable(CSolver *donor_solution, CGeometry *don
CConfig *donor_config, unsigned long Marker_Donor,
unsigned long Vertex_Donor, unsigned long Point_Donor) { }

inline void CTransfer::InitializeTarget_Variable(CSolver *target_solution, unsigned long Marker_Target,
unsigned long Vertex_Target, unsigned short nDonorPoints){
for (unsigned short iVar = 0; iVar < nVar; iVar++) Target_Variable[iVar] = 0.0;
}

inline void CTransfer::RecoverTarget_Variable(long indexPoint_iVertex, su2double *Buffer_Bcast_Variables,
su2double donorCoeff){
for (unsigned short iVar = 0; iVar < nVar; iVar++) Target_Variable[iVar] += donorCoeff * Buffer_Bcast_Variables[indexPoint_iVertex*nVar+iVar];

}

inline void CTransfer::SetTarget_Variable(CSolver *target_solution, CGeometry *target_geometry,
CConfig *target_config, unsigned long Marker_Target,
unsigned long Vertex_Target, unsigned long Point_Target) { }
Expand Down
Loading