1 #ifndef __FUNCTIONAL_H__ 2 #define __FUNCTIONAL_H__ 5 #include <deal.II/differentiation/ad/sacado_math.h> 6 #include <deal.II/differentiation/ad/sacado_number_types.h> 7 #include <deal.II/differentiation/ad/sacado_product_types.h> 8 #include <deal.II/fe/fe_q.h> 9 #include <deal.II/fe/fe_values.h> 10 #include <deal.II/lac/la_parallel_vector.h> 16 #include "dg/dg_base.hpp" 17 #include "physics/physics.h" 39 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
41 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
50 std::shared_ptr<DGBase<dim,real,MeshType>>
dg;
67 const bool _uses_solution_values =
true,
68 const bool _uses_solution_gradient =
true);
75 const bool _uses_solution_values =
true,
76 const bool _uses_solution_gradient =
true);
80 void set_state(
const dealii::LinearAlgebra::distributed::Vector<real> &solution_set);
82 void set_geom(
const dealii::LinearAlgebra::distributed::Vector<real> &volume_nodes_set);
99 const bool compute_dIdW =
false,
100 const bool compute_dIdX =
false,
101 const bool compute_d2I =
false);
107 const double stepsize);
113 const double stepsize);
119 dealii::LinearAlgebra::distributed::Vector<real>
dIdw;
121 dealii::LinearAlgebra::distributed::Vector<real>
dIdX;
124 std::shared_ptr<dealii::TrilinosWrappers::SparseMatrix>
d2IdWdW;
126 std::shared_ptr<dealii::TrilinosWrappers::SparseMatrix>
d2IdWdX;
128 std::shared_ptr<dealii::TrilinosWrappers::SparseMatrix>
d2IdXdX;
165 void allocate_derivatives(
const bool compute_dIdW,
const bool compute_dIdX,
const bool compute_d2I);
169 void allocate_dIdX(dealii::LinearAlgebra::distributed::Vector<real> &dIdX)
const;
174 const bool compute_dIdW,
const bool compute_dIdX,
const bool compute_d2I,
175 const Sacado::Fad::DFad<Sacado::Fad::DFad<real>> volume_local_sum,
176 std::vector<dealii::types::global_dof_index> cell_soln_dofs_indices,
177 std::vector<dealii::types::global_dof_index> cell_metric_dofs_indices);
184 void need_compute(
bool &compute_value,
bool &compute_dIdW,
bool &compute_dIdX,
bool &compute_d2I);
187 template <
typename real2>
190 const std::vector< real2 > &soln_coeff,
191 const dealii::FESystem<dim> &fe_solution,
192 const std::vector< real2 > &coords_coeff,
193 const dealii::FESystem<dim> &fe_metric,
194 const dealii::Quadrature<dim> &volume_quadrature)
const;
199 const std::vector< real > &soln_coeff,
200 const dealii::FESystem<dim> &fe_solution,
201 const std::vector< real > &coords_coeff,
202 const dealii::FESystem<dim> &fe_metric,
203 const dealii::Quadrature<dim> &volume_quadrature)
const;
207 const Physics::PhysicsBase<dim,nstate,Sacado::Fad::DFad<Sacado::Fad::DFad<real>>> &physics_fad_fad,
208 const std::vector< Sacado::Fad::DFad<Sacado::Fad::DFad<real>> > &soln_coeff,
209 const dealii::FESystem<dim> &fe_solution,
210 const std::vector< Sacado::Fad::DFad<Sacado::Fad::DFad<real>> > &coords_coeff,
211 const dealii::FESystem<dim> &fe_metric,
212 const dealii::Quadrature<dim> &volume_quadrature)
const;
233 template <
typename real2>
236 const unsigned int boundary_id,
237 const std::vector< real2 > &soln_coeff,
238 const dealii::FESystem<dim> &fe_solution,
239 const std::vector< real2 > &coords_coeff,
240 const dealii::FESystem<dim> &fe_metric,
241 const unsigned int face_number,
242 const dealii::Quadrature<dim-1> &face_quadrature)
const;
247 const unsigned int boundary_id,
248 const std::vector< real > &soln_coeff,
249 const dealii::FESystem<dim> &fe_solution,
250 const std::vector< real > &coords_coeff,
251 const dealii::FESystem<dim> &fe_metric,
252 const unsigned int face_number,
253 const dealii::Quadrature<dim-1> &face_quadrature)
const;
257 const Physics::PhysicsBase<dim,nstate,Sacado::Fad::DFad<Sacado::Fad::DFad<real>>> &physics_fad_fad,
258 const unsigned int boundary_id,
259 const std::vector< Sacado::Fad::DFad<Sacado::Fad::DFad<real>> > &soln_coeff,
260 const dealii::FESystem<dim> &fe_solution,
261 const std::vector< Sacado::Fad::DFad<Sacado::Fad::DFad<real>> > &coords_coeff,
262 const dealii::FESystem<dim> &fe_metric,
263 const unsigned int face_number,
264 const dealii::Quadrature<dim-1> &face_quadrature)
const;
270 const dealii::Point<dim,real> &,
271 const std::array<real,nstate> &,
272 const std::array<dealii::Tensor<1,dim,real>,nstate> &)
const 273 {
return (real) 0.0; }
279 const dealii::Point<dim,FadFadType> &,
const std::array<FadFadType,nstate> &,
280 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &)
const 281 {
return (real) 0.0; }
288 const dealii::Point<dim,real> &,
289 const dealii::Tensor<1,dim,real> &,
290 const std::array<real,nstate> &,
291 const std::array<dealii::Tensor<1,dim,real>,nstate> &)
const 292 {
return (real) 0.0; }
299 const dealii::Point<dim,FadFadType> &,
300 const dealii::Tensor<1,dim,FadFadType> &,
301 const std::array<FadFadType,nstate> &,
302 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &)
const 308 const dealii::UpdateFlags
volume_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values;
310 const dealii::UpdateFlags
face_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values | dealii::update_normal_vectors;
329 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
331 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
339 const double _normLp,
341 const bool _uses_solution_values =
true,
342 const bool _uses_solution_gradient =
false);
344 template <
typename real2>
347 const dealii::Point<dim,real2> & phys_coord,
348 const std::array<real2,nstate> & soln_at_q,
349 const std::array<dealii::Tensor<1,dim,real2>,nstate> &soln_grad_at_q)
const;
353 const dealii::Point<dim,real> & phys_coord,
354 const std::array<real,nstate> & soln_at_q,
355 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 357 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q);
362 const dealii::Point<dim,FadFadType> & phys_coord,
363 const std::array<FadFadType,nstate> & soln_at_q,
364 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 366 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q);
385 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
387 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
395 const double _normLp,
396 std::vector<unsigned int> _boundary_vector,
397 const bool _use_all_boundaries,
399 const bool _uses_solution_values =
true,
400 const bool _uses_solution_gradient =
false);
402 template <
typename real2>
405 const unsigned int boundary_id,
406 const dealii::Point<dim,real2> & phys_coord,
407 const dealii::Tensor<1,dim,real2> & normal,
408 const std::array<real2,nstate> & soln_at_q,
409 const std::array<dealii::Tensor<1,dim,real2>,nstate> &soln_grad_at_q)
const;
413 const unsigned int boundary_id,
414 const dealii::Point<dim,real> & phys_coord,
415 const dealii::Tensor<1,dim,real> & normal,
416 const std::array<real,nstate> & soln_at_q,
417 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 419 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q);
424 const unsigned int boundary_id,
425 const dealii::Point<dim,FadFadType> & phys_coord,
426 const dealii::Tensor<1,dim,FadFadType> & normal,
427 const std::array<FadFadType,nstate> & soln_at_q,
428 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 430 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q);
452 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
454 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
464 const bool _use_weight_function_laplacian,
466 const bool _uses_solution_values =
true,
467 const bool _uses_solution_gradient =
false);
469 template <
typename real2>
472 const dealii::Point<dim,real2> & phys_coord,
473 const std::array<real2,nstate> & soln_at_q,
474 const std::array<dealii::Tensor<1,dim,real2>,nstate> & soln_grad_at_q,
479 const dealii::Point<dim,real> & phys_coord,
480 const std::array<real,nstate> & soln_at_q,
481 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 483 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q, this->weight_function_double);
488 const dealii::Point<dim,FadFadType> & phys_coord,
489 const std::array<FadFadType,nstate> & soln_at_q,
490 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 492 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q, this->weight_function_adtype);
517 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
519 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
529 const bool _use_weight_function_laplacian,
530 std::vector<unsigned int> _boundary_vector,
531 const bool _use_all_boundaries,
533 const bool _uses_solution_values =
true,
534 const bool _uses_solution_gradient =
false);
536 template <
typename real2>
539 const unsigned int boundary_id,
540 const dealii::Point<dim,real2> & phys_coord,
541 const dealii::Tensor<1,dim,real2> & normal,
542 const std::array<real2,nstate> & soln_at_q,
543 const std::array<dealii::Tensor<1,dim,real2>,nstate> & soln_grad_at_q,
548 const unsigned int boundary_id,
549 const dealii::Point<dim,real> & phys_coord,
550 const dealii::Tensor<1,dim,real> & normal,
551 const std::array<real,nstate> & soln_at_q,
552 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 554 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q, this->weight_function_double);
559 const unsigned int boundary_id,
560 const dealii::Point<dim,FadFadType> & phys_coord,
561 const dealii::Tensor<1,dim,FadFadType> & normal,
562 const std::array<FadFadType,nstate> & soln_at_q,
563 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 565 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q, this->weight_function_adtype);
590 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
592 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
600 const double _normLp,
602 const bool _uses_solution_values =
true,
603 const bool _uses_solution_gradient =
false);
605 template <
typename real2>
608 const dealii::Point<dim,real2> & phys_coord,
609 const std::array<real2,nstate> & soln_at_q,
610 const std::array<dealii::Tensor<1,dim,real2>,nstate> &soln_grad_at_q)
const;
614 const dealii::Point<dim,real> & phys_coord,
615 const std::array<real,nstate> & soln_at_q,
616 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 618 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q);
623 const dealii::Point<dim,FadFadType> & phys_coord,
624 const std::array<FadFadType,nstate> & soln_at_q,
625 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 627 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q);
647 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
649 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
657 const double _normLp,
658 std::vector<unsigned int> _boundary_vector,
659 const bool _use_all_boundaries,
661 const bool _uses_solution_values =
true,
662 const bool _uses_solution_gradient =
false);
664 template <
typename real2>
667 const unsigned int boundary_id,
668 const dealii::Point<dim,real2> & phys_coord,
669 const dealii::Tensor<1,dim,real2> & normal,
670 const std::array<real2,nstate> & soln_at_q,
671 const std::array<dealii::Tensor<1,dim,real2>,nstate> &soln_grad_at_q)
const;
675 const unsigned int boundary_id,
676 const dealii::Point<dim,real> & phys_coord,
677 const dealii::Tensor<1,dim,real> & normal,
678 const std::array<real,nstate> & soln_at_q,
679 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 681 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q);
686 const unsigned int boundary_id,
687 const dealii::Point<dim,FadFadType> & phys_coord,
688 const dealii::Tensor<1,dim,FadFadType> & normal,
689 const std::array<FadFadType,nstate> & soln_at_q,
690 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 692 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q);
706 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
708 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
726 template <
typename real2>
729 const dealii::Point<dim,real2> &phys_coord,
730 const std::array<real2,nstate> &soln_at_q,
731 const std::array<dealii::Tensor<1,dim,real2>,nstate> &soln_grad_at_q)
const;
736 const dealii::Point<dim,real> &phys_coord,
737 const std::array<real,nstate> &soln_at_q,
738 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 740 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q);
746 const dealii::Point<dim,FadFadType> &phys_coord,
747 const std::array<FadFadType,nstate> &soln_at_q,
748 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 750 return evaluate_volume_integrand<>(physics, phys_coord, soln_at_q, soln_grad_at_q);
757 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
769 template <
typename real2>
772 const unsigned int boundary_id,
773 const dealii::Point<dim,real2> & phys_coord,
774 const dealii::Tensor<1,dim,real2> & normal,
775 const std::array<real2,nstate> & soln_at_q,
776 const std::array<dealii::Tensor<1,dim,real2>,nstate> &soln_grad_at_q)
const;
781 const unsigned int boundary_id,
782 const dealii::Point<dim,real> & phys_coord,
783 const dealii::Tensor<1,dim,real> & normal,
784 const std::array<real,nstate> & soln_at_q,
785 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_at_q)
const override 787 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q);
793 const unsigned int boundary_id,
794 const dealii::Point<dim,FadFadType> & phys_coord,
795 const dealii::Tensor<1,dim,FadFadType> & normal,
796 const std::array<FadFadType,nstate> & soln_at_q,
797 const std::array<dealii::Tensor<1,dim,FadFadType>,nstate> &soln_grad_at_q)
const override 799 return evaluate_boundary_integrand<>(physics, boundary_id, phys_coord, normal, soln_at_q, soln_grad_at_q);
809 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::Triangulation<dim>>
811 template <
int dim,
int nstate,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
817 static std::shared_ptr< Functional<dim,nstate,real,MeshType> >
823 static std::shared_ptr< Functional<dim,nstate,real,MeshType> >
831 #endif // __FUNCTIONAL_H__ std::shared_ptr< dealii::TrilinosWrappers::SparseMatrix > d2IdXdX
Sparse matrix for storing the functional partial second derivatives.
const bool use_weight_function_laplacian
Flag to enable using the weight function laplacian.
Weighted volume norm functional class.
FadFadType evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const unsigned int boundary_id, const dealii::Point< dim, FadFadType > &phys_coord, const dealii::Tensor< 1, dim, FadFadType > &normal, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Virtual function for Sacado computation of cell boundary functional term and derivatives.
const bool uses_solution_gradient
Will evaluate solution gradient at quadrature points.
const double normLp
Norm exponent value.
Lp volume norm functional class.
dealii::LinearAlgebra::distributed::Vector< real > dIdX
Vector for storing the derivatives with respect to each grid DoF.
Sacado::Fad::DFad< double > FadType
Sacado AD type for first derivatives.
const double normLp
Norm exponent value.
std::vector< unsigned int > boundary_vector
Ids of selected boundaries for integration.
const bool uses_solution_values
Will evaluate solution values at quadrature points.
dealii::LinearAlgebra::distributed::Vector< double > solution_dIdX
void set_state(const dealii::LinearAlgebra::distributed::Vector< real > &solution_set)
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_value
dealii::LinearAlgebra::distributed::Vector< real > dIdw
Vector for storing the derivatives with respect to each solution DoF.
Base class from which Advection, Diffusion, ConvectionDiffusion, and Euler is derived.
dealii::LinearAlgebra::distributed::Vector< double > solution_dIdW
Manufactured solution used for grid studies to check convergence orders.
real evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const dealii::Point< dim, real > &phys_coord, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Virtual function for computation of cell volume functional term.
std::vector< unsigned int > boundary_vector
Ids of selected boundaries for integration.
real evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const unsigned int boundary_id, const dealii::Point< dim, real > &phys_coord, const dealii::Tensor< 1, dim, real > &normal, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Virtual function for computation of cell boundary functional term.
std::shared_ptr< dealii::TrilinosWrappers::SparseMatrix > d2IdWdW
Sparse matrix for storing the functional partial second derivatives.
virtual real evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &, const unsigned int, const dealii::Point< dim, real > &, const dealii::Tensor< 1, dim, real > &, const std::array< real, nstate > &, const std::array< dealii::Tensor< 1, dim, real >, nstate > &) const
Virtual function for computation of cell boundary functional term.
std::shared_ptr< ManufacturedSolutionFunction< dim, real > > weight_function_double
Manufactured solution weighting function of double return type.
real evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const unsigned int boundary_id, const dealii::Point< dim, real > &phys_coord, const dealii::Tensor< 1, dim, real > &normal, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Virtual function for computation of cell boundary functional term.
const dealii::UpdateFlags face_update_flags
Update flags needed at face points.
Sacado::Fad::DFad< FadType > FadFadType
Sacado AD type that allows 2nd derivatives.
Files for the baseline physics.
std::shared_ptr< ManufacturedSolutionFunction< dim, FadFadType > > weight_function_adtype
Manufactured solution weighting function of adtype return type.
SolutionIntegral(std::shared_ptr< PHiLiP::DGBase< dim, real, MeshType >> dg_input, std::shared_ptr< PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType >> _physics_fad_fad, const bool uses_solution_values=true, const bool uses_solution_gradient=false)
Constructor.
Functional to take the integral of the solution.
FadFadType evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const dealii::Point< dim, FadFadType > &phys_coord, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Virtual function for Sacado computation of cell volume functional term and derivatives.
Main parameter class that contains the various other sub-parameter classes.
virtual real evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &, const dealii::Point< dim, real > &, const std::array< real, nstate > &, const std::array< dealii::Tensor< 1, dim, real >, nstate > &) const
Virtual function for computation of cell volume functional term.
Lp boundary norm functional class.
Sacado::Fad::DFad< FadType > FadFadType
Sacado AD type that allows 2nd derivatives.
void allocate_dIdX(dealii::LinearAlgebra::distributed::Vector< real > &dIdX) const
Allocate and setup the derivative dIdX vector.
std::vector< unsigned int > boundary_vector
Ids of selected boundaries for integration.
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dIdW
FadFadType evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const unsigned int boundary_id, const dealii::Point< dim, FadFadType > &phys_coord, const dealii::Tensor< 1, dim, FadFadType > &normal, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Non-template functions to override the template classes.
Factory class to construct default functional types.
FadFadType evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const dealii::Point< dim, FadFadType > &phys_coord, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Non-template functions to override the template classes.
real2 evaluate_boundary_cell_functional(const Physics::PhysicsBase< dim, nstate, real2 > &physics, const unsigned int boundary_id, const std::vector< real2 > &soln_coeff, const dealii::FESystem< dim > &fe_solution, const std::vector< real2 > &coords_coeff, const dealii::FESystem< dim > &fe_metric, const unsigned int face_number, const dealii::Quadrature< dim-1 > &face_quadrature) const
Templated function to evaluate a cell's boundary functional.
dealii::LinearAlgebra::distributed::Vector< real > evaluate_dIdw_finiteDifferences(DGBase< dim, real, MeshType > &dg, const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const double stepsize)
FadFadType evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const unsigned int boundary_id, const dealii::Point< dim, FadFadType > &phys_coord, const dealii::Tensor< 1, dim, FadFadType > &normal, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Virtual function for Sacado computation of cell boundary functional term and derivatives.
FadFadType evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const dealii::Point< dim, FadFadType > &phys_coord, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Virtual function for Sacado computation of cell volume functional term and derivatives.
dealii::LinearAlgebra::distributed::Vector< real > evaluate_dIdX_finiteDifferences(DGBase< dim, real, MeshType > &dg, const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const double stepsize)
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dIdX
Parameterse related to the functional object.
Lp volume error norm functional class.
const bool use_weight_function_laplacian
Flag to enable using the weight function laplacian.
const bool use_all_boundaries
Flag to use all domain boundaries.
FadFadType evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const unsigned int boundary_id, const dealii::Point< dim, FadFadType > &phys_coord, const dealii::Tensor< 1, dim, FadFadType > &normal, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Virtual function for Sacado computation of cell boundary functional term and derivatives.
virtual FadFadType evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &, const dealii::Point< dim, FadFadType > &, const std::array< FadFadType, nstate > &, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &) const
Virtual function for Sacado computation of cell volume functional term and derivatives.
real current_functional_value
Store the functional value from the last time evaluate_functional() was called.
void need_compute(bool &compute_value, bool &compute_dIdW, bool &compute_dIdX, bool &compute_d2I)
Checks which derivatives actually need to be recomputed.
Functional(std::shared_ptr< PHiLiP::DGBase< dim, real, MeshType >> _dg, const bool _uses_solution_values=true, const bool _uses_solution_gradient=true)
const bool use_all_boundaries
Flag to use all domain boundaries.
Weighted boundary norm functional class.
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_d2I
std::shared_ptr< Physics::PhysicsBase< dim, nstate, FadFadType > > physics_fad_fad
Physics that should correspond to the one in DGBase.
FadFadType evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &physics, const dealii::Point< dim, FadFadType > &phys_coord, const std::array< FadFadType, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &soln_grad_at_q) const override
Virtual function for Sacado computation of cell volume functional term and derivatives.
std::shared_ptr< dealii::TrilinosWrappers::SparseMatrix > d2IdWdX
Sparse matrix for storing the functional partial second derivatives.
Sacado::Fad::DFad< FadType > FadFadType
Sacado AD type that allows 2nd derivatives.
virtual ~Functional()=default
Destructor.
dealii::LinearAlgebra::distributed::Vector< double > solution_d2I
const double normLp
Norm exponent value.
virtual FadFadType evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, FadFadType > &, const unsigned int, const dealii::Point< dim, FadFadType > &, const dealii::Tensor< 1, dim, FadFadType > &, const std::array< FadFadType, nstate > &, const std::array< dealii::Tensor< 1, dim, FadFadType >, nstate > &) const
Virtual function for Sacado computation of cell boundary functional term and derivatives.
std::shared_ptr< DGBase< dim, real, MeshType > > dg
Smart pointer to DGBase.
dealii::LinearAlgebra::distributed::Vector< double > solution_value
std::shared_ptr< ManufacturedSolutionFunction< dim, FadFadType > > weight_function_adtype
Manufactured solution weighting function of adtype return type.
const double normLp
Norm exponent value.
DGBase is independent of the number of state variables.
real evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const dealii::Point< dim, real > &phys_coord, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Virtual function for computation of cell volume functional term.
Lp boundary error norm functional class.
void allocate_derivatives(const bool compute_dIdW, const bool compute_dIdX, const bool compute_d2I)
Allocate and setup the derivative vectors/matrices.
virtual real evaluate_functional(const bool compute_dIdW=false, const bool compute_dIdX=false, const bool compute_d2I=false)
Evaluates the functional derivative with respect to the solution variable.
real evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const dealii::Point< dim, real > &phys_coord, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Non-template functions to override the template classes.
void set_derivatives(const bool compute_dIdW, const bool compute_dIdX, const bool compute_d2I, const Sacado::Fad::DFad< Sacado::Fad::DFad< real >> volume_local_sum, std::vector< dealii::types::global_dof_index > cell_soln_dofs_indices, std::vector< dealii::types::global_dof_index > cell_metric_dofs_indices)
Set the derivative vectors/matrices.
const bool use_all_boundaries
Flag to use all domain boundaries.
std::shared_ptr< ManufacturedSolutionFunction< dim, real > > weight_function_double
Manufactured solution weighting function of double return type.
const dealii::UpdateFlags volume_update_flags
Update flags needed at volume points.
real evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const unsigned int boundary_id, const dealii::Point< dim, real > &phys_coord, const dealii::Tensor< 1, dim, real > &normal, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Non-template functions to override the template classes.
real evaluate_volume_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const dealii::Point< dim, real > &phys_coord, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Virtual function for computation of cell volume functional term.
void set_geom(const dealii::LinearAlgebra::distributed::Vector< real > &volume_nodes_set)
real evaluate_boundary_integrand(const PHiLiP::Physics::PhysicsBase< dim, nstate, real > &physics, const unsigned int boundary_id, const dealii::Point< dim, real > &phys_coord, const dealii::Tensor< 1, dim, real > &normal, const std::array< real, nstate > &soln_at_q, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_at_q) const override
Virtual function for computation of cell boundary functional term.
dealii::ConditionalOStream pcout
Parallel std::cout that only outputs on mpi_rank==0.
real2 evaluate_volume_cell_functional(const Physics::PhysicsBase< dim, nstate, real2 > &physics, const std::vector< real2 > &soln_coeff, const dealii::FESystem< dim > &fe_solution, const std::vector< real2 > &coords_coeff, const dealii::FESystem< dim > &fe_metric, const dealii::Quadrature< dim > &volume_quadrature) const
Templated function to evaluate a cell's volume functional.