FlowManager
Summary
- class pvade.fluid.FlowManager.Flow(domain, params)
This class solves the CFD problem
Initialize the fluid solver
This method initialize the Flow object, namely, it creates all the necessary function spaces on the mesh, initializes key counting and boolean variables and records certain characteristic quantities like the minimum cell size and the number of degrees of freedom attributed to both the pressure and velocity function spaces.
- Parameters:
domain (
pvade.geometry.MeshManager.Domain) – A Domain object
- _assemble_system(params)
Pre-assemble all LHS matrices and RHS vectors
Here we pre-assemble all the forms corresponding to the left-hand side matrices and right-hand side vectors once outside the time loop. This will enable us to re-use certain features like the sparsity pattern during the timestepping without any modification of the function calls.
- Parameters:
params (
pvade.Parameters.SimParams) – A SimParams object
- _solver_step_1(params)
Solve step 1: tentative velocity
Here we calculate the tentative velocity which, not guaranteed to be divergence free.
- Parameters:
params (
pvade.Parameters.SimParams) – A SimParams object
- _solver_step_2(params)
Solve step 2: pressure correction
Here we calculate the pressure field that would be required to correct the tentative velocity such that it is divergence free.
- Parameters:
params (
pvade.Parameters.SimParams) – A SimParams object
- _solver_step_3(params)
Solve step 3: velocity update
Here we update the tentative velocity with the effect of the modified, continuity-enforcing pressure field.
- Parameters:
params (
pvade.Parameters.SimParams) – A SimParams object
- _solver_step_4(params)
Solve step 4: Solves for temperature using the advection-diffusion equation
- Parameters:
params (
pvade.Parameters.SimParams) – A SimParams object
- _solver_step_5(params)
Solve step 5: Projects stress onto a tensor function space
- Parameters:
params (
pvade.Parameters.SimParams) – A SimParams object
- adjust_dpdx_for_constant_flux()
Adjust the forcing term,
dpdx, to maintain flowrateHere we calculate what the value of the dolfinx.fem.constant driving pressure/force,
dpdx, should be adjusted to to maintain a dolfinx.fem.constant flux through the domain. This is a useful option if performing a periodic simulation in which the flux will slowly decay due to viscous dissipation. The amount of change indpdxis calculated by comparing the current flux to the flux measured in the initial condition and then employing a PID controller to adjust the driving force to seek the target defined by the initial condition.- Parameters:
None
- build_boundary_conditions(domain, params)
Build the boundary conditions
A method to manage the building of boundary conditions, including the steps of identifying entities on the boundary, marking those degrees of freedom either by the identified facets or a gmsh marker function, and finally assembling a list of Boundary objects that enforce the correct value.
- Parameters:
domain (
pvade.geometry.MeshManager.Domain) – A Domain objectparams (
pvade.Parameters.SimParams) – A SimParams object
- build_forms(domain, params)
Builds all variational statements
This method creates all the functions, expressions, and variational forms that will be needed for the numerical solution of Navier Stokes using a fractional step method. This includes the calculation of a tentative velocity, the calculation of the change in pressure required to correct the tentative velocity to enforce continuity, and the update to the velocity field to reflect this change in pressure.
- Parameters:
domain (
pvade.geometry.MeshManager.Domain) – A Domain objectparams (
pvade.Parameters.SimParams) – A SimParams object
- compute_cfl()
Solve for the CFL number
Using the velocity, timestep size, and cell sizes, we calculate a CFL number at every mesh cell. From that, we select the single highest value of CFL number and record it for the purposes of monitoring simulation stability.
- Parameters:
None
- solve(domain, params, current_time)
Solve for a single timestep advancement
Here we perform the three-step solution process (tentative velocity, pressure correction, velocity update) to advance the fluid simulation a single timestep. Additionally, we calculate the new CFL number associated with the latest velocity solution.
- Parameters:
params (
pvade.Parameters.SimParams) – A SimParams object