biot_savart_vc_comp

Module Contents

Classes

BiotSavartComp

Compute AIC.

SymmetryFlip

Compute the whole AIC matrix given half of it

class biot_savart_vc_comp.BiotSavartComp(**kwargs)

Bases: csdl.Model

Compute AIC.

Parameters
eval_pts[num_nodes,nc, ns, 3]numpy array

Array defining the nodal coordinates of the lifting surface that the AIC matrix is computed on.

vortex_coords[num_nodes,nc_v, ns_v, 3]numpy array

Array defining the nodal coordinates of background mesh that induces the AIC.

Returns
AIC[nc*ns*(nc_v-1)*(ns_v-1), nc*ns*(nc_v-1)*(ns_v-1), 3]numpy array

Aerodynamic influence coeffients (can be interprete as induced velocities given circulations=1)

2023-06-13:

need to check the node order and the bound vector against OAS

__compute_expand_vecs(eval_pts, p_1, vortex_coords_shape, eval_pt_name, vortex_coords_name, output_name, point_name)
_induced_vel_line(r_1, r_2, r_1_norm, r_2_norm, line_name)
define()

User defined method to define runtime behavior. Note: the user never _calls_ this method. Only the Simulator class constructor calls this method.

Example

```py class Example(Model):

def define(self):

self.create_input(‘x’) m = 5 b = 3 y = m*x + b self.register_output(‘y’, y)

# compile using Simulator imported from back end… sim = Simulator(Example()) sim[‘x’] = -3/5 sim.run() print(sim[‘y’]) # expect 0 ```

initialize()

User defined method to declare parameter values. Parameters are compile time constants (neither inputs nor outputs to the model) and cannot be updated at runtime. Parameters are intended to make a Model subclass definition generic, and therefore reusable. The example below shows how a Model subclass definition uses parameters and how the user can set parameters when constructing the example Model subclass.

Example

```py class Example(Model):

def initialize(self):

self.parameters.declare(‘num_times’, types=int) self.parameters.declare(‘step_size’, types=float) self.parameters.declare(‘surface’, types=dict)

def define(self):

num_times = self.parameters[‘num_times’] step_size = self.parameters[‘step_size’] surface = self.parameters[‘surface’] name = surface[‘name’] # str symmetry = surface[‘symmetry’] # bool mesh = surface[‘mesh’] # numpy array

# define runtime behavior…

surface = {

‘name’: ‘wing’, ‘symmetry’: False, ‘mesh’: mesh,

}

# compile using Simulator imported from back end… sim = Simulator(

Example(

num_times=100, step_size=0.1, surface=surface,

),

)

```

class biot_savart_vc_comp.SymmetryFlip(*args, **kwargs)

Bases: csdl.CustomExplicitOperation

Compute the whole AIC matrix given half of it

Parameters
<aic_half_names>[nc*ns*(nc_v-1)*(ns_v-1)* nc*ns*(nc_v-1)*(ns_v-1)/2, 3]numpy array

Array defining the nodal coordinates of the lifting surface that the AIC matrix is computed on.

Returns
<aic_names>[nc*ns*(nc_v-1)*(ns_v-1), nc*ns*(nc_v-1)*(ns_v-1), 3]numpy array

Aerodynamic influence coeffients (can be interprete as induced velocities given circulations=1)

__get_full_aic_jax(half_aic)
compute(inputs, outputs)

Define outputs as an explicit function of the inputs

Example

```py def compute(self, inputs, outputs):

outputs[‘L’] = 1/2 * inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] outputs[‘D’] = 1/2 * inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’]

```

define()

User defined method to define custom operation

Example

def define(self):
    self.add_input('Cl')
    self.add_input('Cd')
    self.add_input('rho')
    self.add_input('V')
    self.add_input('S')
    self.add_output('L')
    self.add_output('D')

    # declare derivatives of all outputs wrt all inputs
    self.declare_derivatives('*', '*'))
initialize()

User defined method to declare parameter values. Parameters are compile time constants (neither inputs nor outputs to the model) and cannot be updated at runtime. Parameters are intended to make a CustomOperation subclass definition generic, and therefore reusable. The example below shows how a CustomOperation subclass definition uses parameters and how the user can set parameters when constructing the example CustomOperation subclass. Note that the user never instantiates nor inherits directly from the CustomOperation base class.

Example

```py # in this example, we inherit from ExplicitOperation, but # the user can also inherit from ImplicitOperation class Example(ExplicitOperation):

def initialize(self):

self.parameters.declare(‘in_name’, types=str) self.parameters.declare(‘out_name’, types=str)

def define(self):

# use parameters declared in initialize in_name = self.parameters[‘in_name’] out_name = self.parameters[‘out_name’]

self.add_input(in_name) self.add_output(out_name) self.declare_derivatives(out_name, in_name)

# define run time behavior by defining other methods…

# compile using Simulator imported from back end… sim = Simulator(

Example(

in_name=’x’, out_name=’y’,

),

)