Skip to content

Commit

Permalink
Oscillating mesh motion (#1329)
Browse files Browse the repository at this point in the history
* oscillating kernel: compiling with pieces in place

* add bichromatic, use get_required as needed

* formatting etc

* hook for parsing, avoid dividing by 0

* running reg test

* tweaks to reg test input + norm
  • Loading branch information
mbkuhn authored Dec 9, 2024
1 parent e0e9f0f commit 138a324
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 0 deletions.
58 changes: 58 additions & 0 deletions include/mesh_motion/MotionOscillationKernel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#ifndef MOTIONOscillationKERNEL_H
#define MOTIONOscillationKERNEL_H

#include "NgpMotion.h"

namespace sierra {
namespace nalu {

class MotionOscillationKernel : public NgpMotionKernel<MotionOscillationKernel>
{
public:
MotionOscillationKernel(const YAML::Node&);

MotionOscillationKernel() = default;

virtual ~MotionOscillationKernel() = default;

/** Function to compute motion-specific transformation matrix
*
* @param[in] time Current time
* @param[in] xyz Coordinates
* @return Transformation matrix
*/
KOKKOS_FUNCTION
virtual mm::TransMatType
build_transformation(const double& time, const mm::ThreeDVecType& xyz);

/** Function to compute motion-specific velocity
*
* @param[in] time Current time
* @param[in] compTrans Transformation matrix
* including all motions
* @param[in] mxyz Model coordinates
* @param[in] cxyz Transformed coordinates
* @return Velocity vector associated with coordinates
*/
KOKKOS_FUNCTION
virtual mm::ThreeDVecType compute_velocity(
const double& time,
const mm::TransMatType& compTrans,
const mm::ThreeDVecType& mxyz,
const mm::ThreeDVecType& cxyz);

private:
void load(const YAML::Node&);

mm::ThreeDVecType direction_{0.0, 0.0, 1.0};

double period_{0.0};
double amplitude_{0.0};
double period_2nd_{0.0};
double amplitude_2nd_{0.0};
};

} // namespace nalu
} // namespace sierra

#endif /* MOTIONOscillationKERNEL_H */
1 change: 1 addition & 0 deletions reg_tests/CTestList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ if(NOT ENABLE_CUDA AND NOT ENABLE_ROCM)

if (ENABLE_TIOGA AND ENABLE_HYPRE)
add_test_r(oversetRotCylNGPHypre 2)
add_test_r(oversetOscCylNGPHypre 2)
if (ENABLE_TRILINOS_SOLVERS)
add_test_r(oversetRotCylinderHypre 2)
add_test_r(oversetRotCylMultiRealm 2)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
0.1032040329331224 1 0.003
0.03111868191476334 2 0.006
0.03802955274794819 3 0.009
0.04192027057100021 4 0.012
0.0328423923794225 5 0.015
0.01992606763318192 6 0.018
0.00798146926560496 7 0.021
0.003208226735370011 8 0.024
0.006417074116005693 9 0.027
0.006891712098202526 10 0.03
218 changes: 218 additions & 0 deletions reg_tests/test_files/oversetOscCylNGPHypre/oversetOscCylNGPHypre.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# -*- mode: yaml -*-

Simulations:
- name: sim1
time_integrator: ti_1
optimizer: opt1

# Hypre memory and other configurations
hypre_config:
memory_pool_mbs: 1500
use_vendor_spgemm: no
use_vendor_spmv: no
use_vendor_sptrans: no

linear_solvers:

- name: solve_mom
type: hypre
method: hypre_gmres
preconditioner: boomerAMG
tolerance: 1e-12
max_iterations: 200
kspace: 15
output_level: 0
segregated_solver: yes
write_matrix_files: no
simple_hypre_matrix_assemble: no
dump_hypre_matrix_stats: no
recompute_preconditioner_frequency: 1
reuse_linear_system: yes
write_preassembly_matrix_files: no

# File containing hypre specific configuration options
hypre_cfg_file: ../../hypre_settings/hypre_blade_resolved.yaml
# YAML node used for this linear solver
hypre_cfg_node: hypre_simple_precon

- name: solve_elliptic
type: hypre
method: hypre_gmres
preconditioner: boomerAMG
tolerance: 1e-12
max_iterations: 200
kspace: 75
output_level: 0
write_matrix_files: no
simple_hypre_matrix_assemble: no
dump_hypre_matrix_stats: no
recompute_preconditioner_frequency: 1
reuse_linear_system: yes
write_preassembly_matrix_files: no

# File containing hypre specific configuration options
hypre_cfg_file: ../../hypre_settings/hypre_blade_resolved.yaml
# YAML node used for this linear solver
hypre_cfg_node: hypre_elliptic

realms:

- name: realm_1
mesh: ../../mesh/oversetCylinder.g
use_edges: yes
automatic_decomposition_type: rcb

equation_systems:
name: theEqSys
max_iterations: 2
decoupled_overset_solve: yes

solver_system_specification:
velocity: solve_mom
pressure: solve_elliptic

systems:

- LowMachEOM:
name: myLowMach
max_iterations: 1
convergence_tolerance: 1e-7

initial_conditions:

- constant: ic_1
target_name:
- Unspecified-2-HEX
- Unspecified-3-HEX
value:
pressure: 0.0
velocity: [1.0,0.0,0.0]

material_properties:
target_name:
- Unspecified-2-HEX
- Unspecified-3-HEX
specifications:
- name: density
type: constant
value: 1.00

- name: viscosity
type: constant
value: 0.005

boundary_conditions:

- inflow_boundary_condition: bc_1
target_name: inlet
inflow_user_data:
velocity: [1.0,0.0,0.0]
pressure: 0.0

- open_boundary_condition: bc_2
target_name: outlet
open_user_data:
pressure: 0.0
velocity: [0.0,0.0,0.0]

- symmetry_boundary_condition: bc_3
target_name: top
symmetry_user_data:

- symmetry_boundary_condition: bc_4
target_name: bottom
symmetry_user_data:

- wall_boundary_condition: bc_5
target_name: wall
wall_user_data:
user_function_name:
velocity: wind_energy
user_function_string_parameters:
velocity: [interior]

- symmetry_boundary_condition: bc_6
target_name: side11
symmetry_user_data:

- symmetry_boundary_condition: bc_7
target_name: side12
symmetry_user_data:

- symmetry_boundary_condition: bc_8
target_name: side21
symmetry_user_data:

- symmetry_boundary_condition: bc_9
target_name: side22
symmetry_user_data:

- overset_boundary_condition: bc_overset
overset_connectivity_type: tioga
overset_user_data:
tioga_options:
symmetry_direction: 2
set_resolutions: yes
mesh_group:
- overset_name: interior
mesh_parts: [ Unspecified-2-HEX ]
wall_parts: [ wall ]
ovset_parts: [ overset1 ]

- overset_name: wake
mesh_parts: [ Unspecified-3-HEX]

mesh_motion:
- name: interior
mesh_parts: [ Unspecified-2-HEX ]
motion:
- type: oscillation
period: 1.25
amplitude: 1.5
direction: [0.0, 0.0, 1.0]

solution_options:
name: myOptions

options:
- hybrid_factor:
velocity: 1.0

- limiter:
pressure: no
velocity: no

- projected_nodal_gradient:
pressure: element
velocity: element

restart:
restart_data_base_name: rst/cyl.rst
restart_frequency: 100
restart_start: 100

output:
output_data_base_name: out/cyl.e
output_frequency: 10
output_node_set: no
output_variables:
- velocity
- pressure
- dpdx
- mesh_displacement
- iblank
- iblank_cell


Time_Integrators:
- StandardTimeIntegrator:
name: ti_1
start_time: 0
termination_step_count: 10
time_step: 0.003
time_stepping_type: fixed
time_step_count: 0
second_order_accuracy: yes

realms:
- realm_1
1 change: 1 addition & 0 deletions src/mesh_motion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_sources(nalu PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/MotionRotationKernel.C
${CMAKE_CURRENT_SOURCE_DIR}/MotionScalingKernel.C
${CMAKE_CURRENT_SOURCE_DIR}/MotionTranslationKernel.C
${CMAKE_CURRENT_SOURCE_DIR}/MotionOscillationKernel.C
${CMAKE_CURRENT_SOURCE_DIR}/MotionWavesKernel.C
${CMAKE_CURRENT_SOURCE_DIR}/TurbineSurrogateKernel.C
)
3 changes: 3 additions & 0 deletions src/mesh_motion/FrameBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "mesh_motion/MotionScalingKernel.h"
#include "mesh_motion/MotionRotationKernel.h"
#include "mesh_motion/MotionTranslationKernel.h"
#include "mesh_motion/MotionOscillationKernel.h"
#include "mesh_motion/TurbineSurrogateKernel.h"
#include "mesh_motion/MotionWavesKernel.h"
#include "NaluParsing.h"
Expand Down Expand Up @@ -70,6 +71,8 @@ FrameBase::load(const YAML::Node& node)
new MotionDeformingInteriorKernel(meta_, motion_def));
else if (type == "rotation")
motionKernels_[i].reset(new MotionRotationKernel(motion_def));
else if (type == "oscillation")
motionKernels_[i].reset(new MotionOscillationKernel(motion_def));
else if (type == "scaling")
motionKernels_[i].reset(new MotionScalingKernel(meta_, motion_def));
else if (type == "translation")
Expand Down
Loading

0 comments on commit 138a324

Please sign in to comment.