Continuum Membrane 719025a62b1e384a6ff80e2f2a223ef4012153dc
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
Model Class Reference

The Model class encapsulates a Mesh and a Record object. More...

#include <Model.hpp>

Inheritance diagram for Model:
DynamicModel

Classes

struct  ThermalFluctuationRecord
 

Public Member Functions

 Model (Mesh &mesh_, Record &record_)
 Constructs a new Model object.
 
bool should_continue_optimization ()
 Determines whether the optimization algorithm should continue running.
 
void determine_trial_step_size ()
 This code determines the step size used in an optimization algorithm. The step size is used to calculate how far to move in each iteration of the optimization algorithm to minimize an energy function.
 
std::string to_string_current_step ()
 Returns a string representation of the current step's iteration number, trial step size, and optimal step size. The function concatenates the values of model.iteration, model.oa.trialStepSize, and model.stepSize to the following format: "step: , trial StepSize = , StepSize = ".
 
void update_ncg_direction ()
 Updates the direction for nonlinear conjugate gradient (NCG) optimization.
 
void reset_ncg_direction ()
 Reset the direction for nonlinear conjugate gradient (NCG) optimization.
 
double linear_search_for_stepsize_to_minimize_energy ()
 Performs a linear search to find the optimal step size that minimizes energy using either nonlinear conjugate gradient method or simple line search.
 
bool simulated_annealing_next_step (bool forceAttempt=false)
 Use a Metropolis thermal trial move to sample beyond local gradient descent.
 
void enforce_boundary_conditions_after_coordinate_update ()
 Synchronize boundary/ghost coordinates after direct coordinate updates.
 
void update_vertex_using_NCG ()
 Update vertex coordinates using a non-linear conjugate gradient method.
 

Public Attributes

Meshmesh
 
Recordrecord
 
int iteration
 
double stepSize
 
OptimizationAlgorithm oa
 
std::vector< ForcencgDirection0
 vector to store the initial direction for nonlinear conjugate gradient optimization
 
bool isHeating = true
 
int currentCoolingStep = 0
 
int coolingStep = 35
 
int currentHeatingStep = 0
 
int heatingStep = 15
 
double highTemperature = 0.0
 
std::mt19937 thermalRng
 Reproducible random generator for thermal fluctuation trial moves.
 
int thermalFluctuationAttemptCount = 0
 Number of attempted thermal trial moves.
 
std::vector< ThermalFluctuationRecordthermalFluctuationRecords
 Diagnostics for thermal trial moves.
 

Detailed Description

The Model class encapsulates a Mesh and a Record object.

Constructor & Destructor Documentation

◆ Model()

Model::Model ( Mesh mesh_,
Record record_ 
)

Constructs a new Model object.

Parameters
mesh_The mesh object to be encapsulated.
record_The record object to be encapsulated.

Member Function Documentation

◆ determine_trial_step_size()

void Model::determine_trial_step_size ( )

This code determines the step size used in an optimization algorithm. The step size is used to calculate how far to move in each iteration of the optimization algorithm to minimize an energy function.

Returns
double trialStepSize

◆ enforce_boundary_conditions_after_coordinate_update()

void Model::enforce_boundary_conditions_after_coordinate_update ( )

Synchronize boundary/ghost coordinates after direct coordinate updates.

◆ linear_search_for_stepsize_to_minimize_energy()

double Model::linear_search_for_stepsize_to_minimize_energy ( )

Performs a linear search to find the optimal step size that minimizes energy using either nonlinear conjugate gradient method or simple line search.

Returns
double The optimal step size. Returns -1 if no efficient step size is found with the simple line search method.

◆ reset_ncg_direction()

void Model::reset_ncg_direction ( )

Reset the direction for nonlinear conjugate gradient (NCG) optimization.

◆ should_continue_optimization()

bool Model::should_continue_optimization ( )

Determines whether the optimization algorithm should continue running.

The function returns true if the model has not yet been optimized and the maximum number of iterations has not been reached. Otherwise, the function returns false and the optimization algorithm stops.

Note
The implementation of this function can be changed to customize the optimization.
Returns
true if the optimization algorithm should continue running, false otherwise.

◆ simulated_annealing_next_step()

bool Model::simulated_annealing_next_step ( bool  forceAttempt = false)

Use a Metropolis thermal trial move to sample beyond local gradient descent.

Returns
true if a thermal trial was attempted on this iteration.

◆ to_string_current_step()

std::string Model::to_string_current_step ( )

Returns a string representation of the current step's iteration number, trial step size, and optimal step size. The function concatenates the values of model.iteration, model.oa.trialStepSize, and model.stepSize to the following format: "step: , trial StepSize = , StepSize = ".

Returns
std::string A string representation of the current step's information.

◆ update_ncg_direction()

void Model::update_ncg_direction ( )

Updates the direction for nonlinear conjugate gradient (NCG) optimization.

This function calculates the dot product of the previous and current forces to determine the NCG factor. It then updates the NCG direction either as a combination of the current force and the previous NCG direction, or just the current force depending on whether NCG optimization is being used. The NCG direction is updated in the input vector ncgDirections.

◆ update_vertex_using_NCG()

void Model::update_vertex_using_NCG ( )

Update vertex coordinates using a non-linear conjugate gradient method.

Member Data Documentation

◆ coolingStep

int Model::coolingStep = 35

◆ currentCoolingStep

int Model::currentCoolingStep = 0

◆ currentHeatingStep

int Model::currentHeatingStep = 0

◆ heatingStep

int Model::heatingStep = 15

◆ highTemperature

double Model::highTemperature = 0.0

◆ isHeating

bool Model::isHeating = true

◆ iteration

int Model::iteration

The current iteration count of the optimization algorithm.

◆ mesh

Mesh& Model::mesh

The mesh object.

◆ ncgDirection0

std::vector<Force> Model::ncgDirection0

vector to store the initial direction for nonlinear conjugate gradient optimization

◆ oa

The state for the optimization algorithm.

◆ record

Record& Model::record

The record object.

◆ stepSize

double Model::stepSize

The current step size

◆ thermalFluctuationAttemptCount

int Model::thermalFluctuationAttemptCount = 0

Number of attempted thermal trial moves.

◆ thermalFluctuationRecords

std::vector<ThermalFluctuationRecord> Model::thermalFluctuationRecords

Diagnostics for thermal trial moves.

◆ thermalRng

std::mt19937 Model::thermalRng

Reproducible random generator for thermal fluctuation trial moves.


The documentation for this class was generated from the following file: