Initial Conditions#
It is often necessary to set-up complex initial conditions when simulating transient problems. Furthermore, setting a coherent initial condition can greatly help the convergence of steady-state problems. Lethe offers three different strategies to set initial conditions : Nodal (through a function), L2 projection (through a function) and viscous. The viscous strategy solves the same CFD problem but with a user-defined kinematic viscosity. This can allow the user to initialize the velocity field with a Stokes-like flow for which convergence can be obtained more easily.
subsection initial conditions
# Type of initial conditions. Choices are L2projection, viscous, nodal or average_velocity_profile
set type = nodal
# Kinematic viscosity for viscous initial conditions
set kinematic viscosity = 1
subsection uvwp
set Function expression = 0; 0; 0; 0
end
subsection VOF
set Function expression = if (x<0.5 & y<1, 1, 0)
set smoothing type = none # <none|diffusive|geometric>
set diffusion factor = 1
end
subsection temperature
set Function expression = 0
end
subsection cahn hilliard
set Function expression = if (x<0.5 & y<1, 1, -1); 0
end
subsection ramp
subsection kinematic viscosity
set initial kinematic viscosity = 1.0
set iterations = 0
set alpha = 0.5
end
subsection n
set initial n = 1.0
set iterations = 0
set alpha = 0.5
end
end
subsection average velocity profile
set checkpoint folder = ./
set checkpoint file name = restart
end
end
The
typeparameter indicates which strategy is used to impose the initial conditions. The choices are :L2projection,viscous,nodal,ramporaverage_velocity_profile.The
kinematic viscosityparameter controls the kinematic viscosity that is used to solve the Navier-Stokes equations when the viscous initial condition is chosen.The
subsection uvwpallows the user to select a function (velocity-pressure) to set a nodal or L2 projection initial condition.The
subsection VOFdefines the areas where both fluids lay at the initial state (see section Multiphysics). In this example, theFunction expressionis used with a boolean condition to establish the region where the fluid indicator is \(0\) or \(1\):if (condition, value if true, value if false).if (x<0.5 & y<1, 1, 0)means thatfluid 1initially fills the surface wherex<0.5andy<1, the rest being filled withfluid 0.Note
The
Function expressioncan be used to establish an even more complex free surface initial geometry. For example, one can create a circle of fluid :if ( (x^2+y^2)<=(r)^2 ,1,0)The
smoothing typeallows to smooth the VOF initial condition and avoid a staircase definition of the free surface.When the parameter
smoothing type = diffusive, the initial condition is projected following:
\[\psi(\Omega_K) = \int_{\Omega_K} \phi d\Omega\]\[\int_\Omega \left( \psi^* v + \eta_\psi \nabla \psi^* \cdot \nabla v \right) d\Omega = \int_\Omega \psi v d\Omega\]where \(\psi(\Omega_K)\) corresponds to a color function value on the Kth element, \(\phi\) is the phase fraction, \(\psi^*\) is the smoothed phase fraction, \(\eta_\psi = \alpha h^2\) with \(\alpha\) corresponding to the
diffusion factorand \(h\) to the cell size, and \(v\) is a test function.When the parameter
smoothing type = geometric, the initial condition is smoothed using a geometric redistanciation method. In that case, the parameters for the geometric redistanciation method are declared in the Geometric Interface Reinitialization subsection such as described in the Volume of Fluid (Multiphase Flow) documentation.
The
subsection cahn hilliarddefines the areas where both fluids lay at the initial state (see section Multiphysics). It works similarly to thesubsection VOFfor the first component, which corresponds to the phase order parameter. The user also has the choice to specify initial conditions for the chemical potential, although it is often more suitable to leave it at \(0\).The
subsection temperatureallows the user to define an initial temperature for the fluid domain (ifset heat tranfer = truein Multiphysics).The
subsection rampholds the parameters to operate a ramp on either or both the kinematic viscosity and thenparameter in rheological models (see Physical Properties for more information on this parameter). When ramping on the kinematic viscosity value,The
initial kinematic viscosityis the kinematic viscosity with which the initial condition starts off. An initial kinematic viscosity of \(1.0\) is suggested.The
iterationsparameter sets the number of kinematic viscosity iterations before reaching the simulation kinematic viscosity.The
alphaparameter sets the stepping length between kinematic viscosity iterations, as seen in the following equation, where \(\eta\) is the kinematic viscosity and \(i\) stands for the iteration number.
Note
The ramped up kinematic viscosity in the Carreau model in \(\eta_0\), and \(\eta_{\infty}\) stays unchanged. See Physical Properties for more details.
- Likewise, in the
subection n, the parameters for ramping on thenvalue are the following. The
initial nis the \(n\) value with which the initial condition starts off. An initial \(n\) of \(1.0\) is suggested.The
iterationsparameter sets the number of \(n\) iterations before reaching the simulation \(n\).The
alphaparameter sets the stepping length between \(n\) iterations, as seen in the following equation, \(i\) stands for the iteration number.
The subsection
average velocity profileuses the time averaged fluid velocity calculated in a previous simulation as an initial condition. This is useful when the flow dynamics and the subphysics reach a pseudo-steady state at different time scales. Physics can then be run independently, one to solve for the fluid dynamics and one for the subphysics. To use this feature, the user should launch a simulation with the fluid mechanics solver while using the time averaging and checkpointing feature. Once the time average of the velocity field is sufficiently established, the simulation should be stopped and a new simulation can be restarted without the fluid mechanics solver. The subphysics can then be solved using a larger time step.
Important
If only an auxiliary physic must be solved without the fluid dynamics,
set fluid dynamics = falseneeds to be specified in themultiphysicssection. The average velocity field will then be used for the whole duration of the simulation.This feature uses the checkpoint mechanism to load the time averaged velocity field. Make sure to activate checkpointing in the restart section of the first simulation.
The same mesh needs to be used for the fluid dynamics and the auxiliary physics simulations. The mesh should not be modified between the two simulations.