Solver Functions
Functions and classes for solving thermomechanical boundary value problems.
-
arma::Col<int> subdiag2vec()
-
void Lt_2_K(const arma::mat&, arma::mat&, const arma::Col<int>&, const double&)
Function that fills the matrix Tdsde for mix strain/stress conditions.
-
void Lth_2_K(const arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, const arma::Col<int>&, const int&, const double&)
Function that fills the matrix Tdsde for mix strain/stress conditions.
-
void solver_essentials(int&, int&, const std::string& = "data", const std::string& = "solver_essentials.inp")
Function that reads the material properties.
-
void solver_control(double&, double&, int&, int&, int&, double&, double&, const std::string& = "data", const std::string& = "solver_control.inp")
Function that reads the material properties.
-
void read_matprops(std::string&, unsigned int&, arma::vec&, unsigned int&, double&, double&, double&, const std::string& = "data", const std::string& = "material.dat")
Function that reads the material properties.
-
void read_output(solver_output&, const int&, const int&, const std::string& = "data", const std::string& = "output.dat")
Function that reads the output parameters.
-
void check_path_output(const std::vector<block>&, const solver_output&)
Function that checks the coherency between the path and the step increments provided.
-
void read_path(std::vector<block>&, double&, const std::string& = "data", const std::string& = "path.txt")
Function that reads the loading path.
-
void solver(const std::string &umat_name, const arma::vec &props, const unsigned int &nstatev, const double &psi_rve, const double &theta_rve, const double &phi_rve, const int &solver_type, const int &corate_type, const double &div = 0.5, const double &mul = 2., const int &miniter = 10, const int &maxiter = 100, const int &inforce_solver = 1, const double &precision = 1.E-6, const double &lambda_eff = 10000., const std::string &path_data = "data", const std::string &path_results = "results", const std::string &pathfile = "path.txt", const std::string &outputfile = "result_job.txt")
Main solver function for homogeneous thermomechanical problems.
This function drives the simulation by:
Reading the loading path from input files
Managing time stepping with adaptive incrementation
Calling the UMAT for constitutive updates
Writing results to output files
- Parameters:
umat_name – Name of the constitutive model (UMAT)
props – Vector of material properties
nstatev – Number of internal state variables
psi_rve – First Euler angle of RVE orientation (rad)
theta_rve – Second Euler angle of RVE orientation (rad)
phi_rve – Third Euler angle of RVE orientation (rad)
solver_type – Type of solver (0: small strain, 1: finite strain)
corate_type – Type of corotational formulation
div – Divisor for time stepping (default: 0.5)
mul – Multiplier for time stepping (default: 2.0)
miniter – Minimum iterations per increment (default: 10)
maxiter – Maximum iterations per increment (default: 100)
inforce_solver – Enforce solver convergence (default: 1)
precision – Convergence tolerance (default: 1e-6)
lambda_eff – Effective stiffness estimate for mixed control (default: 10000)
path_data – Path to data directory (default: “data”)
path_results – Path to results directory (default: “results”)
pathfile – Name of loading path file (default: “path.txt”)
outputfile – Name of output file (default: “result_job.txt”)
-
class block
- #include <block.hpp>
Class representing a loading block containing multiple steps.
A block groups several loading steps that can be repeated (cycled) multiple times. This is useful for simulating cyclic loading, fatigue tests, or repeated thermomechanical cycles.
The block structure allows organizing complex loading histories:
Multiple steps within a block can represent different loading phases
The block can be cycled to simulate repetitive loading
Different control types (stress, strain, mixed) can be specified
Public Functions
-
block()
Default constructor.
-
block(const unsigned int &number, const unsigned int &nstep, const unsigned int &ncycle, const unsigned int &type, const unsigned int &control_type)
Constructor with basic parameters.
- Parameters:
number – Block identification number
nstep – Number of steps
ncycle – Number of cycles
type – Block type
control_type – Control type
Full constructor with step vector.
- Parameters:
number – Block identification number
nstep – Number of steps
ncycle – Number of cycles
type – Block type
control_type – Control type
steps – Vector of step pointers
-
virtual ~block()
Virtual destructor.
-
void generate()
Generate the steps within the block.
Public Members
-
unsigned int number
Block identification number.
-
unsigned int nstep
Number of steps in the block.
-
unsigned int ncycle
Number of cycles to repeat the block.
-
unsigned int type
Type of block (loading type identifier)
-
unsigned int control_type
Control type (0: strain, 1: stress, 2: mixed)
-
class solver_output
- #include <output.hpp>
Public Functions
-
solver_output()
-
solver_output(const int &o_nb_strain)
-
solver_output(const solver_output &so)
-
~solver_output()
-
virtual solver_output &operator=(const solver_output &so)
Public Members
-
int o_nb_strain
-
arma::Col<int> o_strain
-
int o_nb_stress
-
arma::Col<int> o_stress
-
int o_nb_T
-
int o_strain_type
-
int o_stress_type
-
int o_rotation_type
-
int o_tangent_modulus
-
int o_nw_statev
-
arma::Col<int> o_wanted_statev
-
arma::Col<int> o_range_statev
-
arma::Col<int> o_type
-
arma::Col<int> o_nfreq
-
arma::vec o_tfreq
Friends
-
friend std::ostream &operator<<(std::ostream &os, const solver_output &so)
-
solver_output()
-
class step
- #include <step.hpp>
Class representing a loading step within a simulation block.
A step defines a portion of the loading path with specified boundary conditions and time discretization parameters. It controls how the load is applied and how time increments are managed.
The step class manages:
Time discretization (initial, minimum increments)
Boundary condition mode (stress, strain, or mixed control)
Loading path definition through external files
Subclassed by step_meca, step_thermomeca
Public Functions
-
step()
Default constructor.
-
step(const int &number, const double &Dn_init, const double &Dn_mini, const double &Dn_inc, const int &mode, const unsigned int &control_type)
Constructor with parameters.
- Parameters:
number – Step identification number
Dn_init – Initial time increment fraction
Dn_mini – Minimum time increment fraction
Dn_inc – Maximum time increment fraction
mode – Loading mode
control_type – Control type
-
virtual ~step()
Virtual destructor.
-
virtual void generate()
Generate the time discretization for the step.
-
virtual void compute_inc(double &tnew_dt, const int &inc, double &tinc, double &Dtinc, double &Dn, const int &control)
Compute the next increment parameters.
- Parameters:
tnew_dt – Suggested new time increment ratio (output)
inc – Current increment number
tinc – Time increment (output)
Dtinc – Delta time increment (output)
Dn – Increment fraction (output)
control – Increment control flag
Public Members
-
int number
Step identification number.
-
double Dn_init
Initial fraction of the step (initial time increment ratio)
-
double Dn_mini
Minimal fraction of the step (minimum time increment ratio)
-
double Dn_inc
Maximum fraction of the step (maximum time increment ratio)
-
int ninc
Number of milestones/increments in the step.
-
int mode
Loading mode identifier.
-
unsigned int control_type
Control type (0: strain, 1: stress, 2: mixed)
-
arma::vec times
Vector of time values for the step.
-
double BC_Time
Boundary condition application time.
-
std::string file
Input/output file for loading path values.
-
class step_meca : public step
- #include <step_meca.hpp>
Public Functions
-
step_meca()
-
step_meca(const unsigned int &size)
-
step_meca(const int &number, const double &Dn_init, const double &Dn_mini, const double &Dn_inc, const int &mode, const unsigned int &control_type, const arma::Col<int> &cBC_meca, const arma::vec &BC_meca, const arma::mat &mecas, const arma::mat &BC_mecas, const double &BC_T, const int &cBC_T, const arma::vec &Ts, const arma::vec &BC_Ts, const arma::mat &BC_w, const arma::mat &BC_R)
-
virtual ~step_meca()
-
virtual void generate(const double&, const arma::vec&, const arma::vec&, const double&)
-
virtual void generate_kin(const double&, const arma::mat&, const double&)
-
virtual void assess_inc(const double&, double&, const double&, phase_characteristics&, double&, const double&, const arma::mat&, const int&)
-
virtual void generate()
Generate the time discretization for the step.
-
step_meca()
-
class step_thermomeca : public step
- #include <step_thermomeca.hpp>
Public Functions
-
step_thermomeca()
-
step_thermomeca(const unsigned int&)
-
step_thermomeca(const int&, const double&, const double&, const double&, const int&, const unsigned int&, const arma::Col<int>&, const arma::vec&, const arma::mat&, const arma::mat&, const double&, const int&, const arma::vec&, const arma::vec&, const arma::mat&, const arma::mat&)
-
step_thermomeca(const step_thermomeca&)
-
virtual ~step_thermomeca()
-
virtual void generate(const double&, const arma::vec&, const arma::vec&, const double&)
-
virtual void generate_kin(const double&, const arma::mat &m, const double&)
-
virtual void assess_inc(const double&, double&, const double&, phase_characteristics&, double&, const double&, const arma::mat&, const int&)
-
virtual step_thermomeca &operator=(const step_thermomeca&)
-
virtual void generate()
Generate the time discretization for the step.
Public Members
-
arma::Col<int> cBC_meca
-
arma::vec BC_meca
-
arma::mat mecas
-
arma::mat BC_mecas
-
arma::mat BC_w
-
arma::mat BC_R
-
double BC_T
-
int cBC_T
-
arma::vec Ts
-
arma::vec BC_Ts
Friends
-
friend std::ostream &operator<<(std::ostream&, const step_thermomeca&)
-
step_thermomeca()