Skip to content

Commit

Permalink
Initial stab at linear elastic FFT solver Refs. idaholab#401
Browse files Browse the repository at this point in the history
To make this run, explicit instantiation of

auto RankFourTensorTempl<T>::operator*(const Tensor<T2> & b) const

is required in MOOSE's RankFourTensor.h
  • Loading branch information
recuero committed Aug 3, 2020
1 parent c19bd79 commit c0a274f
Show file tree
Hide file tree
Showing 5 changed files with 559 additions and 1 deletion.
142 changes: 142 additions & 0 deletions examples/spectralLinearElastic2Materials.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
[Mesh]
type = MyTRIMMesh
dim = 3
xmax = 10
ymax = 10
zmax = 10
nx = 64
ny = 64
nz = 64
[]

[Problem]
type = FFTProblem
[]

[AuxVariables]
[./epsilon_aux_var]
order = CONSTANT
family = MONOMIAL
[../]

[./stress_aux_var]
order = CONSTANT
family = MONOMIAL
[../]

[./elastic_aux_var]
order = CONSTANT
family = MONOMIAL
[../]

[./index_buffer_aux_var]
order = CONSTANT
family = MONOMIAL
[../]

[./stiffness_ratio_aux]
order = CONSTANT
family = MONOMIAL
[./InitialCondition]
type = SmoothSuperellipsoidIC
x1 = 5
y1 = 5
z1 = 5
a = 2
b = 2
c = 2
n = 2
int_width = 0
invalue = 1
outvalue = 2.0
[../]
[../]
[]

[UserObjects]
# Buffers
[./epsilon]
type = RankTwoTensorFFTWBuffer
[../]
[./stress]
type = RankTwoTensorFFTWBuffer
[../]
# Reciprocal space: Elastic tensor
[./gamma]
type = RankFourTensorFFTWBuffer
[../]
[./elastic]
type = RankFourTensorFFTWBuffer
[../]
[./stiffness_ratio]
type = RealFFTWBuffer
moose_variable = stiffness_ratio_aux
[]
[./index_buffer]
type = RealFFTWBuffer
[]
[]

[AuxKernels]
[./epsilon_aux]
type = FFTBufferAux
variable = epsilon_aux_var
fft_buffer = epsilon
execute_on = final
component = '0 1'
[../]

[./stress_aux]
type = FFTBufferAux
variable = stress_aux_var
fft_buffer = stress
execute_on = final
component = '0 1'
[../]

[./stiffness_aux]
type = FFTBufferAux
variable = stiffness_ratio_aux
fft_buffer = stiffness_ratio
execute_on = final
[../]

[./index_aux]
type = FFTBufferAux
variable = index_buffer_aux_var
fft_buffer = index_buffer
execute_on = final
[../]
[]

[Executioner]
type = SpectralExecutionerLinearElastic

time_step = 1.0
number_steps = 150
initial_shear_strain = 0.01
young_modulus = 1e4
poisson_ratio = 0.3

[]

[VectorPostprocessors]
[./linevalue]
type = LineValueSampler
variable = 'stress_aux_var'
start_point = '0 0 0'
end_point = '9.9999999999 0 0'
num_points = 101
sort_by = x
execute_on = final
[../]
[]

[Outputs]
exodus = true
execute_on = 'INITIAL FINAL'
perf_graph = true
[./comp]
type = CSV
[../]
[]
88 changes: 88 additions & 0 deletions include/executioners/SpectralExecutionerLinearElastic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**********************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
/* */
/* Copyright 2017 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/**********************************************************************/

#pragma once

#include "SpectralExecutionerBase.h"

// System includes
#include <string>

// Forward declarations
class InputParameters;

/**
* Executioner for diffusion spectral solver.
*/
class SpectralExecutionerLinearElastic : public SpectralExecutionerBase
{
public:
static InputParameters validParams();

SpectralExecutionerLinearElastic(const InputParameters & parameters);
/**
* Algorithm for incremental solution using forward/backward transforms of Green's function.
*/
virtual void execute() final;

protected:
/// Time step
const Real _dt;

/// Number of steps
const unsigned int _nsteps;

/// First parameter
const Real _young_modulus;

/// Second parameter
const Real _poisson_ratio;

/// Current time
Real _t_current;

/// Initial homogeneous shear deformation
const Real _initial_shear_strain;

/// Initial strain tensor
RankTwoTensor _initial_strain_tensor;

private:
/**
* Helper function to get the diffusion equation Green's function corresponding to one time step.
*/
void getGreensFunction(FFTBufferBase<RankFourTensor> & gamma_hat,
FFTBufferBase<Real> & ratio_buffer);

/**
* Helper function to get the initial stress from strain and tensor of elastic coefficients.
*/
FFTBufferBase<RankTwoTensor> & getInitialStress(FFTBufferBase<RankTwoTensor> & epsilon_buffer,
FFTBufferBase<RankFourTensor> & elastic_buffer);
/**
* Helper to populate initial strain buffer
*/
void populateEpsilonBuffer(FFTBufferBase<RankTwoTensor> & epsilon_buffer);

/**
* Advance Fourier epsilon to next iteration
*/
void advanceReciprocalEpsilon(FFTBufferBase<RankTwoTensor> & epsilon_buffer,
FFTBufferBase<RankTwoTensor> & stress_buffer,
const FFTBufferBase<RankFourTensor> & gamma_hat);
/**
* Update sigma in real space for this iteration
*/
void updateRealSigma(FFTBufferBase<RankTwoTensor> & epsilon_buffer,
FFTBufferBase<RankTwoTensor> & stress_buffer,
FFTBufferBase<RankFourTensor> & elastic_tensor);

void filloutElasticTensor(const FFTBufferBase<Real> & ratio_buffer,
FFTBufferBase<Real> & index_buffer,
FFTBufferBase<RankFourTensor> & elastic_tensor_buffer);
};
Loading

0 comments on commit c0a274f

Please sign in to comment.