diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 6c56975b..58b7d75e 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-08T10:55:08","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-09T11:35:00","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/VV/2d-constant-temperature-flat-plate/index.html b/dev/VV/2d-constant-temperature-flat-plate/index.html index 578612fc..81388c35 100644 --- a/dev/VV/2d-constant-temperature-flat-plate/index.html +++ b/dev/VV/2d-constant-temperature-flat-plate/index.html @@ -90,4 +90,4 @@ initialise!(model.momentum.p, 100000.0) initialise!(model.energy.T, 300.0) -Rx, Ry, Rz, Rp, Re, model_out = run!(model, config)

Results


The results of the model are compared to the theoretical correlation in the figure below:

Nusselt number distribution results.

+Rx, Ry, Rz, Rp, Re, model_out = run!(model, config)

Results


The results of the model are compared to the theoretical correlation in the figure below:

Nusselt number distribution results.

diff --git a/dev/VV/2d-isothermal-backward-facing-step/index.html b/dev/VV/2d-isothermal-backward-facing-step/index.html index d4fd2feb..5b7ec0dd 100644 --- a/dev/VV/2d-isothermal-backward-facing-step/index.html +++ b/dev/VV/2d-isothermal-backward-facing-step/index.html @@ -1,2 +1,2 @@ -2D incompressible flat plate · XCALibre.jl
+2D incompressible flat plate · XCALibre.jl
diff --git a/dev/contributor_guide/index.html b/dev/contributor_guide/index.html index e416981b..daf90ebc 100644 --- a/dev/contributor_guide/index.html +++ b/dev/contributor_guide/index.html @@ -1,2 +1,2 @@ -Contributor Guide · XCALibre.jl
+Contributor Guide · XCALibre.jl
diff --git a/dev/index.html b/dev/index.html index acce774b..4c5ec63e 100644 --- a/dev/index.html +++ b/dev/index.html @@ -6,4 +6,4 @@ == -Source(∇p.result) - ) → VectorEquation(mesh)

Planned development


Capabilities, solvers, algorithms, models, etc.

API

Internals

Main dependencies


XCALibre.jl is possible (and relies) on the functionality provided by other packages in the Julia ecosystem. For a full list of direct dependencies please refer to the Project.toml file included with this repository. We are thankful to the teams that have helped develop and maintain every single of our dependencies. Major functionally is provided by the following:


There are other wonderful fluids simulation packages available in the Julia ecosystems (please let us know if we missed any):

+ ) → VectorEquation(mesh)

Planned development


Capabilities, solvers, algorithms, models, etc.

API

Internals

Main dependencies


XCALibre.jl is possible (and relies) on the functionality provided by other packages in the Julia ecosystem. For a full list of direct dependencies please refer to the Project.toml file included with this repository. We are thankful to the teams that have helped develop and maintain every single of our dependencies. Major functionally is provided by the following:


There are other wonderful fluids simulation packages available in the Julia ecosystems (please let us know if we missed any):

diff --git a/dev/objects.inv b/dev/objects.inv index 76fe0f5b..75d3a2e8 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/quick_start/index.html b/dev/quick_start/index.html index 622db534..6de45f6d 100644 --- a/dev/quick_start/index.html +++ b/dev/quick_start/index.html @@ -91,7 +91,7 @@ initialise!(model.momentum.p, 0.0) # Step 11. Run simulation -Rx, Ry, Rz, Rp, model_out = run!(model, config); +residuals = run!(model, config); # Step 12. Post-process -pwd() # find active directory where the file "iteration_002000.vtk" was saved

Output

If you chose to run the example above, XCALibre.jl would have written a simulation result file to your computer. The name of the file is iteration_002000.vtk. The file will be located in your current active directory (you can check this by running pwd()). This file can be open directly in ParaView for further post-processing. You can find out more about ParaView on their website. The image below is the output solution generated by XCALibre.j to the example simulation above.

Simulation result visualisation in ParaView

+pwd() # find active directory where the file "iteration_002000.vtk" was saved

Output

If you chose to run the example above, XCALibre.jl would have written a simulation result file to your computer. The name of the file is iteration_002000.vtk. The file will be located in your current active directory (you can check this by running pwd()). This file can be open directly in ParaView for further post-processing. You can find out more about ParaView on their website. The image below is the output solution generated by XCALibre.j to the example simulation above.

Simulation result visualisation in ParaView

diff --git a/dev/reference/index.html b/dev/reference/index.html index b90eefbc..3e29851b 100644 --- a/dev/reference/index.html +++ b/dev/reference/index.html @@ -1,9 +1,13 @@ -Reference · XCALibre.jl

Reference

XCALibre.Discretise.DirichletType
Dirichlet <: AbstractDirichlet

Dirichlet boundary condition model.

Fields

  • 'ID' – Boundary ID
  • value – Scalar or Vector value for Dirichlet boundary condition.
source
XCALibre.Discretise.FixedTemperatureType
FixedTemperature <: AbstractDirichlet

Fixed temperature boundary condition model, which allows the user to specify wall temperature that can be translated to the energy specific model, such as sensivle enthalpy.

Fields

  • 'ID' – Boundary ID
  • value – Scalar or Vector value for Dirichlet boundary condition.
  • T - Temperature value in Kelvin.
  • model - Energy physics model for case.

Examples

FixedTemperature(:inlet, T=300.0, model=model.energy),
source
XCALibre.Discretise.NeumannType
Neumann <: AbstractNeumann

Neumann boundary condition model (currently only configured for zero gradient)

Fields

  • 'ID' – Boundary ID
  • value – Scalar or Vector value for Neumann boundary condition.
source
XCALibre.Discretise.PeriodicType
struct Periodic{I,V} <: AbstractPhysicalConstraint
+Reference · XCALibre.jl

Reference

XCALibre.Fields.initialise!Method
function initialise!(field, value) # dummy function for documentation
+    # Assign `value` to field in-place
+    nothing
+end

This function will set the given field to the value provided in-place. Useful for initialising fields prior to running a simulation.

Input arguments

  • field specifies the field to be initialised. The field must be either a AbractScalarField or AbstractVectorField
  • value defines the value to be set. This should be a scalar or vector (3 components) depending on the field to be modified e.g. for an AbstractVectorField we can specify as value=[10,0,0]

Note: in most cases the fields to be modified are stored within a physics model i.e. a Physics object. Thus, the argument value must fully qualify the model. For example, if we have created a Physics model named mymodel to set the velocity field, U, we would set the argument field to mymodel.momentum.U. See the example below.

Example

initialise!(mymodel.momentum.U, [2.5, 0, 0])
+initialise!(mymodel.momentum.p, 1.25)
source
XCALibre.Discretise.DirichletType
Dirichlet <: AbstractDirichlet

Dirichlet boundary condition model.

Fields

  • 'ID' – Boundary ID
  • value – Scalar or Vector value for Dirichlet boundary condition.
source
XCALibre.Discretise.FixedTemperatureType
FixedTemperature <: AbstractDirichlet

Fixed temperature boundary condition model, which allows the user to specify wall temperature that can be translated to the energy specific model, such as sensivle enthalpy.

Fields

  • 'ID' – Boundary ID
  • value – Scalar or Vector value for Dirichlet boundary condition.
  • T - Temperature value in Kelvin.
  • model - Energy physics model for case.

Examples

FixedTemperature(:inlet, T=300.0, model=model.energy),
source
XCALibre.Discretise.NeumannType
Neumann <: AbstractNeumann

Neumann boundary condition model (currently only configured for zero gradient)

Fields

  • 'ID' – Boundary ID
  • value – Scalar or Vector value for Neumann boundary condition.
source
XCALibre.Discretise.PeriodicType
struct Periodic{I,V} <: AbstractPhysicalConstraint
     ID::I
     value::V
-end

Periodic boundary condition model.

Fields

  • 'ID' – Boundary ID
  • value – tuple containing information needed to apply this boundary
source
XCALibre.Discretise.construct_periodicMethod
construct_periodic(mesh, backend, patch1::Symbol, patch2::Symbol)

Function for construction of periodic boundary conditions.

Input

  • mesh – Mesh.
  • backend – Backend configuraton.
  • patch1 – Primary periodic patch ID.
  • patch2 – Neighbour periodic patch ID.

Output

  • periodic::Tuple - tuple containing boundary defintions for patch1 and patch2 i.e. (periodic1, periodic2). The fields of periodic1 and periodic2 are

    • ID – Index to access boundary information in mesh object
    • value – represents a NamedTuple with the following keyword arguments:
      • index – ID used to find boundary geometry information in the mesh object
      • distance – perpendicular distance between the patches
      • face_map – vector providing indeces to faces of match patch
      • ismaster – flat to identify one of the patch pairs as the main patch

Example

- `periodic = construct_periodic(mesh, CPU(), :top, :bottom)` - Example using CPU 
-backend with periodic boundaries named `top` and `bottom`.
source
XCALibre.Discretise.set_schemesMethod
set_schemes(;
+end

Periodic boundary condition model.

Fields

  • 'ID' – Boundary ID
  • value – tuple containing information needed to apply this boundary
source
XCALibre.Discretise.construct_periodicMethod
construct_periodic(mesh, backend, patch1::Symbol, patch2::Symbol)

Function for construction of periodic boundary conditions.

Input

  • mesh – Mesh.
  • backend – Backend configuraton.
  • patch1 – Primary periodic patch ID.
  • patch2 – Neighbour periodic patch ID.

Output

  • periodic::Tuple - tuple containing boundary defintions for patch1 and patch2 i.e. (periodic1, periodic2). The fields of periodic1 and periodic2 are

    • ID – Index to access boundary information in mesh object
    • value – represents a NamedTuple with the following keyword arguments:
      • index – ID used to find boundary geometry information in the mesh object
      • distance – perpendicular distance between the patches
      • face_map – vector providing indeces to faces of match patch
      • ismaster – flat to identify one of the patch pairs as the main patch

Example

- `periodic = construct_periodic(mesh, CPU(), :top, :bottom)` - Example using CPU 
+backend with periodic boundaries named `top` and `bottom`.
source
XCALibre.Discretise.set_schemesMethod
set_schemes(;
     # keyword arguments and their default values
     time=SteadyState,
     divergence=Linear, 
@@ -17,7 +21,7 @@
         laplacian=laplacian,
         gradient=gradient
     )
-end

The set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.

inputs

  • time is used to set the time schemes(default is SteadyState)
  • divergence is used to set the divergence scheme (default is Linear)
  • laplacian is used to set the laplacian scheme (default is Linear)
  • gradient is used to set the gradient scheme (default is Orthogonal)
source
XCALibre.Solve.set_runtimeMethod
set_runtime(; 
+end

The set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.

inputs

  • time is used to set the time schemes(default is SteadyState)
  • divergence is used to set the divergence scheme (default is Linear)
  • laplacian is used to set the laplacian scheme (default is Linear)
  • gradient is used to set the gradient scheme (default is Orthogonal)
source
XCALibre.Solve.set_runtimeMethod
set_runtime(; 
     # keyword arguments
     iterations::I, 
     write_interval::I, 
@@ -29,8 +33,8 @@
         iterations=iterations, 
         dt=time_step, 
         write_interval=write_interval)
-end

This is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.

Input arguments

  • iterations::Integer specifies the number of iterations in a simulation run.
  • write_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.
  • time_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.

Example

runtime = set_runtime(
-    iterations=2000, time_step=1, write_interval=2000)
source
XCALibre.Solve.set_solverMethod
set_solver( 
+end

This is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.

Input arguments

  • iterations::Integer specifies the number of iterations in a simulation run.
  • write_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.
  • time_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.

Example

runtime = set_runtime(
+    iterations=2000, time_step=1, write_interval=2000)
source
XCALibre.Solve.set_solverMethod
set_solver( 
     field::AbstractField;
     # keyword arguments and defaults
     solver::S, 
@@ -55,11 +59,11 @@
         atol=atol |> TF, 
         rtol=rtol |> TF
     )
-end

This function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers.

Input arguments

  • field reference to the field to which the solver settings will apply (used to provide integer and float types required)
  • solver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl
  • preconditioner instance of preconditioner to be used e.g. Jacobi()
  • convergence sets the stopping criteria of this field
  • relax specifies the relaxation factor to be used e.g. set to 1 for no relaxation
  • limit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()
  • itmax maximum number of iterations in a single solver pass (defaults to 100)
  • atol absolute tolerance for the solver (default to eps(FloatType)^0.9)
  • rtol set relative tolerance for the solver (defaults to 1e-3)
source
XCALibre.ModelPhysics.CompressibleType
Compressible <: AbstractCompressible

Compressible fluid model containing fluid field parameters for compressible flows with constant parameters - ideal gas with constant viscosity.

Fields

  • 'nu' – Fluid kinematic viscosity.
  • 'cp' – Fluid specific heat capacity.
  • gamma – Ratio of specific heats.
  • Pr – Fluid Prantl number.

Examples

  • Fluid{Compressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructur with default values.
source
XCALibre.ModelPhysics.IncompressibleType
Incompressible <: AbstractIncompressible

Incompressible fluid model containing fluid field parameters for incompressible flows.

Fields

  • 'nu' – Fluid kinematic viscosity.
  • 'rho' – Fluid density.

Examples

  • Fluid{Incompressible}(nu=0.001, rho=1.0) - Constructor with default values.
source
XCALibre.ModelPhysics.KOmegaType
KOmega <: AbstractTurbulenceModel

kOmega model containing all kOmega field parameters.

Fields

  • 'k' – Turbulent kinetic energy ScalarField.
  • 'omega' – Specific dissipation rate ScalarField.
  • 'nut' – Eddy viscosity ScalarField.
  • 'kf' – Turbulent kinetic energy FaceScalarField.
  • 'omegaf' – Specific dissipation rate FaceScalarField.
  • 'nutf' – Eddy viscosity FaceScalarField.
  • 'coeffs' – Model coefficients.
source
XCALibre.ModelPhysics.KOmegaLKEType
KOmegaLKE <: AbstractTurbulenceModel

kOmega model containing all kOmega field parameters.

Fields

  • 'k' – Turbulent kinetic energy ScalarField.
  • 'omega' – Specific dissipation rate ScalarField.
  • 'kl' – ScalarField.
  • 'nut' – Eddy viscosity ScalarField.
  • 'kf' – Turbulent kinetic energy FaceScalarField.
  • 'omegaf' – Specific dissipation rate FaceScalarField.
  • 'klf' – FaceScalarField.
  • 'nutf' – Eddy viscosity FaceScalarField.
  • 'coeffs' – Model coefficients.
  • 'Tu' – Freestream turbulence intensity for model.
  • 'y' – Near-wall distance for model.
source
XCALibre.ModelPhysics.MomentumType
struct Momentum{V,S,SS} <: AbstractMomentumModel
+end

This function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers.

Input arguments

  • field reference to the field to which the solver settings will apply (used to provide integer and float types required)
  • solver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl
  • preconditioner instance of preconditioner to be used e.g. Jacobi()
  • convergence sets the stopping criteria of this field
  • relax specifies the relaxation factor to be used e.g. set to 1 for no relaxation
  • limit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()
  • itmax maximum number of iterations in a single solver pass (defaults to 100)
  • atol absolute tolerance for the solver (default to eps(FloatType)^0.9)
  • rtol set relative tolerance for the solver (defaults to 1e-3)
source
XCALibre.ModelPhysics.CompressibleType
Compressible <: AbstractCompressible

Compressible fluid model containing fluid field parameters for compressible flows with constant parameters - ideal gas with constant viscosity.

Fields

  • 'nu' – Fluid kinematic viscosity.
  • 'cp' – Fluid specific heat capacity.
  • gamma – Ratio of specific heats.
  • Pr – Fluid Prantl number.

Examples

  • Fluid{Compressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructur with default values.
source
XCALibre.ModelPhysics.IncompressibleType
Incompressible <: AbstractIncompressible

Incompressible fluid model containing fluid field parameters for incompressible flows.

Fields

  • 'nu' – Fluid kinematic viscosity.
  • 'rho' – Fluid density.

Examples

  • Fluid{Incompressible}(nu=0.001, rho=1.0) - Constructor with default values.
source
XCALibre.ModelPhysics.KOmegaType
KOmega <: AbstractTurbulenceModel

kOmega model containing all kOmega field parameters.

Fields

  • 'k' – Turbulent kinetic energy ScalarField.
  • 'omega' – Specific dissipation rate ScalarField.
  • 'nut' – Eddy viscosity ScalarField.
  • 'kf' – Turbulent kinetic energy FaceScalarField.
  • 'omegaf' – Specific dissipation rate FaceScalarField.
  • 'nutf' – Eddy viscosity FaceScalarField.
  • 'coeffs' – Model coefficients.
source
XCALibre.ModelPhysics.KOmegaLKEType
KOmegaLKE <: AbstractTurbulenceModel

kOmega model containing all kOmega field parameters.

Fields

  • 'k' – Turbulent kinetic energy ScalarField.
  • 'omega' – Specific dissipation rate ScalarField.
  • 'kl' – ScalarField.
  • 'nut' – Eddy viscosity ScalarField.
  • 'kf' – Turbulent kinetic energy FaceScalarField.
  • 'omegaf' – Specific dissipation rate FaceScalarField.
  • 'klf' – FaceScalarField.
  • 'nutf' – Eddy viscosity FaceScalarField.
  • 'coeffs' – Model coefficients.
  • 'Tu' – Freestream turbulence intensity for model.
  • 'y' – Near-wall distance for model.
source
XCALibre.ModelPhysics.MomentumType
struct Momentum{V,S,SS} <: AbstractMomentumModel
     U::V 
     p::S 
     sources::SS
-end

Momentum model containing key momentum fields.

Fields

  • 'U' – Velocity VectorField.
  • 'p' – Pressure ScalarField.
  • 'sources' – Momentum model sources.

Examples

  • `Momentum(mesh::AbstractMesh)
source
XCALibre.ModelPhysics.PhysicsType
struct Physics{T,F,M,Tu,E,D,BI}
+end

Momentum model containing key momentum fields.

Fields

  • 'U' – Velocity VectorField.
  • 'p' – Pressure ScalarField.
  • 'sources' – Momentum model sources.

Examples

  • `Momentum(mesh::AbstractMesh)
source
XCALibre.ModelPhysics.PhysicsType
struct Physics{T,F,M,Tu,E,D,BI}
     time::T
     fluid::F
     momentum::M 
@@ -67,33 +71,33 @@
     energy::E
     domain::D
     boundary_info::BI
-end

XCALibre's parametric Physics type for user-level API. Also used to dispatch flow solvers.

Fields

  • 'time::Union{Steady, Transient}' – User-provided time model.
  • 'fluid::AbstractFluid' – User-provided Fluid` model.
  • 'momentum' – Momentum model. Currently this is auto-generated by the Physics constructor
  • 'turbulence::AbstractTurbulenceModel' – User-provided Turbulence` model.
  • 'energy:AbstractEnergyModel' – User-provided Energy model.
  • 'domain::AbstractMesh ' – User-provided Mesh. Must be adapted to target device before constructing a Physics object.
  • 'boundaryinfo::boundaryinfo' – Mesh boundary information. Auto-generated by the Physics constructor
source
XCALibre.ModelPhysics.PhysicsMethod
Physics(; time, fluid, turbulence, energy, domain)::Physics{T,F,M,Tu,E,D,BI}

Physics constructor part of the top-level API. It can be used to define the Physics and models relevant to a simulation. This constructor uses keyword arguments to allow users to fine-tune their simulations, whilst some fields are auto-generated behind the scenes for convenience (Momentum and boundary_info). Where:

  • time - specified the time model (Steady or Transient)
  • fluid - specifies the type of fluid (Incompressible, etc.)
  • turbulence - specified the Turbulence model
  • energy - specifies the Energy treatment
  • domain - provides the mesh to used (must be adapted to the target backend device)
source
XCALibre.ModelPhysics.SensibleEnthalpyType
SensibleEnthalpy <: AbstractEnergyModel

Type that represents energy model, coefficients and respective fields.

Fields

  • 'h' – Sensible enthalpy ScalarField.
  • 'T' – Temperature ScalarField.
  • 'hf' – Sensible enthalpy FaceScalarField.
  • 'Tf' – Temperature FaceScalarField.
  • 'K' – Specific kinetic energy ScalarField.
  • 'dpdt' – Pressure time derivative ScalarField.
  • 'updated_BC' – Boundary condition function to convert temperature to sensible enthalp on on a fixed value boudary.
  • 'coeffs' – A tuple of model coefficients.
source
XCALibre.ModelPhysics.SmagorinskyType
Smagorinsky <: AbstractTurbulenceModel

Smagorinsky LES model containing all Smagorinksy field parameters.

Fields

  • 'nut' – Eddy viscosity ScalarField.
  • 'nutf' – Eddy viscosity FaceScalarField.
  • 'coeffs' – Model coefficients.
source
XCALibre.ModelPhysics.WeaklyCompressibleType
WeaklyCompressible <: AbstractCompressible

Weakly compressible fluid model containing fluid field parameters for weakly compressible flows with constant parameters - ideal gas with constant viscosity.

Fields

  • 'nu' – Fluid kinematic viscosity.
  • 'cp' – Fluid specific heat capacity.
  • gamma – Ratio of specific heats.
  • Pr – Fluid Prandtl number.

Examples

  • Fluid{WeaklyCompressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructor with

default values.

source
XCALibre.ModelPhysics.Ttoh!Method
Ttoh!(model::Physics{T1,F,M,Tu,E,D,BI}, T::ScalarField, h::ScalarField
-) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}

Function coverts temperature ScalarField to sensible enthalpy ScalarField.

Input

  • model – Physics model defined by user.
  • T – Temperature ScalarField.
  • h – Sensible enthalpy ScalarField.
source
XCALibre.ModelPhysics.energy!Method
energy::Sensible_Enthalpy_Model{E1}, model::Physics{T1,F,M,Tu,E,D,BI}, prev, mdotf, rho, mueff, time, config
-) where {T1,F,M,Tu,E,D,BI,E1}

Run energy transport equations.

Input

  • energy – Energy model.
  • model – Physics model defined by user.
  • prev – Previous energy cell values.
  • mdtof – Face mass flow.
  • rho – Density ScalarField.
  • mueff – Effective viscosity FaceScalarField.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.htoT!Method
htoT!(model::Physics{T1,F,M,Tu,E,D,BI}, h::ScalarField, T::ScalarField
-) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}

Function coverts sensible enthalpy ScalarField to temperature ScalarField.

Input

  • model – Physics model defined by user.
  • h – Sensible enthalpy ScalarField.
  • T – Temperature ScalarField.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(energy::SensibleEnthalpy, model::Physics{T1,F,M,Tu,E,D,BI}, mdotf, rho, peqn, config
-) where {T1,F,M,Tu,E,D,BI})

Initialisation of energy transport equations.

Input

  • energy – Energy model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • rho – Density ScalarField.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • Sensible_Enthalpy_Model – Energy model struct containing energy equation.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(turbulence::KOmega, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config
-) where {T,F,M,Tu,E,D,BI}

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • KOmegaModel(k_eqn, ω_eqn) – Turbulence model structure.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(turbulence::KOmegaLKE, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config
-) where {T,F,M,Tu,E,D,BI}

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • KOmegaLKEModel( k_eqn, ω_eqn, kl_eqn, nueffkLS, nueffkS, nueffωS, nuL, nuts, Ω, γ, fv, normU, Reυ, ∇k, ∇ω ) – Turbulence model structure.
source
XCALibre.ModelPhysics.initialiseMethod
function initialise(
+end

XCALibre's parametric Physics type for user-level API. Also used to dispatch flow solvers.

Fields

  • 'time::Union{Steady, Transient}' – User-provided time model.
  • 'fluid::AbstractFluid' – User-provided Fluid` model.
  • 'momentum' – Momentum model. Currently this is auto-generated by the Physics constructor
  • 'turbulence::AbstractTurbulenceModel' – User-provided Turbulence` model.
  • 'energy:AbstractEnergyModel' – User-provided Energy model.
  • 'domain::AbstractMesh ' – User-provided Mesh. Must be adapted to target device before constructing a Physics object.
  • 'boundaryinfo::boundaryinfo' – Mesh boundary information. Auto-generated by the Physics constructor
source
XCALibre.ModelPhysics.PhysicsMethod
Physics(; time, fluid, turbulence, energy, domain)::Physics{T,F,M,Tu,E,D,BI}

Physics constructor part of the top-level API. It can be used to define the Physics and models relevant to a simulation. This constructor uses keyword arguments to allow users to fine-tune their simulations, whilst some fields are auto-generated behind the scenes for convenience (Momentum and boundary_info). Where:

  • time - specified the time model (Steady or Transient)
  • fluid - specifies the type of fluid (Incompressible, etc.)
  • turbulence - specified the Turbulence model
  • energy - specifies the Energy treatment
  • domain - provides the mesh to used (must be adapted to the target backend device)
source
XCALibre.ModelPhysics.SensibleEnthalpyType
SensibleEnthalpy <: AbstractEnergyModel

Type that represents energy model, coefficients and respective fields.

Fields

  • 'h' – Sensible enthalpy ScalarField.
  • 'T' – Temperature ScalarField.
  • 'hf' – Sensible enthalpy FaceScalarField.
  • 'Tf' – Temperature FaceScalarField.
  • 'K' – Specific kinetic energy ScalarField.
  • 'dpdt' – Pressure time derivative ScalarField.
  • 'updated_BC' – Boundary condition function to convert temperature to sensible enthalp on on a fixed value boudary.
  • 'coeffs' – A tuple of model coefficients.
source
XCALibre.ModelPhysics.SmagorinskyType
Smagorinsky <: AbstractTurbulenceModel

Smagorinsky LES model containing all Smagorinksy field parameters.

Fields

  • 'nut' – Eddy viscosity ScalarField.
  • 'nutf' – Eddy viscosity FaceScalarField.
  • 'coeffs' – Model coefficients.
source
XCALibre.ModelPhysics.WeaklyCompressibleType
WeaklyCompressible <: AbstractCompressible

Weakly compressible fluid model containing fluid field parameters for weakly compressible flows with constant parameters - ideal gas with constant viscosity.

Fields

  • 'nu' – Fluid kinematic viscosity.
  • 'cp' – Fluid specific heat capacity.
  • gamma – Ratio of specific heats.
  • Pr – Fluid Prandtl number.

Examples

  • Fluid{WeaklyCompressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructor with

default values.

source
XCALibre.ModelPhysics.Ttoh!Method
Ttoh!(model::Physics{T1,F,M,Tu,E,D,BI}, T::ScalarField, h::ScalarField
+) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}

Function coverts temperature ScalarField to sensible enthalpy ScalarField.

Input

  • model – Physics model defined by user.
  • T – Temperature ScalarField.
  • h – Sensible enthalpy ScalarField.
source
XCALibre.ModelPhysics.energy!Method
energy::Sensible_Enthalpy_Model{E1}, model::Physics{T1,F,M,Tu,E,D,BI}, prev, mdotf, rho, mueff, time, config
+) where {T1,F,M,Tu,E,D,BI,E1}

Run energy transport equations.

Input

  • energy – Energy model.
  • model – Physics model defined by user.
  • prev – Previous energy cell values.
  • mdtof – Face mass flow.
  • rho – Density ScalarField.
  • mueff – Effective viscosity FaceScalarField.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.htoT!Method
htoT!(model::Physics{T1,F,M,Tu,E,D,BI}, h::ScalarField, T::ScalarField
+) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}

Function coverts sensible enthalpy ScalarField to temperature ScalarField.

Input

  • model – Physics model defined by user.
  • h – Sensible enthalpy ScalarField.
  • T – Temperature ScalarField.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(energy::SensibleEnthalpy, model::Physics{T1,F,M,Tu,E,D,BI}, mdotf, rho, peqn, config
+) where {T1,F,M,Tu,E,D,BI})

Initialisation of energy transport equations.

Input

  • energy – Energy model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • rho – Density ScalarField.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • Sensible_Enthalpy_Model – Energy model struct containing energy equation.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(turbulence::KOmega, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config
+) where {T,F,M,Tu,E,D,BI}

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • KOmegaModel(k_eqn, ω_eqn) – Turbulence model structure.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(turbulence::KOmegaLKE, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config
+) where {T,F,M,Tu,E,D,BI}

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • KOmegaLKEModel( k_eqn, ω_eqn, kl_eqn, nueffkLS, nueffkS, nueffωS, nuL, nuts, Ω, γ, fv, normU, Reυ, ∇k, ∇ω ) – Turbulence model structure.
source
XCALibre.ModelPhysics.initialiseMethod
function initialise(
     turbulence::Laminar, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config
     ) where {T,F,M,Tu,E,D,BI}
-return LaminarModel()

end

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • LaminarModel() – Turbulence model structure.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(turbulence::Smagorinsky, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config
-) where {T,F,M,Tu,E,D,BI}

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • SmagorinskyModel(Δ, magS) – Turbulence model structure.
source
XCALibre.ModelPhysics.thermo_Psi!Method
thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psif::FaceScalarField) 
-where {T,F<:AbstractCompressible,M,Tu,E,D,BI}

Function updates the value of Psi.

Input

  • model – Physics model defined by user.
  • Psif – Compressibility factor FaceScalarField.

Algorithm

Weakly compressible currently uses the ideal gas equation for establishing the compressibility factor where $\rho = p * \Psi$. $\Psi$ is calculated from the sensible enthalpy, reference temperature and fluid model specified $C_p$ and $R$ value where $R$ is calculated from $C_p$ and $\gamma$ specified in the fluid model.

source
XCALibre.ModelPhysics.thermo_Psi!Method
thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psi::ScalarField) 
-where {T,F<:AbstractCompressible,M,Tu,E,D,BI}

Model updates the value of Psi.

Input

  • model – Physics model defined by user.
  • Psi – Compressibility factor ScalarField.

Algorithm

Weakly compressible currently uses the ideal gas equation for establishing the compressibility factor where $\rho = p * \Psi$. $\Psi$ is calculated from the sensible enthalpy, reference temperature and fluid model specified $C_p$ and $R$ value where $R$ is calculated from $C_p$ and $\gamma$ specified in the fluid model.

source
XCALibre.ModelPhysics.turbulence!Method

turbulence!(rans::KOmegaLKEModel, model::Physics{T,F,M,Turb,E,D,BI}, S, S2, prev, time, config ) where {T,F,M,Turb<:KOmegaLKE,E,D,BI}

Run turbulence model transport equations.

Input

  • rans::KOmegaLKEModel – KOmega turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.turbulence!Method
turbulence!(rans::LaminarModel, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config
-) where {T,F,M,Tu<:Laminar,E,D,BI}

Run turbulence model transport equations.

Input

  • rans::LaminarModel – Laminar turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.turbulence!Method
turbulence!(rans::KOmegaModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config
-) where {T,F,M,Tu<:KOmega,E,D,BI,E1,E2}

Run turbulence model transport equations.

Input

  • rans::KOmegaModel{E1,E2} – KOmega turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.turbulence!Method
turbulence!(les::SmagorinskyModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config
-) where {T,F,M,Tu<:Smagorinsky,E,D,BI,E1,E2}

Run turbulence model transport equations.

Input

  • les::SmagorinskyModel{E1,E2} – Smagorinsky LES turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.Simulate.ConfigurationType
@kwdef struct Configuration{SC,SL,RT,HW}
+return LaminarModel()

end

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • LaminarModel() – Turbulence model structure.
source
XCALibre.ModelPhysics.initialiseMethod
initialise(turbulence::Smagorinsky, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config
+) where {T,F,M,Tu,E,D,BI}

Initialisation of turbulent transport equations.

Input

  • turbulence – turbulence model.
  • model – Physics model defined by user.
  • mdtof – Face mass flow.
  • peqn – Pressure equation.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.

Output

  • SmagorinskyModel(Δ, magS) – Turbulence model structure.
source
XCALibre.ModelPhysics.thermo_Psi!Method
thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psif::FaceScalarField) 
+where {T,F<:AbstractCompressible,M,Tu,E,D,BI}

Function updates the value of Psi.

Input

  • model – Physics model defined by user.
  • Psif – Compressibility factor FaceScalarField.

Algorithm

Weakly compressible currently uses the ideal gas equation for establishing the compressibility factor where $\rho = p * \Psi$. $\Psi$ is calculated from the sensible enthalpy, reference temperature and fluid model specified $C_p$ and $R$ value where $R$ is calculated from $C_p$ and $\gamma$ specified in the fluid model.

source
XCALibre.ModelPhysics.thermo_Psi!Method
thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psi::ScalarField) 
+where {T,F<:AbstractCompressible,M,Tu,E,D,BI}

Model updates the value of Psi.

Input

  • model – Physics model defined by user.
  • Psi – Compressibility factor ScalarField.

Algorithm

Weakly compressible currently uses the ideal gas equation for establishing the compressibility factor where $\rho = p * \Psi$. $\Psi$ is calculated from the sensible enthalpy, reference temperature and fluid model specified $C_p$ and $R$ value where $R$ is calculated from $C_p$ and $\gamma$ specified in the fluid model.

source
XCALibre.ModelPhysics.turbulence!Method

turbulence!(rans::KOmegaLKEModel, model::Physics{T,F,M,Turb,E,D,BI}, S, S2, prev, time, config ) where {T,F,M,Turb<:KOmegaLKE,E,D,BI}

Run turbulence model transport equations.

Input

  • rans::KOmegaLKEModel – KOmega turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.turbulence!Method
turbulence!(rans::LaminarModel, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config
+) where {T,F,M,Tu<:Laminar,E,D,BI}

Run turbulence model transport equations.

Input

  • rans::LaminarModel – Laminar turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.turbulence!Method
turbulence!(rans::KOmegaModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config
+) where {T,F,M,Tu<:KOmega,E,D,BI,E1,E2}

Run turbulence model transport equations.

Input

  • rans::KOmegaModel{E1,E2} – KOmega turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.ModelPhysics.turbulence!Method
turbulence!(les::SmagorinskyModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config
+) where {T,F,M,Tu<:Smagorinsky,E,D,BI,E1,E2}

Run turbulence model transport equations.

Input

  • les::SmagorinskyModel{E1,E2} – Smagorinsky LES turbulence model.
  • model – Physics model defined by user.
  • S – Strain rate tensor.
  • S2 – Square of the strain rate magnitude.
  • prev – Previous field.
  • time
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
source
XCALibre.Simulate.ConfigurationType
@kwdef struct Configuration{SC,SL,RT,HW}
     schemes::SC
     solvers::SL
     runtime::RT
     hardware::HW
-end

The Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation.

Inputs

  • schemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.
  • solvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.
  • runtime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.
  • hardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.

Example

config = Configuration(
-    solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)
source
XCALibre.Solvers.csimple!Method
csimple!(model_in, config; resume=true, pref=nothing)

Compressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy.

Input

  • model in – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • resume – True or false indicating if case is resuming or starting a new simulation.
  • pref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.piso_comp!Method
piso_comp!(model_in, config; resume=true, pref=nothing)

Compressible variant of the PISO algorithm with a sensible enthalpy transport equation for the energy.

Input

  • model in – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • resume – True or false indicating if case is resuming or starting a new simulation.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
run!(
+end

The Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation.

Inputs

  • schemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.
  • solvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.
  • runtime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.
  • hardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.

Example

config = Configuration(
+    solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)
source
XCALibre.Solvers.csimple!Method
csimple!(model_in, config; resume=true, pref=nothing)

Compressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy.

Input

  • model in – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • resume – True or false indicating if case is resuming or starting a new simulation.
  • pref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.piso_comp!Method
piso_comp!(model_in, config; resume=true, pref=nothing)

Compressible variant of the PISO algorithm with a sensible enthalpy transport equation for the energy.

Input

  • model in – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • resume – True or false indicating if case is resuming or starting a new simulation.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
residuals = run!(model::Physics, config::Configuration)

Description goes here

Input arguments

Example

Something here
source
XCALibre.Solvers.run!Method
run!(
 model::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing
-) where{T<:Steady,F<:Incompressible,M,Tu,E,D,BI}

Incompressible steady solver using the SIMPLE algorithm.

Input

  • model – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
run!(
+) where{T<:Steady,F<:Incompressible,M,Tu,E,D,BI}

Incompressible steady solver using the SIMPLE algorithm.

Input

  • model – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
run!(
 model::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing
-) where{T<:Steady,F<:WeaklyCompressible,M,Tu,E,D,BI}

Mildly compressible steady solver using the SIMPLE algorithm for low speed cases with heat transfer.

Input

  • model – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
run!(
+) where{T<:Steady,F<:WeaklyCompressible,M,Tu,E,D,BI}

Mildly compressible steady solver using the SIMPLE algorithm for low speed cases with heat transfer.

Input

  • model – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
run!(
 model::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing
-) where{T<:Transient,F<:Incompressible,M,Tu,E,D,BI}

Incompressible unsteady solver using the PISO algorithm.

Input

  • model – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
run!(
+) where{T<:Transient,F<:Incompressible,M,Tu,E,D,BI}

Incompressible unsteady solver using the PISO algorithm.

Input

  • model – Physics model defined by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.run!Method
run!(
 model::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing
-) where{T<:Transient,F<:WeaklyCompressible,M,Tu,E,D,BI}

Mildly compressible unsteady solver using the PISO algorithm for low speed cases with heat transfer.

Input

  • model – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.simple!Method
simple!(model_in, config; resume=true, pref=nothing)

Compressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy.

Input

  • model in – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • resume – True or false indicating if case is resuming or starting a new simulation.
  • pref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
+) where{T<:Transient,F<:WeaklyCompressible,M,Tu,E,D,BI}

Mildly compressible unsteady solver using the PISO algorithm for low speed cases with heat transfer.

Input

  • model – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • pref – Reference pressure value for cases that do not have a pressure defining BC.

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
XCALibre.Solvers.simple!Method
simple!(model_in, config; resume=true, pref=nothing)

Compressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy.

Input

  • model in – Physics model defiend by user and passed to run!.
  • config – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.
  • resume – True or false indicating if case is resuming or starting a new simulation.
  • pref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)

Output

  • R_ux - Vector of x-velocity residuals for each iteration.
  • R_uy - Vector of y-velocity residuals for each iteration.
  • R_uz - Vector of y-velocity residuals for each iteration.
  • R_p - Vector of pressure residuals for each iteration.
  • R_e - Vector of energy residuals for each iteration.
  • model - Physics model output including field parameters.
source
diff --git a/dev/release_notes/index.html b/dev/release_notes/index.html index 99273a25..281ace6a 100644 --- a/dev/release_notes/index.html +++ b/dev/release_notes/index.html @@ -1,2 +1,2 @@ -Release Notes · XCALibre.jl
+Release Notes · XCALibre.jl
diff --git a/dev/search_index.js b/dev/search_index.js index 59f00390..6d90e981 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"user_guide/4_runtime_and_solvers/#Runtime-and-solvers","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"Final steps before launching a simulation","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#Runtime-setup","page":"Runtime and solvers","title":"Runtime setup","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"set_runtime","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#XCALibre.Solve.set_runtime-user_guide-4_runtime_and_solvers","page":"Runtime and solvers","title":"XCALibre.Solve.set_runtime","text":"set_runtime(; \n # keyword arguments\n iterations::I, \n write_interval::I, \n time_step::N\n ) where {I<:Integer,N<:Number} = begin\n \n # returned `NamedTuple``\n (\n iterations=iterations, \n dt=time_step, \n write_interval=write_interval)\nend\n\nThis is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.\n\nInput arguments\n\niterations::Integer specifies the number of iterations in a simulation run.\nwrite_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.\ntime_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.\n\nExample\n\nruntime = set_runtime(\n iterations=2000, time_step=1, write_interval=2000)\n\n\n\n\n\n","category":"function"},{"location":"user_guide/4_runtime_and_solvers/#Configuration-object","page":"Runtime and solvers","title":"Configuration object","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"Configuration","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#XCALibre.Simulate.Configuration-user_guide-4_runtime_and_solvers","page":"Runtime and solvers","title":"XCALibre.Simulate.Configuration","text":"@kwdef struct Configuration{SC,SL,RT,HW}\n schemes::SC\n solvers::SL\n runtime::RT\n hardware::HW\nend\n\nThe Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation. \n\nInputs\n\nschemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.\nsolvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.\nruntime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.\nhardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.\n\nExample\n\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\n\n\n\n\n","category":"type"},{"location":"user_guide/4_runtime_and_solvers/#Initialising-fields","page":"Runtime and solvers","title":"Initialising fields","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#Launching-flow-solvers","page":"Runtime and solvers","title":"Launching flow solvers","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#2D-constant-temperature-flat-plate","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/#Overview","page":"2D constant temperature flat plate","title":"Overview","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"A 2D constant temperature laminar flat plate case has been used to validate the weakly compressible solver. The case provides a constant temperature boundary condition along the wall of the domain. ","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The results of case are compared against the theoretical local Nusselt number correlation for forced convection on constant temperature flat plate:","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Nu_x = 0332 Re_x^12 Pr^13","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The correlation is valid for Prandtl numbers greater than 0.6.","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The boundaries are shown in the mesh figure and the tables below describe the boundary settings used.","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Inlet","page":"2D constant temperature flat plate","title":"Inlet","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU Dirichlet ([0.2, 0.0, 0.0] m/s)\np Neumann (Zero-gradient)\nT FixedTemperature (300.0 K)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Wall","page":"2D constant temperature flat plate","title":"Wall","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU No-slip wall\np Neumann (Zero-gradient)\nT FixedTemperature (310.0 K)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Outlet","page":"2D constant temperature flat plate","title":"Outlet","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU Neumann (Zero-gradient)\np Dirichlet (0.0 Pa)\nT Neumann (Zero-gradient)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Top","page":"2D constant temperature flat plate","title":"Top","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU Neumann (Zero-gradient)\np Neumann (Zero-gradient)\nT Neumann (Zero-gradient)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Fluid-Properties","page":"2D constant temperature flat plate","title":"Fluid Properties","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Property value\nnu 0.0001\nPr 0.71\nc_p 1005.0\ngamma 1.4","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Mesh","page":"2D constant temperature flat plate","title":"Mesh","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The mesh is shown in the figure below:","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"(Image: Figure of mesh.)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The streamwise cell length is 2mm with a total domain length of 1m. The near-wall cell height is 0.049mm with a domain height of 0.2m.","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Case-file","page":"2D constant temperature flat plate","title":"Case file","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"using XCALibre\n\nmesh_file = pkgdir(XCALibre, \"testcases/compressible/2d_laminar_heated_plate/flatplate_2D_laminar.unv\")\nmesh = UNV2D_mesh(mesh_file, scale=0.001)\n\nvelocity = [0.2, 0.0, 0.0]\nnu = 1e-4\nRe = velocity[1]*1/nu\ncp = 1005.0\ngamma = 1.4\nPr = 0.7\n\nmodel = Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(\n nu = nu,\n cp = cp,\n gamma = gamma,\n Pr = Pr\n ),\n turbulence = RANS{Laminar}(),\n energy = Energy{SensibleEnthalpy}(Tref = 288.15),\n domain = mesh # mesh_dev # use mesh_dev for GPU backend\n )\n\n@assign! model momentum U (\n Dirichlet(:inlet, velocity),\n Neumann(:outlet, 0.0),\n Wall(:wall, [0.0, 0.0, 0.0]),\n Symmetry(:top, 0.0)\n)\n\n @assign! model momentum p (\n Neumann(:inlet, 0.0),\n Dirichlet(:outlet, 100000.0),\n Neumann(:wall, 0.0),\n Neumann(:top, 0.0)\n)\n\n@assign! model energy h (\n FixedTemperature(:inlet, T=300.0, model=model.energy),\n Neumann(:outlet, 0.0),\n FixedTemperature(:wall, T=310.0, model=model.energy),\n Neumann(:top, 0.0)\n)\n\nschemes = (\n U = set_schemes(divergence=Linear),\n p = set_schemes(divergence=Linear),\n h = set_schemes(divergence=Linear)\n)\n\nsolvers = (\n U = set_solver(\n model.momentum.U;\n solver = BicgstabSolver,\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n ),\n p = set_solver(\n model.momentum.p;\n solver = CgSolver,\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.3,\n ),\n h = set_solver(\n model.energy.h;\n solver = BicgstabSolver,\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-2,\n atol = 1e-4\n )\n)\n\nruntime = set_runtime(iterations=1000, write_interval=1000, time_step=1)\n\nhardware = set_hardware(backend=CPU(), workgroup=4)\n\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\nGC.gc()\n\ninitialise!(model.momentum.U, velocity)\ninitialise!(model.momentum.p, 100000.0)\ninitialise!(model.energy.T, 300.0)\n\nRx, Ry, Rz, Rp, Re, model_out = run!(model, config)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Results","page":"2D constant temperature flat plate","title":"Results","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The results of the model are compared to the theoretical correlation in the figure below:","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"(Image: Nusselt number distribution results.)","category":"page"},{"location":"user_guide/0_introduction_and_workflow/#Introduction","page":"Introduction","title":"Introduction","text":"","category":"section"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"This page explains the overarching workflow in XCALibre.jl and provides a list of contents","category":"page"},{"location":"user_guide/0_introduction_and_workflow/#Workflow-overview","page":"Introduction","title":"Workflow overview","text":"","category":"section"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"XCALibre.jl has been designed to incorporate a logical workflow, that is, the sequence of setup steps that would take a user naturally from the start of a simulation to its final post-processing. The key steps are listed below","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"Pre-processing - this step involves defining the computational domain and selecting the corresponding backend to performs the calculations\nPhysics and models - this step involves defining the fluid type, flow properties, selecting appropriate models and setting suitable boundary conditions\nNumerical setup - in this phase of the simulation set up all aspect related to the numerics are chosen, from distretisation schemes all the way to solvers and preconditioners. \nRuntime and solvers - once everything has been set up, the simulation is ready to run, once runtime information such as time steps and solution saving intervals has been selected. The final step is to actually start the simulation.\nPost-processing - the final step is to enjoy all the pretty pictures!","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"The user guide is structured such that the information provided is grouped following the workflow illustrated above. For convenience the contents of the user guide are included below, with links to the relevant sections.","category":"page"},{"location":"user_guide/0_introduction_and_workflow/#Contents","page":"Introduction","title":"Contents","text":"","category":"section"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"Pages = Main.USER_GUIDE_PAGES\nDepth = 2","category":"page"},{"location":"user_guide/3_numerical_setup/#Numerical-setup","page":"Numerical setup","title":"Numerical setup","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"super brief summary","category":"page"},{"location":"user_guide/3_numerical_setup/#Discretisation-schemes","page":"Numerical setup","title":"Discretisation schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Part of the methodology to solve the various model equations using the Finite Volume Method (FVM) is to discretise each equation term, essentially, this process linearises the partial differential equation so that it can be represented as a system of linear equations, which can be solved using linear algebra along with iterative solvers. This section presents the discretisation schemes currently available in XCALibre.jl.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Discretisation schemes in XCALibre.jl are organised under the abstract type AbstractScheme. As shown previously, a list of available schemes can be found using the subtypes function:","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractScheme) # hide","category":"page"},{"location":"user_guide/3_numerical_setup/#Schemes-available","page":"Numerical setup","title":"Schemes available","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Time-schemes","page":"Numerical setup","title":"Time schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nSteadyState sets the time derivative to zero\nEuler First order implicit Euler scheme\nCrankNicolson Second order central scheme (not implemented)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Laplacian-schemes","page":"Numerical setup","title":"Laplacian schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nLinear 2nd order Gauss gradient scheme with linear interpolation","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Divergence-schemes","page":"Numerical setup","title":"Divergence schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nLinear 2nd order central difference\nUpwind 1st order upwind scheme\nBoundedUpwind Bounded version of the Upwind scheme\nLUST 1st/2nd order mixed scheme (fixed at 75% Linear - 25% Upwind)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Gradient-schemes","page":"Numerical setup","title":"Gradient schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nOrthogonal Green-Gauss uncorrected gradient scheme\nMidpoint Green-Gauss skew corrected scheme (2 iterations - hardcoded)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Specifying-schemes","page":"Numerical setup","title":"Specifying schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"XCALibre.jl flow solvers offer considerable flexibility to users for defining discretisation schemes. However, this means that for schemes must be specified for every term of every equation solved. The schemes must be provided as a NamedTuple where each keyword corresponds to the fields being solved, e.g. (U = ..., p = ..., k = ..., = ...). To facilitate this process, the set_schemes function is provided. Used without any inputs set_schemes uses the default values provided (see details below).","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"set_schemes","category":"page"},{"location":"user_guide/3_numerical_setup/#XCALibre.Discretise.set_schemes-user_guide-3_numerical_setup","page":"Numerical setup","title":"XCALibre.Discretise.set_schemes","text":"set_schemes(;\n # keyword arguments and their default values\n time=SteadyState,\n divergence=Linear, \n laplacian=Linear, \n gradient=Orthogonal) = begin\n \n # Returns NamedTuple definition for scheme \n (\n time=time,\n divergence=divergence,\n laplacian=laplacian,\n gradient=gradient\n )\nend\n\nThe set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.\n\ninputs\n\ntime is used to set the time schemes(default is SteadyState)\ndivergence is used to set the divergence scheme (default is Linear) \nlaplacian is used to set the laplacian scheme (default is Linear)\ngradient is used to set the gradient scheme (default is Orthogonal)\n\n\n\n\n\n","category":"function"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"For example, below we set the schemes for the U and p fields. Notice that in the first case the schemes will take their default values (entry for p). In the case of U, we are only changing the setting for the divergence scheme to Upwind.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre\nschemes = (\n p = set_schemes(), # no input provided (will use defaults)\n U = set_schemes(divergence = Upwind),\n)","category":"page"},{"location":"user_guide/3_numerical_setup/#Linear-solvers","page":"Numerical setup","title":"Linear solvers","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Linear solvers in XCALibre.jl are provided by Krylov.jl. The following solvers types are re-exported in XCALibre.jl","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"BicgstabSolver is a general purpose linear solver. Works well with non-symmetric matrices e.g. for U.\nCgSolver is particular strong with symmetric matrices e.g to solve the pressure equation.\nGmresSolver is a general solver. We have found it works best on the CPU backend.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"For more information on these solvers you can review the excellent documentation provided by the Krylov.jl team. ","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"XCALibre.jl provides the set_solver convenience function for setting solvers. See details below. ","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"set_solver","category":"page"},{"location":"user_guide/3_numerical_setup/#XCALibre.Solve.set_solver-user_guide-3_numerical_setup","page":"Numerical setup","title":"XCALibre.Solve.set_solver","text":"set_solver( \n field::AbstractField;\n # keyword arguments and defaults\n solver::S, \n preconditioner::PT, \n convergence, \n relax,\n limit=(),\n itmax::Integer=100, \n atol=(eps(_get_float(field.mesh)))^0.9,\n rtol=_get_float(field.mesh)(1e-3)\n ) where {S,PT<:PreconditionerType} = begin\n\n # return NamedTuple\n TF = _get_float(field.mesh)\n (\n solver=solver, \n preconditioner=preconditioner, \n convergence=convergence |> TF, \n relax=relax |> TF, \n limit=limit,\n itmax=itmax, \n atol=atol |> TF, \n rtol=rtol |> TF\n )\nend\n\nThis function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers. \n\nInput arguments\n\nfield reference to the field to which the solver settings will apply (used to provide integer and float types required)\nsolver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl\npreconditioner instance of preconditioner to be used e.g. Jacobi()\nconvergence sets the stopping criteria of this field\nrelax specifies the relaxation factor to be used e.g. set to 1 for no relaxation\nlimit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()\nitmax maximum number of iterations in a single solver pass (defaults to 100) \natol absolute tolerance for the solver (default to eps(FloatType)^0.9)\nrtol set relative tolerance for the solver (defaults to 1e-3)\n\n\n\n\n\n","category":"function"},{"location":"user_guide/3_numerical_setup/#Preconditioners","page":"Numerical setup","title":"Preconditioners","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"XCALibre.jl offers a range of preconditioners which are subtypes of the abstrac type PreconditionerType, exploring its subtypes we can find a list of the currently available preconditioners: ","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(PreconditionerType) # hide","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"note: Note\nOnly the Jacobi and NormDiagonal preconditioners have GPU ready implementations. At present these have the most robust implementation and they can be used with both CPU and GPU backends. The other preconditioners can only be used on the CPU. Notice that on our tests the LDL preconditioner only works when paired with the GmresSolver on the CPU. Also notice that the implementation of the DILU preconditioner, although functions, is only experimental. Work on improving the offering of preconditioners is ongoing.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Below an example is provided in context. Here, we are setting solvers for both the velocity field U and the pressure field p and packing them into a NamedTuple \"solvers\". The Jacobi preconditioner is use in both solvers. Notice that preconditioners are specified with an instance of their type i.e. Jacobi(). Internally, the preconditioner instance is used for dispatch. This tupple will then be pass on to create the final Configuration object.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"DocTestSetup = quote\n using XCALibre\n mesh_file = pkgdir(XCALibre, \"examples/2d_incompressible_laminar_backwards_step/backward_facing_step_10mm.unv\")\n mesh = UNV2D_mesh(mesh_file, scale=0.001)\n mesh_dev = mesh # use this line to run on CPU\n nu = 1e-3\n model = Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu = nu),\n turbulence = RANS{Laminar}(),\n energy = Energy{Isothermal}(),\n domain = mesh_dev\n )\nend","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre\n\n# Note: this example assumes a Physics object named `model` already exists\n\nsolvers = (\n U = set_solver(\n model.momentum.U;\n solver = BicgstabSolver, # GmresSolver\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n ),\n p = set_solver(\n model.momentum.p;\n solver = CgSolver, # BicgstabSolver, GmresSolver\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n )\n)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"DocTestSetup = nothing","category":"page"},{"location":"user_guide/2_physics_and_models/#Physics-and-models","page":"Physics and models","title":"Physics and models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"super brief summary","category":"page"},{"location":"user_guide/2_physics_and_models/#Physics-model-definition","page":"Physics and models","title":"Physics model definition","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The Physics object is part of the highest level API in XCALibre.jl. Physics objects are a means for users to set up the physics and models that are relevant to their particular CFD simulation. Internally, the Physics model created is pass to solvers and it is used for dispatch (solvers, algorithms and models). Thus, it is important to ensure that the information provided to this object is correct and representative of the user's intentions. Physics models consist of a struct with the fields shown below. All fields must be provided to the solvers otherwise the construction of the object will fail.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"struct Physics{T,F,M,Tu,E,D,BI}\n time::T\n fluid::F\n momentum::M \n turbulence::Tu \n energy::E\n domain::D\n boundary_info::BI\nend ","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For convenience, XCALibre.jl provides a more user-friendly constructor that will automatically take care of the construction of derived fields. This constructor uses keyword arguments and has the following signature (follow the link for more information)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(; time, fluid, turbulence, energy, domain)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"At this point, it is worth reminding users that one of the benefits of working with Julia is its dynamic nature. This means that objects can be dynamically interrogated. For example:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre\nfieldnames(Physics)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"This will provide users with all the fields that make up the Physics object. This is a nice way to explore the makeup of any object in Julia (and by extension XCALibre.jl). The rest of this page will provide details of the physics models available in XCALibre.jl, including:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Time models\nFluid types\nTurbulence models\nEnergy models","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"warning: Warning\nThe mesh provided to the domain field must already be adapted to the required backend device. See Backend selection for detail. ","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"note: Note\nIn the next version of XCALibre.jl the field boundary_info will be likely removed outside of the Physics object in order to improve on the current performance (avoiding unnecessary memory movement between GPU backends and the host devices).","category":"page"},{"location":"user_guide/2_physics_and_models/#Time-models","page":"Physics and models","title":"Time models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Earlier in this section, the dynamic nature of Julia was mentioned in the context of extracting fields for the Physics model used in XCALibre.jl. In the following sections this benefit of using Julia will be exploited further. XCALibre.jl takes advantage of Julia's rich type system and we define Abstract types to organise major functionality. For example, time models are subtypes of the abstract type AbstractTimeModel. Therefore, out-of-the-box we get for free a means to explore implemented features in XCALibre.jl. For example, to identify the time models implemented, we need simply need to type the following in the REPL:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre\n# import Main.subtypes as subtypes # hide\nusing InteractiveUtils # Load from standard library\nMain.subtypes(AbstractTimeModel)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"From the output it can be seen that there are two time models in XCALibre.jl for Steady or Transient simulations. These are singleton types and contain (at present) not internal fields or data. They are largely used by XCALibre.jl to dispatch either steady or transient solvers. We starting to get a picture of how the Physics object is constructed. For example, to specify a Steady simulation","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, the time model can be specified as Steady as follows","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady()\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Fluid-types","page":"Physics and models","title":"Fluid types","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Following from the idea of using Julia's dynamic features to explore the types available in XCALibre.jl, in this section we will explore the fluid types available. This time, we will use a helper package AbstractTrees (which can be installed in the usual way, by entering into package mode in the REPL and typing add AbstractTrees). In XCALibre.jl all fluid types are subtypes of AbstractFluid. The types available are shown in the example below:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"begin\n # Note: this code snippet will not be shown later for succinctness\n using XCALibre\n using InteractiveUtils # Load from standard library\n # using Pkg; Pkg.add(\"AbstractTrees\") # run to install AbstractTrees\n using AbstractTrees \n # import Main.subtypes as subtypes # hide\n AbstractTrees.children(d::DataType) = Main.subtypes(d)\n print_tree(AbstractFluid)\nend","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"From the subtype tree above, we can see that XCALibre.jl offers 2 major abstract fluid types, AbstractIncompressible and AbstractCompressible. The concrete fluid types are 3:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Incompressible - for simulations were the fluid density does not change with pressure\nWeaklyCompressible - for simulation were the fluid density is allowed to change (no shockwaves)\nCompressible - for simulations were discontinuities may appear (not available for general use yet)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"To specify a given fluid type, the Fluid wrapper type is used as a general constructor which is specialised depending depending on the fluid type from the list above provided by the user. The constructors require the following inputs:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For incompressible fluid flow","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Fluid{Incompressible}(; nu, rho=1.0) ","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For compressible fluids (weak formulation)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Fluid{WeaklyCompressible}(; nu, cp, gamma, Pr)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"where the input variable represent the following:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"nu - viscosity\nrho - fluid density\ngamma - specific heat ratio\nPr - Prandlt number\ncp - specific heat at constant pressure","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, an incompressible fluid can be specified as follows","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu=1e-5),\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Turbulence-models","page":"Physics and models","title":"Turbulence models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Below is a representation the AbstractTurbulenceModel inheritance tree. It shows turbulence models available. Turbulence models are defined using the RANS and LES constructors and passing a specific turbulence model type. As it will be illustrated in the flowing sections.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractTurbulenceModel) # hide","category":"page"},{"location":"user_guide/2_physics_and_models/#RANS-models-constructors","page":"Physics and models","title":"RANS models constructors","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Laminar model: no user input is required. This is a dummy model that does not contribute to the momentum equation.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"RANS{Laminar}() # only constructor needed","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KOmega model: the standard 2 equation Wilcox model coefficients are passed by default. This model solve an additional 3 equation for k, omega and nut which must be provided with boundary conditions.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"RANS{KOmega}() # will set the default coefficient values shown below\nRANS{KOmega}(; β⁺=0.09, α1=0.52, β1=0.072, σk=0.5, σω=0.5) # set defaults\nRANS{KOmega}(β1=0.075) # user can choose to change a single coefficient","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KOmegaLKE model: the user must provide a reference turbulence intensity (Tu) and a tuple of symbols specifying wall boundaries. This model uses 3 equations (k, kl, omega) and updates the eddy viscosity (nut) these must be provided with boundary conditions.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"RANS{KOmegaLKE}(; Tu::Number, walls::Tuple) # no defaults defined\nRANS{KOmegaLKE}(Tu = 0.01, walls=(:cylinder,)) # user should provide information for Tu and walls","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, a steady, incompressible simulation using the KOmega model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu=1e-5),\n turbulence = RANS{KOmega}(),\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#LES-models","page":"Physics and models","title":"LES models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Smagorinsky model: the standard model constant is pass by default. Boundary conditions for nut must be provided generally zero gradient conditions work well. No special wall functions for nut in LES mode are available.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"LES{Smagorinsky}() # default constructor will use value below\nLES{Smagorinsky}(; C=0.15) # default value provided by default\nLES{Smagorinsky}(C=0.1) # user selected value","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, an incompressible LES simulation with the Smagorinsky model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Transient(),\n fluid = Fluid{Incompressible}(nu=1e-5),\n turbulence = LES{Smagorinsky}(),\n)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"note: Note\nIn the specification above the time model was set as Transient since LES models are strictly time-resolving. A simulation might run when the Steady model is chosen, but the results would likely not be reliable. XCALibre.jl by design offers flexibility for users to customise their setup, the consequence is that is also falls on users to define a combination of models that is appropriate. Likewise, in the example above an Isothermal energy model would have to be selected. See Energy models","category":"page"},{"location":"user_guide/2_physics_and_models/#Energy-models","page":"Physics and models","title":"Energy models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Currently, XCALibre.jl offers two options to model the energy equation. A tree of the AbstractEnergyModel is shown below. The top-level constructor for energy models is the Energy type. Specific constructor signatures are also illustrated below.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractEnergyModel) # hide","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Isothermal model: assumes temperature effects are negligible. Used for incompressible solvers.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Energy{Isothermal}() # default constructor","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"SensibleEnthalpy model: uses the sensible enthalpy model for the energy equation. Required for the compressible solvers.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Energy{SensibleEnthalpy}(; Tref) # constructor definition. No default values given to Tref keyword\nEnergy{SensibleEnthalpy}(Tref=300) # Users must provide a referent temperature value","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, a steady, compressible RANS simulation with the KOmegaLKE model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(nu=1e-5, cp=1005, gamma=1.4, Pr=0.7),\n turbulence = RANS{KOmegaLKE}(),\n energy = Energy{SensibleEnthalpy}(Tref=300),\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Domain-definition","page":"Physics and models","title":"Domain definition","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The final step when defining a Physics model is to specify the domain on which the various models will be used. This is simply a reference to the mesh object.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Continuing from the previous example, a steady, compressible RANS simulation with the KOmegaLKE model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(nu=1e-5, cp=1005, gamma=1.4, Pr=0.7),\n turbulence = RANS{KOmegaLKE}(),\n energy = Energy{SensibleEnthalpy}(Tref=300),\n domain = mesh_dev\n)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"warning: Warning\nWhen passing the mesh objective to complete the definition of the Physics object, the mesh must be adapted to the target device where the computation will be performed. See Backend selection for more details.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Notice that the transfer to the target compute backend can also be done inline. For example,","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(nu=1e-5, cp=1005, gamma=1.4, Pr=0.7),\n turbulence = RANS{KOmegaLKE}(),\n energy = Energy{SensibleEnthalpy}(Tref=300),\n domain = adapt(CUDABackend(), mesh) # for Nvidia GPUs\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Boundary-conditions","page":"Physics and models","title":"Boundary conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The final step to completely capture the physics for the simulation is to define boundary conditions in order to find a concrete solution of the model equations being solved. XCALibre.jl offers a range of boundary condition. As before, boundary conditions are specified by type and the are classified under the AbstractBoundary type and subdivided into 4 additional abstract types AbstractDirichlet, AbstractNeumann, AbstractPhysicalConstraint and AbstractWallFunction. The complete abstract tree is illustrated below.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractBoundary) # hide","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Philosophically, the four subtypes represent different physical types of boundary conditions:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"AbstractDirichlet boundary conditions are used to assign a concrete value to a boundary.\nAbstractNeumann boundaries are used to fix the gradient at the boundary.\nAbstractPhysicalConstraint boundaries represent physical constraints imposed on the domain.\nAbstractWallFunction represent models for treating flow or turbulence quantities in wall regions.","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractDirichlet-conditions","page":"Physics and models","title":"AbstractDirichlet conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Dirichlet(name, value)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nvalue is a vector or scalar defining desired value at the boundary","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"FixedTemperature(name; T, model::EnergyModel<:AbstractEnergyModel)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nT is a keyword argument to define the temperate value to be assigned at the boundary\nmodel is a keyworkd argument that expects an instance of the energy model to be used e.g. SensibleEnergy","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"DirichletFunction(name, func)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nfunc is a function identifier. func is a user-defined function (but can also be a neural network) that returns a scalar or vector as a function of time and space.\nfunc must adhere to an internal contract. See XXX for more details","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractNeumann-conditions","page":"Physics and models","title":"AbstractNeumann conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Neumann(name, value)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nvalue is a scalar defining the gradient normal to the boundary","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"warning: Warning\nAt present the Neumann boundary should be treated as providing a zero gradient condition only. Internally, a zero gradient value is hard-coded. This behaviour will be extended in the near future to allow arbitrary gradients to be defined.","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractPhysicalConstraint-conditions","page":"Physics and models","title":"AbstractPhysicalConstraint conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Wall boundary conditions can be used to provide a boundary with a wall constraint. This boundary type, at present, can only be used to define vectors. For scalar quantities in wall regions a Neumann (zero gradient) should be imposed.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Wall(name, value)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nvalue is a vector defining wall velocity e.g. [0, 0, 0]","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"note: Note\nCurrently, the value provided at the wall is not used internally. This mean that this boundary condition current acts a a no slip boundary. This will be extended to allow non-slip boundaries or moving walls.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Symmetry boundary condition can be use to assign a symmetry constraint to a given boundary patch in the domain. It can be used for both vector and scalar quantities.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Symmetry(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Periodic boundaries consist of a pair of boundary patches that behave as if they are physically connected. The periodic boundary essentially provides a mapping between these patches and helps in calculating the face values at the interface. The construction of periodic boundaries is different to other boundary conditions because the addressing between each face for the patch pair needs to be calculated and stored. Periodic boundary can be constructed as follows:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"periodic::Tuple = construct_periodic(mesh, backend, patch1::Symbol, patch2::Symbol)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"mesh is a reference to the mesh object\nbackend defines the expected backend e.g. CPU(), CUDABackend, etc.\npatch1 and patch2 symbols of the two patch pair we would like to flag as periodic","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The output is a tuple containing two Periodic boundary types with information relevant to each boundary patch pair and it can be used directly to assign a periodic boundary for both patches (by splatting into the assignment macro e.g. periodic...)","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractWallFunction-conditions","page":"Physics and models","title":"AbstractWallFunction conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KWallFunction provides a turbulent kinetic energy boundary condition for high-Reynolds models.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KWallFunction(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"OmegaWallFunction provides a value for the specific dissipation rate for both low- and high-Reynolds model.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"OmegaWallFunction(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"NutWallFunction provides a value for the eddy viscosity for high-Reynolds models","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"NutWallFunction(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/#Assigning-conditions-(macro)","page":"Physics and models","title":"Assigning conditions (macro)","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"XCALibre.jl requires that a boundary condition is assigned to every single patch in the domain (as defined within the mesh object) for every the fields that is part of the solution. To facilitate this process, XCALibre.jl provides the @assign macro for convenience. The @assign macro has the following signature:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"@assign! model::Physics (\n , \n , \n ...\n )","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, for a laminar incompressible simulation, only the momentum equation is being solved. Therefore, users need to provide conditions for every patch for the U and p fields in the momentum model:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre\n\nmesh_file = pkgdir(XCALibre, \"examples/2d_incompressible_laminar_backwards_step/backward_facing_step_10mm.unv\")\nmesh = UNV2D_mesh(mesh_file, scale=0.001)\n\nbackend = CPU() # run on CPU\nhardware = set_hardware(backend=backend, workgroup=4)\nmesh_dev = mesh # dummy assignment \n\n# Flow conditions\nvelocity = [1.5, 0.0, 0.0]\nnu = 1e-3\nRe = velocity[1]*0.1/nu # Reynolds number\n\n# Physics models\nmodel = Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu = nu),\n turbulence = RANS{Laminar}(),\n energy = Energy{Isothermal}(),\n domain = mesh_dev\n )\n\n# Define boundary conditions\n@assign! model momentum U (\n Dirichlet(:inlet, velocity),\n Neumann(:outlet, 0.0),\n Wall(:wall, [0.0, 0.0, 0.0]),\n Wall(:top, [0.0, 0.0, 0.0]),\n)\n\n@assign! model momentum p (\n Neumann(:inlet, 0.0),\n Dirichlet(:outlet, 0.0),\n Neumann(:wall, 0.0), # scalar wall - set up as zero gradient\n Neumann(:top, 0.0) # scalar wall - set up as zero gradient\n)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"hint: Hint\nJulia is a dynamic language and objects can be interrogated on the fly (dynamically). Say you created a Physics model named mymodel, you can interrogate the contents of any of the fields in the Physics structure using the fieldnames function, e.g. fieldnames(mymodel.momentum), to find which fields need to be provided with boundary conditions. Any fields not ending in f should be set. ","category":"page"},{"location":"quick_start/#Quick-Start","page":"Quick Start","title":"Quick Start","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"Read this section for information about how to install XCALibre.jl and an example showcasing the API","category":"page"},{"location":"quick_start/#Installation","page":"Quick Start","title":"Installation","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"First, you need to download and install Julia in your system. Once you have a working installation of Julia, XCALibre.jl can be installed using the built in package manager. ","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"To install XCALibre.jl directly from Github, open a Julia REPL, press ] to enter the package manager. The REPL prompt icon will change from julia> (green) to pkg> (and change colour to blue) or (myenvironment) pkg> where myenvironment is the name of the currently active Juila environment. Once in package manager mode enter","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"pkg> add XCALibre https://github.com/mberto79/XCALibre.jl.git","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"A specific branch can be installed by providing the branch name precided by a #, for example, to install the dev-0.3-main branch","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"pkg> add XCALibre https://github.com/mberto79/XCALibre.jl.git#dev-0.3-main","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"We plan to register XCALibre.jl so that is added to the General Julia Registry. Once this has been completed, to install XCALibre.jl use the following command (in package mode as detailed above)","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"pkg> add XCALibre","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"note: Note\nTo enable GPU acceleration you will also need to install the corresponding GPU package for your hardware. See CUDA.jl, AMD.jl, oneAPI.jl for more details. XCALibre.jl will automatically precompile and load the relevant backend specific functionality (using Julia extensions)","category":"page"},{"location":"quick_start/#Example","page":"Quick Start","title":"Example","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"The example below illustrates the top-level API used in XCALibre.jl. It shows the key steps a user needs to follow to set up a simulation:","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"Pre-processing (steps 1 and 2)\nPhysics and models (steps 3 to 5)\nNumerical setup (steps 6 and 7)\nRuntime and solvers setup (steps 8 to 11)\nPost-processing (step 12)","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"Once you have installed Julia and XCALibre.jl, the example below can be run by copying the contents shown below and pasting them on a file. The file can be executed within vscode, the Julia REPL or from a system terminal. ","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"To run in vscode check the information for using Julia in vscode\nTo run in the Julia REPL, simply launch Julia and type include(\"name_of_your_file.jl\")\nTo run from a system terminal (bash or cmd, for example), simply type path/to/julia name_of_your_file.jl","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"In most cases, it is preferable to run simulations from within the Julia REPL because, in Julia, there is often a cost associated to the first run due to compilation time. By relaunching a simulation in the REPL, all previously compiled code will not be recompiled. This is particularly helpful in the prototyping stages. For long running simulations, the compilation time is normally negligible compared to the actual time needed to complete the simulation.","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"\n# Step 0. Load libraries\nusing XCALibre\n# using CUDA # Uncomment to run on NVIDIA GPUs\n# using AMDGPU # Uncomment to run on AMD GPUs\n\n\n# Step 1. Define mesh\nmesh_file = pkgdir(XCALibre, \"examples/2d_incompressible_laminar_backwards_step/backward_facing_step_10mm.unv\")\nmesh = UNV2D_mesh(mesh_file, scale=0.001)\n\n# Step 2. Select backend and setup hardware\nbackend = CPU()\n# backend = CUDABackend() # ru non NVIDIA GPUs\n# backend = ROCBackend() # run on AMD GPUs\n\nhardware = set_hardware(backend=backend, workgroup=4)\n# hardware = set_hardware(backend=backend, workgroup=32) # use for GPU backends\n\nmesh_dev = mesh # use this line to run on CPU\n# mesh_dev = adapt(backend, mesh) # Uncomment to run on GPU \n\n# Step 3. Flow conditions\nvelocity = [1.5, 0.0, 0.0]\nnu = 1e-3\nRe = velocity[1]*0.1/nu\n\n# Step 4. Define physics\nmodel = Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu = nu),\n turbulence = RANS{Laminar}(),\n energy = Energy{Isothermal}(),\n domain = mesh_dev\n )\n\n# Step 5. Define boundary conditions\n@assign! model momentum U (\n Dirichlet(:inlet, velocity),\n Neumann(:outlet, 0.0),\n Wall(:wall, [0.0, 0.0, 0.0]),\n Wall(:top, [0.0, 0.0, 0.0]),\n)\n\n@assign! model momentum p (\n Neumann(:inlet, 0.0),\n Dirichlet(:outlet, 0.0),\n Neumann(:wall, 0.0),\n Neumann(:top, 0.0)\n)\n\n# Step 6. Choose discretisation schemes\nschemes = (\n U = set_schemes(divergence = Linear),\n p = set_schemes() # no input provided (will use defaults)\n)\n\n# Step 7. Set up linear solvers and preconditioners\nsolvers = (\n U = set_solver(\n model.momentum.U;\n solver = BicgstabSolver, # Options: GmresSolver\n preconditioner = Jacobi(), # Options: NormDiagonal(), DILU(), ILU0()\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n ),\n p = set_solver(\n model.momentum.p;\n solver = CgSolver, # Options: CgSolver, BicgstabSolver, GmresSolver\n preconditioner = Jacobi(), # Options: NormDiagonal(), LDL() (with GmresSolver)\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n )\n)\n\n# Step 8. Specify runtime requirements\nruntime = set_runtime(\n iterations=2000, time_step=1, write_interval=2000)\n\n# Step 9. Construct Configuration object\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\n# Step 10. Initialise fields (initial guess)\ninitialise!(model.momentum.U, velocity)\ninitialise!(model.momentum.p, 0.0)\n\n# Step 11. Run simulation\nRx, Ry, Rz, Rp, model_out = run!(model, config);\n\n# Step 12. Post-process\npwd() # find active directory where the file \"iteration_002000.vtk\" was saved","category":"page"},{"location":"quick_start/#Output","page":"Quick Start","title":"Output","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"If you chose to run the example above, XCALibre.jl would have written a simulation result file to your computer. The name of the file is iteration_002000.vtk. The file will be located in your current active directory (you can check this by running pwd()). This file can be open directly in ParaView for further post-processing. You can find out more about ParaView on their website. The image below is the output solution generated by XCALibre.j to the example simulation above.","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"(Image: Simulation result visualisation in ParaView)","category":"page"},{"location":"contributor_guide/#Contributor-Guide","page":"Contributor Guide","title":"Contributor Guide","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/#2D-incompressible-flat-plate","page":"2D incompressible flat plate","title":"2D incompressible flat plate","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/#Introduction","page":"2D incompressible flat plate","title":"Introduction","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/","page":"2D incompressible flat plate","title":"2D incompressible flat plate","text":"","category":"page"},{"location":"VV/2d-isothermal-backward-facing-step/#This-is-a-subsection","page":"2D incompressible flat plate","title":"This is a subsection","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/","page":"2D incompressible flat plate","title":"2D incompressible flat plate","text":"","category":"page"},{"location":"VV/2d-isothermal-backward-facing-step/#This-is-a-sub-subsection","page":"2D incompressible flat plate","title":"This is a sub-subsection","text":"","category":"section"},{"location":"reference/#Reference","page":"Reference","title":"Reference","text":"","category":"section"},{"location":"reference/","page":"Reference","title":"Reference","text":"Modules = [\n XCALibre, \n XCALibre.Mesh, \n XCALibre.Fields,\n XCALibre.ModelFramework,\n XCALibre.Discretise, \n XCALibre.Solve,\n XCALibre.Calculate, \n XCALibre.ModelPhysics,\n XCALibre.Simulate,\n XCALibre.Solvers,\n XCALibre.Postprocess\n ]","category":"page"},{"location":"reference/#XCALibre.Discretise.Dirichlet","page":"Reference","title":"XCALibre.Discretise.Dirichlet","text":"Dirichlet <: AbstractDirichlet\n\nDirichlet boundary condition model.\n\nFields\n\n'ID' – Boundary ID\nvalue – Scalar or Vector value for Dirichlet boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.DirichletFunction","page":"Reference","title":"XCALibre.Discretise.DirichletFunction","text":"DirichletFunction <: AbstractDirichlet\n\nDirichlet boundary condition model.\n\nFields\n\n'ID' – Boundary ID\nvalue – Custom function for Dirichlet boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.FixedTemperature","page":"Reference","title":"XCALibre.Discretise.FixedTemperature","text":"FixedTemperature <: AbstractDirichlet\n\nFixed temperature boundary condition model, which allows the user to specify wall temperature that can be translated to the energy specific model, such as sensivle enthalpy.\n\nFields\n\n'ID' – Boundary ID\nvalue – Scalar or Vector value for Dirichlet boundary condition.\nT - Temperature value in Kelvin.\nmodel - Energy physics model for case.\n\nExamples\n\nFixedTemperature(:inlet, T=300.0, model=model.energy),\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Neumann","page":"Reference","title":"XCALibre.Discretise.Neumann","text":"Neumann <: AbstractNeumann\n\nNeumann boundary condition model (currently only configured for zero gradient)\n\nFields\n\n'ID' – Boundary ID\nvalue – Scalar or Vector value for Neumann boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Periodic","page":"Reference","title":"XCALibre.Discretise.Periodic","text":"struct Periodic{I,V} <: AbstractPhysicalConstraint\n ID::I\n value::V\nend\n\nPeriodic boundary condition model.\n\nFields\n\n'ID' – Boundary ID\nvalue – tuple containing information needed to apply this boundary\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Symmetry","page":"Reference","title":"XCALibre.Discretise.Symmetry","text":"Symmetry <: AbstractBoundary\n\nSymmetry boundary condition model for velocity and scalar field.\n\nFields\n\n'ID' – Boundary ID\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Wall","page":"Reference","title":"XCALibre.Discretise.Wall","text":"Wall <: AbstractDirichlet\n\nWall boundary condition model for no-slip wall condition.\n\nFields\n\n'ID' – Boundary ID\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.construct_periodic-Tuple{Any, Any, Symbol, Symbol}","page":"Reference","title":"XCALibre.Discretise.construct_periodic","text":"construct_periodic(mesh, backend, patch1::Symbol, patch2::Symbol)\n\nFunction for construction of periodic boundary conditions.\n\nInput\n\nmesh – Mesh.\nbackend – Backend configuraton.\npatch1 – Primary periodic patch ID.\npatch2 – Neighbour periodic patch ID.\n\nOutput\n\nperiodic::Tuple - tuple containing boundary defintions for patch1 and patch2 i.e. (periodic1, periodic2). The fields of periodic1 and periodic2 are \nID – Index to access boundary information in mesh object\nvalue – represents a NamedTuple with the following keyword arguments:\nindex – ID used to find boundary geometry information in the mesh object\ndistance – perpendicular distance between the patches\nface_map – vector providing indeces to faces of match patch\nismaster – flat to identify one of the patch pairs as the main patch\n\nExample\n\n- `periodic = construct_periodic(mesh, CPU(), :top, :bottom)` - Example using CPU \nbackend with periodic boundaries named `top` and `bottom`.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Discretise.set_schemes-Tuple{}","page":"Reference","title":"XCALibre.Discretise.set_schemes","text":"set_schemes(;\n # keyword arguments and their default values\n time=SteadyState,\n divergence=Linear, \n laplacian=Linear, \n gradient=Orthogonal) = begin\n \n # Returns NamedTuple definition for scheme \n (\n time=time,\n divergence=divergence,\n laplacian=laplacian,\n gradient=gradient\n )\nend\n\nThe set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.\n\ninputs\n\ntime is used to set the time schemes(default is SteadyState)\ndivergence is used to set the divergence scheme (default is Linear) \nlaplacian is used to set the laplacian scheme (default is Linear)\ngradient is used to set the gradient scheme (default is Orthogonal)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solve.set_runtime-Union{Tuple{}, Tuple{N}, Tuple{I}} where {I<:Integer, N<:Number}","page":"Reference","title":"XCALibre.Solve.set_runtime","text":"set_runtime(; \n # keyword arguments\n iterations::I, \n write_interval::I, \n time_step::N\n ) where {I<:Integer,N<:Number} = begin\n \n # returned `NamedTuple``\n (\n iterations=iterations, \n dt=time_step, \n write_interval=write_interval)\nend\n\nThis is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.\n\nInput arguments\n\niterations::Integer specifies the number of iterations in a simulation run.\nwrite_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.\ntime_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.\n\nExample\n\nruntime = set_runtime(\n iterations=2000, time_step=1, write_interval=2000)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solve.set_solver-Union{Tuple{AbstractField}, Tuple{PT}, Tuple{S}} where {S, PT<:PreconditionerType}","page":"Reference","title":"XCALibre.Solve.set_solver","text":"set_solver( \n field::AbstractField;\n # keyword arguments and defaults\n solver::S, \n preconditioner::PT, \n convergence, \n relax,\n limit=(),\n itmax::Integer=100, \n atol=(eps(_get_float(field.mesh)))^0.9,\n rtol=_get_float(field.mesh)(1e-3)\n ) where {S,PT<:PreconditionerType} = begin\n\n # return NamedTuple\n TF = _get_float(field.mesh)\n (\n solver=solver, \n preconditioner=preconditioner, \n convergence=convergence |> TF, \n relax=relax |> TF, \n limit=limit,\n itmax=itmax, \n atol=atol |> TF, \n rtol=rtol |> TF\n )\nend\n\nThis function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers. \n\nInput arguments\n\nfield reference to the field to which the solver settings will apply (used to provide integer and float types required)\nsolver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl\npreconditioner instance of preconditioner to be used e.g. Jacobi()\nconvergence sets the stopping criteria of this field\nrelax specifies the relaxation factor to be used e.g. set to 1 for no relaxation\nlimit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()\nitmax maximum number of iterations in a single solver pass (defaults to 100) \natol absolute tolerance for the solver (default to eps(FloatType)^0.9)\nrtol set relative tolerance for the solver (defaults to 1e-3)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.Compressible","page":"Reference","title":"XCALibre.ModelPhysics.Compressible","text":"Compressible <: AbstractCompressible\n\nCompressible fluid model containing fluid field parameters for compressible flows with constant parameters - ideal gas with constant viscosity.\n\nFields\n\n'nu' – Fluid kinematic viscosity.\n'cp' – Fluid specific heat capacity.\ngamma – Ratio of specific heats.\nPr – Fluid Prantl number.\n\nExamples\n\nFluid{Compressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructur with default values.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Fluid","page":"Reference","title":"XCALibre.ModelPhysics.Fluid","text":"Fluid <: AbstractFluid\n\nAbstract fluid model type for constructing new fluid models.\n\nFields\n\n'args' – Model arguments.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Incompressible","page":"Reference","title":"XCALibre.ModelPhysics.Incompressible","text":"Incompressible <: AbstractIncompressible\n\nIncompressible fluid model containing fluid field parameters for incompressible flows.\n\nFields\n\n'nu' – Fluid kinematic viscosity.\n'rho' – Fluid density.\n\nExamples\n\nFluid{Incompressible}(nu=0.001, rho=1.0) - Constructor with default values.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.KOmega","page":"Reference","title":"XCALibre.ModelPhysics.KOmega","text":"KOmega <: AbstractTurbulenceModel\n\nkOmega model containing all kOmega field parameters.\n\nFields\n\n'k' – Turbulent kinetic energy ScalarField.\n'omega' – Specific dissipation rate ScalarField.\n'nut' – Eddy viscosity ScalarField.\n'kf' – Turbulent kinetic energy FaceScalarField.\n'omegaf' – Specific dissipation rate FaceScalarField.\n'nutf' – Eddy viscosity FaceScalarField.\n'coeffs' – Model coefficients.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.KOmegaLKE","page":"Reference","title":"XCALibre.ModelPhysics.KOmegaLKE","text":"KOmegaLKE <: AbstractTurbulenceModel\n\nkOmega model containing all kOmega field parameters.\n\nFields\n\n'k' – Turbulent kinetic energy ScalarField.\n'omega' – Specific dissipation rate ScalarField.\n'kl' – ScalarField.\n'nut' – Eddy viscosity ScalarField.\n'kf' – Turbulent kinetic energy FaceScalarField.\n'omegaf' – Specific dissipation rate FaceScalarField.\n'klf' – FaceScalarField.\n'nutf' – Eddy viscosity FaceScalarField.\n'coeffs' – Model coefficients.\n'Tu' – Freestream turbulence intensity for model.\n'y' – Near-wall distance for model.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.LES","page":"Reference","title":"XCALibre.ModelPhysics.LES","text":"LES <: AbstractLESModel\n\nAbstract LES model type for constructing LES models.\n\nFields\n\n'args' – Model arguments.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Laminar","page":"Reference","title":"XCALibre.ModelPhysics.Laminar","text":"Laminar <: AbstractTurbulenceModel\n\nLaminar model definition for physics API.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Momentum","page":"Reference","title":"XCALibre.ModelPhysics.Momentum","text":"struct Momentum{V,S,SS} <: AbstractMomentumModel\n U::V \n p::S \n sources::SS\nend\n\nMomentum model containing key momentum fields.\n\nFields\n\n'U' – Velocity VectorField.\n'p' – Pressure ScalarField.\n'sources' – Momentum model sources.\n\nExamples\n\n`Momentum(mesh::AbstractMesh)\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Physics","page":"Reference","title":"XCALibre.ModelPhysics.Physics","text":"struct Physics{T,F,M,Tu,E,D,BI}\n time::T\n fluid::F\n momentum::M \n turbulence::Tu \n energy::E\n domain::D\n boundary_info::BI\nend\n\nXCALibre's parametric Physics type for user-level API. Also used to dispatch flow solvers.\n\nFields\n\n'time::Union{Steady, Transient}' – User-provided time model.\n'fluid::AbstractFluid' – User-provided Fluid` model.\n'momentum' – Momentum model. Currently this is auto-generated by the Physics constructor\n'turbulence::AbstractTurbulenceModel' – User-provided Turbulence` model.\n'energy:AbstractEnergyModel' – User-provided Energy model.\n'domain::AbstractMesh ' – User-provided Mesh. Must be adapted to target device before constructing a Physics object.\n'boundaryinfo::boundaryinfo' – Mesh boundary information. Auto-generated by the Physics constructor\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Physics-Tuple{}","page":"Reference","title":"XCALibre.ModelPhysics.Physics","text":"Physics(; time, fluid, turbulence, energy, domain)::Physics{T,F,M,Tu,E,D,BI}\n\nPhysics constructor part of the top-level API. It can be used to define the Physics and models relevant to a simulation. This constructor uses keyword arguments to allow users to fine-tune their simulations, whilst some fields are auto-generated behind the scenes for convenience (Momentum and boundary_info). Where:\n\ntime - specified the time model (Steady or Transient)\nfluid - specifies the type of fluid (Incompressible, etc.)\nturbulence - specified the Turbulence model\nenergy - specifies the Energy treatment\ndomain - provides the mesh to used (must be adapted to the target backend device)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.RANS","page":"Reference","title":"XCALibre.ModelPhysics.RANS","text":"RANS <: AbstractRANSModel\n\nAbstract RANS model type for consturcting RANS models.\n\nFields\n\n'args' – Model arguments.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.SensibleEnthalpy","page":"Reference","title":"XCALibre.ModelPhysics.SensibleEnthalpy","text":"SensibleEnthalpy <: AbstractEnergyModel\n\nType that represents energy model, coefficients and respective fields.\n\nFields\n\n'h' – Sensible enthalpy ScalarField.\n'T' – Temperature ScalarField.\n'hf' – Sensible enthalpy FaceScalarField.\n'Tf' – Temperature FaceScalarField.\n'K' – Specific kinetic energy ScalarField.\n'dpdt' – Pressure time derivative ScalarField.\n'updated_BC' – Boundary condition function to convert temperature to sensible enthalp on on a fixed value boudary.\n'coeffs' – A tuple of model coefficients.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Smagorinsky","page":"Reference","title":"XCALibre.ModelPhysics.Smagorinsky","text":"Smagorinsky <: AbstractTurbulenceModel\n\nSmagorinsky LES model containing all Smagorinksy field parameters.\n\nFields\n\n'nut' – Eddy viscosity ScalarField.\n'nutf' – Eddy viscosity FaceScalarField.\n'coeffs' – Model coefficients.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Steady","page":"Reference","title":"XCALibre.ModelPhysics.Steady","text":"Steady\n\nSteady model for Physics model API.\n\nExamples\n\nSteady()\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Transient","page":"Reference","title":"XCALibre.ModelPhysics.Transient","text":"Transient\n\nTransient model for Physics model API.\n\nExamples\n\nTransient()\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.WeaklyCompressible","page":"Reference","title":"XCALibre.ModelPhysics.WeaklyCompressible","text":"WeaklyCompressible <: AbstractCompressible\n\nWeakly compressible fluid model containing fluid field parameters for weakly compressible flows with constant parameters - ideal gas with constant viscosity.\n\nFields\n\n'nu' – Fluid kinematic viscosity.\n'cp' – Fluid specific heat capacity.\ngamma – Ratio of specific heats.\nPr – Fluid Prandtl number.\n\nExamples\n\nFluid{WeaklyCompressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructor with \n\ndefault values.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Ttoh!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{Physics{T1, F, M, Tu, E, D, BI}, ScalarField, ScalarField}} where {T1, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.Ttoh!","text":"Ttoh!(model::Physics{T1,F,M,Tu,E,D,BI}, T::ScalarField, h::ScalarField\n) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nFunction coverts temperature ScalarField to sensible enthalpy ScalarField.\n\nInput\n\nmodel – Physics model defined by user.\nT – Temperature ScalarField.\nh – Sensible enthalpy ScalarField.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.energy!-Union{Tuple{E1}, Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{XCALibre.ModelPhysics.Sensible_Enthalpy_Model{E1}, Physics{T1, F, M, Tu, E, D, BI}, Vararg{Any, 6}}} where {T1, F, M, Tu, E, D, BI, E1}","page":"Reference","title":"XCALibre.ModelPhysics.energy!","text":"energy::Sensible_Enthalpy_Model{E1}, model::Physics{T1,F,M,Tu,E,D,BI}, prev, mdotf, rho, mueff, time, config\n) where {T1,F,M,Tu,E,D,BI,E1}\n\nRun energy transport equations.\n\nInput\n\nenergy – Energy model.\nmodel – Physics model defined by user.\nprev – Previous energy cell values.\nmdtof – Face mass flow.\nrho – Density ScalarField.\nmueff – Effective viscosity FaceScalarField.\ntime –\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.htoT!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{Physics{T1, F, M, Tu, E, D, BI}, ScalarField, ScalarField}} where {T1, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.htoT!","text":"htoT!(model::Physics{T1,F,M,Tu,E,D,BI}, h::ScalarField, T::ScalarField\n) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nFunction coverts sensible enthalpy ScalarField to temperature ScalarField.\n\nInput\n\nmodel – Physics model defined by user.\nh – Sensible enthalpy ScalarField.\nT – Temperature ScalarField.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{SensibleEnthalpy, Physics{T1, F, M, Tu, E, D, BI}, Vararg{Any, 4}}} where {T1, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(energy::SensibleEnthalpy, model::Physics{T1,F,M,Tu,E,D,BI}, mdotf, rho, peqn, config\n) where {T1,F,M,Tu,E,D,BI})\n\nInitialisation of energy transport equations.\n\nInput\n\nenergy – Energy model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\nrho – Density ScalarField.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nSensible_Enthalpy_Model – Energy model struct containing energy equation.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{KOmega, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(turbulence::KOmega, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n) where {T,F,M,Tu,E,D,BI}\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nKOmegaModel(k_eqn, ω_eqn) – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{KOmegaLKE, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(turbulence::KOmegaLKE, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n) where {T,F,M,Tu,E,D,BI}\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nKOmegaLKEModel( k_eqn, ω_eqn, kl_eqn, nueffkLS, nueffkS, nueffωS, nuL, nuts, Ω, γ, fv, normU, Reυ, ∇k, ∇ω ) – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Laminar, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"function initialise(\n turbulence::Laminar, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n ) where {T,F,M,Tu,E,D,BI}\nreturn LaminarModel()\n\nend\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nLaminarModel() – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Smagorinsky, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(turbulence::Smagorinsky, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n) where {T,F,M,Tu,E,D,BI}\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nSmagorinskyModel(Δ, magS) – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.thermo_Psi!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, FaceScalarField, Any}} where {T, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.thermo_Psi!","text":"thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psif::FaceScalarField) \nwhere {T,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nFunction updates the value of Psi.\n\nInput\n\nmodel – Physics model defined by user.\nPsif – Compressibility factor FaceScalarField.\n\nAlgorithm\n\nWeakly compressible currently uses the ideal gas equation for establishing the compressibility factor where rho = p * Psi. Psi is calculated from the sensible enthalpy, reference temperature and fluid model specified C_p and R value where R is calculated from C_p and gamma specified in the fluid model.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.thermo_Psi!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, ScalarField}} where {T, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.thermo_Psi!","text":"thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psi::ScalarField) \nwhere {T,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nModel updates the value of Psi.\n\nInput\n\nmodel – Physics model defined by user.\nPsi – Compressibility factor ScalarField.\n\nAlgorithm\n\nWeakly compressible currently uses the ideal gas equation for establishing the compressibility factor where rho = p * Psi. Psi is calculated from the sensible enthalpy, reference temperature and fluid model specified C_p and R value where R is calculated from C_p and gamma specified in the fluid model.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Turb}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.KOmegaLKEModel, Physics{T, F, M, Turb, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Turb<:KOmegaLKE, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(rans::KOmegaLKEModel, model::Physics{T,F,M,Turb,E,D,BI}, S, S2, prev, time, config ) where {T,F,M,Turb<:KOmegaLKE,E,D,BI}\n\nRun turbulence model transport equations.\n\nInput\n\nrans::KOmegaLKEModel – KOmega turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.LaminarModel, Physics{T, F, M, Tu, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Tu<:Laminar, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(rans::LaminarModel, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config\n) where {T,F,M,Tu<:Laminar,E,D,BI}\n\nRun turbulence model transport equations.\n\nInput\n\nrans::LaminarModel – Laminar turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{E2}, Tuple{E1}, Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.KOmegaModel{E1, E2}, Physics{T, F, M, Tu, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Tu<:KOmega, E, D, BI, E1, E2}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(rans::KOmegaModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config\n) where {T,F,M,Tu<:KOmega,E,D,BI,E1,E2}\n\nRun turbulence model transport equations.\n\nInput\n\nrans::KOmegaModel{E1,E2} – KOmega turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{E2}, Tuple{E1}, Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.SmagorinskyModel{E1, E2}, Physics{T, F, M, Tu, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Tu<:Smagorinsky, E, D, BI, E1, E2}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(les::SmagorinskyModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config\n) where {T,F,M,Tu<:Smagorinsky,E,D,BI,E1,E2}\n\nRun turbulence model transport equations.\n\nInput\n\nles::SmagorinskyModel{E1,E2} – Smagorinsky LES turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Simulate.Configuration","page":"Reference","title":"XCALibre.Simulate.Configuration","text":"@kwdef struct Configuration{SC,SL,RT,HW}\n schemes::SC\n solvers::SL\n runtime::RT\n hardware::HW\nend\n\nThe Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation. \n\nInputs\n\nschemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.\nsolvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.\nruntime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.\nhardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.\n\nExample\n\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Solvers.csimple!-Tuple{Any, Any}","page":"Reference","title":"XCALibre.Solvers.csimple!","text":"csimple!(model_in, config; resume=true, pref=nothing)\n\nCompressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy. \n\nInput\n\nmodel in – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\nresume – True or false indicating if case is resuming or starting a new simulation.\npref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.piso_comp!-Tuple{Any, Any}","page":"Reference","title":"XCALibre.Solvers.piso_comp!","text":"piso_comp!(model_in, config; resume=true, pref=nothing)\n\nCompressible variant of the PISO algorithm with a sensible enthalpy transport equation for the energy. \n\nInput\n\nmodel in – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\nresume – True or false indicating if case is resuming or starting a new simulation.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Steady, F<:Incompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Steady,F<:Incompressible,M,Tu,E,D,BI}\n\nIncompressible steady solver using the SIMPLE algorithm.\n\nInput\n\nmodel – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Steady, F<:WeaklyCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Steady,F<:WeaklyCompressible,M,Tu,E,D,BI}\n\nMildly compressible steady solver using the SIMPLE algorithm for low speed cases with heat transfer.\n\nInput\n\nmodel – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Transient, F<:Incompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Transient,F<:Incompressible,M,Tu,E,D,BI}\n\nIncompressible unsteady solver using the PISO algorithm.\n\nInput\n\nmodel – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Transient, F<:WeaklyCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Transient,F<:WeaklyCompressible,M,Tu,E,D,BI}\n\nMildly compressible unsteady solver using the PISO algorithm for low speed cases with heat transfer.\n\nInput\n\nmodel – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.simple!-Tuple{Any, Any}","page":"Reference","title":"XCALibre.Solvers.simple!","text":"simple!(model_in, config; resume=true, pref=nothing)\n\nCompressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy. \n\nInput\n\nmodel in – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\nresume – True or false indicating if case is resuming or starting a new simulation.\npref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"user_guide/1_preprocessing/#Pre-processing","page":"Pre-processing","title":"Pre-processing","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"super brief summary","category":"page"},{"location":"user_guide/1_preprocessing/#Mesh-generation-and-requirements","page":"Pre-processing","title":"Mesh generation and requirements","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"As with all CFD solvers, defining a suitable mesh is one of the most important steps. XCALibre.jl does not provides mesh generation utilities (yet). Thus, the user will have to generate the grids using external mesh generation tools. However, XCALibre.jl does provide a number of mesh conversion tools to allow user to import their grids. ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"XCALibre.jl is an unstructured Finite Volume Method (FVM) library, therefore, we are able to support grids of arbitrary polyhedral cells. In XCALibre.jl a cell-centred FVM approach has been implemented, which is popular since it allows the representation of complex geometries and it is used by most commercial and many open source CFD solvers.","category":"page"},{"location":"user_guide/1_preprocessing/#Mesh-conversion","page":"Pre-processing","title":"Mesh conversion","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"XCALibre.jl at present supports .unv mesh formats (which can be generated using SALOME) for simulations in 2D and 3D domains. Additionally, XCALibre.jl also supports the OpenFOAM mesh format for simulations in 3D only (for now). ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"note: Note\nCurrently, XCALibre.jl only supports loading mesh files stored in ASCII format. Please ensure that when saving grid files they are not saved in binary. Most mesh generation programmes offer the option to export in ASCII (test-based) formats.","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"The following functions are provided for importing mesh files:","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"UNV2D_mesh\nUNV3D_mesh\nFOAM3D_mesh","category":"page"},{"location":"user_guide/1_preprocessing/#XCALibre.UNV2.UNV2D_mesh","page":"Pre-processing","title":"XCALibre.UNV2.UNV2D_mesh","text":"UNV2D_mesh(meshFile; scale=1, integer_type=Int64, float_type=Float64)\n\nRead and convert 2D UNV mesh file into XCALibre.jl\n\nInput\n\nmeshFile – path to mesh file.\n\nOptional arguments\n\nscale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling\ninteger_type - select interger type to use in the mesh (Int32 may be useful on GPU runs) \nfloat_type - select interger type to use in the mesh (Float32 may be useful on GPU runs) \n\n\n\n\n\n","category":"function"},{"location":"user_guide/1_preprocessing/#XCALibre.UNV3.UNV3D_mesh","page":"Pre-processing","title":"XCALibre.UNV3.UNV3D_mesh","text":"UNV3D_mesh(unv_mesh; scale=1, integer_type=Int64, float_type=Float64)\n\nRead and convert 3D UNV mesh file into XCALibre.jl. Note that a limitation of the .unv mesh format is that it only supports the following 3D cells:\n\nTetahedrals\nPrisms\nHexahedrals\n\nInput\n\nunv_mesh – path to mesh file.\n\nOptional arguments\n\nscale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling\ninteger_type - select interger type to use in the mesh (Int32 may be useful on GPU runs) \nfloat_type - select interger type to use in the mesh (Float32 may be useful on GPU runs) \n\n\n\n\n\n","category":"function"},{"location":"user_guide/1_preprocessing/#XCALibre.FoamMesh.FOAM3D_mesh","page":"Pre-processing","title":"XCALibre.FoamMesh.FOAM3D_mesh","text":"FOAM3D_mesh(mesh_file; scale=1, integer_type=Int64, float_type=Float64)\n\nRead and convert 3D OpenFOAM mesh file into XCALibre.jl. Note that, at present, it is not recommended to run 2D cases using meshes imported using this function.\n\nInput\n\nmesh_file – path to mesh file.\n\nOptional arguments\n\nscale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling\ninteger_type - select interger type to use in the mesh (Int32 may be useful on GPU runs) \nfloat_type - select interger type to use in the mesh (Float32 may be useful on GPU runs) \n\n\n\n\n\n","category":"function"},{"location":"user_guide/1_preprocessing/#Mesh-limitations-and-requirements","page":"Pre-processing","title":"Mesh limitations and requirements","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"In this section we summarise the key limitations of the mesh loaders presented above, and we also highlight specific requirements. ","category":"page"},{"location":"user_guide/1_preprocessing/#UNV-mesh-files","page":"Pre-processing","title":"UNV mesh files","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Only ASCII files are supported\nFor 2D simulations the mesh must be contained in the X-Y plane only\nIn 3D only hex, tet and prism elements are supported","category":"page"},{"location":"user_guide/1_preprocessing/#OpenFOAM-mesh-files","page":"Pre-processing","title":"OpenFOAM mesh files","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Only ASCII files are supported\nBoundary groups are not supported (must be deleted manually or the conversion may fail)\nBoundary information is not preserved (walls, symmetry, etc)\n2D setups are not currently supported (but will be)","category":"page"},{"location":"user_guide/1_preprocessing/#Backend-selection","page":"Pre-processing","title":"Backend selection","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"In XCALibre.jl the mesh object is very important, as it will not only provide geometry information about the simulation/s, but it is also used to automatically dispatch methods to run on the appropriate backend. Therefore, users must first select the backend they wish to use for the simulations, and then \"adapt\" the mesh to use the correct backend. ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"XCALIbre.jl aims to work with all the backends supported by KernelAbstractions.jl. However, since internally XCALibre.jl uses sparse arrays to reduce its memory footprint some GPU backends are not currently supported since this functionality is not yet available. Thus, currently only a subset of backends are supported:","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"CPU (multithreaded and tested)\nNVidia GPUs (tested)\nAMD GPUs (not tested - feedback welcome)","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Selecting a given backend is straight forward. Below examples are provided by assigning a backend to the symbol backend and assigning the mesh object to the appropriate backend device using the symbol mesh_dev","category":"page"},{"location":"user_guide/1_preprocessing/#CPU-backend","page":"Pre-processing","title":"CPU backend","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Selecting the CPU backend is straight forward. See the example below. Notice that CPU() is a backend type provided by KernelAbstractions.jl which we re-export for convenience.","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"CPU Example ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh\nbackend = CPU()\nmesh_dev = mesh # dummy reference to emphasise the mesh in on our chosen dev (or backend)","category":"page"},{"location":"user_guide/1_preprocessing/#GPU-backends","page":"Pre-processing","title":"GPU backends","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"To run on GPUS, the process is also quite simple, but does require a few additional steps.","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Install the corresponding Julia library that supports your hardware. For NVidia GPUs, the CUDA.jl package is required. For AMD GPUs, the AMDGPU.jl package is needed.\nMove the mesh object to the backend device using the adapt method which for convenience we re-export from Adapt.jl","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Example for Nvidia GPU","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh\nbackend = CUDABackend()\nmesh_dev = adapt(backend, mesh) # make mesh object backend compatible and move to GPU","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Example for AMD GPU","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh\nbackend = ROCBackend()\nmesh_dev = adapt(backend, mesh) # make mesh object backend compatible and move to GPU","category":"page"},{"location":"user_guide/5_postprocessing/#Post-processing","page":"Post-processing","title":"Post-processing","text":"","category":"section"},{"location":"user_guide/5_postprocessing/","page":"Post-processing","title":"Post-processing","text":"super brief summary","category":"page"},{"location":"user_guide/5_postprocessing/#ParaView","page":"Post-processing","title":"ParaView","text":"","category":"section"},{"location":"user_guide/5_postprocessing/","page":"Post-processing","title":"Post-processing","text":"","category":"page"},{"location":"user_guide/5_postprocessing/#Available-functions","page":"Post-processing","title":"Available functions","text":"","category":"section"},{"location":"user_guide/5_postprocessing/","page":"Post-processing","title":"Post-processing","text":"","category":"page"},{"location":"release_notes/#Release-Notes","page":"Release Notes","title":"Release Notes","text":"","category":"section"},{"location":"#XCALibre.jl","page":"Home","title":"XCALibre.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XPU CFD Algorithms and libraries","category":"page"},{"location":"#What-is-XCALibre.jl?","page":"Home","title":"What is XCALibre.jl?","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl (pronounced as the mythical sword Excalibur) is a general purpose Computational Fluid Dynamics (CFD) library for 2D and 3D simulations on structured/unstructured grids using the finite volume method. XCALibre.jl has been designed to act as a platform for developing, testing and using XPU CFD Algorithms and Libraries to give researchers in both academia and industry alike a tool that can be used to test out ideas easily within a framework that offers acceptable performance. To this end, XCALibre.jl has been implemented to offer both CPU multi-threaded capabilities or GPU acceleration using the same codebase (thanks to the unified programming framework provided by KernelAbstractions.jl). Additionally, XCALibre.jl also offers a friendly API for those users who are interested in running CFD simulations with the existing solvers and models built into XCALibre.jl. ","category":"page"},{"location":"#Why-XCALibre.jl?","page":"Home","title":"Why XCALibre.jl?","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"For CFD researchers whose research involves developing new numerical methods, turbulence models, or novel CFD methodologies, the development process can be taxiing when using commercial packages and their imagination might be constrained by having to adhere to either limited access to internal code functionality or exhausted as they reformulate their ideas to fit within any interfaces provided by the code. There are excellent open source CFD packages where access to functionality or internals is available, however, they are either written in static languages such as C/C++ or dynamic languages such as Python. In static languages, the resulting code is likely highly performant but implementation can be slow and often has a high learning curve (specially if the developer/researcher has no prior knowledge of the language). On the other hand, dynamics languages such as Python can offer a nice development experience at the cost of low runtime or reduced performance. The development of XCALibre.jl was motivated when we discovered the Julia programming language, which promises an interactive and enjoyable implementation experience whilst being able to generate performant code. Thanks to the tools available in the Julia ecosystems (see Main dependencies) it is also possible to generate CPU and GPU code using Julia. As a side effect, XCALibre.jl can also link readily with the entire Julia ecosystem, including machine learning frameworks such as Flux.jl, Lux.jl, Knet.jl, etc. Thanks to a user-friendly API, ultimately, we hope that XCALibre.jl can be useful to anyone who has an interest in CFD. Enjoy and give us feedback LINK.","category":"page"},{"location":"#Main-features","page":"Home","title":"Main features","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"#Multiple-backends","page":"Home","title":"Multiple backends","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl embraces parallelism out-of-the-box on all the compute backends supported by KernelAbstractions.jl. That is,","category":"page"},{"location":"","page":"Home","title":"Home","text":"GPU acceleration on Nvidia, AMD, Intel and Apple hardware\nMulti-threaded runs on CPUs","category":"page"},{"location":"","page":"Home","title":"Home","text":"note: Note\nGPU functionality has only been tested on Nvidia hardware due to availability. Although GPUs from other vendors should also work correctly. Please open an issue if this is not the case so we can investigate. Notice that Apple hardware will not work as expected due to support for sparse matrices not being implemented yet on Metal.jl","category":"page"},{"location":"#Mesh-formats","page":"Home","title":"Mesh formats","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl uses its own mesh format to allow the geometry and boundary information to be stored in a format that is suitable for both CPU and GPU calculations. XCALibre.jl does not yet provide mesh generation tools. Therefore, some mesh conversion tools for the following mesh formats are provided:","category":"page"},{"location":"","page":"Home","title":"Home","text":"OpenFOAM meshes for 3D simulations (ascii only)\nUNV meshes for 2D simulations (ascii only)\nUNV meshes for 3D simulations (ascii only)","category":"page"},{"location":"","page":"Home","title":"Home","text":"note: Note\nAlthough the mesh conversion tools for the OpenFOAM format can import grids designed for 2D simulations, it is not recommended to use OpenFOAM grids for 2D cases (at present, support for 2D OpenFOAM grids in progress). Instead, use a 2D grid generated in the .unv format. Also for 2D grids some requirements must be met when defining the geometry (see Mesh generation and requirements)","category":"page"},{"location":"#Solvers","page":"Home","title":"Solvers","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl ships with fluid solvers for steady and transient simulations, based on the SIMPLE and PISO algorithms. Currently, the following flow solvers are provided:","category":"page"},{"location":"","page":"Home","title":"Home","text":"Steady incompressible flows\nSteady weakly compressible flows\nTransient incompressible flows\nTransient weakly compressible flows","category":"page"},{"location":"","page":"Home","title":"Home","text":"note: Note\nA solver for highly compressible flows (shock capturing) is currently in testing and will be available in the next major release. Currently the compressible solvers are based use a sensible energy approach for the energy equation.","category":"page"},{"location":"#Turbulence-and-energy-models","page":"Home","title":"Turbulence and energy models","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The list of available turbulence models available is expected to expand. The following turbulence models are already available in XCALibre.jl","category":"page"},{"location":"","page":"Home","title":"Home","text":"Reynolds-Averaged Navier-Stokes (RANS)\nk-omega - available in low-Reynolds (wall-resolving) and in high-Reynolds (wall functions) mode\nk-omega LKE - transitional model using the Laminar Kinetic Energy concept to model transition onset\nLarge Eddy Simulation (LES with implicit filtering)\nSmagorinsky - classic eddy-viscosity sub-grid scale Smagorinsky model","category":"page"},{"location":"#Boundary-conditions","page":"Home","title":"Boundary conditions","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"User defined functions\nNeural network defined BCs","category":"page"},{"location":"#Numerical-schemes","page":"Home","title":"Numerical schemes","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Linear - second order schemes for gradients, laplacian and divergence terms\nUpwind - first order upwind-biased scheme for divergence terms\nLUST (divergence) - mixed order upwind-biased scheme for divergence terms\nMidpoint - skew-corrected scheme for gradient calculations\nSteadyState - dummy scheme used to dispatch solvers for operation in steady mode\nEuler - first order semi-implicit time scheme","category":"page"},{"location":"#Simple-API-for-transport-equations","page":"Home","title":"Simple API for transport equations","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Code example","category":"page"},{"location":"","page":"Home","title":"Home","text":"U_eqn = (\n Time{schemes.U.time}(U)\n + Divergence{schemes.U.divergence}(mdotf, U) \n - Laplacian{schemes.U.laplacian}(nueff, U) \n == \n -Source(∇p.result)\n\n ) → VectorEquation(mesh)","category":"page"},{"location":"#Planned-development","page":"Home","title":"Planned development","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"#Capabilities,-solvers,-algorithms,-models,-etc.","page":"Home","title":"Capabilities, solvers, algorithms, models, etc.","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Solver for highly compressible flows (including shockwaves)\nConjugate heat transfer\nk-epsilon turbulence model\nImplement parallel versions of more efficient preconditioners","category":"page"},{"location":"#API","page":"Home","title":"API","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Pass boundary conditions as a separate object. The correct approach results in some internal methods/objects not being fully compatible with GPU kernels, and results is some performance degradation (due to unnecessary data transfer between GPU and host device when boundary condition information is needed/applied). A separation of boundary conditions from field data (scalar and vector fields primarily) would address both of these issues.\nThere are no further immediate plans for changing the user API\nFine tuning of the public API expected based on of user feedback","category":"page"},{"location":"#Internals","page":"Home","title":"Internals","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Overhaul of field data. Currently, both vectors and tensors are built on the primitive scalar field object. Whilst this was convenience during the early development stage, the package has reach a level of maturity that makes this approach hard to maintain, adding unneeded complexity when working with tensors. We plan to define separate internals (how tensors are defined and stored in memory). It is anticipated that this will ease the implementation of models working with tensors, and give some performance gains since information will be stored closer in memory.","category":"page"},{"location":"#Main-dependencies","page":"Home","title":"Main dependencies","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl is possible (and relies) on the functionality provided by other packages in the Julia ecosystem. For a full list of direct dependencies please refer to the Project.toml file included with this repository. We are thankful to the teams that have helped develop and maintain every single of our dependencies. Major functionally is provided by the following:","category":"page"},{"location":"","page":"Home","title":"Home","text":"KernelAbstractions.jl - provides a unified parallel programming framework for CPUs and GPUs\nKrylov.jl - provide solvers for linear systems at the heart of XCALibre.jl\nLinearOperators.jl - wrappers for matrices and linear operators\nAtomix.jl - enable atomix operations to ensure race conditions are avoided in parallel kernels\nCUDA.jl, AMD.jl, Metal.jl and OneAPI.jl - not direct dependencies but packages enable GPU usage in Julia","category":"page"},{"location":"#Related-projects","page":"Home","title":"Related projects","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"There are other wonderful fluids simulation packages available in the Julia ecosystems (please let us know if we missed any):","category":"page"},{"location":"","page":"Home","title":"Home","text":"Oceananigans.jl ADD LINK \nWaterlilly.jl ADD LINK \nTrixi.jl ADD LINK ","category":"page"}] +[{"location":"user_guide/4_runtime_and_solvers/#Runtime-and-solvers","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"Final steps before launching a simulation","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#Runtime-setup","page":"Runtime and solvers","title":"Runtime setup","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"set_runtime","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#XCALibre.Solve.set_runtime-user_guide-4_runtime_and_solvers","page":"Runtime and solvers","title":"XCALibre.Solve.set_runtime","text":"set_runtime(; \n # keyword arguments\n iterations::I, \n write_interval::I, \n time_step::N\n ) where {I<:Integer,N<:Number} = begin\n \n # returned `NamedTuple``\n (\n iterations=iterations, \n dt=time_step, \n write_interval=write_interval)\nend\n\nThis is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.\n\nInput arguments\n\niterations::Integer specifies the number of iterations in a simulation run.\nwrite_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.\ntime_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.\n\nExample\n\nruntime = set_runtime(\n iterations=2000, time_step=1, write_interval=2000)\n\n\n\n\n\n","category":"function"},{"location":"user_guide/4_runtime_and_solvers/#Configuration-object","page":"Runtime and solvers","title":"Configuration object","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"Configuration","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#XCALibre.Simulate.Configuration-user_guide-4_runtime_and_solvers","page":"Runtime and solvers","title":"XCALibre.Simulate.Configuration","text":"@kwdef struct Configuration{SC,SL,RT,HW}\n schemes::SC\n solvers::SL\n runtime::RT\n hardware::HW\nend\n\nThe Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation. \n\nInputs\n\nschemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.\nsolvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.\nruntime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.\nhardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.\n\nExample\n\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\n\n\n\n\n","category":"type"},{"location":"user_guide/4_runtime_and_solvers/#Initialising-fields","page":"Runtime and solvers","title":"Initialising fields","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"initialise!","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#XCALibre.Fields.initialise!-user_guide-4_runtime_and_solvers","page":"Runtime and solvers","title":"XCALibre.Fields.initialise!","text":"function initialise!(field, value) # dummy function for documentation\n # Assign `value` to field in-place\n nothing\nend\n\nThis function will set the given field to the value provided in-place. Useful for initialising fields prior to running a simulation.\n\nInput arguments\n\nfield specifies the field to be initialised. The field must be either a AbractScalarField or AbstractVectorField\nvalue defines the value to be set. This should be a scalar or vector (3 components) depending on the field to be modified e.g. for an AbstractVectorField we can specify as value=[10,0,0]\n\nNote: in most cases the fields to be modified are stored within a physics model i.e. a Physics object. Thus, the argument value must fully qualify the model. For example, if we have created a Physics model named mymodel to set the velocity field, U, we would set the argument field to mymodel.momentum.U. See the example below.\n\nExample\n\ninitialise!(mymodel.momentum.U, [2.5, 0, 0])\ninitialise!(mymodel.momentum.p, 1.25)\n\n\n\n\n\n","category":"function"},{"location":"user_guide/4_runtime_and_solvers/#Launching-flow-solvers","page":"Runtime and solvers","title":"Launching flow solvers","text":"","category":"section"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"run!()","category":"page"},{"location":"user_guide/4_runtime_and_solvers/#XCALibre.Solvers.run!-Tuple{}-user_guide-4_runtime_and_solvers","page":"Runtime and solvers","title":"XCALibre.Solvers.run!","text":"residuals = run!(model::Physics, config::Configuration)\n\nDescription goes here\n\nInput arguments\n\nExample\n\nSomething here\n\n\n\n\n\n","category":"method"},{"location":"user_guide/4_runtime_and_solvers/","page":"Runtime and solvers","title":"Runtime and solvers","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#2D-constant-temperature-flat-plate","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/#Overview","page":"2D constant temperature flat plate","title":"Overview","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"A 2D constant temperature laminar flat plate case has been used to validate the weakly compressible solver. The case provides a constant temperature boundary condition along the wall of the domain. ","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The results of case are compared against the theoretical local Nusselt number correlation for forced convection on constant temperature flat plate:","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Nu_x = 0332 Re_x^12 Pr^13","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The correlation is valid for Prandtl numbers greater than 0.6.","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The boundaries are shown in the mesh figure and the tables below describe the boundary settings used.","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Inlet","page":"2D constant temperature flat plate","title":"Inlet","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU Dirichlet ([0.2, 0.0, 0.0] m/s)\np Neumann (Zero-gradient)\nT FixedTemperature (300.0 K)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Wall","page":"2D constant temperature flat plate","title":"Wall","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU No-slip wall\np Neumann (Zero-gradient)\nT FixedTemperature (310.0 K)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Outlet","page":"2D constant temperature flat plate","title":"Outlet","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU Neumann (Zero-gradient)\np Dirichlet (0.0 Pa)\nT Neumann (Zero-gradient)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Top","page":"2D constant temperature flat plate","title":"Top","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Field Boundary condition\nU Neumann (Zero-gradient)\np Neumann (Zero-gradient)\nT Neumann (Zero-gradient)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Fluid-Properties","page":"2D constant temperature flat plate","title":"Fluid Properties","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"Property value\nnu 0.0001\nPr 0.71\nc_p 1005.0\ngamma 1.4","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Mesh","page":"2D constant temperature flat plate","title":"Mesh","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The mesh is shown in the figure below:","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"(Image: Figure of mesh.)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The streamwise cell length is 2mm with a total domain length of 1m. The near-wall cell height is 0.049mm with a domain height of 0.2m.","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Case-file","page":"2D constant temperature flat plate","title":"Case file","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"using XCALibre\n\nmesh_file = pkgdir(XCALibre, \"testcases/compressible/2d_laminar_heated_plate/flatplate_2D_laminar.unv\")\nmesh = UNV2D_mesh(mesh_file, scale=0.001)\n\nvelocity = [0.2, 0.0, 0.0]\nnu = 1e-4\nRe = velocity[1]*1/nu\ncp = 1005.0\ngamma = 1.4\nPr = 0.7\n\nmodel = Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(\n nu = nu,\n cp = cp,\n gamma = gamma,\n Pr = Pr\n ),\n turbulence = RANS{Laminar}(),\n energy = Energy{SensibleEnthalpy}(Tref = 288.15),\n domain = mesh # mesh_dev # use mesh_dev for GPU backend\n )\n\n@assign! model momentum U (\n Dirichlet(:inlet, velocity),\n Neumann(:outlet, 0.0),\n Wall(:wall, [0.0, 0.0, 0.0]),\n Symmetry(:top, 0.0)\n)\n\n @assign! model momentum p (\n Neumann(:inlet, 0.0),\n Dirichlet(:outlet, 100000.0),\n Neumann(:wall, 0.0),\n Neumann(:top, 0.0)\n)\n\n@assign! model energy h (\n FixedTemperature(:inlet, T=300.0, model=model.energy),\n Neumann(:outlet, 0.0),\n FixedTemperature(:wall, T=310.0, model=model.energy),\n Neumann(:top, 0.0)\n)\n\nschemes = (\n U = set_schemes(divergence=Linear),\n p = set_schemes(divergence=Linear),\n h = set_schemes(divergence=Linear)\n)\n\nsolvers = (\n U = set_solver(\n model.momentum.U;\n solver = BicgstabSolver,\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n ),\n p = set_solver(\n model.momentum.p;\n solver = CgSolver,\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.3,\n ),\n h = set_solver(\n model.energy.h;\n solver = BicgstabSolver,\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-2,\n atol = 1e-4\n )\n)\n\nruntime = set_runtime(iterations=1000, write_interval=1000, time_step=1)\n\nhardware = set_hardware(backend=CPU(), workgroup=4)\n\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\nGC.gc()\n\ninitialise!(model.momentum.U, velocity)\ninitialise!(model.momentum.p, 100000.0)\ninitialise!(model.energy.T, 300.0)\n\nRx, Ry, Rz, Rp, Re, model_out = run!(model, config)","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/#Results","page":"2D constant temperature flat plate","title":"Results","text":"","category":"section"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"The results of the model are compared to the theoretical correlation in the figure below:","category":"page"},{"location":"VV/2d-constant-temperature-flat-plate/","page":"2D constant temperature flat plate","title":"2D constant temperature flat plate","text":"(Image: Nusselt number distribution results.)","category":"page"},{"location":"user_guide/0_introduction_and_workflow/#Introduction","page":"Introduction","title":"Introduction","text":"","category":"section"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"This page explains the overarching workflow in XCALibre.jl and provides a list of contents","category":"page"},{"location":"user_guide/0_introduction_and_workflow/#Workflow-overview","page":"Introduction","title":"Workflow overview","text":"","category":"section"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"XCALibre.jl has been designed to incorporate a logical workflow, that is, the sequence of setup steps that would take a user naturally from the start of a simulation to its final post-processing. The key steps are listed below","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"Pre-processing - this step involves defining the computational domain and selecting the corresponding backend to performs the calculations\nPhysics and models - this step involves defining the fluid type, flow properties, selecting appropriate models and setting suitable boundary conditions\nNumerical setup - in this phase of the simulation set up all aspect related to the numerics are chosen, from distretisation schemes all the way to solvers and preconditioners. \nRuntime and solvers - once everything has been set up, the simulation is ready to run, once runtime information such as time steps and solution saving intervals has been selected. The final step is to actually start the simulation.\nPost-processing - the final step is to enjoy all the pretty pictures!","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"The user guide is structured such that the information provided is grouped following the workflow illustrated above. For convenience the contents of the user guide are included below, with links to the relevant sections.","category":"page"},{"location":"user_guide/0_introduction_and_workflow/#Contents","page":"Introduction","title":"Contents","text":"","category":"section"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"","category":"page"},{"location":"user_guide/0_introduction_and_workflow/","page":"Introduction","title":"Introduction","text":"Pages = Main.USER_GUIDE_PAGES\nDepth = 2","category":"page"},{"location":"user_guide/3_numerical_setup/#Numerical-setup","page":"Numerical setup","title":"Numerical setup","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"super brief summary","category":"page"},{"location":"user_guide/3_numerical_setup/#Discretisation-schemes","page":"Numerical setup","title":"Discretisation schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Part of the methodology to solve the various model equations using the Finite Volume Method (FVM) is to discretise each equation term, essentially, this process linearises the partial differential equation so that it can be represented as a system of linear equations, which can be solved using linear algebra along with iterative solvers. This section presents the discretisation schemes currently available in XCALibre.jl.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Discretisation schemes in XCALibre.jl are organised under the abstract type AbstractScheme. As shown previously, a list of available schemes can be found using the subtypes function:","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractScheme) # hide","category":"page"},{"location":"user_guide/3_numerical_setup/#Schemes-available","page":"Numerical setup","title":"Schemes available","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Time-schemes","page":"Numerical setup","title":"Time schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nSteadyState sets the time derivative to zero\nEuler First order implicit Euler scheme\nCrankNicolson Second order central scheme (not implemented)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Laplacian-schemes","page":"Numerical setup","title":"Laplacian schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nLinear 2nd order Gauss gradient scheme with linear interpolation","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Divergence-schemes","page":"Numerical setup","title":"Divergence schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nLinear 2nd order central difference\nUpwind 1st order upwind scheme\nBoundedUpwind Bounded version of the Upwind scheme\nLUST 1st/2nd order mixed scheme (fixed at 75% Linear - 25% Upwind)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Gradient-schemes","page":"Numerical setup","title":"Gradient schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Scheme Description\nOrthogonal Green-Gauss uncorrected gradient scheme\nMidpoint Green-Gauss skew corrected scheme (2 iterations - hardcoded)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/#Specifying-schemes","page":"Numerical setup","title":"Specifying schemes","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"XCALibre.jl flow solvers offer considerable flexibility to users for defining discretisation schemes. However, this means that for schemes must be specified for every term of every equation solved. The schemes must be provided as a NamedTuple where each keyword corresponds to the fields being solved, e.g. (U = ..., p = ..., k = ..., = ...). To facilitate this process, the set_schemes function is provided. Used without any inputs set_schemes uses the default values provided (see details below).","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"set_schemes","category":"page"},{"location":"user_guide/3_numerical_setup/#XCALibre.Discretise.set_schemes-user_guide-3_numerical_setup","page":"Numerical setup","title":"XCALibre.Discretise.set_schemes","text":"set_schemes(;\n # keyword arguments and their default values\n time=SteadyState,\n divergence=Linear, \n laplacian=Linear, \n gradient=Orthogonal) = begin\n \n # Returns NamedTuple definition for scheme \n (\n time=time,\n divergence=divergence,\n laplacian=laplacian,\n gradient=gradient\n )\nend\n\nThe set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.\n\ninputs\n\ntime is used to set the time schemes(default is SteadyState)\ndivergence is used to set the divergence scheme (default is Linear) \nlaplacian is used to set the laplacian scheme (default is Linear)\ngradient is used to set the gradient scheme (default is Orthogonal)\n\n\n\n\n\n","category":"function"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"For example, below we set the schemes for the U and p fields. Notice that in the first case the schemes will take their default values (entry for p). In the case of U, we are only changing the setting for the divergence scheme to Upwind.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre\nschemes = (\n p = set_schemes(), # no input provided (will use defaults)\n U = set_schemes(divergence = Upwind),\n)","category":"page"},{"location":"user_guide/3_numerical_setup/#Linear-solvers","page":"Numerical setup","title":"Linear solvers","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Linear solvers in XCALibre.jl are provided by Krylov.jl. The following solvers types are re-exported in XCALibre.jl","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"BicgstabSolver is a general purpose linear solver. Works well with non-symmetric matrices e.g. for U.\nCgSolver is particular strong with symmetric matrices e.g to solve the pressure equation.\nGmresSolver is a general solver. We have found it works best on the CPU backend.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"For more information on these solvers you can review the excellent documentation provided by the Krylov.jl team. ","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"XCALibre.jl provides the set_solver convenience function for setting solvers. See details below. ","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"set_solver","category":"page"},{"location":"user_guide/3_numerical_setup/#XCALibre.Solve.set_solver-user_guide-3_numerical_setup","page":"Numerical setup","title":"XCALibre.Solve.set_solver","text":"set_solver( \n field::AbstractField;\n # keyword arguments and defaults\n solver::S, \n preconditioner::PT, \n convergence, \n relax,\n limit=(),\n itmax::Integer=100, \n atol=(eps(_get_float(field.mesh)))^0.9,\n rtol=_get_float(field.mesh)(1e-3)\n ) where {S,PT<:PreconditionerType} = begin\n\n # return NamedTuple\n TF = _get_float(field.mesh)\n (\n solver=solver, \n preconditioner=preconditioner, \n convergence=convergence |> TF, \n relax=relax |> TF, \n limit=limit,\n itmax=itmax, \n atol=atol |> TF, \n rtol=rtol |> TF\n )\nend\n\nThis function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers. \n\nInput arguments\n\nfield reference to the field to which the solver settings will apply (used to provide integer and float types required)\nsolver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl\npreconditioner instance of preconditioner to be used e.g. Jacobi()\nconvergence sets the stopping criteria of this field\nrelax specifies the relaxation factor to be used e.g. set to 1 for no relaxation\nlimit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()\nitmax maximum number of iterations in a single solver pass (defaults to 100) \natol absolute tolerance for the solver (default to eps(FloatType)^0.9)\nrtol set relative tolerance for the solver (defaults to 1e-3)\n\n\n\n\n\n","category":"function"},{"location":"user_guide/3_numerical_setup/#Preconditioners","page":"Numerical setup","title":"Preconditioners","text":"","category":"section"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"XCALibre.jl offers a range of preconditioners which are subtypes of the abstrac type PreconditionerType, exploring its subtypes we can find a list of the currently available preconditioners: ","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(PreconditionerType) # hide","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"note: Note\nOnly the Jacobi and NormDiagonal preconditioners have GPU ready implementations. At present these have the most robust implementation and they can be used with both CPU and GPU backends. The other preconditioners can only be used on the CPU. Notice that on our tests the LDL preconditioner only works when paired with the GmresSolver on the CPU. Also notice that the implementation of the DILU preconditioner, although functions, is only experimental. Work on improving the offering of preconditioners is ongoing.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"Below an example is provided in context. Here, we are setting solvers for both the velocity field U and the pressure field p and packing them into a NamedTuple \"solvers\". The Jacobi preconditioner is use in both solvers. Notice that preconditioners are specified with an instance of their type i.e. Jacobi(). Internally, the preconditioner instance is used for dispatch. This tupple will then be pass on to create the final Configuration object.","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"DocTestSetup = quote\n using XCALibre\n mesh_file = pkgdir(XCALibre, \"examples/2d_incompressible_laminar_backwards_step/backward_facing_step_10mm.unv\")\n mesh = UNV2D_mesh(mesh_file, scale=0.001)\n mesh_dev = mesh # use this line to run on CPU\n nu = 1e-3\n model = Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu = nu),\n turbulence = RANS{Laminar}(),\n energy = Energy{Isothermal}(),\n domain = mesh_dev\n )\nend","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"using XCALibre\n\n# Note: this example assumes a Physics object named `model` already exists\n\nsolvers = (\n U = set_solver(\n model.momentum.U;\n solver = BicgstabSolver, # GmresSolver\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n ),\n p = set_solver(\n model.momentum.p;\n solver = CgSolver, # BicgstabSolver, GmresSolver\n preconditioner = Jacobi(),\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n )\n)","category":"page"},{"location":"user_guide/3_numerical_setup/","page":"Numerical setup","title":"Numerical setup","text":"DocTestSetup = nothing","category":"page"},{"location":"user_guide/2_physics_and_models/#Physics-and-models","page":"Physics and models","title":"Physics and models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"super brief summary","category":"page"},{"location":"user_guide/2_physics_and_models/#Physics-model-definition","page":"Physics and models","title":"Physics model definition","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The Physics object is part of the highest level API in XCALibre.jl. Physics objects are a means for users to set up the physics and models that are relevant to their particular CFD simulation. Internally, the Physics model created is pass to solvers and it is used for dispatch (solvers, algorithms and models). Thus, it is important to ensure that the information provided to this object is correct and representative of the user's intentions. Physics models consist of a struct with the fields shown below. All fields must be provided to the solvers otherwise the construction of the object will fail.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"struct Physics{T,F,M,Tu,E,D,BI}\n time::T\n fluid::F\n momentum::M \n turbulence::Tu \n energy::E\n domain::D\n boundary_info::BI\nend ","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For convenience, XCALibre.jl provides a more user-friendly constructor that will automatically take care of the construction of derived fields. This constructor uses keyword arguments and has the following signature (follow the link for more information)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(; time, fluid, turbulence, energy, domain)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"At this point, it is worth reminding users that one of the benefits of working with Julia is its dynamic nature. This means that objects can be dynamically interrogated. For example:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre\nfieldnames(Physics)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"This will provide users with all the fields that make up the Physics object. This is a nice way to explore the makeup of any object in Julia (and by extension XCALibre.jl). The rest of this page will provide details of the physics models available in XCALibre.jl, including:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Time models\nFluid types\nTurbulence models\nEnergy models","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"warning: Warning\nThe mesh provided to the domain field must already be adapted to the required backend device. See Backend selection for detail. ","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"note: Note\nIn the next version of XCALibre.jl the field boundary_info will be likely removed outside of the Physics object in order to improve on the current performance (avoiding unnecessary memory movement between GPU backends and the host devices).","category":"page"},{"location":"user_guide/2_physics_and_models/#Time-models","page":"Physics and models","title":"Time models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Earlier in this section, the dynamic nature of Julia was mentioned in the context of extracting fields for the Physics model used in XCALibre.jl. In the following sections this benefit of using Julia will be exploited further. XCALibre.jl takes advantage of Julia's rich type system and we define Abstract types to organise major functionality. For example, time models are subtypes of the abstract type AbstractTimeModel. Therefore, out-of-the-box we get for free a means to explore implemented features in XCALibre.jl. For example, to identify the time models implemented, we need simply need to type the following in the REPL:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre\n# import Main.subtypes as subtypes # hide\nusing InteractiveUtils # Load from standard library\nMain.subtypes(AbstractTimeModel)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"From the output it can be seen that there are two time models in XCALibre.jl for Steady or Transient simulations. These are singleton types and contain (at present) not internal fields or data. They are largely used by XCALibre.jl to dispatch either steady or transient solvers. We starting to get a picture of how the Physics object is constructed. For example, to specify a Steady simulation","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, the time model can be specified as Steady as follows","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady()\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Fluid-types","page":"Physics and models","title":"Fluid types","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Following from the idea of using Julia's dynamic features to explore the types available in XCALibre.jl, in this section we will explore the fluid types available. This time, we will use a helper package AbstractTrees (which can be installed in the usual way, by entering into package mode in the REPL and typing add AbstractTrees). In XCALibre.jl all fluid types are subtypes of AbstractFluid. The types available are shown in the example below:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"begin\n # Note: this code snippet will not be shown later for succinctness\n using XCALibre\n using InteractiveUtils # Load from standard library\n # using Pkg; Pkg.add(\"AbstractTrees\") # run to install AbstractTrees\n using AbstractTrees \n # import Main.subtypes as subtypes # hide\n AbstractTrees.children(d::DataType) = Main.subtypes(d)\n print_tree(AbstractFluid)\nend","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"From the subtype tree above, we can see that XCALibre.jl offers 2 major abstract fluid types, AbstractIncompressible and AbstractCompressible. The concrete fluid types are 3:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Incompressible - for simulations were the fluid density does not change with pressure\nWeaklyCompressible - for simulation were the fluid density is allowed to change (no shockwaves)\nCompressible - for simulations were discontinuities may appear (not available for general use yet)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"To specify a given fluid type, the Fluid wrapper type is used as a general constructor which is specialised depending depending on the fluid type from the list above provided by the user. The constructors require the following inputs:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For incompressible fluid flow","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Fluid{Incompressible}(; nu, rho=1.0) ","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For compressible fluids (weak formulation)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Fluid{WeaklyCompressible}(; nu, cp, gamma, Pr)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"where the input variable represent the following:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"nu - viscosity\nrho - fluid density\ngamma - specific heat ratio\nPr - Prandlt number\ncp - specific heat at constant pressure","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, an incompressible fluid can be specified as follows","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu=1e-5),\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Turbulence-models","page":"Physics and models","title":"Turbulence models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Below is a representation the AbstractTurbulenceModel inheritance tree. It shows turbulence models available. Turbulence models are defined using the RANS and LES constructors and passing a specific turbulence model type. As it will be illustrated in the flowing sections.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractTurbulenceModel) # hide","category":"page"},{"location":"user_guide/2_physics_and_models/#RANS-models-constructors","page":"Physics and models","title":"RANS models constructors","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Laminar model: no user input is required. This is a dummy model that does not contribute to the momentum equation.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"RANS{Laminar}() # only constructor needed","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KOmega model: the standard 2 equation Wilcox model coefficients are passed by default. This model solve an additional 3 equation for k, omega and nut which must be provided with boundary conditions.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"RANS{KOmega}() # will set the default coefficient values shown below\nRANS{KOmega}(; β⁺=0.09, α1=0.52, β1=0.072, σk=0.5, σω=0.5) # set defaults\nRANS{KOmega}(β1=0.075) # user can choose to change a single coefficient","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KOmegaLKE model: the user must provide a reference turbulence intensity (Tu) and a tuple of symbols specifying wall boundaries. This model uses 3 equations (k, kl, omega) and updates the eddy viscosity (nut) these must be provided with boundary conditions.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"RANS{KOmegaLKE}(; Tu::Number, walls::Tuple) # no defaults defined\nRANS{KOmegaLKE}(Tu = 0.01, walls=(:cylinder,)) # user should provide information for Tu and walls","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, a steady, incompressible simulation using the KOmega model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu=1e-5),\n turbulence = RANS{KOmega}(),\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#LES-models","page":"Physics and models","title":"LES models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Smagorinsky model: the standard model constant is pass by default. Boundary conditions for nut must be provided generally zero gradient conditions work well. No special wall functions for nut in LES mode are available.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"LES{Smagorinsky}() # default constructor will use value below\nLES{Smagorinsky}(; C=0.15) # default value provided by default\nLES{Smagorinsky}(C=0.1) # user selected value","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, an incompressible LES simulation with the Smagorinsky model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Transient(),\n fluid = Fluid{Incompressible}(nu=1e-5),\n turbulence = LES{Smagorinsky}(),\n)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"note: Note\nIn the specification above the time model was set as Transient since LES models are strictly time-resolving. A simulation might run when the Steady model is chosen, but the results would likely not be reliable. XCALibre.jl by design offers flexibility for users to customise their setup, the consequence is that is also falls on users to define a combination of models that is appropriate. Likewise, in the example above an Isothermal energy model would have to be selected. See Energy models","category":"page"},{"location":"user_guide/2_physics_and_models/#Energy-models","page":"Physics and models","title":"Energy models","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Currently, XCALibre.jl offers two options to model the energy equation. A tree of the AbstractEnergyModel is shown below. The top-level constructor for energy models is the Energy type. Specific constructor signatures are also illustrated below.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractEnergyModel) # hide","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Isothermal model: assumes temperature effects are negligible. Used for incompressible solvers.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Energy{Isothermal}() # default constructor","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"SensibleEnthalpy model: uses the sensible enthalpy model for the energy equation. Required for the compressible solvers.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Energy{SensibleEnthalpy}(; Tref) # constructor definition. No default values given to Tref keyword\nEnergy{SensibleEnthalpy}(Tref=300) # Users must provide a referent temperature value","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, a steady, compressible RANS simulation with the KOmegaLKE model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(nu=1e-5, cp=1005, gamma=1.4, Pr=0.7),\n turbulence = RANS{KOmegaLKE}(),\n energy = Energy{SensibleEnthalpy}(Tref=300),\n ...\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Domain-definition","page":"Physics and models","title":"Domain definition","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The final step when defining a Physics model is to specify the domain on which the various models will be used. This is simply a reference to the mesh object.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Continuing from the previous example, a steady, compressible RANS simulation with the KOmegaLKE model can be specified as","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(nu=1e-5, cp=1005, gamma=1.4, Pr=0.7),\n turbulence = RANS{KOmegaLKE}(),\n energy = Energy{SensibleEnthalpy}(Tref=300),\n domain = mesh_dev\n)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"warning: Warning\nWhen passing the mesh objective to complete the definition of the Physics object, the mesh must be adapted to the target device where the computation will be performed. See Backend selection for more details.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Notice that the transfer to the target compute backend can also be done inline. For example,","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Physics(\n time = Steady(),\n fluid = Fluid{WeaklyCompressible}(nu=1e-5, cp=1005, gamma=1.4, Pr=0.7),\n turbulence = RANS{KOmegaLKE}(),\n energy = Energy{SensibleEnthalpy}(Tref=300),\n domain = adapt(CUDABackend(), mesh) # for Nvidia GPUs\n)","category":"page"},{"location":"user_guide/2_physics_and_models/#Boundary-conditions","page":"Physics and models","title":"Boundary conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The final step to completely capture the physics for the simulation is to define boundary conditions in order to find a concrete solution of the model equations being solved. XCALibre.jl offers a range of boundary condition. As before, boundary conditions are specified by type and the are classified under the AbstractBoundary type and subdivided into 4 additional abstract types AbstractDirichlet, AbstractNeumann, AbstractPhysicalConstraint and AbstractWallFunction. The complete abstract tree is illustrated below.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre # hide\nusing AbstractTrees # hide\n# import Main.subtypes as subtypes # hide\n using InteractiveUtils # hide\nAbstractTrees.children(d::DataType) = Main.subtypes(d) # hide\nprint_tree(AbstractBoundary) # hide","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Philosophically, the four subtypes represent different physical types of boundary conditions:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"AbstractDirichlet boundary conditions are used to assign a concrete value to a boundary.\nAbstractNeumann boundaries are used to fix the gradient at the boundary.\nAbstractPhysicalConstraint boundaries represent physical constraints imposed on the domain.\nAbstractWallFunction represent models for treating flow or turbulence quantities in wall regions.","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractDirichlet-conditions","page":"Physics and models","title":"AbstractDirichlet conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Dirichlet(name, value)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nvalue is a vector or scalar defining desired value at the boundary","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"FixedTemperature(name; T, model::EnergyModel<:AbstractEnergyModel)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nT is a keyword argument to define the temperate value to be assigned at the boundary\nmodel is a keyworkd argument that expects an instance of the energy model to be used e.g. SensibleEnergy","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"DirichletFunction(name, func)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nfunc is a function identifier. func is a user-defined function (but can also be a neural network) that returns a scalar or vector as a function of time and space.\nfunc must adhere to an internal contract. See XXX for more details","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractNeumann-conditions","page":"Physics and models","title":"AbstractNeumann conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Neumann(name, value)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nvalue is a scalar defining the gradient normal to the boundary","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"warning: Warning\nAt present the Neumann boundary should be treated as providing a zero gradient condition only. Internally, a zero gradient value is hard-coded. This behaviour will be extended in the near future to allow arbitrary gradients to be defined.","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractPhysicalConstraint-conditions","page":"Physics and models","title":"AbstractPhysicalConstraint conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Wall boundary conditions can be used to provide a boundary with a wall constraint. This boundary type, at present, can only be used to define vectors. For scalar quantities in wall regions a Neumann (zero gradient) should be imposed.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Wall(name, value)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name\nvalue is a vector defining wall velocity e.g. [0, 0, 0]","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"note: Note\nCurrently, the value provided at the wall is not used internally. This mean that this boundary condition current acts a a no slip boundary. This will be extended to allow non-slip boundaries or moving walls.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Symmetry boundary condition can be use to assign a symmetry constraint to a given boundary patch in the domain. It can be used for both vector and scalar quantities.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Symmetry(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"Periodic boundaries consist of a pair of boundary patches that behave as if they are physically connected. The periodic boundary essentially provides a mapping between these patches and helps in calculating the face values at the interface. The construction of periodic boundaries is different to other boundary conditions because the addressing between each face for the patch pair needs to be calculated and stored. Periodic boundary can be constructed as follows:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"periodic::Tuple = construct_periodic(mesh, backend, patch1::Symbol, patch2::Symbol)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"mesh is a reference to the mesh object\nbackend defines the expected backend e.g. CPU(), CUDABackend, etc.\npatch1 and patch2 symbols of the two patch pair we would like to flag as periodic","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"The output is a tuple containing two Periodic boundary types with information relevant to each boundary patch pair and it can be used directly to assign a periodic boundary for both patches (by splatting into the assignment macro e.g. periodic...)","category":"page"},{"location":"user_guide/2_physics_and_models/#AbstractWallFunction-conditions","page":"Physics and models","title":"AbstractWallFunction conditions","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KWallFunction provides a turbulent kinetic energy boundary condition for high-Reynolds models.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"KWallFunction(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"OmegaWallFunction provides a value for the specific dissipation rate for both low- and high-Reynolds model.","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"OmegaWallFunction(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"NutWallFunction provides a value for the eddy viscosity for high-Reynolds models","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"NutWallFunction(name)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"name is a symbol providing the boundary name","category":"page"},{"location":"user_guide/2_physics_and_models/#Assigning-conditions-(macro)","page":"Physics and models","title":"Assigning conditions (macro)","text":"","category":"section"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"XCALibre.jl requires that a boundary condition is assigned to every single patch in the domain (as defined within the mesh object) for every the fields that is part of the solution. To facilitate this process, XCALibre.jl provides the @assign macro for convenience. The @assign macro has the following signature:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"@assign! model::Physics (\n , \n , \n ...\n )","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"For example, for a laminar incompressible simulation, only the momentum equation is being solved. Therefore, users need to provide conditions for every patch for the U and p fields in the momentum model:","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"using XCALibre\n\nmesh_file = pkgdir(XCALibre, \"examples/2d_incompressible_laminar_backwards_step/backward_facing_step_10mm.unv\")\nmesh = UNV2D_mesh(mesh_file, scale=0.001)\n\nbackend = CPU() # run on CPU\nhardware = set_hardware(backend=backend, workgroup=4)\nmesh_dev = mesh # dummy assignment \n\n# Flow conditions\nvelocity = [1.5, 0.0, 0.0]\nnu = 1e-3\nRe = velocity[1]*0.1/nu # Reynolds number\n\n# Physics models\nmodel = Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu = nu),\n turbulence = RANS{Laminar}(),\n energy = Energy{Isothermal}(),\n domain = mesh_dev\n )\n\n# Define boundary conditions\n@assign! model momentum U (\n Dirichlet(:inlet, velocity),\n Neumann(:outlet, 0.0),\n Wall(:wall, [0.0, 0.0, 0.0]),\n Wall(:top, [0.0, 0.0, 0.0]),\n)\n\n@assign! model momentum p (\n Neumann(:inlet, 0.0),\n Dirichlet(:outlet, 0.0),\n Neumann(:wall, 0.0), # scalar wall - set up as zero gradient\n Neumann(:top, 0.0) # scalar wall - set up as zero gradient\n)","category":"page"},{"location":"user_guide/2_physics_and_models/","page":"Physics and models","title":"Physics and models","text":"hint: Hint\nJulia is a dynamic language and objects can be interrogated on the fly (dynamically). Say you created a Physics model named mymodel, you can interrogate the contents of any of the fields in the Physics structure using the fieldnames function, e.g. fieldnames(mymodel.momentum), to find which fields need to be provided with boundary conditions. Any fields not ending in f should be set. ","category":"page"},{"location":"quick_start/#Quick-Start","page":"Quick Start","title":"Quick Start","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"Read this section for information about how to install XCALibre.jl and an example showcasing the API","category":"page"},{"location":"quick_start/#Installation","page":"Quick Start","title":"Installation","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"First, you need to download and install Julia in your system. Once you have a working installation of Julia, XCALibre.jl can be installed using the built in package manager. ","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"To install XCALibre.jl directly from Github, open a Julia REPL, press ] to enter the package manager. The REPL prompt icon will change from julia> (green) to pkg> (and change colour to blue) or (myenvironment) pkg> where myenvironment is the name of the currently active Juila environment. Once in package manager mode enter","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"pkg> add XCALibre https://github.com/mberto79/XCALibre.jl.git","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"A specific branch can be installed by providing the branch name precided by a #, for example, to install the dev-0.3-main branch","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"pkg> add XCALibre https://github.com/mberto79/XCALibre.jl.git#dev-0.3-main","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"We plan to register XCALibre.jl so that is added to the General Julia Registry. Once this has been completed, to install XCALibre.jl use the following command (in package mode as detailed above)","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"pkg> add XCALibre","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"note: Note\nTo enable GPU acceleration you will also need to install the corresponding GPU package for your hardware. See CUDA.jl, AMD.jl, oneAPI.jl for more details. XCALibre.jl will automatically precompile and load the relevant backend specific functionality (using Julia extensions)","category":"page"},{"location":"quick_start/#Example","page":"Quick Start","title":"Example","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"The example below illustrates the top-level API used in XCALibre.jl. It shows the key steps a user needs to follow to set up a simulation:","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"Pre-processing (steps 1 and 2)\nPhysics and models (steps 3 to 5)\nNumerical setup (steps 6 and 7)\nRuntime and solvers setup (steps 8 to 11)\nPost-processing (step 12)","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"Once you have installed Julia and XCALibre.jl, the example below can be run by copying the contents shown below and pasting them on a file. The file can be executed within vscode, the Julia REPL or from a system terminal. ","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"To run in vscode check the information for using Julia in vscode\nTo run in the Julia REPL, simply launch Julia and type include(\"name_of_your_file.jl\")\nTo run from a system terminal (bash or cmd, for example), simply type path/to/julia name_of_your_file.jl","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"In most cases, it is preferable to run simulations from within the Julia REPL because, in Julia, there is often a cost associated to the first run due to compilation time. By relaunching a simulation in the REPL, all previously compiled code will not be recompiled. This is particularly helpful in the prototyping stages. For long running simulations, the compilation time is normally negligible compared to the actual time needed to complete the simulation.","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"\n# Step 0. Load libraries\nusing XCALibre\n# using CUDA # Uncomment to run on NVIDIA GPUs\n# using AMDGPU # Uncomment to run on AMD GPUs\n\n\n# Step 1. Define mesh\nmesh_file = pkgdir(XCALibre, \"examples/2d_incompressible_laminar_backwards_step/backward_facing_step_10mm.unv\")\nmesh = UNV2D_mesh(mesh_file, scale=0.001)\n\n# Step 2. Select backend and setup hardware\nbackend = CPU()\n# backend = CUDABackend() # ru non NVIDIA GPUs\n# backend = ROCBackend() # run on AMD GPUs\n\nhardware = set_hardware(backend=backend, workgroup=4)\n# hardware = set_hardware(backend=backend, workgroup=32) # use for GPU backends\n\nmesh_dev = mesh # use this line to run on CPU\n# mesh_dev = adapt(backend, mesh) # Uncomment to run on GPU \n\n# Step 3. Flow conditions\nvelocity = [1.5, 0.0, 0.0]\nnu = 1e-3\nRe = velocity[1]*0.1/nu\n\n# Step 4. Define physics\nmodel = Physics(\n time = Steady(),\n fluid = Fluid{Incompressible}(nu = nu),\n turbulence = RANS{Laminar}(),\n energy = Energy{Isothermal}(),\n domain = mesh_dev\n )\n\n# Step 5. Define boundary conditions\n@assign! model momentum U (\n Dirichlet(:inlet, velocity),\n Neumann(:outlet, 0.0),\n Wall(:wall, [0.0, 0.0, 0.0]),\n Wall(:top, [0.0, 0.0, 0.0]),\n)\n\n@assign! model momentum p (\n Neumann(:inlet, 0.0),\n Dirichlet(:outlet, 0.0),\n Neumann(:wall, 0.0),\n Neumann(:top, 0.0)\n)\n\n# Step 6. Choose discretisation schemes\nschemes = (\n U = set_schemes(divergence = Linear),\n p = set_schemes() # no input provided (will use defaults)\n)\n\n# Step 7. Set up linear solvers and preconditioners\nsolvers = (\n U = set_solver(\n model.momentum.U;\n solver = BicgstabSolver, # Options: GmresSolver\n preconditioner = Jacobi(), # Options: NormDiagonal(), DILU(), ILU0()\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n ),\n p = set_solver(\n model.momentum.p;\n solver = CgSolver, # Options: CgSolver, BicgstabSolver, GmresSolver\n preconditioner = Jacobi(), # Options: NormDiagonal(), LDL() (with GmresSolver)\n convergence = 1e-7,\n relax = 0.7,\n rtol = 1e-4,\n atol = 1e-10\n )\n)\n\n# Step 8. Specify runtime requirements\nruntime = set_runtime(\n iterations=2000, time_step=1, write_interval=2000)\n\n# Step 9. Construct Configuration object\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\n# Step 10. Initialise fields (initial guess)\ninitialise!(model.momentum.U, velocity)\ninitialise!(model.momentum.p, 0.0)\n\n# Step 11. Run simulation\nresiduals = run!(model, config);\n\n# Step 12. Post-process\npwd() # find active directory where the file \"iteration_002000.vtk\" was saved","category":"page"},{"location":"quick_start/#Output","page":"Quick Start","title":"Output","text":"","category":"section"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"If you chose to run the example above, XCALibre.jl would have written a simulation result file to your computer. The name of the file is iteration_002000.vtk. The file will be located in your current active directory (you can check this by running pwd()). This file can be open directly in ParaView for further post-processing. You can find out more about ParaView on their website. The image below is the output solution generated by XCALibre.j to the example simulation above.","category":"page"},{"location":"quick_start/","page":"Quick Start","title":"Quick Start","text":"(Image: Simulation result visualisation in ParaView)","category":"page"},{"location":"contributor_guide/#Contributor-Guide","page":"Contributor Guide","title":"Contributor Guide","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/#2D-incompressible-flat-plate","page":"2D incompressible flat plate","title":"2D incompressible flat plate","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/#Introduction","page":"2D incompressible flat plate","title":"Introduction","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/","page":"2D incompressible flat plate","title":"2D incompressible flat plate","text":"","category":"page"},{"location":"VV/2d-isothermal-backward-facing-step/#This-is-a-subsection","page":"2D incompressible flat plate","title":"This is a subsection","text":"","category":"section"},{"location":"VV/2d-isothermal-backward-facing-step/","page":"2D incompressible flat plate","title":"2D incompressible flat plate","text":"","category":"page"},{"location":"VV/2d-isothermal-backward-facing-step/#This-is-a-sub-subsection","page":"2D incompressible flat plate","title":"This is a sub-subsection","text":"","category":"section"},{"location":"reference/#Reference","page":"Reference","title":"Reference","text":"","category":"section"},{"location":"reference/","page":"Reference","title":"Reference","text":"Modules = [\n XCALibre, \n XCALibre.Mesh, \n XCALibre.Fields,\n XCALibre.ModelFramework,\n XCALibre.Discretise, \n XCALibre.Solve,\n XCALibre.Calculate, \n XCALibre.ModelPhysics,\n XCALibre.Simulate,\n XCALibre.Solvers,\n XCALibre.Postprocess\n ]","category":"page"},{"location":"reference/#XCALibre.Fields.initialise!-Tuple{Any, Any}","page":"Reference","title":"XCALibre.Fields.initialise!","text":"function initialise!(field, value) # dummy function for documentation\n # Assign `value` to field in-place\n nothing\nend\n\nThis function will set the given field to the value provided in-place. Useful for initialising fields prior to running a simulation.\n\nInput arguments\n\nfield specifies the field to be initialised. The field must be either a AbractScalarField or AbstractVectorField\nvalue defines the value to be set. This should be a scalar or vector (3 components) depending on the field to be modified e.g. for an AbstractVectorField we can specify as value=[10,0,0]\n\nNote: in most cases the fields to be modified are stored within a physics model i.e. a Physics object. Thus, the argument value must fully qualify the model. For example, if we have created a Physics model named mymodel to set the velocity field, U, we would set the argument field to mymodel.momentum.U. See the example below.\n\nExample\n\ninitialise!(mymodel.momentum.U, [2.5, 0, 0])\ninitialise!(mymodel.momentum.p, 1.25)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Discretise.Dirichlet","page":"Reference","title":"XCALibre.Discretise.Dirichlet","text":"Dirichlet <: AbstractDirichlet\n\nDirichlet boundary condition model.\n\nFields\n\n'ID' – Boundary ID\nvalue – Scalar or Vector value for Dirichlet boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.DirichletFunction","page":"Reference","title":"XCALibre.Discretise.DirichletFunction","text":"DirichletFunction <: AbstractDirichlet\n\nDirichlet boundary condition model.\n\nFields\n\n'ID' – Boundary ID\nvalue – Custom function for Dirichlet boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.FixedTemperature","page":"Reference","title":"XCALibre.Discretise.FixedTemperature","text":"FixedTemperature <: AbstractDirichlet\n\nFixed temperature boundary condition model, which allows the user to specify wall temperature that can be translated to the energy specific model, such as sensivle enthalpy.\n\nFields\n\n'ID' – Boundary ID\nvalue – Scalar or Vector value for Dirichlet boundary condition.\nT - Temperature value in Kelvin.\nmodel - Energy physics model for case.\n\nExamples\n\nFixedTemperature(:inlet, T=300.0, model=model.energy),\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Neumann","page":"Reference","title":"XCALibre.Discretise.Neumann","text":"Neumann <: AbstractNeumann\n\nNeumann boundary condition model (currently only configured for zero gradient)\n\nFields\n\n'ID' – Boundary ID\nvalue – Scalar or Vector value for Neumann boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Periodic","page":"Reference","title":"XCALibre.Discretise.Periodic","text":"struct Periodic{I,V} <: AbstractPhysicalConstraint\n ID::I\n value::V\nend\n\nPeriodic boundary condition model.\n\nFields\n\n'ID' – Boundary ID\nvalue – tuple containing information needed to apply this boundary\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Symmetry","page":"Reference","title":"XCALibre.Discretise.Symmetry","text":"Symmetry <: AbstractBoundary\n\nSymmetry boundary condition model for velocity and scalar field.\n\nFields\n\n'ID' – Boundary ID\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.Wall","page":"Reference","title":"XCALibre.Discretise.Wall","text":"Wall <: AbstractDirichlet\n\nWall boundary condition model for no-slip wall condition.\n\nFields\n\n'ID' – Boundary ID\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Discretise.construct_periodic-Tuple{Any, Any, Symbol, Symbol}","page":"Reference","title":"XCALibre.Discretise.construct_periodic","text":"construct_periodic(mesh, backend, patch1::Symbol, patch2::Symbol)\n\nFunction for construction of periodic boundary conditions.\n\nInput\n\nmesh – Mesh.\nbackend – Backend configuraton.\npatch1 – Primary periodic patch ID.\npatch2 – Neighbour periodic patch ID.\n\nOutput\n\nperiodic::Tuple - tuple containing boundary defintions for patch1 and patch2 i.e. (periodic1, periodic2). The fields of periodic1 and periodic2 are \nID – Index to access boundary information in mesh object\nvalue – represents a NamedTuple with the following keyword arguments:\nindex – ID used to find boundary geometry information in the mesh object\ndistance – perpendicular distance between the patches\nface_map – vector providing indeces to faces of match patch\nismaster – flat to identify one of the patch pairs as the main patch\n\nExample\n\n- `periodic = construct_periodic(mesh, CPU(), :top, :bottom)` - Example using CPU \nbackend with periodic boundaries named `top` and `bottom`.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Discretise.set_schemes-Tuple{}","page":"Reference","title":"XCALibre.Discretise.set_schemes","text":"set_schemes(;\n # keyword arguments and their default values\n time=SteadyState,\n divergence=Linear, \n laplacian=Linear, \n gradient=Orthogonal) = begin\n \n # Returns NamedTuple definition for scheme \n (\n time=time,\n divergence=divergence,\n laplacian=laplacian,\n gradient=gradient\n )\nend\n\nThe set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.\n\ninputs\n\ntime is used to set the time schemes(default is SteadyState)\ndivergence is used to set the divergence scheme (default is Linear) \nlaplacian is used to set the laplacian scheme (default is Linear)\ngradient is used to set the gradient scheme (default is Orthogonal)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solve.set_runtime-Union{Tuple{}, Tuple{N}, Tuple{I}} where {I<:Integer, N<:Number}","page":"Reference","title":"XCALibre.Solve.set_runtime","text":"set_runtime(; \n # keyword arguments\n iterations::I, \n write_interval::I, \n time_step::N\n ) where {I<:Integer,N<:Number} = begin\n \n # returned `NamedTuple``\n (\n iterations=iterations, \n dt=time_step, \n write_interval=write_interval)\nend\n\nThis is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.\n\nInput arguments\n\niterations::Integer specifies the number of iterations in a simulation run.\nwrite_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.\ntime_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.\n\nExample\n\nruntime = set_runtime(\n iterations=2000, time_step=1, write_interval=2000)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solve.set_solver-Union{Tuple{AbstractField}, Tuple{PT}, Tuple{S}} where {S, PT<:PreconditionerType}","page":"Reference","title":"XCALibre.Solve.set_solver","text":"set_solver( \n field::AbstractField;\n # keyword arguments and defaults\n solver::S, \n preconditioner::PT, \n convergence, \n relax,\n limit=(),\n itmax::Integer=100, \n atol=(eps(_get_float(field.mesh)))^0.9,\n rtol=_get_float(field.mesh)(1e-3)\n ) where {S,PT<:PreconditionerType} = begin\n\n # return NamedTuple\n TF = _get_float(field.mesh)\n (\n solver=solver, \n preconditioner=preconditioner, \n convergence=convergence |> TF, \n relax=relax |> TF, \n limit=limit,\n itmax=itmax, \n atol=atol |> TF, \n rtol=rtol |> TF\n )\nend\n\nThis function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers. \n\nInput arguments\n\nfield reference to the field to which the solver settings will apply (used to provide integer and float types required)\nsolver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl\npreconditioner instance of preconditioner to be used e.g. Jacobi()\nconvergence sets the stopping criteria of this field\nrelax specifies the relaxation factor to be used e.g. set to 1 for no relaxation\nlimit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()\nitmax maximum number of iterations in a single solver pass (defaults to 100) \natol absolute tolerance for the solver (default to eps(FloatType)^0.9)\nrtol set relative tolerance for the solver (defaults to 1e-3)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.Compressible","page":"Reference","title":"XCALibre.ModelPhysics.Compressible","text":"Compressible <: AbstractCompressible\n\nCompressible fluid model containing fluid field parameters for compressible flows with constant parameters - ideal gas with constant viscosity.\n\nFields\n\n'nu' – Fluid kinematic viscosity.\n'cp' – Fluid specific heat capacity.\ngamma – Ratio of specific heats.\nPr – Fluid Prantl number.\n\nExamples\n\nFluid{Compressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructur with default values.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Fluid","page":"Reference","title":"XCALibre.ModelPhysics.Fluid","text":"Fluid <: AbstractFluid\n\nAbstract fluid model type for constructing new fluid models.\n\nFields\n\n'args' – Model arguments.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Incompressible","page":"Reference","title":"XCALibre.ModelPhysics.Incompressible","text":"Incompressible <: AbstractIncompressible\n\nIncompressible fluid model containing fluid field parameters for incompressible flows.\n\nFields\n\n'nu' – Fluid kinematic viscosity.\n'rho' – Fluid density.\n\nExamples\n\nFluid{Incompressible}(nu=0.001, rho=1.0) - Constructor with default values.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.KOmega","page":"Reference","title":"XCALibre.ModelPhysics.KOmega","text":"KOmega <: AbstractTurbulenceModel\n\nkOmega model containing all kOmega field parameters.\n\nFields\n\n'k' – Turbulent kinetic energy ScalarField.\n'omega' – Specific dissipation rate ScalarField.\n'nut' – Eddy viscosity ScalarField.\n'kf' – Turbulent kinetic energy FaceScalarField.\n'omegaf' – Specific dissipation rate FaceScalarField.\n'nutf' – Eddy viscosity FaceScalarField.\n'coeffs' – Model coefficients.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.KOmegaLKE","page":"Reference","title":"XCALibre.ModelPhysics.KOmegaLKE","text":"KOmegaLKE <: AbstractTurbulenceModel\n\nkOmega model containing all kOmega field parameters.\n\nFields\n\n'k' – Turbulent kinetic energy ScalarField.\n'omega' – Specific dissipation rate ScalarField.\n'kl' – ScalarField.\n'nut' – Eddy viscosity ScalarField.\n'kf' – Turbulent kinetic energy FaceScalarField.\n'omegaf' – Specific dissipation rate FaceScalarField.\n'klf' – FaceScalarField.\n'nutf' – Eddy viscosity FaceScalarField.\n'coeffs' – Model coefficients.\n'Tu' – Freestream turbulence intensity for model.\n'y' – Near-wall distance for model.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.LES","page":"Reference","title":"XCALibre.ModelPhysics.LES","text":"LES <: AbstractLESModel\n\nAbstract LES model type for constructing LES models.\n\nFields\n\n'args' – Model arguments.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Laminar","page":"Reference","title":"XCALibre.ModelPhysics.Laminar","text":"Laminar <: AbstractTurbulenceModel\n\nLaminar model definition for physics API.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Momentum","page":"Reference","title":"XCALibre.ModelPhysics.Momentum","text":"struct Momentum{V,S,SS} <: AbstractMomentumModel\n U::V \n p::S \n sources::SS\nend\n\nMomentum model containing key momentum fields.\n\nFields\n\n'U' – Velocity VectorField.\n'p' – Pressure ScalarField.\n'sources' – Momentum model sources.\n\nExamples\n\n`Momentum(mesh::AbstractMesh)\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Physics","page":"Reference","title":"XCALibre.ModelPhysics.Physics","text":"struct Physics{T,F,M,Tu,E,D,BI}\n time::T\n fluid::F\n momentum::M \n turbulence::Tu \n energy::E\n domain::D\n boundary_info::BI\nend\n\nXCALibre's parametric Physics type for user-level API. Also used to dispatch flow solvers.\n\nFields\n\n'time::Union{Steady, Transient}' – User-provided time model.\n'fluid::AbstractFluid' – User-provided Fluid` model.\n'momentum' – Momentum model. Currently this is auto-generated by the Physics constructor\n'turbulence::AbstractTurbulenceModel' – User-provided Turbulence` model.\n'energy:AbstractEnergyModel' – User-provided Energy model.\n'domain::AbstractMesh ' – User-provided Mesh. Must be adapted to target device before constructing a Physics object.\n'boundaryinfo::boundaryinfo' – Mesh boundary information. Auto-generated by the Physics constructor\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Physics-Tuple{}","page":"Reference","title":"XCALibre.ModelPhysics.Physics","text":"Physics(; time, fluid, turbulence, energy, domain)::Physics{T,F,M,Tu,E,D,BI}\n\nPhysics constructor part of the top-level API. It can be used to define the Physics and models relevant to a simulation. This constructor uses keyword arguments to allow users to fine-tune their simulations, whilst some fields are auto-generated behind the scenes for convenience (Momentum and boundary_info). Where:\n\ntime - specified the time model (Steady or Transient)\nfluid - specifies the type of fluid (Incompressible, etc.)\nturbulence - specified the Turbulence model\nenergy - specifies the Energy treatment\ndomain - provides the mesh to used (must be adapted to the target backend device)\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.RANS","page":"Reference","title":"XCALibre.ModelPhysics.RANS","text":"RANS <: AbstractRANSModel\n\nAbstract RANS model type for consturcting RANS models.\n\nFields\n\n'args' – Model arguments.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.SensibleEnthalpy","page":"Reference","title":"XCALibre.ModelPhysics.SensibleEnthalpy","text":"SensibleEnthalpy <: AbstractEnergyModel\n\nType that represents energy model, coefficients and respective fields.\n\nFields\n\n'h' – Sensible enthalpy ScalarField.\n'T' – Temperature ScalarField.\n'hf' – Sensible enthalpy FaceScalarField.\n'Tf' – Temperature FaceScalarField.\n'K' – Specific kinetic energy ScalarField.\n'dpdt' – Pressure time derivative ScalarField.\n'updated_BC' – Boundary condition function to convert temperature to sensible enthalp on on a fixed value boudary.\n'coeffs' – A tuple of model coefficients.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Smagorinsky","page":"Reference","title":"XCALibre.ModelPhysics.Smagorinsky","text":"Smagorinsky <: AbstractTurbulenceModel\n\nSmagorinsky LES model containing all Smagorinksy field parameters.\n\nFields\n\n'nut' – Eddy viscosity ScalarField.\n'nutf' – Eddy viscosity FaceScalarField.\n'coeffs' – Model coefficients.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Steady","page":"Reference","title":"XCALibre.ModelPhysics.Steady","text":"Steady\n\nSteady model for Physics model API.\n\nExamples\n\nSteady()\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Transient","page":"Reference","title":"XCALibre.ModelPhysics.Transient","text":"Transient\n\nTransient model for Physics model API.\n\nExamples\n\nTransient()\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.WeaklyCompressible","page":"Reference","title":"XCALibre.ModelPhysics.WeaklyCompressible","text":"WeaklyCompressible <: AbstractCompressible\n\nWeakly compressible fluid model containing fluid field parameters for weakly compressible flows with constant parameters - ideal gas with constant viscosity.\n\nFields\n\n'nu' – Fluid kinematic viscosity.\n'cp' – Fluid specific heat capacity.\ngamma – Ratio of specific heats.\nPr – Fluid Prandtl number.\n\nExamples\n\nFluid{WeaklyCompressible}(; nu=1E-5, cp=1005.0, gamma=1.4, Pr=0.7) - Constructor with \n\ndefault values.\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.ModelPhysics.Ttoh!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{Physics{T1, F, M, Tu, E, D, BI}, ScalarField, ScalarField}} where {T1, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.Ttoh!","text":"Ttoh!(model::Physics{T1,F,M,Tu,E,D,BI}, T::ScalarField, h::ScalarField\n) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nFunction coverts temperature ScalarField to sensible enthalpy ScalarField.\n\nInput\n\nmodel – Physics model defined by user.\nT – Temperature ScalarField.\nh – Sensible enthalpy ScalarField.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.energy!-Union{Tuple{E1}, Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{XCALibre.ModelPhysics.Sensible_Enthalpy_Model{E1}, Physics{T1, F, M, Tu, E, D, BI}, Vararg{Any, 6}}} where {T1, F, M, Tu, E, D, BI, E1}","page":"Reference","title":"XCALibre.ModelPhysics.energy!","text":"energy::Sensible_Enthalpy_Model{E1}, model::Physics{T1,F,M,Tu,E,D,BI}, prev, mdotf, rho, mueff, time, config\n) where {T1,F,M,Tu,E,D,BI,E1}\n\nRun energy transport equations.\n\nInput\n\nenergy – Energy model.\nmodel – Physics model defined by user.\nprev – Previous energy cell values.\nmdtof – Face mass flow.\nrho – Density ScalarField.\nmueff – Effective viscosity FaceScalarField.\ntime –\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.htoT!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{Physics{T1, F, M, Tu, E, D, BI}, ScalarField, ScalarField}} where {T1, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.htoT!","text":"htoT!(model::Physics{T1,F,M,Tu,E,D,BI}, h::ScalarField, T::ScalarField\n) where {T1,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nFunction coverts sensible enthalpy ScalarField to temperature ScalarField.\n\nInput\n\nmodel – Physics model defined by user.\nh – Sensible enthalpy ScalarField.\nT – Temperature ScalarField.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T1}, Tuple{SensibleEnthalpy, Physics{T1, F, M, Tu, E, D, BI}, Vararg{Any, 4}}} where {T1, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(energy::SensibleEnthalpy, model::Physics{T1,F,M,Tu,E,D,BI}, mdotf, rho, peqn, config\n) where {T1,F,M,Tu,E,D,BI})\n\nInitialisation of energy transport equations.\n\nInput\n\nenergy – Energy model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\nrho – Density ScalarField.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nSensible_Enthalpy_Model – Energy model struct containing energy equation.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{KOmega, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(turbulence::KOmega, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n) where {T,F,M,Tu,E,D,BI}\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nKOmegaModel(k_eqn, ω_eqn) – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{KOmegaLKE, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(turbulence::KOmegaLKE, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n) where {T,F,M,Tu,E,D,BI}\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nKOmegaLKEModel( k_eqn, ω_eqn, kl_eqn, nueffkLS, nueffkS, nueffωS, nuL, nuts, Ω, γ, fv, normU, Reυ, ∇k, ∇ω ) – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Laminar, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"function initialise(\n turbulence::Laminar, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n ) where {T,F,M,Tu,E,D,BI}\nreturn LaminarModel()\n\nend\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nLaminarModel() – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.initialise-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Smagorinsky, Physics{T, F, M, Tu, E, D, BI}, Any, Any, Any}} where {T, F, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.initialise","text":"initialise(turbulence::Smagorinsky, model::Physics{T,F,M,Tu,E,D,BI}, mdotf, peqn, config\n) where {T,F,M,Tu,E,D,BI}\n\nInitialisation of turbulent transport equations.\n\nInput\n\nturbulence – turbulence model.\nmodel – Physics model defined by user.\nmdtof – Face mass flow.\npeqn – Pressure equation.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\nOutput\n\nSmagorinskyModel(Δ, magS) – Turbulence model structure.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.thermo_Psi!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, FaceScalarField, Any}} where {T, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.thermo_Psi!","text":"thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psif::FaceScalarField) \nwhere {T,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nFunction updates the value of Psi.\n\nInput\n\nmodel – Physics model defined by user.\nPsif – Compressibility factor FaceScalarField.\n\nAlgorithm\n\nWeakly compressible currently uses the ideal gas equation for establishing the compressibility factor where rho = p * Psi. Psi is calculated from the sensible enthalpy, reference temperature and fluid model specified C_p and R value where R is calculated from C_p and gamma specified in the fluid model.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.thermo_Psi!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, ScalarField}} where {T, F<:AbstractCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.thermo_Psi!","text":"thermo_Psi!(model::Physics{T,F,M,Tu,E,D,BI}, Psi::ScalarField) \nwhere {T,F<:AbstractCompressible,M,Tu,E,D,BI}\n\nModel updates the value of Psi.\n\nInput\n\nmodel – Physics model defined by user.\nPsi – Compressibility factor ScalarField.\n\nAlgorithm\n\nWeakly compressible currently uses the ideal gas equation for establishing the compressibility factor where rho = p * Psi. Psi is calculated from the sensible enthalpy, reference temperature and fluid model specified C_p and R value where R is calculated from C_p and gamma specified in the fluid model.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Turb}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.KOmegaLKEModel, Physics{T, F, M, Turb, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Turb<:KOmegaLKE, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(rans::KOmegaLKEModel, model::Physics{T,F,M,Turb,E,D,BI}, S, S2, prev, time, config ) where {T,F,M,Turb<:KOmegaLKE,E,D,BI}\n\nRun turbulence model transport equations.\n\nInput\n\nrans::KOmegaLKEModel – KOmega turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.LaminarModel, Physics{T, F, M, Tu, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Tu<:Laminar, E, D, BI}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(rans::LaminarModel, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config\n) where {T,F,M,Tu<:Laminar,E,D,BI}\n\nRun turbulence model transport equations.\n\nInput\n\nrans::LaminarModel – Laminar turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{E2}, Tuple{E1}, Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.KOmegaModel{E1, E2}, Physics{T, F, M, Tu, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Tu<:KOmega, E, D, BI, E1, E2}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(rans::KOmegaModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config\n) where {T,F,M,Tu<:KOmega,E,D,BI,E1,E2}\n\nRun turbulence model transport equations.\n\nInput\n\nrans::KOmegaModel{E1,E2} – KOmega turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.ModelPhysics.turbulence!-Union{Tuple{E2}, Tuple{E1}, Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{XCALibre.ModelPhysics.SmagorinskyModel{E1, E2}, Physics{T, F, M, Tu, E, D, BI}, Vararg{Any, 5}}} where {T, F, M, Tu<:Smagorinsky, E, D, BI, E1, E2}","page":"Reference","title":"XCALibre.ModelPhysics.turbulence!","text":"turbulence!(les::SmagorinskyModel{E1,E2}, model::Physics{T,F,M,Tu,E,D,BI}, S, S2, prev, time, config\n) where {T,F,M,Tu<:Smagorinsky,E,D,BI,E1,E2}\n\nRun turbulence model transport equations.\n\nInput\n\nles::SmagorinskyModel{E1,E2} – Smagorinsky LES turbulence model.\nmodel – Physics model defined by user.\nS – Strain rate tensor.\nS2 – Square of the strain rate magnitude.\nprev – Previous field.\ntime – \nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Simulate.Configuration","page":"Reference","title":"XCALibre.Simulate.Configuration","text":"@kwdef struct Configuration{SC,SL,RT,HW}\n schemes::SC\n solvers::SL\n runtime::RT\n hardware::HW\nend\n\nThe Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation. \n\nInputs\n\nschemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.\nsolvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.\nruntime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.\nhardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.\n\nExample\n\nconfig = Configuration(\n solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)\n\n\n\n\n\n","category":"type"},{"location":"reference/#XCALibre.Solvers.csimple!-Tuple{Any, Any}","page":"Reference","title":"XCALibre.Solvers.csimple!","text":"csimple!(model_in, config; resume=true, pref=nothing)\n\nCompressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy. \n\nInput\n\nmodel in – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\nresume – True or false indicating if case is resuming or starting a new simulation.\npref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.piso_comp!-Tuple{Any, Any}","page":"Reference","title":"XCALibre.Solvers.piso_comp!","text":"piso_comp!(model_in, config; resume=true, pref=nothing)\n\nCompressible variant of the PISO algorithm with a sensible enthalpy transport equation for the energy. \n\nInput\n\nmodel in – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\nresume – True or false indicating if case is resuming or starting a new simulation.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Tuple{}","page":"Reference","title":"XCALibre.Solvers.run!","text":"residuals = run!(model::Physics, config::Configuration)\n\nDescription goes here\n\nInput arguments\n\nExample\n\nSomething here\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Steady, F<:Incompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Steady,F<:Incompressible,M,Tu,E,D,BI}\n\nIncompressible steady solver using the SIMPLE algorithm.\n\nInput\n\nmodel – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Steady, F<:WeaklyCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Steady,F<:WeaklyCompressible,M,Tu,E,D,BI}\n\nMildly compressible steady solver using the SIMPLE algorithm for low speed cases with heat transfer.\n\nInput\n\nmodel – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Transient, F<:Incompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Transient,F<:Incompressible,M,Tu,E,D,BI}\n\nIncompressible unsteady solver using the PISO algorithm.\n\nInput\n\nmodel – Physics model defined by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.run!-Union{Tuple{BI}, Tuple{D}, Tuple{E}, Tuple{Tu}, Tuple{M}, Tuple{F}, Tuple{T}, Tuple{Physics{T, F, M, Tu, E, D, BI}, Any}} where {T<:Transient, F<:WeaklyCompressible, M, Tu, E, D, BI}","page":"Reference","title":"XCALibre.Solvers.run!","text":"run!(\nmodel::Physics{T,F,M,Tu,E,D,BI}, config; pref=nothing\n) where{T<:Transient,F<:WeaklyCompressible,M,Tu,E,D,BI}\n\nMildly compressible unsteady solver using the PISO algorithm for low speed cases with heat transfer.\n\nInput\n\nmodel – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\npref – Reference pressure value for cases that do not have a pressure defining BC.\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#XCALibre.Solvers.simple!-Tuple{Any, Any}","page":"Reference","title":"XCALibre.Solvers.simple!","text":"simple!(model_in, config; resume=true, pref=nothing)\n\nCompressible variant of the SIMPLE algorithm with a sensible enthalpy transport equation for the energy. \n\nInput\n\nmodel in – Physics model defiend by user and passed to run!.\nconfig – Configuration structure defined by user with solvers, schemes, runtime and hardware structures set.\nresume – True or false indicating if case is resuming or starting a new simulation.\npref – Reference pressure value for cases that do not have a pressure defining BC (incompressible flows only)\n\nOutput\n\nR_ux - Vector of x-velocity residuals for each iteration.\nR_uy - Vector of y-velocity residuals for each iteration.\nR_uz - Vector of y-velocity residuals for each iteration.\nR_p - Vector of pressure residuals for each iteration.\nR_e - Vector of energy residuals for each iteration.\nmodel - Physics model output including field parameters.\n\n\n\n\n\n","category":"method"},{"location":"user_guide/1_preprocessing/#Pre-processing","page":"Pre-processing","title":"Pre-processing","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"super brief summary","category":"page"},{"location":"user_guide/1_preprocessing/#Mesh-generation-and-requirements","page":"Pre-processing","title":"Mesh generation and requirements","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"As with all CFD solvers, defining a suitable mesh is one of the most important steps. XCALibre.jl does not provides mesh generation utilities (yet). Thus, the user will have to generate the grids using external mesh generation tools. However, XCALibre.jl does provide a number of mesh conversion tools to allow user to import their grids. ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"XCALibre.jl is an unstructured Finite Volume Method (FVM) library, therefore, we are able to support grids of arbitrary polyhedral cells. In XCALibre.jl a cell-centred FVM approach has been implemented, which is popular since it allows the representation of complex geometries and it is used by most commercial and many open source CFD solvers.","category":"page"},{"location":"user_guide/1_preprocessing/#Mesh-conversion","page":"Pre-processing","title":"Mesh conversion","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"XCALibre.jl at present supports .unv mesh formats (which can be generated using SALOME) for simulations in 2D and 3D domains. Additionally, XCALibre.jl also supports the OpenFOAM mesh format for simulations in 3D only (for now). ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"note: Note\nCurrently, XCALibre.jl only supports loading mesh files stored in ASCII format. Please ensure that when saving grid files they are not saved in binary. Most mesh generation programmes offer the option to export in ASCII (test-based) formats.","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"The following functions are provided for importing mesh files:","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"UNV2D_mesh\nUNV3D_mesh\nFOAM3D_mesh","category":"page"},{"location":"user_guide/1_preprocessing/#XCALibre.UNV2.UNV2D_mesh","page":"Pre-processing","title":"XCALibre.UNV2.UNV2D_mesh","text":"UNV2D_mesh(meshFile; scale=1, integer_type=Int64, float_type=Float64)\n\nRead and convert 2D UNV mesh file into XCALibre.jl\n\nInput\n\nmeshFile – path to mesh file.\n\nOptional arguments\n\nscale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling\ninteger_type - select interger type to use in the mesh (Int32 may be useful on GPU runs) \nfloat_type - select interger type to use in the mesh (Float32 may be useful on GPU runs) \n\n\n\n\n\n","category":"function"},{"location":"user_guide/1_preprocessing/#XCALibre.UNV3.UNV3D_mesh","page":"Pre-processing","title":"XCALibre.UNV3.UNV3D_mesh","text":"UNV3D_mesh(unv_mesh; scale=1, integer_type=Int64, float_type=Float64)\n\nRead and convert 3D UNV mesh file into XCALibre.jl. Note that a limitation of the .unv mesh format is that it only supports the following 3D cells:\n\nTetahedrals\nPrisms\nHexahedrals\n\nInput\n\nunv_mesh – path to mesh file.\n\nOptional arguments\n\nscale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling\ninteger_type - select interger type to use in the mesh (Int32 may be useful on GPU runs) \nfloat_type - select interger type to use in the mesh (Float32 may be useful on GPU runs) \n\n\n\n\n\n","category":"function"},{"location":"user_guide/1_preprocessing/#XCALibre.FoamMesh.FOAM3D_mesh","page":"Pre-processing","title":"XCALibre.FoamMesh.FOAM3D_mesh","text":"FOAM3D_mesh(mesh_file; scale=1, integer_type=Int64, float_type=Float64)\n\nRead and convert 3D OpenFOAM mesh file into XCALibre.jl. Note that, at present, it is not recommended to run 2D cases using meshes imported using this function.\n\nInput\n\nmesh_file – path to mesh file.\n\nOptional arguments\n\nscale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling\ninteger_type - select interger type to use in the mesh (Int32 may be useful on GPU runs) \nfloat_type - select interger type to use in the mesh (Float32 may be useful on GPU runs) \n\n\n\n\n\n","category":"function"},{"location":"user_guide/1_preprocessing/#Mesh-limitations-and-requirements","page":"Pre-processing","title":"Mesh limitations and requirements","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"In this section we summarise the key limitations of the mesh loaders presented above, and we also highlight specific requirements. ","category":"page"},{"location":"user_guide/1_preprocessing/#UNV-mesh-files","page":"Pre-processing","title":"UNV mesh files","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Only ASCII files are supported\nFor 2D simulations the mesh must be contained in the X-Y plane only\nIn 3D only hex, tet and prism elements are supported","category":"page"},{"location":"user_guide/1_preprocessing/#OpenFOAM-mesh-files","page":"Pre-processing","title":"OpenFOAM mesh files","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Only ASCII files are supported\nBoundary groups are not supported (must be deleted manually or the conversion may fail)\nBoundary information is not preserved (walls, symmetry, etc)\n2D setups are not currently supported (but will be)","category":"page"},{"location":"user_guide/1_preprocessing/#Backend-selection","page":"Pre-processing","title":"Backend selection","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"In XCALibre.jl the mesh object is very important, as it will not only provide geometry information about the simulation/s, but it is also used to automatically dispatch methods to run on the appropriate backend. Therefore, users must first select the backend they wish to use for the simulations, and then \"adapt\" the mesh to use the correct backend. ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"XCALIbre.jl aims to work with all the backends supported by KernelAbstractions.jl. However, since internally XCALibre.jl uses sparse arrays to reduce its memory footprint some GPU backends are not currently supported since this functionality is not yet available. Thus, currently only a subset of backends are supported:","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"CPU (multithreaded and tested)\nNVidia GPUs (tested)\nAMD GPUs (not tested - feedback welcome)","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Selecting a given backend is straight forward. Below examples are provided by assigning a backend to the symbol backend and assigning the mesh object to the appropriate backend device using the symbol mesh_dev","category":"page"},{"location":"user_guide/1_preprocessing/#CPU-backend","page":"Pre-processing","title":"CPU backend","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Selecting the CPU backend is straight forward. See the example below. Notice that CPU() is a backend type provided by KernelAbstractions.jl which we re-export for convenience.","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"CPU Example ","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh\nbackend = CPU()\nmesh_dev = mesh # dummy reference to emphasise the mesh in on our chosen dev (or backend)","category":"page"},{"location":"user_guide/1_preprocessing/#GPU-backends","page":"Pre-processing","title":"GPU backends","text":"","category":"section"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"To run on GPUS, the process is also quite simple, but does require a few additional steps.","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Install the corresponding Julia library that supports your hardware. For NVidia GPUs, the CUDA.jl package is required. For AMD GPUs, the AMDGPU.jl package is needed.\nMove the mesh object to the backend device using the adapt method which for convenience we re-export from Adapt.jl","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Example for Nvidia GPU","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh\nbackend = CUDABackend()\nmesh_dev = adapt(backend, mesh) # make mesh object backend compatible and move to GPU","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"Example for AMD GPU","category":"page"},{"location":"user_guide/1_preprocessing/","page":"Pre-processing","title":"Pre-processing","text":"mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh\nbackend = ROCBackend()\nmesh_dev = adapt(backend, mesh) # make mesh object backend compatible and move to GPU","category":"page"},{"location":"user_guide/5_postprocessing/#Post-processing","page":"Post-processing","title":"Post-processing","text":"","category":"section"},{"location":"user_guide/5_postprocessing/","page":"Post-processing","title":"Post-processing","text":"super brief summary","category":"page"},{"location":"user_guide/5_postprocessing/#ParaView","page":"Post-processing","title":"ParaView","text":"","category":"section"},{"location":"user_guide/5_postprocessing/","page":"Post-processing","title":"Post-processing","text":"","category":"page"},{"location":"user_guide/5_postprocessing/#Available-functions","page":"Post-processing","title":"Available functions","text":"","category":"section"},{"location":"user_guide/5_postprocessing/","page":"Post-processing","title":"Post-processing","text":"","category":"page"},{"location":"release_notes/#Release-Notes","page":"Release Notes","title":"Release Notes","text":"","category":"section"},{"location":"#XCALibre.jl","page":"Home","title":"XCALibre.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XPU CFD Algorithms and libraries","category":"page"},{"location":"#What-is-XCALibre.jl?","page":"Home","title":"What is XCALibre.jl?","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl (pronounced as the mythical sword Excalibur) is a general purpose Computational Fluid Dynamics (CFD) library for 2D and 3D simulations on structured/unstructured grids using the finite volume method. XCALibre.jl has been designed to act as a platform for developing, testing and using XPU CFD Algorithms and Libraries to give researchers in both academia and industry alike a tool that can be used to test out ideas easily within a framework that offers acceptable performance. To this end, XCALibre.jl has been implemented to offer both CPU multi-threaded capabilities or GPU acceleration using the same codebase (thanks to the unified programming framework provided by KernelAbstractions.jl). Additionally, XCALibre.jl also offers a friendly API for those users who are interested in running CFD simulations with the existing solvers and models built into XCALibre.jl. ","category":"page"},{"location":"#Why-XCALibre.jl?","page":"Home","title":"Why XCALibre.jl?","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"For CFD researchers whose research involves developing new numerical methods, turbulence models, or novel CFD methodologies, the development process can be taxiing when using commercial packages and their imagination might be constrained by having to adhere to either limited access to internal code functionality or exhausted as they reformulate their ideas to fit within any interfaces provided by the code. There are excellent open source CFD packages where access to functionality or internals is available, however, they are either written in static languages such as C/C++ or dynamic languages such as Python. In static languages, the resulting code is likely highly performant but implementation can be slow and often has a high learning curve (specially if the developer/researcher has no prior knowledge of the language). On the other hand, dynamics languages such as Python can offer a nice development experience at the cost of low runtime or reduced performance. The development of XCALibre.jl was motivated when we discovered the Julia programming language, which promises an interactive and enjoyable implementation experience whilst being able to generate performant code. Thanks to the tools available in the Julia ecosystems (see Main dependencies) it is also possible to generate CPU and GPU code using Julia. As a side effect, XCALibre.jl can also link readily with the entire Julia ecosystem, including machine learning frameworks such as Flux.jl, Lux.jl, Knet.jl, etc. Thanks to a user-friendly API, ultimately, we hope that XCALibre.jl can be useful to anyone who has an interest in CFD. Enjoy and give us feedback LINK.","category":"page"},{"location":"#Main-features","page":"Home","title":"Main features","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"#Multiple-backends","page":"Home","title":"Multiple backends","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl embraces parallelism out-of-the-box on all the compute backends supported by KernelAbstractions.jl. That is,","category":"page"},{"location":"","page":"Home","title":"Home","text":"GPU acceleration on Nvidia, AMD, Intel and Apple hardware\nMulti-threaded runs on CPUs","category":"page"},{"location":"","page":"Home","title":"Home","text":"note: Note\nGPU functionality has only been tested on Nvidia hardware due to availability. Although GPUs from other vendors should also work correctly. Please open an issue if this is not the case so we can investigate. Notice that Apple hardware will not work as expected due to support for sparse matrices not being implemented yet on Metal.jl","category":"page"},{"location":"#Mesh-formats","page":"Home","title":"Mesh formats","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl uses its own mesh format to allow the geometry and boundary information to be stored in a format that is suitable for both CPU and GPU calculations. XCALibre.jl does not yet provide mesh generation tools. Therefore, some mesh conversion tools for the following mesh formats are provided:","category":"page"},{"location":"","page":"Home","title":"Home","text":"OpenFOAM meshes for 3D simulations (ascii only)\nUNV meshes for 2D simulations (ascii only)\nUNV meshes for 3D simulations (ascii only)","category":"page"},{"location":"","page":"Home","title":"Home","text":"note: Note\nAlthough the mesh conversion tools for the OpenFOAM format can import grids designed for 2D simulations, it is not recommended to use OpenFOAM grids for 2D cases (at present, support for 2D OpenFOAM grids in progress). Instead, use a 2D grid generated in the .unv format. Also for 2D grids some requirements must be met when defining the geometry (see Mesh generation and requirements)","category":"page"},{"location":"#Solvers","page":"Home","title":"Solvers","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl ships with fluid solvers for steady and transient simulations, based on the SIMPLE and PISO algorithms. Currently, the following flow solvers are provided:","category":"page"},{"location":"","page":"Home","title":"Home","text":"Steady incompressible flows\nSteady weakly compressible flows\nTransient incompressible flows\nTransient weakly compressible flows","category":"page"},{"location":"","page":"Home","title":"Home","text":"note: Note\nA solver for highly compressible flows (shock capturing) is currently in testing and will be available in the next major release. Currently the compressible solvers are based use a sensible energy approach for the energy equation.","category":"page"},{"location":"#Turbulence-and-energy-models","page":"Home","title":"Turbulence and energy models","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The list of available turbulence models available is expected to expand. The following turbulence models are already available in XCALibre.jl","category":"page"},{"location":"","page":"Home","title":"Home","text":"Reynolds-Averaged Navier-Stokes (RANS)\nk-omega - available in low-Reynolds (wall-resolving) and in high-Reynolds (wall functions) mode\nk-omega LKE - transitional model using the Laminar Kinetic Energy concept to model transition onset\nLarge Eddy Simulation (LES with implicit filtering)\nSmagorinsky - classic eddy-viscosity sub-grid scale Smagorinsky model","category":"page"},{"location":"#Boundary-conditions","page":"Home","title":"Boundary conditions","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"User defined functions\nNeural network defined BCs","category":"page"},{"location":"#Numerical-schemes","page":"Home","title":"Numerical schemes","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Linear - second order schemes for gradients, laplacian and divergence terms\nUpwind - first order upwind-biased scheme for divergence terms\nLUST (divergence) - mixed order upwind-biased scheme for divergence terms\nMidpoint - skew-corrected scheme for gradient calculations\nSteadyState - dummy scheme used to dispatch solvers for operation in steady mode\nEuler - first order semi-implicit time scheme","category":"page"},{"location":"#Simple-API-for-transport-equations","page":"Home","title":"Simple API for transport equations","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Code example","category":"page"},{"location":"","page":"Home","title":"Home","text":"U_eqn = (\n Time{schemes.U.time}(U)\n + Divergence{schemes.U.divergence}(mdotf, U) \n - Laplacian{schemes.U.laplacian}(nueff, U) \n == \n -Source(∇p.result)\n\n ) → VectorEquation(mesh)","category":"page"},{"location":"#Planned-development","page":"Home","title":"Planned development","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"#Capabilities,-solvers,-algorithms,-models,-etc.","page":"Home","title":"Capabilities, solvers, algorithms, models, etc.","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Solver for highly compressible flows (including shockwaves)\nConjugate heat transfer\nk-epsilon turbulence model\nImplement parallel versions of more efficient preconditioners","category":"page"},{"location":"#API","page":"Home","title":"API","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Pass boundary conditions as a separate object. The correct approach results in some internal methods/objects not being fully compatible with GPU kernels, and results is some performance degradation (due to unnecessary data transfer between GPU and host device when boundary condition information is needed/applied). A separation of boundary conditions from field data (scalar and vector fields primarily) would address both of these issues.\nThere are no further immediate plans for changing the user API\nFine tuning of the public API expected based on of user feedback","category":"page"},{"location":"#Internals","page":"Home","title":"Internals","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Overhaul of field data. Currently, both vectors and tensors are built on the primitive scalar field object. Whilst this was convenience during the early development stage, the package has reach a level of maturity that makes this approach hard to maintain, adding unneeded complexity when working with tensors. We plan to define separate internals (how tensors are defined and stored in memory). It is anticipated that this will ease the implementation of models working with tensors, and give some performance gains since information will be stored closer in memory.","category":"page"},{"location":"#Main-dependencies","page":"Home","title":"Main dependencies","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"XCALibre.jl is possible (and relies) on the functionality provided by other packages in the Julia ecosystem. For a full list of direct dependencies please refer to the Project.toml file included with this repository. We are thankful to the teams that have helped develop and maintain every single of our dependencies. Major functionally is provided by the following:","category":"page"},{"location":"","page":"Home","title":"Home","text":"KernelAbstractions.jl - provides a unified parallel programming framework for CPUs and GPUs\nKrylov.jl - provide solvers for linear systems at the heart of XCALibre.jl\nLinearOperators.jl - wrappers for matrices and linear operators\nAtomix.jl - enable atomix operations to ensure race conditions are avoided in parallel kernels\nCUDA.jl, AMD.jl, Metal.jl and OneAPI.jl - not direct dependencies but packages enable GPU usage in Julia","category":"page"},{"location":"#Related-projects","page":"Home","title":"Related projects","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"There are other wonderful fluids simulation packages available in the Julia ecosystems (please let us know if we missed any):","category":"page"},{"location":"","page":"Home","title":"Home","text":"Oceananigans.jl ADD LINK \nWaterlilly.jl ADD LINK \nTrixi.jl ADD LINK ","category":"page"}] } diff --git a/dev/theory_guide/introduction/index.html b/dev/theory_guide/introduction/index.html index f52b5d68..60cb34f9 100644 --- a/dev/theory_guide/introduction/index.html +++ b/dev/theory_guide/introduction/index.html @@ -1,2 +1,2 @@ -Theory Guide · XCALibre.jl
+Theory Guide · XCALibre.jl
diff --git a/dev/user_guide/0_introduction_and_workflow/index.html b/dev/user_guide/0_introduction_and_workflow/index.html index 633cc743..d5849d08 100644 --- a/dev/user_guide/0_introduction_and_workflow/index.html +++ b/dev/user_guide/0_introduction_and_workflow/index.html @@ -1,2 +1,2 @@ -Introduction · XCALibre.jl

Introduction

This page explains the overarching workflow in XCALibre.jl and provides a list of contents

Workflow overview


XCALibre.jl has been designed to incorporate a logical workflow, that is, the sequence of setup steps that would take a user naturally from the start of a simulation to its final post-processing. The key steps are listed below

  • Pre-processing - this step involves defining the computational domain and selecting the corresponding backend to performs the calculations
  • Physics and models - this step involves defining the fluid type, flow properties, selecting appropriate models and setting suitable boundary conditions
  • Numerical setup - in this phase of the simulation set up all aspect related to the numerics are chosen, from distretisation schemes all the way to solvers and preconditioners.
  • Runtime and solvers - once everything has been set up, the simulation is ready to run, once runtime information such as time steps and solution saving intervals has been selected. The final step is to actually start the simulation.
  • Post-processing - the final step is to enjoy all the pretty pictures!

The user guide is structured such that the information provided is grouped following the workflow illustrated above. For convenience the contents of the user guide are included below, with links to the relevant sections.

Contents


+Introduction · XCALibre.jl

Introduction

This page explains the overarching workflow in XCALibre.jl and provides a list of contents

Workflow overview


XCALibre.jl has been designed to incorporate a logical workflow, that is, the sequence of setup steps that would take a user naturally from the start of a simulation to its final post-processing. The key steps are listed below

  • Pre-processing - this step involves defining the computational domain and selecting the corresponding backend to performs the calculations
  • Physics and models - this step involves defining the fluid type, flow properties, selecting appropriate models and setting suitable boundary conditions
  • Numerical setup - in this phase of the simulation set up all aspect related to the numerics are chosen, from distretisation schemes all the way to solvers and preconditioners.
  • Runtime and solvers - once everything has been set up, the simulation is ready to run, once runtime information such as time steps and solution saving intervals has been selected. The final step is to actually start the simulation.
  • Post-processing - the final step is to enjoy all the pretty pictures!

The user guide is structured such that the information provided is grouped following the workflow illustrated above. For convenience the contents of the user guide are included below, with links to the relevant sections.

Contents


diff --git a/dev/user_guide/1_preprocessing/index.html b/dev/user_guide/1_preprocessing/index.html index 05273132..4b1683bf 100644 --- a/dev/user_guide/1_preprocessing/index.html +++ b/dev/user_guide/1_preprocessing/index.html @@ -1,8 +1,8 @@ -Pre-processing · XCALibre.jl

Pre-processing

super brief summary

Mesh generation and requirements


As with all CFD solvers, defining a suitable mesh is one of the most important steps. XCALibre.jl does not provides mesh generation utilities (yet). Thus, the user will have to generate the grids using external mesh generation tools. However, XCALibre.jl does provide a number of mesh conversion tools to allow user to import their grids.

XCALibre.jl is an unstructured Finite Volume Method (FVM) library, therefore, we are able to support grids of arbitrary polyhedral cells. In XCALibre.jl a cell-centred FVM approach has been implemented, which is popular since it allows the representation of complex geometries and it is used by most commercial and many open source CFD solvers.

Mesh conversion

XCALibre.jl at present supports .unv mesh formats (which can be generated using SALOME) for simulations in 2D and 3D domains. Additionally, XCALibre.jl also supports the OpenFOAM mesh format for simulations in 3D only (for now).

Note

Currently, XCALibre.jl only supports loading mesh files stored in ASCII format. Please ensure that when saving grid files they are not saved in binary. Most mesh generation programmes offer the option to export in ASCII (test-based) formats.

The following functions are provided for importing mesh files:

XCALibre.UNV2.UNV2D_meshFunction
UNV2D_mesh(meshFile; scale=1, integer_type=Int64, float_type=Float64)

Read and convert 2D UNV mesh file into XCALibre.jl

Input

  • meshFile – path to mesh file.

Optional arguments

  • scale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling

  • integer_type - select interger type to use in the mesh (Int32 may be useful on GPU runs)

  • float_type - select interger type to use in the mesh (Float32 may be useful on GPU runs)

source
XCALibre.UNV3.UNV3D_meshFunction
UNV3D_mesh(unv_mesh; scale=1, integer_type=Int64, float_type=Float64)

Read and convert 3D UNV mesh file into XCALibre.jl. Note that a limitation of the .unv mesh format is that it only supports the following 3D cells:

  • Tetahedrals
  • Prisms
  • Hexahedrals

Input

  • unv_mesh – path to mesh file.

Optional arguments

  • scale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling

  • integer_type - select interger type to use in the mesh (Int32 may be useful on GPU runs)

  • float_type - select interger type to use in the mesh (Float32 may be useful on GPU runs)

source
XCALibre.FoamMesh.FOAM3D_meshFunction
FOAM3D_mesh(mesh_file; scale=1, integer_type=Int64, float_type=Float64)

Read and convert 3D OpenFOAM mesh file into XCALibre.jl. Note that, at present, it is not recommended to run 2D cases using meshes imported using this function.

Input

  • mesh_file – path to mesh file.

Optional arguments

  • scale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling

  • integer_type - select interger type to use in the mesh (Int32 may be useful on GPU runs)

  • float_type - select interger type to use in the mesh (Float32 may be useful on GPU runs)

source

Mesh limitations and requirements

In this section we summarise the key limitations of the mesh loaders presented above, and we also highlight specific requirements.

UNV mesh files

  • Only ASCII files are supported
  • For 2D simulations the mesh must be contained in the X-Y plane only
  • In 3D only hex, tet and prism elements are supported

OpenFOAM mesh files

  • Only ASCII files are supported
  • Boundary groups are not supported (must be deleted manually or the conversion may fail)
  • Boundary information is not preserved (walls, symmetry, etc)
  • 2D setups are not currently supported (but will be)

Backend selection


In XCALibre.jl the mesh object is very important, as it will not only provide geometry information about the simulation/s, but it is also used to automatically dispatch methods to run on the appropriate backend. Therefore, users must first select the backend they wish to use for the simulations, and then "adapt" the mesh to use the correct backend.

XCALIbre.jl aims to work with all the backends supported by KernelAbstractions.jl. However, since internally XCALibre.jl uses sparse arrays to reduce its memory footprint some GPU backends are not currently supported since this functionality is not yet available. Thus, currently only a subset of backends are supported:

  • CPU (multithreaded and tested)
  • NVidia GPUs (tested)
  • AMD GPUs (not tested - feedback welcome)

Selecting a given backend is straight forward. Below examples are provided by assigning a backend to the symbol backend and assigning the mesh object to the appropriate backend device using the symbol mesh_dev

CPU backend

Selecting the CPU backend is straight forward. See the example below. Notice that CPU() is a backend type provided by KernelAbstractions.jl which we re-export for convenience.

CPU Example

mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh
+Pre-processing · XCALibre.jl

Pre-processing

super brief summary

Mesh generation and requirements


As with all CFD solvers, defining a suitable mesh is one of the most important steps. XCALibre.jl does not provides mesh generation utilities (yet). Thus, the user will have to generate the grids using external mesh generation tools. However, XCALibre.jl does provide a number of mesh conversion tools to allow user to import their grids.

XCALibre.jl is an unstructured Finite Volume Method (FVM) library, therefore, we are able to support grids of arbitrary polyhedral cells. In XCALibre.jl a cell-centred FVM approach has been implemented, which is popular since it allows the representation of complex geometries and it is used by most commercial and many open source CFD solvers.

Mesh conversion

XCALibre.jl at present supports .unv mesh formats (which can be generated using SALOME) for simulations in 2D and 3D domains. Additionally, XCALibre.jl also supports the OpenFOAM mesh format for simulations in 3D only (for now).

Note

Currently, XCALibre.jl only supports loading mesh files stored in ASCII format. Please ensure that when saving grid files they are not saved in binary. Most mesh generation programmes offer the option to export in ASCII (test-based) formats.

The following functions are provided for importing mesh files:

XCALibre.UNV2.UNV2D_meshFunction
UNV2D_mesh(meshFile; scale=1, integer_type=Int64, float_type=Float64)

Read and convert 2D UNV mesh file into XCALibre.jl

Input

  • meshFile – path to mesh file.

Optional arguments

  • scale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling

  • integer_type - select interger type to use in the mesh (Int32 may be useful on GPU runs)

  • float_type - select interger type to use in the mesh (Float32 may be useful on GPU runs)

source
XCALibre.UNV3.UNV3D_meshFunction
UNV3D_mesh(unv_mesh; scale=1, integer_type=Int64, float_type=Float64)

Read and convert 3D UNV mesh file into XCALibre.jl. Note that a limitation of the .unv mesh format is that it only supports the following 3D cells:

  • Tetahedrals
  • Prisms
  • Hexahedrals

Input

  • unv_mesh – path to mesh file.

Optional arguments

  • scale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling

  • integer_type - select interger type to use in the mesh (Int32 may be useful on GPU runs)

  • float_type - select interger type to use in the mesh (Float32 may be useful on GPU runs)

source
XCALibre.FoamMesh.FOAM3D_meshFunction
FOAM3D_mesh(mesh_file; scale=1, integer_type=Int64, float_type=Float64)

Read and convert 3D OpenFOAM mesh file into XCALibre.jl. Note that, at present, it is not recommended to run 2D cases using meshes imported using this function.

Input

  • mesh_file – path to mesh file.

Optional arguments

  • scale – used to scale mesh file e.g. scale=0.001 will convert mesh from mm to metres defaults to 1 i.e. no scaling

  • integer_type - select interger type to use in the mesh (Int32 may be useful on GPU runs)

  • float_type - select interger type to use in the mesh (Float32 may be useful on GPU runs)

source

Mesh limitations and requirements

In this section we summarise the key limitations of the mesh loaders presented above, and we also highlight specific requirements.

UNV mesh files

  • Only ASCII files are supported
  • For 2D simulations the mesh must be contained in the X-Y plane only
  • In 3D only hex, tet and prism elements are supported

OpenFOAM mesh files

  • Only ASCII files are supported
  • Boundary groups are not supported (must be deleted manually or the conversion may fail)
  • Boundary information is not preserved (walls, symmetry, etc)
  • 2D setups are not currently supported (but will be)

Backend selection


In XCALibre.jl the mesh object is very important, as it will not only provide geometry information about the simulation/s, but it is also used to automatically dispatch methods to run on the appropriate backend. Therefore, users must first select the backend they wish to use for the simulations, and then "adapt" the mesh to use the correct backend.

XCALIbre.jl aims to work with all the backends supported by KernelAbstractions.jl. However, since internally XCALibre.jl uses sparse arrays to reduce its memory footprint some GPU backends are not currently supported since this functionality is not yet available. Thus, currently only a subset of backends are supported:

  • CPU (multithreaded and tested)
  • NVidia GPUs (tested)
  • AMD GPUs (not tested - feedback welcome)

Selecting a given backend is straight forward. Below examples are provided by assigning a backend to the symbol backend and assigning the mesh object to the appropriate backend device using the symbol mesh_dev

CPU backend

Selecting the CPU backend is straight forward. See the example below. Notice that CPU() is a backend type provided by KernelAbstractions.jl which we re-export for convenience.

CPU Example

mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh
 backend = CPU()
 mesh_dev = mesh # dummy reference to emphasise the mesh in on our chosen dev (or backend)

GPU backends

To run on GPUS, the process is also quite simple, but does require a few additional steps.

  • Install the corresponding Julia library that supports your hardware. For NVidia GPUs, the CUDA.jl package is required. For AMD GPUs, the AMDGPU.jl package is needed.
  • Move the mesh object to the backend device using the adapt method which for convenience we re-export from Adapt.jl

Example for Nvidia GPU

mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh
 backend = CUDABackend()
 mesh_dev = adapt(backend, mesh) # make mesh object backend compatible and move to GPU

Example for AMD GPU

mesh = # call function to load mesh e.g. UNV2_mesh, UNV3_mesh or FOAM3D_mesh
 backend = ROCBackend()
-mesh_dev = adapt(backend, mesh) # make mesh object backend compatible and move to GPU
+mesh_dev = adapt(backend, mesh) # make mesh object backend compatible and move to GPU
diff --git a/dev/user_guide/2_physics_and_models/index.html b/dev/user_guide/2_physics_and_models/index.html index ea58f28f..f1dd8a9c 100644 --- a/dev/user_guide/2_physics_and_models/index.html +++ b/dev/user_guide/2_physics_and_models/index.html @@ -124,4 +124,4 @@ Dirichlet(:outlet, 0.0), Neumann(:wall, 0.0), # scalar wall - set up as zero gradient Neumann(:top, 0.0) # scalar wall - set up as zero gradient -)
Hint

Julia is a dynamic language and objects can be interrogated on the fly (dynamically). Say you created a Physics model named mymodel, you can interrogate the contents of any of the fields in the Physics structure using the fieldnames function, e.g. fieldnames(mymodel.momentum), to find which fields need to be provided with boundary conditions. Any fields not ending in f should be set.

+)
Hint

Julia is a dynamic language and objects can be interrogated on the fly (dynamically). Say you created a Physics model named mymodel, you can interrogate the contents of any of the fields in the Physics structure using the fieldnames function, e.g. fieldnames(mymodel.momentum), to find which fields need to be provided with boundary conditions. Any fields not ending in f should be set.

diff --git a/dev/user_guide/3_numerical_setup/index.html b/dev/user_guide/3_numerical_setup/index.html index fe62120e..0d3e1104 100644 --- a/dev/user_guide/3_numerical_setup/index.html +++ b/dev/user_guide/3_numerical_setup/index.html @@ -22,7 +22,7 @@ laplacian=laplacian, gradient=gradient ) -end

The set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.

inputs

  • time is used to set the time schemes(default is SteadyState)
  • divergence is used to set the divergence scheme (default is Linear)
  • laplacian is used to set the laplacian scheme (default is Linear)
  • gradient is used to set the gradient scheme (default is Orthogonal)
source

For example, below we set the schemes for the U and p fields. Notice that in the first case the schemes will take their default values (entry for p). In the case of U, we are only changing the setting for the divergence scheme to Upwind.

using XCALibre
+end

The set_schemes function is used at the top-level API to help users define discretisation schemes for every field solved. It offers default values, thus users can pick and choose which entry they wish to modify.

inputs

  • time is used to set the time schemes(default is SteadyState)
  • divergence is used to set the divergence scheme (default is Linear)
  • laplacian is used to set the laplacian scheme (default is Linear)
  • gradient is used to set the gradient scheme (default is Orthogonal)
source

For example, below we set the schemes for the U and p fields. Notice that in the first case the schemes will take their default values (entry for p). In the case of U, we are only changing the setting for the divergence scheme to Upwind.

using XCALibre
 schemes = (
     p = set_schemes(), # no input provided (will use defaults)
     U = set_schemes(divergence = Upwind),
@@ -51,7 +51,7 @@
         atol=atol |> TF, 
         rtol=rtol |> TF
     )
-end

This function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers.

Input arguments

  • field reference to the field to which the solver settings will apply (used to provide integer and float types required)
  • solver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl
  • preconditioner instance of preconditioner to be used e.g. Jacobi()
  • convergence sets the stopping criteria of this field
  • relax specifies the relaxation factor to be used e.g. set to 1 for no relaxation
  • limit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()
  • itmax maximum number of iterations in a single solver pass (defaults to 100)
  • atol absolute tolerance for the solver (default to eps(FloatType)^0.9)
  • rtol set relative tolerance for the solver (defaults to 1e-3)
source

Preconditioners

XCALibre.jl offers a range of preconditioners which are subtypes of the abstrac type PreconditionerType, exploring its subtypes we can find a list of the currently available preconditioners:

PreconditionerType
+end

This function is used to provide solver settings that will be used internally in XCALibre.jl. It returns a NamedTuple with solver settings that are used internally by the flow solvers.

Input arguments

  • field reference to the field to which the solver settings will apply (used to provide integer and float types required)
  • solver solver object from Krylov.jl and it could be one of BicgstabSolver, CgSolver, GmresSolver which are reexported in XCALibre.jl
  • preconditioner instance of preconditioner to be used e.g. Jacobi()
  • convergence sets the stopping criteria of this field
  • relax specifies the relaxation factor to be used e.g. set to 1 for no relaxation
  • limit used in some solvers to bound the solution within this limits e.g. (min, max). It defaults to ()
  • itmax maximum number of iterations in a single solver pass (defaults to 100)
  • atol absolute tolerance for the solver (default to eps(FloatType)^0.9)
  • rtol set relative tolerance for the solver (defaults to 1e-3)
source

Preconditioners

XCALibre.jl offers a range of preconditioners which are subtypes of the abstrac type PreconditionerType, exploring its subtypes we can find a list of the currently available preconditioners:

PreconditionerType
 ├─ DILU
 ├─ ILU0
 ├─ Jacobi
@@ -79,4 +79,4 @@
         rtol = 1e-4,
         atol = 1e-10
     )
-)
+) diff --git a/dev/user_guide/4_runtime_and_solvers/index.html b/dev/user_guide/4_runtime_and_solvers/index.html index 51e3e5c3..ab249b7f 100644 --- a/dev/user_guide/4_runtime_and_solvers/index.html +++ b/dev/user_guide/4_runtime_and_solvers/index.html @@ -11,11 +11,15 @@ iterations=iterations, dt=time_step, write_interval=write_interval) -end

This is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.

Input arguments

  • iterations::Integer specifies the number of iterations in a simulation run.
  • write_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.
  • time_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.

Example

runtime = set_runtime(
-    iterations=2000, time_step=1, write_interval=2000)
source

Configuration object


XCALibre.Simulate.ConfigurationType
@kwdef struct Configuration{SC,SL,RT,HW}
+end

This is a convenience function to set the top-level runtime information. The inputs are all keyword arguments and provide basic information to flow solvers just before running a simulation.

Input arguments

  • iterations::Integer specifies the number of iterations in a simulation run.
  • write_interval::Integer define how often simulation results are written to file. The interval is currently based on number of iterations. Set to -1 to run without writing results to file.
  • time_step::Number the time step to use in the simulation. Notice that for steady solvers this is simply a counter and it is recommended to simply use 1.

Example

runtime = set_runtime(
+    iterations=2000, time_step=1, write_interval=2000)
source

Configuration object


XCALibre.Simulate.ConfigurationType
@kwdef struct Configuration{SC,SL,RT,HW}
     schemes::SC
     solvers::SL
     runtime::RT
     hardware::HW
-end

The Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation.

Inputs

  • schemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.
  • solvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.
  • runtime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.
  • hardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.

Example

config = Configuration(
-    solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)
source

Initialising fields


Launching flow solvers


+end

The Configuration type is pass to all flow solvers and provides all the relevant configuration to run a simulation.

Inputs

  • schemes::NamedTuple this keyword argument is used to pass distretisation scheme information to flow solvers. See Numerical setup for details.
  • solvers::NamedTuple this keyword argument is used to pass the configurations for the linear solvers for each field information to flow solvers. See Runtime and solvers for details.
  • runtime::NamedTuple this keyword argument is used to pass runtime information to the flow solvers. See Runtime and solvers for details.
  • hardware::NamedTuple this keyword argument is used to pass the hardware configuration and backend settings to the flow solvers. See Pre-processing for details.

Example

config = Configuration(
+    solvers=solvers, schemes=schemes, runtime=runtime, hardware=hardware)
source

Initialising fields


XCALibre.Fields.initialise!Function
function initialise!(field, value) # dummy function for documentation
+    # Assign `value` to field in-place
+    nothing
+end

This function will set the given field to the value provided in-place. Useful for initialising fields prior to running a simulation.

Input arguments

  • field specifies the field to be initialised. The field must be either a AbractScalarField or AbstractVectorField
  • value defines the value to be set. This should be a scalar or vector (3 components) depending on the field to be modified e.g. for an AbstractVectorField we can specify as value=[10,0,0]

Note: in most cases the fields to be modified are stored within a physics model i.e. a Physics object. Thus, the argument value must fully qualify the model. For example, if we have created a Physics model named mymodel to set the velocity field, U, we would set the argument field to mymodel.momentum.U. See the example below.

Example

initialise!(mymodel.momentum.U, [2.5, 0, 0])
+initialise!(mymodel.momentum.p, 1.25)
source

Launching flow solvers

XCALibre.Solvers.run!Method
residuals = run!(model::Physics, config::Configuration)

Description goes here

Input arguments

Example

Something here
source

diff --git a/dev/user_guide/5_postprocessing/index.html b/dev/user_guide/5_postprocessing/index.html index b7c9e5a8..4316b3c4 100644 --- a/dev/user_guide/5_postprocessing/index.html +++ b/dev/user_guide/5_postprocessing/index.html @@ -1,2 +1,2 @@ -Post-processing · XCALibre.jl
+Post-processing · XCALibre.jl