Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
CahnHilliardScratchData< dim > Class Template Reference

#include <cahn_hilliard_scratch_data.h>

Inheritance diagram for CahnHilliardScratchData< dim >:
[legend]

Public Member Functions

 CahnHilliardScratchData (const PhysicalPropertiesManager &properties_manager, const FESystem< dim > &fe_cahn_hilliard, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping, const FiniteElement< dim > &fe_fd, const Quadrature< dim - 1 > &face_quadrature)
 CahnHilliardScratchData (const CahnHilliardScratchData< dim > &sd)
void allocate () override
template<typename VectorType>
void reinit (const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const std::vector< VectorType > &previous_solutions, Function< dim > *source_function)
template<typename VectorType>
void reinit_velocity (const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const Parameters::ALE< dim > &ale)
void calculate_physical_properties ()
Public Member Functions inherited from PhysicsScratchDataBase
virtual ~PhysicsScratchDataBase ()=default

Public Attributes

PhysicalPropertiesManager properties_manager
std::map< field, std::vector< double > > fields
dealii::types::material_id material_id
std::vector< double > density
std::vector< double > kinematic_viscosity
std::vector< double > surface_tension
std::vector< double > mobility_cahn_hilliard
std::vector< double > mobility_cahn_hilliard_gradient
FEValuesExtractors::Scalar phase_order
FEValuesExtractors::Scalar chemical_potential
FEValues< dim > fe_values_cahn_hilliard
unsigned int n_dofs
unsigned int n_q_points
double cell_size
Table< 1, double > JxW
std::vector< Point< dim > > quadrature_points
std::vector< double > phase_order_values
std::vector< Tensor< 1, dim > > phase_order_gradients
std::vector< double > phase_order_laplacians
std::vector< std::vector< double > > previous_phase_order_values
std::vector< double > chemical_potential_values
std::vector< Tensor< 1, dim > > chemical_potential_gradients
std::vector< double > chemical_potential_laplacians
std::vector< std::vector< double > > previous_chemical_potential_values
std::vector< double > source_phase_order
std::vector< double > source_chemical_potential
Table< 2, double > phi_phase
Table< 2, Tensor< 2, dim > > hess_phi_phase
Table< 2, double > laplacian_phi_phase
Table< 2, Tensor< 1, dim > > grad_phi_phase
Table< 2, double > phi_potential
Table< 2, Tensor< 2, dim > > hess_phi_potential
Table< 2, double > laplacian_phi_potential
Table< 2, Tensor< 1, dim > > grad_phi_potential
FEValuesExtractors::Vector velocities
FEValues< dim > fe_values_fd
std::vector< Tensor< 1, dim > > velocity_values
std::vector< std::vector< Tensor< 1, dim > > > previous_velocity_values
std::vector< Tensor< 2, dim > > velocity_gradient_values
FEFaceValues< dim > fe_face_values_cahn_hilliard
Table< 2, double > face_JxW
unsigned int n_faces
unsigned int n_faces_q_points
bool is_boundary_cell
std::vector< bool > is_boundary_face
std::vector< unsigned int > boundary_face_id
Table< 3, Tensor< 1, dim > > grad_phi_face_phase
std::vector< std::vector< Tensor< 1, dim > > > face_phase_grad_values
std::vector< std::vector< Tensor< 1, dim > > > face_normal

Detailed Description

template<int dim>
class CahnHilliardScratchData< dim >

Class that stores the information required by the assembly procedure for the Cahn-Hilliard equations. Consequently, this class calculates the phase field parameter Phi (values, gradients, laplacians), the chemical potential eta (values, gradients, laplacians) and the shape function (values, gradients, laplacians) at all the Gauss points for all degrees of freedom and stores it into arrays. Additionally, the user can request that this class gathers additional fields for physics which are coupled to the Cahn-Hilliard equations, such as the velocity which is required. This class serves as a separation between the evaluation at the Gauss point of the variables of interest and their use in the assembly, which is carried out by the assembler functions. For more information on this design, the reader can consult deal.II step-9 "https://www.dealii.org/current/doxygen/deal.II/step_9.html". In this latter example, the scratch is a struct instead of a templated class because of the simplicity of step-9.

Template Parameters
dimAn integer that denotes the dimension of the space in which the flow is solved

Definition at line 39 of file cahn_hilliard_scratch_data.h.

Constructor & Destructor Documentation

◆ CahnHilliardScratchData() [1/2]

template<int dim>
CahnHilliardScratchData< dim >::CahnHilliardScratchData ( const PhysicalPropertiesManager & properties_manager,
const FESystem< dim > & fe_cahn_hilliard,
const Quadrature< dim > & quadrature,
const Mapping< dim > & mapping,
const FiniteElement< dim > & fe_fd,
const Quadrature< dim - 1 > & face_quadrature )
inline

Constructor. The constructor creates the fe_values that will be used to fill the member variables of the scratch. It also allocated the necessary memory for all member variables. However, it does not do any evaluation, since this needs to be done at the cell level.

Parameters
properties_managerThe physical properties manager (see physical_properties_manager.h)
fe_cahn_hilliardThe FESystem used to solve the Cahn-Hilliard equations
quadratureThe quadrature to use for the assembly
mappingThe mapping of the domain in which the Cahn-Hilliard equations are solved
fe_fdThe FESystem used to solve the Fluid Dynamics equations

Definition at line 55 of file cahn_hilliard_scratch_data.h.

References allocate(), fe_face_values_cahn_hilliard, fe_values_cahn_hilliard, fe_values_fd, and properties_manager.

◆ CahnHilliardScratchData() [2/2]

template<int dim>
CahnHilliardScratchData< dim >::CahnHilliardScratchData ( const CahnHilliardScratchData< dim > & sd)
inline

Copy Constructor. Same as the main constructor. This constructor only uses the other scratch to build the FeValues, it does not copy the content of the other scratch into itself since, by definition of the WorkStream mechanism it is assumed that the content of the scratch will be reset on a cell basis.

Parameters
sd

Definition at line 88 of file cahn_hilliard_scratch_data.h.

References allocate(), CahnHilliardScratchData(), fe_face_values_cahn_hilliard, fe_values_cahn_hilliard, fe_values_fd, and properties_manager.

Member Function Documentation

◆ allocate()

◆ calculate_physical_properties()

template<int dim>
void CahnHilliardScratchData< dim >::calculate_physical_properties ( )

Calculates the physical properties that may be required by the Cahn-Hilliard problem. Namely the surface tension and the Cahn-Hilliard mobility.

Definition at line 79 of file cahn_hilliard_scratch_data.cc.

References fields, fluid_fluid, mobility_cahn_hilliard, mobility_cahn_hilliard_gradient, phase_order_cahn_hilliard, phase_order_values, properties_manager, set_field_vector(), and surface_tension.

◆ reinit()

template<int dim>
template<typename VectorType>
void CahnHilliardScratchData< dim >::reinit ( const typename DoFHandler< dim >::active_cell_iterator & cell,
const VectorType & current_solution,
const std::vector< VectorType > & previous_solutions,
Function< dim > * source_function )
inline

Reinitializes the content of the scratch.

Using the FeValues and the content of the solutions and previous solutions, fills all of the class member of the scratch.

Parameters
[in]cellThe cell over which the assembly is being carried. This cell must be compatible with the fe which is used to fill the FeValues.
[in]current_solutionThe present value of the solution for [Phi,eta]
[in]previous_solutionsThe solutions at the previous time steps.
[in]source_functionThe function describing the source term in Cahn-Hilliard equations.

Definition at line 136 of file cahn_hilliard_scratch_data.h.

References boundary_face_id, cell_size, chemical_potential, chemical_potential_gradients, chemical_potential_laplacians, chemical_potential_values, compute_cell_diameter(), compute_cell_measure_with_JxW(), face_JxW, face_normal, face_phase_grad_values, fe_face_values_cahn_hilliard, fe_values_cahn_hilliard, grad_phi_face_phase, grad_phi_phase, grad_phi_potential, hess_phi_phase, hess_phi_potential, is_boundary_cell, is_boundary_face, JxW, laplacian_phi_phase, laplacian_phi_potential, n_dofs, n_faces, n_faces_q_points, n_q_points, phase_order, phase_order_gradients, phase_order_laplacians, phase_order_values, phi_phase, phi_potential, previous_chemical_potential_values, previous_phase_order_values, quadrature_points, source_chemical_potential, and source_phase_order.

◆ reinit_velocity()

template<int dim>
template<typename VectorType>
void CahnHilliardScratchData< dim >::reinit_velocity ( const typename DoFHandler< dim >::active_cell_iterator & cell,
const VectorType & current_solution,
const Parameters::ALE< dim > & ale )
inline

Member Data Documentation

◆ boundary_face_id

template<int dim>
std::vector<unsigned int> CahnHilliardScratchData< dim >::boundary_face_id

Definition at line 379 of file cahn_hilliard_scratch_data.h.

◆ cell_size

template<int dim>
double CahnHilliardScratchData< dim >::cell_size

Definition at line 329 of file cahn_hilliard_scratch_data.h.

◆ chemical_potential

template<int dim>
FEValuesExtractors::Scalar CahnHilliardScratchData< dim >::chemical_potential

Definition at line 323 of file cahn_hilliard_scratch_data.h.

◆ chemical_potential_gradients

template<int dim>
std::vector<Tensor<1, dim> > CahnHilliardScratchData< dim >::chemical_potential_gradients

Definition at line 341 of file cahn_hilliard_scratch_data.h.

◆ chemical_potential_laplacians

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::chemical_potential_laplacians

Definition at line 342 of file cahn_hilliard_scratch_data.h.

◆ chemical_potential_values

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::chemical_potential_values

Definition at line 340 of file cahn_hilliard_scratch_data.h.

◆ density

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::density

Definition at line 315 of file cahn_hilliard_scratch_data.h.

◆ face_JxW

template<int dim>
Table<2, double> CahnHilliardScratchData< dim >::face_JxW

Definition at line 371 of file cahn_hilliard_scratch_data.h.

◆ face_normal

template<int dim>
std::vector<std::vector<Tensor<1, dim> > > CahnHilliardScratchData< dim >::face_normal

Definition at line 386 of file cahn_hilliard_scratch_data.h.

◆ face_phase_grad_values

template<int dim>
std::vector<std::vector<Tensor<1, dim> > > CahnHilliardScratchData< dim >::face_phase_grad_values

Definition at line 384 of file cahn_hilliard_scratch_data.h.

◆ fe_face_values_cahn_hilliard

template<int dim>
FEFaceValues<dim> CahnHilliardScratchData< dim >::fe_face_values_cahn_hilliard

Definition at line 370 of file cahn_hilliard_scratch_data.h.

◆ fe_values_cahn_hilliard

template<int dim>
FEValues<dim> CahnHilliardScratchData< dim >::fe_values_cahn_hilliard

Definition at line 326 of file cahn_hilliard_scratch_data.h.

◆ fe_values_fd

template<int dim>
FEValues<dim> CahnHilliardScratchData< dim >::fe_values_fd

Definition at line 364 of file cahn_hilliard_scratch_data.h.

◆ fields

template<int dim>
std::map<field, std::vector<double> > CahnHilliardScratchData< dim >::fields

Definition at line 313 of file cahn_hilliard_scratch_data.h.

◆ grad_phi_face_phase

template<int dim>
Table<3, Tensor<1, dim> > CahnHilliardScratchData< dim >::grad_phi_face_phase

Definition at line 382 of file cahn_hilliard_scratch_data.h.

◆ grad_phi_phase

template<int dim>
Table<2, Tensor<1, dim> > CahnHilliardScratchData< dim >::grad_phi_phase

Definition at line 353 of file cahn_hilliard_scratch_data.h.

◆ grad_phi_potential

template<int dim>
Table<2, Tensor<1, dim> > CahnHilliardScratchData< dim >::grad_phi_potential

Definition at line 357 of file cahn_hilliard_scratch_data.h.

◆ hess_phi_phase

template<int dim>
Table<2, Tensor<2, dim> > CahnHilliardScratchData< dim >::hess_phi_phase

Definition at line 351 of file cahn_hilliard_scratch_data.h.

◆ hess_phi_potential

template<int dim>
Table<2, Tensor<2, dim> > CahnHilliardScratchData< dim >::hess_phi_potential

Definition at line 355 of file cahn_hilliard_scratch_data.h.

◆ is_boundary_cell

template<int dim>
bool CahnHilliardScratchData< dim >::is_boundary_cell

Definition at line 377 of file cahn_hilliard_scratch_data.h.

◆ is_boundary_face

template<int dim>
std::vector<bool> CahnHilliardScratchData< dim >::is_boundary_face

Definition at line 378 of file cahn_hilliard_scratch_data.h.

◆ JxW

template<int dim>
Table<1, double> CahnHilliardScratchData< dim >::JxW

Definition at line 332 of file cahn_hilliard_scratch_data.h.

◆ kinematic_viscosity

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::kinematic_viscosity

Definition at line 316 of file cahn_hilliard_scratch_data.h.

◆ laplacian_phi_phase

template<int dim>
Table<2, double> CahnHilliardScratchData< dim >::laplacian_phi_phase

Definition at line 352 of file cahn_hilliard_scratch_data.h.

◆ laplacian_phi_potential

template<int dim>
Table<2, double> CahnHilliardScratchData< dim >::laplacian_phi_potential

Definition at line 356 of file cahn_hilliard_scratch_data.h.

◆ material_id

template<int dim>
dealii::types::material_id CahnHilliardScratchData< dim >::material_id

Definition at line 314 of file cahn_hilliard_scratch_data.h.

◆ mobility_cahn_hilliard

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::mobility_cahn_hilliard

Definition at line 318 of file cahn_hilliard_scratch_data.h.

◆ mobility_cahn_hilliard_gradient

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::mobility_cahn_hilliard_gradient

Definition at line 319 of file cahn_hilliard_scratch_data.h.

◆ n_dofs

template<int dim>
unsigned int CahnHilliardScratchData< dim >::n_dofs

Definition at line 327 of file cahn_hilliard_scratch_data.h.

◆ n_faces

template<int dim>
unsigned int CahnHilliardScratchData< dim >::n_faces

Definition at line 373 of file cahn_hilliard_scratch_data.h.

◆ n_faces_q_points

template<int dim>
unsigned int CahnHilliardScratchData< dim >::n_faces_q_points

Definition at line 374 of file cahn_hilliard_scratch_data.h.

◆ n_q_points

template<int dim>
unsigned int CahnHilliardScratchData< dim >::n_q_points

Definition at line 328 of file cahn_hilliard_scratch_data.h.

◆ phase_order

template<int dim>
FEValuesExtractors::Scalar CahnHilliardScratchData< dim >::phase_order

Definition at line 322 of file cahn_hilliard_scratch_data.h.

◆ phase_order_gradients

template<int dim>
std::vector<Tensor<1, dim> > CahnHilliardScratchData< dim >::phase_order_gradients

Definition at line 337 of file cahn_hilliard_scratch_data.h.

◆ phase_order_laplacians

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::phase_order_laplacians

Definition at line 338 of file cahn_hilliard_scratch_data.h.

◆ phase_order_values

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::phase_order_values

Definition at line 336 of file cahn_hilliard_scratch_data.h.

◆ phi_phase

template<int dim>
Table<2, double> CahnHilliardScratchData< dim >::phi_phase

Definition at line 350 of file cahn_hilliard_scratch_data.h.

◆ phi_potential

template<int dim>
Table<2, double> CahnHilliardScratchData< dim >::phi_potential

Definition at line 354 of file cahn_hilliard_scratch_data.h.

◆ previous_chemical_potential_values

template<int dim>
std::vector<std::vector<double> > CahnHilliardScratchData< dim >::previous_chemical_potential_values

Definition at line 343 of file cahn_hilliard_scratch_data.h.

◆ previous_phase_order_values

template<int dim>
std::vector<std::vector<double> > CahnHilliardScratchData< dim >::previous_phase_order_values

Definition at line 339 of file cahn_hilliard_scratch_data.h.

◆ previous_velocity_values

template<int dim>
std::vector<std::vector<Tensor<1, dim> > > CahnHilliardScratchData< dim >::previous_velocity_values

Definition at line 366 of file cahn_hilliard_scratch_data.h.

◆ properties_manager

template<int dim>
PhysicalPropertiesManager CahnHilliardScratchData< dim >::properties_manager

Definition at line 312 of file cahn_hilliard_scratch_data.h.

◆ quadrature_points

template<int dim>
std::vector<Point<dim> > CahnHilliardScratchData< dim >::quadrature_points

Definition at line 333 of file cahn_hilliard_scratch_data.h.

◆ source_chemical_potential

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::source_chemical_potential

Definition at line 347 of file cahn_hilliard_scratch_data.h.

◆ source_phase_order

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::source_phase_order

Definition at line 346 of file cahn_hilliard_scratch_data.h.

◆ surface_tension

template<int dim>
std::vector<double> CahnHilliardScratchData< dim >::surface_tension

Definition at line 317 of file cahn_hilliard_scratch_data.h.

◆ velocities

template<int dim>
FEValuesExtractors::Vector CahnHilliardScratchData< dim >::velocities

Scratch component for the Navier-Stokes component

Definition at line 362 of file cahn_hilliard_scratch_data.h.

◆ velocity_gradient_values

template<int dim>
std::vector<Tensor<2, dim> > CahnHilliardScratchData< dim >::velocity_gradient_values

Definition at line 367 of file cahn_hilliard_scratch_data.h.

◆ velocity_values

template<int dim>
std::vector<Tensor<1, dim> > CahnHilliardScratchData< dim >::velocity_values

Definition at line 365 of file cahn_hilliard_scratch_data.h.


The documentation for this class was generated from the following files: