Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
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'.\n" );

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

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