Class: Nematic Liquid Crystal

Nematic Liquid Crystal model.

class comfit.nematic_liquid_crystal.nematic_liquid_crystal.NematicLiquidCrystal(dim, **kwargs)

Bases: BaseSystem

__init__(dim, **kwargs)

Initializes a system to simulate a (active) nematic liquid crystal

Parameters

dimint

The dimension of the system.

kwargsdict, optional

Optional keyword arguments to set additional parameters. See https://comfitlib.com/ClassNematicLiquidCrystal/

Returns

NematicLiquidCrystal

The system object representing the nematic simulation.

Examples

>>> nematic = NematicLiquidCrystal(2, xRes=100, yRes = 100, alpha=-0.5)
Creates a nematic liquid crystal with 2 dimensions and a spatial resolution of 100.
The activity alpha is set to -0.5.
calc_active_force_f(Q)

Function that calculates the active force in Fourier space.

Parameters

Qnumpy.ndarray

the order parameter that we use to find the force.

Returns

numpy.ndarray

The active force in Fourier space

calc_disclination_density()

Calculates the disclination density for the nematic. Note that in three dimension the disclination density is a tensor

Returns

numpy.ndarray

The disclination density

calc_disclination_density_decoupled()

Calculates the decoupled disclination density in three dimensions.

Returns

omeganumpy.ndarray

The scalar magnitude of the disclination density tensor.

rotation_fieldnumpy.ndarray

The rotation vector field, the leading eigenvector of the disclination density tensor contracted with its transpose.

Tnumpy.ndarray

The tangent vector, the leading eigenvector of the disclination density tensor’s transpose contracted with itself.

rho_tracenumpy.ndarray

The trace of the disclination density tensor.

calc_disclination_nodes(dt_Q=None, polarization=None, charge_tolerance=0.1)

Calculates the positions and charges of disclination nodes based on the disclination density.

Parameters

dt_Qnumpy.ndarray, optional

The time derivative of the order parameter. If not provided, the velocity of the disclination nodes will not be calculated.

polarizationnumpy.ndarray, optional

The polarization field for positive defects in 2D. If provided the direction of the positive defects are shown.

charge_tolerancefloat, optional

The tolerance given to the defect finding algorithm in 3D. Default 0.1

Returns

list of dict
A list of dictionaries representing the disclination nodes. Each dictionary contains the following keys:
  • ‘position_index’: The position index of the disclination node in the disclination density array.

  • ‘charge’: The charge of the disclination node.

  • ‘position’: The position of the disclination node as a list [x, y].

  • ‘velocity’: The velocity of the disclination node as a list [vx, vy].

In 3F the charge key is removed and we instead have

-‘tangent_vector’: The tangent vector of the dislocation -‘rotation_vector’: The rotation vector of the dislocation

calc_disclination_polarization_field()

Calculates the polarization field of the disclination in two dimensions

Returns

numpy.ndarray

The polarization field

calc_disclination_velocity_field(dt_Q, tangent_vector=None, rotation_vector=None, g_matrix=None, disclination_density_magnitude=None)

Calculates the velocity field of the disclination in two dimensions

Parameters

dt_Qnumpy.ndarray

the time derivative of the order parameter

tangent_vectornumpy.ndarray, optional

the unit tangent vector to the disclination line (3D only)

rotation_vectornumpy.ndarray, optional

the unit rotation vector of the disclination line, i.e. the axis about which the director winds (3D only)

g_matrixnumpy.ndarray, optional

the auxiliary tensor coupling dt_Q to the spatial derivatives of self.Q, from calc_g_matrix (3D only)

disclination_density_magnitudenumpy.ndarray, optional

the scalar magnitude of the disclination density tensor (3D only)

Returns

numpy.ndarray

The velocity field. Note in 2D this returns a field while in 3D this is returning a vector

calc_dt_psi(Q_prev, delta_t)

Calculates the time derivative of the order parameter as a complex field

Parameters

Q_prevnumpy.ndarray

the order parameter at the previous time step

delta_tfloat

the time step

Returns

numpy.ndarray

The time derivative of the order parameter

calc_equilibrium_S()

Calculates the strength of nematic order S

Returns

numpy.ndarray

equilibrium value of S

calc_g_matrix(dt_Q)

Calculates the matrix g, that is used to find the disclination velocity in 3D

Returns

numpy.ndarray

The g matrix

calc_gradient_pressure_f(p_f)

Calculates the gradient of the pressure

Parameters

p_fnumpy.ndarray

the pressure in Fourier space

Returns

numpy.ndarray

Gradient of the pressure

calc_molecular_field(Q)

Finds the molecular field

Parameters

Qnumpy.ndarray

The nematic tensor

Returns

numpy.ndarray

The molecular field

calc_nonlinear_evolution_function_f(Q, t)

Calculates the non-linear evolution function for the nematic

Parameters

Qnumpy.ndarray

the nematic order parameter

Returns

numpy.ndarray

The non-linear evolution function evaluated in Fourier space

calc_nonlinear_evolution_term_no_flow_f(Q, t)

Calculates the non-linear evolution function for the nematic without the flow field

Parameters

Qnumpy.ndarray

the nematic order parameter

Returns

numpy.ndarray

The non-linear evolution function evaluated in Fourier space

calc_order_and_director()

Calculates the amount of order (S) and the director field (n)

Returns

tuple
Tuple consisting of
  • Amount of order (scalar field)

  • the director field (vector field)

calc_passive_force_f(Q)

Calculates the passive force in Fourier space

Parameters

Qnumpy.ndarray

the order parameter that we use to find the force.

Returns

numpy.ndarray

The passive force in Fourier space

calc_passive_stress_f(Q)

Calculates the passive stress in Fourier space

Parameters

Qnumpy.ndarray

the order parameter that we use to find the stress.

Returns

numpy.ndarray

The passive stress in Fourier space

calc_pressure_f(F_af, F_pf)

Calculates the pressure in Fourier space. The zero mode is set to zero

Parameters

F_afnumpy.ndarray

the active force in Fourier space

F_pfnumpy.ndarray

the passive force in Fourier space

Returns

numpy.ndarray

The pressure

calc_strain_rate_tensor_f()

Calculates the strainrate tensor

Returns

numpy.ndarray

The strainrate

calc_trace_Q2(Q)
calc_vorticity_tensor()

Calculates the vorticity tensor

Returns

numpy.ndarray

The vorticity tensor

conf_active_channel(width=None, interface_width=7)

Configures the activity to zero everywhere except for inside a channel of width “width”

Parameters

widthfloat

width of the channel

interface_widthfloat, optional

width of interface

Returns

None

Updates the activity to the channel configuration.

conf_initial_condition_ordered(noise_strength=0.01)

Configures the system with the nematogens pointing in the x-direction in 2D and in the z-direction in 3D with some random noise in the angle.

Parameters

noise_strengthfloat

A measure for how much noise to put in the angle

Returns

None

Initialises self.Q and self.Q_f

Raises

Exception

If the dimension is not 2 or 3

conf_initial_disclination_lines(position1=None, position2=None)

Sets the initial condition for a disclination line in a 3-dimensional system.

The dislocation is parallel to the z-axis

Parameters

position1list

the position of the first dislocation. Only the position in the xy plane is used

Returns

None

Sets the value of self.Q and self.Q_f

conf_insert_disclination_dipole(dipole_vector=None, dipole_position=None)

Sets the initial condition for a disclination dipole configuration in a 2-dimensional system.

Returns

None

Configures self.Q and self.Q_f with a disclination dipole configuration.

Raises

Exception

If the dimension of the system is not 2.

conf_velocity(Q)

Updates the velocity and its fourier transform given a nematic field Q.

Parameters

Qnumpy.ndarray

the Q tensor

Returns

None

Updates self.u and self.u_f.

evolve_nematic(number_of_steps, method='ETD2RK')

Evolves the nematic system

Parameters

number_of_stepsint

the number of time steps that we are evolving the equation

methodstring

the integration method we want to use. ETD2RK is sett as default

Returns

None

Updates the fields self.Q and self.Q_f

evolve_nematic_no_flow(number_of_steps, method='ETD2RK')

Evolves the nematic system without the flow field

Parameters

number_of_stepsint

the number of time steps that we are evolving the equation

methodstring

the integration method we want to use. ETD2RK is sett as default

Returns

None

Updates the fields self.Q and self.Q_f

plot_field_velocity_and_director(field, velocity, director, **kwargs)
comfit.nematic_liquid_crystal.plot_field_velocity_and_director_matplotlib.plot_field_velocity_and_director_matplotlib(self, field, velocity, director, **kwargs)

Plot the fields, velocity, and director field in 2 dimensions

Parameters

fieldndarray

The field to be plotted.

velocityndarray

The velocity to be plotted.

directorndarray

The director to be plotted.

**kwargsAny

Keyword arguments for the plot. See https://comfitlib.com/ClassBaseSystem/ for a full list of keyword arguments.

Returns

tuple
A tuple consisting of
  • The figure

  • The axes with the plotted field, velocity, and director.

Raises

Exception

If the dimension is other than 2.

comfit.nematic_liquid_crystal.plot_field_velocity_and_director_plotly.plot_field_velocity_and_director_plotly(self, field, velocity, director, **kwargs)

Plot the fields, velocity, and director field in 2 dimensions using Plotly.

Parameters

fieldndarray

The field to be plotted.

velocityndarray

The velocity to be plotted.

directorndarray

The director to be plotted.

**kwargsAny

Keyword arguments for the plot.

Returns

go.Figure

The plotly figure.