Revision d0bb2b64423f741556a2d86fa29cf13a053ca4be authored by Lars Bilke on 24 November 2022, 13:37:50 UTC, committed by Lars Bilke on 25 November 2022, 13:54:51 UTC
1 parent 462a3e8
TwoPhaseFlowWithPrhoProcess.cpp
/**
* \file
* \copyright
* Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "TwoPhaseFlowWithPrhoProcess.h"
#include "ProcessLib/Utils/CreateLocalAssemblers.h"
#include "TwoPhaseFlowWithPrhoLocalAssembler.h"
namespace ProcessLib
{
namespace TwoPhaseFlowWithPrho
{
TwoPhaseFlowWithPrhoProcess::TwoPhaseFlowWithPrhoProcess(
std::string name,
MeshLib::Mesh& mesh,
std::unique_ptr<AbstractJacobianAssembler>&& jacobian_assembler,
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
unsigned const integration_order,
std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
process_variables,
TwoPhaseFlowWithPrhoProcessData&& process_data,
SecondaryVariableCollection&& secondary_variables,
BaseLib::ConfigTree const& /*config*/,
std::map<std::string,
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
/*curves*/)
: Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
integration_order, std::move(process_variables),
std::move(secondary_variables)),
_process_data(std::move(process_data))
{
DBUG("Create TwoPhaseFlowProcess with Prho model.");
}
void TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess(
NumLib::LocalToGlobalIndexMap const& dof_table,
MeshLib::Mesh const& mesh,
unsigned const integration_order)
{
ProcessLib::createLocalAssemblers<TwoPhaseFlowWithPrhoLocalAssembler>(
mesh.getDimension(), mesh.getElements(), dof_table, _local_assemblers,
NumLib::IntegrationOrder{integration_order}, mesh.isAxiallySymmetric(),
_process_data);
_secondary_variables.addSecondaryVariable(
"saturation",
makeExtrapolator(
1, getExtrapolator(), _local_assemblers,
&TwoPhaseFlowWithPrhoLocalAssemblerInterface::getIntPtSaturation));
_secondary_variables.addSecondaryVariable(
"pressure_nonwetting",
makeExtrapolator(1, getExtrapolator(), _local_assemblers,
&TwoPhaseFlowWithPrhoLocalAssemblerInterface::
getIntPtNonWettingPressure));
}
void TwoPhaseFlowWithPrhoProcess::assembleConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& xdot, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b)
{
DBUG("Assemble TwoPhaseFlowWithPrhoProcess.");
std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
dof_table = {std::ref(*_local_to_global_index_map)};
ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
// Call global assembler for each local assembly item.
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers,
pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K,
b);
}
void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& xdot, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
{
DBUG("AssembleWithJacobian TwoPhaseFlowWithPrhoProcess.");
std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
dof_table = {std::ref(*_local_to_global_index_map)};
ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
// Call global assembler for each local assembly item.
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot,
process_id, M, K, b, Jac);
}
void TwoPhaseFlowWithPrhoProcess::preTimestepConcreteProcess(
std::vector<GlobalVector*> const& x, double const t, double const dt,
const int process_id)
{
DBUG("PreTimestep TwoPhaseFlowWithPrhoProcess.");
ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
GlobalExecutor::executeSelectedMemberOnDereferenced(
&LocalAssemblerInterface::preTimestep, _local_assemblers,
pv.getActiveElementIDs(), *_local_to_global_index_map, *x[process_id],
t, dt);
}
} // namespace TwoPhaseFlowWithPrho
} // namespace ProcessLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...