Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8b623b4
Add H1 projection support to calculator app
roystgnr Nov 11, 2024
86f0aee
Add FDMGradient class
roystgnr Nov 12, 2024
0f3c459
Support FEMFunctionBase in ExactSolution
roystgnr Nov 12, 2024
bebed2a
Re-bootstrap
roystgnr Nov 13, 2024
987fdd4
Add FEMFunctionBase::init()
roystgnr Nov 13, 2024
99b4947
Direct WrappedFunctor(function) constructor
roystgnr Nov 13, 2024
b9e381c
Fixup FDMGradient
roystgnr Nov 13, 2024
42efe37
Fixup L2System
roystgnr Nov 13, 2024
5a9fa1c
Fixup ExactSolution
roystgnr Nov 13, 2024
af3ef3a
Clearer usage message
roystgnr Nov 13, 2024
ce9155f
Calculator app updates to HilbertSystem API
roystgnr Nov 13, 2024
8389e7b
Error calculation option in calculator
roystgnr Nov 13, 2024
f2faf47
get_nothing() in ParsedFEMFunction needing nothing
roystgnr Nov 14, 2024
2126a54
get_nothing() from context for WrappedFunctor
roystgnr Nov 14, 2024
c4c0737
Print norms before errors in calculator
roystgnr Nov 14, 2024
470c3dc
Add --inmat option to calculator
roystgnr Nov 15, 2024
7bdf3d0
Optimize SparseMatrix::read_matlab()
roystgnr Nov 19, 2024
ac2e11d
Switch read_matlab() hotspot regex->istringstream
roystgnr Nov 20, 2024
9b1c628
Use libMesh::out in calculator
roystgnr Dec 2, 2024
8f68aa8
Fix new FDMGradient with --enable-complex
roystgnr Dec 10, 2024
40c3658
Fix ExactSolution refactor w/unused context FEs
roystgnr Dec 10, 2024
5a12fc5
Fix vector_fe_ex9 with --enable-complex
roystgnr Dec 10, 2024
7701dc0
Add missing entries to FEAbstract::build()
roystgnr Dec 11, 2024
130f9c2
Don't disable $LIBMESH_OPTIONS for vector_fe_ex6
roystgnr Dec 11, 2024
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
40 changes: 20 additions & 20 deletions examples/vector_fe/vector_fe_ex6/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,65 @@ example_name=vector_fe_ex6
### Neumann boundary conditions

options="dim=2 element_type=TRI6 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 element_type=TRI7 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 element_type=QUAD8 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 element_type=QUAD9 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=TRI6 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=TRI7 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=QUAD8 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=QUAD9 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

# Subdividing each hex into 24 tets gets expensive in dbg...
options="dim=3 element_type=TET14 boundary_condition=neumann grid_size=6"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=3 element_type=HEX27 boundary_condition=neumann"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

### Dirichlet boundary conditions

options="dim=2 element_type=TRI6 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 element_type=TRI7 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 element_type=QUAD8 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 element_type=QUAD9 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=TRI6 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=TRI7 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=QUAD8 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=2 order=2 element_type=QUAD9 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

# Subdividing each hex into 24 tets gets expensive in dbg...
options="dim=3 element_type=TET14 boundary_condition=dirichlet grid_size=6"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"

options="dim=3 element_type=HEX27 boundary_condition=dirichlet"
run_example_no_extra_options "$example_name" "$options"
run_example "$example_name" "$options"
18 changes: 9 additions & 9 deletions examples/vector_fe/vector_fe_ex9/hdg_problem.C
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,17 @@ HDGProblem::vector_volume_jacobian(DenseMatrix<Number> & Jqq, DenseMatrix<Number
}
}

RealVectorValue
NumberVectorValue
HDGProblem::vel_cross_vel_residual(const std::vector<Number> & u_sol_local,
const std::vector<Number> & v_sol_local,
const unsigned int qp,
const unsigned int vel_component) const
{
const RealVectorValue U(u_sol_local[qp], v_sol_local[qp]);
const NumberVectorValue U(u_sol_local[qp], v_sol_local[qp]);
return U * U(vel_component);
}

RealVectorValue
NumberVectorValue
HDGProblem::vel_cross_vel_jacobian(const std::vector<Number> & u_sol_local,
const std::vector<Number> & v_sol_local,
const unsigned int qp,
Expand All @@ -194,8 +194,8 @@ HDGProblem::vel_cross_vel_jacobian(const std::vector<Number> & u_sol_local,
const std::vector<std::vector<Real>> & phi,
const unsigned int j) const
{
const RealVectorValue U(u_sol_local[qp], v_sol_local[qp]);
RealVectorValue vector_phi_local;
const NumberVectorValue U(u_sol_local[qp], v_sol_local[qp]);
NumberVectorValue vector_phi_local;
vector_phi_local(vel_j_component) = phi[j][qp];
auto ret = vector_phi_local * U(vel_component);
if (vel_component == vel_j_component)
Expand Down Expand Up @@ -318,11 +318,11 @@ HDGProblem::pressure_volume_jacobian(DenseMatrix<Number> & Jpu,
for (const auto j : make_range(scalar_n_dofs))
{
{
const Gradient phi((*scalar_phi)[j][qp], 0);
const Gradient phi((*scalar_phi)[j][qp], Number(0));
Jpu(i, j) -= (*JxW)[qp] * ((*grad_scalar_phi)[i][qp] * phi);
}
{
const Gradient phi(0, (*scalar_phi)[j][qp]);
const Gradient phi(Number(0), (*scalar_phi)[j][qp]);
Jpv(i, j) -= (*JxW)[qp] * ((*grad_scalar_phi)[i][qp] * phi);
}
}
Expand Down Expand Up @@ -359,11 +359,11 @@ HDGProblem::pressure_face_jacobian(DenseMatrix<Number> & Jplm_u, DenseMatrix<Num
for (const auto j : make_range(lm_n_dofs))
{
{
const Gradient phi((*lm_phi_face)[j][qp], 0);
const Gradient phi((*lm_phi_face)[j][qp], Number(0));
Jplm_u(i, j) += (*JxW_face)[qp] * phi * (*normals)[qp] * (*scalar_phi_face)[i][qp];
}
{
const Gradient phi(0, (*lm_phi_face)[j][qp]);
const Gradient phi(Number(0), (*lm_phi_face)[j][qp]);
Jplm_v(i, j) += (*JxW_face)[qp] * phi * (*normals)[qp] * (*scalar_phi_face)[i][qp];
}
}
Expand Down
24 changes: 12 additions & 12 deletions examples/vector_fe/vector_fe_ex9/hdg_problem.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ class HDGProblem : public NonlinearImplicitSystem::ComputeResidual,

void vector_volume_jacobian(DenseMatrix<Number> & Jqq, DenseMatrix<Number> & Jqs);

RealVectorValue vel_cross_vel_residual(const std::vector<Number> & u_sol_local,
const std::vector<Number> & v_sol_local,
const unsigned int qp,
const unsigned int vel_component) const;

RealVectorValue vel_cross_vel_jacobian(const std::vector<Number> & u_sol_local,
const std::vector<Number> & v_sol_local,
const unsigned int qp,
const unsigned int vel_component,
const unsigned int vel_j_component,
const std::vector<std::vector<Real>> & phi,
const unsigned int j) const;
NumberVectorValue vel_cross_vel_residual(const std::vector<Number> & u_sol_local,
const std::vector<Number> & v_sol_local,
const unsigned int qp,
const unsigned int vel_component) const;

NumberVectorValue vel_cross_vel_jacobian(const std::vector<Number> & u_sol_local,
const std::vector<Number> & v_sol_local,
const unsigned int qp,
const unsigned int vel_component,
const unsigned int vel_j_component,
const std::vector<std::vector<Real>> & phi,
const unsigned int j) const;

void scalar_volume_residual(const std::vector<Gradient> & vel_gradient,
const unsigned int vel_component,
Expand Down
1 change: 1 addition & 0 deletions include/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ include_HEADERS = \
numerics/eigen_preconditioner.h \
numerics/eigen_sparse_matrix.h \
numerics/eigen_sparse_vector.h \
numerics/fdm_gradient.h \
numerics/fem_function_base.h \
numerics/function_base.h \
numerics/lumped_mass_matrix.h \
Expand Down
45 changes: 42 additions & 3 deletions include/error_estimation/exact_solution.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class EquationSystems;
class Parameters;
class Mesh;
template <typename Output> class FunctionBase;
template <typename Output> class FEMFunctionBase;
enum FEMNormType : int;

// Is there any way to simplify this?
Expand Down Expand Up @@ -112,13 +113,26 @@ class ExactSolution
*/
void attach_exact_values (const std::vector<FunctionBase<Number> *> & f);

/**
* Clone and attach arbitrary functors which compute the exact
* values of the EquationSystems' solutions at any point.
*/
void attach_exact_values (const std::vector<FEMFunctionBase<Number> *> & f);

/**
* Clone and attach an arbitrary functor which computes the exact
* value of the system \p sys_num solution at any point.
*/
void attach_exact_value (unsigned int sys_num,
FunctionBase<Number> * f);

/**
* Clone and attach an arbitrary functor which computes the exact
* value of the system \p sys_num solution at any point.
*/
void attach_exact_value (unsigned int sys_num,
FEMFunctionBase<Number> * f);

/**
* Attach an arbitrary function which computes the exact value of
* the solution at any point.
Expand All @@ -135,13 +149,26 @@ class ExactSolution
*/
void attach_exact_derivs (const std::vector<FunctionBase<Gradient> *> & g);

/**
* Clone and attach arbitrary functors which compute the exact
* gradients of the EquationSystems' solutions at any point.
*/
void attach_exact_derivs (const std::vector<FEMFunctionBase<Gradient> *> & g);

/**
* Clone and attach an arbitrary functor which computes the exact
* gradient of the system \p sys_num solution at any point.
*/
void attach_exact_deriv (unsigned int sys_num,
FunctionBase<Gradient> * g);

/**
* Clone and attach an arbitrary functor which computes the exact
* gradient of the system \p sys_num solution at any point.
*/
void attach_exact_deriv (unsigned int sys_num,
FEMFunctionBase<Gradient> * g);

/**
* Attach an arbitrary function which computes the exact gradient of
* the solution at any point.
Expand All @@ -157,6 +184,11 @@ class ExactSolution
* second derivatives of the EquationSystems' solutions at any point.
*/
void attach_exact_hessians (std::vector<FunctionBase<Tensor> *> h);
/**
* Clone and attach arbitrary functors which compute the exact
* second derivatives of the EquationSystems' solutions at any point.
*/
void attach_exact_hessians (std::vector<FEMFunctionBase<Tensor> *> h);

/**
* Clone and attach an arbitrary functor which computes the exact
Expand All @@ -165,6 +197,13 @@ class ExactSolution
void attach_exact_hessian (unsigned int sys_num,
FunctionBase<Tensor> * h);

/**
* Clone and attach an arbitrary functor which computes the exact
* second derivatives of the system \p sys_num solution at any point.
*/
void attach_exact_hessian (unsigned int sys_num,
FEMFunctionBase<Tensor> * h);

/**
* Attach an arbitrary function which computes the exact second
* derivatives of the solution at any point.
Expand Down Expand Up @@ -315,19 +354,19 @@ class ExactSolution
* User-provided functors which compute the exact value of the
* solution for each system.
*/
std::vector<std::unique_ptr<FunctionBase<Number>>> _exact_values;
std::vector<std::unique_ptr<FEMFunctionBase<Number>>> _exact_values;

/**
* User-provided functors which compute the exact derivative of the
* solution for each system.
*/
std::vector<std::unique_ptr<FunctionBase<Gradient>>> _exact_derivs;
std::vector<std::unique_ptr<FEMFunctionBase<Gradient>>> _exact_derivs;

/**
* User-provided functors which compute the exact hessians of the
* solution for each system.
*/
std::vector<std::unique_ptr<FunctionBase<Tensor>>> _exact_hessians;
std::vector<std::unique_ptr<FEMFunctionBase<Tensor>>> _exact_hessians;

/**
* Data structure which stores the errors:
Expand Down
1 change: 1 addition & 0 deletions include/include_HEADERS
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ include_HEADERS = \
numerics/eigen_preconditioner.h \
numerics/eigen_sparse_matrix.h \
numerics/eigen_sparse_vector.h \
numerics/fdm_gradient.h \
numerics/fem_function_base.h \
numerics/function_base.h \
numerics/lumped_mass_matrix.h \
Expand Down
4 changes: 4 additions & 0 deletions include/libmesh/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ BUILT_SOURCES = \
eigen_preconditioner.h \
eigen_sparse_matrix.h \
eigen_sparse_vector.h \
fdm_gradient.h \
fem_function_base.h \
function_base.h \
laspack_matrix.h \
Expand Down Expand Up @@ -1333,6 +1334,9 @@ eigen_sparse_matrix.h: $(top_srcdir)/include/numerics/eigen_sparse_matrix.h
eigen_sparse_vector.h: $(top_srcdir)/include/numerics/eigen_sparse_vector.h
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@

fdm_gradient.h: $(top_srcdir)/include/numerics/fdm_gradient.h
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@

fem_function_base.h: $(top_srcdir)/include/numerics/fem_function_base.h
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@

Expand Down
9 changes: 6 additions & 3 deletions include/libmesh/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,9 @@ BUILT_SOURCES = auto_ptr.h dirichlet_boundaries.h dof_map.h \
dense_subvector.h dense_vector.h dense_vector_base.h \
diagonal_matrix.h distributed_vector.h eigen_core_support.h \
eigen_preconditioner.h eigen_sparse_matrix.h \
eigen_sparse_vector.h fem_function_base.h function_base.h \
laspack_matrix.h laspack_vector.h lumped_mass_matrix.h \
numeric_vector.h parsed_fem_function.h \
eigen_sparse_vector.h fdm_gradient.h fem_function_base.h \
function_base.h laspack_matrix.h laspack_vector.h \
lumped_mass_matrix.h numeric_vector.h parsed_fem_function.h \
parsed_fem_function_parameter.h parsed_function.h \
parsed_function_parameter.h petsc_macro.h petsc_matrix.h \
petsc_matrix_base.h petsc_matrix_shell_matrix.h \
Expand Down Expand Up @@ -1666,6 +1666,9 @@ eigen_sparse_matrix.h: $(top_srcdir)/include/numerics/eigen_sparse_matrix.h
eigen_sparse_vector.h: $(top_srcdir)/include/numerics/eigen_sparse_vector.h
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@

fdm_gradient.h: $(top_srcdir)/include/numerics/fdm_gradient.h
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@

fem_function_base.h: $(top_srcdir)/include/numerics/fem_function_base.h
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@

Expand Down
Loading