FEDEM Solver  R8.0
Source code of the dynamics solver
Functions/Subroutines | Variables
engineroutinesmodule Module Reference

Module with subroutines/functions for evaluation of general functions. More...

Functions/Subroutines

subroutine setpointersforsensors (eArr, tArr, sArr, dArr)
 Initialization of private pointers. More...
 
subroutine preevaluate (engines, ierr)
 Pre-evaluation of general functions. More...
 
real(dp) function evaluate (engine, E1, E0, ierr, xArg)
 Evaluates a general function with optional scaling and offset. More...
 
recursive real(dp) function enginevalue (engine, ierr, xArg)
 Evaluates a general function. More...
 
recursive real(dp) function enginerate (engine, ierr, tArg)
 Evaluates the time-derivative of a general function. More...
 
recursive real(dp) function, private sensorrate (sensor, ierr)
 Evaluates the time-derivative of a sensor value. More...
 
recursive subroutine, private evalargs (args, nArg, iDer, xArg, x, rVal, ierr)
 Evaluates the argument(s) of a general function. More...
 
recursive subroutine updatesensor (sensor, ierr)
 Updates a sensor value depending on the sensor type. More...
 
recursive subroutine updatespringbase (spr, ierr)
 Updates the spring variables. More...
 
recursive subroutine updatedamperbase (dmp, ierr)
 Updates the damper variables. More...
 
subroutine updateenginesforsave (engines, eFlag, ierr)
 Update all engines and store the values for saving. More...
 
subroutine printfuncvalues (istep, time, engines, lpu)
 Updates and prints out the current value of all general functions. More...
 

Variables

type(environmenttype), pointer, save, public ourenvir => null()
 Public pointer to the environmental data member in the mechanismtypemodule::mechanismtype object. More...
 
type(enginetype), dimension(:), pointer, save, private engines => null()
 Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object. More...
 
type(triadtype), dimension(:), pointer, save, private triads => null()
 Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object. More...
 
type(springbasetype), dimension(:), pointer, save, private springs => null()
 Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object. More...
 
type(damperbasetype), dimension(:), pointer, save, private dampers => null()
 Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object. More...
 
logical, save ispredictorstep = .false.
 Flag used for consistent right-hand-side calculation in the predictor step. More...
 

Detailed Description

Module with subroutines/functions for evaluation of general functions.

This module contains functions and subroutines for evaluating general functions, which are represented by functiontypemodule::enginetype objects in the model.

Note
The enginevalue() function may be implicitly recursive if a sensortypemodule::sensortype object defining an argument of the general function is defined on a quantity which again may be controlled by (another) general function. Currently, this applies to sensors on spring- and damper quantities. Due to this, the update subroutines for springs and dampers as well as sensors have all to be within this module, in order to avoid circular use inclusions. No other (non-recursive) subroutines that work on functiontypemodule::enginetype objects should be placed in this module.

Function/Subroutine Documentation

◆ enginerate()

recursive real(dp) function engineroutinesmodule::enginerate ( type(enginetype), intent(inout)  engine,
integer, intent(inout)  ierr,
real(dp), intent(in), optional  tArg 
)

Evaluates the time-derivative of a general function.

Parameters
engineThe general function to evaluate
ierrError flag
[in]tArgOptional function argument value
Author
Trond Arne Svidal
Date
13 May 2002
Author
Knut Morten Okstad
Date
17 Nov 2014
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enginevalue()

recursive real(dp) function engineroutinesmodule::enginevalue ( type(enginetype), intent(inout)  engine,
integer, intent(inout)  ierr,
real(dp), intent(in), optional  xArg 
)

Evaluates a general function.

Parameters
engineThe general function to evaluate
ierrError flag
[in]xArgOptional function argument value
  • EngineValue = func(x), if func is defined for engine
  • EngineValue = x, if func is not defined for engine

x may either be the input xArg or sensor-defined.

Note
This may be an implicit recursive function through the call sequence:
-> evalargs -> updatesensor -> updatespringbase -> enginevalue
updatedamperbase
Author
Karl Erik Thoresen / Bjorn Haugen / Knut Morten Okstad
Date
6 Jun 2002
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evalargs()

recursive subroutine, private engineroutinesmodule::evalargs ( type(sensorptrtype), dimension(:), intent(inout)  args,
integer, intent(in)  nArg,
integer, intent(in)  iDer,
real(dp), intent(in), optional  xArg,
real(dp), dimension(:), intent(out)  x,
real(dp), intent(out)  rVal,
integer, intent(inout)  ierr 
)
private

Evaluates the argument(s) of a general function.

Parameters
argsThe function arguments to evaluate
[in]nArgLength of array args
[in]iDerDerivative order of ramp function (0, 1, or -1 for no ramp)
[in]xArgOptional value of (first) function argument
[out]xThe evaluated argument value(s)
[out]rValRamp function value or derivative (equals 1.0 if no ramp)
ierrError flag

The output value x may either be the input argument xArg or a sensor-defined value. If a ramp function is defined and the argument type is TIME, the argument value x is instead set to the end time of the ramp function, and the ramp function value is returned through rVal.

Note
This may be an implicit recursive subroutine through the call sequence:
-> updatesensor -> updatespringbase -> enginevalue -> evalargs
-> updatedamperbase enginerate /
Author
Knut Morten Okstad
Date
22 Aug 2022
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate()

real(dp) function engineroutinesmodule::evaluate ( type(enginetype), pointer  engine,
real(dp), intent(in)  E1,
real(dp), intent(in)  E0,
integer, intent(inout)  ierr,
real(dp), intent(in), optional  xArg 
)

Evaluates a general function with optional scaling and offset.

Parameters
enginePoints to the general function to evaluate
[in]E1Scaling factor
[in]E0Offset value
ierrError flag
[in]xArgOptional function argument value
  • eVal = E0 + E1*func(x), if func is defined for engine
  • eVal = E0 + E1*x, if func is not defined for engine

x may either be the input xArg or sensor-defined.

Author
Karl Erik Thoresen / Bjorn Haugen / Knut Morten Okstad
Date
6 Jun 2002
Here is the call graph for this function:
Here is the caller graph for this function:

◆ preevaluate()

subroutine engineroutinesmodule::preevaluate ( type(enginetype), dimension(:), intent(inout)  engines,
integer, intent(inout)  ierr 
)

Pre-evaluation of general functions.

Parameters
enginesAll general functions in the model
ierrError flag

This subroutine pre-evaluates all functiontypemodule::enginetype objects that have been flagged for it. It is used in the case that the order of evaluation matters, in particular for user-defined functions.

Author
Knut Morten Okstad
Date
6 Feb 2015
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printfuncvalues()

subroutine engineroutinesmodule::printfuncvalues ( integer, intent(in)  istep,
real(dp), intent(in)  time,
type(enginetype), dimension(:), intent(inout)  engines,
integer, intent(in)  lpu 
)

Updates and prints out the current value of all general functions.

Parameters
[in]istepTime increment counter
[in]timeCurrent time
enginesAll general functions in the model
[in]lpuFile unit number for res-file output
Author
Knut Morten Okstad
Date
12 Jun 2023
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sensorrate()

recursive real(dp) function, private engineroutinesmodule::sensorrate ( type(sensortype), intent(inout)  sensor,
integer, intent(inout)  ierr 
)
private

Evaluates the time-derivative of a sensor value.

Parameters
sensorThe sensor object to evaluate the derivative for
ierrError flag
Author
Knut Morten Okstad
Date
17 Nov 2014
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setpointersforsensors()

subroutine engineroutinesmodule::setpointersforsensors ( type(enginetype), dimension(:), intent(in), target  eArr,
type(triadtype), dimension(:), intent(in), target  tArr,
type(springbasetype), dimension(:), intent(in), target  sArr,
type(damperbasetype), dimension(:), intent(in), target  dArr 
)

Initialization of private pointers.

Parameters
[in]eArrAll functiontypemodule::enginetype objects in the model
[in]tArrAll triadtypemodule::triadtype objects in the model
[in]sArrAll springtypemodule::springbasetype objects in the model
[in]dArrAll dampertypemodule::damperbasetype objects in the model

This subroutine sets the private pointers of this module to point to the arrays provided as arguments (which should be those within the mechanismtypemodule::mechanismtype object). This is to avoid the necessity to transport these arrays through the enginevalue() and evalargs() calls, since they are needed by the subroutine updatesensor() which is invoked from evalargs().

Author
Knut Morten Okstad
Date
6 Jun 2002
Here is the caller graph for this function:

◆ updatedamperbase()

recursive subroutine engineroutinesmodule::updatedamperbase ( type(damperbasetype), intent(inout)  dmp,
integer, intent(inout)  ierr 
)

Updates the damper variables.

Parameters
dmpThe damper object to update the variables for
ierrError flag
Note
This may be an implicit recursive subroutine through the call sequence:
-> enginevalue -> evalargs -> updatesensor -> updatedamperbase
Author
Knut Morten Okstad
Date
6 Jun 2002
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateenginesforsave()

subroutine engineroutinesmodule::updateenginesforsave ( type(enginetype), dimension(:), intent(inout)  engines,
integer, intent(in)  eFlag,
integer, intent(out)  ierr 
)

Update all engines and store the values for saving.

Parameters
enginesAll general functions in the model
[in]eFlagUpdate the functions whose saveVar equals this value
[out]ierrError flag
Author
Knut Morten Okstad
Date
20 Jul 2004
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatesensor()

recursive subroutine engineroutinesmodule::updatesensor ( type(sensortype), intent(inout)  sensor,
integer, intent(inout)  ierr 
)

Updates a sensor value depending on the sensor type.

Parameters
sensorThe sensor object to update the value for
ierrError flag

For many sensor types the actual sensor value is a pointer directly into the object it is evaluating, and this subroutine does nothing for such sensors.

Note
For some sensors of non-trivial type, this may be an implicit recursive subroutine through the call sequences:
-> enginevalue --------------------\
-> updatespringbase -> enginevalue -> evalargs -> updatesensor
-> updatedamperbase /
Author
Knut Morten Okstad
Date
6 Jun 2002
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatespringbase()

recursive subroutine engineroutinesmodule::updatespringbase ( type(springbasetype), intent(inout)  spr,
integer, intent(inout)  ierr 
)

Updates the spring variables.

Parameters
sprThe spring object to update the variables for
ierrError flag
Note
This may be an implicit recursive subroutine through the call sequence:
-> enginevalue -> evalargs -> updatesensor -> updatespringbase
Author
Knut Morten Okstad
Date
6 Jun 2002
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dampers

type(damperbasetype), dimension(:), pointer, save, private engineroutinesmodule::dampers => null()
private

Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object.

◆ engines

type(enginetype), dimension(:), pointer, save, private engineroutinesmodule::engines => null()
private

Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object.

◆ ispredictorstep

logical, save engineroutinesmodule::ispredictorstep = .false.

Flag used for consistent right-hand-side calculation in the predictor step.

Equals .true. in first iteration

◆ ourenvir

type(environmenttype), pointer, save, public engineroutinesmodule::ourenvir => null()

Public pointer to the environmental data member in the mechanismtypemodule::mechanismtype object.

◆ springs

type(springbasetype), dimension(:), pointer, save, private engineroutinesmodule::springs => null()
private

Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object.

◆ triads

type(triadtype), dimension(:), pointer, save, private engineroutinesmodule::triads => null()
private

Private pointer to the corresponding member array in the mechanismtypemodule::mechanismtype object.