Skip to content

Commit

Permalink
Merge pull request #1996 from wenqing/change_name
Browse files Browse the repository at this point in the history
Name change and new argument for a member function of process classes

1. Changed the names of structs,  variables that are related to the coupled terms.
2. Changed the name and the type of HTProcessData to HTMaterialProperties (std::unique_ptr).
3. Added an argument to a member function of classes of processes.
4. removed an unused include.

This PR is a part of PR #1970.
  • Loading branch information
endJunction authored Nov 23, 2017
2 parents 4a6b54d + 4d9d70c commit 3a0a3ab
Show file tree
Hide file tree
Showing 46 changed files with 248 additions and 220 deletions.
4 changes: 2 additions & 2 deletions ProcessLib/AbstractJacobianAssembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace ProcessLib
{
class LocalAssemblerInterface;
struct LocalCouplingTerm;
struct LocalCoupledSolutions;

//! Base class for Jacobian assemblers.
class AbstractJacobianAssembler
Expand All @@ -40,7 +40,7 @@ class AbstractJacobianAssembler
std::vector<double>& /*local_K_data*/,
std::vector<double>& /*local_b_data*/,
std::vector<double>& /*local_Jac_data*/,
LocalCouplingTerm const& /*coupling_term*/)
LocalCoupledSolutions const& /*coupled_solutions*/)
{
}

Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void ComponentTransportProcess::assembleConcreteProcess(
// Call global assembler for each local assembly item.
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers,
*_local_to_global_index_map, t, x, M, K, b, _coupling_term);
*_local_to_global_index_map, t, x, M, K, b, _coupled_solutions);
}

void ComponentTransportProcess::assembleWithJacobianConcreteProcess(
Expand All @@ -77,7 +77,7 @@ void ComponentTransportProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx,
dx_dx, M, K, b, Jac, _coupling_term);
dx_dx, M, K, b, Jac, _coupled_solutions);
}

} // namespace ComponentTransport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
* \file StaggeredCouplingTerm.cpp
* \file CoupledSolutionsForStaggeredScheme.cpp
*
* Created on November 7, 2016, 12:14 PM
*/

#include "StaggeredCouplingTerm.h"
#include "CoupledSolutionsForStaggeredScheme.h"

#include "MathLib/LinAlg/LinAlg.h"
#include "Process.h"

namespace ProcessLib
{
StaggeredCouplingTerm::StaggeredCouplingTerm(
CoupledSolutionsForStaggeredScheme::CoupledSolutionsForStaggeredScheme(
std::unordered_map<std::type_index, Process const&> const&
coupled_processes_,
std::unordered_map<std::type_index, GlobalVector const&> const& coupled_xs_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
* \file StaggeredCouplingTerm.h
* \file CoupledSolutionsForStaggeredScheme.h
*
* Created on November 7, 2016, 12:14 PM
*/
Expand All @@ -29,9 +29,9 @@ class Process;
* and passed through interfaces to global and local assemblers for each
* process.
*/
struct StaggeredCouplingTerm
struct CoupledSolutionsForStaggeredScheme
{
StaggeredCouplingTerm(
CoupledSolutionsForStaggeredScheme(
std::unordered_map<std::type_index, Process const&> const&
coupled_processes_,
std::unordered_map<std::type_index, GlobalVector const&> const&
Expand All @@ -58,9 +58,9 @@ struct StaggeredCouplingTerm
* During the global assembly loop, an instance of this struct is created for
* each element and it is then passed to local assemblers.
*/
struct LocalCouplingTerm
struct LocalCoupledSolutions
{
LocalCouplingTerm(
LocalCoupledSolutions(
const double dt_,
std::unordered_map<std::type_index, Process const&> const&
coupled_processes_,
Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void GroundwaterFlowProcess::assembleConcreteProcess(const double t,
// Call global assembler for each local assembly item.
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers,
*_local_to_global_index_map, t, x, M, K, b, _coupling_term);
*_local_to_global_index_map, t, x, M, K, b, _coupled_solutions);
}

void GroundwaterFlowProcess::assembleWithJacobianConcreteProcess(
Expand All @@ -82,7 +82,7 @@ void GroundwaterFlowProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx,
dx_dx, M, K, b, Jac, _coupling_term);
dx_dx, M, K, b, Jac, _coupled_solutions);
}

} // namespace GroundwaterFlow
Expand Down
43 changes: 22 additions & 21 deletions ProcessLib/HT/CreateHTProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "ProcessLib/Utils/ProcessUtils.h"

#include "HTProcess.h"
#include "HTProcessData.h"
#include "HTMaterialProperties.h"

namespace ProcessLib
{
Expand All @@ -43,23 +43,22 @@ std::unique_ptr<Process> createHTProcess(

auto process_variables = findProcessVariables(
variables, pv_config,
{
//! \ogs_file_param_special{prj__processes__process__HT__process_variables__temperature}
"temperature",
//! \ogs_file_param_special{prj__processes__process__HT__process_variables__pressure}
"pressure"});
{//! \ogs_file_param_special{prj__processes__process__HT__process_variables__temperature}
"temperature",
//! \ogs_file_param_special{prj__processes__process__HT__process_variables__pressure}
"pressure"});

MaterialLib::PorousMedium::PorousMediaProperties porous_media_properties{
MaterialLib::PorousMedium::createPorousMediaProperties(
mesh, config, parameters)};
MaterialLib::PorousMedium::createPorousMediaProperties(mesh, config,
parameters)};

//! \ogs_file_param{prj__processes__process__HT__fluid}
auto const& fluid_config = config.getConfigSubtree("fluid");
auto fluid_properties =
MaterialLib::Fluid::createFluidProperties(fluid_config);

// Parameter for the density of the fluid.
auto& fluid_reference_density= findParameter<double>(
auto& fluid_reference_density = findParameter<double>(
config,
//! \ogs_file_param_special{prj__processes__process__HT__fluid_reference_density}
"fluid_reference_density", parameters, 1);
Expand Down Expand Up @@ -134,17 +133,19 @@ std::unique_ptr<Process> createHTProcess(
std::copy_n(b.data(), b.size(), specific_body_force.data());
}

HTProcessData process_data{std::move(porous_media_properties),
density_solid,
fluid_reference_density,
std::move(fluid_properties),
thermal_dispersivity_longitudinal,
thermal_dispersivity_transversal,
specific_heat_capacity_solid,
thermal_conductivity_solid,
thermal_conductivity_fluid,
specific_body_force,
has_gravity};
std::unique_ptr<HTMaterialProperties> material_properties =
std::make_unique<HTMaterialProperties>(
std::move(porous_media_properties),
density_solid,
fluid_reference_density,
std::move(fluid_properties),
thermal_dispersivity_longitudinal,
thermal_dispersivity_transversal,
specific_heat_capacity_solid,
thermal_conductivity_solid,
thermal_conductivity_fluid,
specific_body_force,
has_gravity);

SecondaryVariableCollection secondary_variables;

Expand All @@ -156,7 +157,7 @@ std::unique_ptr<Process> createHTProcess(

return std::make_unique<HTProcess>(
mesh, std::move(jacobian_assembler), parameters, integration_order,
std::move(process_variables), std::move(process_data),
std::move(process_variables), std::move(material_properties),
std::move(secondary_variables), std::move(named_function_caller));
}

Expand Down
6 changes: 3 additions & 3 deletions ProcessLib/HT/HTFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <vector>


#include "HTProcessData.h"
#include "HTMaterialProperties.h"
#include "MathLib/LinAlg/Eigen/EigenMapTools.h"
#include "NumLib/DOF/DOFTableUtil.h"
#include "NumLib/Extrapolation/ExtrapolatableElement.h"
Expand Down Expand Up @@ -87,7 +87,7 @@ class LocalAssemblerData : public HTLocalAssemblerInterface
std::size_t const local_matrix_size,
bool is_axially_symmetric,
unsigned const integration_order,
HTProcessData const& process_data)
HTMaterialProperties const& process_data)
: _element(element),
_process_data(process_data),
_integration_method(integration_order)
Expand Down Expand Up @@ -342,7 +342,7 @@ class LocalAssemblerData : public HTLocalAssemblerInterface

private:
MeshLib::Element const& _element;
HTProcessData const& _process_data;
HTMaterialProperties const& _process_data;

IntegrationMethod const _integration_method;
std::vector<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ struct Parameter;

namespace HT
{
struct HTProcessData
struct HTMaterialProperties
{
HTProcessData(
HTMaterialProperties(
MaterialLib::PorousMedium::PorousMediaProperties&&
porous_media_properties_,
ProcessLib::Parameter<double> const& density_solid_,
Expand Down Expand Up @@ -52,7 +52,7 @@ struct HTProcessData
{
}

HTProcessData(HTProcessData&& other)
HTMaterialProperties(HTMaterialProperties&& other)
: porous_media_properties(std::move(other.porous_media_properties)),
density_solid(other.density_solid),
fluid_reference_density(other.fluid_reference_density),
Expand All @@ -70,13 +70,13 @@ struct HTProcessData
}

//! Copies are forbidden.
HTProcessData(HTProcessData const&) = delete;
HTMaterialProperties(HTMaterialProperties const&) = delete;

//! Assignments are not needed.
void operator=(HTProcessData const&) = delete;
void operator=(HTMaterialProperties const&) = delete;

//! Assignments are not needed.
void operator=(HTProcessData&&) = delete;
void operator=(HTMaterialProperties&&) = delete;

MaterialLib::PorousMedium::PorousMediaProperties porous_media_properties;
Parameter<double> const& density_solid;
Expand Down
10 changes: 5 additions & 5 deletions ProcessLib/HT/HTProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ HTProcess::HTProcess(
std::vector<std::unique_ptr<ParameterBase>> const& parameters,
unsigned const integration_order,
std::vector<std::reference_wrapper<ProcessVariable>>&& process_variables,
HTProcessData&& process_data,
std::unique_ptr<HTMaterialProperties>&& material_properties,
SecondaryVariableCollection&& secondary_variables,
NumLib::NamedFunctionCaller&& named_function_caller)
: Process(mesh, std::move(jacobian_assembler), parameters,
integration_order, std::move(process_variables),
std::move(secondary_variables), std::move(named_function_caller)),
_process_data(std::move(process_data))
_material_properties(std::move(material_properties))
{
}

Expand All @@ -42,7 +42,7 @@ void HTProcess::initializeConcreteProcess(
ProcessLib::createLocalAssemblers<LocalAssemblerData>(
mesh.getDimension(), mesh.getElements(), dof_table,
pv.getShapeFunctionOrder(), _local_assemblers,
mesh.isAxiallySymmetric(), integration_order, _process_data);
mesh.isAxiallySymmetric(), integration_order, *_material_properties);

_secondary_variables.addSecondaryVariable(
"darcy_velocity",
Expand All @@ -62,7 +62,7 @@ void HTProcess::assembleConcreteProcess(const double t,
// Call global assembler for each local assembly item.
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers,
*_local_to_global_index_map, t, x, M, K, b, _coupling_term);
*_local_to_global_index_map, t, x, M, K, b, _coupled_solutions);
}

void HTProcess::assembleWithJacobianConcreteProcess(
Expand All @@ -76,7 +76,7 @@ void HTProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx,
dx_dx, M, K, b, Jac, _coupling_term);
dx_dx, M, K, b, Jac, _coupled_solutions);
}

} // namespace HT
Expand Down
6 changes: 3 additions & 3 deletions ProcessLib/HT/HTProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#pragma once

#include "HTFEM.h"
#include "HTProcessData.h"
#include "HTMaterialProperties.h"
#include "NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.h"
#include "ProcessLib/Process.h"

Expand Down Expand Up @@ -47,7 +47,7 @@ class HTProcess final : public Process
unsigned const integration_order,
std::vector<std::reference_wrapper<ProcessVariable>>&&
process_variables,
HTProcessData&& process_data,
std::unique_ptr<HTMaterialProperties>&& material_properties,
SecondaryVariableCollection&& secondary_variables,
NumLib::NamedFunctionCaller&& named_function_caller);

Expand All @@ -72,7 +72,7 @@ class HTProcess final : public Process
const double dxdot_dx, const double dx_dx, GlobalMatrix& M,
GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override;

HTProcessData _process_data;
const std::unique_ptr<HTMaterialProperties> _material_properties;

std::vector<std::unique_ptr<HTLocalAssemblerInterface>> _local_assemblers;
};
Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/HeatConduction/HeatConductionFEM-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void LocalAssemblerData<ShapeFunction, IntegrationMethod, GlobalDim>::
std::vector<double>& local_M_data,
std::vector<double>& local_K_data,
std::vector<double>& /*local_b_data*/,
LocalCouplingTerm const& coupled_term)
LocalCoupledSolutions const& coupled_term)
{
for (auto const& coupled_process_pair : coupled_term.coupled_processes)
{
Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/HeatConduction/HeatConductionFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class LocalAssemblerData : public HeatConductionLocalAssemblerInterface
double const t, std::vector<double> const& local_x,
std::vector<double>& local_M_data, std::vector<double>& local_K_data,
std::vector<double>& /*local_b_data*/,
LocalCouplingTerm const& coupled_term) override;
LocalCoupledSolutions const& coupled_term) override;

void computeSecondaryVariableConcrete(
const double t, std::vector<double> const& local_x) override
Expand Down
9 changes: 5 additions & 4 deletions ProcessLib/HeatConduction/HeatConductionProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ HeatConductionProcess::HeatConductionProcess(

void HeatConductionProcess::preTimestepConcreteProcess(GlobalVector const& x,
const double /*t*/,
const double /*delta_t*/)
const double /*delta_t*/,
const int /*process_id*/)
{
if (!_x_previous_timestep)
{
Expand Down Expand Up @@ -95,7 +96,7 @@ void HeatConductionProcess::assembleConcreteProcess(const double t,
// Call global assembler for each local assembly item.
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers,
*_local_to_global_index_map, t, x, M, K, b, _coupling_term);
*_local_to_global_index_map, t, x, M, K, b, _coupled_solutions);
}

void HeatConductionProcess::assembleWithJacobianConcreteProcess(
Expand All @@ -109,7 +110,7 @@ void HeatConductionProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx,
dx_dx, M, K, b, Jac, _coupling_term);
dx_dx, M, K, b, Jac, _coupled_solutions);
}

void HeatConductionProcess::computeSecondaryVariableConcrete(
Expand All @@ -119,7 +120,7 @@ void HeatConductionProcess::computeSecondaryVariableConcrete(
GlobalExecutor::executeMemberOnDereferenced(
&HeatConductionLocalAssemblerInterface::computeSecondaryVariable,
_local_assemblers, *_local_to_global_index_map, t, x,
_coupling_term);
_coupled_solutions);
}

} // namespace HeatConduction
Expand Down
3 changes: 2 additions & 1 deletion ProcessLib/HeatConduction/HeatConductionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class HeatConductionProcess final : public Process
double const t, GlobalVector const& x) override;

void preTimestepConcreteProcess(GlobalVector const& x, const double t,
const double delta_t) override;
const double delta_t,
const int process_id) override;

// Get the solution of the previous time step.
GlobalVector* getPreviousTimeStepSolution() const override
Expand Down
Loading

0 comments on commit 3a0a3ab

Please sign in to comment.