40 m_parameters (params),
43 m_analyticSolution (nullptr),
44 m_ownedRefSol (false),
50 m_ownedFunctions (true),
53 m_outputFileBase (
"./result"),
55 m_writeGlobalIDs (false),
57 m_ignoreZeroDError (
false)
60 "When instantiating pde problem : passed ptr to Geometry is null"
94 if (params->
hasKey(
"output format"))
97 if (otype ==
"MUSICARDIO" or otype==
"VTK_LEGACY")
99 else if (otype ==
"PARAVIEW_SERIES" or otype ==
"PSERIES")
101 else if (otype ==
"CEPS")
106 "Unknown output format : " << otype <<
". Valid types are\n" <<
107 " MUSICARDIO, VTK_LEGACY, PARAVIEW_SERIES, PSERIES (default), CEPS"
112 if (params->
hasKey(
"probe points"))
117 std::stringstream ss(spoint);
180 "When creating spatial discretization, not enough parameters to deduce the type of discretization"
186 CEPS_ABORT(
"No other discretization than finite elements implemented yet");
219 if (u->getIdentifier()==uid)
263 if ((ui->u1==u1 and ui->u2==u2) or (ui->u2==u1 and ui->u1==u2))
264 if (attrs.contains(
CepsUniversal) or ui->hasOneOfAttributes(attrs)
265 or ui->hasAttribute(
CepsUniversal) or ui->getNumberOfAttributes()==0)
385 CEPS_SAYS(
"Setting up elements of the problem...");
496 "When setting up interactions between unknowns : cannot find unknown " << std::quoted(label1)
499 "When setting up interactions between unknowns : cannot find unknown " << std::quoted(label2)
502 "When setting up interactions between unknowns : unknwons are the same!"
509 "When setting up interactions between unknowns : unknown " << std::quoted(label1) <<
510 "\n is not defined on any of the given attributes"
513 "When setting up interactions between unknowns : unknown " << std::quoted(label2) <<
514 "\n is not defined on any of the given attributes"
CepsLocationFlag
DataLocation: an enum that will be used by various elements of the code (pde, readers,...
@ ZeroD
Data is defined once.
CepsOutputFormat
Style of output files.
@ VTKCeps
vtk_ceps format, use contrib/CepsParaviewPlugin.py (5.11)
@ ParaviewSeries
Paraview files series, JSON + VTU/PVTU.
@ Music
MUSIC files, VTKLegacy and xml.
#define CEPS_ABORT(message)
Stops the execution with a message. If testing is enabled, only throws a runtime_error.
#define CEPS_SAYS(message)
Writes a message in the debug log and in the terminal (stdio).
#define CEPS_ABORT_IF(condition, message)
Stops the execution with a message if condition is true. If testing is enabled, only throws a runtime...
#define CEPS_SEPARATOR
Writes a separator in the debug log and in the terminal.
std::basic_string< CepsChar > CepsString
C++ format string.
CepsIndex CepsUnknownIndex
For unknowns.
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
std::vector< _Type, _Alloc > CepsVector
C++ vector.
float CepsReal
Need single precision floating point.
CepsArray3< CepsReal > CepsReal3D
Three real scalars, used like this for compatibility in polynomials.
constexpr CepsAttribute CepsUniversal
This attribute means "everywhere".
Abstract Class for all numerical method (FE, FD, FV etc)
DistributedInfos< DegreeOfFreedom * > * getDistributedDofs() const
Get the stored Degree Of Freedom repartition.
CepsString m_name
Name of the problem.
CepsOutputFormat getOutputFormat() const
Tells if output is binary or ascii.
CepsVector< Unknown * > getSpatialUnknowns() const
A vector of all unknowns of pb defined on cells or points.
ScalarFunction * getAnalyticSolution() const
Pointer on analytic or refScalarFunction solution.
virtual void defineUnknowns()=0
Define all the unknowns of the problem here. Must be overriden, and call all necessary addUnknown,...
CepsBool hasAnalyticSolution() const
Tells if there is an analytic or reference solution.
void setProblemName(const CepsString &name)
Set the name of the problem.
virtual void defineBoundaryConditions()
Define the boundary conditions. Should be defined in derived classes. Default is no BC.
CepsString getOutputFileBase() const
Output file name includes the directory.
virtual CepsReal getSnapshotTime() const
Returns 0. Here for compatibility.
CepsBool m_ownedDiscr
True if instance used new to create discretization.
virtual void setupWithParameters(InputParameters *params)
Set attributes from input file. Parameters are passed as arguments in case one wants to use other par...
const CepsVector< UnknownInteraction * > & getUnknownsInteractions() const
All the interactions between unknowns.
FunctionDictionary * getFunctionDictionary() const
Get functions manager.
SourceTermManager * getSourceTermManager() const
Get boundary condition manager.
virtual void defineAnalyticSolution()
Set directly the analytic function, default sets no solution, unless there is a collection of referen...
CepsString m_outputFileBase
File names prefix.
CepsVector< CepsReal3D > getProbePoints() const
Returns points where single data output should be written.
CepsString m_refSolFiles
base name of reference solution file, if any
AbstractDiscretization * m_discr
Discretization method (eg FE for now)
AbstractPdeProblem(Geometry *geom, InputParameters *params=nullptr)
Constructor with geometry and optional parameters.
void setFunctionDictionary(FunctionDictionary *)
Set functions manager.
SourceTermManager * m_sourceTerms
All source terms.
virtual ~AbstractPdeProblem()
destructor
CepsReal m_refSolSnapDt
reference solution output period
void addUnknown(const CepsString &label, CepsSet< CepsAttribute > attrs={}, CepsLocationFlag flag=CepsLocationFlag::Point, const CepsString &unit="")
Register a new unknown.
CepsBool ignoreZeroDUnknownsForError() const
Tells if 0D must not be taken into account in error computation.
CepsString getProblemName() const
Get the name of the problem.
void setOutputFormat(CepsOutputFormat opt)
Enable/disable binary output.
void addZeroDUnknown(CepsString label, const CepsString &unit="")
Register a new unknown, defined outside of geometry.
CepsVector< UnknownInteraction * > m_unknownsInteractions
Describes how unknowns interact.
CepsBool m_ignoreZeroDError
Ignore 0D unknowns when computing errors.
void addUnknownInteraction(CepsString label1, CepsString label2, CepsSet< CepsAttribute > attrs={})
Register interaction between unknowns. Also sets the interaction within Unknown instances label1 and ...
CepsBool unknownsInteract(Unknown *u1, Unknown *u2, const CepsSet< CepsAttribute > &attrs={CepsUniversal}) const
Tells if unknowns interact on an entity with attributes.
AbstractDiscretization * getSpatialDiscretization() const
Link to the spatial discretization (FE, FV, etc)
InputParameters * getParameters() const
Text parameters.
CepsOutputFormat m_outputFormat
Output format selector.
CepsVector< Unknown * > m_unknowns
All maths unknowns of the problem.
CepsBool usesReferenceSolution() const
Tells if analytic solution and if it is loaded from files.
Unknown * getUnknown(const CepsString &label) const
Get an unknown by its name.
CepsVector< CepsReal3D > m_probePoints
Single point data outputs.
CepsBool writesGlobalIndices() const
Tells if global indices are written on top of solution.
virtual void run()
Computes the solution to the problem. Default does nothing, override it !
InputParameters * m_parameters
Input file data.
CepsBool m_ownedSrcs
True if instance used new to create src term manager.
void setOutputFileBase(CepsString fileName)
Output file name includes the directory.
virtual void initializeEquation()
Initializes equations (unknowns, bc, source term) and creates the spatial discretization This method ...
CepsReal getReferenceSolutionOutputPeriod() const
Output dt of reference.
CepsBool m_ownedRefSol
Flag for reference ownership.
Geometry * m_geom
Link to geometry on which the pb is defined.
void setSpatialDiscretization(AbstractDiscretization *discr)
Link to the spatial discretization (FE, FV, etc)
void writeGlobalIndices(CepsBool opt)
Activate/deactivate global indices writing.
BoundaryConditionManager * getBoundaryConditionManager() const
Get boundary condition manager.
virtual void defineSourceTerms()
Define the source terms. Should be defined in derived classes. Default is no src term.
void setSourceTermManager(SourceTermManager *stm)
Set boundary condition manager.
virtual CepsReal getStartTime() const
Returns 0. Here for compatibility.
void createSpatialDiscretization()
Compute the discretization structure.
Geometry * getGeometry() const
Link to geometry on which the pb is defined.
virtual CepsReal getEndTime() const
Returns 0. Here for compatibility.
ScalarFunction * m_analyticSolution
analytic or reference solution
CepsBool m_ownedBCs
True if instance used new to create BC manager.
BoundaryConditionManager * m_boundaryConditions
All BCs should be there.
CepsBool m_ownedFunctions
True if instance used new to create dictionary.
FunctionDictionary * m_functions
Collection of custom functions.
CepsVector< Unknown * > getZeroDUnknowns() const
A vector of all zeroD unknowns of the pb.
void setBoundaryConditionManager(BoundaryConditionManager *bcm)
Set boundary condition manager.
void setReferenceSolution(const CepsString &baseFiles, CepsReal snapDt)
Externally define the referece solution from files. Can be used for convergence tests.
CepsBool m_writeGlobalIDs
Writes CEPS indices as well.
const CepsVector< Unknown * > & getUnknowns() const
List of unknowns of the pb.
Boundary condition to manage Dirichlet, Neumann and Robin conditions.
void setDofsInfos(DistributedInfos< DegreeOfFreedom * > *dof)
Set dofs infos in this class.
FunctionDictionary that holds functions which can be used to define source terms, boundary conditions...
Encapsulates all the geometrical data.
Source term manager to create and manage SourceTerm objects.
void setDofsInfos(DistributedInfos< DegreeOfFreedom * > *dofs)
Set dofs infos in this class.
Data describing how two unknowns are coupled.
Unknown * u2
Second unknown in the coupling.
Unknown * u1
First unknown in the coupling.
A class used to defined an unknown of a PDE problem The unknown can be defined on a specific region,...
void setUnit(const CepsString &unit)
Set the unit of the unknown.
void addUnknownInteraction(Unknown *u, CepsBool addReciprocal=true)
Add an unknown this one interacts with.
void setLocation(const CepsLocationFlag &location)
Set the data location of the unknown.
void addAttribute(const CepsAttribute &name)
Adds an attribute to the entity.
CepsBool hasOneOfAttributes(const CepsSet< CepsAttribute > &attributes) const
Tells if the entity has one of the attributes in argument.
void setAttributes(const CepsVector< CepsAttribute > &attributes)
Sets the attributes of the entity.
CepsBool hasAttribute(const CepsAttribute &name) const
Tells if the entity has the attribute in argument.
A namespace for all utility methods.
CepsString getDir(const CepsString &str)
Get a substring of s, from beginning of s to the last '/' character. Example: "/home/someone/file....
CepsString toKey(const CepsString &s)
Transform to key type a std::string, upper case and no spaces.
CepsBool isValidPtr(_Type *ptr)
Tells if pointer is not null.
_Type * getNew(_Args... args)
Allocates memory for one object. Be careful, the expansion of arguments may produce some weird result...
CepsReal3D readVertex(std::istream &file, const CepsString &errorMessage="")
Reads an integral number from an istream, aborts if conversion fails advances the stream by 1 word.
CepsBool isNullPtr(_Type *ptr)
Tells if passed pointer is null.
CepsVector< CepsString > split(const CepsString &s, const CepsString &delimiters=CepsString(" \t"))
Splits a string using mulitple delimiters in a single string.
CepsUInt toUInt(const CepsString &s)
Cast CepsString to CepsUInt.
CepsString toUpper(const CepsString &s)
Switches all characters to upper case.
CepsString getBaseName(const CepsString &str)
Extracts the base of a file name, without path, nor extension. Ex: getBaseName("/path/to/myfile....
void destroyObject(_Type &)
Destroy[delete] any type.
function caller : abstract base, only contains an variadic operator()