Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
ImmersX: embedded & mixed-dimensional simulation framework
Logo
ImmersX: embedded & mixed-dimensional simulation framework
  • Getting started
    • Installation and build
    • First run: Poisson
  • How-to guides
    • Run an application
    • Imported finite-element fields
    • Configure a parameter file
    • Choose boundary conditions
    • Configure reduced coupling
    • Test a documented workflow
    • Vascular-tree elasticity
  • Tutorials
    • Poisson: your first ImmersX simulation
    • Static elasticity
    • Elastodynamics
    • Reduced Poisson
    • Coupled Poisson
    • Coupled Poisson–elasticity
    • Fiber-reinforced elastodynamics
    • Navier–Stokes
    • Tutorial 01: area-to-wall kinematics
    • Tutorial 02: static two-way vessel-wall equilibrium
    • Tutorial 03: spatial manufactured vessel-wall coupling
    • Tutorial 04: transient two-way manufactured solution
  • Concepts
    • Overview
    • Mathematical Background
    • Architecture concepts
    • Application coupling roadmap
  • Reference
    • Application reference
    • Parameter-file reference
    • Verification inputs
    • Library Reference
      • Namespace ImmersX
      • Namespace ImmersX::detail
      • Namespace ImmersX::elastic_static_detail
      • Namespace ImmersX::ImmersXLA
      • Namespace ImmersX::LegacyInclusions
      • Namespace ImmersX::navier_stokes_detail
      • Namespace ImmersX::ReducedFieldUtils
      • Namespace ImmersX::semidiscrete_detail
      • Namespace ImmersX::UtilitiesAL
      • Struct ConstraintFields
      • Template Struct ConstraintSum::Entry
      • Template Struct ConstraintSum::MakeEntryVariant
      • Template Struct CouplingPoint
      • Struct CurlOperation
      • Struct DivergenceOperation
      • Struct ExecutionComposition::Snapshot
      • Struct ExecutionComposition::StateSnapshot
      • Struct GradientOperation
      • Template Struct has_distributed_matrix_reinit
      • Template Struct has_distributed_partitions
      • Template Struct has_in_place_transpose
      • Template Struct has_matrix_compress
      • Template Struct has_raw_tensor_access
      • Template Struct has_reinit_and_copy_from
      • Template Struct has_reinit_dimensions
      • Template Struct has_sparse_reinit
      • Template Struct has_transpose_apply
      • Template Struct is_field
      • Template Struct is_field< Field< dim, spacedim, Extractor > >
      • Template Struct is_lifted_observable
      • Template Struct is_lifted_observable< LiftedObservable< SourceObservable, reduced_dim, surface_dim, spacedim, n_components > >
      • Template Struct is_lifted_observable< TestLiftedObservable< LiftedObservableType > >
      • Template Struct is_linear_observable
      • Template Struct is_linear_observable< Observable< SourceFieldType, Operation > >
      • Template Struct is_observable
      • Template Struct is_observable< LiftedObservable< SourceObservable, reduced_dim, surface_dim, spacedim, n_components > >
      • Template Struct is_observable< Observable< SourceFieldType, Operation > >
      • Template Struct is_supported_operation
      • Template Struct is_tensor
      • Template Struct is_test_expression
      • Template Struct is_test_expression< TestExpression< SourceFieldType, Operation > >
      • Template Struct is_test_expression< TestLiftedObservable< LiftedObservableType > >
      • Template Struct is_transformed_observable
      • Template Struct is_weak_term
      • Template Struct is_weak_term< WeakTerm< ObservableType, TargetField > >
      • Template Struct LiftedSourceStencil
      • Template Struct LiftedTargetWeakAssembly
      • Template Struct LiftedTargetWeakAssembly::MatrixStorage
      • Template Struct LiftedWeakAssembly
      • Template Struct NonlinearWeakAssembly
      • Template Struct NonlinearWeakAssembly::has_distributed_reinit
      • Template Struct NonlinearWeakAssembly::MatrixStorage
      • Struct SymmetricGradientOperation
      • Struct ValueOperation
      • Template Struct WeakAssembly
      • Template Struct WeakAssembly::MatrixStorage
      • Template Struct WeakAssembly::PreparedMatrix
      • Struct DimensionParameters
      • Struct ElasticStaticFields
      • Struct ElastodynamicsFields
      • Struct FiberReinforcedElastodynamicsResiduals
      • Struct Field::ExecutionLayout
      • Struct FieldDescriptor
      • Template Struct ImmersedRepartitionerStorage
      • Template Struct ImmersedRepartitionerStorage< 0, spacedim >
      • Struct ImportedFiniteElementFields::Storage
      • Struct InputFieldBinding
      • Struct LinearAdapterParameters
      • Template Struct LinearHistoryInterpolation
      • Template Struct LinearHistoryInterpolation< double >
      • Template Struct MaterializedOperator
      • Struct MaterialProperties
      • Template Struct NavierStokesFields
      • Template Struct PointCloud
      • Template Struct PoissonFields
      • Struct ReducedFieldDescriptor
      • Template Struct RefinementParameters
      • Template Struct RefinementParameters< 0 >
      • Template Struct SaddlePointMetadata
      • Struct SemiDiscreteModel::OperatorEntry
      • Struct SemiDiscreteModel::ResidualEntry
      • Struct StateHistory::Snapshot
      • Template Struct TensorProductLiftParameters
      • Template Struct TensorProductLiftPoint
      • Template Struct TensorProductSpaceParameters
      • Template Struct WeakTerm::Pairing
      • Template Class BlockPreconditionerAugmentedLagrangian
      • Template Class Constraint
      • Template Class ConstraintSum
      • Class CumulativeReductionControl
      • Class CumulativeSolverControl
      • Template Class BlockFieldLayout
      • Template Class ExecutionComposition
      • Template Class DistributedLiftedQuadrature
      • Template Class ElasticityProblem
      • Template Class ElasticityProblemParameters
      • Template Class ElasticStaticParameters
      • Template Class ElasticStaticProblem
      • Template Class ElastodynamicsParameters
      • Template Class ElastodynamicsSolver
      • Template Class EvaluationContext
      • Template Class FESpaceView
      • Template Class FESubspaceView
      • Template Class FiberReinforcedElastodynamics
      • Template Class FiberReinforcedElastodynamicsParameters
      • Template Class Field
      • Class FieldId
      • Class FixedStepParameters
      • Class HistoryGroupId
      • Class IDAParameters
      • Template Class ImmersedRepartitioner
      • Template Class ImportedFiniteElementFields
      • Class ImportedFiniteElementFields::FieldView
      • Template Class Inclusions
      • Class InputFieldSelector
      • Template Class LagrangeMultiplierConstraintSolver
      • Class LagrangeMultiplierConstraintSolver::SchurComplementOperator
      • Template Class LagrangeMultiplierSchurSolver
      • Class LagrangeMultiplierSchurSolver::SchurComplementOperator
      • Template Class LiftedObservable
      • Template Class LinearAdapter
      • Template Class MatrixFreeCouplingOperator
      • Template Class MetricFlowXVesselWallConstraint
      • Template Class ModulatedParsedFunction
      • Template Class NavierStokesParameters
      • Template Class NavierStokesSolver
      • Template Class NormalGeometry
      • Template Class NormalQuantity
      • Template Class NormalWeakTerm
      • Template Class Observable
      • Template Class OwnedFESpace
      • Template Class ParticleCoupling
      • Template Class ParticleCouplingParameters
      • Template Class PoissonParameters
      • Template Class PoissonProblem
      • Template Class PoissonSolver
      • Template Class ProblemHandle
      • Template Class ProblemParameters
      • Template Class ReducedCoupling
      • Template Class ReducedCouplingParameters
      • Template Class ReducedFieldValues
      • Template Class ReducedPoisson
      • Template Class ReducedPoissonParameters
      • Template Class ReferenceCrossSection
      • Template Class ReferenceCrossSectionParameters
      • Template Class RigidBodyMotion
      • Template Class SemidiscreteBuilder
      • Template Class SemiDiscreteModel
      • Template Class SemidiscreteTerm
      • Template Class StateAccessor
      • Template Class StateHistory
      • Template Class StateHistoryRegistry
      • Class StateLayout
      • Template Class StateView
      • Class SymbolicExpressionKernel
      • Class SymbolicFieldEvaluator
      • Template Class TensorProductLift
      • Template Class TensorProductLiftSupport
      • Template Class TensorProductSpace
      • Template Class TensorProductSpace< 0, dim, spacedim, n_components >
      • Class TermSelection
      • Template Class TestExpression
      • Template Class TestLiftedObservable
      • Class TimeIntervalParameters
      • Class TimeParameters
      • Template Class BlockPreconditionerAugmentedLagrangian
      • Template Class WeakTerm
      • Enum CouplingType
      • Enum ElasticityModel
      • Enum FieldAssociation
      • Enum LinearPreconditioner
      • Enum LinearSolver
      • Enum PointCloudDistribution
      • Enum TermTreatment
      • Enum TimeMode
      • Template Function ImmersX::adjust_grids
      • Template Function ImmersX::curl(const FieldType&)
      • Template Function ImmersX::curl(const Observable<SourceFieldType, Operation>&)
      • Template Function ImmersX::curl(const TestExpression<SourceFieldType, Operation>&)
      • Function ImmersX::declare_dimension_parameters
      • Template Function ImmersX::detail::apply_stencils(const std::vector<PointType>&, const std::vector<TargetIndexType>&, const dealii::IndexSet&, const dealii::IndexSet&, const dealii::AffineConstraints<double> *, const MPI_Comm, const SourceVectorType&, TargetVectorType&, DofIndices, Coefficient, const bool, const bool)
      • Template Function ImmersX::detail::apply_stencils(const std::vector<PointType>&, const std::vector<TargetIndexType>&, const dealii::IndexSet&, const dealii::IndexSet&, const dealii::IndexSet&, const dealii::IndexSet&, const dealii::AffineConstraints<double> *, const MPI_Comm, const SourceVectorType&, TargetVectorType&, DofIndices, Coefficient, const bool, const bool)
      • Template Function ImmersX::detail::apply_stencils_transpose
      • Template Function ImmersX::detail::apply_tensor_product_lift(const std::vector<PointType>&, const std::vector<IndexType>&, const std::vector<std::vector<IndexType>>&, const VectorType&, VectorType&, const bool, const bool)
      • Template Function ImmersX::detail::apply_tensor_product_lift(const std::vector<PointType>&, const std::vector<IndexType>&, const std::vector<std::vector<IndexType>>&, const VectorType&, VectorType&, const bool, const bool, const dealii::IndexSet&, const dealii::IndexSet&, const MPI_Comm)
      • Template Function ImmersX::detail::clone_matrix
      • Template Function ImmersX::detail::compress_weak_matrix
      • Template Function ImmersX::detail::constraint_entry_index
      • Template Function ImmersX::detail::copy_matrix
      • Template Function ImmersX::detail::evaluate_stencil(const VectorType&, const std::vector<dealii::types::global_dof_index>&, const std::vector<double>&)
      • Template Function ImmersX::detail::evaluate_stencil(const VectorType&, const PointType&, DofIndices, Coefficient)
      • Template Function ImmersX::detail::flatten_value
      • Template Function ImmersX::detail::initialize_weak_matrix
      • Template Function ImmersX::detail::make_matrix_with_sparsity
      • Template Function ImmersX::detail::make_multiplier_metric
      • Template Function ImmersX::detail::make_normal_load_operator
      • Template Function ImmersX::detail::make_relevant_stencil_source
      • Template Function ImmersX::detail::make_sparsity
      • Template Function ImmersX::detail::make_tensor_product_quadrature
      • Template Function ImmersX::detail::make_transformed_observable
      • Template Function ImmersX::detail::n_stored_components
      • Function ImmersX::detail::normalize_lift_subsection
      • Template Function ImmersX::detail::reference_to_physical_rotation
      • Template Function ImmersX::detail::set_matrix_values
      • Template Function ImmersX::detail::sum_matrices
      • Template Function ImmersX::detail::transform_representative_point
      • Template Function ImmersX::detail::transpose_matrix
      • Template Function ImmersX::detail::unflatten_value
      • Template Function ImmersX::divergence(const FieldType&)
      • Template Function ImmersX::divergence(const Observable<SourceFieldType, Operation>&)
      • Template Function ImmersX::divergence(const TestExpression<SourceFieldType, Operation>&)
      • Function ImmersX::elastic_static_detail::normalize_subsection
      • Template Function ImmersX::evaluate_thickness_values
      • Template Function ImmersX::fe_space(const dealii::DoFHandler<dim, spacedim>&, const dealii::Mapping<dim, spacedim>&, const dealii::AffineConstraints<double>&, const dealii::IndexSet *)
      • Template Function ImmersX::fe_space(const dealii::DoFHandler<dim, spacedim>&, const dealii::Mapping<dim, spacedim>&, const dealii::AffineConstraints<double>&, const dealii::IndexSet&)
      • Template Function ImmersX::frozen
      • Function ImmersX::get_dimension_parameters(const ParameterHandler&)
      • Function ImmersX::get_dimension_parameters(const std::string&)
      • Template Function ImmersX::gradient(const FieldType&)
      • Template Function ImmersX::gradient(const Observable<SourceFieldType, Operation>&)
      • Template Function ImmersX::gradient(const TestExpression<SourceFieldType, Operation>&)
      • Template Function ImmersX::initialize_elastodynamics_adapter_state
      • Function ImmersX::initialize_parameters
      • Function ImmersX::initialize_parameters_from_string
      • Function ImmersX::LegacyInclusions::fourier_to_reference_indices
      • Function ImmersX::LegacyInclusions::fourier_to_reference_scale
      • Function ImmersX::LegacyInclusions::read_2d
      • Function ImmersX::LegacyInclusions::read_3d
      • Template Function ImmersX::lift(const SourceObservable&, const TensorProductLift<reduced_dim, surface_dim, spacedim, n_components>&)
      • Template Function ImmersX::lift(const SourceObservable&, const TensorProductLift<reduced_dim, surface_dim, spacedim, n_components>&, SourceThicknessEvaluator<spacedim>)
      • Template Function ImmersX::make_amg_preconditioner
      • Template Function ImmersX::make_constraint(ConstraintSum<Terms…>, Rhs&&)
      • Template Function ImmersX::make_constraint(ConstraintSum<Terms…>)
      • Template Function ImmersX::make_constraint(Term)
      • Template Function ImmersX::make_constraint(Term, Rhs&&)
      • Template Function ImmersX::make_lift(const SourceObservable&, const TensorProductLift<reduced_dim, surface_dim, spacedim, n_components>&)
      • Template Function ImmersX::make_lift(const SourceObservable&, const TensorProductLift<reduced_dim, surface_dim, spacedim, n_components>&, SourceThicknessEvaluator<spacedim>)
      • Template Function ImmersX::make_local_preconditioner
      • Template Function ImmersX::matrix_operator
      • Template Function ImmersX::navier_stokes_detail::make_block_field
      • Template Function ImmersX::normal
      • Template Function ImmersX::operator*(const double, const MaterializedOperator<VectorType, MatrixType>&)
      • Template Function ImmersX::operator*(const MaterializedOperator<VectorType, MatrixType>&, const double)
      • Template Function ImmersX::operator*(Left, Right)
      • Template Function ImmersX::operator*(const double, Expression)
      • Template Function ImmersX::operator*(Expression, const double)
      • Template Function ImmersX::operator*(const double, TestExpression<SourceFieldType, Operation>)
      • Template Function ImmersX::operator*(TestExpression<SourceFieldType, Operation>, const double)
      • Template Function ImmersX::operator*(Quantity, NormalGeometry<Surface>)
      • Template Function ImmersX::operator+(Lhs, Rhs)
      • Template Function ImmersX::operator+(ConstraintSum<LhsTerms…>, ConstraintSum<RhsTerms…>)
      • Template Function ImmersX::operator+(ConstraintSum<Terms…>, NewTerm)
      • Template Function ImmersX::operator+(Left, Right)
      • Template Function ImmersX::operator-(Lhs, Rhs)
      • Template Function ImmersX::operator-(ConstraintSum<LhsTerms…>, ConstraintSum<RhsTerms…>)
      • Template Function ImmersX::operator-(ConstraintSum<Terms…>, NewTerm)
      • Template Function ImmersX::operator-(Left, Right)
      • Template Function ImmersX::operator-(Expression)
      • Template Function ImmersX::operator/
      • Template Function ImmersX::output_augmented_lagrangian_iteration_summary
      • Template Function ImmersX::payload_free
      • Template Function ImmersX::read_grid_and_cad_files
      • Template Function ImmersX::ReducedFieldUtils::data_to_dealii_vector
      • Template Function ImmersX::ReducedFieldUtils::distributed_to_serial_vertex_indices
      • Template Function ImmersX::ReducedFieldUtils::field_catalog_to_finite_element
      • Template Function ImmersX::ReducedFieldUtils::get_block_indices
      • Template Function ImmersX::ReducedFieldUtils::serial_vector_to_distributed_vector(const dealii::DoFHandler<dim, spacedim>&, const dealii::DoFHandler<dim, spacedim>&, const dealii::Vector<double>&, dealii::LinearAlgebra::distributed::Vector<double>&)
      • Template Function ImmersX::ReducedFieldUtils::serial_vector_to_distributed_vector(const dealii::DoFHandler<dim, spacedim>&, const dealii::DoFHandler<dim, spacedim>&, const dealii::Vector<double>&, ImmersXLA::MPI::Vector&)
      • Template Function ImmersX::refine_space_around_points
      • Function ImmersX::reset_parameter_handler_to_root
      • Template Function ImmersX::semidiscrete_detail::add_matrix_product
      • Template Function ImmersX::semidiscrete_detail::constrained_identity_operator
      • Template Function ImmersX::semidiscrete_detail::constrained_matrix_identity_operator
      • Template Function ImmersX::semidiscrete_detail::constrained_matrix_operator
      • Template Function ImmersX::semidiscrete_detail::constrained_matrix_operator_with_identity
      • Template Function ImmersX::semidiscrete_detail::constrained_operation
      • Template Function ImmersX::semidiscrete_detail::constrained_operator
      • Template Function ImmersX::semidiscrete_detail::constrained_operator_with_identity
      • Template Function ImmersX::semidiscrete_detail::constrained_residual
      • Template Function ImmersX::semidiscrete_detail::mixed_constrained_matrix_operator
      • Template Function ImmersX::semidiscrete_detail::mixed_constrained_operation
      • Template Function ImmersX::semidiscrete_detail::mixed_constrained_operator
      • Template Function ImmersX::semidiscrete_detail::zero_constrained
      • Template Function ImmersX::semidiscrete_detail::zero_mixed_constrained
      • Template Function ImmersX::symmetric_gradient(const FieldType&)
      • Template Function ImmersX::symmetric_gradient(const Observable<SourceFieldType, Operation>&)
      • Template Function ImmersX::symmetric_gradient(const TestExpression<SourceFieldType, Operation>&)
      • Template Function ImmersX::test(const FieldType&)
      • Template Function ImmersX::test(const LiftedObservableType&)
      • Function ImmersX::throw_unsupported_dimension_combination
      • Template Function ImmersX::transform
      • Template Function ImmersX::transpose_operator
      • Template Function ImmersX::UtilitiesAL::create_augmented_block
      • Template Function ImmersX::UtilitiesAL::set_null_space
      • Template Function ImmersX::value(const FieldType&)
      • Template Function ImmersX::value(const Observable<SourceFieldType, Operation>&)
      • Template Function ImmersX::value(const TestExpression<SourceFieldType, Operation>&)
      • Template Function ImmersX::weak_term(Trial, Test)
      • Template Function ImmersX::weak_term(NormalQuantity<Quantity, Surface>, TargetField)
      • Template Function ImmersX::weak_term(NormalQuantity<Quantity, Surface>, TestExpression<SourceFieldType, Operation>)
      • Variable ImmersX::detail::dependent_false
      • Variable ImmersX::detail::is_scalar_value
      • Variable ImmersX::detail::is_supported_transport_value
      • Define augmented_lagrangian_prec_h
      • Typedef ImmersX::FieldCatalog
      • Typedef ImmersX::ImportedFieldView
      • Typedef ImmersX::LinearSolverParameters
      • Typedef ImmersX::SourceThicknessEvaluator
      • Typedef ObserverPointer
  • Developer documentation
    • Contributing
    • Testing
    • Documentation
    • Repository layout
    • Constraints and interactions
    • Residual execution with IDA and KINSOL
  • Changes and investigations
    • Issue 203: constrained elastodynamics investigation
    • PR 204: transient-time refactor
    • PR 202: elastodynamics MMS validation
    • PR 201: DebugRelease build variants
  • About ImmersX
    • References
    • Funding
Back to top
View this page
Edit this page

Navier–Stokes¶

This tutorial introduces the full-dimensional NavierStokesSolver Problem through the public IDAAdapter application path. It is ready to be composed with other Problems at the execution-adapter boundary while remaining independent of elasticity and immersed coupling in this example.

The runnable example is:

  • tutorials/navier_stokes/transient_2d.prm.in

The implementation follows the fluid formulation used by deal.II step-80. The application contains no solid or immersed-coupling branch.

The problem¶

On a full-dimensional domain \(\Omega\), the solver advances velocity \(u\) and pressure \(p\) for the incompressible system

\[\begin{split}\begin{aligned} \rho\left(\partial_t u + (u\cdot\nabla)u\right) - \nabla\cdot\left(2\nu\,\varepsilon(u)\right) + \nabla p &= \rho f, \\ \nabla\cdot u &= 0, \end{aligned}\end{split}\]

where

\[\varepsilon(u) = \tfrac12\left(\nabla u + \nabla u^T\right).\]

The implementation currently supports dim = spacedim = 2 and dim = spacedim = 3. Surface or embedded Navier–Stokes problems are not supported by this solver.

Finite elements and native blocks¶

The default example uses a Taylor–Hood-like pair:

  • FE_Q(2) for the velocity;

  • FE_Q(1) for the pressure.

Component-wise DoF renumbering gives one native two-block system:

[ A   B^T ] [ u ] = [ velocity RHS ]
[ B     0 ] [ p ]   [ pressure RHS ]

The pressure-pressure block has no physical pressure mass term. The constant pressure nullspace is removed by constraining one pressure DoF to zero. This normalization fixes the pressure gauge without adding a multiplier block.

Time discretization¶

Each step uses backward Euler for the mass and viscous terms. Given the accepted state \(u^n\), the assembled velocity equation contains

\[\frac{\rho}{\Delta t}(u^{n+1},v) + 2\nu(\varepsilon(u^{n+1}),\varepsilon(v)) - (p^{n+1},\nabla\cdot v),\]

and the incompressibility equation contributes

\[(\nabla\cdot u^{n+1},q).\]

When Include convective term = true, the convective velocity is lagged at the accepted previous state and moved to the right-hand side:

\[-\rho\left((u^n\cdot\nabla)u^n,v\right).\]

Setting the option to false gives the unsteady Stokes limit. No nonlinear Newton iteration, ALE motion, or multirate time integration is introduced by this tutorial.

Solver lifecycle¶

The application owns setup and registers the Problem directly with IDAAdapter:

  1. make_grid() creates the distributed triangulation;

  2. setup_fe() builds the mixed velocity-pressure finite element;

  3. setup_system() creates the native block matrix, mass matrix, vectors, and constraints;

  4. IDA evaluates the semantic residual and Jacobian using velocity as a differential Field and pressure as an algebraic Field;

  5. an accepted-state callback calls accept_state() and then output_results() at the configured frequency.

The solver still exposes its standalone backward-Euler methods for focused physics and regression tests, but the published application does not hide its execution policy behind run().

The linear solve uses FGMRES on the indefinite block system. The velocity block and pressure mass approximation have separate AMG preconditioners. The distributed triangulation and block vectors work with MPI from the beginning.

Running the tutorial¶

Build the project, then run the example from the repository root:

CCACHE_DIR=/Users/heltai/.ccache cmake --build build --target navier_stokes_debug -j2
./build/navier_stokes_debug build/tutorials/navier_stokes/transient_2d.prm

The Release executable is named ./build/navier_stokes. The example writes a time series under build/test_output/tutorial-output/navier-stokes-2d and emits visualization output every Output time interval units of physical time. For a parallel run, use two MPI ranks:

mpirun -np 2 ./build/navier_stokes_debug build/tutorials/navier_stokes/transient_2d.prm

The application synchronizes the ranks before releasing the solver resources, so the same lifecycle is valid for serial and MPI execution.

The application reads dimension and space dimension before constructing the statically typed solver. The parameter-file name does not select the dimension:

dimension = 2, space dimension = 2  -> NavierStokesSolver<2>
dimension = 3, space dimension = 3  -> NavierStokesSolver<3>

Parameter-file choices¶

The top-level Navier-Stokes subsection contains:

  • Finite element spaces: velocity and pressure polynomial degrees;

  • Grid generation: generator, arguments, and distributed triangulation;

  • Physical properties: Density, Viscosity, and the explicit-convection toggle;

  • Time interval: initial/final time and the physical output interval;

  • Fixed step: either a fixed timestep or a prescribed number of steps; policy;

  • Right hand side, Dirichlet boundary conditions, and Initial condition: parsed vector functions with dim + 1 components, where the last component is pressure and is ignored for velocity data;

  • Solver: outer FGMRES and inner block-solver controls.

Velocity Dirichlet data is applied on the boundary ids listed in Dirichlet boundary ids. The parsed functions are updated to the current time before each step, so nonzero time-dependent velocity data is handled in the constraints for that step.

The complete input file used by this tutorial is:

set dimension       = 2
set space dimension = 2

subsection Navier-Stokes
  set Output directory       = @TEST_OUTPUT_DIR@/tutorial-output/navier-stokes-2d
  set Output name            = transient_stokes
  set Initial refinement     = 2
  set Dirichlet boundary ids = 0

  subsection Finite element spaces
    set Velocity degree = 2
    set Pressure degree = 1
  end

  subsection Grid generation
    set Grid generator           = hyper_cube
    set Grid generator arguments = -1: 1: false
    set Triangulation type       = distributed
  end

  subsection Physical properties
    set Density                 = 1
    set Viscosity               = 1
    set Include convective term = true
  end

  subsection Time interval
    set Initial time         = 0
    set Final time           = 0.1
    set Output time interval = 0.02
  end
  subsection Fixed step
    set Policy               = number_of_steps
    set Time step            = 0.01
    set Number of time steps = 10
  end

  subsection Right hand side
    set Function expression = 1; 0; 0
    set Variable names      = x,y,t
  end

  subsection Dirichlet boundary conditions
    set Function expression = 0; 0; 0
    set Variable names      = x,y,t
  end

  subsection Initial condition
    set Function expression = 0; 0; 0
    set Variable names      = x,y,t
  end

  subsection Solver
    subsection Control
      set Max steps  = 500
      set Reduction  = 1.e-9
      set Tolerance  = 1.e-11
      set Log result = false
    end
    set Inner maximum steps = 500
    set Inner tolerance     = 1.e-10
    set Log iterations      = false
  end
end

Manufactured-solution validation¶

The step-80-inspired MMS regression is kept with the tests rather than making the application depend on a verification-only workflow:

mkdir -p build/test_directory
(cd build/test_directory && \
  mpirun -np 2 ../gtests/gtests_debug \
  --gtest_filter='NavierStokes.Step80ManufacturedSolutionConvergence-*.MPI_*')

The test uses ParsedConvergenceTable and the parameter file gtests/parameters/navier_stokes_step80_mms_2d.prm. It reports the velocity L2 error and computes rates with respect to DoFs. With Q2 velocity, the observed rates are approximately three.

Source files¶

The application is implemented in:

  • apps/app_navier_stokes.cc — MPI initialization and 2D/3D dispatch;

  • include/immersx/physics/navier_stokes.h — parameter and solver interfaces;

  • source/navier_stokes.cc — mesh setup, mixed assembly, block solve, time-stepping, and output;

  • gtests/navier_stokes_01.cc — setup and transient Stokes/Navier–Stokes coverage;

  • gtests/navier_stokes_step80_mms_01.cc — manufactured-solution convergence;

  • tutorials/navier_stokes/transient_2d.prm.in — the runnable tutorial input.

The Problem exposes semantic velocity and pressure Fields with distinct differential/algebraic metadata, so it can participate in larger compositions without moving IDA-specific policy into the physics class.

Next
Tutorial 01: area-to-wall kinematics
Previous
Fiber-reinforced elastodynamics
Copyright ©
Made with Sphinx and @pradyunsg's Furo
On this page
  • Navier–Stokes
    • The problem
    • Finite elements and native blocks
    • Time discretization
    • Solver lifecycle
    • Running the tutorial
    • Parameter-file choices
    • Manufactured-solution validation
    • Source files