-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat: Introduce full tensor permeability #2822
base: develop
Are you sure you want to change the base?
Changes from 2 commits
b8f4c46
ea3fd3b
638a410
b740ec4
eb1fa9a
ce54941
5274772
5a10e64
a9314e2
e4c929a
cc53d0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,38 @@ namespace constitutive | |
ConstantPermeability::ConstantPermeability( string const & name, Group * const parent ): | ||
PermeabilityBase( name, parent ) | ||
{ | ||
registerWrapper( viewKeyStruct::permeabilityComponentsString(), &m_permeabilityComponents ). | ||
setInputFlag( InputFlags::REQUIRED ). | ||
registerWrapper( viewKeyStruct::diagonalPermeabilityTensorString(), &m_diagonalPermeabilityTensor ). | ||
setInputFlag( InputFlags::OPTIONAL ). | ||
setRestartFlags( RestartFlags::NO_WRITE ). | ||
setApplyDefaultValue(-1.0) | ||
setDescription( "xx, yy and zz components of a diagonal permeability tensor." ); | ||
|
||
registerWrapper( viewKeyStruct::symmetricFullPermabilityTensorString(), &m_symmetricFullPermeabilityTensor ). | ||
setInputFlag( InputFlags::OPTIONAL ). | ||
setRestartFlags( RestartFlags::NO_WRITE ). | ||
setApplyDefaultValue(-1.0). | ||
setDescription( "xx, yy and zz, xz, yz, xy components of a symmetric permeability tensor." ); | ||
} | ||
|
||
ConstantPermeability::postProcessInput() | ||
{ | ||
GEOS_ERROR_IF( m_diagonalPermeabilityTensor[0] < 0.0 && m_symmetricFullPermeabilityTensor[0] < 0.0, | ||
"Either a diagonal permeability tensor or a full tensor must be provided."); | ||
|
||
GEOS_ERROR_IF( m_diagonalPermeabilityTensor[0] > 0.0 && m_symmetricFullPermeabilityTensor[0] > 0.0, | ||
"Only one between a diagonal permeability tensor and a full tensor permeability can be provided."); | ||
|
||
if ( m_diagonalPermeabilityTensor[0] > 0.0 ) | ||
{ | ||
for( int i = 0; i < 3; i++ ) | ||
{ | ||
m_symmetricFullPermeabilityTensor[i] = m_diagonalPermeabilityTensor[i]; | ||
} | ||
for( int j=4; j < 6; i++ ) | ||
{ | ||
m_symmetricFullPermeabilityTensor[i] = 0.0; | ||
} | ||
} | ||
} | ||
|
||
std::unique_ptr< ConstitutiveBase > | ||
|
@@ -54,9 +82,8 @@ void ConstantPermeability::allocateConstitutiveData( dataRepository::Group & par | |
{ | ||
for( localIndex q = 0; q < numQuad; ++q ) | ||
{ | ||
m_permeability[ei][q][0] = m_permeabilityComponents[0]; | ||
m_permeability[ei][q][1] = m_permeabilityComponents[1]; | ||
m_permeability[ei][q][2] = m_permeabilityComponents[2]; | ||
for ( int c=0; c < 6; c++) | ||
m_permeability[ei][q][c] = m_symmetricFullPermeabilityTensor[c]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we enforce positiveness of diagonal component here ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should really throw an error earlier if someone inputs a negative value but, for now, I am using the default negative value to distinguish whether a diagonal or a full tensor was provided so I need to improve that logic fist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One option would be to simply provide 2 R1Tensors one for the main diagonal and one for the off diagonal terms and have the off diagonal components default to 0.0 if not provided. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noticed that the order would be imposed by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, and it's different from the one used by |
||
} | ||
} | ||
} | ||
|
@@ -67,18 +94,21 @@ void ConstantPermeability::initializeState() const | |
integer constexpr numQuad = 1; // NOTE: enforcing 1 quadrature point | ||
|
||
auto permView = m_permeability.toView(); | ||
real64 const permComponents[3] = { m_permeabilityComponents[0], | ||
m_permeabilityComponents[1], | ||
m_permeabilityComponents[2] }; | ||
real64 const permComponents[3] = { m_symmetricFullPermeabilityTensor[0], | ||
m_symmetricFullPermeabilityTensor[1], | ||
m_symmetricFullPermeabilityTensor[2], | ||
m_symmetricFullPermeabilityTensor[3], | ||
m_symmetricFullPermeabilityTensor[4], | ||
m_symmetricFullPermeabilityTensor[5] }; | ||
|
||
forAll< parallelDevicePolicy<> >( numE, [=] GEOS_HOST_DEVICE ( localIndex const ei ) | ||
{ | ||
for( localIndex q = 0; q < numQuad; ++q ) | ||
{ | ||
for( integer dim=0; dim < 3; ++dim ) | ||
for( integer dim=0; dim < 6; ++dim ) | ||
{ | ||
// The default value is -1 so if it still -1 it needs to be set to something physical | ||
if( permView[ei][q][0] < 0 ) | ||
if( permView[ei][q][dim] < 0 ) | ||
{ | ||
permView[ei][q][dim] = permComponents[dim]; | ||
} | ||
|
@@ -87,9 +117,6 @@ void ConstantPermeability::initializeState() const | |
} ); | ||
} | ||
|
||
void ConstantPermeability::postProcessInput() | ||
{} | ||
|
||
REGISTER_CATALOG_ENTRY( ConstitutiveBase, ConstantPermeability, string const &, Group * const ) | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,8 +204,9 @@ BoundaryStencilWrapper:: | |
auto const compute = [&] | ||
{ | ||
real64 faceConormal[3]; | ||
LvArray::tensorOps::hadamardProduct< 3 >( faceConormal, coef, faceNormal ); | ||
LvArray::tensorOps::Ri_eq_symAijBj< 3 >( faceConormal, coef, faceNormal ) | ||
CusiniM marked this conversation as resolved.
Show resolved
Hide resolved
|
||
weight = LvArray::tensorOps::AiBi< 3 >( cellToFace, faceConormal ); | ||
// Matteo: this one also has to change! | ||
LvArray::tensorOps::hadamardProduct< 3 >( dWeight_dCoef, cellToFace, faceNormal ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure about how this one should change. |
||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.