https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AbaqusUExternalDB.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "AbaqusUExternalDB.h"
11#include "AbaqusUtils.h"
13
14#define QUOTE(macro) stringifyName(macro)
15
17
20{
22 params.addClassDescription("Coupling user object to use Abaqus UEXTERNALDB subroutines in MOOSE");
23 params.addRequiredParam<FileName>(
24 "plugin", "The path to the compiled dynamic library for the plugin you want to use");
25 params.addParam<UserObjectName>(
26 "analysis_step_user_object",
27 "The AnalysisStepUserObject that provides times from simulation loading steps.");
28 return params;
29}
30
31#ifndef METHOD
32#error "The METHOD preprocessor symbol must be supplied by the build system."
33#endif
34
36 : ThreadedGeneralUserObject(parameters),
37 _plugin(getParam<FileName>("plugin")),
38 _library(_plugin + std::string("-") + QUOTE(METHOD) + ".plugin"),
39 _uexternaldb(_library.getFunction<uexternaldb_t>("uexternaldb_")),
40 _aqSTEP(0),
41 _current_execute_on_flag(_fe_problem.getCurrentExecuteOnFlag())
42{
45}
46
47void
49{
50 // Let's automatically detect uos and identify the one we are interested in.
51 // If there is more than one, we assume something is off and error out.
52 if (!isParamSetByUser("analysis_step_user_object"))
54 else
55 _step_user_object = &getUserObject<AnalysisStepUserObject>("analysis_step_user_object");
56}
57
58void
60{
61 // Obtain step number if user object was coupled (beginning of increment)
64
66 callPlugin(0);
67
68 // TODO support 2 -> trigger saving for restart
69
71 callPlugin(3);
72
74 callPlugin(1);
75
77 callPlugin(2);
78}
79
80void
82{
83 Real time[2] = {_t, _t - _dt};
84 int lrestart = 0;
85
86 // call plugin function
87 _uexternaldb(&lop, &lrestart, time, &_dt, &_aqSTEP, &_t_step);
88}
registerMooseObject("SolidMechanicsApp", AbaqusUExternalDB)
const ExecFlagType EXEC_TIMESTEP_END
const ExecFlagType EXEC_TIMESTEP_BEGIN
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_FINAL
Coupling user object to use Abaqus UEXTERNALDB subroutines in MOOSE.
virtual void initialSetup() override
void callPlugin(int lop)
static InputParameters validParams()
virtual void execute() override
the UEXTERNALDB subroutine gets called here
const AnalysisStepUserObject * _step_user_object
User object that determines the step number.
AbaqusUExternalDB(const InputParameters &parameters)
const ExecFlagType & _current_execute_on_flag
uexternaldb_t _uexternaldb
static void setCommunicator(const libMesh::Parallel::Communicator *communicator)
Global storage for the MPI communicator, this will be set by any Abaqus class.
Definition AbaqusUtils.C:19
static void setInputFile(const std::string &input_file)
Global storage for the simulation output directory, this will be set by any Abaqus class.
Definition AbaqusUtils.C:70
virtual void getAnalysisStepUserObject(const FEProblemBase &fe_problem, const AnalysisStepUserObject *&step_user_object, const std::string &name)
unsigned int getStep(const Real &time) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const std::string & getLastInputFileName() const
const std::string & name() const
bool isParamSetByUser(const std::string &name) const
static InputParameters validParams()
FEProblemBase & _fe_problem
const Parallel::Communicator & _communicator