Skip to content

Commit a828c10

Browse files
committed
Clean up and rearrange
1 parent 213b050 commit a828c10

File tree

5 files changed

+121
-74
lines changed

5 files changed

+121
-74
lines changed

cookbooks/CPO_induced_anisotropic_viscosity/doc/CPO_induced_anisotropic_viscosity.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
```{tags}
2+
category:cookbook
3+
feature:3d
4+
feature:cartesian
5+
feature:modular-equations
6+
feature:compositional-fields
7+
feature:particles
8+
19
(sec:cookbooks:CPO_induced_anisotropic_viscosity)=
210
# CPO induced anisotropic viscosity
311

cookbooks/CPO_induced_anisotropic_viscosity/plugin/anisotropic_stress.cc

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,14 @@ namespace aspect
113113
ASPECT_REGISTER_VISUALIZATION_POSTPROCESSOR(AnisotropicStress,
114114
"Anisotropic stress",
115115
"A visualization output object that generates output "
116-
"for the 6 (in 3d) components of the shear stress "
117-
"tensor, i.e., for the components of the tensor "
118-
"$-2\\eta\\varepsilon(\\mathbf u)$ "
119-
"in the incompressible case and "
120-
"$-2\\eta\\left[\\varepsilon(\\mathbf u)-"
121-
"\\tfrac 13(\\textrm{tr}\\;\\varepsilon(\\mathbf u))\\mathbf I\\right]$ "
122-
"in the compressible case. If elasticity is used, the "
123-
"elastic contribution is being accounted for. The shear "
124-
"stress differs from the full stress tensor "
125-
"by the absence of the pressure. Note that the convention "
126-
"of positive compressive stress is followed. ")
116+
"for the 6 (in 3d) components of the anisotropic stress "
117+
"tensor. The anisotropic stress is defined as $2 \eta "
118+
"(\varepsilon(\mathbf u) - \tfrac 13 \textrm{trace}\ "
119+
"\varepsilon(\mathbf u) \mathbf 1) = 2\eta (\varepsilon(\mathbf u) - "
120+
"\frac 13 (\nabla \cdot \mathbf u) \mathbf I)$ * stress_strain_directors, and differs from the "
121+
"full stress by the absence of the pressure. The second term in the "
122+
"difference is zero if the model is incompressible. "
123+
"If elasticity is used, the elastic contribution is being accounted for. ")
127124
}
128125
}
129126
}

cookbooks/CPO_induced_anisotropic_viscosity/plugin/cpo_induced_anisotropic_viscosity.cc

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -787,42 +787,6 @@ namespace aspect
787787

788788

789789

790-
791-
792-
793-
template <int dim>
794-
void
795-
CPO_AV_3D<dim>::parse_parameters (ParameterHandler &prm)
796-
{
797-
prm.enter_subsection("Material model");
798-
{
799-
prm.enter_subsection("CPO-induced Anisotropic Viscosity");
800-
{
801-
802-
equation_of_state.parse_parameters (prm);
803-
eta = prm.get_double("Reference viscosity");
804-
min_strain_rate = prm.get_double("Minimum strain rate");
805-
grain_size = prm.get_double("Grain size");
806-
CnI_F = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for F")));
807-
CnI_G = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for G")));
808-
CnI_H = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for H")));
809-
CnI_L = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for L")));
810-
CnI_M = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for M")));
811-
CnI_N = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for N")));
812-
compositional_delta_rho = prm.get_double ("Density differential for compositional field 1");
813-
}
814-
prm.leave_subsection();
815-
}
816-
prm.leave_subsection();
817-
818-
819-
820-
// Declare dependence
821-
this->model_dependence.density = NonlinearDependence::compositional_fields;
822-
}
823-
824-
825-
826790
template <int dim>
827791
void
828792
CPO_AV_3D<dim>::declare_parameters (ParameterHandler &prm)
@@ -880,6 +844,38 @@ namespace aspect
880844

881845

882846

847+
template <int dim>
848+
void
849+
CPO_AV_3D<dim>::parse_parameters (ParameterHandler &prm)
850+
{
851+
prm.enter_subsection("Material model");
852+
{
853+
prm.enter_subsection("CPO-induced Anisotropic Viscosity");
854+
{
855+
856+
equation_of_state.parse_parameters (prm);
857+
eta = prm.get_double("Reference viscosity");
858+
min_strain_rate = prm.get_double("Minimum strain rate");
859+
grain_size = prm.get_double("Grain size");
860+
CnI_F = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for F")));
861+
CnI_G = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for G")));
862+
CnI_H = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for H")));
863+
CnI_L = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for L")));
864+
CnI_M = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for M")));
865+
CnI_N = dealii::Utilities::string_to_double(dealii::Utilities::split_string_list(prm.get("Coefficients and intercept for N")));
866+
}
867+
prm.leave_subsection();
868+
}
869+
prm.leave_subsection();
870+
871+
872+
873+
// Declare dependence
874+
this->model_dependence.density = NonlinearDependence::compositional_fields;
875+
}
876+
877+
878+
883879
template <int dim>
884880
void
885881
CPO_AV_3D<dim>::create_additional_named_outputs(MaterialModel::MaterialModelOutputs<dim> &out) const

cookbooks/CPO_induced_anisotropic_viscosity/plugin/cpo_induced_anisotropic_viscosity.h

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,56 @@ namespace aspect
7575
{
7676
public:
7777
void initialize() override;
78+
7879
void evaluate (const MaterialModel::MaterialModelInputs<dim> &in,
7980
MaterialModel::MaterialModelOutputs<dim> &out) const override;
81+
82+
bool is_compressible () const override;
83+
8084
static void declare_parameters (ParameterHandler &prm);
85+
8186
void parse_parameters (ParameterHandler &prm) override;
82-
bool is_compressible () const override;
87+
8388
void create_additional_named_outputs(MaterialModel::MaterialModelOutputs<dim> &out) const override;
89+
8490
private:
85-
double eta; //reference viscosity
91+
92+
/**
93+
* Reference viscosity.
94+
*/
95+
double eta;
96+
8697
/**
8798
* Defining a minimum strain rate stabilizes the viscosity calculation,
8899
* which involves a division by the strain rate. Units: 1/s.
89100
*/
90101
double min_strain_rate;
102+
103+
/**
104+
* These are arrays that store eigenvalues of the olivine textures in a, b, and c axis, and
105+
* the olivine texture represented by Euler angles. For more details, please refer to the
106+
* cpo_bingham_average particle property. To use the anisotropic viscosity plugin in this
107+
* cookbook, the CPO Bingham Average particle property must be included and Use rotation matrix
108+
* must be set to false. The resulting arrays are:
109+
* cpo_bingham_avg_a = [phi, eigenvalue 1 for a-axis, eigenvalue 2 for a-axis, eigenvalue 3 for a-axis]
110+
* cpo_bingham_avg_b = [phi, eigenvalue 1 for b-axis, eigenvalue 2 for b-axis, eigenvalue 3 for b-axis]
111+
* cpo_bingham_avg_c = [phi, eigenvalue 1 for c-axis, eigenvalue 2 for c-axis, eigenvalue 3 for c-axis]
112+
* They are used in computing rotation matrix with regards to the CPO reference frame, and
113+
* the anisotropic Hill coefficients FGHLMN.
114+
*/
91115
std::vector<double> cpo_bingham_avg_a, cpo_bingham_avg_b, cpo_bingham_avg_c;
92-
double grain_size;
116+
117+
/**
118+
* These are arrays that store coefficients used to compute the anisotropic Hill coefficients FGHLMN from
119+
* a certain olivine texture represented with the eigenvalues of its a-, b-, and c-axis. Each array therefore contatains
120+
* 9 coefficients and 1 constant. This empirical relationship is found using linear regression.
121+
*/
93122
std::vector<double> CnI_F, CnI_G, CnI_H, CnI_L, CnI_M, CnI_N;
94-
double compositional_delta_rho;
95123

96-
unsigned int n_grains;
124+
double grain_size;
125+
97126
EquationOfState::LinearizedIncompressible<dim> equation_of_state;
127+
98128
void set_assemblers(const SimulatorAccess<dim> &,
99129
Assemblers::Manager<dim> &assemblers) const;
100130

cookbooks/CPO_induced_anisotropic_viscosity/shearbox_cpo_av.prm

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
#This cookbook demonstrate how CPO induced anisotropic viscosity evolves during simple shearing. The model consist of 1 cell and one particle in the middle. The particle includes 500 grains with initially random orientations (isotropic texture), which is then evolves into a CPO aligned with the shear direction
1+
# This cookbook demonstrates how CPO induced anisotropic viscosity evolves during
2+
# simple shearing. The model consists of 1 cell and one particle in the middle.
3+
# The particle includes 500 grains with initially random orientations (isotropic
4+
# texture), which then evolves into a CPO aligned with the shear direction.
5+
26
set Additional shared libraries = ./plugin/libCPO_induced_anisotropic_viscosity.debug.so
3-
set CFL number = 0.1 ##Annotation CFL number
7+
set CFL number = 0.
48
set Timing output frequency = 10000
59
set Dimension = 3
610
set Pressure normalization = surface
711
set Surface pressure = 0
812
set Nonlinear solver scheme = single Advection, single Stokes
913
set End time = 0.1
10-
# set Resume computation = true
1114
set Use years instead of seconds = false
12-
set Output directory = output_Shearbox_CPO_AV_1ts
15+
set Output directory = output_Shearbox_CPO_AV
1316

1417
subsection Initial composition model
1518
set List of model names = function
@@ -68,7 +71,10 @@ subsection Initial temperature model
6871
set Model name = function
6972

7073
subsection Function
71-
set Function expression = 1600 ## Annotation: Temperature function (note: anisotropic viscosity is not considered at T<1000K)
74+
75+
# Temperature function (anisotropic viscosity in this material is disabled at T<1000K)
76+
77+
set Function expression = 1600
7278
end
7379
end
7480

@@ -87,10 +93,11 @@ subsection Boundary temperature model
8793
end
8894

8995
subsection Boundary velocity model
90-
set Prescribed velocity boundary indicators = top:function, bottom:function, left:function, right:function ##, , front:function, back:function
96+
set Prescribed velocity boundary indicators = top:function, bottom:function, left:function, right:function
97+
9198
subsection Function
9299
set Variable names = x,y,z,t
93-
set Function expression = (z-0.5);0;0 ## 13, top
100+
set Function expression = (z-0.5);0;0
94101
end
95102
end
96103

@@ -99,81 +106,90 @@ subsection Material model
99106
set Model name = CPO-induced Anisotropic Viscosity
100107

101108
subsection CPO-induced Anisotropic Viscosity
102-
set Reference viscosity = 1e9 # so that the initial stress is 0.3 MPa
109+
# Chosen so that the initial stress is 0.3 MPa
110+
111+
set Reference viscosity = 1e9
103112
end
104113
end
105114

106115
subsection Mesh refinement
107116
set Initial global refinement = 0
108117
set Initial adaptive refinement = 0
109-
set Time steps between mesh refinement = 10000
118+
# For this single cell shear box test, there is no need for AMR
119+
120+
set Time steps between mesh refinement = 0
110121
end
111122

112123
subsection Postprocess
113124
set List of postprocessors = velocity statistics, composition statistics, memory statistics, visualization, particles, crystal preferred orientation
114125

115126
subsection Visualization
116127
set Time between graphical output = 0.1
117-
set List of output variables = material properties, strain rate, named additional outputs, shear stress, stress
128+
set List of output variables = material properties, strain rate, named additional outputs, shear stress, stress
118129

119130
subsection Material properties
120131
set List of material properties = density, viscosity
121132
end
122133
end
134+
123135
subsection Particles
124136
set Time between data output = 0.1
125137
set Data output format = gnuplot, vtu
126138
set Exclude output properties = rotation_matrix, volume fraction
127139
end
140+
128141
subsection Crystal Preferred Orientation
129142
set Time between data output = 0.1
130143
set Write in background thread = true
131144
set Compress cpo data files = false
132-
set Write out raw cpo data = mineral 0: volume fraction, mineral 0: Euler angles #, mineral 1: volume fraction, mineral 1: Euler angles
133-
set Write out draw volume weighted cpo data = mineral 0: volume fraction, mineral 0: Euler angles #, mineral 1: volume fraction, mineral 1: Euler angles
145+
set Write out raw cpo data = mineral 0: volume fraction, mineral 0: Euler angles
146+
set Write out draw volume weighted cpo data = mineral 0: volume fraction, mineral 0: Euler angles
134147
end
135148
end
136149

137150
subsection Particles
138-
set List of particle properties = integrated strain, integrated strain invariant, velocity, pT path, strain rate, crystal preferred orientation, cpo bingham average, cpo elastic tensor #integrated strain, integrated strain invariant, velocity, pT path, strain rate, velocity gradient, stress, crystal preferred orientation, cpo bingham average, cpo bingham average euler angle, cpo elastic tensor
151+
set List of particle properties = integrated strain, integrated strain invariant, velocity, pT path, strain rate, crystal preferred orientation, cpo bingham average, cpo elastic tensor
139152
set Allow cells without particles = false
140153
set Interpolation scheme = nearest neighbor
141154
set Particle generator name = ascii file
155+
142156
subsection Generator
143157
subsection Ascii file
144158
set Data directory = ./
145159
set Data file name = particle_one.dat
146160
end
147161
end
162+
148163
subsection Crystal Preferred Orientation
164+
149165
subsection Initial grains
150166
set Minerals = Olivine: A-fabric
151167
set Volume fractions minerals = 1.0
152168
end
153-
set Number of grains per particle = 1000 ## Annotation grain count
154-
set Property advection method = Backward Euler ## Annotation Property advection method
169+
170+
set Number of grains per particle = 1000
171+
set Property advection method = Backward Euler
155172
set Property advection tolerance = 1e-15
156173
set CPO derivatives algorithm = D-Rex 2004
174+
157175
subsection D-Rex 2004
158-
set Mobility = 10 ## Annotation CPO Mobility
176+
set Mobility = 10
159177
set Stress exponents = 3.5
160178
set Exponents p = 1.5
161-
set Threshold GBS = 0.3 ## Annotation TGBS
179+
set Threshold GBS = 0.3
162180
end
163181
end
182+
164183
subsection CPO Bingham Average
165184
set Random number seed = 200
166185
set Use rotation matrix = false
167186
end
168187
end
169188

170189
subsection Solver parameters
171-
set Temperature solver tolerance = 1e-10
190+
# set Temperature solver tolerance = 1e-10
191+
172192
subsection Stokes solver parameters
173193
set Stokes solver type = block AMG
174194
end
175195
end
176-
177-
# subsection Checkpointing
178-
# set Steps between checkpoint = 50
179-
# end

0 commit comments

Comments
 (0)