https://kratos-wiki.cimne.upc.edu/index.php?title=Special:Contributions&feed=atom&deletedOnly=&limit=50&target=Jcotela&topOnly=&year=&month=KratosWiki - User contributions [en]2022-08-16T12:44:38ZFrom KratosWikiMediaWiki 1.17.0https://kratos-wiki.cimne.upc.edu/index.php/HOW_TOsHOW TOs2017-12-11T11:48:29Z<p>Jcotela: </p>
<hr />
<div>This section is intended as a list of "recipes" for common needs in using the Kratos<br />
<br />
----<br />
<div style="background:#F2CECE; color:black; text-align:center;"><br />
== We have moved! ==<br />
<br />
The development of Kratos Multiphysics has been moved to GitHub. You can find us [https://github.com/KratosMultiphysics/Kratos in our GitHub project page]. We are keeping this wiki until the migration is complete, but it will no longer be updated. Find up-to date documentation in the new [https://github.com/KratosMultiphysics/Kratos/wiki GitHub wiki page].<br />
</div><br />
----<br />
<br />
== General ==<br />
* [[LinuxInstall | Installing kratos in Ubuntu Linux ]]<br />
* [[Windows 7 Download and Installation | Installing kratos in Windows]]<br />
* [[Installing kratos in macOS]]<br />
<!-- * [[MacOSX Installation]] (Leopard) --><br />
<!-- * [[How to get Kratos]] --> <br />
<!-- * [[How to Compile Kratos]] --><br />
* [[How to Compile Kratos on the Acuario Cluster]]<br />
* [[How to Check Kratos is Correctly Installed in Windows]]<br />
* [[How to Check Kratos is Correctly Installed in Linux]]<br />
* [[How to subscribe to Kratos' mailing list]]<br />
* [[How to Profile an application (using google-perftools)]]<br />
* [[How to Measure memory consumption (using google-perftools)]]<br />
* [[How to Profile an application (using OProfile)]]<br />
* [[How to work with Groups (Meshes)]]<br />
* [[How to make my application derivable]]<br />
* [[How to use the PaStiX solver in Kratos]]<br />
<!--* [[Working]]--><br />
<!--* [[Working_kernel]]--><br />
<br />
== OpenMP Parallelism ==<br />
* [[How to Learn OpenMP]]<br />
* [[How to "survive" OpenMP parallelism]]<br />
* [[How to force a scalar run]]<br />
* [[How to use ThreadSanitizer to detect data race bugs]]<br />
<br />
== MPI Parallelism ==<br />
* [[How to run your application in cluster]]<br />
* [[How to compile the Boost if you want to use MPI]]<br />
* [[How to use communicator for parallel synchronization]]<br />
<br />
== OpenCL Parallelism ==<br />
* [[Introduction to OpenCL Programming]]<br />
* [[Useful OpenCL links]]<br />
* [[How to set up OpenCL]]<br />
* [[How to debug OpenCL programs using GDB]]<br />
* [[Support for double-precision floating point basic arithmetic in ATI Stream SDK (2.1 and later)]]<br />
<br />
== Git ==<br />
* [[How to make Git ignore the files resulting from a compilation without conflicts in .gitignore]]<br />
<br />
== Python ==<br />
'''General Python Use for Kratos'''<br />
* [[How to use Python]]<br />
* [[How to Use an Application]]<br />
* [[How to use parameters]]<br />
* [[How to import Kratos from Python using the KratosMultiphysics module]]<br />
* [[How to work with nodes and elements in python]]<br />
* [[How to use multiple model parts]]<br />
* [[How to construct a linear solver using the "Linear Solver Factory"]]<br />
* [[How to construct the "solving strategies"]]<br />
* [[How to create unitary tests]]<br />
* [[How to create a new application]]<br />
* [[strategy_python]]<br />
* [[Operations]]<br />
* [[How to acess the values of a Table]]<br />
'''Input/Output and GiD'''<br />
* [[How to read a mdpa file]]<br />
* [[How to use the GidIO]]<br />
* [[How to read a data file]]<br />
* [[How to plot graphs]]<br />
* [[How to create the problem_type.gid folder with the new problem type generator]]<br />
* [[How to use the Isosurface Node Printer]]<br />
'''Calculation tips for Kratos feasible from Python'''<br />
* [[How to Calculate Distance Function]]<br />
* [[How to Calculate Normals]]<br />
* [[How to execute an FFT analysis]]<br />
* [[How to execute fitting of data series]]<br />
* [[How to run python recursively]]<br />
* [[How to execute a SVD analysis]]<br />
* [[How to add automatic benchmarking to your example]]<br />
* [[How to use parallel Pardiso solver for your example]]<br />
* [[How to use the projection between no matching meshes]]<br />
* [[How to use the ReduceTimeStep]]<br />
* [[How to transfer nodal values between non-matching meshes]]<br />
* [[How to use the OpenCL linear solvers]]<br />
* [[How to refine an existing triangular or tetrahedral mesh]]<br />
<!-- * [[How to include the restart in python]] --><br />
* [[How to use the Cutting Application (Serial and Parallel)]]<br />
* [[How to use external linear solvers and preconditioners]]<br />
* [[How to create a restart (python) file]]<br />
* [[How to use the Cutting Isosurface Application]]<br />
* [[How to access a value in a 'Properties' block]]<br />
<br />
== C++ ==<br />
* [[How to use the Constitutive Law class]]<br />
* [[How to use "Smart Pointers" within Kratos]]<br />
* [[How to Use the ModelPart]]<br />
* [[How to Use the Meshes as Group]]<br />
* [[How to Add and Delete Components (Nodes, Elements, ...) from ModelPart]]<br />
* [[How to Access Neighbor Nodes and Elements]]<br />
* [[How to Access DataBase]]<br />
* [[How to Create a New Application using cmake]]<br />
* [[How to Create New Element]]<br />
* [[How to use the geometry within an element]]<br />
* [[How to Use Solving Strategy]]<br />
* [[How to understand Kratos Pointers]]<br />
* [[How to Use the std::vector (and the kratos containers)]]<br />
* [[How to Use Ublas]]<br />
* [[How to Export Function/Classes to the Python]]<br />
* [[How to Interpolate Data]]<br />
* [[How to Compile Kratos in Debug mode]]<br />
* [[How to debug with valgrind]]<br />
* [[How to Add a Custom_Utilities File]]<br />
* [[How to Create a GiD Problem Type]]<br />
* [[How to Add a New Element (Condition)]]<br />
* [[How to Add a New constitutive law]]<br />
* [[How to Add a New Variable]]<br />
* [[How to use the Geometry]]<br />
* [[How to Create Multi-step Elements]]<br />
* [[How to use push_back]]<br />
* [[How to Create a executable without Python]]<br />
* [[How to apply face pressures]]<br />
* [[How to print values on Gauss points]]<br />
* [[How to use Serialization]]<br />
* [[How to Search neighbors]]<br />
* [[How to use Doxygen to generate documentation for our code]]<br />
* [[News for constitutive laws]]<br />
* [[strategy_python]]<br />
* [[Compiling lapack++ for 64 bit Windows]]<br />
* [[Common errors ]]<br />
* [[Some aspects of programing]]<br />
* [[How to use the Spatial Containers]]<br />
* [[How to solve linker errors]]<br />
<br />
== Debbuging and optimizing your code ==<br />
* [[Debugging the Application]]<br />
* [[Profiling the Kratos]]<br />
* [[How to Profile (Measure Time Consumption)]]<br />
* [[Checking memory use with Valgrind]]<br />
<br />
== Graphical User Interfaces ==<br />
* [[How the GiD Graphical User Interface communicates with Kratos]]<br />
<br />
<br />
<br />
<!--== Theory Manual ==<br />
* [[GeneralTemplate]]<br />
* [[MiguelAngel]]<br />
* [[Kazem]]<br />
* [[Computational Fluid Dynamic Module (CFDm)]]<br />
* [[CFDm 1.Introduction]]<br />
* [[CFDm 2.Structure]]<br />
* [[CFDm 2.1.Fluid Types]]<br />
* [[CFDm 2.2.Kinematical Approaches]]<br />
* [[CFDm 2.3.Solution Strategies]]<br />
* [[CFDm 2.4.Elements]]<br />
* [[CFDm 2.5.Boundary Conditions]]<br />
* [[CFDm 2.6.Initial Conditions]]<br />
* [[CFDm 2.7.Turbulence Models]]<br />
* [[CFDm 2.8.HPC]]<br />
* [[CFDm 2.9.Problem Parameters]]<br />
* [[CFDm 2.10.Other Relevant Aspects]]<br />
* [[CFDm 3.Benchmarking]]<br />
* [[CFDm 4.Tutorials]]<br />
* [[CFDm 5.Contact People]]<br />
* [[CFDm 6.Aknowledgements]]<br />
* [[Computational Structural Mechanics Module (CSMm)]]<br />
* [[CSMm 1.Introduction]]<br />
* [[CSMm 2.Structure]]<br />
* [[CSMm 2.1.Analysis Type]]<br />
* [[CSMm 2.2.Elements]]<br />
* [[CSMm 2.3.Boundary Conditions]]<br />
* [[CSMm 2.4.Loads]]<br />
* [[CSMm 2.5.Constitutive Laws]]<br />
* [[CSMm 2.6.HPC]]<br />
* [[CSMm 2.7.Problem Parameters]]<br />
* [[CSMm 2.8.Other Relevant Aspects]]<br />
* [[CSMm 3.Benchmarking]]<br />
* [[CSMm 4.Tutorials]]<br />
* [[CSMm 5.Contact People]]<br />
* [[CSMm 6.Aknowledgements]]<br />
* [[Convection Diffusion Module (CDm)]]<br />
* [[CDm 1.Introduction]]<br />
* [[CDm 2.Structure]]<br />
* [[CDm 2.1.Analysis type]]<br />
* [[CDm 2.2.Kinematical Approaches]]<br />
* [[CDm 2.3.Solution Strategies]]<br />
* [[CDm 2.4.Elements]]<br />
* [[CDm 2.5.Boundary Conditions]]<br />
* [[CDm 2.6.Initial Conditions]]<br />
* [[CDm 2.7.HPC]]<br />
* [[CDm 2.8.Problem Parameters]]<br />
* [[CDm 2.9.Other Relevant Aspects]]<br />
* [[CDm 3.Benchmarking]]<br />
* [[CDm 4.Tutorials]]<br />
* [[CDm 5.Contact People]]<br />
* [[CDm 6.Aknowledgements]]<br />
<br />
<br />
[[Category: Theory Manual]]--></div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/HOW_TOsHOW TOs2017-12-11T11:45:40Z<p>Jcotela: Directing users to GitHub</p>
<hr />
<div><div style="background:#F2CECE; color:black; text-align:center;"><br />
----<br />
== We have moved! ==<br />
<br />
The development of Kratos Multiphysics has been moved to GitHub. You can find us [https://github.com/KratosMultiphysics/Kratos in our GitHub project page]. We are keeping this wiki until the migration is complete, but it will no longer be updated. Find up-to date documentation in the new [https://github.com/KratosMultiphysics/Kratos/wiki GitHub wiki page].<br />
<br />
----<br />
</div><br />
<br />
This section is intended as a list of "recipes" for common needs in using the Kratos<br />
<br />
== General ==<br />
* [[LinuxInstall | Installing kratos in Ubuntu Linux ]]<br />
* [[Windows 7 Download and Installation | Installing kratos in Windows]]<br />
* [[Installing kratos in macOS]]<br />
<!-- * [[MacOSX Installation]] (Leopard) --><br />
<!-- * [[How to get Kratos]] --> <br />
<!-- * [[How to Compile Kratos]] --><br />
* [[How to Compile Kratos on the Acuario Cluster]]<br />
* [[How to Check Kratos is Correctly Installed in Windows]]<br />
* [[How to Check Kratos is Correctly Installed in Linux]]<br />
* [[How to subscribe to Kratos' mailing list]]<br />
* [[How to Profile an application (using google-perftools)]]<br />
* [[How to Measure memory consumption (using google-perftools)]]<br />
* [[How to Profile an application (using OProfile)]]<br />
* [[How to work with Groups (Meshes)]]<br />
* [[How to make my application derivable]]<br />
* [[How to use the PaStiX solver in Kratos]]<br />
<!--* [[Working]]--><br />
<!--* [[Working_kernel]]--><br />
<br />
== OpenMP Parallelism ==<br />
* [[How to Learn OpenMP]]<br />
* [[How to "survive" OpenMP parallelism]]<br />
* [[How to force a scalar run]]<br />
* [[How to use ThreadSanitizer to detect data race bugs]]<br />
<br />
== MPI Parallelism ==<br />
* [[How to run your application in cluster]]<br />
* [[How to compile the Boost if you want to use MPI]]<br />
* [[How to use communicator for parallel synchronization]]<br />
<br />
== OpenCL Parallelism ==<br />
* [[Introduction to OpenCL Programming]]<br />
* [[Useful OpenCL links]]<br />
* [[How to set up OpenCL]]<br />
* [[How to debug OpenCL programs using GDB]]<br />
* [[Support for double-precision floating point basic arithmetic in ATI Stream SDK (2.1 and later)]]<br />
<br />
== Git ==<br />
* [[How to make Git ignore the files resulting from a compilation without conflicts in .gitignore]]<br />
<br />
== Python ==<br />
'''General Python Use for Kratos'''<br />
* [[How to use Python]]<br />
* [[How to Use an Application]]<br />
* [[How to use parameters]]<br />
* [[How to import Kratos from Python using the KratosMultiphysics module]]<br />
* [[How to work with nodes and elements in python]]<br />
* [[How to use multiple model parts]]<br />
* [[How to construct a linear solver using the "Linear Solver Factory"]]<br />
* [[How to construct the "solving strategies"]]<br />
* [[How to create unitary tests]]<br />
* [[How to create a new application]]<br />
* [[strategy_python]]<br />
* [[Operations]]<br />
* [[How to acess the values of a Table]]<br />
'''Input/Output and GiD'''<br />
* [[How to read a mdpa file]]<br />
* [[How to use the GidIO]]<br />
* [[How to read a data file]]<br />
* [[How to plot graphs]]<br />
* [[How to create the problem_type.gid folder with the new problem type generator]]<br />
* [[How to use the Isosurface Node Printer]]<br />
'''Calculation tips for Kratos feasible from Python'''<br />
* [[How to Calculate Distance Function]]<br />
* [[How to Calculate Normals]]<br />
* [[How to execute an FFT analysis]]<br />
* [[How to execute fitting of data series]]<br />
* [[How to run python recursively]]<br />
* [[How to execute a SVD analysis]]<br />
* [[How to add automatic benchmarking to your example]]<br />
* [[How to use parallel Pardiso solver for your example]]<br />
* [[How to use the projection between no matching meshes]]<br />
* [[How to use the ReduceTimeStep]]<br />
* [[How to transfer nodal values between non-matching meshes]]<br />
* [[How to use the OpenCL linear solvers]]<br />
* [[How to refine an existing triangular or tetrahedral mesh]]<br />
<!-- * [[How to include the restart in python]] --><br />
* [[How to use the Cutting Application (Serial and Parallel)]]<br />
* [[How to use external linear solvers and preconditioners]]<br />
* [[How to create a restart (python) file]]<br />
* [[How to use the Cutting Isosurface Application]]<br />
* [[How to access a value in a 'Properties' block]]<br />
<br />
== C++ ==<br />
* [[How to use the Constitutive Law class]]<br />
* [[How to use "Smart Pointers" within Kratos]]<br />
* [[How to Use the ModelPart]]<br />
* [[How to Use the Meshes as Group]]<br />
* [[How to Add and Delete Components (Nodes, Elements, ...) from ModelPart]]<br />
* [[How to Access Neighbor Nodes and Elements]]<br />
* [[How to Access DataBase]]<br />
* [[How to Create a New Application using cmake]]<br />
* [[How to Create New Element]]<br />
* [[How to use the geometry within an element]]<br />
* [[How to Use Solving Strategy]]<br />
* [[How to understand Kratos Pointers]]<br />
* [[How to Use the std::vector (and the kratos containers)]]<br />
* [[How to Use Ublas]]<br />
* [[How to Export Function/Classes to the Python]]<br />
* [[How to Interpolate Data]]<br />
* [[How to Compile Kratos in Debug mode]]<br />
* [[How to debug with valgrind]]<br />
* [[How to Add a Custom_Utilities File]]<br />
* [[How to Create a GiD Problem Type]]<br />
* [[How to Add a New Element (Condition)]]<br />
* [[How to Add a New constitutive law]]<br />
* [[How to Add a New Variable]]<br />
* [[How to use the Geometry]]<br />
* [[How to Create Multi-step Elements]]<br />
* [[How to use push_back]]<br />
* [[How to Create a executable without Python]]<br />
* [[How to apply face pressures]]<br />
* [[How to print values on Gauss points]]<br />
* [[How to use Serialization]]<br />
* [[How to Search neighbors]]<br />
* [[How to use Doxygen to generate documentation for our code]]<br />
* [[News for constitutive laws]]<br />
* [[strategy_python]]<br />
* [[Compiling lapack++ for 64 bit Windows]]<br />
* [[Common errors ]]<br />
* [[Some aspects of programing]]<br />
* [[How to use the Spatial Containers]]<br />
* [[How to solve linker errors]]<br />
<br />
== Debbuging and optimizing your code ==<br />
* [[Debugging the Application]]<br />
* [[Profiling the Kratos]]<br />
* [[How to Profile (Measure Time Consumption)]]<br />
* [[Checking memory use with Valgrind]]<br />
<br />
== Graphical User Interfaces ==<br />
* [[How the GiD Graphical User Interface communicates with Kratos]]<br />
<br />
<br />
<br />
<!--== Theory Manual ==<br />
* [[GeneralTemplate]]<br />
* [[MiguelAngel]]<br />
* [[Kazem]]<br />
* [[Computational Fluid Dynamic Module (CFDm)]]<br />
* [[CFDm 1.Introduction]]<br />
* [[CFDm 2.Structure]]<br />
* [[CFDm 2.1.Fluid Types]]<br />
* [[CFDm 2.2.Kinematical Approaches]]<br />
* [[CFDm 2.3.Solution Strategies]]<br />
* [[CFDm 2.4.Elements]]<br />
* [[CFDm 2.5.Boundary Conditions]]<br />
* [[CFDm 2.6.Initial Conditions]]<br />
* [[CFDm 2.7.Turbulence Models]]<br />
* [[CFDm 2.8.HPC]]<br />
* [[CFDm 2.9.Problem Parameters]]<br />
* [[CFDm 2.10.Other Relevant Aspects]]<br />
* [[CFDm 3.Benchmarking]]<br />
* [[CFDm 4.Tutorials]]<br />
* [[CFDm 5.Contact People]]<br />
* [[CFDm 6.Aknowledgements]]<br />
* [[Computational Structural Mechanics Module (CSMm)]]<br />
* [[CSMm 1.Introduction]]<br />
* [[CSMm 2.Structure]]<br />
* [[CSMm 2.1.Analysis Type]]<br />
* [[CSMm 2.2.Elements]]<br />
* [[CSMm 2.3.Boundary Conditions]]<br />
* [[CSMm 2.4.Loads]]<br />
* [[CSMm 2.5.Constitutive Laws]]<br />
* [[CSMm 2.6.HPC]]<br />
* [[CSMm 2.7.Problem Parameters]]<br />
* [[CSMm 2.8.Other Relevant Aspects]]<br />
* [[CSMm 3.Benchmarking]]<br />
* [[CSMm 4.Tutorials]]<br />
* [[CSMm 5.Contact People]]<br />
* [[CSMm 6.Aknowledgements]]<br />
* [[Convection Diffusion Module (CDm)]]<br />
* [[CDm 1.Introduction]]<br />
* [[CDm 2.Structure]]<br />
* [[CDm 2.1.Analysis type]]<br />
* [[CDm 2.2.Kinematical Approaches]]<br />
* [[CDm 2.3.Solution Strategies]]<br />
* [[CDm 2.4.Elements]]<br />
* [[CDm 2.5.Boundary Conditions]]<br />
* [[CDm 2.6.Initial Conditions]]<br />
* [[CDm 2.7.HPC]]<br />
* [[CDm 2.8.Problem Parameters]]<br />
* [[CDm 2.9.Other Relevant Aspects]]<br />
* [[CDm 3.Benchmarking]]<br />
* [[CDm 4.Tutorials]]<br />
* [[CDm 5.Contact People]]<br />
* [[CDm 6.Aknowledgements]]<br />
<br />
<br />
[[Category: Theory Manual]]--></div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/DocumentationDocumentation2017-12-11T11:45:24Z<p>Jcotela: Directing users to GitHub</p>
<hr />
<div><div style="background:#F2CECE; color:black; text-align:center;"><br />
----<br />
== We have moved! ==<br />
<br />
The development of Kratos Multiphysics has been moved to GitHub. You can find us [https://github.com/KratosMultiphysics/Kratos in our GitHub project page]. We are keeping this wiki until the migration is complete, but it will no longer be updated. Find up-to date documentation in the new [https://github.com/KratosMultiphysics/Kratos/wiki GitHub wiki page].<br />
<br />
----<br />
</div><br />
<br />
* Kratos [[HOW TOs]] : Descriptions of several tools used in Kratos: Python, C++, Parallelism.<br />
* [http://kratos-wiki.cimne.upc.edu/forum/index.php Kratos Forum] : The site where you can ask anything to the Kratos Comunity and read older posts.<br />
* [https://kratos.cimne.upc.es/attachments/download/1391/Kratos_workshop_2016_material.tar.gz Kratos Workshop 2016 material ] pdf of the III Kratos Workshop<br />
* [[Kratos For Dummies]] : Tutorial to create a new Kratos application from the very beginning to runnning an example.<br />
* [[Kratos Tutorials]] : Tutorials for Python, C++.<br />
* [[Applications]] : Descriptions of some common Kratos Applications.<br />
* [[Input Data]] : How to input the problem data: Mesh, elements, nodes.<br />
* [[Doxygen Documentation]] on some old Kratos releases.<br />
* [[Programming Conventions]] : For developers. How to name variables, etc.<br />
* [[Licence]]<br />
* [[How to Reference Kratos]]<br />
* [[External References]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Main_PageMain Page2017-12-11T11:44:17Z<p>Jcotela: Directing users to GitHub</p>
<hr />
<div>{| class="radius" cellspacing="10" cellpadding="0" width="100%" <br />
|-<br />
| colspan = "2" style="background:#ffffff; border:1px solid #eeeeee; -moz-border-radius-topleft:0px; -moz-border-radius-bottomleft:0px; padding:10px 10px 10px 10px;" valign="top"|<br />
<center> <span style="font-size: 100%; line-height: 2"><br />
{{Main:Header}}<br />
</span> </center><br />
<div style="background:#F2CECE; color:black; text-align:center;"><br />
----<br />
== We have moved! ==<br />
<br />
The development of Kratos Multiphysics has been moved to GitHub. You can find us [https://github.com/KratosMultiphysics/Kratos in our GitHub project page]. We are keeping this wiki until the migration is complete, but it will no longer be updated. Find up-to date documentation in the new [https://github.com/KratosMultiphysics/Kratos/wiki GitHub wiki page].<br />
<br />
----<br />
</div><br />
|-<br />
<!-----------------------------<br />
LEFT BOX <br />
-------------------------------><br />
|width="52%" style="background:#EAF5FB; border:1px solid #e1eaee; font-size:100%; -moz-border-radius-topleft:0px; -moz-border-radius-bottomleft:0px; padding:7px 7px 7px 7px;" valign="top"|<br />
<!-- BLOCK 1: General --><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#F1FAFF;"<br />
<!-- TITLE 1 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #d0d9dd; text-align:center" | <br />
<div style="font-size:120%">General</div><br />
<!-- TITLE 1 (END)--><br />
<!-- TEXT 1 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; padding-bottom:2px;" |<br />
{{Main:General}}<br />
<!-- TEXT 1 (END) --><br />
|}<br />
<!-- BLOCK 1 (END) --><br />
<br />
<!-- BLOCK 2: Shortcuts--><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#F1FAFF;"<br />
<!-- TITLE 2 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #d0d9dd; text-align:center" | <br />
<div style="font-size:120%">Shortcuts</div><br />
<!-- TITLE 2 (END)--><br />
<!-- TEXT 2 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; padding-bottom:2px;" |<br />
{{Main:Shortcuts}}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<!-- TEXT 2 (END) --><br />
|}<br />
<!-- BLOCK 2 (END) --><br />
<br />
<!-- LEFT BOX (END) --><br />
<!-----------------------------<br />
RIGHT BOX<br />
-------------------------------><br />
|width="48%" style="background:#EAF5FB; border:1px solid #eeeed1; font-size:100%; -moz-border-radius-topright:0px; -moz-border-radius-bottomright:0px; padding:7px 7px 7px 7px;" valign="top"|<br />
<!-- BLOCK 1: Social --><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#EAF5FB;"<br />
<!-- TITLE 1 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #ddddc0; text-align:center;" | <br />
<div style="font-size:120%">Social</div><br />
<!-- TITLE 1 (END)--><br />
<!-- TEXT 1 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; padding-bottom:2px; padding-right:0px;" |<br />
{{Main:Social}}<br />
<!-- TEXT 1 (END) --><br />
|-<br />
| style="padding-bottom:5px;" |<br />
|}<br />
<!-- BLOCK 1 (END) --><br />
<br />
<!-- BLOCK 2: NEWS --><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#EAF5FB;"<br />
<!-- TITLE 2 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #ddddc0; text-align:center;" | <br />
<div style="font-size:120%">NEWS</div><br />
<!-- TITLE 2 (END)--><br />
|-<br />
| style="padding-bottom:5px;" |<br />
|-<br />
| style="background:#EAF5FB;font-size:9pt; text-align:center;" | <small>{{LOCALTIME}}; ''Today is {{CURRENTMONTHNAME}}, {{LOCALDAYNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}''</small> <br />
<!-- TEXT 2 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; |<br />
{{Main:NEWS}}<br />
<!-- TEXT 2 (END) --><br />
|}<br />
<!-- BLOCK 2 (END) --><br />
<br />
<!-- RIGHT BOX (END) --><br />
<br />
<br />
<br />
<br />
<br />
__NOTOC__<br />
<br />
[[Category:Main]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Fluid_Dynamics_ApplicationFluid Dynamics Application2016-04-01T10:03:23Z<p>Jcotela: Created page with "'''UNDER CONSTRUCTION : "we are now building this page"''' == Theory == '''Continuum Solid Mechanics Theory''' and '''Non-Linear Finite Elements Theory''' == Application cont..."</p>
<hr />
<div>'''UNDER CONSTRUCTION : "we are now building this page"'''<br />
<br />
== Theory ==<br />
<br />
'''Continuum Solid Mechanics Theory''' and '''Non-Linear Finite Elements Theory'''<br />
<br />
== Application contents ==<br />
<br />
=== Finite element solvers ===<br />
<br />
The application provides solvers for the Stokes and Navier-Stokes problems using stabilized finite element strategies. While the default approach is based on an Eulerian description of the flow (fixed mesh), all elements support moving parts descirbed using an Arbitrary Lagrangian-Eulerian (ALE) description of motion.<br />
<br />
=== Numerical approach ===<br />
<br />
==== Elements ====<br />
<br />
Support for linear triangles and tetrahedra. All elements use Variational Multiscale (VMS) stabilization.<br />
<br />
* The element used by the monolithic solver supports either ASGS or OSS stabilization.<br />
* The fractional step element uses split-OSS type stabilization.<br />
<br />
==== Boundary Conditions ====<br />
<br />
* Fixed inflow velocity.<br />
* Slip and No-slip fixed boundaries.<br />
* Turbulent wall-law friction: log-linear and Werner-Wengle models.<br />
* Imposed external pressure.<br />
<br />
==== Turbulence ====<br />
<br />
Support for turbulence modelling:<br />
<br />
* RANS: Spalart-Allmaras.<br />
* LES: Smagorinsky.<br />
<br />
==== Constitutive Laws ====<br />
<br />
* Newtonian.<br />
* Bingham.<br />
* Hershel-Bulkley.<br />
<br />
==== Time Integration Schemes ====<br />
<br />
* Steady solution.<br />
* Bossak (generalized-alpha type scheme).<br />
* BDF2.<br />
<br />
==== Solving Strategies ====<br />
<br />
* Stokes solver.<br />
* Navier-Stokes Monolithic solution strategy.<br />
* Segregated Navier-Stokes fractional-step strategy.<br />
* Support for embedded objects.<br />
<br />
==== Utilities ====<br />
<br />
* Basic support for Dynamic Smagorinsky LES modeling.<br />
* Periodic boundary conditions.<br />
<br />
== Benchmarks ==<br />
<br />
"'''under construction'''"<br />
<br />
Insert here all the '''benchmarks''' of the application.<br />
<br />
For every benchmark insert a video or a photo (not only a link)<br />
<br />
For every benchmark<br />
- brief description of the solved problem, if it is a benchmark that can be found in literature, insert the link to the reference or, at least a reference).<br />
- reference with a link the location in which you describe all the theory behind [[Numerical approach]].<br />
<br />
== Application Dependencies ==<br />
<br />
=== Other Kratos Applications used in current application: ===<br />
<br />
Optional:<br />
<br />
* Introduction of moving parts in the model though the [[ALEApplication]].<br />
* Interface to additional linear solvers through the [[ExternalSolversApplication]].<br />
* Distributed memory (MPI) support through the [[TrilinosApplication]].<br />
<br />
== Contact ==<br />
<br />
Please direct any questions regarding this application to the [http://kratos-wiki.cimne.upc.edu/forum/index.php Kratos Forum].<br />
<br />
== Programming Documentation ==<br />
<br />
* [[Programming Conventions]]<br />
<br />
[[Category: Applications]]<br />
[[Category: Fluid Dynamics Application]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/LinuxInstallLinuxInstall2015-01-12T16:21:10Z<p>Jcotela: /* Test */</p>
<hr />
<div>== How to compile Kratos: Linux ==<br />
<br />
In this section we are going to go through the process of compiling a basic version of Kratos Multiphysics under linux environments. Specifically, we explain how to compile in Ubuntu 14.04 LTS, with the latest checked libraries. A basic knowledge of Linux is assumed ( execute commands, create directories, etc...)<br />
<br />
=== Subversion ===<br />
<br />
* Objectives: <br />
** Install subversion<br />
** Get Kratos Multiphysics source code<br />
<br />
The first thing you will need is the Kratos Multiphysics source code. To download the code you will have to use a subversion manager. You can install the default subversion by using this command:<br />
<br />
$sudo apt-get install subversion<br />
<br />
Once subversion is installed you can fetch the code by using this command:<br />
<br />
$svn co https://svn.cimne.upc.edu/p/kratos/kratos<br />
<br />
=== Dev Packages === <br />
<br />
* Objectives:<br />
** Get Python3-dev<br />
** Get Fortran compiler<br />
** Get LIBBLAS and LIBLAPACK <br />
<br />
You will need python dev files in order to compile kratos and some of its dependent libraries. Whether you wish to use python 3 ( recommended ) or python 2, you will need to install its dev files. This guide will show the process to install python 3.4 dev files, as is its recommended version.<br />
<br />
$sudo apt-get install python3-dev<br />
<br />
Additionally you will need a fortran compiler, which is not present in ubuntu 14.04 by default:<br />
<br />
$sudo apt-get install gfortran<br />
<br />
We will also need an implementation of blas and lapack. You can obtain an implementation by:<br />
<br />
$sudo apt-get install libblas-dev<br />
$sudo apt-get install liblapack-dev<br />
<br />
Notice that if you prefer, you can compile other BLAS implementation like ATLAS. <br />
<br />
=== Boost === <br />
<br />
* Objectives:<br />
** Compile boost libraries<br />
<br />
The next step will consist in compile Boost. Kratos Multiphysics needs Boost libraries to support some of its functions. We recommend you to use '''version 1.57'''. You can download boost from its official website:<br />
<br />
http://www.boost.org/users/download/<br />
<br />
Navigate to the directory where you have extracted boost and execute this command:<br />
<br />
$sh bootstrap.sh<br />
<br />
Some additional files will be generated.<br />
<br />
By default, boost will try to link with python 2.7. '''It is important to manually specify that we want to use python 3 by adding “using python : 3.4 : /usr ;”''' to the file project-config.jam. It will look like this:<br />
<br />
# Boost.Build Configuration<br />
# Automatically generated by bootstrap.sh<br />
<br />
import option ;<br />
import feature ;<br />
<br />
# Compiler configuration. This definition will be used unless<br />
# you already have defined some toolsets in your user-config.jam<br />
# file.<br />
if ! gcc in [ feature.values <toolset> ]<br />
{<br />
using gcc ; <br />
}<br />
<br />
project : default-build <toolset>gcc ;<br />
<br />
<span style="color:red">'''# Python configuration'''</span><br />
<span style="color:red">'''using python : 3.4 : /usr ;'''</span><br />
<br />
# List of --with-<library> and --without-<library><br />
# options. If left empty, all libraries will be built.<br />
# Options specified on the command line completely<br />
# override this variable.<br />
libraries = ;<br />
<br />
# These settings are equivalent to corresponding command-line<br />
# options.<br />
option.set prefix : /usr/local ;<br />
option.set exec-prefix : /usr/local ;<br />
option.set libdir : /usr/local/lib ;<br />
option.set includedir : /usr/local/include ;<br />
<br />
# Stop on first error<br />
option.set keep-going : false ;<br />
<br />
After modifying it you will have to compile the required boost libraries using this command. Notice that this will only compile “serialization” and “python” libraries. If you need further libraries, you will need to explicitly tell boost to compile them.<br />
<br />
$./b2 --with-python --with-serialization<br />
<br />
=== CMake === <br />
<br />
* Objectives:<br />
** Install CMake<br />
<br />
Cmake is the tool used to compile kratos. To install it simply execute this command:<br />
<br />
$sudo apt-get install cmake<br />
<br />
=== Configure === <br />
<br />
* Objectives:<br />
** Configure Kratos for the first time compilation<br />
<br />
In order to compile kratos for the first time you will need to configure the project. First, navigate to your kratos/cmake_build folder and make a copy of the template file:<br />
<br />
$cp example_configure.sh configure.sh<br />
<br />
Then, open configure.sh with any text editor and modify the lines that tell cmake where some components are located.<br />
You will need to provide at least '''BOOST_ROOT''', '''PYTHON_LIBRARY''' and '''PYTHON_INCLUDE_DIR'''. It is also recommended to change '''KRATOS_INSTALL_PREFIX'''<br />
<br />
* Option<br />
** BOOST_ROOT: Directory where you have compiled boost<br />
** PYTHON_LIBRARY: Location of the python librarie used to compile boost<br />
** PYTHON_INCLUDE_DIR: Location of the python headers<br />
** KRATOS_INSTALL_PREFIX: Sets the install directory<br />
<br />
For example, in ubuntu it will look something like:<br />
<br />
-DBOOST_ROOT="~/compiled_libraries/boost_1_57_0" \<br />
-DPYTHON_LIBRARY="/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu/libpython3.4m.so" \<br />
-DPYTHON_INCLUDE_DIR="/usr/include/python3.4" \<br />
<br />
It is also recomended that you specify the directory where kratos is goin to be installed. You can do that by changing <br />
the path in '''-DKRATOS_INSTALL_PREFIX'''. If the variable is not set, the installation will be done in the source directory.<br />
<br />
-DKRATOS_INSTALL_PREFIX="/path/to/my/kratos/installation" \<br />
<br />
Notice that you can also turn ON/OFF parts of the code according to your necessities:<br />
<br />
-DSTRUCTURAL_APPLICATION=<span style="color:green">'''ON'''</span>/<span style="color:red">'''OFF'''</span> <br />
<br />
{{Warning|<br />
* Cmake requires all definitions in a single line! The line concatenation character '\' therefore MUST NOT be followed by any whitespace in the same line as this would prevent the cmake from running the lines below<br />
}}<br />
<br />
=== Compile === <br />
<br />
* Objectives:<br />
** Compile kratos.<br />
<br />
If you followed all the steps correctly, compile kratos should be as easy as executing the configure script:<br />
<br />
$sh configure.sh<br />
<br />
Please, notice that kratos is big and the compilation process can easily take 1 or 2 hours, depending on which applications are being compiled. A typical compilation process with the default configuration takes approximately 45 minutes with a i7 / 8GB Ram computer.<br />
<br />
=== Setting up your enviroment === <br />
<br />
* Objectives:<br />
** Tell Linux how to execute kratos<br />
<br />
Once Kratos ins compiled, you will have to tell the OS where to find the libraries. You can do that<br />
by executing these commands. Notice that '''you have to put the same path as in the step 5'''<br />
<br />
$echo "export PYTHONPATH=/path/to/my/kratos/installation:$PYTHONPATH" >> $HOME/.bashrc<br />
$echo "export LD_LIBRARY_PATH=/path/to/my/kratos/installation/libs:$LD_LIBRARY_PATH" >> $HOME/.bashrc<br />
<br />
If you have enabled the embedded python option, you can also add<br />
<br />
$echo "export PATH=/path/to/my/kratos/installation:$PATH" >> $HOME/.bashrc<br />
<br />
In order to have the "runkratos" available as a regular command.<br />
<br />
Now each time you open a terminal these commands will be executed and the paths set automatically. <br />
If you don't want to reset your terminal the first time, just execute:<br />
<br />
$source ~/.bashrc<br />
<br />
=== Test === <br />
<br />
* Objectives:<br />
** Tests kratos<br />
<br />
To to tests the compilation, you can execute a simple python script containing this line:<br />
<br />
from KratosMultiphysics import *<br />
<br />
If everething was ok you will see this message:<br />
<br />
| / | <br />
' / __| _` | __| _ \ __|<br />
. \ | ( | | ( |\__ \ <br />
_|\_\_| \__,_|\__|\___/ ____/<br />
Multi-Physics 3.3.11016<br />
<br />
== Troubleshooting ==<br />
<br />
In this section we provide will try to provide solutions to the most common problems and issues that may appear during the compilation process<br />
<br />
=== I am getting ''"boost::python::detail::init_module(char const*, void (*)())"'' link errors ===<br />
<br />
This error appear the version of python used to compile boost is not the same as the one<br />
used by Kratos.<br />
<br />
There are several causes that may be causing this. Pleas try the following:<br />
<br />
==== Python version mismatch ====<br />
The most provable reason for this error to happend is a missmatch between the python versions used by Kratos and Boost. Please, double check you have the same version of python in the projet-config.jam (boost) and configure.sh (Kratos) files.<br />
<br />
==== Old version of CMake ====<br />
If the error remains, please check that CMake version is 3.0.2 or newer. If it is not, it will be unable to load python 3.4.<br />
To solve the error please '''upgrade to CMake 3.0.2'''.<br />
<br />
It has been observed that compiling with IDE's ( QTCreator, Netbeans, ...) sometimes causes this error as well.<br />
If you are experiencing this problem, try to modify the configure.sh script and replace '''cmake''' by the absolute path of CMake 3.0.2:<br />
<br />
<span style="color:red">'''/path/to/correct/cmake ..'''</span> \<br />
-DCMAKE_C_COMPILER=/usr/bin/gcc \<br />
-DCMAKE_INSTALL_RPATH="/home/youruser/kratos/kratos/libs" \<br />
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \<br />
...<br />
<br />
If for some reason you have to use an older version of CMake you can manually add support for python 3.4 by adding the version to these files:<br />
<br />
/usr/share/cmake-2.8/Modules/FindPythonLibs.cmake (line 41)<br />
/usr/share/cmake-2.8/Modules/FindPythonInterp.cmake (line 36)<br />
<br />
Please add the version at the begining of the list:<br />
<br />
SET(_PYTHON1_VERSIONS 1.6 1.5)<br />
SET(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)<br />
SET(_PYTHON3_VERSIONS <span style="color:red">'''3.4'''</span> 3.3 3.2 3.1 3.0)<br />
<br />
=== I am getting lots of warnings when I compile Kratos ===<br />
<br />
It is known that in some cases warnings appear while including boost files due to the fact that the flag '''"-Wunused-local-typedefs"'''<br />
is set by default in gcc.<br />
<br />
This does not have any impact on the final code, but if you want a cleaner output you can add the flag '''"-Wno-unused-local-typedefs"''' to the configuration files:<br />
<br />
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -msse3 -Wno-unused-local-typedefs" \<br />
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -msse3 -Wno-unused-local-typedefs" \</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/LinuxInstallLinuxInstall2014-12-07T13:29:17Z<p>Jcotela: typo</p>
<hr />
<div>== How to compile Kratos: Linux ==<br />
<br />
In this section we are going to go through the process of compiling a basic version of Kratos Multiphysics under linux environments. Specifically, we explain how to compile in Ubuntu 14.04 LTS, with the latest checked libraries. A basic knowledge of Linux is assumed ( execute commands, create directories, etc...)<br />
<br />
=== Subversion ===<br />
<br />
* Objectives: <br />
** Install subversion<br />
** Get Kratos Multiphysics source code<br />
<br />
The first thing you will need is the Kratos Multiphysics source code. To download the code you will have to use a subversion manager. You can install the default subversion by using this command:<br />
<br />
$sudo apt-get install subversion<br />
<br />
Once subversion is installed you can fetch the code by using this command:<br />
<br />
$svn co https://svn.cimne.upc.edu/p/kratos/kratos<br />
<br />
=== Dev Packages === <br />
<br />
* Objectives:<br />
** Get Python3-dev<br />
** Get Fortran compiler<br />
** Get LIBBLAS and LIBLAPACK <br />
<br />
You will need python dev files in order to compile kratos and some of its dependent libraries. Whether you wish to use python 3 ( recommended ) or python 2, you will need to install its dev files. This guide will show the process to install python 3.4 dev files, as is its recommended version.<br />
<br />
$sudo apt-get install python3-dev<br />
<br />
Additionally you will need a fortran compiler, which is not present in ubuntu 14.04 by default:<br />
<br />
$sudo apt-get install gfortran<br />
<br />
We will also need an implementation of blas and lapack. You can obtain an implementation by:<br />
<br />
$sudo apt-get install libblas-dev<br />
$sudo apt-get install liblapack-dev<br />
<br />
Notice that if you prefer, you can compile other BLAS implementation like ATLAS. <br />
<br />
=== Boost === <br />
<br />
* Objectives:<br />
** Compile boost libraries<br />
<br />
The next step will consist in compile Boost. Kratos Multiphysics needs Boost libraries to support some of its functions. We recommend you to use '''version 1.57'''. You can download boost from its official website:<br />
<br />
http://www.boost.org/users/download/<br />
<br />
Navigate to the directory where you have extracted boost and execute this command:<br />
<br />
$sh bootstrap.sh<br />
<br />
Some additional files will be generated.<br />
<br />
By default, boost will try to link with python 2.7. '''It is important to manually specify that we want to use python 3 by adding “using python : 3.4 : /usr ;”''' to the file project-config.jam. It will look like this:<br />
<br />
# Boost.Build Configuration<br />
# Automatically generated by bootstrap.sh<br />
<br />
import option ;<br />
import feature ;<br />
<br />
# Compiler configuration. This definition will be used unless<br />
# you already have defined some toolsets in your user-config.jam<br />
# file.<br />
if ! gcc in [ feature.values <toolset> ]<br />
{<br />
using gcc ; <br />
}<br />
<br />
project : default-build <toolset>gcc ;<br />
<br />
<span style="color:red">'''# Python configuration'''</span><br />
<span style="color:red">'''using python : 3.4 : /usr ;'''</span><br />
<br />
# List of --with-<library> and --without-<library><br />
# options. If left empty, all libraries will be built.<br />
# Options specified on the command line completely<br />
# override this variable.<br />
libraries = ;<br />
<br />
# These settings are equivalent to corresponding command-line<br />
# options.<br />
option.set prefix : /usr/local ;<br />
option.set exec-prefix : /usr/local ;<br />
option.set libdir : /usr/local/lib ;<br />
option.set includedir : /usr/local/include ;<br />
<br />
# Stop on first error<br />
option.set keep-going : false ;<br />
<br />
After modifying it you will have to compile the required boost libraries using this command. Notice that this will only compile “serialization” and “python” libraries. If you need further libraries, you will need to explicitly tell boost to compile them.<br />
<br />
$./b2 --with-python --with-serialization<br />
<br />
=== CMake === <br />
<br />
* Objectives:<br />
** Install CMake<br />
<br />
Cmake is the tool used to compile kratos. To install it simply execute this command:<br />
<br />
$sudo apt-get install cmake<br />
<br />
=== Configure === <br />
<br />
* Objectives:<br />
** Configure Kratos for the first time compilation<br />
<br />
In order to compile kratos for the first time you will need to configure the project. First, navigate to your kratos/cmake_build folder and make a copy of the template file:<br />
<br />
$cp example_configure.sh configure.sh<br />
<br />
Then, open configure.sh with any text editor and modify the lines that tell cmake where some components are located.<br />
You will need to provide at least '''BOOST_ROOT''', '''PYTHON_LIBRARY''' and '''PYTHON_INCLUDE_DIR'''. It is also recommended to change '''KRATOS_INSTALL_PREFIX'''<br />
<br />
* Option<br />
** BOOST_ROOT: Directory where you have compiled boost<br />
** PYTHON_LIBRARY: Location of the python librarie used to compile boost<br />
** PYTHON_INCLUDE_DIR: Location of the python headers<br />
** KRATOS_INSTALL_PREFIX: Sets the install directory<br />
<br />
For example, in ubuntu it will look something like:<br />
<br />
-DBOOST_ROOT="~/compiled_libraries/boost_1_57_0" \<br />
-DPYTHON_LIBRARY="/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu/libpython3.4m.so" \<br />
-DPYTHON_INCLUDE_DIR="/usr/include/python3.4" \<br />
<br />
It is also recomended that you specify the directory where kratos is goin to be installed. You can do that by changing <br />
the path in '''-DKRATOS_INSTALL_PREFIX'''. If the variable is not set, the installation will be done in the source directory.<br />
<br />
-DKRATOS_INSTALL_PREFIX="/path/to/my/kratos/installation" \<br />
<br />
Notice that you can also turn ON/OFF parts of the code according to your necessities:<br />
<br />
-DSTRUCTURAL_APPLICATION=<span style="color:green">'''ON'''</span>/<span style="color:red">'''OFF'''</span> <br />
<br />
{{Warning|<br />
* Cmake requires all definitions in a single line! The line concatenation character '\' therefore MUST NOT be followed by any whitespace in the same line as this would prevent the cmake from running the lines below<br />
}}<br />
<br />
=== Compile === <br />
<br />
* Objectives:<br />
** Compile kratos.<br />
<br />
If you followed all the steps correctly, compile kratos should be as easy as executing the configure script:<br />
<br />
$sh configure.sh<br />
<br />
Please, notice that kratos is big and the compilation process can easily take 1 or 2 hours, depending on which applications are being compiled. A typical compilation process with the default configuration takes approximately 45 minutes with a i7 / 8GB Ram computer.<br />
<br />
=== Setting up your enviroment === <br />
<br />
* Objectives:<br />
** Tell Linux how to execute kratos<br />
<br />
Once Kratos ins compiled, you will have to tell the OS where to find the libraries. You can do that<br />
by executing these commands. Notice that '''you have to put the same path as in the step 5'''<br />
<br />
$echo "export PYTHONPATH=/path/to/my/kratos/installation:$PYTHONPATH" >> $HOME/.bashrc<br />
$echo "export LD_LIBRARY_PATH=/path/to/my/kratos/installation/libs:$LD_LIBRARY_PATH" >> $HOME/.bashrc<br />
<br />
Now each time you open a terminal these commands will be executed and the paths set automatically. <br />
If you don't want to reset your terminal the first time, just execute:<br />
<br />
$source ~/.bashrc<br />
<br />
=== Test === <br />
<br />
* Objectives:<br />
** Tests kratos<br />
<br />
To to tests the compilation, you can execute a simple python script containing this line:<br />
<br />
form KratosMultiphysics import *<br />
<br />
If everething was ok you will see this message:<br />
<br />
| / | <br />
' / __| _` | __| _ \ __|<br />
. \ | ( | | ( |\__ \ <br />
_|\_\_| \__,_|\__|\___/ ____/<br />
Multi-Physics 3.3.11016<br />
<br />
== Troubleshooting ==<br />
<br />
In this section we provide will try to provide solutions to the most common problems and issues that may appear during the compilation process<br />
<br />
=== I am getting ''"boost::python::detail::init_module(char const*, void (*)())"'' link errors ===<br />
<br />
This error appear the version of python used to compile boost is not the same as the one<br />
used by Kratos.<br />
<br />
There are several causes that may be causing this. Pleas try the following:<br />
<br />
==== Python version mismatch ====<br />
The most provable reason for this error to happend is a missmatch between the python versions used by Kratos and Boost. Please, double check you have the same version of python in the projet-config.jam (boost) and configure.sh (Kratos) files.<br />
<br />
==== Old version of CMake ====<br />
If the error remains, please check that CMake version is 3.0.2 or newer. If it is not, it will be unable to load python 3.4.<br />
To solve the error please '''upgrade to CMake 3.0.2'''.<br />
<br />
It has been observed that compiling with IDE's ( QTCreator, Netbeans, ...) sometimes causes this error as well.<br />
If you are experiencing this problem, try to modify the configure.sh script and replace '''cmake''' by the absolute path of CMake 3.0.2:<br />
<br />
<span style="color:red">'''/path/to/correct/cmake ..'''</span> \<br />
-DCMAKE_C_COMPILER=/usr/bin/gcc \<br />
-DCMAKE_INSTALL_RPATH="/home/youruser/kratos/kratos/libs" \<br />
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \<br />
...<br />
<br />
If for some reason you have to use an older version of CMake you can manually add support for python 3.4 by adding the version to these files:<br />
<br />
/usr/share/cmake-2.8/Modules/FindPythonLibs.cmake (line 41)<br />
/usr/share/cmake-2.8/Modules/FindPythonInterp.cmake (line 36)<br />
<br />
Please add the version at the begining of the list:<br />
<br />
SET(_PYTHON1_VERSIONS 1.6 1.5)<br />
SET(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)<br />
SET(_PYTHON3_VERSIONS <span style="color:red">'''3.4'''</span> 3.3 3.2 3.1 3.0)<br />
<br />
=== I am getting lots of warnings when I compile Kratos ===<br />
<br />
It is known that in some cases warnings appear while including boost files due to the fact that the flag '''"-Wunused-local-typedefs"'''<br />
is set by default in gcc.<br />
<br />
This does not have any impact on the final code, but if you want a cleaner output you can add the flag '''"-Wno-unused-local-typedefs"''' to the configuration files:<br />
<br />
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -msse3 -Wno-unused-local-typedefs" \<br />
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -msse3 -Wno-unused-local-typedefs" \</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/User:JcotelaUser:Jcotela2013-09-19T07:35:39Z<p>Jcotela: </p>
<hr />
<div>= Kratos Course 2013 =<br />
<br />
== Before we start ==<br />
<br />
Usually, the Python interpreter can be called from command line. To execute the commands in a file, lets say script.py, we can use the instruction<br />
<br />
python script.py<br />
<br />
Exceptionally, for this course, we are using a non-standard python installation so, for today, download the following file [https://dl.dropboxusercontent.com/u/24737069/run.sh] and copy it to your problem’s folder (for example, inside cylinder.gid)<br />
<br />
To run a python script, on a command window, go to the model’s folder and type<br />
<br />
./run.sh script.py<br />
<br />
First, we will create a new Python file to work on. To do this, we create a copyuse the default script (KratosOpenMP.py) to use as a starting point:<br />
<br />
cp KratosOpenMP.py script.py<br />
<br />
Open script.py on a text editor.<br />
<br />
== A first Python example ==<br />
<br />
The following function defines a parabolic velocity profile, with different values depending on the Y coordinate (we are assuming that the Y coordinates vary from 0 to h)<br />
<br />
def get_boundary_velocity(y,u_max,h):<br />
return (1-y/h)*(y/h)*u_max<br />
<br />
we can use it as an initial condition by assigning it to all nodes in the model (correct the value of h if your model has a different size)<br />
<br />
u_max = 0.01<br />
h = 2.0<br />
for node in fluid_model_part.Nodes:<br />
u_node = get_boundary_velocity(node.Y,u_max,h)<br />
node.SetSolutionStepValue(VELOCITY_X,0,u_node)<br />
<br />
Paste the last two pieces of code into script.py (just before the '''while''' solution loop is a fine place) and run your script.<br />
<br />
Alternatively, we could use it as an inlet boundary condition by asigning it only to the leftmost nodes (I’m assuming here that the inlet boundary is defined by x=0)<br />
<br />
u_max = 0.01<br />
h = 2.0<br />
for node in fluid_model_part.Nodes:<br />
if node.X == 0.0:<br />
u_node = get_boundary_velocity(node.Y,u_max,h)<br />
node.SetSolutionStepValue(VELOCITY_X,0,u_node)<br />
node.Fix(VELOCITY_X)<br />
<br />
A similar technique can be used to print information about particular nodes:<br />
<br />
id_to_track = 50<br />
for node in fluid_model_part.Nodes:<br />
if node.Id == id_to_track:<br />
this_node = node<br />
<br />
With this, we have a pointer to a node we are interested in. Later, in the solution loop, we can use it to display information of interest<br />
<br />
print "Pressure on node 50 is",node.GetSolutionStepValue(PRESSURE,0)<br />
<br />
<br />
<br />
= Older stuff =<br />
<br />
[[Required components]]<br />
[[How to refine an existing triangular or tetrahedral mesh]]<br />
<br />
== Kratos Structure ==<br />
<br />
* [[Kratos Structure: Global Design. Kernel and Applications]]<br />
* [[Kratos Structure: Design Concepts. Basic Object Classes]]<br />
* [[Kratos Structure: Node and Nodal Data]]<br />
* [[Kratos Structure: Elements and Conditions]]<br />
* [[Kratos Structure: Mesh and ModelPart]]<br />
* [[Kratos Structure: Strategies and Processes]]<br />
* [[Kratos Structure: Workflow]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/User:JcotelaUser:Jcotela2013-09-19T07:33:09Z<p>Jcotela: </p>
<hr />
<div>= Kratos Course 2013 =<br />
<br />
== Before we start ==<br />
<br />
Usually, the Python interpreter can be called from command line. To execute the commands in a file, lets say script.py, we can use the instruction<br />
<br />
python script.py<br />
<br />
Exceptionally, for this course, we are using a non-standard python installation so, for today, download the following file [https://dl.dropboxusercontent.com/u/24737069/run.sh] and copy it to your problem’s folder (for example, inside cylinder.gid)<br />
<br />
To run a python script, on a command window, go to the model’s folder and type<br />
<br />
./run.sh script.py<br />
<br />
First, we will create a new Python file to work on. To do this, we create a copyuse the default script (KratosOpenMP.py) to use as a starting point:<br />
<br />
cp KratosOpenMP.py script.py<br />
<br />
Open script.py on a text editor.<br />
<br />
== A first Python example ==<br />
<br />
The following function defines a parabolic velocity profile, with different values depending on the Y coordinate (we are assuming that the Y coordinates vary from 0 to h)<br />
<br />
def get_boundary_velocity(y,u_max,h):<br />
return (1-y/h)*(y/h)*u_max<br />
<br />
we can use it as an initial condition by assigning it to all nodes in the model (correct the value of h if your model has a different size)<br />
<br />
u_max = 0.01<br />
h = 2.0<br />
for node in fluid_model_part.Nodes:<br />
u_node = get_boundary_velocity(node.Y,u_max,h)<br />
node.SetSolutionStepValue(VELOCITY_X,0,u_node)<br />
<br />
Paste the last two pieces of code into script.py (just before the **while** solution loop is a fine place) and run your script.<br />
<br />
Alternatively, we could use it as an inlet boundary condition by asigning it only to the leftmost nodes (I’m assuming here that the inlet boundary is defined by x=0)<br />
<br />
u_max = 0.01<br />
h = 2.0<br />
for node in fluid_model_part.Nodes:<br />
if node.X == 0.0:<br />
u_node = get_boundary_velocity(node.Y,u_max,h)<br />
node.SetSolutionStepValue(VELOCITY_X,0,u_node)<br />
node.Fix(VELOCITY_X)<br />
<br />
A similar technique can be used to print information about particular nodes:<br />
<br />
id_to_track = 50<br />
for node in fluid_model_part.Nodes:<br />
if node.Id == id_to_track:<br />
this_node = node<br />
<br />
With this, we have a pointer to a node we are interested in. Later, in the solution loop, we can use it to display information of interest<br />
<br />
print "Pressure on node 50 is",node.GetSolutionStepValue(PRESSURE,0)<br />
<br />
<br />
<br />
= Older stuff =<br />
<br />
[[Required components]]<br />
[[How to refine an existing triangular or tetrahedral mesh]]<br />
<br />
== Kratos Structure ==<br />
<br />
* [[Kratos Structure: Global Design. Kernel and Applications]]<br />
* [[Kratos Structure: Design Concepts. Basic Object Classes]]<br />
* [[Kratos Structure: Node and Nodal Data]]<br />
* [[Kratos Structure: Elements and Conditions]]<br />
* [[Kratos Structure: Mesh and ModelPart]]<br />
* [[Kratos Structure: Strategies and Processes]]<br />
* [[Kratos Structure: Workflow]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/User:JcotelaUser:Jcotela2013-09-18T16:54:20Z<p>Jcotela: /* A first Python example */</p>
<hr />
<div>= Kratos Course 2013 =<br />
<br />
== Before we start ==<br />
<br />
Usually, the Python interpreter can be called from command line. To execute the commands in a file, lets say script.py, we can use the instruction<br />
<br />
python script.py<br />
<br />
Exceptionally, for this course, we are using a non-standard python installation so, for today, download the following file [https://dl.dropboxusercontent.com/u/24737069/run.sh] and copy it to your problem’s folder (for example, inside cylinder.gid)<br />
<br />
To run a python script, on a command window, go to the model’s folder and type<br />
<br />
./run.sh script.py<br />
<br />
First, we will create a new Python file to work on. To do this, we create a copyuse the default script (KratosOpenMP.py) to use as a starting point:<br />
<br />
cp KratosOpenMP.py script.py<br />
<br />
Open script.py on a text editor.<br />
<br />
== A first Python example ==<br />
<br />
The following function defines a parabolic velocity profile, with different values depending on the Y coordinate (we are assuming that the Y coordinates vary from 0 to h)<br />
<br />
def get_boundary_velocity(y,u_max,h):<br />
return (1-y/h)*(y/h)*u_max<br />
<br />
we can use it as an initial condition by assigning it to all nodes in the model (correct the value of h if your model has a different size)<br />
<br />
u_max = 0.01<br />
h = 2.0<br />
for node in fluid_model_part.Nodes:<br />
u_node = get_boundary_velocity(node.Y,u_max,h)<br />
node.SetSolutionStepValue(VELOCITY_X,0,u_node)<br />
<br />
Paste the last two pieces of code into script.py (just before the **while** solution loop is a fine place) and run your script.<br />
<br />
Alternatively, we could use it as an inlet boundary condition by asigning it only to the leftmost nodes (I’m assuming here that the inlet boundary is defined by x=0)<br />
<br />
u_max = 0.01<br />
h = 2.0<br />
for node in fluid_model_part.Nodes:<br />
if node.X == 0.0:<br />
u_node = get_boundary_velocity(node.Y,u_max,h)<br />
node.SetSolutionStepValue(VELOCITY_X,0,u_node)<br />
node.Fix(VELOCITY_X)<br />
<br />
= Older stuff =<br />
<br />
[[Required components]]<br />
[[How to refine an existing triangular or tetrahedral mesh]]<br />
<br />
== Kratos Structure ==<br />
<br />
* [[Kratos Structure: Global Design. Kernel and Applications]]<br />
* [[Kratos Structure: Design Concepts. Basic Object Classes]]<br />
* [[Kratos Structure: Node and Nodal Data]]<br />
* [[Kratos Structure: Elements and Conditions]]<br />
* [[Kratos Structure: Mesh and ModelPart]]<br />
* [[Kratos Structure: Strategies and Processes]]<br />
* [[Kratos Structure: Workflow]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/User:JcotelaUser:Jcotela2013-09-18T16:35:11Z<p>Jcotela: </p>
<hr />
<div>= Kratos Course 2013 =<br />
<br />
== Before we start ==<br />
<br />
Usually, the Python interpreter can be called from command line. To execute the commands in a file, lets say script.py, we can use the instruction<br />
<br />
python script.py<br />
<br />
Exceptionally, for this course, we are using a non-standard python installation so, for today, download the following file [https://dl.dropboxusercontent.com/u/24737069/run.sh] and copy it to your problem’s folder (for example, inside cylinder.gid)<br />
<br />
To run a python script, on a command window, go to the model’s folder and type<br />
<br />
./run.sh script.py<br />
<br />
First, we will create a new Python file to work on. To do this, we create a copyuse the default script (KratosOpenMP.py) to use as a starting point:<br />
<br />
cp KratosOpenMP.py script.py<br />
<br />
Open script.py on a text editor.<br />
<br />
== A first Python example ==<br />
<br />
<br />
<br />
= Older stuff =<br />
<br />
[[Required components]]<br />
[[How to refine an existing triangular or tetrahedral mesh]]<br />
<br />
== Kratos Structure ==<br />
<br />
* [[Kratos Structure: Global Design. Kernel and Applications]]<br />
* [[Kratos Structure: Design Concepts. Basic Object Classes]]<br />
* [[Kratos Structure: Node and Nodal Data]]<br />
* [[Kratos Structure: Elements and Conditions]]<br />
* [[Kratos Structure: Mesh and ModelPart]]<br />
* [[Kratos Structure: Strategies and Processes]]<br />
* [[Kratos Structure: Workflow]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/New_Main_PageNew Main Page2012-10-04T09:21:12Z<p>Jcotela: </p>
<hr />
<div>{| class="radius" cellspacing="10" cellpadding="0" width="100%" <br />
|-<br />
| colspan = "2" style="background:#ffffff; border:1px solid #eeeeee; -moz-border-radius-topleft:0px; -moz-border-radius-bottomleft:0px; padding:10px 10px 10px 10px;" valign="top"|<br />
<center> <span style="font-size: 100%; line-height: 2"><br />
{{Main:Header}}<br />
</span> </center><br />
|-<br />
<!-----------------------------<br />
LEFT BOX <br />
-------------------------------><br />
|width="52%" style="background:#EAF5FB; border:1px solid #e1eaee; font-size:100%; -moz-border-radius-topleft:0px; -moz-border-radius-bottomleft:0px; padding:7px 7px 7px 7px;" valign="top"|<br />
<!-- BLOCK 1: General --><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#F1FAFF;"<br />
<!-- TITLE 1 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #d0d9dd; text-align:center" | <br />
<div style="font-size:120%">General</div><br />
<!-- TITLE 1 (END)--><br />
<!-- TEXT 1 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; padding-bottom:2px;" |<br />
{{Main:General}}<br />
<!-- TEXT 1 (END) --><br />
|}<br />
<!-- BLOCK 1 (END) --><br />
<br />
<!-- BLOCK 2: Shortcuts--><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#F1FAFF;"<br />
<!-- TITLE 2 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #d0d9dd; text-align:center" | <br />
<div style="font-size:120%">Shortcuts</div><br />
<!-- TITLE 2 (END)--><br />
<!-- TEXT 2 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; padding-bottom:2px;" |<br />
{{Main:Shortcuts}}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<!-- TEXT 2 (END) --><br />
|}<br />
<!-- BLOCK 2 (END) --><br />
<br />
<!-- LEFT BOX (END) --><br />
<!-----------------------------<br />
RIGHT BOX<br />
-------------------------------><br />
|width="48%" style="background:#EAF5FB; border:1px solid #eeeed1; font-size:100%; -moz-border-radius-topright:0px; -moz-border-radius-bottomright:0px; padding:7px 7px 7px 7px;" valign="top"|<br />
<!-- BLOCK 1: Social --><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#EAF5FB;"<br />
<!-- TITLE 1 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #ddddc0; text-align:center;" | <br />
<div style="font-size:120%">Social</div><br />
<!-- TITLE 1 (END)--><br />
<!-- TEXT 1 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; padding-bottom:2px; padding-right:0px;" |<br />
{{Main:Social}}<br />
<!-- TEXT 1 (END) --><br />
|-<br />
| style="padding-bottom:5px;" |<br />
|}<br />
<!-- BLOCK 1 (END) --><br />
<br />
<!-- BLOCK 2: NEWS --><br />
{| width=100% cellpadding="0" cellspacing="0" valign="top" style="background:#EAF5FB;"<br />
<!-- TITLE 2 --><br />
|-<br />
! style="background:#e1eaee; border:1px solid #ddddc0; text-align:center;" | <br />
<div style="font-size:120%">NEWS</div><br />
<!-- TITLE 2 (END)--><br />
|-<br />
| style="padding-bottom:5px;" |<br />
|-<br />
| style="background:#EAF5FB;font-size:9pt; text-align:center;" | <small>{{LOCALTIME}}; ''Today is {{CURRENTMONTHNAME}}, {{LOCALDAYNAME}} {{CURRENTDAY}}, {{CURRENTYEAR}}''</small> <br />
<!-- TEXT 2 --><br />
|- <br />
| style="background:#EAF5FB; padding-left:0px; padding-top:2px; |<br />
{{Main:NEWS}}<br />
<!-- TEXT 2 (END) --><br />
|}<br />
<!-- BLOCK 2 (END) --><br />
<br />
<!-- RIGHT BOX (END) --><br />
<br />
<br />
<br />
<br />
<br />
__NOTOC__<br />
<br />
[[Category:Main]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Template:Main:NEWSTemplate:Main:NEWS2012-10-04T09:16:20Z<p>Jcotela: </p>
<hr />
<div>{| border="0" cellpadding="15" cellspacing="3" style="background:e1eaee"<br />
|-<br />
| style="background:e1eaee; color:Balck; width:65%; font-size:75%;" valign="top" |<br />
<br />
May 14th, 2012<br />
'''Kratos Release 3.0.0'''<br />
<br />
The third major release of Kratos Multiphysics is available for [[Download| download]].<br />
<br />
<br />
May 14th, 2012<br />
'''2nd Kratos Workshop'''<br />
<br />
The 2nd Kratos Workshop took place in may in Barcelona, within the 6th Convention on Advances and Applications of GiD.<br />
<br />
<br />
May 26-27th, 2010<br />
'''1st Kratos Workshop'''<br />
<br />
The first Kratos workshop.<br />
<br />
<br />
May 21st, 2010<br />
'''Kratos Release 2.0.0'''<br />
<br />
The second major release of Kratos which can be downloaded from [[Download| here]]<br />
<br />
<br />
<br />
<br />
|}</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Using_Kratos_SolversPython Script Tutorial: Using Kratos Solvers2012-05-10T09:22:25Z<p>Jcotela: </p>
<hr />
<div>In this tutorial, we will solve a structural problem using the example input file from [[Python Script Tutorial: Reading ModelPart From Input File]]<br />
<br />
=== Starting ===<br />
<br />
We provide an inital script using the concepts introduced in the previous sections of this tutorial<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
<br />
=== Reading the ModelPart ===<br />
<br />
Instead of manually adding solution step variables, we will ask the solver to add all variables it requires.<br />
<br />
import structural_solver_static<br />
structural_solver_static.AddVariables(structure_model_part)<br />
<br />
The code for the solver we are going to use can be seen [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/python_scripts/structural_solver_static.py here].<br />
<br />
Now we continue as usual, reading the model part file and initializing GiD output<br />
<br />
structure_model_part.SetBufferSize(1)<br />
<br />
model_part_io_structure = ModelPartIO("example")<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
#Creating GidIO<br />
gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii<br />
use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile<br />
deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed<br />
write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions<br />
gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
gid_io.WriteMesh( structure_model_part.GetMesh() )<br />
gid_io.FinalizeMesh()<br />
<br />
=== Initializing a Solver ===<br />
<br />
As we are going to solve a structural problem, we also need to define the constitutive law for the structure material.<br />
Remembering that all elements in our '''example.mdpa''' file had Property 1 assigned, we add a constitutive law to Property 1:<br />
<br />
structure_model_part.Properties[1].SetValue(CONSTITUTIVE_LAW, Isotropic2D())<br />
<br />
Now we let the solver to define the required degrees of freedom in the system. It will create DISPLACEMENT Dofs on all nodes<br />
<br />
# Add DOFs used by the solver to model part<br />
structural_solver_static.AddDofs(structure_model_part)<br />
<br />
At this point, we create a solver object, which will manage the solution process. Domain size is the number of spatial dimensions (2 or 3).<br />
<br />
# Construct a solver object<br />
domain_size = 2<br />
solver = structural_solver_static.StaticStructuralSolver(structure_model_part,domain_size)<br />
<br />
If we want to modify some solver parameters, this is the moment to do it. Each solver defines its own parameters, which can be set between constructing the solver object and calling its Initalize() method.<br />
<br />
# modify default solver parameters here<br />
solver.ReformDofSetAtEachStep = True<br />
<br />
In this case, we are forcing the solver to re-shape the system matrix at each time step. This would be essential if we wanted to modify the mesh connectivity during the solution process.<br />
Once the choice of parameters is made, the solver object can be initalized:<br />
<br />
# Initialize the solver (using our custom parameters)<br />
solver.Initialize()<br />
<br />
And the solver can be used to solve the problem:<br />
<br />
# Use the solver to solve the problem<br />
solver.Solve()<br />
<br />
Finally, we can print the results for our computation in a GiD post-process file<br />
<br />
# Print results to GiD<br />
time = 0.0<br />
gid_io.InitializeResults(time,structure_model_part.GetMesh())<br />
gid_io.WriteNodalResults(DISPLACEMENT,structure_model_part.Nodes,time,0)<br />
gid_io.FinalizeResults()<br />
<br />
Next Tutorial : [[Python Script Tutorial: Main Solution]]<br />
<br />
Previous Tutorial : [[Python Script Tutorial: ModelPart Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Using_Kratos_SolversPython Script Tutorial: Using Kratos Solvers2012-05-10T09:22:02Z<p>Jcotela: </p>
<hr />
<div>In this tutorial, we will solve a structural problem using the example input file from [[Python Script Tutorial: Reading ModelPart From Input File]]<br />
<br />
=== Starting ===<br />
<br />
We provide an inital script using the concepts introduced in the previous sections of this tutorial<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
<br />
=== Reading the ModelPart ===<br />
<br />
Instead of manually adding solution step variables, we will ask the solver to add all variables it requires.<br />
<br />
import structural_solver_static<br />
structural_solver_static.AddVariables(structure_model_part)<br />
<br />
The code for the solver we are going to use can be seen [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/python_scripts/structural_solver_static.py here].<br />
<br />
Now we continue as usual, reading the model part file and initializing GiD output<br />
<br />
structure_model_part.SetBufferSize(1)<br />
<br />
model_part_io_structure = ModelPartIO("example")<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
#Creating GidIO<br />
gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii<br />
use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile<br />
deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed<br />
write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions<br />
gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
gid_io.WriteMesh( structure_model_part.GetMesh() )<br />
gid_io.FinalizeMesh()<br />
<br />
=== Initializing a Solver ===<br />
<br />
As we are going to solve a structural problem, we also need to define the constitutive law for the structure material.<br />
Remembering that all elements in our '''example.mdpa''' file had Property 1 assigned, we add a constitutive law to Property 1:<br />
<br />
structure_model_part.Properties[1].SetValue(CONSTITUTIVE_LAW, Isotropic2D())<br />
<br />
Now we let the solver to define the required degrees of freedom in the system. It will create DISPLACEMENT Dofs on all nodes<br />
<br />
# Add DOFs used by the solver to model part<br />
structural_solver_static.AddDofs(structure_model_part)<br />
<br />
At this point, we create a solver object, which will manage the solution process. Domain size is the number of spatial dimensions (2 or 3).<br />
<br />
# Construct a solver object<br />
domain_size = 2<br />
solver = structural_solver_static.StaticStructuralSolver(structure_model_part,domain_size)<br />
<br />
If we want to modify some solver parameters, this is the moment to do it. Each solver defines its own parameters, which can be set between constructing the solver object and calling its Initalize() method.<br />
<br />
# modify default solver parameters here<br />
solver.ReformDofSetAtEachStep = True<br />
<br />
In this case, we are forcing the solver to re-shape the system matrix at each time step. This would be essential if we wanted to modify the mesh connectivity during the solution process.<br />
Once the choice of parameters is made, the solver object can be initalized:<br />
<br />
# Initialize the solver (using our custom parameters)<br />
solver.Initialize()<br />
<br />
And the solver can be used to solve the problem:<br />
<br />
# Use the solver to solve the problem<br />
solver.Solve()<br />
<br />
Finally, we can print the results for our computation in a GiD post-process file<br />
<br />
# Print results to GiD<br />
time = 0.0<br />
gid_io.InitializeResults(time,structure_model_part.GetMesh())<br />
gid_io.WriteNodalResults(DISPLACEMENT,structure_model_part.Nodes,time,0)<br />
gid_io.FinalizeResults()<br />
<br />
Next Tutorial : [[Python Script Tutorial: Main Solution]]<br />
<br />
Previous Tutorial : [[Python Script Tutorial: ModelPart Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Main_SolutionPython Script Tutorial: Main Solution2012-05-10T07:38:09Z<p>Jcotela: /* Dynamic solution */</p>
<hr />
<div>=== Dynamic solution ===<br />
<br />
In dynamic problems, we will want to iterate over time. We do this from the main Python file, looping over time steps. An example of this can be seen in [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/test_examples/cantilever2d.gid/cantilever2ddynamic.py this Kratos example].<br />
<br />
The part we are interested in is at the end of the file, after we have read the model part and initialized a solver.<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
gid_io.InitializeResults(mesh_name,(model_part).GetMesh())<br />
<br />
for step in range(0,nsteps):<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
if(step > 3):<br />
solver.Solve()<br />
gid_io.WriteNodalResults(DISPLACEMENT,model_part.Nodes,time,0)<br />
gid_io.PrintOnGaussPoints(PK2_STRESS_TENSOR,model_part,time)<br />
<br />
gid_io.FinalizeResults()<br />
<br />
Ignoring the output-specific parts of the code, which have already been explained in a previous tutorial, this code block is defining a time step and a number of steps, and looping over the time steps<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
...<br />
<br />
for step in range(0,nsteps):<br />
<br />
At every time step, it updates the current time and creates a new solution step, advancing the nodal solution step data to a new iteration<br />
<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
It then skips some time steps, in order to have a full set of nodal solution step data once it starts calculating<br />
<br />
if(step > 3):<br />
<br />
And, once we have enough previous time steps to use the time iteration scheme, it calls the solver<br />
<br />
solver.Solve()<br />
<br />
Once the solver is finished, it prints the results and advances to the next step.<br />
<br />
Previous Tutorial : [[Python Script Tutorial: Using Kratos Solvers]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Main_SolutionPython Script Tutorial: Main Solution2012-05-10T07:37:31Z<p>Jcotela: /* Dynamic solution */</p>
<hr />
<div>=== Dynamic solution ===<br />
<br />
In dynamic problems, we will want to iterate over time. We do this from the main Python file, looping over time steps. An example of this can be seen in [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/test_examples/cantilever2d.gid/cantilever2ddynamic.py this Kratos example].<br />
<br />
The part we are interested in is at the end of the file, after we have read the model part and initialized a solver.<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
gid_io.InitializeResults(mesh_name,(model_part).GetMesh())<br />
<br />
for step in range(0,nsteps):<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
if(step > 3):<br />
solver.Solve()<br />
gid_io.WriteNodalResults(DISPLACEMENT,model_part.Nodes,time,0)<br />
gid_io.PrintOnGaussPoints(PK2_STRESS_TENSOR,model_part,time)<br />
<br />
gid_io.FinalizeResults()<br />
<br />
Ignoring the output-specific parts of the code, which have already been explained in a previous tutorial, this code block is defining a time step and a number of steps, and looping over the time steps<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
...<br />
<br />
for step in range(0,nsteps):<br />
<br />
At every time step, it updates the current time and creates a new solution step, advancing the nodal solution step data to a new iteration<br />
<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
It then skips some time steps, in order to have a full set of nodal solution step data once it starts calculating<br />
<br />
if(step > 3):<br />
<br />
And, once we have enough previous time steps to use the time iteration scheme, it calls the solver<br />
<br />
solver.Solve()<br />
<br />
Once the solver is finished, it prints the results and advances to the next step.<br />
<br />
Previous Tutorial : [[Python Script Tutorial: Using Kratos Solvers]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_WorkflowKratos Structure: Workflow2012-05-09T19:27:23Z<p>Jcotela: </p>
<hr />
<div>The basic ingredients required to solve a problem using Kratos Multiphysics are the following<br />
<br />
* The Model Part (.mdpa) file.<br />
* A Python script.<br />
<br />
== The Model Part (.mdpa) file ==<br />
<br />
The Model Part file defines the geometry and mesh of the problem, as well as the initial and boundary conditions to be applied. It is a regular text file with the extension ''.mdpa'' which follows the structure outlined in [[Input Data]].<br />
<br />
== The Python script ==<br />
<br />
Kratos Multiphysics uses the [http://www.python.org Python] scripting language to provide a flexible and dynamic way of combining its components to perform different types of simulations. The main Python script plays the part of the main function of the program, but with the crucial advantage of being easily accessible both to users and developers, who can modify the flow of the program without having to recompile the source code.<br />
<br />
For models defined using [http://www.gidhome.com/ GiD], there will be an auxiliary Python file defining additional problem settings to be read from the main script. This file is used to communicate the input provided by the user to the default Python file that GiD launches when the simulation is launched.<br />
<br />
Previous : [[Kratos Structure: Strategies and Processes]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Main_SolutionPython Script Tutorial: Main Solution2012-05-09T19:26:39Z<p>Jcotela: /* Dynamic solution */</p>
<hr />
<div>=== Dynamic solution ===<br />
<br />
In more dynamic problems, we will want to iterate over time. We do this from the main Python file, looping over time steps. An example of this can be seen in [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/test_examples/cantilever2d.gid/cantilever2ddynamic.py this Kratos example].<br />
<br />
The part we are interested in is at the end of the file, after we have read the model part and initialized a solver.<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
gid_io.InitializeResults(mesh_name,(model_part).GetMesh())<br />
<br />
for step in range(0,nsteps):<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
if(step > 3):<br />
solver.Solve()<br />
gid_io.WriteNodalResults(DISPLACEMENT,model_part.Nodes,time,0)<br />
gid_io.PrintOnGaussPoints(PK2_STRESS_TENSOR,model_part,time)<br />
<br />
gid_io.FinalizeResults()<br />
<br />
Ignoring the output-specific parts of the code, which have already been explained in a previous tutorial, this code block is defining a time step and a number of steps, and looping over the time steps<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
...<br />
<br />
for step in range(0,nsteps):<br />
<br />
At every time step, it updates the current time and creates a new solution step, advancing the nodal solution step data to a new iteration<br />
<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
It then skips some time steps, in order to have a full set of nodal solution step data once it starts calculating<br />
<br />
if(step > 3):<br />
<br />
And, once we have enough previous time steps to use the time iteration scheme, it calls the solver<br />
<br />
solver.Solve()<br />
<br />
Once the solver is finished, it prints the results and advances to the next step.<br />
<br />
Previous Tutorial : [[Python Script Tutorial: Using Kratos Solvers]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Main_SolutionPython Script Tutorial: Main Solution2012-05-09T19:25:48Z<p>Jcotela: /* Dynamic solution */</p>
<hr />
<div>=== Dynamic solution ===<br />
<br />
In more dynamic problems, we will want to iterate over time. We do this from the main Python file, looping over time steps. An example of this can be seen in [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/test_examples/cantilever2d.gid/cantilever2ddynamic.py this Kratos example].<br />
<br />
The part we are interested in is at the end of the file, after we have read the model part and initialized a solver.<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
gid_io.InitializeResults(mesh_name,(model_part).GetMesh())<br />
<br />
for step in range(0,nsteps):<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
if(step > 3):<br />
solver.Solve()<br />
gid_io.WriteNodalResults(DISPLACEMENT,model_part.Nodes,time,0)<br />
gid_io.PrintOnGaussPoints(PK2_STRESS_TENSOR,model_part,time)<br />
<br />
gid_io.FinalizeResults()<br />
<br />
Ignoring the output-specific parts of the code, which have already been explained in a previous tutorial, this code block is defining a time step and a number of steps, and looping over the time steps<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
...<br />
<br />
for step in range(0,nsteps):<br />
<br />
At every time step, it updates the current time and creates a new solution step, advancing the nodal solution step data to a new iteration<br />
<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
It then skips some time steps, in order to have a full set of nodal solution step data once it starts iterating<br />
<br />
if(step > 3):<br />
<br />
And, once we have enough previous time steps to use the time iteration scheme, it calls the solver<br />
<br />
solver.Solve()<br />
<br />
Once the solver is finished, it prints the results and advances to the next step.<br />
<br />
Previous Tutorial : [[Python Script Tutorial: Using Kratos Solvers]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Main_SolutionPython Script Tutorial: Main Solution2012-05-09T19:25:29Z<p>Jcotela: Created page with "=== Dynamic solution === In more dynamic problems, we will want to iterate over time. We do this from the main Python file, looping over time steps. An example of this can be se..."</p>
<hr />
<div>=== Dynamic solution ===<br />
<br />
In more dynamic problems, we will want to iterate over time. We do this from the main Python file, looping over time steps. An example of this can be seen in [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/test_examples/cantilever2d.gid/cantilever2ddynamic.py this Kratos example].<br />
<br />
The part we are interested in is at the end of the file, after we have read the model part and initialized a solver.<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
gid_io.InitializeResults(mesh_name,(model_part).GetMesh())<br />
<br />
for step in range(0,nsteps):<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
if(step > 3):<br />
solver.Solve()<br />
gid_io.WriteNodalResults(DISPLACEMENT,model_part.Nodes,time,0)<br />
gid_io.PrintOnGaussPoints(PK2_STRESS_TENSOR,model_part,time)<br />
<br />
gid_io.FinalizeResults()<br />
<br />
Ignoring the output-specific parts of the code, which have already been explained in a previous tutorial, this code block is defining a time step and a number of steps, and looping over the time steps<br />
<br />
Dt = 0.02<br />
nsteps = 101<br />
<br />
...<br />
<br />
for step in range(0,nsteps):<br />
<br />
At every time step, it updates the current time and creates a new solution step, advancing the nodal solution step data to a new iteration<br />
<br />
time = Dt*step<br />
model_part.CloneTimeStep(time)<br />
<br />
It then skips some time steps, in order to have a full set of nodal solution step data once it starts iterating<br />
<br />
if(step > 3):<br />
<br />
And, once we have enough previous time steps to use the time iteration scheme, it calls the solver<br />
<br />
solver.Solve()<br />
<br />
Once the solver is finished, it prints the results and advances to the next step.<br />
<br />
Previous Tutorial : [[Python Script Tutorial: Using Kratos Solvers]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Using_Kratos_SolversPython Script Tutorial: Using Kratos Solvers2012-05-09T19:10:06Z<p>Jcotela: </p>
<hr />
<div>In this tutorial, we will solve a structural problem using the example input file from [[Python Script Tutorial: Reading ModelPart From Input File]]<br />
<br />
=== Starting ===<br />
<br />
We provide an inital script using the concepts introduced in the previous sections of this tutorial<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
structure_model_part.SetBufferSize(1)<br />
<br />
=== Reading the ModelPart ===<br />
<br />
Instead of manually adding solution step variables, we will ask the solver to add all variables it requires.<br />
<br />
import structural_solver_static<br />
structural_solver_static.AddVariables(structure_model_part)<br />
<br />
The code for the solver we are going to use can be seen [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/python_scripts/structural_solver_static.py here].<br />
<br />
Now we continue as usual, reading the model part file and initializing GiD output<br />
<br />
model_part_io_structure = ModelPartIO("example")<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
#Creating GidIO<br />
gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii<br />
use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile<br />
deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed<br />
write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions<br />
gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
gid_io.WriteMesh( structure_model_part.GetMesh() )<br />
gid_io.FinalizeMesh()<br />
<br />
=== Initializing a Solver ===<br />
<br />
As we are going to solve a structural problem, we also need to define the constitutive law for the structure material.<br />
Remembering that all elements in our '''example.mdpa''' file had Property 1 assigned, we add a constitutive law to Property 1:<br />
<br />
structure_model_part.Properties[1].SetValue(CONSTITUTIVE_LAW, Isotropic2D())<br />
<br />
Now we let the solver to define the required degrees of freedom in the system. It will create DISPLACEMENT Dofs on all nodes<br />
<br />
# Add DOFs used by the solver to model part<br />
structural_solver_static.AddDofs(structure_model_part)<br />
<br />
At this point, we create a solver object, which will manage the solution process. Domain size is the number of spatial dimensions (2 or 3).<br />
<br />
# Construct a solver object<br />
domain_size = 2<br />
solver = structural_solver_static.StaticStructuralSolver(structure_model_part,domain_size)<br />
<br />
If we want to modify some solver parameters, this is the moment to do it. Each solver defines its own parameters, which can be set between constructing the solver object and calling its Initalize() method.<br />
<br />
# modify default solver parameters here<br />
solver.ReformDofSetAtEachStep = True<br />
<br />
In this case, we are forcing the solver to re-shape the system matrix at each time step. This would be essential if we wanted to modify the mesh connectivity during the solution process.<br />
Once the choice of parameters is made, the solver object can be initalized:<br />
<br />
# Initialize the solver (using our custom parameters)<br />
solver.Initialize()<br />
<br />
And the solver can be used to solve the problem:<br />
<br />
# Use the solver to solve the problem<br />
solver.Solve()<br />
<br />
Finally, we can print the results for our computation in a GiD post-process file<br />
<br />
# Print results to GiD<br />
time = 0.0<br />
gid_io.InitializeResults(time,structure_model_part.GetMesh())<br />
gid_io.WriteNodalResults(DISPLACEMENT,structure_model_part.Nodes,time,0)<br />
gid_io.FinalizeResults()<br />
<br />
Next Tutorial : [[Python Script Tutorial: Main Solution]]<br />
<br />
Previous Tutorial : [[Python Script Tutorial: ModelPart Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Using_Kratos_SolversPython Script Tutorial: Using Kratos Solvers2012-05-09T19:08:59Z<p>Jcotela: </p>
<hr />
<div>In this tutorial, we will solve a structural problem using the example input file from [[Python Script Tutorial: Reading ModelPart From Input File]]<br />
<br />
Starting<br />
<br />
We provide an inital script using the concepts introduced in the previous sections of this tutorial<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
structure_model_part.SetBufferSize(1)<br />
<br />
Reading the ModelPart<br />
<br />
Instead of manually adding solution step variables, we will ask the solver to add all variables it requires.<br />
<br />
import structural_solver_static<br />
structural_solver_static.AddVariables(structure_model_part)<br />
<br />
The code for the solver we are going to use can be seen [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/python_scripts/structural_solver_static.py here].<br />
<br />
Now we continue as usual, reading the model part file and initializing GiD output<br />
<br />
model_part_io_structure = ModelPartIO("example")<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
#Creating GidIO<br />
gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii<br />
use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile<br />
deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed<br />
write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions<br />
gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
gid_io.WriteMesh( structure_model_part.GetMesh() ) # I CHANGED THIS!<br />
gid_io.FinalizeMesh()<br />
<br />
As we are going to solve a structural problem, we also need to define the constitutive law for the structure material.<br />
Remembering that all elements in our '''example.mdpa''' file had Property 1 assigned, we add a constitutive law to Property 1:<br />
<br />
structure_model_part.Properties[1].SetValue(CONSTITUTIVE_LAW, Isotropic2D())<br />
<br />
Now we let the solver to define the required degrees of freedom in the system. It will create DISPLACEMENT Dofs on all nodes<br />
<br />
# Add DOFs used by the solver to model part<br />
structural_solver_static.AddDofs(structure_model_part)<br />
<br />
At this point, we create a solver object, which will manage the solution process. Domain size is the number of spatial dimensions (2 or 3).<br />
<br />
# Construct a solver object<br />
domain_size = 2<br />
solver = structural_solver_static.StaticStructuralSolver(structure_model_part,domain_size)<br />
<br />
If we want to modify some solver parameters, this is the moment to do it. Each solver defines its own parameters, which can be set between constructing the solver object and calling its Initalize() method.<br />
<br />
# modify default solver parameters here<br />
solver.ReformDofSetAtEachStep = True<br />
<br />
In this case, we are forcing the solver to re-shape the system matrix at each time step. This would be essential if we wanted to modify the mesh connectivity during the solution process.<br />
Once the choice of parameters is made, the solver object can be initalized:<br />
<br />
# Initialize the solver (using our custom parameters)<br />
solver.Initialize()<br />
<br />
And the solver can be used to solve the problem:<br />
<br />
# Use the solver to solve the problem<br />
solver.Solve()<br />
<br />
Finally, we can print the results for our computation in a GiD post-process file<br />
<br />
# Print results to GiD<br />
time = 0.0<br />
gid_io.InitializeResults(time,structure_model_part.GetMesh())<br />
gid_io.WriteNodalResults(DISPLACEMENT,structure_model_part.Nodes,time,0)<br />
gid_io.FinalizeResults()<br />
<br />
Next Tutorial : [[Python Script Tutorial: Main Solution]]<br />
<br />
Previous Tutorial : [[Python Script Tutorial: ModelPart Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Using_Kratos_SolversPython Script Tutorial: Using Kratos Solvers2012-05-09T19:08:48Z<p>Jcotela: </p>
<hr />
<div>In this tutorial, we will solve a structural problem using the example input file from [[Python Script Tutorial: Reading ModelPart From Input File]]<br />
<br />
Starting<br />
<br />
We provide an inital script using the concepts introduced in the previous sections of this tutorial<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
structure_model_part.SetBufferSize(1)<br />
<br />
Reading the ModelPart<br />
<br />
Instead of manually adding solution step variables, we will ask the solver to add all variables it requires.<br />
<br />
import structural_solver_static<br />
structural_solver_static.AddVariables(structure_model_part)<br />
<br />
The code for the solver we are going to use can be seen [http://kratos.cimne.upc.es/projects/kratos/repository/entry/kratos/applications/structural_application/python_scripts/structural_solver_static.py here].<br />
<br />
Now we continue as usual, reading the model part file and initializing GiD output<br />
<br />
model_part_io_structure = ModelPartIO("example")<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
#Creating GidIO<br />
gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii<br />
use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile<br />
deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed<br />
write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions<br />
gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
gid_io.WriteMesh( structure_model_part.GetMesh() ) # I CHANGED THIS!<br />
gid_io.FinalizeMesh()<br />
<br />
As we are going to solve a structural problem, we also need to define the constitutive law for the structure material.<br />
Remembering that all elements in our '''example.mdpa''' file had Property 1 assigned, we add a constitutive law to Property 1:<br />
<br />
structure_model_part.Properties[1].SetValue(CONSTITUTIVE_LAW, Isotropic2D())<br />
<br />
Now we let the solver to define the required degrees of freedom in the system. It will create DISPLACEMENT Dofs on all nodes<br />
<br />
# Add DOFs used by the solver to model part<br />
structural_solver_static.AddDofs(structure_model_part)<br />
<br />
At this point, we create a solver object, which will manage the solution process. Domain size is the number of spatial dimensions (2 or 3).<br />
<br />
# Construct a solver object<br />
domain_size = 2<br />
solver = structural_solver_static.StaticStructuralSolver(structure_model_part,domain_size)<br />
<br />
If we want to modify some solver parameters, this is the moment to do it. Each solver defines its own parameters, which can be set between constructing the solver object and calling its Initalize() method.<br />
<br />
# modify default solver parameters here<br />
solver.ReformDofSetAtEachStep = True<br />
<br />
In this case, we are forcing the solver to re-shape the system matrix at each time step. This would be essential if we wanted to modify the mesh connectivity during the solution process.<br />
Once the choice of parameters is made, the solver object can be initalized:<br />
<br />
# Initialize the solver (using our custom parameters)<br />
solver.Initialize()<br />
<br />
And the solver can be used to solve the problem:<br />
<br />
# Use the solver to solve the problem<br />
solver.Solve()<br />
<br />
Finally, we can print the results for our computation in a GiD post-process file<br />
<br />
# Print results to GiD<br />
time = 0.0<br />
gid_io.InitializeResults(time,structure_model_part.GetMesh())<br />
gid_io.WriteNodalResults(DISPLACEMENT,structure_model_part.Nodes,time,0)<br />
gid_io.FinalizeResults()<br />
<br />
Next Tutorial : [[Python Script Tutorial: Main Solution]]<br />
Previous Tutorial : [[Python Script Tutorial: ModelPart Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Using_Kratos_SolversPython Script Tutorial: Using Kratos Solvers2012-05-09T18:29:50Z<p>Jcotela: Created page with "In this tutorial, we will solve a structural problem using the example input file from Python Script Tutorial: Reading ModelPart From Input File Starting We provide an init..."</p>
<hr />
<div>In this tutorial, we will solve a structural problem using the example input file from [[Python Script Tutorial: Reading ModelPart From Input File]]<br />
<br />
Starting<br />
<br />
We provide an inital script using the concepts introduced in the previous sections of this tutorial<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
structure_model_part.SetBufferSize(1)<br />
<br />
<br />
<br />
structure_model_part.AddNodalSolutionStepVariable(DISPLACEMENT)<br />
structure_model_part.AddNodalSolutionStepVariable(FORCE)<br />
<br />
model_part_io_structure = ModelPartIO("example")<br />
<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
<br />
# Wiki, ch 3<br />
<br />
#Creating GidIO<br />
gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii<br />
use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile<br />
deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed<br />
write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions<br />
gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
gid_io.WriteMesh( structure_model_part.GetMesh() ) # I CHANGED THIS!<br />
gid_io.FinalizeMesh()<br />
<br />
for node in structure_model_part.Nodes:<br />
node.SetSolutionStepValue(TEMPERATURE,0,100.0)</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Reading_ModelPart_From_Input_FilePython Script Tutorial: Reading ModelPart From Input File2012-05-09T18:04:54Z<p>Jcotela: </p>
<hr />
<div>The ModelPart represents an arbitrary part of the model to be simulated and stores the mesh and additional data for it. Most of the Kratos routines take a ModelPart as their argument. So always is necessary to create and fill a ModelPart. In this tutorial we will describe how to create and fill a model part from given input file. <br />
<br />
<br />
== Starting ==<br />
<br />
First of all we need to create a python file with following code to import the Kratos:<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
== Creating a ModelPart ==<br />
<br />
<br />
To create a ModelPart, one has to call its constructor passing the ModelPart`s name as its argument:<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
<br />
You can print the fluid_model_part:<br />
<br />
>>> print structure_model_part<br />
StructurePart model part<br />
Buffer Size : 1<br />
Number of tables : 0<br />
Current solution step index : 0<br />
<br />
Mesh 0 : <br />
Number of Nodes : 0<br />
Number of Properties : 0<br />
Number of Elements : 0<br />
Number of Conditions : 0<br />
<br />
It can be seen that the ModelPart is empty and has the buffer size equal to 1. This means that no history of the nodal solution steps variables will be saved.<br />
<br />
The next step is to define the variables we want to store as historical variables in nodes of this ModelPart as follow:<br />
<br />
structure_model_part.AddNodalSolutionStepVariable(DISPLACEMENT)<br />
structure_model_part.AddNodalSolutionStepVariable(FORCE)<br />
<br />
== Reading ModelPart File ==<br />
<br />
The input file of the Kratos has .mdpa (stand for ModelPart) and contains the properties, nodes, elements, conditions and initial values. A convenient way to create this file is to use the interface prepared for [http://www.gidhome.com GiD] pre and post processor. [[Input Data | Here]] you can find more information about the input file. Here we assume that the example.mdpa input file is already created as follow:<br />
<br />
'''example.mdpa'''<br />
<br />
Begin ModelPartData<br />
// nothing here<br />
End ModelPartData<br />
<br />
<br />
Begin Properties 1<br />
DENSITY 2700.000000<br />
YOUNG_MODULUS 7000000.000000<br />
POISSON_RATIO 0.300000<br />
BODY_FORCE [3] (0.000000,0.000000,0.000000)<br />
THICKNESS 1.000000<br />
End Properties<br />
<br />
Begin Nodes<br />
1 0.0 0.0 0.0 //node number, coord x, cord y, coord z<br />
2 1.0 0.0 0.0 //node number, coord x, cord y, coord z<br />
3 1.0 1.0 0.0 //node number, coord x, cord y, coord z<br />
4 0.0 1.0 0.0 //node number, coord x, cord y, coord z<br />
End Nodes<br />
<br />
Begin Elements TotalLagrangian2D3N<br />
1 1 1 2 4 //the first column is the property<br />
2 1 3 4 2<br />
End Elements<br />
<br />
Begin NodalData DISPLACEMENT_X //be careful, variables are case sensitive!<br />
1 1 100.0 <span style="color:red"> // pos1 is the node, pos2 (a 1) means that the DOF is fixed, then (position 3) we write the fixed displacement (in this case, temperature) </span> <br />
End NodalData<br />
<br />
Begin NodalData DISPLACEMENT_Y <br />
1 1 100.0 <br />
End NodalData<br />
<br />
Begin NodalData FORCE_Y <br />
3 0 5.0 <span style="color:red"> //fixing it or not does not change anything since it is not a degree of freedom, it's just info that will be used by the condition </span> <br />
End NodalData<br />
<br />
Begin Conditions PointForce2D<br />
1 1 3 <span style="color:red"> //pos1:condition ID(irrelevant) ; pos2:cond Property ( = 1 in this case) ; pos3:node to apply the condition. </span> <br />
End Conditions<br />
<br />
which represents the following 2D problem:<br />
<br />
<br />
[[File:elems.png]]<br />
<br />
For reading the .mdpa file first we have to create a ModelPartIO object passing the input file path/name to its constructor:<br />
<br />
model_part_io_structure = ModelPartIO("path/to/file/example")<br />
<br />
{{Note| <br />
the file name is used without the .mdpa extension!<br />
}}<br />
<br />
<br />
Then use this io object to read the file and store the mesh and data in ModelPart:<br />
<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
<br />
And printing again the ModelPart:<br />
<br />
>>> print structure_model_part<br />
StructurePart model part<br />
Buffer Size : 1<br />
Number of tables : 0<br />
Current solution step index : 0<br />
<br />
Mesh 0 : <br />
Number of Nodes : 4<br />
Number of Properties : 1<br />
Number of Elements : 2<br />
Number of Conditions : 1<br />
<br />
<br />
== Setting the Buffer Size ==<br />
<br />
If we need to store the values of the nodal solution step variables in previous time steps, we must modify the buffer size '''before''' defining the historical variables:<br />
<br />
structure_model_part.SetBufferSize(3)<br />
<br />
This would store the values for two previous steps in addition to the current ones. Now we can add the solution step data and continue as in the previous example<br />
<br />
structure_model_part.AddNodalSolutionStepVariable(DISPLACEMENT)<br />
structure_model_part.AddNodalSolutionStepVariable(FORCE)<br />
<br />
<br />
Next Tutorial : [[Python Script Tutorial: Writing Output File]] <br />
<br />
Previous Tutorial : [[Python Script Tutorial: Hello Kratos]] <br />
<br />
All Tutorials : [[Kratos_Tutorials#Python_Script| Kratos Tutorials]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Reading_ModelPart_From_Input_FilePython Script Tutorial: Reading ModelPart From Input File2012-05-09T18:03:29Z<p>Jcotela: /* Creating a ModelPart */</p>
<hr />
<div>The ModelPart represents an arbitrary part of the model to be simulated and stores the mesh and additional data for it. Most of the Kratos routines take a ModelPart as their argument. So always is necessary to create and fill a ModelPart. In this tutorial we will describe how to create and fill a model part from given input file. <br />
<br />
<br />
== Starting ==<br />
<br />
First of all we need to create a python file with following code to import the Kratos:<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
== Creating a ModelPart ==<br />
<br />
<br />
To create a ModelPart, one has to call its constructor passing the ModelPart`s name as its argument:<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
<br />
You can print the fluid_model_part:<br />
<br />
>>> print structure_model_part<br />
StructurePart model part<br />
Buffer Size : 1<br />
Number of tables : 0<br />
Current solution step index : 0<br />
<br />
Mesh 0 : <br />
Number of Nodes : 0<br />
Number of Properties : 0<br />
Number of Elements : 0<br />
Number of Conditions : 0<br />
<br />
It can be seen that the ModelPart is empty and has the buffer size equal to 1. This means that no history of the nodal solution steps variables will be saved. If we need to store the values of the nodal solution step variables in previous time steps, we must modify the buffer size '''before''' defining the historical variables:<br />
<br />
structure_model_part.SetBufferSize(3)<br />
<br />
This would store the values for two previous steps in addition to the current ones.<br />
<br />
The next step is to define the variables we want to store as historical variables in nodes of this ModelPart as follow:<br />
<br />
structure_model_part.AddNodalSolutionStepVariable(DISPLACEMENT)<br />
structure_model_part.AddNodalSolutionStepVariable(FORCE)<br />
<br />
== Reading ModelPart File ==<br />
<br />
The input file of the Kratos has .mdpa (stand for ModelPart) and contains the properties, nodes, elements, conditions and initial values. A convenient way to create this file is to use the interface prepared for [http://www.gidhome.com GiD] pre and post processor. [[Input Data | Here]] you can find more information about the input file. Here we assume that the example.mdpa input file is already created as follow:<br />
<br />
'''example.mdpa'''<br />
<br />
Begin ModelPartData<br />
// nothing here<br />
End ModelPartData<br />
<br />
<br />
Begin Properties 1<br />
DENSITY 2700.000000<br />
YOUNG_MODULUS 7000000.000000<br />
POISSON_RATIO 0.300000<br />
BODY_FORCE [3] (0.000000,0.000000,0.000000)<br />
THICKNESS 1.000000<br />
End Properties<br />
<br />
Begin Nodes<br />
1 0.0 0.0 0.0 //node number, coord x, cord y, coord z<br />
2 1.0 0.0 0.0 //node number, coord x, cord y, coord z<br />
3 1.0 1.0 0.0 //node number, coord x, cord y, coord z<br />
4 0.0 1.0 0.0 //node number, coord x, cord y, coord z<br />
End Nodes<br />
<br />
Begin Elements TotalLagrangian2D3N<br />
1 1 1 2 4 //the first column is the property<br />
2 1 3 4 2<br />
End Elements<br />
<br />
Begin NodalData DISPLACEMENT_X //be careful, variables are case sensitive!<br />
1 1 100.0 <span style="color:red"> // pos1 is the node, pos2 (a 1) means that the DOF is fixed, then (position 3) we write the fixed displacement (in this case, temperature) </span> <br />
End NodalData<br />
<br />
Begin NodalData DISPLACEMENT_Y <br />
1 1 100.0 <br />
End NodalData<br />
<br />
Begin NodalData FORCE_Y <br />
3 0 5.0 <span style="color:red"> //fixing it or not does not change anything since it is not a degree of freedom, it's just info that will be used by the condition </span> <br />
End NodalData<br />
<br />
Begin Conditions PointForce2D<br />
1 1 3 <span style="color:red"> //pos1:condition ID(irrelevant) ; pos2:cond Property ( = 1 in this case) ; pos3:node to apply the condition. </span> <br />
End Conditions<br />
<br />
which represents the following 2D problem:<br />
<br />
<br />
[[File:elems.png]]<br />
<br />
For reading the .mdpa file first we have to create a ModelPartIO object passing the input file path/name to its constructor:<br />
<br />
model_part_io_structure = ModelPartIO("path/to/file/example")<br />
<br />
{{Note| <br />
the file name is used without the .mdpa extension!<br />
}}<br />
<br />
<br />
Then use this io object to read the file and store the mesh and data in ModelPart:<br />
<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
<br />
And printing again the ModelPart:<br />
<br />
>>> print structure_model_part<br />
StructurePart model part<br />
Buffer Size : 1<br />
Number of tables : 0<br />
Current solution step index : 0<br />
<br />
Mesh 0 : <br />
Number of Nodes : 4<br />
Number of Properties : 1<br />
Number of Elements : 2<br />
Number of Conditions : 1<br />
<br />
<br />
== Setting the Buffer Size ==<br />
<br />
<br />
Next Tutorial : [[Python Script Tutorial: Writing Output File]] <br />
<br />
Previous Tutorial : [[Python Script Tutorial: Hello Kratos]] <br />
<br />
All Tutorials : [[Kratos_Tutorials#Python_Script| Kratos Tutorials]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Python_Script_Tutorial:_Writing_Output_FilePython Script Tutorial: Writing Output File2012-05-09T17:46:21Z<p>Jcotela: /* Writing Mesh */</p>
<hr />
<div>In this tutorial the procedure for writing the mesh and data from a ModelPart to output files will be described briefly. More information can be found [[How to use the GidIO | here]]<br />
<br />
== Starting ==<br />
<br />
First of all we need to create a python file with following code to import the Kratos, create a ModelPart and read it from input as described in the [[Python Script Tutorial: Reading ModelPart From Input File | previous tutorial]] :<br />
<br />
from KratosMultiphysics import *<br />
from KratosMultiphysics.StructuralApplication import *<br />
<br />
structure_model_part = ModelPart("StructurePart")<br />
<br />
structure_model_part.AddNodalSolutionStepVariable(DISPLACEMENT)<br />
structure_model_part.AddNodalSolutionStepVariable(FORCE)<br />
<br />
model_part_io_structure = ModelPartIO("path/to/file/example")<br />
model_part_io_structure.ReadModelPart(structure_model_part)<br />
<br />
<br />
== Creating GidIO ==<br />
<br />
The GidIO is in charge of writing files in [http://www.gidhome.com GiD] format. So we need to create an instance of this class for writing output files for GiD. The constructor of the GidIO takes following parameters:<br />
<br />
* '''GiD_PostMode''' determines whether the output should be written in plain text (<tt>GiD_PostAscii</tt>) or binary (<tt>Gid_PostBinary</tt>) file format. The <tt>ASCII</tt> format is only recommended for debugging, where the user needs to manually access and read the output data. In general, the binary format should be preferred as it yields much smaller output files and can be read and written much faster.<br />
<br />
* '''MultiFileFlag''' states whether GidIO should write all results in one file or use different files. If the flag is set to <tt>SingleFile</tt>, all meshes are written into one file. Note that this is only possible in Binary mode. If instead the flag is set to <tt>MultipleFiles</tt>, a new file (or, in ASCII mode set of mesh and result files) is generated for each step. The names for the files are chosen automatically according to the number given in <tt>InitializeMesh</tt>.<br />
<br />
* '''WriteDeformedMeshFlag''' specifies whether the meshes are written in deformed or undeformed configuration. <tt>WriteDeformedMesh</tt> will cause the meshes to be written in deformed state and <tt>WriteUndeformedMesh</tt> causes the meshes to be written in their original configuration respectively.<br />
<br />
* '''WriteConditionsFlag''' is used to switch between the option to write only the elements of each mesh (option <tt>WriteElementsOnly</tt>) or to write additionally the Condition objects in the current model part (option <tt>WriteConditions</tt>)<br />
<br />
<br />
To create a GidIO we can call the constructor passing above arguments as follow:<br />
<br />
<code lang="python"><br />
#Creating GidIO<br />
gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii<br />
use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile<br />
deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed<br />
write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions<br />
<br />
gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)<br />
</code><br />
<br />
<br />
== Writing Mesh ==<br />
<br />
For writing a mesh first we have to initialize it passing a double number as mesh name to the <tt>InitializeMesh</tt> method:<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
<br />
After initializing we can write the Mesh stored in ModelPart to the IO using <tt>WriteMesh( mesh )</tt> method:<br />
<br />
gid_io.WriteMesh( structure_model_part.GetMesh() ) <br />
<br />
It is necessary to call <tt>FinalizeMesh()</tt>. So the entire process is as follow:<br />
<br />
gid_io.InitializeMesh( 0.0 )<br />
gid_io.WriteMesh( structure_model_part.GetMesh() ) <br />
gid_io.FinalizeMesh()<br />
<br />
== Writing Nodal Data ==<br />
<br />
<br />
<br />
== Writing Elemental Data ==<br />
<br />
<br />
Next Tutorial : [[Python Script Tutorial: ModelPart Nodes and Nodal Data]] <br />
<br />
Previous Tutorial : [[Python Script Tutorial: Reading ModelPart From Input File]] <br />
<br />
All Tutorials : [[Kratos_Tutorials#Python_Script| Kratos Tutorials]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Node_and_Nodal_DataKratos Structure: Node and Nodal Data2012-05-07T09:07:51Z<p>Jcotela: </p>
<hr />
<div>One of the most basic classes is the Node. In this section, we will briefly present its implementation, which will will allow us to present some basic concepts in Kratos.<br />
<br />
== The Node ==<br />
<br />
The Node class centralizes the information related to a single point in the finite element mesh. In its core, the node class contains an index (Id) that uniquely identifies the node in the finite element mesh, and the geometrical information about the position of the node, which is stored as a Point instance. This basic structure is common to all nodes used in Kartos, and can be accessed and modified from Python using the following interface<br />
<br />
node.Id # Unique identifier for the node. An unsigned integer value, starting from 1<br />
node.X # X coordinate of the current position of the node<br />
node.Y # Y coordinate<br />
node.Z # Z coordinate<br />
<br />
In addition, the original position of the node is also stored, which is useful in Lagrangian or ALE (Arbitrary Lagrangian-Eulerian) formulations:<br />
<br />
node.X0 # Original X coordinate<br />
node.Y0 # Original Y coordinate<br />
node.Z0 # Original Z coordinate<br />
<br />
== Kratos Variables ==<br />
<br />
The node class is also responsible for managing the information related to that point of the mesh and, in particular, of the values of the problem data and unknowns at that point of the mesh. In Kratos, all such data is associated to a Variable, which typically identifies a phyisical magnitude such as velocity or temperature. For example, a node in a fluid problem could be required to store the following data:<br />
<br />
Node 735<br />
Velocity: An unknown of the problem, 3D vector.<br />
Pressure: An unknown of the problem, scalar.<br />
Density: Problem data, given as input, scalar.<br />
Viscosity: Problem data, given as input, scalar.<br />
Body force: Problem data (for example, acceleration of gravity), given as input, 3D vector.<br />
<br />
In Kratos, all variables are identified by a label, typically their name in uppercase (VELOCITY,PRESSURE). In the case of vectors, individual components can be also recovered explicitly so, for example, instead of asking for VELOCITY, we can inquire a node about VELOCITY_X, VELOCITY_Y or VELOCITY_Z. Variable names are hardcoded in Kratos, so adding new ones requires modifying the source. There is a main set of variables that is defined in the Kratos core files (see kratos/includes/variables.h and kratos/sources/variables.cpp) while each application can define its own set of variables. On a given Kratos model, all variables included in the Kratos Kernel and each of the individual applications imported will be available for use.<br />
<br />
== Types of Nodal Data ==<br />
<br />
There are two different containers for information that can be stored in nodes: the historical database and the non-historical database. Both can be used to store As the name suggests, the difference between the two is that the first one stores both the current value and the values that the variable held during the previous time steps, while the second stores only the current value.<br />
<br />
Note that there is no restriction to storing variables in either container, so both containers can store values for the same variable at the same time. While this can be useful in some cases, it should be noted that the values stored in each container are completely independent and no attempt will be made to synchronize them.<br />
<br />
=== Historical database: Solution step data ===<br />
<br />
The historical database is typically used to store values that are tied to time iteration and that we want to track as the simulation advances. A typical example of this is a dynamic problem, where we use a time scheme that approximates time derivatives using the values of our unknowns at previous time steps. To access the historical database of a node, we will use the C++ function<br />
<br />
Value& node.FastGetSolutionStepValue(VARIABLE,StepIndex = 0)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetSolutionStepValue(VARIABLE,StepIndex)<br />
node.SetSolutionStepValue(VARIABLE,StepIndex,Value)<br />
<br />
where VARIABLE is the Kratos Variable we want to access, Value is the value stored in the node for VARIABLE and StepIndex indicates the time step we are interested in, with 0 being the current time step, 1 the previous time step and so on. The maximum number of time steps stored at the same time for a given simulation is regulated by the ModelPart's buffer size parameter, that will be described in a later section.<br />
<br />
Note that all nodal variables read from the mdpa file are stored in the historical database.<br />
<br />
=== Non-historical database: Values ===<br />
<br />
The non-historical database stores values that are not related to time iteration and won't be recorded as the simulation advances in time. Only a single value on each node is kept for a given variable at a given time. They can be accessed with the C++ function<br />
<br />
Value& node.GetValue(VARIABLE)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetValue(VARIABLE)<br />
node.SetValue(VARIABLE,Value)<br />
<br />
== Degrees of Freedom ==<br />
<br />
A last concept related to nodes and nodal data will be presented in this section: the Degree of freedom, or Dof for short. The Dof is one of the basic types in Kratos, and it is used to store information relative to the problem unknowns. A node will typically have one or more Dofs, depending on the problem being simulated. For the variables associated to a degree of freedom, in addition to their value, the status of the variable as a fixed (a boundary conditon) or free (an unknown) value is tracked, as well as its position in the system matrix, which is used to update it after a solution iteration.<br />
<br />
Next : [[Kratos Structure: Elements and Conditions]]<br />
<br />
Previous : [[Kratos Structure: Basic Components]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Mesh_and_ModelPartKratos Structure: Mesh and ModelPart2012-05-07T08:57:20Z<p>Jcotela: </p>
<hr />
<div>Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data related to a given model.<br />
<br />
== The Mesh ==<br />
<br />
The Mesh class is the container that stores the geometrical definition of the problem or a region of the simulation domain. At its core, it contains three lists, for the nodes, elements and conditions that constitute the model. The elements on each list are ordered by their Id, ordered consecutively starting from one. In addition, the mesh also holds a list of properties used to characterize the material properties of its elements and conditions.<br />
<br />
== The Model Part ==<br />
<br />
The ModelPart is arguably the most important class in Kratos. It contains all the information required for the simulation of a given problem, namely '''Nodes''', '''Elements''' and '''Conditions'''.<br />
* One or more '''Mesh''' instances, containing the nodes, elements and conditions that compose the problem domain.<br />
* The '''ProcessInfo''', a container of global data for the entire model, such as the time step the simulation is at, and any global parameters required by the algorithms used to solve the problem.<br />
* Any additional global data required, such as Tables.<br />
<br />
In addition to this, the ModelPart is also responsible for keeping track of the advancement in time of the simulation, managing the initialization of new time steps<br />
<br />
model_part.CloneSolutionStep(time)<br />
<br />
and the amount of old step data that is stored in the nodes' historical database.<br />
<br />
model_part.SetBufferSize(Nsteps)<br />
<br />
A problem usually has a single ModelPart instance, that manages the entire model, but in some cases it can be convenient to use multiple model parts. This is often done in coupled problems, where a model part is used for each individual field to be solved.<br />
<br />
In a distributed memory environment, the ModelPart is also responsible for parallel communication.<br />
<br />
Next : [[Kratos Structure: Strategies and Processes]]<br />
<br />
Previous : [[Kratos Structure: Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Mesh_and_ModelPartKratos Structure: Mesh and ModelPart2012-05-07T08:19:43Z<p>Jcotela: </p>
<hr />
<div>Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data related to a given model.<br />
<br />
== The Mesh ==<br />
<br />
The Mesh class is the container that stores the geometrical definition of the problem or a region of the simulation domain. At its core, it contains three lists, for the nodes, elements and conditions that constitute the model. The elements on each list are ordered by their Id, ordered consecutively starting from one. In addition, the mesh also holds a list of properties used to characterize the material properties of its elements and conditions.<br />
<br />
== The Model Part ==<br />
<br />
The ModelPart is arguably the most important class in Kratos. It contains all the information required for the simulation of a given problem, namely '''Nodes''', '''Elements''' and '''Conditions'''.<br />
* One or more '''Mesh''' instances, containing the nodes, elements and conditions that compose the problem domain.<br />
* The '''ProcessInfo''', a container of global data for the entire model, such as the time step the simulation is at, and any global parameters required by the algorithms used to solve the problem.<br />
* Any additional global data required, such as Tables.<br />
<br />
In addition to this, the ModelPart is also responsible for keeping track of the advancement in time of the simulation, managing the initialization of new time steps<br />
<br />
model_part.CloneSolutionStep(time)<br />
<br />
and the amount of old step data that is stored in the nodes' historical database.<br />
<br />
model_part.SetBufferSize(Nsteps)<br />
<br />
A problem usually has a single ModelPart instance, that manages the entire model, but in some cases it can be convenient to use multiple model parts. This is often done in coupled problems, where a model part is used for each individual field to be solved.<br />
<br />
Next : [[Kratos Structure: Strategies and Processes]]<br />
<br />
Previous : [[Kratos Structure: Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_WorkflowKratos Structure: Workflow2012-05-06T10:01:00Z<p>Jcotela: Created page with "The basic ingredients required to solve a problem using Kratos Multiphysics are the following * The Model Part (.mdpa) file. * A Python script. == The Model Part (.mdpa) file =..."</p>
<hr />
<div>The basic ingredients required to solve a problem using Kratos Multiphysics are the following<br />
<br />
* The Model Part (.mdpa) file.<br />
* A Python script.<br />
<br />
== The Model Part (.mdpa) file ==<br />
<br />
The Model Part file defines the geometry and mesh of the problem, as well as the initial and boundary conditions to be applied. It is a regular text file with the extension ''.mdpa'' which follows the structure outlined in [[Input Data]].<br />
<br />
== The Python script ==<br />
<br />
Kratos Multiphysics uses the [http://www.python.org Python] scripting language to provide a flexible and dynamic way of combining its components to perform different types of simulations. The main Python script plays the part of the main function of the program, but with the crucial advantage of being easily accessible both to users and developers, who can modify the flow of the program without having to recompile the source code.<br />
<br />
For models defined using [http://www.gidhome.com/ GiD], there will be an auxiliary Python file defining additional problem settings to be read from the main script. This file is used to communicate the input provided by the user to the default Python file that GiD launches when the simulation is launched.</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Strategies_and_ProcessesKratos Structure: Strategies and Processes2012-05-06T09:33:09Z<p>Jcotela: </p>
<hr />
<div>We will briefly present the classes used to implement a solver in Kratos Multiphysics. In the previous sections of this overview, we have described the different components that are used to describe the model: ModelPart, Mesh, Element, Condition, Node. Here, we will examine a different group of classes that can be used to implement a solver for a particular problem. Again, the design is based in providing a modular system, where different components can be used interchangeably or reused to implement different solvers.<br />
<br />
== Solution strategies ==<br />
<br />
=== Time scheme ===<br />
<br />
The time scheme implements the time discretization of the problem, as well as the update of the problem unknowns once the problem ends. Its task is to ask elements and conditions for their local contributions to the system matrix. Each element/condition can define up to three different local matrices (and their corresponding right hand side vector):<br />
<br />
* '''Local system contribution''' matrices that multiply the system unknowns.<br />
* '''Damp matrix''' matrices that multiply the first derivatives in time of the system unknowns.<br />
* '''Mass matrix''' matrices that multiply the second derivatives in time of the system unknowns.<br />
<br />
The time scheme collect these matrices and combine them using an appropriate time iteration to form a single local contribution, that will then be passed to the builder and solver.<br />
<br />
=== Builder and solver ===<br />
<br />
For implicit problems, the builder and solver manages the assembly and solution of the system matrix. Its work flow can be summarized as<br />
<br />
* At the start of the problem (or on demand, if the mesh changes) the builder and solver calculates the dimensions of the system matrix by counting the degrees of freedom in the system, and assigns a row in the final system to each unknown.<br />
* At each solution iteration, the builder and solver asks the time scheme to provide the local contributions for each element and condition and assembles them in the corresponding positions of the global system.<br />
* Once the system matrix and right hand side vector have been assembled, the builder and solver calls a linear solver (provided at runtime) to solve the system.<br />
<br />
=== Strategy ===<br />
<br />
The strategy constitutes the top layer of the solution strategy components, and controls the flow of the problem. A typical example of what a strategy implements would be Newton-Raphson iterations. It uses the time scheme and the builder and solver to perform an iteration and update the unknowns, checks for convergence (with the help of a ConvergenceCriteria object, not presented in this overview) and decides when the solution process is finished.<br />
<br />
== Helper tools ==<br />
<br />
In addition to the solution strategy classes, there are some classes that can be used to implement auxiliary tasks in the simulation: processes and utilities.<br />
<br />
=== Process ===<br />
<br />
The Process class is used to implement general tasks that are not covered by the basic solution iteration. They are characterized by an Execute() function, that will perform the task the process was designed for.<br />
<br />
=== Utilities ===<br />
<br />
Utilities are collections of tools used to perform a particular task, or with a common subject, such as, for example, mathematical functions, parallelization tools or calculation of surface normals.<br />
<br />
== Python solvers ==<br />
<br />
All tools described to this point are compiled in C++, and have an interface to call them from Python. The user can then freely mix them in a simulation, although not all combinations will work or even make sense, obviously. We provide some ''pre-packaged'' solvers already implemented as Python classes, which combine the strategies and tools in a way that is usable out of the box. Each application defines its own solvers, but their general structure will be outlined in the following section.<br />
<br />
Next : [[Kratos Structure: Workflow]]<br />
<br />
Previous : [[Kratos Structure: Mesh and ModelPart]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Strategies_and_ProcessesKratos Structure: Strategies and Processes2012-05-06T08:38:09Z<p>Jcotela: Created page with "We will briefly present the classes used to implement a solver in Kratos Multiphysics. In the previous sections of this overview, we have described the different components that ..."</p>
<hr />
<div>We will briefly present the classes used to implement a solver in Kratos Multiphysics. In the previous sections of this overview, we have described the different components that are used to describe the model: ModelPart, Mesh, Element, Condition, Node. Here, we will examine a different group of classes that can be used to implement a solver for a particular problem. Again, the design is based in providing a modular system, where different components can be used interchangeably or reused to implement different solvers.<br />
<br />
== Solution strategies ==<br />
<br />
=== Time scheme ===<br />
<br />
The time scheme implements the time discretization of the problem, as well as the update of the problem unknowns once the problem ends. Its task is to ask elements and conditions for their local contributions to the system matrix. Each element/condition can define up to three different local matrices (and their corresponding right hand side vector):<br />
<br />
* '''Local system contribution''' matrices that multiply the system unknowns.<br />
* '''Damp matrix''' matrices that multiply the first derivatives in time of the system unknowns.<br />
* '''Mass matrix''' matrices that multiply the second derivatives in time of the system unknowns.<br />
<br />
The time scheme collect these matrices and combine them using an appropriate time iteration to form a single local contribution, that will then be passed to the builder and solver.<br />
<br />
=== Builder and solver ===<br />
<br />
For implicit problems, the builder and solver manages the assembly and solution of the system matrix. Its work flow can be summarized as<br />
<br />
* At the start of the problem (or on demand, if the mesh changes) the builder and solver calculates the dimensions of the system matrix by counting the degrees of freedom in the system, and assigns a row in the final system to each unknown.<br />
* At each solution iteration, the builder and solver asks the time scheme to provide the local contributions for each element and condition and assembles them in the corresponding positions of the global system.<br />
* Once the system matrix and right hand side vector have been assembled, the builder and solver calls a linear solver (provided at runtime) to solve the system.<br />
<br />
=== Strategy ===<br />
<br />
== Helper tools ==<br />
<br />
=== Process ===<br />
<br />
=== Utilities ===<br />
<br />
== Python solvers ==</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Mesh_and_ModelPartKratos Structure: Mesh and ModelPart2012-05-05T18:34:52Z<p>Jcotela: </p>
<hr />
<div>Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data related to a given model.<br />
<br />
== The Mesh ==<br />
<br />
The Mesh class is the container that stores the geometrical definition of the problem or a region of the simulation domain. At its core, it contains three lists, for the nodes, elements and conditions that constitute the model. The elements on each list are ordered by their Id, ordered consecutively starting from one.<br />
<br />
== The Model Part ==<br />
<br />
The ModelPart is arguably the most important class in Kratos. It contains all the information required for the simulation of a given problem, namely '''Nodes''', '''Elements''' and '''Conditions'''.<br />
* One or more '''Mesh''' instances, containing the nodes, elements and conditions that compose the problem domain.<br />
* A list of the '''Properties''' used to define the material properties of elements and conditions of the model.<br />
* The '''ProcessInfo''', a container of global data for the entire model, such as the time step the simulation is at, and any global parameters required by the algorithms used to solve the problem.<br />
* Any additional global data required, such as Tables.<br />
<br />
In addition to this, the ModelPart is also responsible for keeping track of the advancement in time of the simulation, managing the initialization of new time steps<br />
<br />
model_part.CloneSolutionStep(time)<br />
<br />
and the amount of old step data that is stored in the nodes' historical database.<br />
<br />
model_part.SetBufferSize(Nsteps)<br />
<br />
A problem usually has a single ModelPart instance, that manages the entire model, but in some cases it can be convenient to use multiple model parts. This is often done in coupled problems, where a model part is used for each individual field to be solved.<br />
<br />
Next : [[Kratos Structure: Strategies and Processes]]<br />
<br />
Previous : [[Kratos Structure: Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Mesh_and_ModelPartKratos Structure: Mesh and ModelPart2012-05-05T18:32:29Z<p>Jcotela: </p>
<hr />
<div>Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data related to a given model.<br />
<br />
== The Mesh ==<br />
<br />
The Mesh class is the container that stores the geometrical definition of the problem or a region of the simulation domain. At its core, it contains three lists, for the nodes, elements and conditions that constitute the model. The elements on each list are ordered by their Id, ordered consecutively starting from one.<br />
<br />
== The Model Part ==<br />
<br />
The ModelPart is arguably the most important class in Kratos. It contains all the information required for the simulation of a given problem, namely '''Nodes''', '''Elements''' and '''Conditions'''.<br />
* One or more '''Mesh''' instances, containing the nodes, elements and conditions that compose the problem domain.<br />
* A list of the '''Properties''' used to define the material properties of elements and conditions of the model.<br />
* The '''ProcessInfo''', a container of global data for the entire model, such as the time step the simulation is at, and any global parameters required by the algorithms used to solve the problem.<br />
* Any additional global data required, such as Tables.<br />
<br />
In addition to this, the ModelPart is also responsible for keeping track of the advancement in time of the simulation, managing the initialization of new time steps<br />
<br />
model_part.CloneSolutionStep(time)<br />
<br />
and the amount of old step data that is stored in the nodes' historical database.<br />
<br />
model_part.SetBufferSize(Nsteps)<br />
<br />
Next : [[Kratos Structure: Strategies and Processes]]<br />
<br />
Previous : [[Kratos Structure: Elements and Conditions]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Mesh_and_ModelPartKratos Structure: Mesh and ModelPart2012-05-05T18:32:06Z<p>Jcotela: </p>
<hr />
<div>Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data related to a given model.<br />
<br />
== The Mesh ==<br />
<br />
The Mesh class is the container that stores the geometrical definition of the problem or a region of the simulation domain. At its core, it contains three lists, for the nodes, elements and conditions that constitute the model. The elements on each list are ordered by their Id, ordered consecutively starting from one.<br />
<br />
== The Model Part ==<br />
<br />
The ModelPart is arguably the most important class in Kratos. It contains all the information required for the simulation of a given problem, namely '''Nodes''', '''Elements''' and '''Conditions'''.<br />
* One or more '''Mesh''' instances, containing the nodes, elements and conditions that compose the problem domain.<br />
* A list of the '''Properties''' used to define the material properties of elements and conditions of the model.<br />
* The '''ProcessInfo''', a container of global data for the entire model, such as the time step the simulation is at, and any global parameters required by the algorithms used to solve the problem.<br />
* Any additional global data required, such as Tables.<br />
<br />
In addition to this, the ModelPart is also responsible for keeping track of the advancement in time of the simulation, managing the initialization of new time steps<br />
<br />
model_part.CloneSolutionStep(time)<br />
<br />
and the amount of old step data that is stored in the nodes' historical database.<br />
<br />
model_part.SetBufferSize(Nsteps)<br />
<br />
Next : [[Kratos Structure: Strategies and Processes]]<br />
<br />
Previous : [[Kratos Structure: Workflow]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Elements_and_ConditionsKratos Structure: Elements and Conditions2012-05-05T18:31:52Z<p>Jcotela: </p>
<hr />
<div>Elements and conditions are the objects that contain most of the physics of the problem. An element contains all the information related to an individual finite element in the mesh, and its main functionality is to provide that element's local contributions to the system matrices and vectors. Each condition represents a face of a finite element that is contained in the boundary of the model, and is used to implement boundary conditions.<br />
<br />
While both elements and conditions have practically the same interface, they are implemented as separate objects to emphasize the conceptual difference between them. Like nodes, both elements and conditions have a unique id (an integer starting from 1) and can store variables but, unlike the nodes, they only have a non-historical database.<br />
<br />
To compute the local contributions to the system matrix, developers of elements and conditions can have the following tools at hand:<br />
<br />
* A '''Geometry''' instance.<br />
* A pointer to the elment's '''Properties'''.<br />
<br />
== The Geometry class ==<br />
<br />
The Geometry class manages all the geometrical information for a single element. There is a geometry type for each basic shape used in finite elements, such as lines, triangles, quadrilaterals, tetrahedra and hexahedra. The geometry of an element provides a way to access its nodes, as well as all information required to evaluate shape functions and integrate quantities of interest on the element using a quadrature.<br />
<br />
== Properties ==<br />
<br />
Elements and conditions can also store a pointer to a Properties instance. Properties are used to provide information that is common to a group of elements in the problem. For example, in solid mechanics problems, information about the material properties of the element is stored in a properties container. Just as it was the case with nodes and elements, all values stored in properties are associated to a Kratos variable.<br />
<br />
Next : [[Kratos Structure: Mesh and ModelPart]]<br />
<br />
Previous : [[Kratos Structure: Node and Nodal Data]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Basic_ComponentsKratos Structure: Basic Components2012-05-05T18:31:36Z<p>Jcotela: </p>
<hr />
<div>As a library, Kratos intends to help users develop easier and faster their own finite element code, taking advantage of the generic components provided by the Kratos Kernel or the features implemented in the different applications. As such, in the design of Kratos, the needs of three different types of potential users where considered:<br />
<br />
* '''Finite Element Developers''' These developers are considered to be more expert in FEM, from the physical and mathematical points of view, than C++ programming. For this reason, Kratos has to meet their needs without involving them in advanced programming concepts.<br />
* '''Application Developers''' These users are less interested in finite element programming and their programming knowledge may vary from very expert to higher than basic. They may use not only Kratos itself but also any other applications provided by finite element developers, or other application developers. Developers of optimization programs or design tools are the typical users of this kind.<br />
* '''Package Users''' Engineers and designers are a third group of users of Kratos. They use Kratos and its applications to model and solve their problem as a closed package, without getting involved in its implementation details. For these users Kratos has to provide a flexible external interface to enable them use different features of Kratos without requiring them to modify its internal structure.<br />
<br />
== Object Oriented Design ==<br />
<br />
Kratos follows an object oriented design philosophy, which is based on splitting a problem into multiple individual objects and defining their interactions through a common interface. In the case of Kratos, these objects tend to reproduce concepts from the finite element literature when possible, as seen in the following scheme. <br />
<br />
[[Image:GSMainClasses.jpg]]<br />
<br />
<tt>Vector</tt>, <tt>Matrix</tt>, and <tt>Quadrature</tt> are<br />
designed by basic numerical concepts. <tt>Node</tt>,<br />
<tt>Element</tt>, <tt>Condition</tt>, and <tt>Dof</tt> are defined<br />
directly from finite element concepts. <tt>Model</tt>,<br />
<tt>Mesh</tt>, and <tt>Properties</tt> are coming from practical<br />
methodology used in finite element modeling completed by<br />
<tt>ModelPart</tt>, and <tt>SpatialContainer</tt>, for organizing<br />
better all data necessary for analysis. <tt>IO</tt>,<br />
<tt>LinearSolver</tt>, <tt>Process</tt>, and <tt>Strategy</tt> are<br />
representing the different steps of finite element program flow.<br />
and finally <tt>Kernel</tt> and <tt>Application</tt> are defined<br />
for library management and defining its interface.<br />
<br />
These main objects are described below:<br />
<br />
* '''<tt>Vector</tt>''' Represents the algebraic vector and defines usual operators over vectors.<br />
<br />
* '''<tt>Matrix</tt>''' Encapsulate matrix and its operators. There are different matrix classes are necessary. The most typical ones are dense matrix and compressed row matrix.<br />
<br />
* '''<tt>Quadrature</tt>''' Implements the quadrature methods used in finite element method. For example the gaussian integration with different number of integration points.<br />
<br />
* '''<tt>Geometry</tt>''' Defines a geometry over a list of points or <tt>Node</tt>s and provides from its usual parameter like area or center point to shape functions and coordinate transformation routines.<br />
<br />
* '''<tt>Node</tt>''' <tt>Node</tt> is a point with additional facilities. Stores the nodal data, historical nodal data, and list of degrees of freedom. It provides also an interface to access all its data.<br />
<br />
* '''<tt>Element</tt>''' Encapsulates the elemental formulation in one objects and provides an interface for calculating the local matrices and vectors necessary for assembling the global system of equations. It holds its geometry that meanwhile is its array of <tt>Node</tt>s. Also stores the elemental data and interface to access it.<br />
<br />
* '''<tt>Condition</tt>''' Encapsulates data and operations necessary for calculating the local contributions of <tt>Condition</tt> in global system of equations. Neumann conditions are example '''Condition'''s which can be encapsulated by derivatives of this class.<br />
<br />
* '''<tt>Dof</tt>''' Represents a degree of freedom (dof). It is a lightweight object which holds the its variable, like <tt>TEMPERATURE</tt>, its state of freedom, and a reference to its value in data structure. This class enables the system to work with different set of dofs and also represents the Dirichlet condition assigned to each dof.<br />
<br />
* '''<tt>Properties</tt>''' Encapsulates data shared by different <tt>Element</tt>s or <tt>Condition</tt>s. It can stores any type of data and provide a variable base access to them.<br />
<br />
* '''<tt>Model</tt>''' Stores the whole model to be analyzed. All <tt>Node</tt>s, <tt>Properties</tt>, <tt>Element</tt>s, <tt>Condition</tt>s and solution data. It also provides and access interface to these data.<br />
* '''<tt>ModelPart</tt>''' Holds all data related to an arbitrary part of model. It stores all existing components and data like <tt>Node</tt>s, <tt>Properties</tt>, <tt>Element</tt>s, <tt>Condition</tt>s and solution data related to a part of model and provides interface to access them in different ways.<br />
* '''<tt>Mesh</tt>''' Holds <tt>Node</tt>s, <tt>Properties</tt>, <tt>Element</tt>s, <tt>Condition</tt>s and represents a part of model but without additional solution parameters. It provides access interface to its data.<br />
<br />
* '''<tt>SpatialContainer</tt>''' Containers associated with spacial search algorithms. This algorithms are useful for finding the nearest <tt>Node</tt> or <tt>Element</tt> to some point or other spacial searches. Quadtree and Octree are example of these containers.<br />
<br />
* '''<tt>IO</tt>''' Provides different implementation of input output procedures which can be used to read and write with different formats and characteristics.<br />
<br />
* '''<tt>LinearSolver</tt>''' Encapsulates the algorithms used for solving a linear system of equations. Different direct solvers and iterative solvers can be implemented in Kratos as a derivatives of this class.<br />
<br />
* '''<tt>Strategy</tt>''' Encapsulates the solving algorithm and general flow of a solving process. Strategy manages the building of equation system and then solve it using a linear solver and finally is in charge of updating the results in the data structure.<br />
<br />
* '''<tt>Process</tt>''' Is the extension point for adding new algorithms to Kratos. Mapping algorithms, Optimization procedures and many other type of algorithms can be implemented as a new process in Kratos.<br />
<br />
* '''<tt>Kernel</tt>''' Manages the whole Kratos by initializing different part of it and provides necessary interface to communicate with applications.<br />
<br />
* '''<tt>Application</tt>''' Provide all information necessary for adding an application to Kratos. A derived class from it is necessary to give kernel its required information like new <tt>Variable</tt>s, <tt>Element</tt>s, <tt>Condition</tt>s, etc.<br />
<br />
The main intention here was to provide a clear separation between the most basic components, such as the data structure and the IO, that are critical for perfomance and require a relatively advanced computer science background to design and implement efficiently, and the higher level components derived from finite element analysis, that are not as performance critical but are more involved from an engineering or mathemathical point of view.<br />
<br />
== Multi-Layered Design ==<br />
<br />
<br />
Kratos uses a ''multi-layer'' approach in its design, in which each object only interacts with other objects in its layer or in a more basic layer. Layering reduces the dependency inside the program. It helps in the maintenance of the code and also helps developers to better understand the code and clarify their tasks.<br />
<br />
In designing the layers of the structure, the different user types mentioned<br />
before are considered. The layering is done in a way that each<br />
user has to work in the minimum number of layers as possible. In this<br />
way the amount of the code to be known by each user is minimized<br />
and the chance of conflict between users in different categories<br />
is reduced. This layering also lets Kratos to tune the<br />
implementation difficulties needed for each layer to the knowledge<br />
of users working in it. For example the finite element layer uses<br />
only basic to average features of C++ programming but the main<br />
developer layer use advanced language features in order to provide<br />
the desirable performance.<br />
<br />
Following these design principles, Kratos is organized in the following layers:<br />
<br />
* '''Basic Tools Layer''' Holds all basic tools used in Kratos. In this layer using advance techniques in C++ is essential in order to maximize the performance of these tools. This layer is designed to be implemented by an expert programmer and with less knowledge of FEM. This layer may also provides interfaces with other libraries to take benefit of existing work in area.<br />
* '''Base Finite Element Layer''' This layer holds the objects that are necessary to implement a finite element formulation. It also defines the structure to be extended for new formulations. This layer hides the difficult implementations of nodal and data structure and other common features from the finite element developers.<br />
<br />
* '''Finite Element Layer''' The extension layer for finite element developers. The finite element layer is restricted to use the basic and average features of language and uses the component base finite element layer and basic tools to optimize the performance without entering into optimization details.<br />
<br />
* '''Data Structure Layer''' Contains all objects organizing the data structure. This layer has no restriction in implementation. Advanced language features are used to maximize the flexibility of the data structure.<br />
<br />
* '''Base Algorithms Layer''' Provides the components building the extendible structure for algorithms. Generic algorithms can also be implemented here to help developer in their implementation by reusing them.<br />
<br />
* '''User's Algorithms Layer''' Another layer to be used by finite element programmers but at a higher level. This layer contains all classes implementing the different algorithms in Kratos. Implementation in this layer requires medium level of programming experience but a higher knowledge of program structure than the finite element layer.<br />
<br />
* '''Applications' Interface Layer''' This layer holds all objects that manage Kratos and its relation with other applications. Components in this layer are implemented using high level programming techniques in order to provide the required flexibility.<br />
* '''Applications Layer''' A simple layer which contains the interface of certain applications with Kratos.<br />
<br />
* '''Scripts Layer''' Holds a set of IO scripts which can be used to implement different algorithms from outside Kratos. Package users can use modules in this layer or create their own extension without having knowledge of C++ programming or the internal structure of Kratos. Via this layer they can activate and deactivate certain functionalities or implement a new global algorithm without entering into Kratos implementation details.<br />
<br />
The layers described here are summarised in the following figure<br />
<br />
[[Image:KratosLayers.jpg]]<br />
<br />
Next : [[Kratos Structure: Node and Nodal Data]]<br />
<br />
Previous : [[Kratos Structure: Kernel and applications]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Kernel_and_applicationsKratos Structure: Kernel and applications2012-05-05T18:31:21Z<p>Jcotela: </p>
<hr />
<div>== Introduction ==<br />
<br />
Kratos Multitphysics is designed as a framework for the development of multi-disciplinary finite element programs. We intend to provide a flexible and extensible code base, that can be used to implement formulations in different fields of physiscs, as well as algorithms that involve the solution of multi-physics problems. To achieve the flexibility required for this goal, Kratos is not designed as a monolithic code but as a library where users can find and combine the different tools required to solve a particular problem.<br />
<br />
Kratos is implemented in C++ and follows an object-oriented design that will be described in detail in the following pages. It is exposed to [http://www.python.org Python] through the [http://www.boost.org Boost] library.<br />
<br />
== Kernel and Applications ==<br />
<br />
The components of Kratos Multiphysics can be broadly grouped in two categories, the Kernel and the Applications, which can be broadly seen as the numerical core and the physics, respectively. An application provides an implementation of a collection of algorithms used in the simulation of problems in a certain field, such as fluid dynamics or solid mechanics. The applications can be self-contained or intended to work with other applciations but, in general, can be seen as a toolset for the solution of a particualr physics problem. In contrast, the Kernel provides the basic infrastructure and general numeric tools, that is, the core over which the different applications are built. In providing a common infrastructure for all applications, the Kernel also allows the communication between the different applications.<br />
<br />
The main advantage of the Kernel and Applications model is that it provides a clear separation between the numerical base of the code and the parts that are focused to the simulation of a particular class of problems, preventing conflics in the development of different applications. This allows Kratos developers to concentrate on extending a part of the code without fear of introducign errors in other areas, with the added advantage that it reduces compilation time. In addition, it adds a great deal of modularity to the code, and allows us to provide "closed package" solutions focused to a given type of models.<br />
<br />
<br />
Next : [[Kratos Structure: Basic Components]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Basic_ComponentsKratos Structure: Basic Components2012-05-05T18:30:47Z<p>Jcotela: </p>
<hr />
<div>As a library, Kratos intends to help users develop easier and faster their own finite element code, taking advantage of the generic components provided by the Kratos Kernel or the features implemented in the different applications. As such, in the design of Kratos, the needs of three different types of potential users where considered:<br />
<br />
* '''Finite Element Developers''' These developers are considered to be more expert in FEM, from the physical and mathematical points of view, than C++ programming. For this reason, Kratos has to meet their needs without involving them in advanced programming concepts.<br />
* '''Application Developers''' These users are less interested in finite element programming and their programming knowledge may vary from very expert to higher than basic. They may use not only Kratos itself but also any other applications provided by finite element developers, or other application developers. Developers of optimization programs or design tools are the typical users of this kind.<br />
* '''Package Users''' Engineers and designers are a third group of users of Kratos. They use Kratos and its applications to model and solve their problem as a closed package, without getting involved in its implementation details. For these users Kratos has to provide a flexible external interface to enable them use different features of Kratos without requiring them to modify its internal structure.<br />
<br />
== Object Oriented Design ==<br />
<br />
Kratos follows an object oriented design philosophy, which is based on splitting a problem into multiple individual objects and defining their interactions through a common interface. In the case of Kratos, these objects tend to reproduce concepts from the finite element literature when possible, as seen in the following scheme. <br />
<br />
[[Image:GSMainClasses.jpg]]<br />
<br />
<tt>Vector</tt>, <tt>Matrix</tt>, and <tt>Quadrature</tt> are<br />
designed by basic numerical concepts. <tt>Node</tt>,<br />
<tt>Element</tt>, <tt>Condition</tt>, and <tt>Dof</tt> are defined<br />
directly from finite element concepts. <tt>Model</tt>,<br />
<tt>Mesh</tt>, and <tt>Properties</tt> are coming from practical<br />
methodology used in finite element modeling completed by<br />
<tt>ModelPart</tt>, and <tt>SpatialContainer</tt>, for organizing<br />
better all data necessary for analysis. <tt>IO</tt>,<br />
<tt>LinearSolver</tt>, <tt>Process</tt>, and <tt>Strategy</tt> are<br />
representing the different steps of finite element program flow.<br />
and finally <tt>Kernel</tt> and <tt>Application</tt> are defined<br />
for library management and defining its interface.<br />
<br />
These main objects are described below:<br />
<br />
* '''<tt>Vector</tt>''' Represents the algebraic vector and defines usual operators over vectors.<br />
<br />
* '''<tt>Matrix</tt>''' Encapsulate matrix and its operators. There are different matrix classes are necessary. The most typical ones are dense matrix and compressed row matrix.<br />
<br />
* '''<tt>Quadrature</tt>''' Implements the quadrature methods used in finite element method. For example the gaussian integration with different number of integration points.<br />
<br />
* '''<tt>Geometry</tt>''' Defines a geometry over a list of points or <tt>Node</tt>s and provides from its usual parameter like area or center point to shape functions and coordinate transformation routines.<br />
<br />
* '''<tt>Node</tt>''' <tt>Node</tt> is a point with additional facilities. Stores the nodal data, historical nodal data, and list of degrees of freedom. It provides also an interface to access all its data.<br />
<br />
* '''<tt>Element</tt>''' Encapsulates the elemental formulation in one objects and provides an interface for calculating the local matrices and vectors necessary for assembling the global system of equations. It holds its geometry that meanwhile is its array of <tt>Node</tt>s. Also stores the elemental data and interface to access it.<br />
<br />
* '''<tt>Condition</tt>''' Encapsulates data and operations necessary for calculating the local contributions of <tt>Condition</tt> in global system of equations. Neumann conditions are example '''Condition'''s which can be encapsulated by derivatives of this class.<br />
<br />
* '''<tt>Dof</tt>''' Represents a degree of freedom (dof). It is a lightweight object which holds the its variable, like <tt>TEMPERATURE</tt>, its state of freedom, and a reference to its value in data structure. This class enables the system to work with different set of dofs and also represents the Dirichlet condition assigned to each dof.<br />
<br />
* '''<tt>Properties</tt>''' Encapsulates data shared by different <tt>Element</tt>s or <tt>Condition</tt>s. It can stores any type of data and provide a variable base access to them.<br />
<br />
* '''<tt>Model</tt>''' Stores the whole model to be analyzed. All <tt>Node</tt>s, <tt>Properties</tt>, <tt>Element</tt>s, <tt>Condition</tt>s and solution data. It also provides and access interface to these data.<br />
* '''<tt>ModelPart</tt>''' Holds all data related to an arbitrary part of model. It stores all existing components and data like <tt>Node</tt>s, <tt>Properties</tt>, <tt>Element</tt>s, <tt>Condition</tt>s and solution data related to a part of model and provides interface to access them in different ways.<br />
* '''<tt>Mesh</tt>''' Holds <tt>Node</tt>s, <tt>Properties</tt>, <tt>Element</tt>s, <tt>Condition</tt>s and represents a part of model but without additional solution parameters. It provides access interface to its data.<br />
<br />
* '''<tt>SpatialContainer</tt>''' Containers associated with spacial search algorithms. This algorithms are useful for finding the nearest <tt>Node</tt> or <tt>Element</tt> to some point or other spacial searches. Quadtree and Octree are example of these containers.<br />
<br />
* '''<tt>IO</tt>''' Provides different implementation of input output procedures which can be used to read and write with different formats and characteristics.<br />
<br />
* '''<tt>LinearSolver</tt>''' Encapsulates the algorithms used for solving a linear system of equations. Different direct solvers and iterative solvers can be implemented in Kratos as a derivatives of this class.<br />
<br />
* '''<tt>Strategy</tt>''' Encapsulates the solving algorithm and general flow of a solving process. Strategy manages the building of equation system and then solve it using a linear solver and finally is in charge of updating the results in the data structure.<br />
<br />
* '''<tt>Process</tt>''' Is the extension point for adding new algorithms to Kratos. Mapping algorithms, Optimization procedures and many other type of algorithms can be implemented as a new process in Kratos.<br />
<br />
* '''<tt>Kernel</tt>''' Manages the whole Kratos by initializing different part of it and provides necessary interface to communicate with applications.<br />
<br />
* '''<tt>Application</tt>''' Provide all information necessary for adding an application to Kratos. A derived class from it is necessary to give kernel its required information like new <tt>Variable</tt>s, <tt>Element</tt>s, <tt>Condition</tt>s, etc.<br />
<br />
The main intention here was to provide a clear separation between the most basic components, such as the data structure and the IO, that are critical for perfomance and require a relatively advanced computer science background to design and implement efficiently, and the higher level components derived from finite element analysis, that are not as performance critical but are more involved from an engineering or mathemathical point of view.<br />
<br />
== Multi-Layered Design ==<br />
<br />
<br />
Kratos uses a ''multi-layer'' approach in its design, in which each object only interacts with other objects in its layer or in a more basic layer. Layering reduces the dependency inside the program. It helps in the maintenance of the code and also helps developers to better understand the code and clarify their tasks.<br />
<br />
In designing the layers of the structure, the different user types mentioned<br />
before are considered. The layering is done in a way that each<br />
user has to work in the minimum number of layers as possible. In this<br />
way the amount of the code to be known by each user is minimized<br />
and the chance of conflict between users in different categories<br />
is reduced. This layering also lets Kratos to tune the<br />
implementation difficulties needed for each layer to the knowledge<br />
of users working in it. For example the finite element layer uses<br />
only basic to average features of C++ programming but the main<br />
developer layer use advanced language features in order to provide<br />
the desirable performance.<br />
<br />
Following these design principles, Kratos is organized in the following layers:<br />
<br />
* '''Basic Tools Layer''' Holds all basic tools used in Kratos. In this layer using advance techniques in C++ is essential in order to maximize the performance of these tools. This layer is designed to be implemented by an expert programmer and with less knowledge of FEM. This layer may also provides interfaces with other libraries to take benefit of existing work in area.<br />
* '''Base Finite Element Layer''' This layer holds the objects that are necessary to implement a finite element formulation. It also defines the structure to be extended for new formulations. This layer hides the difficult implementations of nodal and data structure and other common features from the finite element developers.<br />
<br />
* '''Finite Element Layer''' The extension layer for finite element developers. The finite element layer is restricted to use the basic and average features of language and uses the component base finite element layer and basic tools to optimize the performance without entering into optimization details.<br />
<br />
* '''Data Structure Layer''' Contains all objects organizing the data structure. This layer has no restriction in implementation. Advanced language features are used to maximize the flexibility of the data structure.<br />
<br />
* '''Base Algorithms Layer''' Provides the components building the extendible structure for algorithms. Generic algorithms can also be implemented here to help developer in their implementation by reusing them.<br />
<br />
* '''User's Algorithms Layer''' Another layer to be used by finite element programmers but at a higher level. This layer contains all classes implementing the different algorithms in Kratos. Implementation in this layer requires medium level of programming experience but a higher knowledge of program structure than the finite element layer.<br />
<br />
* '''Applications' Interface Layer''' This layer holds all objects that manage Kratos and its relation with other applications. Components in this layer are implemented using high level programming techniques in order to provide the required flexibility.<br />
* '''Applications Layer''' A simple layer which contains the interface of certain applications with Kratos.<br />
<br />
* '''Scripts Layer''' Holds a set of IO scripts which can be used to implement different algorithms from outside Kratos. Package users can use modules in this layer or create their own extension without having knowledge of C++ programming or the internal structure of Kratos. Via this layer they can activate and deactivate certain functionalities or implement a new global algorithm without entering into Kratos implementation details.<br />
<br />
The layers described here are summarised in the following figure<br />
<br />
[[Image:KratosLayers.jpg]]<br />
<br />
Next: [[Kratos Structure: Node and Nodal Data]]<br />
<br />
Previous: [[Kratos Structure: Kernel and applications]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Mesh_and_ModelPartKratos Structure: Mesh and ModelPart2012-05-05T18:29:09Z<p>Jcotela: </p>
<hr />
<div>Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data related to a given model.<br />
<br />
== The Mesh ==<br />
<br />
The Mesh class is the container that stores the geometrical definition of the problem or a region of the simulation domain. At its core, it contains three lists, for the nodes, elements and conditions that constitute the model. The elements on each list are ordered by their Id, ordered consecutively starting from one.<br />
<br />
== The Model Part ==<br />
<br />
The ModelPart is arguably the most important class in Kratos. It contains all the information required for the simulation of a given problem, namely '''Nodes''', '''Elements''' and '''Conditions'''.<br />
* One or more '''Mesh''' instances, containing the nodes, elements and conditions that compose the problem domain.<br />
* A list of the '''Properties''' used to define the material properties of elements and conditions of the model.<br />
* The '''ProcessInfo''', a container of global data for the entire model, such as the time step the simulation is at, and any global parameters required by the algorithms used to solve the problem.<br />
* Any additional global data required, such as Tables.<br />
<br />
In addition to this, the ModelPart is also responsible for keeping track of the advancement in time of the simulation, managing the initialization of new time steps<br />
<br />
model_part.CloneSolutionStep(time)<br />
<br />
and the amount of old step data that is stored in the nodes' historical database.<br />
<br />
model_part.SetBufferSize(Nsteps)<br />
<br />
Next: [[Kratos Structure: Strategies and Processes]]<br />
<br />
Previous: [[Kratos Structure: Workflow]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Mesh_and_ModelPartKratos Structure: Mesh and ModelPart2012-05-05T17:53:20Z<p>Jcotela: Created page with "Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data rela..."</p>
<hr />
<div>Continuing with this description of the basic components of Kratos, we turn our attention to the Mesh and the ModelPart, which are the containers of all information and data related to a given model.<br />
<br />
== The Mesh ==<br />
<br />
The Mesh class is the container that stores the geometrical definition of the problem. At its core, it contains three lists, for the nodes, elements and conditions that constitute the model. The elements on each list are ordered by their Id, ordered consecutively starting from one.<br />
<br />
== The Model Part ==</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Node_and_Nodal_DataKratos Structure: Node and Nodal Data2012-05-05T17:33:10Z<p>Jcotela: /* Historical database: Solution step data */</p>
<hr />
<div>One of the most basic classes is the Node. In this section, we will briefly present its implementation, which will will allow us to present some basic concepts in Kratos.<br />
<br />
== The Node ==<br />
<br />
The Node class centralizes the information related to a single point in the finite element mesh. In its core, the node class contains an index (Id) that uniquely identifies the node in the finite element mesh, and the geometrical information about the position of the node, which is stored as a Point instance. This basic structure is common to all nodes used in Kartos, and can be accessed and modified from Python using the following interface<br />
<br />
node.Id # Unique identifier for the node. An unsigned integer value, starting from 1<br />
node.X # X coordinate of the current position of the node<br />
node.Y # Y coordinate<br />
node.Z # Z coordinate<br />
<br />
In addition, the original position of the node is also stored, which is useful in Lagrangian or ALE (Arbitrary Lagrangian-Eulerian) formulations:<br />
<br />
node.X0 # Original X coordinate<br />
node.Y0 # Original Y coordinate<br />
node.Z0 # Original Z coordinate<br />
<br />
== Kratos Variables ==<br />
<br />
The node class is also responsible for managing the information related to that point of the mesh and, in particular, of the values of the problem data and unknowns at that point of the mesh. In Kratos, all such data is associated to a Variable, which typically identifies a phyisical magnitude such as velocity or temperature. For example, a node in a fluid problem could be required to store the following data:<br />
<br />
Node 735<br />
Velocity: An unknown of the problem, 3D vector.<br />
Pressure: An unknown of the problem, scalar.<br />
Density: Problem data, given as input, scalar.<br />
Viscosity: Problem data, given as input, scalar.<br />
Body force: Problem data (for example, acceleration of gravity), given as input, 3D vector.<br />
<br />
In Kratos, all variables are identified by a label, typically their name in uppercase (VELOCITY,PRESSURE). In the case of vectors, individual components can be also recovered explicitly so, for example, instead of asking for VELOCITY, we can inquire a node about VELOCITY_X, VELOCITY_Y or VELOCITY_Z. Variable names are hardcoded in Kratos, so adding new ones requires modifying the source. There is a main set of variables that is defined in the Kratos core files (see kratos/includes/variables.h and kratos/sources/variables.cpp) while each application can define its own set of variables. On a given Kratos model, all variables included in the Kratos Kernel and each of the individual applications imported will be available for use.<br />
<br />
== Types of Nodal Data ==<br />
<br />
There are two different containers for information that can be stored in nodes: the historical database and the non-historical database. Both can be used to store As the name suggests, the difference between the two is that the first one stores both the current value and the values that the variable held during the previous time steps, while the second stores only the current value.<br />
<br />
Note that there is no restriction to storing variables in either container, so both containers can store values for the same variable at the same time. While this can be useful in some cases, it should be noted that the values stored in each container are completely independent and no attempt will be made to synchronize them.<br />
<br />
=== Historical database: Solution step data ===<br />
<br />
The historical database is typically used to store values that we want to track as the simulation advances. A typical example of this is a dynamic problem, where we use a time scheme that approximates time derivatives using the values of our unknowns at previous time steps. To access the historical database of a node, we will use the C++ function<br />
<br />
Value& node.FastGetSolutionStepValue(VARIABLE,StepIndex = 0)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetSolutionStepValue(VARIABLE,StepIndex)<br />
node.SetSolutionStepValue(VARIABLE,StepIndex,Value)<br />
<br />
where VARIABLE is the Kratos Variable we want to access, Value is the value stored in the node for VARIABLE and StepIndex indicates the time step we are interested in, with 0 being the current time step, 1 the previous time step and so on. The maximum number of time steps stored at the same time for a given simulation is regulated by the ModelPart's buffer size parameter, that will be described in a later section.<br />
<br />
Note that all nodal variables read from the mdpa file are stored in the historical database.<br />
<br />
=== Non-historical database: Values ===<br />
<br />
The non-historical database stores values that won't be recorded as the simulation advances in time. Only a single value on each node is kept for a given variable at a given time. They can be accessed with the C++ function<br />
<br />
Value& node.GetValue(VARIABLE)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetValue(VARIABLE)<br />
node.SetValue(VARIABLE,Value)<br />
<br />
== Degrees of Freedom ==<br />
<br />
A last concept related to nodes and nodal data will be presented in this section: the Degree of freedom, or Dof for short. The Dof is one of the basic types in Kratos, and it is used to store information relative to the problem unknowns. A node will typically have one or more Dofs, depending on the problem being simulated. For the variables associated to a degree of freedom, in addition to their value, the status of the variable as a fixed (a boundary conditon) or free (an unknown) value is tracked, as well as its position in the system matrix, which is used to update it after a solution iteration.<br />
<br />
Next : [[Kratos Structure: Elements and Conditions]]<br />
<br />
Previous : [[Kratos Structure: Basic Components]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Node_and_Nodal_DataKratos Structure: Node and Nodal Data2012-05-05T17:32:58Z<p>Jcotela: /* Non-historical database: Values */</p>
<hr />
<div>One of the most basic classes is the Node. In this section, we will briefly present its implementation, which will will allow us to present some basic concepts in Kratos.<br />
<br />
== The Node ==<br />
<br />
The Node class centralizes the information related to a single point in the finite element mesh. In its core, the node class contains an index (Id) that uniquely identifies the node in the finite element mesh, and the geometrical information about the position of the node, which is stored as a Point instance. This basic structure is common to all nodes used in Kartos, and can be accessed and modified from Python using the following interface<br />
<br />
node.Id # Unique identifier for the node. An unsigned integer value, starting from 1<br />
node.X # X coordinate of the current position of the node<br />
node.Y # Y coordinate<br />
node.Z # Z coordinate<br />
<br />
In addition, the original position of the node is also stored, which is useful in Lagrangian or ALE (Arbitrary Lagrangian-Eulerian) formulations:<br />
<br />
node.X0 # Original X coordinate<br />
node.Y0 # Original Y coordinate<br />
node.Z0 # Original Z coordinate<br />
<br />
== Kratos Variables ==<br />
<br />
The node class is also responsible for managing the information related to that point of the mesh and, in particular, of the values of the problem data and unknowns at that point of the mesh. In Kratos, all such data is associated to a Variable, which typically identifies a phyisical magnitude such as velocity or temperature. For example, a node in a fluid problem could be required to store the following data:<br />
<br />
Node 735<br />
Velocity: An unknown of the problem, 3D vector.<br />
Pressure: An unknown of the problem, scalar.<br />
Density: Problem data, given as input, scalar.<br />
Viscosity: Problem data, given as input, scalar.<br />
Body force: Problem data (for example, acceleration of gravity), given as input, 3D vector.<br />
<br />
In Kratos, all variables are identified by a label, typically their name in uppercase (VELOCITY,PRESSURE). In the case of vectors, individual components can be also recovered explicitly so, for example, instead of asking for VELOCITY, we can inquire a node about VELOCITY_X, VELOCITY_Y or VELOCITY_Z. Variable names are hardcoded in Kratos, so adding new ones requires modifying the source. There is a main set of variables that is defined in the Kratos core files (see kratos/includes/variables.h and kratos/sources/variables.cpp) while each application can define its own set of variables. On a given Kratos model, all variables included in the Kratos Kernel and each of the individual applications imported will be available for use.<br />
<br />
== Types of Nodal Data ==<br />
<br />
There are two different containers for information that can be stored in nodes: the historical database and the non-historical database. Both can be used to store As the name suggests, the difference between the two is that the first one stores both the current value and the values that the variable held during the previous time steps, while the second stores only the current value.<br />
<br />
Note that there is no restriction to storing variables in either container, so both containers can store values for the same variable at the same time. While this can be useful in some cases, it should be noted that the values stored in each container are completely independent and no attempt will be made to synchronize them.<br />
<br />
=== Historical database: Solution step data ===<br />
<br />
The historical database is typically used to store values that we want to track as the simulation advances. A typical example of this is a dynamic problem, where we use a time scheme that approximates time derivatives using the values of our unknowns at previous time steps. To access the historical database of a node, we will use the C function<br />
<br />
Value& node.FastGetSolutionStepValue(VARIABLE,StepIndex = 0)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetSolutionStepValue(VARIABLE,StepIndex)<br />
node.SetSolutionStepValue(VARIABLE,StepIndex,Value)<br />
<br />
where VARIABLE is the Kratos Variable we want to access, Value is the value stored in the node for VARIABLE and StepIndex indicates the time step we are interested in, with 0 being the current time step, 1 the previous time step and so on. The maximum number of time steps stored at the same time for a given simulation is regulated by the ModelPart's buffer size parameter, that will be described in a later section.<br />
<br />
Note that all nodal variables read from the mdpa file are stored in the historical database.<br />
<br />
=== Non-historical database: Values ===<br />
<br />
The non-historical database stores values that won't be recorded as the simulation advances in time. Only a single value on each node is kept for a given variable at a given time. They can be accessed with the C++ function<br />
<br />
Value& node.GetValue(VARIABLE)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetValue(VARIABLE)<br />
node.SetValue(VARIABLE,Value)<br />
<br />
== Degrees of Freedom ==<br />
<br />
A last concept related to nodes and nodal data will be presented in this section: the Degree of freedom, or Dof for short. The Dof is one of the basic types in Kratos, and it is used to store information relative to the problem unknowns. A node will typically have one or more Dofs, depending on the problem being simulated. For the variables associated to a degree of freedom, in addition to their value, the status of the variable as a fixed (a boundary conditon) or free (an unknown) value is tracked, as well as its position in the system matrix, which is used to update it after a solution iteration.<br />
<br />
Next : [[Kratos Structure: Elements and Conditions]]<br />
<br />
Previous : [[Kratos Structure: Basic Components]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Elements_and_ConditionsKratos Structure: Elements and Conditions2012-05-05T17:32:37Z<p>Jcotela: </p>
<hr />
<div>Elements and conditions are the objects that contain most of the physics of the problem. An element contains all the information related to an individual finite element in the mesh, and its main functionality is to provide that element's local contributions to the system matrices and vectors. Each condition represents a face of a finite element that is contained in the boundary of the model, and is used to implement boundary conditions.<br />
<br />
While both elements and conditions have practically the same interface, they are implemented as separate objects to emphasize the conceptual difference between them. Like nodes, both elements and conditions have a unique id (an integer starting from 1) and can store variables but, unlike the nodes, they only have a non-historical database.<br />
<br />
To compute the local contributions to the system matrix, developers of elements and conditions can have the following tools at hand:<br />
<br />
* A '''Geometry''' instance.<br />
* A pointer to the elment's '''Properties'''.<br />
<br />
== The Geometry class ==<br />
<br />
The Geometry class manages all the geometrical information for a single element. There is a geometry type for each basic shape used in finite elements, such as lines, triangles, quadrilaterals, tetrahedra and hexahedra. The geometry of an element provides a way to access its nodes, as well as all information required to evaluate shape functions and integrate quantities of interest on the element using a quadrature.<br />
<br />
== Properties ==<br />
<br />
Elements and conditions can also store a pointer to a Properties instance. Properties are used to provide information that is common to a group of elements in the problem. For example, in solid mechanics problems, information about the material properties of the element is stored in a properties container. Just as it was the case with nodes and elements, all values stored in properties are associated to a Kratos variable.<br />
<br />
Next: [[Kratos Structure: Mesh and ModelPart]]<br />
<br />
Previous: [[Kratos Structure: Node and Nodal Data]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Elements_and_ConditionsKratos Structure: Elements and Conditions2012-05-05T17:01:43Z<p>Jcotela: Created page with "Elements and conditions are the objects that contain most of the physics of the problem. An element contains all the information related to an individual finite element in the me..."</p>
<hr />
<div>Elements and conditions are the objects that contain most of the physics of the problem. An element contains all the information related to an individual finite element in the mesh, and its main functionality is to provide that element's local contributions to the system matrices and vectors. Each condition represents a face of a finite element that is contained in the boundary of the model, and is used to implement boundary conditions.<br />
<br />
While both elements and conditions have practically the same interface, they are implemented as separate objects to emphasize the conceptual difference between them. Both elements and conditions can store variables but, unlike the nodes, they only have a non-historical database.</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Node_and_Nodal_DataKratos Structure: Node and Nodal Data2012-05-05T16:44:54Z<p>Jcotela: </p>
<hr />
<div>One of the most basic classes is the Node. In this section, we will briefly present its implementation, which will will allow us to present some basic concepts in Kratos.<br />
<br />
== The Node ==<br />
<br />
The Node class centralizes the information related to a single point in the finite element mesh. In its core, the node class contains an index (Id) that uniquely identifies the node in the finite element mesh, and the geometrical information about the position of the node, which is stored as a Point instance. This basic structure is common to all nodes used in Kartos, and can be accessed and modified from Python using the following interface<br />
<br />
node.Id # Unique identifier for the node. An unsigned integer value, starting from 1<br />
node.X # X coordinate of the current position of the node<br />
node.Y # Y coordinate<br />
node.Z # Z coordinate<br />
<br />
In addition, the original position of the node is also stored, which is useful in Lagrangian or ALE (Arbitrary Lagrangian-Eulerian) formulations:<br />
<br />
node.X0 # Original X coordinate<br />
node.Y0 # Original Y coordinate<br />
node.Z0 # Original Z coordinate<br />
<br />
== Kratos Variables ==<br />
<br />
The node class is also responsible for managing the information related to that point of the mesh and, in particular, of the values of the problem data and unknowns at that point of the mesh. In Kratos, all such data is associated to a Variable, which typically identifies a phyisical magnitude such as velocity or temperature. For example, a node in a fluid problem could be required to store the following data:<br />
<br />
Node 735<br />
Velocity: An unknown of the problem, 3D vector.<br />
Pressure: An unknown of the problem, scalar.<br />
Density: Problem data, given as input, scalar.<br />
Viscosity: Problem data, given as input, scalar.<br />
Body force: Problem data (for example, acceleration of gravity), given as input, 3D vector.<br />
<br />
In Kratos, all variables are identified by a label, typically their name in uppercase (VELOCITY,PRESSURE). In the case of vectors, individual components can be also recovered explicitly so, for example, instead of asking for VELOCITY, we can inquire a node about VELOCITY_X, VELOCITY_Y or VELOCITY_Z. Variable names are hardcoded in Kratos, so adding new ones requires modifying the source. There is a main set of variables that is defined in the Kratos core files (see kratos/includes/variables.h and kratos/sources/variables.cpp) while each application can define its own set of variables. On a given Kratos model, all variables included in the Kratos Kernel and each of the individual applications imported will be available for use.<br />
<br />
== Types of Nodal Data ==<br />
<br />
There are two different containers for information that can be stored in nodes: the historical database and the non-historical database. Both can be used to store As the name suggests, the difference between the two is that the first one stores both the current value and the values that the variable held during the previous time steps, while the second stores only the current value.<br />
<br />
Note that there is no restriction to storing variables in either container, so both containers can store values for the same variable at the same time. While this can be useful in some cases, it should be noted that the values stored in each container are completely independent and no attempt will be made to synchronize them.<br />
<br />
=== Historical database: Solution step data ===<br />
<br />
The historical database is typically used to store values that we want to track as the simulation advances. A typical example of this is a dynamic problem, where we use a time scheme that approximates time derivatives using the values of our unknowns at previous time steps. To access the historical database of a node, we will use the C function<br />
<br />
Value& node.FastGetSolutionStepValue(VARIABLE,StepIndex = 0)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetSolutionStepValue(VARIABLE,StepIndex)<br />
node.SetSolutionStepValue(VARIABLE,StepIndex,Value)<br />
<br />
where VARIABLE is the Kratos Variable we want to access, Value is the value stored in the node for VARIABLE and StepIndex indicates the time step we are interested in, with 0 being the current time step, 1 the previous time step and so on. The maximum number of time steps stored at the same time for a given simulation is regulated by the ModelPart's buffer size parameter, that will be described in a later section.<br />
<br />
Note that all nodal variables read from the mdpa file are stored in the historical database.<br />
<br />
=== Non-historical database: Values ===<br />
<br />
The non-historical database stores values that won't be recorded as the simulation advances in time. Only a single value on each node is kept for a given variable at a given time. They can be accessed with the C function<br />
<br />
Value& node.GetValue(VARIABLE)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetValue(VARIABLE)<br />
node.SetValue(VARIABLE,Value)<br />
<br />
== Degrees of Freedom ==<br />
<br />
A last concept related to nodes and nodal data will be presented in this section: the Degree of freedom, or Dof for short. The Dof is one of the basic types in Kratos, and it is used to store information relative to the problem unknowns. A node will typically have one or more Dofs, depending on the problem being simulated. For the variables associated to a degree of freedom, in addition to their value, the status of the variable as a fixed (a boundary conditon) or free (an unknown) value is tracked, as well as its position in the system matrix, which is used to update it after a solution iteration.<br />
<br />
Next : [[Kratos Structure: Elements and Conditions]]<br />
<br />
Previous : [[Kratos Structure: Basic Components]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Node_and_Nodal_DataKratos Structure: Node and Nodal Data2012-05-05T16:44:30Z<p>Jcotela: </p>
<hr />
<div>One of the most basic classes is the Node. In this section, we will briefly present its implementation, which will will allow us to present some basic concepts in Kratos.<br />
<br />
== The Node ==<br />
<br />
The Node class centralizes the information related to a single point in the finite element mesh. In its core, the node class contains an index (Id) that uniquely identifies the node in the finite element mesh, and the geometrical information about the position of the node, which is stored as a Point instance. This basic structure is common to all nodes used in Kartos, and can be accessed and modified from Python using the following interface<br />
<br />
node.Id # Unique identifier for the node. An unsigned integer value, starting from 1<br />
node.X # X coordinate of the current position of the node<br />
node.Y # Y coordinate<br />
node.Z # Z coordinate<br />
<br />
In addition, the original position of the node is also stored, which is useful in Lagrangian or ALE (Arbitrary Lagrangian-Eulerian) formulations:<br />
<br />
node.X0 # Original X coordinate<br />
node.Y0 # Original Y coordinate<br />
node.Z0 # Original Z coordinate<br />
<br />
== Kratos Variables ==<br />
<br />
The node class is also responsible for managing the information related to that point of the mesh and, in particular, of the values of the problem data and unknowns at that point of the mesh. In Kratos, all such data is associated to a Variable, which typically identifies a phyisical magnitude such as velocity or temperature. For example, a node in a fluid problem could be required to store the following data:<br />
<br />
Node 735<br />
Velocity: An unknown of the problem, 3D vector.<br />
Pressure: An unknown of the problem, scalar.<br />
Density: Problem data, given as input, scalar.<br />
Viscosity: Problem data, given as input, scalar.<br />
Body force: Problem data (for example, acceleration of gravity), given as input, 3D vector.<br />
<br />
In Kratos, all variables are identified by a label, typically their name in uppercase (VELOCITY,PRESSURE). In the case of vectors, individual components can be also recovered explicitly so, for example, instead of asking for VELOCITY, we can inquire a node about VELOCITY_X, VELOCITY_Y or VELOCITY_Z. Variable names are hardcoded in Kratos, so adding new ones requires modifying the source. There is a main set of variables that is defined in the Kratos core files (see kratos/includes/variables.h and kratos/sources/variables.cpp) while each application can define its own set of variables. On a given Kratos model, all variables included in the Kratos Kernel and each of the individual applications imported will be available for use.<br />
<br />
== Types of Nodal Data ==<br />
<br />
There are two different containers for information that can be stored in nodes: the historical database and the non-historical database. Both can be used to store As the name suggests, the difference between the two is that the first one stores both the current value and the values that the variable held during the previous time steps, while the second stores only the current value.<br />
<br />
Note that there is no restriction to storing variables in either container, so both containers can store values for the same variable at the same time. While this can be useful in some cases, it should be noted that the values stored in each container are completely independent and no attempt will be made to synchronize them.<br />
<br />
=== Historical database: Solution step data ===<br />
<br />
The historical database is typically used to store values that we want to track as the simulation advances. A typical example of this is a dynamic problem, where we use a time scheme that approximates time derivatives using the values of our unknowns at previous time steps. To access the historical database of a node, we will use the C function<br />
<br />
Value& node.FastGetSolutionStepValue(VARIABLE,StepIndex = 0)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetSolutionStepValue(VARIABLE,StepIndex)<br />
node.SetSolutionStepValue(VARIABLE,StepIndex,Value)<br />
<br />
where VARIABLE is the Kratos Variable we want to access, Value is the value stored in the node for VARIABLE and StepIndex indicates the time step we are interested in, with 0 being the current time step, 1 the previous time step and so on. The maximum number of time steps stored at the same time for a given simulation is regulated by the ModelPart's buffer size parameter, that will be described in a later section.<br />
<br />
Note that all nodal variables read from the mdpa file are stored in the historical database.<br />
<br />
=== Non-historical database: Values ===<br />
<br />
The non-historical database stores values that won't be recorded as the simulation advances in time. Only a single value on each node is kept for a given variable at a given time. They can be accessed with the C function<br />
<br />
Value& node.GetValue(VARIABLE)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetValue(VARIABLE)<br />
node.SetValue(VARIABLE,Value)<br />
<br />
== Degrees of Freedom ==<br />
<br />
A last concept related to nodes and nodal data will be presented in this section: the Degree of freedom, or Dof for short. The Dof is one of the basic types in Kratos, and it is used to store information relative to the problem unknowns. A node will typically have one or more Dofs, depending on the problem being simulated. For the variables associated to a degree of freedom, in addition to their value, the status of the variable as a fixed (a boundary conditon) or free (an unknown) value is tracked, as well as its position in the system matrix, which is used to update it after a solution iteration.<br />
<br />
Next : [[Kratos Structure: Elements and Conditions]]<br />
Previous : [[Kratos Structure: Node and Nodal Data]]</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Node_and_Nodal_DataKratos Structure: Node and Nodal Data2012-05-05T16:43:26Z<p>Jcotela: </p>
<hr />
<div>One of the most basic classes is the Node. In this section, we will briefly present its implementation, which will will allow us to present some basic concepts in Kratos.<br />
<br />
== The Node ==<br />
<br />
The Node class centralizes the information related to a single point in the finite element mesh. In its core, the node class contains an index (Id) that uniquely identifies the node in the finite element mesh, and the geometrical information about the position of the node, which is stored as a Point instance. This basic structure is common to all nodes used in Kartos, and can be accessed and modified from Python using the following interface<br />
<br />
node.Id # Unique identifier for the node. An unsigned integer value, starting from 1<br />
node.X # X coordinate of the current position of the node<br />
node.Y # Y coordinate<br />
node.Z # Z coordinate<br />
<br />
In addition, the original position of the node is also stored, which is useful in Lagrangian or ALE (Arbitrary Lagrangian-Eulerian) formulations:<br />
<br />
node.X0 # Original X coordinate<br />
node.Y0 # Original Y coordinate<br />
node.Z0 # Original Z coordinate<br />
<br />
== Kratos Variables ==<br />
<br />
The node class is also responsible for managing the information related to that point of the mesh and, in particular, of the values of the problem data and unknowns at that point of the mesh. In Kratos, all such data is associated to a Variable, which typically identifies a phyisical magnitude such as velocity or temperature. For example, a node in a fluid problem could be required to store the following data:<br />
<br />
Node 735<br />
Velocity: An unknown of the problem, 3D vector.<br />
Pressure: An unknown of the problem, scalar.<br />
Density: Problem data, given as input, scalar.<br />
Viscosity: Problem data, given as input, scalar.<br />
Body force: Problem data (for example, acceleration of gravity), given as input, 3D vector.<br />
<br />
In Kratos, all variables are identified by a label, typically their name in uppercase (VELOCITY,PRESSURE). In the case of vectors, individual components can be also recovered explicitly so, for example, instead of asking for VELOCITY, we can inquire a node about VELOCITY_X, VELOCITY_Y or VELOCITY_Z. Variable names are hardcoded in Kratos, so adding new ones requires modifying the source. There is a main set of variables that is defined in the Kratos core files (see kratos/includes/variables.h and kratos/sources/variables.cpp) while each application can define its own set of variables. On a given Kratos model, all variables included in the Kratos Kernel and each of the individual applications imported will be available for use.<br />
<br />
== Types of Nodal Data ==<br />
<br />
There are two different containers for information that can be stored in nodes: the historical database and the non-historical database. Both can be used to store As the name suggests, the difference between the two is that the first one stores both the current value and the values that the variable held during the previous time steps, while the second stores only the current value.<br />
<br />
Note that there is no restriction to storing variables in either container, so both containers can store values for the same variable at the same time. While this can be useful in some cases, it should be noted that the values stored in each container are completely independent and no attempt will be made to synchronize them.<br />
<br />
=== Historical database: Solution step data ===<br />
<br />
The historical database is typically used to store values that we want to track as the simulation advances. A typical example of this is a dynamic problem, where we use a time scheme that approximates time derivatives using the values of our unknowns at previous time steps. To access the historical database of a node, we will use the C function<br />
<br />
Value& node.FastGetSolutionStepValue(VARIABLE,StepIndex = 0)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetSolutionStepValue(VARIABLE,StepIndex)<br />
node.SetSolutionStepValue(VARIABLE,StepIndex,Value)<br />
<br />
where VARIABLE is the Kratos Variable we want to access, Value is the value stored in the node for VARIABLE and StepIndex indicates the time step we are interested in, with 0 being the current time step, 1 the previous time step and so on. The maximum number of time steps stored at the same time for a given simulation is regulated by the ModelPart's buffer size parameter, that will be described in a later section.<br />
<br />
Note that all nodal variables read from the mdpa file are stored in the historical database.<br />
<br />
=== Non-historical database: Values ===<br />
<br />
The non-historical database stores values that won't be recorded as the simulation advances in time. Only a single value on each node is kept for a given variable at a given time. They can be accessed with the C function<br />
<br />
Value& node.GetValue(VARIABLE)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetValue(VARIABLE)<br />
node.SetValue(VARIABLE,Value)<br />
<br />
== Degrees of Freedom ==<br />
<br />
A last concept related to nodes and nodal data will be presented in this section: the Degree of freedom, or Dof for short. The Dof is one of the basic types in Kratos, and it is used to store information relative to the problem unknowns. A node will typically have one or more Dofs, depending on the problem being simulated. For the variables associated to a degree of freedom, in addition to their value, the status of the variable as a fixed (a boundary conditon) or free (an unknown) value is tracked, as well as its position in the system matrix, which is used to update it after a solution iteration.</div>Jcotelahttps://kratos-wiki.cimne.upc.edu/index.php/Kratos_Structure:_Node_and_Nodal_DataKratos Structure: Node and Nodal Data2012-05-05T16:23:30Z<p>Jcotela: </p>
<hr />
<div>One of the most basic classes is the Node. In this section, we will briefly present its implementation, which will will allow us to present some basic concepts in Kratos.<br />
<br />
== The Node ==<br />
<br />
The Node class centralizes the information related to a single point in the finite element mesh. In its core, the node class contains an index (Id) that uniquely identifies the node in the finite element mesh, and the geometrical information about the position of the node, which is stored as a Point instance. This basic structure is common to all nodes used in Kartos, and can be accessed and modified from Python using the following interface<br />
<br />
node.Id # Unique identifier for the node. An unsigned integer value, starting from 1<br />
node.X # X coordinate of the current position of the node<br />
node.Y # Y coordinate<br />
node.Z # Z coordinate<br />
<br />
In addition, the original position of the node is also stored, which is useful in Lagrangian or ALE (Arbitrary Lagrangian-Eulerian) formulations:<br />
<br />
node.X0 # Original X coordinate<br />
node.Y0 # Original Y coordinate<br />
node.Z0 # Original Z coordinate<br />
<br />
== Kratos Variables ==<br />
<br />
The node class is also responsible for managing the information related to that point of the mesh and, in particular, of the values of the problem data and unknowns at that point of the mesh. In Kratos, all such data is associated to a Variable, which typically identifies a phyisical magnitude such as velocity or temperature. For example, a node in a fluid problem could be required to store the following data:<br />
<br />
Node 735<br />
Velocity: An unknown of the problem, 3D vector.<br />
Pressure: An unknown of the problem, scalar.<br />
Density: Problem data, given as input, scalar.<br />
Viscosity: Problem data, given as input, scalar.<br />
Body force: Problem data (for example, acceleration of gravity), given as input, 3D vector.<br />
<br />
In Kratos, all variables are identified by a label, typically their name in uppercase (VELOCITY,PRESSURE). In the case of vectors, individual components can be also recovered explicitly so, for example, instead of asking for VELOCITY, we can inquire a node about VELOCITY_X, VELOCITY_Y or VELOCITY_Z. Variable names are hardcoded in Kratos, so adding new ones requires modifying the source. There is a main set of variables that is defined in the Kratos core files (see kratos/includes/variables.h and kratos/sources/variables.cpp) while each application can define its own set of variables. On a given Kratos model, all variables included in the Kratos Kernel and each of the individual applications imported will be available for use.<br />
<br />
== Types of Nodal Data ==<br />
<br />
There are two different containers for information that can be stored in nodes: the historical database and the non-historical database. Both can be used to store As the name suggests, the difference between the two is that the first one stores both the current value and the values that the variable held during the previous time steps, while the second stores only the current value.<br />
<br />
Note that there is no restriction to storing variables in either container, so both containers can store values for the same variable at the same time. While this can be useful in some cases, it should be noted that the values stored in each container are completely independent and no attempt will be made to synchronize them.<br />
<br />
=== Historical database: Solution step data ===<br />
<br />
The historical database is typically used to store values that we want to track as the simulation advances. A typical example of this is a dynamic problem where, to advance in time, we use a time scheme that approximates time derivatives using the values of our unknowns at previous time steps. To access the historical database of a node, we will use the C function<br />
<br />
Value& node.FastGetSolutionStepValue(VARIABLE,StepIndex = 0)<br />
<br />
or its Python interface<br />
<br />
Value = node.GetSolutionStepValue(VARIABLE,StepIndex)<br />
node.SetSolutionStepValue(VARIABLE,StepIndex,Value)<br />
<br />
where VARIABLE is the Kratos Variable we want to access, Value is the value stored in the node for VARIABLE and StepIndex indicates the time step we are interested in, with 0 being the current time step, 1 the previous time step and so on. The maximum number of time steps stored at the same time for a given simulation is regulated by the ModelPart's buffer size parameter, that will be described in a later section.<br />
<br />
=== Non-historical database: Values ===<br />
<br />
<br />
<br />
== Degrees of Freedom ==</div>Jcotela