Skip to content

Commit

Permalink
Tracer with Sharp IB (#1185)
Browse files Browse the repository at this point in the history
Description
Previously, the tracer physics used with the Sharp IB solver could not consider material dependent physical properties: both fluid and solid had the same diffusivity.
Now, physical properties of immersed solids are defined using the solid 0 section, though only one solid can be used at the moment.
A tracer diffusivity model based on the signed distance function used in the Sharp IB has been added, which allows to smooth the diffusivity transition at the fluid/solid interface. The architecture is there for future models and could serve as a base for reactive physics models used in heterogeneous catalysis.
Testing
[tests/core/immersed_solid_diffusivity_tanh] Unit test for the tanh diffusivity transition model.
[applications_tests/lethe-fluid-sharp/tracer_around_sphere] 2D application test where the tracer physics is used with the Sharp IB solver. This also tests the new diffusivity model.
Documentation
[doc/source/parameters/cfd/physical_properties] The new model has been added in new section where immersed solids models will be added in the future.

Co-authored-by: hepap <47506601+hepap@users.noreply.github.com>
Co-authored-by: Bruno Blais <blais.bruno@gmail.com>
  • Loading branch information
3 people authored Jul 12, 2024
1 parent 49a2616 commit e7bfe64
Show file tree
Hide file tree
Showing 22 changed files with 641 additions and 45 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to the Lethe project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## [Master] - 2024-07-12

### Added

- MINOR A tracer diffusivity model is added, to be used with the `lethe-fluid-sharp` solver. It makes it possible to assign distance-based (depth) diffusivity to the immersed solids. [#1185](https://github.com/chaos-polymtl/lethe/pull/1185)

## [Master] - 2024-07-09

### Added
Expand Down
34 changes: 34 additions & 0 deletions applications_tests/lethe-fluid-sharp/tracer_around_sphere.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Running on 1 MPI rank(s)...
Number of active cells: 128
Number of degrees of freedom: 459
Volume of triangulation: 0.5
Number of tracer degrees of freedom: 153
Initial refinement around IB particles - Step : 1 of 3
Number of active cells: 176
Number of degrees of freedom: 627
Volume of triangulation: 0.5
Number of tracer degrees of freedom: 209
Initial refinement around IB particles - Step : 2 of 3
Number of active cells: 284
Number of degrees of freedom: 987
Volume of triangulation: 0.5
Number of tracer degrees of freedom: 329
Initial refinement around IB particles - Step : 3 of 3
Number of active cells: 500
Number of degrees of freedom: 1719
Volume of triangulation: 0.5
Number of tracer degrees of freedom: 573
Tracer statistics :
Min : 0
Max : 0.7887
Average : 0.01367
Std-Dev : 0.09216

*****************************
Steady iteration: 1/1
*****************************
Tracer statistics :
Min : -0.0071
Max : 1.007
Average : 0.441
Std-Dev : 0.3645
133 changes: 133 additions & 0 deletions applications_tests/lethe-fluid-sharp/tracer_around_sphere.prm
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
set dimension = 2

subsection simulation control
set method = steady
set output frequency = 0
set log precision = 4
end

subsection FEM
set velocity order = 1
set pressure order = 1
end

subsection physical properties
set number of fluids = 1
subsection fluid 0
set kinematic viscosity = 0.01
set tracer diffusivity model = immersed solid tanh
subsection immersed solid tanh
set tracer diffusivity inside = 0
set tracer diffusivity outside = 1e-5
set thickness = 0.005
end
end
end

subsection multiphysics
set fluid dynamics = true
set tracer = true
end

subsection mesh
set type = dealii
set grid type = subdivided_hyper_rectangle
set grid arguments = 2, 1: -1.25, -0.25: -0.25, 0.25: true
set initial refinement = 3
end

subsection boundary conditions
set number = 4
subsection bc 0
set id = 0
set type = function
subsection u
set Function expression = 1
end
end
subsection bc 1
set id = 1
set type = outlet
end
subsection bc 2
set id = 2
set type = noslip
end
subsection bc 3
set id = 3
set type = noslip
end
end

subsection boundary conditions tracer
set number = 1
subsection bc 0
set id = 0
set type = dirichlet
subsection dirichlet
set Function expression = if(y>0,1,0)
end
end
end

subsection post-processing
set verbosity = verbose
set calculate tracer statistics = true
set tracer statistics name = tracer_statistics
end

subsection particles
set number of particles = 1
set assemble Navier-Stokes inside particles = false

subsection extrapolation function
set stencil order = 1
end
subsection output
set calculate force = false
end
subsection local mesh refinement
set initial refinement = 3
set refine mesh inside radius factor = 1
set refine mesh outside radius factor = 1
end
subsection particle info 0
set type = sphere
set shape arguments = 0.06
subsection position
set Function expression = -0.75; 0
end
end
end

subsection mesh adaptation
set type = kelly
set variable = pressure
set fraction type = number
set max number elements = 200000000
set max refinement level = 6
set min refinement level = 0
set frequency = 0
end

subsection non-linear solver
subsection fluid dynamics
set verbosity = quiet
set tolerance = 1e-4
set max iterations = 10
end
subsection tracer
set verbosity = quiet
set tolerance = 1e-7
set max iterations = 30
end
end

subsection linear solver
subsection fluid dynamics
set verbosity = quiet
end
subsection tracer
set verbosity = quiet
end
end
38 changes: 37 additions & 1 deletion doc/source/parameters/cfd/physical_properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Physical Properties
where :math:`F_B` denotes the buoyant force source term, :math:`\beta` is the thermal expansion coefficient, :math:`T` is temperature, and :math:`T_\text{ref}` is the reference temperature. This is only used when a constant thermal expansion model is used.

* The ``tracer diffusivity model`` specifies the model used to calculate the tracer diffusivity. At the moment, only a constant tracer diffusivity is supported.
* The ``tracer diffusivity model`` specifies the model used to calculate the tracer diffusivity. At the moment, a constant tracer diffusivity and level set based :math:`\tanh` model are supported. The ``immersed solid tanh`` model is intended to be used with immersed solids with the ``lethe-fluid-sharp`` executable as a way to set diffusivity inside solids as well (described more in `Immersed Solid Models`_).

* The ``tracer diffusivity`` parameter is the diffusivity coefficient of the tracer in units of :math:`\text{Length}^{2} \cdot \text{Time}^{-1}` . In SI, this is :math:`\text{m}^{2} \cdot \text{s}^{-1}`.

Expand Down Expand Up @@ -226,6 +226,42 @@ Conjugate heat transfer enables the addition of solid regions in which the fluid
end
end
.. _immersed solid models:

Immersed Solid Models
~~~~~~~~~~~~~~~~~~~~~~

Immersed solid models can be used to affect specific behavior to immersed solids when ``lethe-fluid-sharp`` is used. At the moment, such a model is only available for the ``tracer`` multiphysics, but additional physics will be included in the future.

The immersed solid properties models are based on the signed distance function of the immersed solids, and therefore depend on the depth inside the solid. The intent behind these models is to define physical properties in the fluid and solid phases as well as in the transition regions.

The ``tracer diffusivity model`` parameter sets which diffusivity model is used. The default model is ``constant``, which uses a constant ``tracer diffusivity``. The alternative is ``immersed solid tanh``, whose parameters are defined as such, with :math:`D` being the tracer diffusivity (outside and inside), :math:`\lambda` being signed distance and :math:`t` the thickness of the transition zone between both diffusivity values:

.. math::
D(\lambda) = D_\text{inside} + \left(D_\text{outside} - D_\text{inside}\right) \left( 0.5 + 0.5 \tanh \left(\frac{\lambda}{t}\right)\right)
.. code-block:: text
subsection physical properties
set number of fluids = 1
subsection fluid 0
set kinematic viscosity = 0.01
set tracer diffusivity model = immersed solid tanh
subsection immersed solid tanh
set tracer diffusivity inside = 1
set tracer diffusivity outside = 1
set thickness = 1
end
end
end
* The ``tracer diffusivity inside`` parameter represents the desired diffusivity inside of the solid.

* The ``tracer diffusivity outside`` parameter represents the desired diffusivity outside of the solid.

* The ``thickness`` parameter represents thickness of the applied :math:`\tanh` function.

.. _rheological_models:

Rheological Models
Expand Down
26 changes: 26 additions & 0 deletions include/core/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,21 @@ namespace Parameters
parse_parameters(ParameterHandler &prm, const Dimensionality dimensions);
};

/**
* @brief Tanh-based physical properties model to handle properties in/out of immersed solids
*/
struct ImmersedSolidTanhParameters
{
// Properties that apply to the tracer physics with immersed solids
double tracer_diffusivity_inside;
double tracer_diffusivity_outside;
double thickness;

static void
declare_parameters(ParameterHandler &prm);
void
parse_parameters(ParameterHandler &prm, const Dimensionality dimensions);
};

/**
* @brief Isothermal ideal gas model to solve for isothermal weakly
Expand Down Expand Up @@ -389,6 +404,7 @@ namespace Parameters
double thermal_conductivity;
// thermal expansion coefficient (alpha) in 1/K
double thermal_expansion;

// tracer diffusivity in L^2/s
double tracer_diffusivity;

Expand Down Expand Up @@ -431,6 +447,16 @@ namespace Parameters
phase_change
} thermal_expansion_model;

enum class TracerDiffusivityModel
{
constant,
immersed_boundary_tanh
} tracer_diffusivity_model;

// Struct that contains the parameters to handle physical properties when
// immersed solids models are used
ImmersedSolidTanhParameters immersed_solid_tanh_parameters;

// Linear thermal conductivity parameters: k = k_A0 + k_A1 * T
double k_A0;
double k_A1;
Expand Down
4 changes: 3 additions & 1 deletion include/core/physical_property_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ enum field : int
temperature_p2, // temperature at time t-dt
pressure,
phase_order_cahn_hilliard,
phase_order_cahn_hilliard_filtered
phase_order_cahn_hilliard_filtered,
levelset
};

inline void
Expand Down Expand Up @@ -96,6 +97,7 @@ class PhysicalPropertyModel
model_depends_on[temperature_p2] = false;
model_depends_on[pressure] = false;
model_depends_on[phase_order_cahn_hilliard] = false;
model_depends_on[levelset] = false;
}

/**
Expand Down
Loading

0 comments on commit e7bfe64

Please sign in to comment.