Initialization step for physics solvers
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 287
- Forks
- 109
- Avg merge
- 4d 41m
- Merged PRs (30d)
- 5
Description
Describe the issue
We currently have a few different functions that can be used for initialization of the physics solvers. The role of each one of them is not always clear so physics solvers tend to use them a bit inconsistently.
The initialization functions are:
initialize_postMeshGeneration(I am not sure this is still used)initializePreSubGroupsinitializePostSubGroupsinitializePostInitialConditionsPreSubGroupsinitializePostInitialConditionsPostSubGroups
Proposed cleanup
I propose to define what these functions do for a physics solver in SolverBase and have a final implementation there and then have physics solver specific functions to initialize things. Something like
void initialize_postMeshGeneration override final;
void initializePreSubGroups override final;
void initializePostSubGroups override final;
void initializePostInitialConditionsPreSubGroups override final;
void initializePostInitialConditionsPostSubGroups override final
{
initializePrimaryVariables();
initializeConstitutiveModels();
}
virtual void initializePrimaryVariables();
virtual void initializeConstitutiveModels();
This way we could avoid patterns which seem to be a bit arbitrary like the fact that this step is performed here https://github.com/GEOSX/GEOSX/blob/00dd40335a8b3dae72adb5ebc4e7b181e7b62051/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp#L231 but other initializations are performed here https://github.com/GEOSX/GEOSX/blob/00dd40335a8b3dae72adb5ebc4e7b181e7b62051/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp#L339 instead. Similarly, the linear algebra parameters for the physics solvers are not always set in the same function. These small inconsistencies make it hard when writing a coupled solver because the order in which things occur is not always clear.
I guess we could also introduce a new intialization step, less generic than the one provided by Group, which, for example, explicitly takes DomainPartition as an input.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading SolverBase and the initialization hooks listed in the issue, then compare the two referenced sections of src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp. Trace when each initialization function and the linear algebra setup runs. Done means the lifecycle is explicitly defined and physics-solver-specific initialization has a consistent, documented order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100