Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dsl/temporal operators #259

Merged
merged 22 commits into from
Feb 14, 2025
Merged

Conversation

HenningScheufler
Copy link
Collaborator

@HenningScheufler HenningScheufler commented Feb 9, 2025

Motivation

adds implicit temporal operator

included features in NeoFOAM:

  • replaced Operator by Spatial and TemporalOperator

Advantages:

  • one interface for spatialOperators and one for temporalOperators (Interface segregation principle)
  • No global timestep object is required. t and deltaT can easily be injected and the interface can be adapted if necessary
  • Operators are now either explicit or implicit. (Spatial and Temporal is included in the type)

Cons:

  • a bit more complex

included features in FoamAdapter:

  • test_implicitOperators
  • SourceTerms: explicit and implicit
  • DivOperators: explicit and implicit
  • TemporalOperators: explicit and implicit

ToDo:

  • improve code:
  • introduce new enum so we dont rely on SpatialOperator::Type
  • remove NeoFOAM/dsl/ddt.hpp?

Copy link

github-actions bot commented Feb 9, 2025

Deployed test documentation to https://exasim-project.com/NeoFOAM/Build_PR_259

@HenningScheufler
Copy link
Collaborator Author

@gregorweiss @greole @bevanwsjones @MarcelKoch

I would propose to not add any more features to this PR and focus on improving code quality and merge it as quickly as possible in stack/implicitOperator.

Currently, multiple PR adapt the DSL and introduce new features. If we quickly merge this PR, we can minimize the impact on the other PRs.

The next Milestone would be to implement scalarAdvection with implicitOperators:

With ideally required the following features:

  • runtime-selectable solvers
  • GPU solver support
  • handling of implicit boundaries

NeoFOAM::dsl::TemporalOperator ddtOperator = NeoFOAM::dsl::imp::ddt(vf);

// ddt(U) = f
auto eqn = ddtOperator + dummy;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto is a bit miss leading here

Copy link
Contributor

@greole greole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some quick comments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove usage of namespace NeoFOAM:: inside the NeoFOAM namespace.

{
public:

LinearSystem(VolumeField<ValueType>& psi)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use x or solution instead of psi?

);
}

Field<IndexType> diagIndex()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is diagIndex? Please add a docstring

@HenningScheufler HenningScheufler marked this pull request as ready for review February 13, 2025 17:31
@@ -57,91 +52,80 @@ class Expression
/* @brief perform all explicit operation and accumulate the result */
Field<scalar> explicitOperation(Field<scalar>& source)
{
for (auto& oper : explicitOperators_)
for (auto& oper : spatialOperators_)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using op would be more consistent, cf with loop in L.44

Suggested change
for (auto& oper : spatialOperators_)
for (auto& op : spatialOperators_)

} -> std::same_as<void>; // Adjust return type and arguments as needed
};

/* @class Operator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So most of the implementation is gone from here: can this file be removed all together otherwise maybe add some docstring why the Operator class is still needed and what the purpose is.

@HenningScheufler HenningScheufler merged commit 7dc90b1 into stack/implicitOperators Feb 14, 2025
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion dsl enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants