Skip to content

A(vars)

Area of faces between nodes.

Parameters:

Name Type Description Default
vars list

List of arguments

required
Source code in openterrace/domains/sphere_1d.py
def A(vars):
    """Area of faces between nodes.

    Args:
        vars (list): List of arguments
    """

    n = vars['n']
    R = vars['R']
    dx = R/(n-1)
    face_pos_vec = np.concatenate(([0],np.linspace(dx/2,R-dx/2,n-1),[R]))
    return np.array([(4*np.pi*face_pos_vec**2)[:-1], (4*np.pi*face_pos_vec**2)[1:]])

V(vars)

Volume of node element.

Parameters:

Name Type Description Default
vars list

List of arguments

required
Source code in openterrace/domains/sphere_1d.py
def V(vars):
    """Volume of node element.

    Args:
        vars (list): List of arguments
    """

    n = vars['n']
    R = vars['R']
    dx = R/(n-1)
    face_pos_vec = np.concatenate(([0],np.linspace(dx/2,R-dx/2,n-1),[R]))
    return np.diff(4/3*np.pi*face_pos_vec**3)

V0(vars)

Volume of shape.

Parameters:

Name Type Description Default
vars list

List of arguments

required
Source code in openterrace/domains/sphere_1d.py
def V0(vars):
    """Volume of shape.

    Args:
        vars (list): List of arguments
    """

    R = vars['R']
    return 4/3*np.pi*R**3

dx(vars)

Node spacing function.

Parameters:

Name Type Description Default
vars list

List of arguments

required
Source code in openterrace/domains/sphere_1d.py
def dx(vars):
    """Node spacing function.

    Args:
        vars (list): List of arguments
    """

    n = vars['n']
    R = vars['R']
    dx = R/(n-1)
    return np.repeat(dx, n)

node_pos(vars)

Node position function.

Parameters:

Name Type Description Default
vars list

List of arguments

required
Source code in openterrace/domains/sphere_1d.py
def node_pos(vars):
    """Node position function.

    Args:
        vars (list): List of arguments
    """

    n = vars['n']
    R = vars['R']
    return np.array(np.linspace(0,R,n))

shape(vars)

Shape function.

Parameters:

Name Type Description Default
vars list

List of arguments

required
Source code in openterrace/domains/sphere_1d.py
def shape(vars):
    """Shape function.

    Args:
        vars (list): List of arguments
    """

    n = vars['n']
    return np.array([n])

validate_input(vars, domain_shape)

Validates input arguments.

Parameters:

Name Type Description Default
vars list

List of arguments

required
domain_shape str

Name of domain type

required
Source code in openterrace/domains/sphere_1d.py
def validate_input(vars, domain_shape):
    """Validates input arguments.

    Args:
        vars (list): List of arguments
        domain_shape (str): Name of domain type
    """

    required = ['n','R']
    for var in required:
        if not var in vars:
            raise Exception("Keyword \'"+var+"\' not specified for domain of type \'"+domain_shape+"\'")