1 #ifndef ABLATELIBRARY_DOMAIN_H
2 #define ABLATELIBRARY_DOMAIN_H
10 #include "domain/fieldDescriptor.hpp"
11 #include "domain/modifiers/modifier.hpp"
12 #include "fieldDescription.hpp"
13 #include "initializer.hpp"
14 #include "io/serializable.hpp"
15 #include "mathFunctions/fieldFunction.hpp"
17 #include "utilities/loggable.hpp"
18 #include "utilities/nonCopyable.hpp"
20 namespace ablate::solver {
25 namespace ablate::domain {
38 Domain(DM dm, std::string name, std::vector<std::shared_ptr<FieldDescriptor>>, std::vector<std::shared_ptr<modifiers::Modifier>> modifiers,
39 const std::shared_ptr<parameters::Parameters>& options = {},
bool setFromOptions =
true);
53 const std::vector<std::shared_ptr<FieldDescriptor>> fieldDescriptors;
56 std::vector<Field> fields;
59 std::vector<std::shared_ptr<SubDomain>> subDomains;
64 void CreateStructures();
67 std::vector<std::shared_ptr<modifiers::Modifier>> modifiers;
70 PetscOptions petscOptions =
nullptr;
73 [[nodiscard]]
const std::string& GetName()
const {
return name; }
75 inline DM& GetDM() noexcept {
return dm; }
89 [[nodiscard]] PetscInt GetDimensions() const noexcept;
96 void InitializeSubDomains(const std::vector<std::shared_ptr<solver::Solver>>& solvers = {},
const std::shared_ptr<ablate::domain::Initializer>& initializations = {},
97 const std::vector<std::shared_ptr<mathFunctions::FieldFunction>>& = {});
104 void ProjectFieldFunctions(
const std::vector<std::shared_ptr<mathFunctions::FieldFunction>>& fieldFunctions, Vec globVec, PetscReal time = 0.0);
111 std::shared_ptr<SubDomain>
GetSubDomain(
const std::shared_ptr<Region>& name)
const;
123 [[nodiscard]]
inline const Field&
GetField(
int fieldId)
const {
return fields[fieldId]; }
125 [[nodiscard]]
inline const Field&
GetField(
const std::string_view& fieldName)
const {
126 auto field = std::find_if(fields.begin(), fields.end(), [&fieldName](
auto field) { return field.name == fieldName; });
127 if (field != fields.end()) {
130 throw std::invalid_argument(
"Cannot locate field with name " + std::string(fieldName) +
" in domain " + name);
139 [[nodiscard]]
inline const std::vector<Field>&
GetFields()
const {
return fields; }
Definition: domain.hpp:29
bool CheckFieldValues(Vec globSourceVector=nullptr)
Definition: domain.cpp:252
void InitializeSubDomains(const std::vector< std::shared_ptr< solver::Solver >> &solvers={}, const std::shared_ptr< ablate::domain::Initializer > &initializations={}, const std::vector< std::shared_ptr< mathFunctions::FieldFunction >> &={})
Definition: domain.cpp:143
void ProjectFieldFunctions(const std::vector< std::shared_ptr< mathFunctions::FieldFunction >> &fieldFunctions, Vec globVec, PetscReal time=0.0)
Definition: domain.cpp:198
void RegisterField(const ablate::domain::FieldDescription &fieldDescription)
Definition: domain.cpp:71
std::vector< std::weak_ptr< io::Serializable > > GetSerializableSubDomains()
Definition: domain.cpp:190
const Field & GetField(int fieldId) const
Definition: domain.hpp:123
static const std::string solution_vector_name
The name of the solution field vector.
Definition: domain.hpp:32
static const std::string aux_vector_name
The name of the aux field vector.
Definition: domain.hpp:35
const std::vector< Field > & GetFields() const
Definition: domain.hpp:139
std::shared_ptr< SubDomain > GetSubDomain(const std::shared_ptr< Region > &name) const
Definition: domain.cpp:123
Vec GetSolutionVector()
Definition: domain.hpp:81
Definition: loggable.hpp:9
Definition: nonCopyable.hpp:9
Definition: fieldDescription.hpp:20