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

Args:

dimension : The dimension of the system. kwargs : dict, optional Optional keyword arguments to set additional parameters. See https://comfitlib.com/ClassNematicLiquidCrystal/

Returns: - NematicLiquidCrystal object

The system object representing the nematic simulation.

Example:

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 activ force in Fourier space.

Args:

Q: the order parameter that we use to find the force. (numpy.narray)

Returns:

The active force in Fourier space (numpy.narray)

calc_disclination_density_decoupled()

Calculates the decoupled disclination density

Args:

None

Returns:

The disclination density (numpy.narray)

calc_disclination_density_nematic()

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

Args:

None

Returns:

The disclination density (numpy.narray)

calc_disclination_nodes_nem(dt_Q=None, polarization=None, charge_tolerance=None)

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

Args:

dt_Q: The time derivative of the order parameter. If not provided, the velocity of the disclination nodes will not be calculated. (numpy.narray, optional)

Returns:
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].

calc_disclination_polarization_field()

Calculates the polarization field of the disclination in two dimensions

Args:

None

Returns:

The polarization field (numpy.narray)

calc_disclination_velocity_field(dt_Q, T=None, Omega_R=None, g=None, omega=None)

Calculates the velocity field of the disclination in two dimensions

Args:

dt_Q: the time derivative of the order parameter (numpy.narray)

Returns:
The velocity field (numpy.narray).

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

Args:

Q_prev: the order parameter at the previous time step (numpy.narray) delta_t: the time step (float)

Returns:

The time derivative of the order parameter (numpy.narray)

calc_equilibrium_S()

Calculates the strength of nematic order S

Args:

None

Returns:

equilibrium value of S (numpy.narray)

calc_g_matrix(dt_Q)

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

Args:

None

Returns:

The disclination density (numpy.narray)

calc_gradient_pressure_f(p_f)

Caclulates the gradient of the pressure

Args:

p_f: the pressure in Fourier space (numpy.narray)

Returns:

Gradient of the pressure (numpy.ndarray)

calc_molecular_field(Q)

Finds the molecular field

Args:

Q (numpy.ndarray): The nematic tensor

Returns:

The molecular field (numpy.ndarray)

calc_nonlinear_evolution_function_f(Q, t)

Calculates the non-linear evolution function for the nematic

Args:

Q: the nematic orderparameter (numpy.narray)

Returns:

The non-linear evolution function evaluated in Fourier space (numpy.narray)

calc_nonlinear_evolution_term_no_flow_f(Q, t)

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

Args:

Q: the nematic orderparameter (numpy.narray)

Returns:

The non-linear evolution function evaluated in Fourier space (numpy.narray)

calc_order_and_director()

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

Args:

None

Returns:
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

Args:

Q: the order parameter that we use to find the force. (numpy.narray)

Returns:

The passive force in Fourier space numpy.ndarray:

calc_passive_stress_f(Q)

Calculates the passive stress in fourier space

Args:

Q: the order parameter that we use to find the stress.

Returns:

The passive stress in fourier space (numpy.narray)

calc_pressure_f(F_af, F_pf)

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

Args:

F_af: the active force in Fourier space (numpy.narray) F_pf:the passive force in Fourier space (numpy.narray)

Returns:

The pressure (numpy.ndarray)

calc_strain_rate_tensor_f()

Calculates the strainrate tensor

Args:

None

Returns:

The strainrate (numpy.ndarray)

calc_trace_Q2(Q)
calc_vorticity_tensor()

Calculates the vorticity tensor

Args:

None

Returns:

The vorticity tensor (numpy.ndarray)

conf_active_channel(width=None, d=7)

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

Args:

width: width of the channel (float) d: width of interface (float, optional)

Returns:

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.

Args:

noise_strength: A meshure for how much noise to put in the angle (float)

Returns:

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 parralell to the z-axis

Args:

position1 (list): the position of the first dislocation. Only the position in the xy plane is used

Returns:

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.

Args:

None

Returns:

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.

Args:

(numpy.narray) the Q tensor

Returns:

(numpy.narray) velocity

evolve_nematic(number_of_steps, method='ETD2RK')

Evolves the nematic system

Args:

number_of_steps: the number of time steps that we are evolving the equation (int) method: the integration method we want to use. ETD2RK is sett as default (string)

Returns:

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

Args:

number_of_steps: the number of time steps that we are evolving the equation (int) method: the integration method we want to use. ETD2RK is sett as default (string)

Returns:

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

Args:

field (ndarray): The field to be plotted. velocity (ndarray): The velocity to be plotted. director (ndarray): The director to be plotted. **kwargs: Keyword arguments for the plot.

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

Returns:
A tuple consisting of
  • The figure

  • The axes with the plotted field, velocity, and director. ax (Axes)

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.

Args:

field (ndarray): The field to be plotted. velocity (ndarray): The velocity to be plotted. director (ndarray): The director to be plotted. **kwargs: Keyword arguments for the plot.

Returns:

The plotly figure (go.Figure).