Skip to content

Commit

Permalink
Merge pull request #1555 from ExtremeFLOW/feature/spectral-error-simcomp
Browse files Browse the repository at this point in the history
  • Loading branch information
njansson authored Nov 1, 2024
2 parents 3d770d0 + 35e8c41 commit e32f35f
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 142 deletions.
41 changes: 35 additions & 6 deletions doc/pages/user-guide/simcomps.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ in Neko. The list will be updated as new simcomps are added.
- Computation of the weak gradient of a field \ref simcomp_weak_grad
- User defined components \ref user-file_simcomps
- Fluid statistics simcomp, "fluid_stats", for more details see the [statistics guide](@ref statistics-guide)
- Computation of the spectral error indicator \ref simcomp_speri

## Controling execution and file output
Each simulation component is, by default, executed once per time step to perform
Expand Down Expand Up @@ -63,12 +64,25 @@ vorticity fields will be added to the main `.fld` file.

### vorticity {#simcomp_vorticity}
Computes the vorticity field an stores in the field registry as `omega_x`,
`omega_y` and `omega_z`.
`omega_y` and `omega_z`. By default, appends the 3 vorticity fields to the field files as
scalars. To output in a different `fld` series, use the `"output_filename"` parameter.

~~~~~~~~~~~~~~~{.json}
{
"type": "vorticity"
}
~~~~~~~~~~~~~~~

### lambda2 {#simcomp_lambda2}
Computes \f$ \lambda_2 \f$ for the velocity field and stores it in the normal output files as the first unused field.
This means that \f$ \lambda_2 \f$ can be found in the temperature field in then fld files if running without a scalar
and s1 if neko is run with one scalar.
and s1 if neko is run with one scalar. To output in a different `fld` series, use the `"output_filename"` parameter.

~~~~~~~~~~~~~~~{.json}
{
"type": "lambda2"
}
~~~~~~~~~~~~~~~

### probes {#simcomp_probes}
Probes selected solution fields at a list of points. This list of points can be
Expand Down Expand Up @@ -198,15 +212,15 @@ field to derivate is controlled by the `field` keyword and the direction by the
`direction` keyword. The simcomp will register the computed derivatives in the
registry as `d[field]_d[direction]`, where the values in the brackets
correspond to the choice of the user keywords. Supports writing the computed
fields to disk via the usual common keywords.
fields to disk via the usual common keywords. The resulting field will be
appended as a scalar to the field files. To output in a different `fld` series,
use the `"output_filename"` parameter.

~~~~~~~~~~~~~~~{.json}
{
"type": "derivative",
"field": "u",
"direction", "y",
"output_control" : "simulation_time",
"output_value" : 1.0
"direction": "y"
}
~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -247,3 +261,18 @@ writing the computed fields to disk via the usual common keywords.
"output_control" : "never"
}
~~~~~~~~~~~~~~~

### Spectral error indicator {#simcomp_speri}

Computes the spectral error indicator as developed by Mavriplis (1989) (https://doi.org/10.1007/978-3-663-13975-1_34).
This is an a posteriori error measure, based on the local properties of
the spectral solution. This method formally only gives an indication of the error.

The spectral error indicator is computed for the 3 velocity fields, resulting
in 3 additional fields appended to the field files.

~~~~~~~~~~~~~~~{.json}
{
"type": "spectral_error"
}
~~~~~~~~~~~~~~~
6 changes: 3 additions & 3 deletions src/.depends
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ sem/map_2d.o : sem/map_2d.f90 field/field.o io/fld_file_data.o comm/mpi_types.o
sem/dofmap.o : sem/dofmap.f90 mesh/hex.o mesh/quad.o mesh/element.o math/math.o device/device.o math/tensor.o math/fast3d.o common/utils.o config/num_types.o adt/tuple.o sem/space.o mesh/mesh.o config/neko_config.o
sem/coef.o : sem/coef.f90 device/device.o math/mxm_wrapper.o sem/bcknd/device/device_coef.o math/bcknd/device/device_math.o mesh/mesh.o math/math.o sem/space.o sem/dofmap.o config/num_types.o config/neko_config.o gs/gs_ops.o gs/gather_scatter.o
sem/cpr.o : sem/cpr.f90 sem/dofmap.o common/log.o math/mxm_wrapper.o math/tensor.o sem/coef.o mesh/mesh.o math/math.o sem/space.o field/field.o config/num_types.o config/neko_config.o gs/gather_scatter.o
sem/spectral_error_indicator.o : sem/spectral_error_indicator.f90 common/utils.o comm/comm.o device/device.o config/neko_config.o gs/gather_scatter.o math/bcknd/device/device_math.o math/tensor.o io/file.o math/math.o field/field_list.o sem/coef.o field/field.o config/num_types.o
common/time_interpolator.o : common/time_interpolator.f90 math/fast3d.o common/utils.o math/math.o math/bcknd/device/device_math.o config/neko_config.o field/field.o config/num_types.o
sem/interpolation.o : sem/interpolation.f90 sem/space.o math/bcknd/cpu/tensor_cpu.o math/tensor.o math/fast3d.o device/device.o config/num_types.o config/neko_config.o
sem/point_interpolator.o : sem/point_interpolator.f90 config/neko_config.o math/bcknd/device/device_math.o device/device.o common/utils.o math/fast3d.o math/math.o mesh/point.o config/num_types.o sem/space.o math/tensor.o
Expand Down Expand Up @@ -277,11 +276,12 @@ scalar/source_scalar.o : scalar/source_scalar.f90 math/bcknd/device/device_math.
simulation_components/simulation_component.o : simulation_components/simulation_component.f90 common/json_utils.o common/time_based_controller.o case.o config/num_types.o
simulation_components/simcomp_executor.o : simulation_components/simcomp_executor.f90 common/log.o common/utils.o case.o common/json_utils.o simulation_components/simulation_component.o config/num_types.o
simulation_components/vorticity.o : simulation_components/vorticity.f90 simulation_components/field_writer.o common/json_utils.o io/fld_file_output.o case.o math/operators.o field/field.o field/field_registry.o simulation_components/simulation_component.o config/num_types.o
simulation_components/spectral_error.o : simulation_components/spectral_error.f90 field/field_registry.o case.o common/json_utils.o simulation_components/simulation_component.o simulation_components/field_writer.o common/utils.o comm/comm.o device/device.o common/log.o config/neko_config.o gs/gather_scatter.o math/bcknd/device/device_math.o math/tensor.o io/file.o math/math.o field/field_list.o sem/coef.o field/field.o config/num_types.o
simulation_components/lambda2.o : simulation_components/lambda2.f90 device/device.o simulation_components/field_writer.o case.o math/operators.o field/field.o field/field_registry.o simulation_components/simulation_component.o config/num_types.o
simulation_components/weak_grad.o : simulation_components/weak_grad.f90 simulation_components/field_writer.o common/json_utils.o io/fld_file_output.o case.o math/operators.o field/field.o field/field_registry.o simulation_components/simulation_component.o config/num_types.o
simulation_components/derivative.o : simulation_components/derivative.f90 common/utils.o simulation_components/field_writer.o common/json_utils.o io/fld_file_output.o case.o math/operators.o field/field.o field/field_registry.o simulation_components/simulation_component.o config/num_types.o
simulation_components/les_simcomp.o : simulation_components/les_simcomp.f90 simulation_components/field_writer.o common/json_utils.o les/les_model.o case.o simulation_components/simulation_component.o config/num_types.o
simulation_components/simulation_component_fctry.o : simulation_components/simulation_component_fctry.f90 simulation_components/derivative.o simulation_components/weak_grad.o simulation_components/field_writer.o common/utils.o simulation_components/les_simcomp.o simulation_components/probes.o simulation_components/lambda2.o simulation_components/fluid_stats_simcomp.o simulation_components/force_torque.o simulation_components/vorticity.o simulation_components/simulation_component.o
simulation_components/simulation_component_fctry.o : simulation_components/simulation_component_fctry.f90 simulation_components/spectral_error.o simulation_components/derivative.o simulation_components/weak_grad.o simulation_components/field_writer.o common/utils.o simulation_components/les_simcomp.o simulation_components/probes.o simulation_components/lambda2.o simulation_components/fluid_stats_simcomp.o simulation_components/force_torque.o simulation_components/vorticity.o simulation_components/simulation_component.o
source_terms/source_term.o : source_terms/source_term.f90 field/field_list.o sem/coef.o config/num_types.o
source_terms/coriolis_source_term.o : source_terms/coriolis_source_term.f90 source_terms/bcknd/cpu/coriolis_source_term_cpu.o common/utils.o config/neko_config.o sem/coef.o source_terms/source_term.o common/json_utils.o field/field_list.o config/num_types.o
source_terms/bcknd/cpu/coriolis_source_term_cpu.o : source_terms/bcknd/cpu/coriolis_source_term_cpu.f90 field/field.o math/math.o field/field_list.o config/num_types.o
Expand Down Expand Up @@ -316,5 +316,5 @@ wall_models/wall_model.o : wall_models/wall_model.f90 common/log.o comm/comm.o m
wall_models/rough_log_law.o : wall_models/rough_log_law.f90 common/utils.o common/json_utils.o field/field_registry.o wall_models/wall_model.o config/neko_config.o sem/coef.o sem/dofmap.o config/num_types.o field/field.o
wall_models/spalding.o : wall_models/spalding.f90 common/utils.o common/log.o common/json_utils.o field/field_registry.o wall_models/wall_model.o config/neko_config.o sem/coef.o sem/dofmap.o config/num_types.o field/field.o
wall_models/wall_model_fctry.o : wall_models/wall_model_fctry.f90 common/json_utils.o common/utils.o wall_models/rough_log_law.o wall_models/spalding.o les/vreman.o wall_models/wall_model.o
neko.o : neko.f90 common/json_utils.o common/runtime_statistics.o bc/field_dirichlet_vector.o bc/field_dirichlet.o mesh/point_zone_registry.o mesh/point_zones/sphere_point_zone.o mesh/point_zones/box_point_zone.o mesh/point_zone.o sem/point_interpolator.o common/time_interpolator.o io/data_streamer.o simulation_components/simcomp_executor.o field/scratch_registry.o field/field_registry.o qoi/drag_torque.o common/system.o sem/spectral_error_indicator.o simulation_components/probes.o simulation_components/simulation_component.o math/tensor.o math/matrix.o math/vector.o scalar/scalar_user_source_term.o fluid/fluid_user_source_term.o field/field_list.o fluid/fluid_stats.o sem/cpr.o sem/map_2d.o sem/map_1d.o math/bcknd/device/device_math.o device/device.o common/jobctrl.o common/signal.o common/user_intf.o common/projection.o math/mathops.o math/operators.o simulation.o io/output.o io/output_controller.o case.o config/neko_config.o comm/parmetis.o math/ax.o bc/dirichlet.o bc/wall.o bc/bc.o sem/coef.o gs/gather_scatter.o comm/mpi_types.o field/field.o io/file.o common/global_interpolation.o math/mxm_wrapper.o io/format/map.o field/mesh_field.o mesh/point.o mesh/mesh.o adt/tuple.o adt/stack.o adt/uset.o adt/htable.o sem/space.o sem/dofmap.o sem/speclib.o math/math.o common/log.o common/utils.o comm/comm.o config/num_types.o
neko.o : neko.f90 common/json_utils.o common/runtime_statistics.o bc/field_dirichlet_vector.o bc/field_dirichlet.o mesh/point_zone_registry.o mesh/point_zones/sphere_point_zone.o mesh/point_zones/box_point_zone.o mesh/point_zone.o sem/point_interpolator.o common/time_interpolator.o io/data_streamer.o simulation_components/simcomp_executor.o field/scratch_registry.o field/field_registry.o qoi/drag_torque.o common/system.o simulation_components/spectral_error.o simulation_components/probes.o simulation_components/simulation_component.o math/tensor.o math/matrix.o math/vector.o scalar/scalar_user_source_term.o fluid/fluid_user_source_term.o field/field_list.o fluid/fluid_stats.o sem/cpr.o sem/map_2d.o sem/map_1d.o math/bcknd/device/device_math.o device/device.o common/jobctrl.o common/signal.o common/user_intf.o common/projection.o math/mathops.o math/operators.o simulation.o io/output.o io/output_controller.o case.o config/neko_config.o comm/parmetis.o math/ax.o bc/dirichlet.o bc/wall.o bc/bc.o sem/coef.o gs/gather_scatter.o comm/mpi_types.o field/field.o io/file.o common/global_interpolation.o math/mxm_wrapper.o io/format/map.o field/mesh_field.o mesh/point.o mesh/mesh.o adt/tuple.o adt/stack.o adt/uset.o adt/htable.o sem/space.o sem/dofmap.o sem/speclib.o math/math.o common/log.o common/utils.o comm/comm.o config/num_types.o
driver.o : driver.f90 neko.o
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ neko_fortran_SOURCES = \
sem/dofmap.f90\
sem/coef.f90\
sem/cpr.f90\
sem/spectral_error_indicator.f90\
common/time_interpolator.f90\
sem/interpolation.f90\
sem/point_interpolator.f90\
Expand Down Expand Up @@ -280,6 +279,7 @@ neko_fortran_SOURCES = \
simulation_components/simulation_component.f90\
simulation_components/simcomp_executor.f90\
simulation_components/vorticity.f90\
simulation_components/spectral_error.f90\
simulation_components/lambda2.f90\
simulation_components/weak_grad.f90\
simulation_components/derivative.f90\
Expand Down
2 changes: 1 addition & 1 deletion src/neko.f90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module neko
use simulation_component, only : simulation_component_t, &
simulation_component_wrapper_t
use probes, only : probes_t
use spectral_error_indicator
use spectral_error
use system, only : system_cpu_name, system_cpuid
use drag_torque, only : drag_torque_zone, drag_torque_facet, drag_torque_pt
use field_registry, only : neko_field_registry
Expand Down
8 changes: 6 additions & 2 deletions src/simulation_components/simulation_component_fctry.f90
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,18 @@
use field_writer, only : field_writer_t
use weak_grad, only : weak_grad_t
use derivative, only : derivative_t
use spectral_error, only: spectral_error_t

! List of all possible types created by the factory routine
character(len=20) :: SIMCOMPS_KNOWN_TYPES(7) = [character(len=20) :: &
character(len=20) :: SIMCOMPS_KNOWN_TYPES(8) = [character(len=20) :: &
"vorticity", &
"lambda2", &
"probes", &
"les_model", &
"field_writer", &
"fluid_stats", &
"force_torque"]
"force_torque", &
"spectral_error"]

contains

Expand Down Expand Up @@ -92,6 +94,8 @@ module subroutine simulation_component_factory(object, json, case)
allocate(force_torque_t::object)
else if (trim(type_name) .eq. "fluid_stats") then
allocate(fluid_stats_simcomp_t::object)
else if (trim(type_name) .eq. "spectral_error") then
allocate(spectral_error_t::object)
else
type_string = concat_string_array(SIMCOMPS_KNOWN_TYPES, &
NEW_LINE('A') // "- ", .true.)
Expand Down
Loading

0 comments on commit e32f35f

Please sign in to comment.