Skip to content
Merged
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
13 changes: 5 additions & 8 deletions libsrc/pylith/feassemble/IntegratorBoundary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,9 @@ pylith::feassemble::IntegratorBoundary::initialize(const pylith::topology::Field

Integrator::initialize(solution);

assert(_auxiliaryField);
PetscErrorCode err;
PetscDM dmSoln = solution.getDM();assert(dmSoln);
PetscDMLabel dmLabel = NULL;
err = DMGetLabel(dmSoln, _labelName.c_str(), &dmLabel);PYLITH_CHECK_ERROR(err);assert(dmLabel);
err = DMSetAuxiliaryVec(dmSoln, dmLabel, _labelValue, LHS, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMSetAuxiliaryVec(dmSoln, dmLabel, _labelValue, RHS, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);

pythia::journal::debug_t debug(GenericComponent::getName());
if (debug.state()) {
assert(_auxiliaryField);
PYLITH_JOURNAL_DEBUG("Viewing auxiliary field.");
_auxiliaryField->view("Auxiliary field");
} // if
Expand Down Expand Up @@ -245,6 +238,7 @@ pylith::feassemble::IntegratorBoundary::computeRHSResidual(pylith::topology::Fie
assert(residual->getLocalVector());
PetscVec solutionDotVec = NULL;
err = DMGetCoordinateField(_dsLabel->dm(), &coordField);PYLITH_CHECK_ERROR(err);
err = DMSetAuxiliaryVec(_dsLabel->dm(), key.label, key.value, key.part, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMPlexComputeBdResidualSingleByKey(_dsLabel->dm(), _dsLabel->weakForm(), key, _dsLabel->pointsIS(), solution->getLocalVector(),
solutionDotVec, t, coordField, residual->getLocalVector());PYLITH_CHECK_ERROR(err);

Expand Down Expand Up @@ -283,6 +277,7 @@ pylith::feassemble::IntegratorBoundary::computeLHSResidual(pylith::topology::Fie
assert(solution->getLocalVector());
assert(residual->getLocalVector());
err = DMGetCoordinateField(_dsLabel->dm(), &coordField);PYLITH_CHECK_ERROR(err);
err = DMSetAuxiliaryVec(_dsLabel->dm(), key.label, key.value, key.part, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMPlexComputeBdResidualSingleByKey(_dsLabel->dm(), _dsLabel->weakForm(), key, _dsLabel->pointsIS(), solution->getLocalVector(),
solutionDot->getLocalVector(), t, coordField, residual->getLocalVector());PYLITH_CHECK_ERROR(err);

Expand Down Expand Up @@ -352,7 +347,9 @@ pylith::feassemble::IntegratorBoundary::_computeDiagnosticField(void) {
PetscDM diagnosticDM = _diagnosticField->getDM();
PetscDMLabel diagnosticFieldLabel = NULL;
const PetscInt labelValue = 1;
const PetscInt part = 0;
err = DMGetLabel(diagnosticDM, "output", &diagnosticFieldLabel);PYLITH_CHECK_ERROR(err);
err = DMSetAuxiliaryVec(diagnosticDM, diagnosticFieldLabel, labelValue, part, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMProjectBdFieldLabelLocal(diagnosticDM, t, diagnosticFieldLabel, 1, &labelValue, PETSC_DETERMINE, NULL, _auxiliaryField->getLocalVector(), kernelsArray, INSERT_VALUES, _diagnosticField->getLocalVector());PYLITH_CHECK_ERROR(err);
delete[] kernelsArray;kernelsArray = NULL;

Expand Down
12 changes: 4 additions & 8 deletions libsrc/pylith/feassemble/IntegratorDomain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,6 @@ pylith::feassemble::IntegratorDomain::initialize(const pylith::topology::Field&
Integrator::initialize(solution);

assert(_auxiliaryField);
PetscErrorCode err;
PetscDM dmSoln = solution.getDM();assert(dmSoln);
PetscDMLabel dmLabel = NULL;
err = DMGetLabel(dmSoln, _labelName.c_str(), &dmLabel);PYLITH_CHECK_ERROR(err);assert(dmLabel);
err = DMSetAuxiliaryVec(dmSoln, dmLabel, _labelValue, LHS, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMSetAuxiliaryVec(dmSoln, dmLabel, _labelValue, RHS, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMSetAuxiliaryVec(dmSoln, dmLabel, _labelValue, LHS_LUMPED_INV, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);

if (_kernelsUpdateStateVars.size() > 0) {
delete _updateState;_updateState = new pylith::feassemble::UpdateStateVars;assert(_updateState);
_updateState->initialize(*_auxiliaryField);
Expand Down Expand Up @@ -419,6 +411,7 @@ pylith::feassemble::IntegratorDomain::computeRHSResidual(pylith::topology::Field
assert(solution->getLocalVector());
assert(residual->getLocalVector());
PetscVec solutionDotVec = NULL;
err = DMSetAuxiliaryVec(_dsLabel->dm(), key.label, key.value, key.part, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMPlexComputeResidualByKey(_dsLabel->dm(), key, _dsLabel->pointsIS(), PETSC_MIN_REAL, solution->getLocalVector(),
solutionDotVec, t, residual->getLocalVector(), NULL);PYLITH_CHECK_ERROR(err);

Expand Down Expand Up @@ -456,6 +449,7 @@ pylith::feassemble::IntegratorDomain::computeLHSResidual(pylith::topology::Field
assert(solution->getLocalVector());
assert(solutionDot->getLocalVector());
assert(residual->getLocalVector());
err = DMSetAuxiliaryVec(_dsLabel->dm(), key.label, key.value, key.part, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMPlexComputeResidualByKey(_dsLabel->dm(), key, _dsLabel->pointsIS(), PETSC_MIN_REAL, solution->getLocalVector(),
solutionDot->getLocalVector(), t, residual->getLocalVector(), NULL);PYLITH_CHECK_ERROR(err);

Expand Down Expand Up @@ -497,6 +491,7 @@ pylith::feassemble::IntegratorDomain::computeLHSJacobian(PetscMat jacobianMat,
assert(solutionDot->getLocalVector());
assert(jacobianMat);
assert(precondMat);
err = DMSetAuxiliaryVec(_dsLabel->dm(), key.label, key.value, key.part, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMPlexComputeJacobianByKey(_dsLabel->dm(), key, _dsLabel->pointsIS(), t, s_tshift, solution->getLocalVector(),
solutionDot->getLocalVector(), jacobianMat, precondMat, NULL);PYLITH_CHECK_ERROR(err);

Expand Down Expand Up @@ -548,6 +543,7 @@ pylith::feassemble::IntegratorDomain::computeLHSJacobianLumpedInv(pylith::topolo

assert(jacobianInv);
assert(jacobianInv->getLocalVector());
err = DMSetAuxiliaryVec(_dsLabel->dm(), key.label, key.value, key.part, _auxiliaryField->getLocalVector());PYLITH_CHECK_ERROR(err);
err = DMPlexComputeJacobianActionByKey(_dsLabel->dm(), key, _dsLabel->pointsIS(), t, s_tshift, vecRowSum, NULL,
vecRowSum, jacobianInv->getLocalVector(), NULL);PYLITH_CHECK_ERROR(err);

Expand Down
12 changes: 3 additions & 9 deletions tests/fullscale/poroelasticity/cryer/generate_gmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,21 @@ def mark(self):
dim=2,
entities=[self.s_shell],
),
BoundaryGroup(
name="boundary_shell_copy",
tag=11,
dim=2,
entities=[self.s_shell],
),
BoundaryGroup(
name="boundary_zneg",
tag=12,
tag=11,
dim=2,
entities=[self.s_zneg],
),
BoundaryGroup(
name="boundary_yneg",
tag=13,
tag=12,
dim=2,
entities=[self.s_yneg],
),
BoundaryGroup(
name="boundary_xneg",
tag=14,
tag=13,
dim=2,
entities=[self.s_xneg],
),
Expand Down
Binary file modified tests/fullscale/poroelasticity/cryer/mesh_tet.msh
Binary file not shown.
10 changes: 5 additions & 5 deletions tests/fullscale/poroelasticity/cryer/pylithapp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ db_auxiliary_field.description = Dirichlet BC on surface

# ------------------------------------------------------------------------------
[pylithapp.problem.bc.bc_shell_traction]
label = boundary_shell_copy
label_value = 11
label = boundary_shell
label_value = 10
field = displacement
scale_name = stress

Expand All @@ -141,7 +141,7 @@ auxiliary_subfields.initial_amplitude.basis_order = 0
# ------------------------------------------------------------------------------
[pylithapp.problem.bc.bc_xneg]
label = boundary_xneg
label_value = 14
label_value = 13
field = displacement
constrained_dof = [0]

Expand All @@ -151,7 +151,7 @@ db_auxiliary_field.description = Dirichlet BC on -x
# ------------------------------------------------------------------------------
[pylithapp.problem.bc.bc_yneg]
label = boundary_yneg
label_value = 13
label_value = 12
field = displacement
constrained_dof = [1]

Expand All @@ -161,7 +161,7 @@ db_auxiliary_field.description = Dirichlet BC on -y
# ------------------------------------------------------------------------------
[pylithapp.problem.bc.bc_zneg]
label = boundary_zneg
label_value = 12
label_value = 11
field = displacement
constrained_dof = [2]

Expand Down
6 changes: 0 additions & 6 deletions tests/fullscale/poroelasticity/terzaghi/generate_gmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ def mark(self):
dim=1,
entities=[self.l_ypos],
),
BoundaryGroup(
name="boundary_ypos_copy",
tag=14,
dim=1,
entities=[self.l_ypos],
),
)
for group in face_groups:
group.create_physical_group()
Expand Down
Binary file modified tests/fullscale/poroelasticity/terzaghi/mesh_quad.msh
Binary file not shown.
Binary file modified tests/fullscale/poroelasticity/terzaghi/mesh_tri.msh
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/fullscale/poroelasticity/terzaghi/pylithapp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ auxiliary_subfields.initial_amplitude.basis_order = 0

# ------------------------------------------------------------------------------
[pylithapp.problem.bc.bc_ypos_pressure]
label = boundary_ypos_copy
label_value = 14
label = boundary_ypos
label_value = 13
field = pressure

constrained_dof = [0]
Expand Down