/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/FEM/assembler/common.hh Source File#
|
DiFfRG
Discretization Framework for functional Renormalization Group flows
|
common.hh
Go to the documentation of this file.
70 mapping(discretization.get_mapping()), schedule_overrides(AssemblyScheduleOverrides::from_config(config)),
91 virtual void attach_data_output(OutputFrame<dim, VectorType> &data_out, const VectorType &solution,
118 const auto metadata = internal::build_affine_constraint_metadata<Components, dim>(discretization);
134 virtual void refinement_indicator(Vector<double> & /*indicator*/, const VectorType & /*solution*/) = 0;
162 template <typename PotentialEvaluation = RawPotentialEvaluation<dim, NumberType>> struct PointEvaluation {
201 [&](const auto &p, const auto &values) { return model.raw_potential_gradient(p, values); }, EoM_config,
212 [&](const auto &p, const auto &values) { return model.raw_potential_gradient(p, values); }, EoM_config,
220 EoM_cell, solution_global, dof_handler, mapping, EoMfun, [&](const auto &p, const auto &) { return p; },
262 resolve_extractor_point(const Point<dim> &EoM_point, const typename DoFHandler<dim>::cell_iterator &EoM_cell_,
274 void extract(std::array<NumberType, Components::count_extractors()> &data, const VectorType &solution_global,
283 [&](const auto &p, const auto &values) { return postprocess ? model.EoM_postprocess(p, values) : p; },
302 bool jacobian_extractors(FullMatrix<NumberType> &extractor_jacobian, const VectorType &solution_global,
307 extractor_jacobian_u = FullMatrix<NumberType>(Components::count_extractors(), Components::count_fe_functions());
315 FullMatrix<NumberType>(Components::count_extractors(), Components::count_fe_functions() * dim * dim);
320 [&](const auto &p, const auto &values) { return model.EoM_postprocess(p, values); }, EoM_config,
363 if (extractor_jacobian.m() != Components::count_extractors() || extractor_jacobian.n() != n_dofs)
373 extractor_jacobian_du(e, component_i * dim + d1) * fe_v.shape_grad_component(i, 0, component_i)[d1];
375 extractor_jacobian(e, i) += extractor_jacobian_ddu(e, component_i * dim * dim + d1 * dim + d2) *
440 report_port.info("FEM: Assembling {} cells on {} threads -- {}x{} workers/cells for a cheap cell loop, "
This is the general assembler interface for any kind of discretization. An assembler is responsible f...
Definition abstract_assembler.hh:54
void jacobian(SparseMatrixType &jacobian, const VectorType &solution_global, NumberType weight, NumberType mass_weight, const VectorType &variables=VectorType())
Definition abstract_assembler.hh:298
void residual(VectorType &residual, const VectorType &solution_global, NumberType weight, NumberType weight_mass, const VectorType &variables=VectorType())
Definition abstract_assembler.hh:224
Definition affine_constraint_metadata.hh:24
A hierarchical configuration tree, readable from JSON and TOML files.
Definition config_tree.hh:32
The basic assembler that can be used for any standard CG scheme with flux and source.
Definition common.hh:42
uint num_variable_jacobians() const
Definition common.hh:401
const auto & get_discretization() const
Definition common.hh:113
typename Discretization::NumberType NumberType
Definition common.hh:61
virtual void residual_variables(VectorType &residual, const VectorType &variables, const VectorType &spatial_solution) override
Definition common.hh:136
double average_time_variable_jacobian_assembly()
Definition common.hh:393
uint num_variable_residuals() const
Definition common.hh:391
FullMatrix< NumberType > extractor_jacobian
Definition common.hh:459
virtual void set_time(double t) override
Set the current time. The assembler should usually just forward this to the numerical model.
Definition common.hh:132
double average_time_variable_residual_assembly()
Definition common.hh:383
void update_assembly_schedules()
Re-count the cells the schedules are sized from.
Definition common.hh:430
uint n_owned_cells
Cells this rank assembles. Refreshed in reinit(); the per-loop schedules are sized from it.
Definition common.hh:447
void extract(std::array< NumberType, Components::count_extractors()> &data, const VectorType &solution_global, const VectorType &variables, bool search_EoM, bool set_EoM, bool postprocess) const
Definition common.hh:274
typename Discretization::Components Components
Definition common.hh:65
bool jacobian_extractors(FullMatrix< NumberType > &extractor_jacobian, const VectorType &solution_global, const VectorType &variables)
Definition common.hh:302
FullMatrix< NumberType > extractor_jacobian_du
Definition common.hh:461
typename Discretization::SparseMatrixType SparseMatrixType
Definition common.hh:63
virtual void refinement_indicator(Vector< double > &, const VectorType &)=0
void readouts(OutputFrame< dim, VectorType > &data_out, const VectorType &solution_global, const VectorType &variables) const
Definition common.hh:207
auto evaluate_at(const Point< dim > &x, const typename DoFHandler< dim >::cell_iterator &cell, const VectorType &solution_global, const RawPotential &raw_potential) const
Evaluate the FE solution and the raw potential at x, which lies in cell.
Definition common.hh:175
virtual void jacobian_variables(FullMatrix< NumberType > &jacobian, const VectorType &variables, const VectorType &spatial_solution) override
Definition common.hh:148
FullMatrix< NumberType > extractor_jacobian_ddu
Definition common.hh:462
DiFfRG::internal::PotentialSystemCache< dim, NumberType > potential_cache
Mesh-dependent half of the potential reconstructions, built once and reused; see PotentialSystemCache...
Definition common.hh:456
std::vector< double > timings_variable_jacobian
Definition common.hh:466
DoFHandler< dim >::cell_iterator old_EoM_cell
Definition common.hh:451
auto extractor_raw_potential(const VectorType &solution_global) const
The raw potential for the extractors, or an inert placeholder if the model does not read it.
Definition common.hh:196
std::vector< double > timings_variable_residual
Definition common.hh:465
const AssemblyScheduleOverrides schedule_overrides
Definition common.hh:448
std::optional< Point< dim > > EoM_minimum_guess
Definition common.hh:454
virtual void reinit() override
Reinitialize the assembler. This is necessary if the mesh has changed, e.g. after a mesh refinement.
Definition common.hh:116
typename Discretization::VectorType VectorType
Definition common.hh:62
FEMAssembler(Discretization &discretization, Model &model, const ConfigTree &config)
Definition common.hh:67
std::pair< Point< dim >, typename DoFHandler< dim >::cell_iterator > resolve_extractor_point(const Point< dim > &EoM_point, const typename DoFHandler< dim >::cell_iterator &EoM_cell_, const VectorType &solution_global) const
Where the model wants its extractors evaluated, and the cell holding that point.
Definition common.hh:262
DoFHandler< dim >::cell_iterator old_extractor_cell
Where the extractors are evaluated. Equal to EoM unless the model defines extractor_point.
Definition common.hh:458
virtual IndexSet get_differential_indices() const override
Obtain the dofs which contain time derivatives.
Definition common.hh:81
std::vector< types::global_dof_index > extractor_dof_indices
Definition common.hh:463
virtual void attach_data_output(OutputFrame< dim, VectorType > &data_out, const VectorType &solution, const VectorType &variables, const VectorType &dt_solution=VectorType(), const VectorType &residual=VectorType()) override
Definition common.hh:91
virtual void rebuild_jacobian_sparsity()=0
FullMatrix< NumberType > extractor_jacobian_u
Definition common.hh:460
AssemblySchedule schedule_for(const double cost_ns) const
The mesh_loop schedule for a loop whose cell worker costs cost_ns nanoseconds.
Definition common.hh:418
void attach(const DoFHandler< dim > &dof_handler, const VectorType &solution, const std::string &name)
Definition output_session.hh:47
Definition output_session.hh:42
void attach_raw_potential(ReconstructedRawPotential< dim, typename VectorType::value_type > potential)
Definition output_session.hh:141
void register_readout(const std::string &id)
Definition output_session.hh:154
void attach_eom_potential(EoMResult< dim, typename VectorType::value_type > result)
Definition output_session.hh:136
Definition run_reporter.hh:96
void info(spdlog::format_string_t< Args... > format, Args &&...args) const
Definition run_reporter.hh:103
The mesh-dependent half of solve_potential, retained across calls.
Definition eom.hh:315
Whether Model chooses its own point at which the extractors are evaluated.
Definition solution_sample.hh:137
bool any_of(MPI_Comm comm, bool value)
Collective agreement on a predicate. Used to turn a rank-local decision (an abort,...
constexpr double local_fe
Local FE work only: mass matrices, refinement indicators. ~0.2-0.3 us/cell for CG p=3.
Definition assembly_schedule.hh:48
constexpr double momentum_integral
Definition assembly_schedule.hh:53
AffineConstraintMetadata< dim > build_affine_constraint_metadata(const Discretization &discretization)
Definition affine_constraint_metadata.hh:99
void apply_model_affine_constraints(Model &model, Constraints &constraints, const Context &context)
Definition affine_constraint_metadata.hh:79
constexpr void validate_readout_helper_arity()
Definition abstract_assembler.hh:17
Definition complex_math.hh:10
ReconstructedRawPotential< dim, typename VectorType::value_type > reconstruct_raw_potential(const VectorType &sol, const dealii::DoFHandler< dim > &dof_handler, const dealii::Mapping< dim > &mapping, const GradientFUN &get_gradient, const Config::EoMConfig &config, internal::PotentialSystemCache< dim, typename VectorType::value_type > *cache=nullptr)
Reconstruct a scalar raw potential without locating its minimum.
Definition eom.hh:1411
AssemblySchedule make_assembly_schedule(const uint n_local_cells, const uint thread_budget, const double cost_ns, const AssemblyScheduleOverrides &overrides={})
Derive one mesh_loop schedule from the cost of a cell.
Definition assembly_schedule.hh:114
uint n_locally_owned_cells(const Discretization &discretization)
How many cells locally_owned_cells() yields.
Definition assembly_schedule.hh:167
dealii::IndexSet restrict_to_owned(const dealii::IndexSet &global_set, const dealii::IndexSet &locally_owned)
Restrict a global index set to what this rank may write.
Definition la_policy.hh:114
UnusedPotentialEvaluation evaluate_raw_potential(const UnusedPotential &, const dealii::Mapping< dim > &, const dealii::Point< dim > &)
Definition eom.hh:149
EoMResult< dim, typename VectorType::value_type > get_EoM_point_with_potential(typename dealii::DoFHandler< dim >::cell_iterator &EoM_cell, const VectorType &sol, const dealii::DoFHandler< dim > &dof_handler, const dealii::Mapping< dim > &mapping, const EoMFUN &get_EoM, const EoMPFUN &EoM_postprocess, const Config::EoMConfig &config, const std::optional< dealii::Point< dim > > &initial_guess=std::nullopt, internal::PotentialSystemCache< dim, typename VectorType::value_type > *cache=nullptr)
Reconstruct a potential whose gradient approximates the model EoM vector field and return a sampled a...
Definition eom.hh:1486
SolutionSample< dim, NumberType > make_solution_sample(const dealii::DoFHandler< dim > &dof_handler, const dealii::Mapping< dim > &mapping, const uint n_components, const FillFUN &fill)
Build a SolutionSample, taking values and gradients from a callback.
Definition solution_sample.hh:154
Overrides, if really wanted by the user: /discretization/{mesh_workers,batch_size}...
Definition assembly_schedule.hh:82
The two trailing arguments of dealii::MeshWorker::mesh_loop.
Definition assembly_schedule.hh:30
Definition eom_config.hh:10
The FE solution and the reconstructed raw potential at one point.
Definition common.hh:162
std::vector< std::vector< Tensor< 1, dim, NumberType > > > gradients
Definition common.hh:164
PotentialEvaluation potential
Definition common.hh:168
std::shared_ptr< FEValues< dim > > fe_values
Kept for the shape values the extractor jacobian needs.
Definition common.hh:170
std::vector< Vector< NumberType > > values
Definition common.hh:163
std::vector< std::vector< Tensor< 2, dim, NumberType > > > hessians
Definition common.hh:166
Definition tuples.hh:34
Stand-in for a raw potential that a model has declared it does not read.
Definition eom.hh:140
A class to store a tuple with elements that can be accessed by name. The names are stored as FixedStr...
Definition tuples.hh:56
Generated by