Skip to content

Always use grad q to evaluate rhs of q eq #77

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

Merged
merged 1 commit into from
May 14, 2022
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
26 changes: 0 additions & 26 deletions source/EllipticFACSolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,6 @@
// This file is part of AMPE.
// For details, see https://github.com/LLNL/AMPE
// Please also read AMPE/LICENSE.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or other materials provided with the distribution.
// - Neither the name of the LLNS/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
// LLC, UT BATTELLE, LLC,
// THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#include "EllipticFACSolver.h"
#include "EllipticFACOps.h"
Expand Down Expand Up @@ -253,13 +229,11 @@ void EllipticFACSolver::setBoundaries(const std::string& boundary_type,
const int fluxes, const int flags,
int* bdry_types)
{
#ifdef DEBUG_CHECK_ASSERTIONS
if (d_bc_object != NULL && d_bc_object != &d_simple_bc) {
TBOX_ERROR(d_object_name << ": Bad attempt to set boundary condition\n"
<< "by using default bc object after it has "
"been overriden.\n");
}
#endif
d_simple_bc.setBoundaries(boundary_type, fluxes, flags, bdry_types);
d_bc_object = &d_simple_bc;
d_fac_ops->setPhysicalBcCoefObject(d_bc_object);
Expand Down
26 changes: 1 addition & 25 deletions source/QuatFACOps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,6 @@
// This file is part of AMPE.
// For details, see https://github.com/LLNL/AMPE
// Please also read AMPE/LICENSE.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or other materials provided with the distribution.
// - Neither the name of the LLNS/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
// LLC, UT BATTELLE, LLC,
// THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
/*
* This class provides operator specific functions supporting
Expand Down Expand Up @@ -2026,7 +2002,7 @@ void QuatFACOps::evaluateRHS(
{
t_compute_rhs->start();

assert(grad_q_id >= 0);
if (use_gradq_for_flux) assert(grad_q_id >= 0);
assert(grad_q_copy_id >= 0);

d_rotation_index_id = rotation_index_id;
Expand Down
13 changes: 8 additions & 5 deletions source/QuatIntegrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2762,20 +2762,23 @@ void QuatIntegrator::evaluateConcentrationRHS(
//-----------------------------------------------------------------------

void QuatIntegrator::evaluateQuatRHS(
std::shared_ptr<hier::PatchHierarchy> hierarchy, const int quat_id,
const int quat_rhs_id, const bool visit_flag)
std::shared_ptr<hier::PatchHierarchy> hierarchy, const int quat_rhs_id,
const bool visit_flag)
{
assert(d_quat_sys_solver);
assert(d_quat_grad_side_id >= 0);

// tbox::pout<<"QuatIntegrator::evaluateQuatRHS()"<<endl;
// tbox::plog<<"QuatIntegrator::evaluateQuatRHS()"<<std::endl;
int quat_symm_rotation_id =
d_use_gradq_for_flux ? d_quat_symm_rotation_id : -1;

// compute RHS using the gradient of q at sides (d_quat_grad_side_id)
// computed with physical BC
d_quat_sys_solver->evaluateRHS(d_epsilon_q, d_quat_grad_floor,
d_quat_smooth_floor_type, d_quat_diffusion_id,
d_quat_grad_side_id, d_quat_grad_side_copy_id,
quat_symm_rotation_id, d_quat_mobility_id,
quat_id, quat_rhs_id, d_use_gradq_for_flux);
d_quat_scratch_id, quat_rhs_id, true);


if (visit_flag && d_model_parameters.with_rhs_visit_output())
Expand Down Expand Up @@ -2810,7 +2813,7 @@ void QuatIntegrator::evaluateQuatRHS(
// doesn't know about symmetry!
if (d_symmetry_aware && !d_use_gradq_for_flux) {
// tbox::pout<<"Correct r.h.s. for symmetry..."<<endl;
correctRhsForSymmetry(hierarchy, quat_id, quat_rhs_id);
correctRhsForSymmetry(hierarchy, d_quat_scratch_id, quat_rhs_id);
}

if (visit_flag && d_model_parameters.with_rhs_visit_output()) {
Expand Down
5 changes: 2 additions & 3 deletions source/QuatIntegrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class QuatIntegrator : public mesh::StandardTagAndInitStrategy
const int ydot_quat_id =
y_dot_samvect->getComponentDescriptorIndex(d_quat_component_index);

evaluateQuatRHS(hierarchy, d_quat_scratch_id, ydot_quat_id, fd_flag == 0);
evaluateQuatRHS(hierarchy, ydot_quat_id, fd_flag == 0);
}

void evaluateTemperatureRHS(
Expand Down Expand Up @@ -583,8 +583,7 @@ class QuatIntegrator : public mesh::StandardTagAndInitStrategy
const int temperature_rhs_id,
const bool visit_flag);
void evaluateQuatRHS(std::shared_ptr<hier::PatchHierarchy> hierarchy,
const int quat_id, const int quat_rhs_id,
const bool visit_flag);
const int quat_rhs_id, const bool visit_flag);

void correctRhsForSymmetry(
const std::shared_ptr<hier::PatchHierarchy> hierarchy, const int,
Expand Down
52 changes: 3 additions & 49 deletions source/QuatSysSolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,6 @@
// This file is part of AMPE.
// For details, see https://github.com/LLNL/AMPE
// Please also read AMPE/LICENSE.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or other materials provided with the distribution.
// - Neither the name of the LLNS/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
// LLC, UT BATTELLE, LLC,
// THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
/*
* This class is a high-level wrapper for a quaternion system
Expand Down Expand Up @@ -196,8 +172,10 @@ void QuatSysSolver::initializeSolverState(
const int q_soln_id, const int q_rhs_id, const int weight_id,
std::shared_ptr<hier::PatchHierarchy> hierarchy)
{
TBOX_ASSERT(hierarchy);
assert(hierarchy);
assert(q_soln_id >= 0);
assert(q_rhs_id >= 0);
assert(weight_id >= 0);

if (d_bc_object == NULL) {
TBOX_ERROR(d_object_name << ": No BC coefficient strategy object!\n"
Expand All @@ -207,18 +185,6 @@ void QuatSysSolver::initializeSolverState(
}

if (!d_solver_is_initialized) {
#ifdef DEBUG_CHECK_ASSERTIONS
if (q_soln_id < 0 || q_rhs_id < 0 || weight_id < 0) {
TBOX_ERROR(d_object_name << ": Bad patch data id.\n");
}
#endif

#ifdef DEBUG_CHECK_ASSERTIONS
if (!hierarchy) {
TBOX_ERROR(d_object_name << ": NULL hierarchy pointer not allowed\n"
<< "in inititialization.");
}
#endif
d_hierarchy = hierarchy;

d_ln_min = 0;
Expand Down Expand Up @@ -277,14 +243,6 @@ void QuatSysSolver::deallocateSolverState()
// Deallocate FAC preconditioner
d_fac_solver.deallocateSolverState();

/*
* Delete internally managed data.
*/
// int ln;
// for ( ln=d_ln_min; ln<=d_ln_max; ++ln ) {
// d_hierarchy->getPatchLevel(ln)->deallocatePatchData(d_weight_id);
// }

d_hierarchy.reset();
d_ln_min = -1;
d_ln_max = -1;
Expand All @@ -299,13 +257,11 @@ void QuatSysSolver::setBoundaries(const std::string& boundary_type,
const int fluxes, const int flags,
int* bdry_types)
{
#ifdef DEBUG_CHECK_ASSERTIONS
if (d_bc_object != NULL && d_bc_object != &d_simple_bc) {
TBOX_ERROR(d_object_name << ": Bad attempt to set boundary condition\n"
<< "by using default bc object after it has "
"been overriden.\n");
}
#endif
d_simple_bc.setBoundaries(boundary_type, fluxes, flags, bdry_types);
d_bc_object = &d_simple_bc;
d_fac_ops->setPhysicalBcCoefObject(d_bc_object);
Expand Down Expand Up @@ -462,9 +418,7 @@ void QuatSysSolver::createVectorWrappers(
int q_u, int q_f, std::shared_ptr<solv::SAMRAIVectorReal<double> >& uv,
std::shared_ptr<solv::SAMRAIVectorReal<double> >& fv)
{
#ifdef DEBUG_CHECK_ASSERTIONS
assert(d_weight_id != -1);
#endif

hier::VariableDatabase& vdb(*hier::VariableDatabase::getDatabase());
std::shared_ptr<hier::Variable> variable;
Expand Down