Skip to content

Commit

Permalink
building docs structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ACea15 committed Sep 11, 2024
1 parent 1f761b2 commit 4d4036a
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 71 deletions.
1 change: 1 addition & 0 deletions docs/documentation/api/couplings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: intrinsic.couplings
5 changes: 5 additions & 0 deletions docs/documentation/api/inputs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Input containers

## Intrinsic modal solution

::: preprocessor.containers.intrinsicmodal
1 change: 1 addition & 0 deletions docs/documentation/examples.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Examples

1 change: 1 addition & 0 deletions docs/documentation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Latest versions at time of writing.
mkdocs # Main documentation generator.
mkdocstrings[python]
mkdocs-material # Theme
pymdown-extensions # Markdown extensions e.g. to handle LaTeX.
mkdocstrings # Autogenerate documentation from docstrings.
Expand Down
6 changes: 6 additions & 0 deletions docs/documentation/theory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Theoretical background

## Reduction to Load paths:
## Intrinsic modes:
## Nonlinear couplings:
## Aeroelastic system:
4 changes: 2 additions & 2 deletions docs/reports/CPC24/main.org
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ We propose a non-intrusive framework to enhance complex FE structural and aeroel
'("latexmk -pdflatex='pdflatex --syntex=1 -shell-escape -interaction nonstopmode' -pdf -bibtex -f %f"
"latexmk -pdflatex='pdflatex --syntex=1 -shell-escape -interaction nonstopmode' -pdf -bibtex -f %f"))
;; (setq org-latex-pdf-process (list "latexmk -f -pdf -interaction=nonstopmode -output-directory=%o %f"))
(pyvenv-workon "feniax.ev")
(pyvenv-workon "feniax")
(require 'org-tempo)
;; Veval_blocks -> eval blocks of latex
;; Veval_blocks_run -> eval blocks to obtain results
(setq Veval_blocks "yes") ;; yes, no, no-export
(setq Veval_blocks_run "no-export")
(setq Veval_blocks_run "yes")
(setq Vpics "png") ;; yes, no, no-export
(setq pythonShell "py2")
;; export_blocks: code, results, both, none
Expand Down
12 changes: 5 additions & 7 deletions examples/ArgyrisBeam/settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import pathlib
import pdb
import sys
import numpy as np
import datetime
import pathlib

import feniax.feniax_main
import feniax.preprocessor.configuration as configuration # import Config, dump_to_yaml
from feniax.preprocessor.inputs import Inputs
import feniax.feniax_main
import jax.numpy as jnp
import jax


#jax.config.update("jax_enable_compilation_cache", False)


Expand Down
2 changes: 1 addition & 1 deletion feniax/feniax_main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""FEM4INAS main"""
"""Main FENIAX"""

import feniax.drivers
import feniax.preprocessor.configuration as configuration # Config, ValidateConfig
Expand Down
53 changes: 53 additions & 0 deletions feniax/intrinsic/couplings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ def f_gamma1(phi1: jnp.array, psi1: jnp.array) -> jnp.array:
def f_gamma2(
phi1m: jnp.array, phi2: jnp.array, psi2: jnp.array, delta_s: jnp.array
) -> jnp.array:
"""Gamma1 tensor calculation.
Parameters
----------
psi1m : jnp.array
Velocity modal shapes at mid-points (Nmx6xNn)
phi2 : jnp.array
Internal force modal shapes (Nmx6xNn)
psi2 : jnp.array
Strain modal shapes (Nmx6xNn)
delta_s : jnp.array
1D differential path increments (Nn)
Returns
-------
jnp.array
Gamma2 tensor (NmxNmxNm)
"""

phi1mi = phi1m[:, :, 1:]
phi2i = phi2[:, :, 1:]
psi2i = psi2[:, :, 1:]
Expand All @@ -55,12 +75,45 @@ def f_gamma2(

@jax.jit
def f_alpha1(phi1: jnp.array, psi1: jnp.array) -> jnp.array:
"""Gamma1 tensor calculation.
Parameters
----------
phi1 : jnp.array
Velocity modal shapes (Nmx6xNn)
psi1 : jnp.array
Momentum modal shapes (Nmx6xNn)
Returns
-------
jnp.array
alpha1 tensor (NmxNm)
"""

alpha1 = jnp.einsum("isn,jsn->ij", phi1, psi1)
return alpha1


@jax.jit
def f_alpha2(phi2: jnp.array, psi2: jnp.array, delta_s: jnp.array) -> jnp.array:
"""Gamma1 tensor calculation.
Parameters
----------
phi2 : jnp.array
Internal force modal shapes (Nmx6xNn)
psi2 : jnp.array
Strain modal shapes (Nmx6xNn)
delta_s : jnp.array
1D differential path increments (Nn)
Returns
-------
jnp.array
Alpha2 tensor (NmxNm)
"""

phi2i = phi2[:, :, 1:]
psi2i = psi2[:, :, 1:]
delta_si = delta_s[1:]
Expand Down
121 changes: 61 additions & 60 deletions feniax/preprocessor/containers/intrinsicmodal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
xxxx
Containers for the intrinsic modal solution settings
"""

import inspect
Expand Down Expand Up @@ -897,7 +897,12 @@ def __post_init__(self):
if self.components is None:
object.__setattr__(self, "components", tuple(range(self._numcomponents)))



class ADinputType(Enum):
POINT_FORCES = 1
GUST1 = 2
FEM = 3

@dataclass(frozen=True, kw_only=True)
class DtoAD(Dlibrary):
"""Algorithm differentiation settings
Expand Down Expand Up @@ -952,61 +957,7 @@ def __post_init__(self):
_numcomponents=self._numcomponents,
),
)

@dataclass(frozen=True)
class Dsystems(DataContainer):
"""Input setting for the range of systems in the simulation
Parameters
----------
sett : dict
mapper : dict
borrow : dict
_fem : Dfem
Attributes
----------
"""

sett: dict[str:dict] = dfield("Settings ", yaml_save=True)
mapper: dict[str:Dsystem] = dfield(
"Dictionary with systems in the simulation", init=False
)
borrow: dict[str:str] = dfield(
"""Borrow settings from another system:
if there is only one system, then inactive; otherwise default to take settings from
the first system unless specified.
""",
default=None,
)
_fem: Dfem = dfield("", default=None, yaml_save=False)

def __post_init__(self):
mapper = dict()
counter = 0
for k, v in self.sett.items():
if self.borrow is None:
# pass self._fem to the system here, the others should already have
# a reference
mapper[k] = initialise_Dclass(v, Dsystem, name=k, _fem=self._fem)
elif isinstance(self.borrow, str):
assert self.borrow in self.sett.keys(), "borrow not in system names"
if k == self.borrow:
mapper[k] = initialise_Dclass(v, Dsystem, name=k)
else:
v0 = self.sett[self.borrow]
mapper[k] = initialise_Dclass(v0, Dsystem, name=k, **v)
else:
if k in self.borrow.keys():
v0 = self.sett[self.borrow[k]]
mapper[k] = initialise_Dclass(v0, Dsystem, name=k, **v)
else:
mapper[k] = initialise_Dclass(v, Dsystem, name=k)

counter += 1
object.__setattr__(self, "mapper", mapper)

@dataclass(frozen=True, kw_only=True)
class Dsystem(DataContainer):
Expand Down Expand Up @@ -1259,11 +1210,61 @@ def build_label(self):
object.__setattr__(self, "label_map", lmap)
object.__setattr__(self, "label", label) # f"dq_{label}")


@dataclass(frozen=True)
class Dsystems(DataContainer):
"""Input setting for the range of systems in the simulation
class ADinputType(Enum):
POINT_FORCES = 1
GUST1 = 2
FEM = 3
Parameters
----------
sett : dict
mapper : dict
borrow : dict
_fem : Dfem
Attributes
----------
"""

sett: dict[str:dict] = dfield("Settings ", yaml_save=True)
mapper: dict[str:Dsystem] = dfield(
"Dictionary with systems in the simulation", init=False
)
borrow: dict[str:str] = dfield(
"""Borrow settings from another system:
if there is only one system, then inactive; otherwise default to take settings from
the first system unless specified.
""",
default=None,
)
_fem: Dfem = dfield("", default=None, yaml_save=False)

def __post_init__(self):
mapper = dict()
counter = 0
for k, v in self.sett.items():
if self.borrow is None:
# pass self._fem to the system here, the others should already have
# a reference
mapper[k] = initialise_Dclass(v, Dsystem, name=k, _fem=self._fem)
elif isinstance(self.borrow, str):
assert self.borrow in self.sett.keys(), "borrow not in system names"
if k == self.borrow:
mapper[k] = initialise_Dclass(v, Dsystem, name=k)
else:
v0 = self.sett[self.borrow]
mapper[k] = initialise_Dclass(v0, Dsystem, name=k, **v)
else:
if k in self.borrow.keys():
v0 = self.sett[self.borrow[k]]
mapper[k] = initialise_Dclass(v0, Dsystem, name=k, **v)
else:
mapper[k] = initialise_Dclass(v, Dsystem, name=k)

counter += 1
object.__setattr__(self, "mapper", mapper)


def generate_docstring(cls: Any) -> Any:
Expand Down
5 changes: 4 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ plugins:
default_handler: python
handlers:
python:
paths: [fem4inas]
paths: [feniax]
options:
docstring_style: numpy # 'google' 'numpy', 'rst', etc.
filters: ["!^_[^_]"] # Exclude private members
Expand Down Expand Up @@ -115,5 +115,8 @@ nav:
#- Tutorials
- Examples: examples.md
#- Postprocessing
- Theoretical background: theory.md
- Codes:
- Inputs: api/inputs.md
- Modes: api/modes.md
- Nonlinear couplings: api/couplings.md

0 comments on commit 4d4036a

Please sign in to comment.