Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c8adaac
add scales and functionNames attributes
kdrienCG Apr 22, 2026
67da13f
modify applyFieldValueKernel to accept non-scalar applications
kdrienCG Apr 22, 2026
e133dd2
add validations against scale(s) and functionName(s)
kdrienCG Apr 22, 2026
7c18352
add regionNames attribute to field specifications
kdrienCG Apr 23, 2026
2dc1751
add setRegionNames method
kdrienCG Apr 27, 2026
d5fbc7f
fix typo in log message parameter
kdrienCG Apr 27, 2026
e7af0f5
modify scales setter and getter
kdrienCG Apr 28, 2026
663a168
modify application methods to accept non-scalar field specifications
kdrienCG Apr 28, 2026
7e4f6a5
move region names construction
kdrienCG Apr 28, 2026
839d653
call FieldSpecification validations in subclasses
kdrienCG Apr 28, 2026
b0ae8d2
add doxygen comment for overloaded computeRhsContribution
kdrienCG Apr 28, 2026
e073b5f
rename isVectorMode() to usesNonScalarValues()
kdrienCG Apr 30, 2026
156ffc7
add functionNames check to usesNonScalarValues()
kdrienCG Apr 30, 2026
bfb53d5
update warning messages when combining scalars and non-scalars
kdrienCG Apr 30, 2026
d74a3d1
remove newline
kdrienCG Apr 30, 2026
f684f70
fix wrong variable used
kdrienCG May 4, 2026
28dbcff
add rst documentation
kdrienCG May 4, 2026
0ecdd93
modify one inputFiles to use the new feature
kdrienCG May 4, 2026
76d2297
uncrustify
kdrienCG May 4, 2026
27a5eb8
remove unnecessary newline character in Wrapper doc
kdrienCG May 4, 2026
d766df1
add schema
kdrienCG May 4, 2026
0013c0a
Merge branch 'develop' into feature/kdrienCG/nonScalarFieldSpecification
kdrienCG May 4, 2026
4c708e0
fix too short title underline
kdrienCG May 4, 2026
b0b3df9
add doxygen documentation
kdrienCG May 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions inputFiles/singlePhaseFlow/sourceFlux_2d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,31 +145,12 @@
scale="5e6"/>

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

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

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

<SourceFlux
name="sourceTerm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ AquiferBoundaryCondition::AquiferBoundaryCondition( string const & name, Group *

void AquiferBoundaryCondition::postInputInitialization()
{
FieldSpecificationBase::postInputInitialization();

GEOS_THROW_IF_LE_MSG( m_permeability, 0.0,
"The aquifer permeability cannot be equal to zero or negative",
InputError, getDataContext() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ EquilibriumInitialCondition::EquilibriumInitialCondition( string const & name, G

void EquilibriumInitialCondition::postInputInitialization()
{
FieldSpecificationBase::postInputInitialization();

FunctionManager const & functionManager = FunctionManager::getInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include "FieldSpecificationBase.hpp"

#include "common/format/StringUtilities.hpp"
#include "common/logger/Logger.hpp"
#include "fieldSpecification/FieldSpecificationManager.hpp"

namespace geos
Expand All @@ -39,6 +41,11 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Path to the target field" );

registerWrapper( viewKeyStruct::regionNamesString(), &m_regionNames ).
setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Names of the regions where the field specification is applied." );

registerWrapper( viewKeyStruct::fieldNameString(), &m_fieldName ).
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
setInputFlag( InputFlags::OPTIONAL ).
Expand All @@ -61,6 +68,13 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Name of function that specifies variation of the boundary condition." );

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'." );

registerWrapper( viewKeyStruct::bcApplicationTableNameString(), &m_bcApplicationFunctionName ).
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
setInputFlag( InputFlags::OPTIONAL ).
Expand All @@ -71,6 +85,11 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Apply a scaling factor for the value of the boundary condition." );

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

registerWrapper( viewKeyStruct::initialConditionString(), &m_initialCondition ).
setApplyDefaultValue( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
Expand Down Expand Up @@ -110,22 +129,66 @@ FieldSpecificationBase::getCatalog()
}


void FieldSpecificationBase::postInputInitialization()
{
GEOS_THROW_IF( !m_functionNames.empty() &&
m_functionNames.size() != static_cast< string_array::size_type >( m_scales.size() ),
GEOS_FMT ( "Size mismatch: '{}' has {} entries but '{}' has {}. "
"Either leave '{}' empty or size it exactly like '{}'",
viewKeyStruct::functionNamesString(), m_functionNames.size(),
viewKeyStruct::scalesString(), m_scales.size(),
viewKeyStruct::functionNamesString(), viewKeyStruct::scalesString() ),
InputError,
getDataContext() );

if( usesNonScalarValues() )
{
GEOS_THROW_IF( m_component != -1,
GEOS_FMT ( "'{}' must not be set when '{}' is set.",
viewKeyStruct::componentString(),
viewKeyStruct::scalesString() ),
InputError,
getDataContext() );

GEOS_THROW_IF( !m_functionName.empty(),
GEOS_FMT ( "'{}' must not be set when '{}' is set."
"Use '{}' to provide one function per component instead",
viewKeyStruct::functionNameString(),
viewKeyStruct::scalesString(),
viewKeyStruct::functionNamesString() ),
InputError,
getDataContext() );
}

if( !m_regionNames.empty() )
{
GEOS_THROW_IF( !m_objectPath.empty(),
GEOS_FMT ( "'{}' must not be set when '{}' is set.",
viewKeyStruct::objectPathString(),
viewKeyStruct::regionNamesString() ),
InputError,
getDataContext() );
}
}

void FieldSpecificationBase::setMeshObjectPath( Group const & meshBodies )
{
string const path = m_regionNames.empty()
? m_objectPath
: "ElementRegions/{" + stringutilities::join( m_regionNames, ' ' ) + "}";
try
{
m_meshObjectPaths = std::make_unique< MeshObjectPath >( m_objectPath, meshBodies );
m_meshObjectPaths = std::make_unique< MeshObjectPath >( path, meshBodies );
}
catch( std::exception const & e )
{
ErrorLogger::global().modifyCurrentExceptionMessage()
.addToMsg( getWrapperDataContext( viewKeyStruct::objectPathString() ).toString() +
" is a wrong objectPath: " + m_objectPath + "\n" )
" is a wrong objectPath: " + path + "\n" )
.addContextInfo( getWrapperDataContext( viewKeyStruct::objectPathString() ).getContextInfo()
.setPriority( 2 ) );
throw InputError( e, getWrapperDataContext( viewKeyStruct::objectPathString() ).toString() +
" is a wrong objectPath: " + m_objectPath + "\n" );
" is a wrong objectPath: " + path + "\n" );
}
}

Expand Down
Loading
Loading