Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
82df50b
isolate the regularisation directory
shiyu-du-dsy May 6, 2026
5c0ad0e
make the input of entropy viscosity from fluid setting
shiyu-du-dsy May 6, 2026
e4aff1d
change regularization into viscous_regularization
shiyu-du-dsy May 6, 2026
7b0a86a
move entropy viscosity to the umbrella of artificial viscosity (avm),…
shiyu-du-dsy May 7, 2026
9b7684e
decouple entropy viscosity from euler solver
shiyu-du-dsy May 7, 2026
a091687
minor debug
shiyu-du-dsy May 7, 2026
ef47b3f
update examples
shiyu-du-dsy May 7, 2026
76daed9
add the documentation for viscous regularization
shiyu-du-dsy May 8, 2026
ffb1f83
make up for the previous PR
shiyu-du-dsy May 8, 2026
bab7e35
change documentation
shiyu-du-dsy May 8, 2026
42b4b58
make avm_model into the same directory, separated from the source fil…
shiyu-du-dsy May 8, 2026
3092532
formatting
shiyu-du-dsy May 8, 2026
0c39245
Potential fix for pull request finding
shiyu-du-dsy May 8, 2026
df9e57e
fix: deallocate local allocatables in avm_simcomp init
Copilot May 8, 2026
f9c0bfc
fix: deallocate local allocatable in setup_viscous_regularization
Copilot May 8, 2026
7f8b6a1
Potential fix for pull request finding
shiyu-du-dsy May 8, 2026
b026a26
Potential fix for pull request finding
shiyu-du-dsy May 8, 2026
8dfec24
Potential fix for pull request finding
shiyu-du-dsy May 8, 2026
12bec1c
Potential fix for pull request finding
shiyu-du-dsy May 8, 2026
62f530f
fix: align avm_simcomp field name with model field name
Copilot May 8, 2026
b4bf565
fix redundant arguments
shiyu-du-dsy May 11, 2026
48aae05
fix the nomenclature of avm_model etc
shiyu-du-dsy May 11, 2026
919289e
update changelog
shiyu-du-dsy May 11, 2026
f7e2069
further fix the comments
shiyu-du-dsy May 11, 2026
888dd4d
formating
shiyu-du-dsy May 11, 2026
98cea7c
try to make the file naming shorter in order to pass the CI tests
shiyu-du-dsy May 12, 2026
fac7b66
remove h from fluid_scheme
shiyu-du-dsy Jul 16, 2026
ce067c2
move entropy into entropy_viscosity
shiyu-du-dsy Jul 16, 2026
f5ae2a9
update json test
shiyu-du-dsy Jul 17, 2026
a03233a
fix the upper bound coefficient for entropy viscosity
shiyu-du-dsy Jul 17, 2026
61f7db1
update change log
shiyu-du-dsy Jul 17, 2026
42c2d60
gix grammar mistakes in the doc
shiyu-du-dsy Jul 23, 2026
f851e68
update depends
shiyu-du-dsy Aug 31, 2026
742e3f4
update the S_lag before compute
shiyu-du-dsy Sep 2, 2026
3508783
reject the old json setup for the entropy viscosity
shiyu-du-dsy Sep 2, 2026
444a6d5
restart the entropy viscosity by computing the entropy viscosity from…
shiyu-du-dsy Sep 3, 2026
e72ce0f
fix the registry and init of entropy
shiyu-du-dsy Sep 3, 2026
47f241a
clean the reg_coeff_name in the destructor
shiyu-du-dsy Sep 3, 2026
8929da8
report an error if it's not a compressible solver
shiyu-du-dsy Sep 3, 2026
a2dc673
fix documentation and copyright claim
shiyu-du-dsy Sep 3, 2026
39343c6
update depends
shiyu-du-dsy Sep 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog

## Develop
- *BREAKING* Modularized entropy viscosity in the compressible Navier-Stokes
solver. The obsolete `case.numerics.c_avisc_low` and
`case.numerics.c_avisc_entropy` options are now rejected. Configure an
`artificial_viscosity_model` simulation component with those coefficients
and enable its field through the fluid `viscous_regularization` object.

- *BREAKING*, normal_outflow conditions now require specifying `value`, which
is used to set the value of the tangential components of velocity.
Expand Down Expand Up @@ -153,6 +158,9 @@
- Added `host_array_t` and `device_array_t` temporary array types and support
for requesting these through `scratch_registry_t`.
- Added the `cai_sagaut_model_ii` wall model with CPU, CUDA, HIP, and OpenCL.
- Modularized `entropy_viscosity` into two steps: 1. Calculate the
artificial viscosity field in a simcomp; 2. Apply the artificial
viscosity though a viscous regularization object.
- Added the `create_periodic_zones` contrib utility for converting pairs of
labeled zones in an existing `.nmsh` mesh into periodic zones.
backends. This model is based on the work of [Cai and Sagaut (PoF,
Expand Down
65 changes: 51 additions & 14 deletions doc/pages/user-guide/case-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,6 @@ The compressible solver accepts the following parameters:
| `mu` | Constant physical dynamic viscosity | Non-negative real | `0.0` |
| `kappa` | Constant physical thermal conductivity | Non-negative real | `0.0` |

Additional numerics parameters specific to compressible flows:

| Name | Description | Admissible values | Default value |
| ----------------- | -------------------------------------------------- | ----------------- | ------------- |
| `c_avisc_low` | Coefficient for low-order artificial viscosity | Positive reals | `0.5` |
| `c_avisc_entropy` | Coefficient for entropy-based artificial viscosity | Positive reals | `1.0` |

The compressible solver uses variable time-stepping controlled by the CFL
number. Set `variable_timestep` to `true` and specify `target_cfl` in the time
control object.
Expand All @@ -403,6 +396,10 @@ Example configuration:
"fluid": {
"scheme": "compressible",
"gamma": 1.4,
"viscous_regularization":{
"type": "artificial_viscosity",
"reg_coeff_name": "entropy_viscosity"
},
"initial_condition": {
"type": "user"
},
Expand All @@ -426,12 +423,13 @@ Example configuration:
"output_control": "nsamples",
"output_value": 20
},
"numerics": {
"time_order": 3,
"polynomial_order": 5,
"c_avisc_low": 0.5,
"c_avisc_entropy": 0.5
}
"simulation_components": [
{
"type": "artificial_viscosity_model",
"model": "entropy_viscosity",
"field_name": "entropy_viscosity"
}
]
}
~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -2020,7 +2018,6 @@ concisely directly in the table.
| `shear_stress.value` | The shear stress vector value for `sh` boundaries | Vector of 3 reals | `[0, 0, 0]` |
| `wall_modelling.type` | The wall model type for `wm` boundaries. See documentation for additional config parameters. | `rough_log_law`, `spalding` | - |
| `source_terms` | Array of JSON objects, defining additional source terms. | See list of source terms above | - |
| `gradient_jump_penalty` | Array of JSON objects, defining additional gradient jump penalty. | See list of gradient jump penalty above | - |
| `boundary_types` | Boundary types/conditions labels. | Array of strings | - |
| `velocity_solver.type` | Linear solver for the momentum equation. | `cg`, `pipecg`, `bicgstab`, `cacg`, `gmres` | - |
| `velocity_solver.preconditioner.type` | Linear solver preconditioner for the momentum equation. | `ident`, `hsmg`, `jacobi` | - |
Expand Down Expand Up @@ -2237,3 +2234,43 @@ currently supports 50 regions, with id 1..25 being reserved for internal use.
| ---------------- | ----------------------------------------------------------- | ----------------- | ------------- |
| `enabled` | Whether to enable gathering of runtime statistics | `true` or `false` | `false` |
| `output_profile` | Whether to output all gathered profiling data as a CSV file | `true` or `false` | `false` |

## Viscous regularization {#case-file_viscous-regularization}

Users can use the viscous regularization object to enhance the smoothness or
the numerical stability of the solution via a diffusion term. For example,
artificial viscosity can be set up by this object to perform shock capturing.
Note that some regularization techniques do not have a diffusive mathematical
form, for example gradient jump penalty and high-pass filter relaxation terms,
and they are included in the source terms instead. The viscous regularization
can be set up with the following options:

* `type`, the viscous regularization type.
- `artificial_viscosity`, the standard second-order diffusion term,
$\frac{\partial}{\partial x}\left(\mu_\mathrm{artificial}\frac{\partial u}{\partial x}\right)$.
* `reg_coeff_name`, name of the $\mu_\mathrm{artificial}$ field, usually
computed by a simulation component.

Viscous regularization is currently supported by the compressible fluid
solver. Artificial viscosity requires both the regularization object that
consumes the coefficient and a simulation component that computes it. The
`reg_coeff_name` and `field_name` values must match:

~~~~~~~~~~~~~~~{.json}
{
"fluid": {
"scheme": "compressible",
"viscous_regularization": {
"type": "artificial_viscosity",
"reg_coeff_name": "entropy_viscosity"
}
},
"simulation_components": [
{
"type": "artificial_viscosity_model",
"model": "entropy_viscosity",
"field_name": "entropy_viscosity"
}
]
}
~~~~~~~~~~~~~~~
46 changes: 39 additions & 7 deletions doc/pages/user-guide/simcomps.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ in Neko. The list will be updated as new simcomps are added.
- Streaming of data for in-situ field manipulation \ref simcomp_data_streamer
- Sub-sampling of fields by changing polynomial order and masking by point
zones \ref simcomp_field_subsampler
- Computation of the viscous coefficient in artificial viscosity method (AVM)
via a particular model \ref simcomp_avm

## Controlling execution and file output
Each simulation component is, by default, executed once per time step to perform
Expand Down Expand Up @@ -764,15 +766,15 @@ keywords:
the maximum spacing of the GLL nodes within the element. The `les_delta`
field is added to the registry and written to the .fld files.
- `nut_field`: The name of the SGS eddy viscosity field added to the registry.
Defaults to `nut`. This allows to have two different SGS models active, saved
to different fields. For example, one for the scalar and one to the fluid.
- `extrapolation`: Whether or not extrapolate the velocity to
Defaults to `nut`. This allows two different SGS models to be active and saved
to different fields, for example one for the scalar and one for the fluid.
- `extrapolation`: Whether or not to extrapolate the velocity to
compute the eddy viscosity.
- `true`: extrapolate the velocity as the same order as
- `true`: extrapolate the velocity to the same order as
the time scheme.
- `false`: the default option, disable the extrapolation.
- `false`: the default option, disables extrapolation.
In this case, the estimation of the eddy viscosity is of first order, while
circumvent the risk of unstable extrapolation.
circumventing the risk of unstable extrapolation.

~~~~~~~~~~~~~~~{.json}
{
Expand Down Expand Up @@ -932,4 +934,34 @@ keywords used by the latter can also be specified, with the exception of
"compute_control": "tsteps",
"compute_value": 10
}
~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~

### artificial_viscosity_model {#simcomp_avm}
Computes an artificial viscosity field using a particular model. **Note:** The simcomp
*only* computes the artificial viscosity field. You have to select the
corresponding `reg_coeff_name` in the compressible fluid solver's
`viscous_regularization` JSON object to actually enable artificial viscosity;
see @ref case-file_viscous-regularization. The simcomp is controlled by the
following keywords:

- `model`: Selects the artificial viscosity model. Currently available models are:
- `entropy_viscosity`: An entropy-based viscosity aimed at shock capturing;
see Guermond et al. (https://doi.org/10.1016/j.jcp.2010.11.043).
- `c_avisc_low`: Coefficient for low-order artificial viscosity, defaults
to 0.5
- `c_avisc_entropy`: Coefficient for entropy-based artificial viscosity,
defaults to 1.0

- `field_name`: The name of the artificial viscosity field added to the registry.
Defaults to the model name.
It must match the `reg_coeff_name` selected by the consuming regularization
object.

~~~~~~~~~~~~~~~{.json}
{
"type": "artificial_viscosity_model",
"name": "artificial_viscosity_model",
"model": "entropy_viscosity",
"field_name": "entropy_viscosity"
}
~~~~~~~~~~~~~~~
6 changes: 0 additions & 6 deletions doc/schemas/numerics.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
},
"oifs_target_cfl": {
"$ref": "urn:neko:schema:common#/$defs/positiveNumberOrRef"
},
"c_avisc_low": {
"$ref": "urn:neko:schema:common#/$defs/positiveNumberOrRef"
},
"c_avisc_entropy": {
"$ref": "urn:neko:schema:common#/$defs/positiveNumberOrRef"
}
},
"additionalProperties": false
Expand Down
40 changes: 40 additions & 0 deletions doc/schemas/simcomps/artificial_viscosity_model.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:neko:schema:simcomps:artificial_viscosity_model",
"$defs": {
"simulationComponent": {
"allOf": [
{
"$ref": "urn:neko:schema:simulation-components#/$defs/simcompBase"
},
{
"$ref": "urn:neko:schema:simulation-components#/$defs/simcompFieldWriterOptions"
},
{
"type": "object",
"required": [
"model"
],
"properties": {
"type": {
"const": "artificial_viscosity_model"
},
"model": {
"const": "entropy_viscosity"
},
"field_name": {
"$ref": "urn:neko:schema:simulation-components#/$defs/nonEmptyString"
},
"c_avisc_low": {
"$ref": "urn:neko:schema:simulation-components#/$defs/numberOrRef"
},
"c_avisc_entropy": {
"$ref": "urn:neko:schema:simulation-components#/$defs/numberOrRef"
}
},
"additionalProperties": true
}
]
}
}
}
5 changes: 4 additions & 1 deletion doc/schemas/simulation-components.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@
{
"$ref": "urn:neko:schema:simcomps:field_subsampler#/$defs/simulationComponent"
},
{
"$ref": "urn:neko:schema:simcomps:artificial_viscosity_model#/$defs/simulationComponent"
},
{
"$ref": "urn:neko:schema:simcomps:boundary_data_writer#/$defs/simulationComponent"
},
Expand All @@ -616,4 +619,4 @@
]
}
}
}
}
14 changes: 11 additions & 3 deletions examples/cns_2d_shock_tube/2d_shock_tube.case
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
},
"numerics": {
"time_order": 3,
"polynomial_order": 3,
"c_avisc_low": 0.5,
"c_avisc_entropy": 0.5
"polynomial_order": 3
},
"fluid": {
"scheme": "compressible",
"gamma": 1.4,
"viscous_regularization": {
"type": "artificial_viscosity",
"reg_coeff_name": "entropy_viscosity"
},
"Re": 1000.0,
"Pr": 0.73,
"initial_condition": {
Expand All @@ -39,6 +41,12 @@
"output_value": 100
},
"simulation_components": [
{
"type": "artificial_viscosity_model",
"model": "entropy_viscosity",
"c_avisc_low": 0.5,
"c_avisc_entropy": 0.5
},
{
"type": "field_writer",
"fields": ["fluid_rho", "S", "artificial_visc"],
Expand Down
12 changes: 9 additions & 3 deletions examples/euler_1d_sod/sod.case
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
},
"numerics": {
"time_order": 4,
"polynomial_order": 3,
"c_avisc_low": 0.5,
"c_avisc_entropy": 1.0
"polynomial_order": 3
},
"fluid": {
"scheme": "compressible",
"gamma": 1.4,
"viscous_regularization":{
"type": "artificial_viscosity",
"reg_coeff_name": "entropy_viscosity"
},
"initial_condition": {
"type": "user"
},
Expand All @@ -33,6 +35,10 @@
"output_value": 100
},
"simulation_components": [
{
"type": "artificial_viscosity_model",
"model": "entropy_viscosity"
},
{
"type": "field_writer",
"fields": ["fluid_rho", "S", "artificial_visc"], // s2, s3, s4 in Paraview
Expand Down
12 changes: 9 additions & 3 deletions examples/euler_2d_cylinder/euler_2d_cylinder.case
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@

"numerics": {
"time_order": 3,
"polynomial_order": 5,
"c_avisc_low": 0.5,
"c_avisc_entropy": 1.0
"polynomial_order": 5
},

"fluid": {
"scheme": "compressible",
"gamma": 1.4,
"viscous_regularization":{
"type": "artificial_viscosity",
"reg_coeff_name": "entropy_viscosity"
},

"initial_condition": {
"type": "user"
Expand Down Expand Up @@ -58,6 +60,10 @@
},

"simulation_components": [
{
"type": "artificial_viscosity_model",
"model": "entropy_viscosity"
},
{
"type": "field_writer",
"fields": ["fluid_rho", "S", "artificial_visc"], // s2, s3, s4 in Paraview
Expand Down
12 changes: 9 additions & 3 deletions examples/euler_2d_forward_facing_step/step.case
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@

"numerics": {
"time_order": 3,
"polynomial_order": 5,
"c_avisc_low": 0.5,
"c_avisc_entropy": 0.5
"polynomial_order": 5
},

"fluid": {
"scheme": "compressible",
"gamma": 1.4,
"viscous_regularization":{
"type": "artificial_viscosity",
"reg_coeff_name": "entropy_viscosity"
},

"initial_condition": {
"type": "user"
Expand Down Expand Up @@ -54,6 +56,10 @@
},

"simulation_components": [
{
"type": "artificial_viscosity_model",
"model": "entropy_viscosity"
},
{
"type": "field_writer",
"fields": ["fluid_rho", "S", "artificial_visc", "max_wave_speed"], // s2, s3, s4, s5 in Paraview
Expand Down
Loading
Loading