/** * \file * \copyright * Copyright (c) 2012-2021, 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 "SteadyStateDiffusion.h" #include #include "ProcessLib/Utils/CreateLocalAssemblers.h" namespace ProcessLib { namespace SteadyStateDiffusion { SteadyStateDiffusion::SteadyStateDiffusion( std::string name, MeshLib::Mesh& mesh, std::unique_ptr&& jacobian_assembler, std::vector> const& parameters, unsigned const integration_order, std::vector>>&& process_variables, SteadyStateDiffusionData&& process_data, SecondaryVariableCollection&& secondary_variables, std::unique_ptr&& surfaceflux) : 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)), _surfaceflux(std::move(surfaceflux)) { } void SteadyStateDiffusion::initializeConcreteProcess( NumLib::LocalToGlobalIndexMap const& dof_table, MeshLib::Mesh const& mesh, unsigned const integration_order) { ProcessLib::createLocalAssemblers( mesh.getDimension(), mesh.getElements(), dof_table, _local_assemblers, mesh.isAxiallySymmetric(), integration_order, _process_data); _secondary_variables.addSecondaryVariable( "darcy_velocity", makeExtrapolator(mesh.getDimension(), getExtrapolator(), _local_assemblers, &SteadyStateDiffusionLocalAssemblerInterface:: getIntPtDarcyVelocity)); } void SteadyStateDiffusion::assembleConcreteProcess( const double t, double const dt, std::vector const& x, std::vector const& xdot, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble SteadyStateDiffusion."); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; std::vector> dof_table = {std::ref(*_local_to_global_index_map)}; // 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 SteadyStateDiffusion::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, std::vector const& xdot, const double dxdot_dx, const double dx_dx, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian SteadyStateDiffusion."); ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; std::vector> dof_table = {std::ref(*_local_to_global_index_map)}; // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, dxdot_dx, dx_dx, process_id, M, K, b, Jac); } } // namespace SteadyStateDiffusion } // namespace ProcessLib