Skip to content

feat: support non-scalar valued field specifications #4034

Open
kdrienCG wants to merge 28 commits intodevelopfrom
feature/kdrienCG/nonScalarFieldSpecification
Open

feat: support non-scalar valued field specifications #4034
kdrienCG wants to merge 28 commits intodevelopfrom
feature/kdrienCG/nonScalarFieldSpecification

Conversation

@kdrienCG
Copy link
Copy Markdown

@kdrienCG kdrienCG commented Apr 22, 2026

This PR generalizes field specifications to support non-scalar values, notably scales (and so function names).

The following interface is proposed:

<FieldSpecification
   name="perm_wall"
   initialCondition="1"
   setNames="{ wall1, wall2 }"
   objectPath="ElementRegions/Region1/block1"
   fieldName="rockPerm_permeability"
   scales="{ 2.0e-22, 2.0e-22, 2.0e-22 }"
/>

Instead of:

<FieldSpecification
   name="permx_wall"
   component="0"
   initialCondition="1"
   setNames="{ wall1, wall2 }"
   objectPath="ElementRegions/Region1/block1"
   fieldName="rockPerm_permeability"
   scales="2.0e-22"
/>

<FieldSpecification
   name="permy_wall"
   component="1"
   initialCondition="1"
   setNames="{ wall1, wall2 }"
   objectPath="ElementRegions/Region1/block1"
   fieldName="rockPerm_permeability"
   scales="2.0e-22"
/>

<FieldSpecification
   name="permz_wall"
   component="2"
   initialCondition="1"
   setNames="{ wall1, wall2 }"
   objectPath="ElementRegions/Region1/block1"
   fieldName="rockPerm_permeability"
   scales="2.0e-22"
/>

This PR also add a regionNames array to make it easier to specify multiple regions.

Considerations

Implementations considerations:

Design choice

I added a separate scales attribute (on top of the already existing scale) and a functionNames attribute (on top of the already existing functionName) to keep backward compatibility with every input files.

The user must choose one way to describe its field specification,
either the scalar way:

<FieldSpecification
   ...
   functionName="func"
   scale="11"
   ...
/>

or the non-scalar way:

<FieldSpecification
   ...
   functionNames="{ func1, func2, func3 }"
   scales="{ 11, 12, 13 }"
   ...
/>

and will not be able to use both at the same time.

Other possible implementations

There are different ways this PR could have been implemented, like:

  • completly removing the scalar scale attribute in favor of a non-scalar scales
    • It would requires a massive refactor and break every input files (if no solution is found to treat scale="42" and scale="{ 42 }" as the same type)
  • use the blueprint/factory design (from feat: add PermeabilitySpecification as an high-level FieldSpecification #4019) to describe a new non-scalar component that creates multiple FieldSpecification
    • It would produce a lot of code duplication to have the same capabilities between all the new components (condensing multiple FieldSpecification in one, having a user-friendly way to specify a region, have similar validations etc.). Where those "high-level"/specialized components could be thin wrappers over this PR for custom validation, documentation, etc.
  • others.

@kdrienCG kdrienCG self-assigned this Apr 22, 2026
@kdrienCG kdrienCG added the type: feature New feature or request label Apr 22, 2026
@kdrienCG kdrienCG marked this pull request as ready for review May 4, 2026 08:38
@kdrienCG kdrienCG added ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI labels May 4, 2026
@kdrienCG kdrienCG added flag: requires rebaseline Requires rebaseline branch in integratedTests and removed flag: requires rebaseline Requires rebaseline branch in integratedTests labels May 6, 2026
@herve-gross herve-gross requested a review from bd713 May 6, 2026 16:10
@herve-gross
Copy link
Copy Markdown
Contributor

@rrsettgast does this work for you?

@kdrienCG kdrienCG removed the ci: run CUDA builds Allows to triggers (costly) CUDA jobs label May 7, 2026
Copy link
Copy Markdown
Member

@rrsettgast rrsettgast left a comment

Choose a reason for hiding this comment

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

Really only two potential issues I have:

  1. It seems like the tensorial specifications are a completely separate thing from the scalar specifications. They should be able to be made into the same thing.
  2. The introduction of regionNames seems like it is duplicating the objectPath capability but just cutting out the ElementRegions/regionName*? Can you comment on how the usage is improved?

objectPath="ElementRegions/Region1/block1"
fieldName="rockPerm_permeability"
scale="2.0e-22"/>
scales="{ 2.0e-22, 2.0e-22, 2.0e-22 }"/>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you can just leave this as scale?

Comment on lines +88 to +92
registerWrapper( viewKeyStruct::scalesString(), &m_scales ).
setInputFlag( InputFlags::OPTIONAL ).
setSizedFromParent( 0 ).
setDescription( "Apply scaling factors for the values of every component of the boundary condition." );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the driver to make a new m_scales instead of generalizing m_scale?

Comment on lines +71 to +77
registerWrapper( viewKeyStruct::functionNamesString(), &m_functionNames ).
setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ).
setInputFlag( InputFlags::OPTIONAL ).
setSizedFromParent( 0 ).
setDescription( "Names of per-component functions that specifies variation of the boundary condition.\n"
"Either left empty or sized exactly like 'scales'." );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

similar to the m_scales comment below. Can we generalize m_bcApplicaitonFunctionName to serve the role you have here for m_functionNames?

Comment on lines +433 to +434
/// @return The key for regionNames
constexpr static char const * regionNamesString() { return "regionNames"; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this to avoid ElementRegions/regionName type specifications in objectPath?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: run integrated tests Allows to run the integrated tests in GEOS CI flag: requires rebaseline Requires rebaseline branch in integratedTests type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants