30 template<
class TSparseSpace,
66 typename TSchemeType::Pointer pScheme,
67 typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria,
68 typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver,
70 bool WriteFormFoundGeometryFile,
71 const std::string& rPrintingFormat,
73 int MaxIterations = 30,
74 bool CalculateReactions =
false,
75 bool ReformDofSetAtEachStep =
false,
79 pNewConvergenceCriteria,pNewBuilderAndSolver,MaxIterations,CalculateReactions,ReformDofSetAtEachStep,
81 mProjectionSettings(ProjectionSetting),
82 mrFormFindingModelPart(rFormFindingModelPart),
83 mPrintingFormat(rPrintingFormat),
84 mWriteFormFoundGeometryFile(WriteFormFoundGeometryFile)
86 InitializeIterationIO();
96 for(
auto& r_element : rModelPart.
Elements()){
97 r_element.Calculate(MEMBRANE_PRESTRESS,output_matrix,r_process_info);
98 r_element.GetData().
Clear();
99 r_element.SetValue(MEMBRANE_PRESTRESS,output_matrix);
118 for(
auto& r_node : mrFormFindingModelPart.
Nodes()){
123 disp_non_historical = disp_non_historical + disp;
124 r_node.GetInitialPosition() += disp;
126 r_node.FastGetSolutionStepValue(DISPLACEMENT) =
ZeroVector(3);
133 void EchoInfo(
const unsigned int IterationNumber)
override
136 mIterationNumber = IterationNumber;
141 if (mPrintingFormat==
"all"){
142 PrintVtkFiles(mIterationNumber);
143 PrintGiDFiles(mIterationNumber);
145 else if (mPrintingFormat==
"vtk") PrintVtkFiles(mIterationNumber);
146 else if (mPrintingFormat==
"gid") PrintGiDFiles(mIterationNumber);
150 void FinalizeSolutionStep()
override
153 if (mPrintingFormat==
"all" || mPrintingFormat==
"gid") mpIterationIO->FinalizeResults();
158 void PrintVtkFiles(
const int rIterationNumber)
160 Parameters vtk_params( R
"({
161 "file_format" : "binary",
162 "output_precision" : 7,
163 "output_control_type" : "step",
164 "save_output_files_in_folder" : true,
165 "output_path" : "formfinding_results_vtk",
166 "nodal_data_value_variables" : ["DISPLACEMENT"]
170 std::stringstream postfix;
171 postfix << std::setw(max_prefix) << std::setfill(
'0') << rIterationNumber;
175 void PrintGiDFiles(
const int rIterationNumber)
177 double solution_tag = rIterationNumber;
178 mpIterationIO->WriteNodalResultsNonHistorical(DISPLACEMENT,
BaseType::GetModelPart().Nodes(),solution_tag);
181 void InitializeIterationIO()
184 std::vector<std::string> printing_possibilities {
"all",
"vtk",
"gid",
"none"};
185 if (std::find(printing_possibilities.begin(), printing_possibilities.end(), mPrintingFormat)==printing_possibilities.end()){
186 KRATOS_ERROR <<
"Chosen printing format :" << mPrintingFormat <<
" is not available. Please use: " << printing_possibilities << std::endl;
190 if (mPrintingFormat==
"all" || mPrintingFormat==
"vtk"){
195 PrintVtkFiles(mIterationNumber);
198 if (mPrintingFormat==
"all" || mPrintingFormat==
"gid"){
199 mpIterationIO = Kratos::make_unique<IterationIOType>(
200 "formfinding_iterations",
206 mpIterationIO->InitializeMesh(0.0);
209 mpIterationIO->FinalizeMesh();
216 Parameters mProjectionSettings;
218 std::string mPrintingFormat;
219 int mIterationNumber = 0;
220 bool mWriteFormFoundGeometryFile =
true;
This is the base class to define the different convergence criterion considered.
Definition: convergence_criteria.h:58
void Clear()
Clears the entire data container.
Definition: data_value_container.h:352
This class defines an interface to the GiDPost library in order to provide GiD compliant I/O function...
Definition: gid_io.h:112
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
PropertiesContainerType & rProperties(IndexType ThisIndex=0)
Definition: model_part.h:1003
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
VariablesList & GetNodalSolutionStepVariablesList()
Definition: model_part.h:549
An IO class for reading and writing a modelpart.
Definition: model_part_io.h:56
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
void clear()
Clear the set, removing all elements.
Definition: pointer_vector_set.h:663
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
static void Execute(ModelPart &rModelPart, Parameters ThisParameters)
Definition: project_vector_on_surface_utility.cpp:84
This is the base Newton Raphson strategy.
Definition: residualbased_newton_raphson_strategy.h:66
virtual void UpdateDatabase(TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, const bool MoveMesh)
Here the database is updated.
Definition: residualbased_newton_raphson_strategy.h:1278
unsigned int mMaxIterationNumber
Definition: residualbased_newton_raphson_strategy.h:1261
BaseType::TSchemeType TSchemeType
Definition: residualbased_newton_raphson_strategy.h:87
BaseType::TBuilderAndSolverType TBuilderAndSolverType
Definition: residualbased_newton_raphson_strategy.h:81
virtual void EchoInfo(const unsigned int IterationNumber)
This method returns the components of the system of equations depending of the echo level.
Definition: residualbased_newton_raphson_strategy.h:1298
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: residualbased_newton_raphson_strategy.h:848
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
bool MoveMeshFlag()
This function returns the flag that says if the mesh is moved.
Definition: solving_strategy.h:290
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
virtual void MoveMesh()
This function is designed to move the mesh.
Definition: solving_strategy.h:330
void clear()
Definition: variables_list.h:249
#define KRATOS_ERROR
Definition: exception.h:161
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
ModelPart::MeshType & GetMesh(ModelPart &rModelPart)
bool create_directory(const std::string &rPath)
Definition: kratos_filesystem.cpp:45
bool exists(const std::string &rPath)
Definition: kratos_filesystem.cpp:27
std::uintmax_t remove_all(const std::string &rPath)
Definition: kratos_filesystem.cpp:63
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
@ WriteUndeformed
Definition: gid_io.h:52
@ SingleFile
Definition: gid_io.h:54
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33
@ WriteConditions
Definition: gid_io.h:53
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
model_part_io
Definition: PecletTest.py:50
model_part
Definition: face_heat.py:14
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
A
Definition: sensitivityMatrix.py:70