deqatn
Module
digraph inheritance98f66fe713 {
bgcolor=transparent;
rankdir=LR;
size="";
"pyNastran.bdf.cards.base_card.BaseCard" [URL="pyNastran.bdf.cards.base_card.html#pyNastran.bdf.cards.base_card.BaseCard",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Defines a series of base methods for every card class"];
"pyNastran.bdf.cards.deqatn.DEQATN" [URL="#pyNastran.bdf.cards.deqatn.DEQATN",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Design Equation Definition"];
"pyNastran.bdf.cards.base_card.BaseCard" -> "pyNastran.bdf.cards.deqatn.DEQATN" [arrowsize=0.5,style="setlinewidth(0.5)"];
}
Defines the DEQATN class and sub-functions.
The capitalization of the sub-functions is important.
- class pyNastran.bdf.cards.deqatn.DEQATN(equation_id: int, eqs: list[str], comment='')[source]
Bases:
BaseCard
Design Equation Definition Defines one or more equations for use in design sensitivity analysis.
1
2
3
4
5
6
7
8
DEQATN
EQID
EQUATION
EQUATION (cont.)
Creates a DEQATN card
- Parameters:
- equation_idint
the id of the equation
- eqslist[str]
the equations, which may overbound the field split them by a semicolon (;)
- commentstr; default=’’
a comment for the card
- DEQATN 41 F1(A,B,C,D,R) = A+B *C–(D**3 + 10.0) + sin(PI(1) * R)
A**2 / (B - C); F = A + B - F1 * D
- def F1(A, B, C, D, R):
F1 = A+B *C-(D**3 + 10.0) + sin(PI(1) * R) + A**2 / (B – C) F = A + B - F1 * D return F
- eqs = [
‘F1(A,B,C,D,R) = A+B *C–(D**3 + 10.0) + sin(PI(1) * R) + A**2 / (B – C)’, ‘F = A + B – F1 * D’,
- ]
- >>> deqatn = DEQATN(41, eq, comment=’’)
- _properties = ['dtable']
- _setup_equation() None [source]
creates an executable equation object from self.eqs
x = 10. >>> deqatn.func(x) 42.0
>>> deqatn.func_str def stress(x): x = float(x) return x + 32.
- classmethod add_card(card: list[str], comment: str = '')[source]
Adds a DEQATN card from
BDF.add_card(...)
- Parameters:
- cardlist[str]
this card is special and is not a
BDFCard
like other cards- commentstr; default=’’
a comment for the card
- cross_reference(model: BDF) None [source]
Cross links the card so referenced cards can be extracted directly
- Parameters:
- modelBDF()
the BDF object
- repr_fields() list[str] [source]
Gets the fields in their simplified form
- Returns:
- fieldslist[varies]
the fields that define the card
- type = 'DEQATN'
- pyNastran.bdf.cards.deqatn._join_wrapped_equation_lines(unused_eqs_temp_in, eqs_temp: list[str]) list[str] [source]
helper for
lines_to_eqs
- pyNastran.bdf.cards.deqatn._setup_deqatn(equation_id: int, eqs: list[str], dtable_ref: DTABLE | None, comment: str)[source]
- pyNastran.bdf.cards.deqatn._split_equation(lines_out: list[str], line: str, n: int, isplit: int = 0) list[str] [source]
Takes an overbounded DEQATN line and shortens it using recursion
- Parameters:
- lines_outlist[str]
len(lines) = 0 : first iteration len(lines) = 1 : second iteration
- linestr
the line to split
- nint
the maximum number of characters allowed the first line of the DEQATN has a different number of fields allowed vs. subsequent lines
- isplitint; default=0
the number of levels deep in the recursive function we are
- Returns:
- lines_outlist[str]
the long line broken into shorter lines
- pyNastran.bdf.cards.deqatn._split_equations_by_semicolon(eqs_in: list[str]) list[str] [source]
helper for
lines_to_eqs
- pyNastran.bdf.cards.deqatn._write_comment(comment: str) str [source]
writes the deqatn to the comment block
- pyNastran.bdf.cards.deqatn._write_function_line(func_name: str, variables: list[str], default_values: dict[str, float]) str [source]
writes the
def f(x, y, z=1.):
part of the function
- pyNastran.bdf.cards.deqatn._write_variables(variables: list[str]) str [source]
type checks the inputs
- pyNastran.bdf.cards.deqatn.atan2h(x, y)[source]
Hyperbolic arctangent >>> arctanh(z) = 1/2 Log((1+z)/(1-z))
- real:
- complex:
x1 = a + bi x2 = b + di a = b = 0 and (sign of c) = (sign of d):
the result is 0.
- a = b = 0 and (sign of c) ≠ (sign of d):
the result is π.
- c = d = 0 and (sign of a) = (sign of b):
the result is π/2.
- c = d = 0 and (sign of a) ≠ (sign of b):
the result is −π/2
- pyNastran.bdf.cards.deqatn.dba(p: float, pref: float, f: float) float [source]
sound pressure in decibels (perceived)
- Parameters:
- pfloat
structural responses or acoustic pressure
- ffloat
forcing frequency
- preffloat
reference pressure
- Returns:
- dbifloat
acoustic pressure in Decibels
- pyNastran.bdf.cards.deqatn.fortran_to_python(deqatn_id: int, lines: list[str], default_values: dict[str, float | ndarray], comment: str = '') tuple[str, int, str] [source]
Creates the python function
- Parameters:
- lineslist[str]
the equations to write broken up by statement
- default_valuesdict[name] = value
the default values from the DTABLE card
- Returns:
- func_namestr
the name of the function
- nargsint
the number of variables to the function
- func_msgstr
the python function
- def f(x, y=10.):
‘’’ $ deqatn DEQATN 1000 f(x,y) = x+y ‘’’ try:
- if isinstance(x, (int, float, str)):
x = float(x)
- if isinstance(y, (int, float, str)):
y = float(y)
- except Exception:
print(locals()) raise
f = x + y return f
- pyNastran.bdf.cards.deqatn.fortran_to_python_short(line: str, unused_default_values: Any) Any [source]
the function used by the DRESP2
- pyNastran.bdf.cards.deqatn.invdba(dbai: float, pref: float, f: float) float [source]
Inverse Dba
- Parameters:
- dbaifloat
acoustic pressure in Decibels (perceived)
- ffloat
forcing frequency
- preffloat
reference pressure
- Returns:
- pfloat
structural responses or acoustic pressure
- pyNastran.bdf.cards.deqatn.rss(*args)[source]
2-norm; generalized magnitude of vector for N components
- pyNastran.bdf.cards.deqatn.split_equations(lines: list[str]) list[str] [source]
takes an overbounded DEQATN card and shortens it
- pyNastran.bdf.cards.deqatn.split_to_equations(lines: list[str]) list[str] [source]
Splits a line like:
b = a + z; c = 42
into:
b = a + z c = 42
- pyNastran.bdf.cards.deqatn.write_deqatn(equation_id: int, eqs: list[str], size: int = 8, is_double: bool = False) str [source]
directly write a DEQATN
- pyNastran.bdf.cards.deqatn.write_function_header(func_header: str, eq: str, default_values: dict[str, float], comment: str = '') tuple[str, str, list[str]] [source]
initializes the python function
- def f(x, y=10.):
‘’’ $ deqatn DEQATN 1000 f(x,y) = x+y ‘’’ try:
- if isinstance(x, (int, float, str)):
x = float(x)
- if isinstance(y, (int, float, str)):
y = float(y)
- except Exception:
print(locals()) raise
- Parameters:
- fstr
the function header f(a, b, c)
- eqstr
the value on the other side of the equals sign (f=eq) 1. max(a, b, c)
- default_valuesdict[name] = value
the default values from the DTABLE card
- Returns:
- func_namestr
the name of the function
f
- msgstr
see above
- variableslist[str]
the variables used by the equation header a, b, c