-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic HighOrderGrid class and test.
- Loading branch information
1 parent
38ce54d
commit 4dd6d62
Showing
20 changed files
with
812 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
set(DG_SOURCE | ||
high_order_grid.cpp | ||
dg.cpp | ||
weak_dg.cpp | ||
strong_dg.cpp | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <deal.II/fe/fe_q.h> | ||
|
||
#include <deal.II/dofs/dof_tools.h> | ||
|
||
#include <deal.II/numerics/vector_tools.h> | ||
|
||
#include "high_order_grid.h" | ||
namespace PHiLiP { | ||
|
||
template <int dim, typename real, typename VectorType , typename DoFHandlerType> | ||
HighOrderGrid<dim,real,VectorType,DoFHandlerType>::HighOrderGrid( | ||
const Parameters::AllParameters *const parameters_input, | ||
const unsigned int max_degree, | ||
dealii::Triangulation<dim> *const triangulation_input) | ||
: all_parameters(parameters_input) | ||
, max_degree(max_degree) | ||
, triangulation(triangulation_input) | ||
, fe_q(max_degree) // The grid must be at least p1. A p0 solution required a p1 grid. | ||
, fe_system(dealii::FESystem<dim>(fe_q,dim)) // The grid must be at least p1. A p0 solution required a p1 grid. | ||
, mpi_communicator(MPI_COMM_WORLD) | ||
, pcout(std::cout, dealii::Utilities::MPI::this_mpi_process(mpi_communicator)==0) | ||
{ | ||
dof_handler_grid.initialize(*triangulation, fe_system); | ||
dof_handler_grid.distribute_dofs(fe_system); | ||
|
||
locally_owned_dofs_grid = dof_handler_grid.locally_owned_dofs(); | ||
dealii::DoFTools::extract_locally_relevant_dofs(dof_handler_grid, ghost_dofs_grid); | ||
locally_relevant_dofs_grid = ghost_dofs_grid; | ||
ghost_dofs_grid.subtract_set(locally_owned_dofs_grid); | ||
nodes.reinit(locally_owned_dofs_grid, ghost_dofs_grid, mpi_communicator); | ||
|
||
} | ||
|
||
template <int dim, typename real, typename VectorType , typename DoFHandlerType> | ||
dealii::MappingFEField<dim,dim,VectorType,DoFHandlerType> | ||
HighOrderGrid<dim,real,VectorType,DoFHandlerType>::get_MappingFEField() { | ||
const dealii::ComponentMask mask(dim, true); | ||
dealii::VectorTools::get_position_vector(dof_handler_grid, nodes, mask); | ||
|
||
dealii::MappingFEField<dim,dim,VectorType,DoFHandlerType> mapping(dof_handler_grid,nodes,mask); | ||
|
||
return mapping; | ||
} | ||
|
||
//template class HighOrderGrid<PHILIP_DIM, double>; | ||
template class HighOrderGrid<PHILIP_DIM, double, dealii::LinearAlgebra::distributed::Vector<double>, dealii::DoFHandler<PHILIP_DIM>>; | ||
} // namespace PHiLiP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#ifndef __HIGHORDERGRID_H__ | ||
#define __HIGHORDERGRID_H__ | ||
|
||
#include <deal.II/grid/tria.h> | ||
|
||
#include <deal.II/fe/fe_system.h> | ||
#include <deal.II/fe/mapping_fe_field.h> | ||
|
||
#include <deal.II/dofs/dof_handler.h> | ||
|
||
#include <deal.II/lac/vector.h> | ||
|
||
#include "parameters/all_parameters.h" | ||
|
||
namespace PHiLiP { | ||
|
||
/** This class is used to generate and control the high-order nodes given a Triangulation and a Manifold. | ||
* This will especially be useful when performing shape optimization, where the surface and volume | ||
* nodes will need to be displaced. | ||
*/ | ||
//template <int dim, typename real, typename VectorType , typename DoFHandlerType> | ||
template <int dim = PHILIP_DIM, typename real = double, typename VectorType = dealii::LinearAlgebra::distributed::Vector<double>, typename DoFHandlerType = dealii::DoFHandler<PHILIP_DIM>> | ||
class HighOrderGrid | ||
{ | ||
public: | ||
/// Principal constructor that will call delegated constructor. | ||
HighOrderGrid(const Parameters::AllParameters *const parameters_input, const unsigned int max_degree, dealii::Triangulation<dim> *const triangulation_input); | ||
|
||
dealii::MappingFEField<dim,dim,VectorType,DoFHandlerType> get_MappingFEField(); | ||
|
||
const Parameters::AllParameters *const all_parameters; ///< Pointer to all parameters | ||
|
||
/// Maximum degree of the grid. | ||
const unsigned int max_degree; | ||
|
||
dealii::Triangulation<dim> *triangulation; ///< Mesh | ||
|
||
/// Get evaluate high-order grid from Triangulation and Manifold | ||
|
||
|
||
/// Degrees of freedom handler for the high-order grid | ||
dealii::DoFHandler<dim> dof_handler_grid; | ||
|
||
/// Current nodal coefficients of the high-order grid. | ||
dealii::LinearAlgebra::distributed::Vector<double> nodes; | ||
|
||
/// List of surface points | ||
dealii::LinearAlgebra::distributed::Vector<double> surface_nodes; | ||
|
||
|
||
/// RBF mesh deformation | ||
void deform_mesh(dealii::LinearAlgebra::distributed::Vector<double> surface_displacements); | ||
|
||
|
||
/// Using system of FE_Q to represent the grid | ||
const dealii::FE_Q<dim> fe_q; | ||
const dealii::FESystem<dim> fe_system; | ||
|
||
dealii::IndexSet locally_owned_dofs_grid; ///< Locally own degrees of freedom for the grid | ||
dealii::IndexSet ghost_dofs_grid; ///< Locally relevant ghost degrees of freedom for the grid | ||
dealii::IndexSet locally_relevant_dofs_grid; ///< Union of locally owned degrees of freedom and relevant ghost degrees of freedom for the grid | ||
protected: | ||
|
||
MPI_Comm mpi_communicator; ///< MPI communicator | ||
dealii::ConditionalOStream pcout; ///< Parallel std::cout that only outputs on mpi_rank==0 | ||
|
||
}; | ||
|
||
} // namespace PHiLiP | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
set(TEST_SRC | ||
high_order_grid_test.cpp | ||
) | ||
|
||
foreach(dim RANGE 2 3) | ||
|
||
# Output executable | ||
string(CONCAT TEST_TARGET ${dim}D_HighOrder_MappingFEField) | ||
message("Adding executable " ${TEST_TARGET} " with files " ${TEST_SRC} "\n") | ||
add_executable(${TEST_TARGET} ${TEST_SRC}) | ||
# Replace occurences of PHILIP_DIM with 1, 2, or 3 in the code | ||
target_compile_definitions(${TEST_TARGET} PRIVATE PHILIP_DIM=${dim}) | ||
|
||
# Compile this executable when 'make unit_tests' | ||
add_dependencies(unit_tests ${TEST_TARGET}) | ||
add_dependencies(${dim}D ${TEST_TARGET}) | ||
|
||
# Library dependency | ||
set(ParametersLib ParametersLibrary) | ||
string(CONCAT DiscontinuousGalerkinLib DiscontinuousGalerkin_${dim}D) | ||
target_link_libraries(${TEST_TARGET} ${ParametersLib}) | ||
target_link_libraries(${TEST_TARGET} ${DiscontinuousGalerkinLib}) | ||
# Setup target with deal.II | ||
DEAL_II_SETUP_TARGET(${TEST_TARGET}) | ||
|
||
add_test( | ||
NAME ${TEST_TARGET} | ||
COMMAND mpirun -n 1 ${EXECUTABLE_OUTPUT_PATH}/${TEST_TARGET} | ||
WORKING_DIRECTORY ${TEST_OUTPUT_DIR} | ||
) | ||
|
||
unset(TEST_TARGET) | ||
unset(DiscontinuousGalerkinLib) | ||
unset(ParametersLib) | ||
|
||
endforeach() |
Oops, something went wrong.