Skip to content
Open
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
1 change: 1 addition & 0 deletions src/observers/VertexCFD_Compute_ErrorNorms_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void ErrorNorms<Scalar>::ComputeNorms(
in_args.ghostedContainer_ = _lof->buildGhostedLinearObjContainer();
in_args.evaluate_transient_terms = false;
in_args.time = working_state->getTime();
in_args.step_size = working_state->getTimeStep();

_lof->initializeGhostedContainer(panzer::LinearObjContainer::X,
*(in_args.ghostedContainer_));
Expand Down
2 changes: 2 additions & 0 deletions src/observers/VertexCFD_Compute_Volume_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ void Volume<Scalar>::ComputeVol()
in_args.container_ = _lof->buildLinearObjContainer();
in_args.ghostedContainer_ = _lof->buildGhostedLinearObjContainer();
in_args.evaluate_transient_terms = false;
in_args.time = 0.0;
in_args.step_size = 0.0;

_lof->initializeGhostedContainer(panzer::LinearObjContainer::X
| panzer::LinearObjContainer::F
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ void ResponseOutput<Scalar>::outputResponses(

// Evaluate responses.
const auto state = integrator.getSolutionHistory()->getCurrentState();
_response_manager->evaluateResponses(state->getX(), state->getXDot());
_response_manager->evaluateResponses(state->getX(), state->getXDot(),
state->getTime(), state->getTimeStep());

// Outupt the integrated values.
_ostream << "Scalar Responses:\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ void GlobalCFL<Scalar>::setNextTimeStep(

// Get minimum time step that ensures CFL <= 1
_response_manager.evaluateResponses(working_state->getX(),
working_state->getXDot());
working_state->getXDot(),
working_state->getTime(),
working_state->getTimeStep());
const double dt_cfl1 = _response_manager.value();

// Compute linear weight based on input parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ void GlobalTimeStep<Scalar>::setNextTimeStep(

// Get minimum time step that ensures CFL <= 1
_response_manager.evaluateResponses(working_state->getX(),
working_state->getXDot());
working_state->getXDot(),
working_state->getTime(),
working_state->getTimeStep());
const double dt_cfl1 = _response_manager.value();

// Get time step index (1-based) and compute linear weight
Expand Down
6 changes: 5 additions & 1 deletion src/responses/VertexCFD_ResponseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ void ResponseManager::deactivateAll()
//---------------------------------------------------------------------------//
void ResponseManager::evaluateResponses(
const Teuchos::RCP<Thyra::VectorBase<double>>& x,
const Teuchos::RCP<Thyra::VectorBase<double>>& x_dot)
const Teuchos::RCP<Thyra::VectorBase<double>>& x_dot,
const double t,
const double dt)
{
const int num_active
= std::count(_is_active.begin(), _is_active.end(), true);
Expand All @@ -224,6 +226,8 @@ void ResponseManager::evaluateResponses(
auto in_args = model_evaluator->createInArgs();
auto out_args = model_evaluator->createOutArgs();

in_args.set_t(t);
in_args.set_step_size(dt);
in_args.set_x(x);
in_args.set_x_dot(x_dot);

Expand Down
4 changes: 3 additions & 1 deletion src/responses/VertexCFD_ResponseManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class ResponseManager
void deactivateAll();
void
evaluateResponses(const Teuchos::RCP<Thyra::VectorBase<double>>& x,
const Teuchos::RCP<Thyra::VectorBase<double>>& x_dot);
const Teuchos::RCP<Thyra::VectorBase<double>>& x_dot,
const double t,
const double dt);

int numResponses() const;
int globalIndex(const int index = 0) const;
Expand Down
10 changes: 5 additions & 5 deletions src/responses/unit_test/tstResponseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void testResponseManager(const int basis_order)
testScalarParameters<panzer::Traits::Tangent>(true, physics_manager);

auto [x, x_dot] = helper.getSolutionVectors();
response_manager.evaluateResponses(x, x_dot);
response_manager.evaluateResponses(x, x_dot, 0.0, 0.0);

EXPECT_DOUBLE_EQ(4.0, response_manager.value(0));
EXPECT_DOUBLE_EQ(6.0, response_manager.value(1));
Expand Down Expand Up @@ -282,8 +282,8 @@ TEST(MultipleResponseManagers, NameToIndexBug)
EXPECT_EQ(1, v_index);

auto [x, x_dot] = helper.getSolutionVectors();
rm1.evaluateResponses(x, x_dot);
rm2.evaluateResponses(x, x_dot);
rm1.evaluateResponses(x, x_dot, 0.0, 0.0);
rm2.evaluateResponses(x, x_dot, 0.0, 0.0);

double u_integral = std::numeric_limits<double>::quiet_NaN();
EXPECT_NO_THROW(u_integral = rm1.value("u integral"));
Expand Down Expand Up @@ -322,8 +322,8 @@ TEST(MultipleResponseManagers, NameLookupBug)
// Evaluate both response managers, which will also set values in the
// parameter library.
auto [x, x_dot] = helper.getSolutionVectors();
rm1.evaluateResponses(x, x_dot);
rm2.evaluateResponses(x, x_dot);
rm1.evaluateResponses(x, x_dot, 0.0, 0.0);
rm2.evaluateResponses(x, x_dot, 0.0, 0.0);

// With the bug, the "u_integral" parameter gets overwritten and
// "v_integral" is never set.
Expand Down
1 change: 1 addition & 0 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ add_library(Utils ${UTILS_SOURCES})
target_link_libraries(Utils PUBLIC
MPI::MPI_CXX
Kokkos::kokkos
Phalanx::phalanx
)

target_include_directories(Utils
Expand Down