KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Functions
custom_sympy_fe_utilities Namespace Reference

Functions

def GetSympyVersion ()
 This method returns the current Sympy version. More...
 
def DefineMatrix (name, m, n, mode="Function")
 This method defines a symbolic matrix. More...
 
def DefineSymmetricMatrix (name, m, n=-1, mode="Symbol")
 This method defines a symbolic symmetric matrix. More...
 
def DefineVector (name, m, mode="Symbol")
 This method defines a symbolic vector. More...
 
def DefineShapeFunctions (nnodes, dim, impose_partion_of_unity=False)
 This method defines shape functions and derivatives Note that partition of unity is imposed the name HAS TO BE --> N and DN. More...
 
def DefineCustomShapeFunctions (nnodes, dim, name)
 This method defines shape functions and derivatives (custom version) More...
 
def StrainToVoigt (M)
 This method transform the strains matrix to Voigt notation. More...
 
def MatrixB (DN)
 This method defines the deformation matrix B. More...
 
def grad_sym_voigtform (DN, x)
 This method defines a symmetric gradient. More...
 
def grad (DN, x)
 This method defines a gradient. More...
 
def DfjDxi (DN, f)
 This method defines a gradient. More...
 
def DfiDxj (DN, f)
 This method defines a gradient This returns a matrix D such that D(i,j) = D(fi)/D(xj) More...
 
def div (DN, x)
 This method defines the divergence. More...
 
def DefineJacobian (J, DN, x)
 This method defines a Jacobian. More...
 
def DefineCalculateNormals (normal, tangent1, tangent2, J)
 This method calculates the normals and tangents. More...
 
def CreateVariableMatrixList (variable_list, variable_matrix)
 This method creates a variable list from variable matrix. More...
 
def CreateVariableVectorList (variable_list, variable_vector)
 This method creates a variable list from variable vector. More...
 
def DefineDofDependencyScalar (scalar, variable_list)
 This method injects a dependency into a scalar from a variable list. More...
 
def DefineDofDependencyVector (vector, variable_list)
 This method injects a dependency into a vector from a variable list. More...
 
def DefineDofDependencyMatrix (matrix, variable_list)
 This method injects a dependency into a matrix from a variable list. More...
 
def SubstituteMatrixValue (where_to_substitute, what_to_substitute, substituted_value)
 This method substitutes values into a matrix. More...
 
def SubstituteScalarValue (where_to_substitute, what_to_substitute, substituted_value)
 This method substitutes values into a scalar. More...
 
def GetShapeFunctionDefinitionLine2D2N (x, xg)
 This computes the shape functions on 2D line. More...
 
def GetShapeFunctionDefinitionLine3D3N (x, xg)
 This computes the shape functions on 3D line. More...
 
def Compute_RHS (functional, testfunc, do_simplifications=False)
 This computes the RHS vector. More...
 
def Compute_LHS (rhs, testfunc, dofs, do_simplifications=False)
 This computes the LHS matrix. More...
 
def Compute_RHS_and_LHS (functional, testfunc, dofs, do_simplifications=False)
 This computes the LHS matrix and the RHS vector. More...
 
def OutputVector (rhs, name, mode="python", initial_tabs=1, max_index=30, aux_dict={})
 This method converts into text the RHS vector. More...
 
def OutputMatrix (lhs, name, mode, initial_tabs=1, max_index=30, aux_dict={})
 This method converts into text the LHS matrix. More...
 
def OutputVectorNonZero (rhs, name, mode="python", initial_tabs=1, max_index=30, aux_dict={})
 This method converts into text the RHS vector (only non-zero terms) More...
 
def OutputMatrixNonZero (lhs, name, mode, initial_tabs=1, max_index=30, aux_dict={})
 This method converts into text the LHS matrix (only non-zero terms) More...
 
def OutputSymbolicVariable (var, mode="python", varname="", aux_dict={}, initial_tabs=1, max_index=30)
 This method converts into text the LHS matrix (only non-zero terms) More...
 
def SubstituteIndex (outstring, mode="python", max_index=30)
 This method substitutes certain indexes. More...
 
def DefineVariableLists (variable, name, replacement, dependency, var_strings, var_strings_subs, var_strings_aux_subs, der_var_strings, der_var_list, typology)
 This method define the variables lists. More...
 
def Derivatives_CollectingFactors (A, name, mode, initial_tabs=1, max_index=30, optimizations='basic', postprocess=None, order='canonical')
 This method collects the constants of the replacement for derivatives TODO Think about collecting factors also in the derivatives. More...
 
def OutputMatrix_CollectingFactors (A, name, mode, initial_tabs=1, max_index=30, optimizations='basic')
 This method collects the constants of the replacement for matrices. More...
 
def OutputVector_CollectingFactors (A, name, mode, initial_tabs=1, max_index=30, optimizations='basic')
 This method collects the constants of the replacement for vectors. More...
 
def OutputMatrix_CollectingFactorsNonZero (A, name, mode, initial_tabs=1, max_index=30, optimizations='basic')
 This method collects the constants of the replacement for matrices (only non-zero terms) More...
 
def OutputVector_CollectingFactorsNonZero (A, name, mode, initial_tabs=1, max_index=30, optimizations='basic')
 This method collects the constants of the replacement for vectors (only non-zero terms) More...
 

Function Documentation

◆ Compute_LHS()

def custom_sympy_fe_utilities.Compute_LHS (   rhs,
  testfunc,
  dofs,
  do_simplifications = False 
)

This computes the LHS matrix.

Keyword arguments: rhs – The RHS vector testfunc – The test functions dofs – The dofs vectors do_simplifications – If apply simplifications

◆ Compute_RHS()

def custom_sympy_fe_utilities.Compute_RHS (   functional,
  testfunc,
  do_simplifications = False 
)

This computes the RHS vector.

Keyword arguments: functional – The functional to derivate testfunc – The test functions do_simplifications – If apply simplifications

◆ Compute_RHS_and_LHS()

def custom_sympy_fe_utilities.Compute_RHS_and_LHS (   functional,
  testfunc,
  dofs,
  do_simplifications = False 
)

This computes the LHS matrix and the RHS vector.

Keyword arguments: functional – The functional to derivate testfunc – The test functions dofs – The dofs vectors do_simplifications – If apply simplifications

◆ CreateVariableMatrixList()

def custom_sympy_fe_utilities.CreateVariableMatrixList (   variable_list,
  variable_matrix 
)

This method creates a variable list from variable matrix.

Keyword arguments: variable_list – The variable list to be created variable_matrix – The variable matrix

◆ CreateVariableVectorList()

def custom_sympy_fe_utilities.CreateVariableVectorList (   variable_list,
  variable_vector 
)

This method creates a variable list from variable vector.

Keyword arguments: variable_list – The variable list to be created variable_vector – The variable vector

◆ DefineCalculateNormals()

def custom_sympy_fe_utilities.DefineCalculateNormals (   normal,
  tangent1,
  tangent2,
  J 
)

This method calculates the normals and tangents.

Keyword arguments: normal – The normal vector tangent1 – The first tangent vector tangent2 – The second tangent vector J – The Jacobian matrix

◆ DefineCustomShapeFunctions()

def custom_sympy_fe_utilities.DefineCustomShapeFunctions (   nnodes,
  dim,
  name 
)

This method defines shape functions and derivatives (custom version)

Keyword arguments: nnodes – Number of nodes dim – Dimension of the space name – Name of the variable for the shape functions

◆ DefineDofDependencyMatrix()

def custom_sympy_fe_utilities.DefineDofDependencyMatrix (   matrix,
  variable_list 
)

This method injects a dependency into a matrix from a variable list.

Keyword arguments: matrix – The matrix to be injected variable_list – The variable list injected

◆ DefineDofDependencyScalar()

def custom_sympy_fe_utilities.DefineDofDependencyScalar (   scalar,
  variable_list 
)

This method injects a dependency into a scalar from a variable list.

Keyword arguments: scalar – The scalar to be injected variable_list – The variable list injected

◆ DefineDofDependencyVector()

def custom_sympy_fe_utilities.DefineDofDependencyVector (   vector,
  variable_list 
)

This method injects a dependency into a vector from a variable list.

Keyword arguments: vector – The vector to be injected variable_list – The variable list injected

◆ DefineJacobian()

def custom_sympy_fe_utilities.DefineJacobian (   J,
  DN,
  x 
)

This method defines a Jacobian.

Keyword arguments: J – The Jacobian matrix DN – The shape function derivatives x – The variable to compute the gradient

◆ DefineMatrix()

def custom_sympy_fe_utilities.DefineMatrix (   name,
  m,
  n,
  mode = "Function" 
)

This method defines a symbolic matrix.

Keyword arguments: name – Name of variables. m – Number of rows. n – Number of columns. mode – The type of variable is defined (function or symbol)

◆ DefineShapeFunctions()

def custom_sympy_fe_utilities.DefineShapeFunctions (   nnodes,
  dim,
  impose_partion_of_unity = False 
)

This method defines shape functions and derivatives Note that partition of unity is imposed the name HAS TO BE --> N and DN.

Keyword arguments: nnodes – Number of nodes dim – Dimension of the space impose_partion_of_unity – Impose the partition of unity

◆ DefineSymmetricMatrix()

def custom_sympy_fe_utilities.DefineSymmetricMatrix (   name,
  m,
  n = -1,
  mode = "Symbol" 
)

This method defines a symbolic symmetric matrix.

Keyword arguments: name – Name of variables. m – Number of rows. n – Number of columns.

◆ DefineVariableLists()

def custom_sympy_fe_utilities.DefineVariableLists (   variable,
  name,
  replacement,
  dependency,
  var_strings,
  var_strings_subs,
  var_strings_aux_subs,
  der_var_strings,
  der_var_list,
  typology 
)

This method define the variables lists.

Keyword arguments: variable – The variable to define name – The name to consider replacement – The replacement dependency – The dependency var_strings – The strings that define the variables var_strings – The strings that substitute the variables var_strings_aux_subs – The strings that auxiliarly substitute the variables der_var_strings – The strings that define the derivatives of the strings der_var_list – The list of derivatives variables typology – The typology considered

◆ DefineVector()

def custom_sympy_fe_utilities.DefineVector (   name,
  m,
  mode = "Symbol" 
)

This method defines a symbolic vector.

Keyword arguments: name – Name of variables. m – Number of components. mode – The type of variable is defined (function or symbol)

◆ Derivatives_CollectingFactors()

def custom_sympy_fe_utilities.Derivatives_CollectingFactors (   A,
  name,
  mode,
  initial_tabs = 1,
  max_index = 30,
  optimizations = 'basic',
  postprocess = None,
  order = 'canonical' 
)

This method collects the constants of the replacement for derivatives TODO Think about collecting factors also in the derivatives.

Keyword arguments: A – The factors name – The name of the constant mode – The mode of replacement initial_tabs – The number of initial tabulations max_index – The max number of indexes optimizations – The level of optimizations postprocess – The type of postprocess order – The type of order

◆ DfiDxj()

def custom_sympy_fe_utilities.DfiDxj (   DN,
  f 
)

This method defines a gradient This returns a matrix D such that D(i,j) = D(fi)/D(xj)

Keyword arguments: DN – The shape function derivatives f – The variable to compute the gradient

◆ DfjDxi()

def custom_sympy_fe_utilities.DfjDxi (   DN,
  f 
)

This method defines a gradient.

This returns a matrix D such that D(i,j) = D(fj)/D(xi)

Keyword arguments: DN – The shape function derivatives f– The variable to compute the gradient

◆ div()

def custom_sympy_fe_utilities.div (   DN,
  x 
)

This method defines the divergence.

Keyword arguments: DN – The shape function derivatives x – The variable to compute the gradient

◆ GetShapeFunctionDefinitionLine2D2N()

def custom_sympy_fe_utilities.GetShapeFunctionDefinitionLine2D2N (   x,
  xg 
)

This computes the shape functions on 2D line.

Keyword arguments: x – Definition of line xg – Gauss point

◆ GetShapeFunctionDefinitionLine3D3N()

def custom_sympy_fe_utilities.GetShapeFunctionDefinitionLine3D3N (   x,
  xg 
)

This computes the shape functions on 3D line.

Keyword arguments: x – Definition of line xg – Gauss point

◆ GetSympyVersion()

def custom_sympy_fe_utilities.GetSympyVersion ( )

This method returns the current Sympy version.

◆ grad()

def custom_sympy_fe_utilities.grad (   DN,
  x 
)

This method defines a gradient.

Keyword arguments: DN – The shape function derivatives x – The variable to compute the gradient

◆ grad_sym_voigtform()

def custom_sympy_fe_utilities.grad_sym_voigtform (   DN,
  x 
)

This method defines a symmetric gradient.

Keyword arguments: DN – The shape function derivatives x – The variable to compute the gradient

◆ MatrixB()

def custom_sympy_fe_utilities.MatrixB (   DN)

This method defines the deformation matrix B.

Keyword arguments: DN – The shape function derivatives

◆ OutputMatrix()

def custom_sympy_fe_utilities.OutputMatrix (   lhs,
  name,
  mode,
  initial_tabs = 1,
  max_index = 30,
  aux_dict = {} 
)

This method converts into text the LHS matrix.

Keyword arguments: lhs – The LHS matrix name – The name of the variables mode – The mode of output initial_tabs – The number of tabulations considered max_index – The maximum index aux_dict – Auxiliary dictionary

◆ OutputMatrix_CollectingFactors()

def custom_sympy_fe_utilities.OutputMatrix_CollectingFactors (   A,
  name,
  mode,
  initial_tabs = 1,
  max_index = 30,
  optimizations = 'basic' 
)

This method collects the constants of the replacement for matrices.

Keyword arguments: A – The factors name – The name of the constant mode – The mode of replacement initial_tabs – The number of initial tabulations max_index – The max number of indexes optimizations – The level of optimizations

◆ OutputMatrix_CollectingFactorsNonZero()

def custom_sympy_fe_utilities.OutputMatrix_CollectingFactorsNonZero (   A,
  name,
  mode,
  initial_tabs = 1,
  max_index = 30,
  optimizations = 'basic' 
)

This method collects the constants of the replacement for matrices (only non-zero terms)

Keyword arguments: A – The factors name – The name of the constant mode – The mode of replacement initial_tabs – The number of initial tabulations max_index – The max number of indexes optimizations – The level of optimizations

◆ OutputMatrixNonZero()

def custom_sympy_fe_utilities.OutputMatrixNonZero (   lhs,
  name,
  mode,
  initial_tabs = 1,
  max_index = 30,
  aux_dict = {} 
)

This method converts into text the LHS matrix (only non-zero terms)

Keyword arguments: lhs – The LHS matrix name – The name of the variables mode – The mode of output initial_tabs – The number of tabulations considered max_index – The maximum index aux_dict – Auxiliary dictionary

◆ OutputSymbolicVariable()

def custom_sympy_fe_utilities.OutputSymbolicVariable (   var,
  mode = "python",
  varname = "",
  aux_dict = {},
  initial_tabs = 1,
  max_index = 30 
)

This method converts into text the LHS matrix (only non-zero terms)

Keyword arguments: var – The variable to define symbolic mode – The mode of output varname – The name of the variables aux_dict – Auxiliary dictionary initial_tabs – The number of tabulations considered max_index – The maximum index

◆ OutputVector()

def custom_sympy_fe_utilities.OutputVector (   rhs,
  name,
  mode = "python",
  initial_tabs = 1,
  max_index = 30,
  aux_dict = {} 
)

This method converts into text the RHS vector.

Keyword arguments: rhs – The RHS vector name – The name of the variables mode – The mode of output initial_tabs – The number of tabulations considered max_index – The maximum index aux_dict – Auxiliary dictionary

◆ OutputVector_CollectingFactors()

def custom_sympy_fe_utilities.OutputVector_CollectingFactors (   A,
  name,
  mode,
  initial_tabs = 1,
  max_index = 30,
  optimizations = 'basic' 
)

This method collects the constants of the replacement for vectors.

Keyword arguments: A – The factors name – The name of the constant mode – The mode of replacement initial_tabs – The number of initial tabulations max_index – The max number of indexes optimizations – The level of optimizations

◆ OutputVector_CollectingFactorsNonZero()

def custom_sympy_fe_utilities.OutputVector_CollectingFactorsNonZero (   A,
  name,
  mode,
  initial_tabs = 1,
  max_index = 30,
  optimizations = 'basic' 
)

This method collects the constants of the replacement for vectors (only non-zero terms)

Keyword arguments: A – The factors name – The name of the constant mode – The mode of replacement initial_tabs – The number of initial tabulations max_index – The max number of indexes optimizations – The level of optimizations

◆ OutputVectorNonZero()

def custom_sympy_fe_utilities.OutputVectorNonZero (   rhs,
  name,
  mode = "python",
  initial_tabs = 1,
  max_index = 30,
  aux_dict = {} 
)

This method converts into text the RHS vector (only non-zero terms)

Keyword arguments: rhs – The RHS vector name – The name of the variables mode – The mode of output initial_tabs – The number of tabulations considered max_index – The maximum index aux_dict – Auxiliary dictionary

◆ StrainToVoigt()

def custom_sympy_fe_utilities.StrainToVoigt (   M)

This method transform the strains matrix to Voigt notation.

Keyword arguments: M – The strain matrix

◆ SubstituteIndex()

def custom_sympy_fe_utilities.SubstituteIndex (   outstring,
  mode = "python",
  max_index = 30 
)

This method substitutes certain indexes.

Keyword arguments: outstring – The resulting string mode – The mode of output max_index – The maximum index

◆ SubstituteMatrixValue()

def custom_sympy_fe_utilities.SubstituteMatrixValue (   where_to_substitute,
  what_to_substitute,
  substituted_value 
)

This method substitutes values into a matrix.

Keyword arguments: where_to_substitute – Coordinates where to substitute what_to_substitute – Components to substitute substituted_value – Variable to substitute

◆ SubstituteScalarValue()

def custom_sympy_fe_utilities.SubstituteScalarValue (   where_to_substitute,
  what_to_substitute,
  substituted_value 
)

This method substitutes values into a scalar.

Keyword arguments: where_to_substitute – Coordinates where to substitute what_to_substitute – Components to substitute substituted_value – Variable to substitute