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.
Public Member Functions | List of all members
response_function.ResponseFunction Class Reference

Base response function. More...

Inheritance diagram for response_function.ResponseFunction:
Collaboration diagram for response_function.ResponseFunction:

Public Member Functions

None __init__ (self, str response_name)
 
str GetName (self)
 
None Initialize (self)
 Initializes the response. More...
 
None Check (self)
 Checks the response. More...
 
None Finalize (self)
 Finalizes the response. More...
 
'list[SupportedSensitivityFieldVariableTypes]' GetImplementedPhysicalKratosVariables (self)
 Returns all the dependent physical kratos variables of the response. More...
 
float CalculateValue (self)
 Calculates the response value. More...
 
None CalculateGradient (self, 'dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]' physical_variable_collective_expressions)
 Calculate gradient w.r.t. More...
 
Kratos.ModelPart GetEvaluatedModelPart (self)
 Returns the model part for which this response is computed on. More...
 
'Union[Kratos.ModelPart, None]' GetAnalysisModelPart (self)
 Returns the analysis model part if exists. More...
 

Detailed Description

Base response function.

This reponse function is the base response function. This is assumed to have following responsibilities.
    1. CalculateValue for a new design. (@see CalculateValue)
    2. CalculateSensitivity for a new design (@see CalculateSensitivity)

This response should only work on one model part. Hence, if multiple model parts required then,
a single model part should be created using Kratos.ModelPartOperationUtilities.

Constructor & Destructor Documentation

◆ __init__()

None response_function.ResponseFunction.__init__ (   self,
str  response_name 
)

Member Function Documentation

◆ CalculateGradient()

None response_function.ResponseFunction.CalculateGradient (   self,
'dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]'  physical_variable_collective_expressions 
)

Calculate gradient w.r.t.

given physical variables.

    This method should always calculate the sensitivities w.r.t. requested physical variables on the given container expressions
    in the collective expression. An error should be thrown if sensitivitiy computation w.r.t. one or more given physical variables
    are not implemented.

    This method should always calculate the sensitivities assuming the domain has changed.

    physical_variable_collective_expressions is a map of physical variables, and their domains. The domains are represented by a CollectiveExpression
    which contains list of empty ContainerExpression. Each empty ContainerExpression contains details of the model part's nodes/conditions/element/properties
    container for which the sensitivities w.r.t. physical variable requested.

    Args:
        physical_variable_collective_expressions (dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]): Output containing calculated sensitivities w.r.t. requested physical variables.

◆ CalculateValue()

float response_function.ResponseFunction.CalculateValue (   self)

Calculates the response value.

    This method should always calculate the response value assuming the domain has changed.

    Returns:
        float: Calculated response value.

◆ Check()

None response_function.ResponseFunction.Check (   self)

Checks the response.

    This method checks the response. This is only called once in the whole optimization process.

◆ Finalize()

None response_function.ResponseFunction.Finalize (   self)

Finalizes the response.

    This method finalizes the response. This is only called once in the whole optimization process.

◆ GetAnalysisModelPart()

'Union[Kratos.ModelPart, None]' response_function.ResponseFunction.GetAnalysisModelPart (   self)

Returns the analysis model part if exists.

Otherwise returns None.

    This method returns the analysis model part if an analysis is used (as in Adjoint case)
    to compute the gradients. If it is not the case, then None should be returned.

    Returns:
        Union[Kratos.ModelPart, None]: Analysis model part if used, otherwise None

◆ GetEvaluatedModelPart()

Kratos.ModelPart response_function.ResponseFunction.GetEvaluatedModelPart (   self)

Returns the model part for which this response is computed on.

    Returns:
        Kratos.ModelPart: Response function model part.

◆ GetImplementedPhysicalKratosVariables()

'list[SupportedSensitivityFieldVariableTypes]' response_function.ResponseFunction.GetImplementedPhysicalKratosVariables (   self)

Returns all the dependent physical kratos variables of the response.

    This method should return all the dependent physical variables of the response to make sure
    that sensitivities w.r.t. those variables are requested from the response. If sensitivities
    w.r.t. other variables are required from this response, they are ASSUMED TO BE ZERO.

    Please return all the dependent physical variables, eventhough the gradient computation is not yet implemented
    for some to avoid future bugs.

    Returns:
        list[SupportedSensitivityFieldVariableTypes]: All dependent physical variables of the response.

◆ GetName()

str response_function.ResponseFunction.GetName (   self)

◆ Initialize()

None response_function.ResponseFunction.Initialize (   self)

Initializes the response.

    This method initializes the response. This is only called once in the whole optimization process.

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