Peano
Loading...
Searching...
No Matches
api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation Class Reference

This is one of the simplest solvers that you can think of. More...

Inheritance diagram for api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation:
Collaboration diagram for api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation:

Public Member Functions

 __init__ (self, name, unknowns, dimensions, min_h, max_h, cell_lhs_matrix, cell_rhs_matrix, cell_lhs_matrix_scaling, cell_rhs_matrix_scaling)
 Collocated low-order (d-linear) Finite Elements.
 add_to_Peano4_datamodel (self, datamodel, verbose)
 Initialise index model.
 add_use_statements (self, observer)
 Register the index numbers to be used in each and every mesh traversal.
 add_to_plot (self, observer)
 Tell the project's observer how to plot the data.
 add_to_create_grid (self, observer)
 Add whatever action set you want to use to observer.
 add_to_enumerate_and_init_solution (self, observer)
 Solution initialisation.
 add_to_assemble (self, observer)
 Add whatever action set you want to use to observer.
 add_to_init_petsc (self, observer)
 Add whatever action set you want to use here.
 add_to_map_solution_onto_mesh (self, observer)
 Add whatever action set you want to use to observer.
 add_implementation_files_to_project (self, namespace, output, subdirectory="")
 The solver creates two classes: An abstract base class and its implementations.
 number_of_matrix_entries_per_vertex (self)
 Nothing is associated with the vertex.
 number_of_matrix_entries_per_face (self)
 In the DG scheme, we have a projection from the left and we have a projection from the right.
 number_of_matrix_entries_per_cell (self)
 This is the actual unknowns per cell.
Public Member Functions inherited from api.solvers.Solver.Solver
 __init__ (self, name, min_h, max_h)
 name: String Every solver has a unique name.
 typename (self)
 instance_name (self)
 Return the name of the object that will be created for this solver.
 create_readme_descriptor (self)
 Should really be abstract and properly be initialised.
 name (self)

Data Fields

 cell_lhs_matrix = cell_lhs_matrix
 cell_rhs_matrix = cell_rhs_matrix
 cell_lhs_matrix_scaling = cell_lhs_matrix_scaling
 cell_rhs_matrix_scaling = cell_rhs_matrix_scaling
Data Fields inherited from api.solvers.Solver.Solver
 min_h = min_h
 max_h = max_h

Protected Attributes

 _unknowns = unknowns
 _vertex_pde_data = peano4.api.datamodel.DaStGen2( name )
Protected Attributes inherited from api.solvers.Solver.Solver
 _name = name
 _vertex_petsc_data = peano4.api.datamodel.DaStGen2( name + "PETScData")
 _face_petsc_data = peano4.api.datamodel.DaStGen2( name + "PETScData" )
 _cell_petsc_data = peano4.api.datamodel.DaStGen2( name + "PETScData" )

Detailed Description

This is one of the simplest solvers that you can think of.

It places one degree of freedom (can be scalar or a vector) on each vertex. As we support solely element-wise assembly, this means you can implement things like a 9-point (2d) or 27-point (3d) stencil, but not really anything more sophisticated.

cell_lhs_matrix: [double] or [] Pass in [] if you prefer to assemble the matrix per cell yourself.

cell_rhs_matrix: [double] or [] Pass in [] if you prefer to assemble the matrix per cell yourself.

cell_lhs_matrix_scaling: Positive integer The lhs matrix is scaled with \( h^x \) where the x is defined by this parameter. If you don't specify an lhs matrix, i.e. you prefer to inject this matrix manually, you can leave this parameter None, as it is not used.

cell_rhs_matrix_scaling: Positive integer The rhs matrix is scaled with \( h^x \) where the x is defined by this parameter. If you don't specify a rhs matrix, i.e. you prefer to inject this matrix manually, you can leave this parameter None, as it is not used.

Definition at line 219 of file CollocatedLowOrderDiscretisation.py.

Constructor & Destructor Documentation

◆ __init__()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.__init__ ( self,
name,
unknowns,
dimensions,
min_h,
max_h,
cell_lhs_matrix,
cell_rhs_matrix,
cell_lhs_matrix_scaling,
cell_rhs_matrix_scaling )

Collocated low-order (d-linear) Finite Elements.

Definition at line 247 of file CollocatedLowOrderDiscretisation.py.

References __init__().

Referenced by __init__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ add_implementation_files_to_project()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_implementation_files_to_project ( self,
namespace,
output,
subdirectory = "" )

The solver creates two classes: An abstract base class and its implementations.

The abstract base class will be overwritten if there is one in the directory. I pipe all the Python constants into this base class, so they are available in the C++ code.

The implementation file will not be overwritten, as I assume that the users will write their own domain-specific stuff in there. If it does not exist yet, I'll create an empty stub which can be befilled with something meaningful.

Besides the creation of these two files, I also add the files to the project artifacts and the makefile, so they are captured by the build system.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 352 of file CollocatedLowOrderDiscretisation.py.

References peano4.api.output.ActionSet.ActionSet.__class__, peano4.api.output.Jinja2TemplatedHeaderImplementationFilePair.Jinja2TemplatedHeaderImplementationFilePair.__class__, peano4.api.output.TemplatedHeaderFile.TemplatedHeaderFile.__class__, api.solvers.Solver.Solver._name, dastgen2.attributes.Attribute.Attribute._name, dastgen2.attributes.BooleanArray.BooleanArray._name, dastgen2.attributes.Enumeration.Enumeration._name, exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling._name, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling._name, exagrype.api.FOSOSolver.FOSOSolver._name, exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling._name, exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling._name, exahype2.api.AuxiliaryVariables.AuxiliaryVariables._name, exahype2.api.dslhype.SyntaxTree.Construction._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromDotProduct._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromExisting._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromFunction._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromMatrixVectorProduct._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromOperation._name, exahype2.api.dslhype.SyntaxTree.MemoryAllocation._name, exahype2.api.dslhype.SyntaxTree.MemoryDeallocation._name, exahype2.api.Solver.Solver._name, mghype::matrixfree::solvers::Solver._name, solvers.api.Solver.Solver._name, cell_lhs_matrix, cell_lhs_matrix_scaling, cell_rhs_matrix, cell_rhs_matrix_scaling, max_h, exaparty.api.particle.Particle.Particle.max_h, solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.max_h, solvers.api.CollocatedMG.CollocatedMG.max_h, solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.max_h, solvers.api.Solver.Solver.max_h, api.solvers.Solver.Solver.min_h, exaparty.api.particle.Particle.Particle.min_h, solvers.api.Solver.Solver.min_h, number_of_matrix_entries_per_vertex(), api.solvers.Solver.Solver.typename(), and solvers.api.Solver.Solver.typename().

Here is the call graph for this function:

◆ add_to_assemble()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_assemble ( self,
observer )

Add whatever action set you want to use to observer.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 338 of file CollocatedLowOrderDiscretisation.py.

◆ add_to_create_grid()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_create_grid ( self,
observer )

Add whatever action set you want to use to observer.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 319 of file CollocatedLowOrderDiscretisation.py.

◆ add_to_enumerate_and_init_solution()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_enumerate_and_init_solution ( self,
observer )

Solution initialisation.

Close to trivial: Just add the action set petsc.actionsets.InitVertexDoFs to the observer.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 324 of file CollocatedLowOrderDiscretisation.py.

◆ add_to_init_petsc()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_init_petsc ( self,
observer )

Add whatever action set you want to use here.

I am not sure if there is a real grid traversal tied to this step. So maybe nothing is called. Has to be checked. Anyway, most solvers leave this one blank.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 343 of file CollocatedLowOrderDiscretisation.py.

◆ add_to_map_solution_onto_mesh()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_map_solution_onto_mesh ( self,
observer )

Add whatever action set you want to use to observer.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 347 of file CollocatedLowOrderDiscretisation.py.

◆ add_to_Peano4_datamodel()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_Peano4_datamodel ( self,
datamodel,
verbose )

Initialise index model.

We build up a data model, which is really an index model in this case. Every vertex, face and cell can hold a data model which is only one integer. This integer encodes the first index of a matrix unknown held by the grid entity. For the plain DG code, there are no vertex unknowns. However, we have two types of face indices: Those for the projection and those for the solution of the Riemann problem.

You might want to overwrite this routine, but please ensure that you still call this superclass implementation, too.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 279 of file CollocatedLowOrderDiscretisation.py.

References _vertex_pde_data, and add_to_Peano4_datamodel().

Referenced by add_to_Peano4_datamodel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_to_plot()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_plot ( self,
observer )

Tell the project's observer how to plot the data.

Nothing fancy here. We add plotters from Peano's toolbox to visualise solution and right-hand side.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 289 of file CollocatedLowOrderDiscretisation.py.

References api.solvers.Solver.Solver._name, dastgen2.attributes.Attribute.Attribute._name, dastgen2.attributes.BooleanArray.BooleanArray._name, dastgen2.attributes.Enumeration.Enumeration._name, exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling._name, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling._name, exagrype.api.FOSOSolver.FOSOSolver._name, exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling._name, exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling._name, exahype2.api.AuxiliaryVariables.AuxiliaryVariables._name, exahype2.api.dslhype.SyntaxTree.Construction._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromDotProduct._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromExisting._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromFunction._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromMatrixVectorProduct._name, exahype2.api.dslhype.SyntaxTree.DataBlockConstructionFromOperation._name, exahype2.api.dslhype.SyntaxTree.MemoryAllocation._name, exahype2.api.dslhype.SyntaxTree.MemoryDeallocation._name, exahype2.api.Solver.Solver._name, mghype::matrixfree::solvers::Solver._name, solvers.api.Solver.Solver._name, _unknowns, exahype2.api.Solver.Solver._unknowns, exahype2::CellAccess._unknowns, exahype2::enumerator::AoSLexicographicEnumerator._unknowns, exahype2::enumerator::AoSoALexicographicEnumerator._unknowns, exahype2::enumerator::FaceAoSLexicographicEnumerator._unknowns, exahype2::enumerator::SingleDoFEnumerator._unknowns, exahype2::enumerator::SoALexicographicEnumerator._unknowns, and _vertex_pde_data.

◆ add_use_statements()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_use_statements ( self,
observer )

Register the index numbers to be used in each and every mesh traversal.

You can overwrite the routine and add your own stuff. However, please ensure this routine still is invoked, too.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 284 of file CollocatedLowOrderDiscretisation.py.

References _vertex_pde_data, and add_use_statements().

Referenced by add_use_statements().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ number_of_matrix_entries_per_cell()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.number_of_matrix_entries_per_cell ( self)

This is the actual unknowns per cell.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 438 of file CollocatedLowOrderDiscretisation.py.

◆ number_of_matrix_entries_per_face()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.number_of_matrix_entries_per_face ( self)

In the DG scheme, we have a projection from the left and we have a projection from the right.

These values are proper projections, i.e. they do not carry any semantics. Then we have to solve the Riemann problem, and need one more unknown to store the outcome of that one.

Reimplemented from api.solvers.Solver.Solver.

Definition at line 426 of file CollocatedLowOrderDiscretisation.py.

◆ number_of_matrix_entries_per_vertex()

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.number_of_matrix_entries_per_vertex ( self)

Field Documentation

◆ _unknowns

◆ _vertex_pde_data

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation._vertex_pde_data = peano4.api.datamodel.DaStGen2( name )
protected

◆ cell_lhs_matrix

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.cell_lhs_matrix = cell_lhs_matrix

◆ cell_lhs_matrix_scaling

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.cell_lhs_matrix_scaling = cell_lhs_matrix_scaling

◆ cell_rhs_matrix

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.cell_rhs_matrix = cell_rhs_matrix

◆ cell_rhs_matrix_scaling

api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.cell_rhs_matrix_scaling = cell_rhs_matrix_scaling

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