Skip to content

Commit

Permalink
Add new capabilities
Browse files Browse the repository at this point in the history
- module -T: added -per 1 for -morpho cube, added -ori ks (Kurdjumov-Sachs)
  and ti_beta2alpha (titanium).
- module -S: fixed -res* odfn.
- module -V: added -data{elt2d,elset2d}trs, added -step final, fixed -show*
  <result_component>, added -showmeshsliceelt1d.
  • Loading branch information
rquey committed May 15, 2024
1 parent 8b58d75 commit 7ad17ee
Show file tree
Hide file tree
Showing 48 changed files with 12,252 additions and 316 deletions.
8 changes: 6 additions & 2 deletions VERSIONS
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
New in 4.8.3-6 (15 May 2024):
- module -V: added -showmeshsliceelt1d.
New in 4.9.0 (15 May 2024):
- module -T: added -per 1 for -morpho cube, added -ori ks (Kurdjumov-Sachs)
and ti_beta2alpha (titanium).
- module -S: fixed -res* odfn.
- module -V: added -data{elt2d,elset2d}trs, added -step final, fixed -show*
<result_component>, added -showmeshsliceelt1d.

New in 4.8.2 (27 Mar 2024):
- module -T: added -transform "cut(cube)", added -morphooptiini ori and id,
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import sphinx_rtd_theme

project = u'Neper'
version = u'4.8.3-6'
release = u'4.8.3-6'
version = u'4.9.0'
release = u'4.9.0'
author = u'Romain Quey'
copyright = u'Romain Quey'
language = 'en'
Expand Down
6 changes: 5 additions & 1 deletion doc/neper_t.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ These options can be used to set the cell morphology.

- :data:`<ori_definition>` can be:

- :data:`file(<file_name>[,des=<descriptor>])`: discrete orientations to be read from a :ref:`data_file` written using a specific descriptor (see :ref:`rotations_and_orientations`, default :data:`rodrigues`).
- :data:`file(<file_name>[,des=<descriptor>])`: discrete orientations to be read from a :ref:`data_file` written using a specific descriptor (see :ref:`rotations_and_orientations`, default :data:`rodrigues`). :option:`-ori` :data:`from_morpho` must also be used.

- :data:`<id_definition>` can be:

Expand Down Expand Up @@ -491,6 +491,10 @@ Crystal Orientation Options

- :data:`parent[:<distribution>]`: orientations inherited from the ones of the parent cells, with an optional continuous distribution about the nominal orientations (see below);

- :data:`ks[:<distribution>]`: orientations inherited from the ones of the parent cells using the Kurdjumov-Sachs (KS) orientation relationship (austenite--ferrite transformation), with an optional continuous distribution about the nominal orientations (see below);

- :data:`ti_beta2alpha[:<distribution>]`: orientations inherited from the ones of the parent cells using the :math:`\beta\rightarrow\alpha` transformation orientation relationship in titanium, with an optional continuous distribution about the nominal orientations (see below);

- :data:`file(<file_name>[,des=<descriptor>])`: discrete orientations to be read from a :ref:`data_file` written using a specific descriptor (see :ref:`rotations_and_orientations`, default :data:`rodrigues`).

- :data:`from_morpho`: discrete orientations read from :option:`-morphooptiini`:data:`ori`.
Expand Down
15 changes: 14 additions & 1 deletion doc/neper_v.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ When a simulation directory is loaded as input, it is possible to specify the si

Specify the simulation step(s), which can be:

- :data:`0`: initial state;
- :data:`0`: the initial state;
- :data:`final`: the final step;
- any step number;
- :data:`all`: all steps;
- a list of steps combined with :data:`,`; a range of values can also be specified using :data:`-`. An example is :data:`0-10,20` (for steps 0 to 10, and 20).
Expand Down Expand Up @@ -424,6 +425,18 @@ The following options enable the definition of the properties (color, size, etc.

**Default value**: :data:`palette` for integer values, :data:`viridis` for real values, and :data:`rodrigues` for crystal orientations.

.. index::
single: -dataelt2dtrs
single: -dataelset2dtrs

.. option:: -data{elt2d,elset2d}trs <transparency>

Specify the transparencies (values from 0 to 1), which can be:

- a real value;
- an expression based on the variables described in :ref:`mesh_keys`, such as :data:`x` or :data:`area`;
- :data:`file(<file_name>)`: individual values to load from a :ref:`data_file`.

.. option:: -data{elt,elset,node,elt{0-3}d,elset{0-3}d}scale <scale>

Specify the scale relative to the :data:`-data...col real` data, which can be:
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()

set(NEPER_VERSION \"4.8.3-6\")
set(NEPER_VERSION \"4.9.0\")
project(neper)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.1)
Expand Down
1 change: 1 addition & 0 deletions src/neper_t/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ add_library(neper_t
./net_tess/net_tess2.c
./net_tess/net_tess_cube/net_tess_cube1.c
./net_tess/net_tess_cube/net_tess_cube2.c
./net_tess/net_tess_cube/net_tess_cube3.c
./net_tess/net_tess_onecell/net_tess_onecell1.c
./net_tess/net_tess_lam/net_tess_lam1.c
./net_tess/net_tess_lam//net_tess_lam_seed/net_tess_lam_seed1.c
Expand Down
5 changes: 2 additions & 3 deletions src/neper_t/net_flatten/net_flatten1.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ net_flatten (struct MTESS MTess, struct TESS *Tess, struct TESS *pFTess)
net_mtess_flatten (MTess, Tess2, id, Tess2 + id);
}


neut_tess_tess (Tess2[1], pFTess);

if (Tess[1].CellCrySym)
ut_string_string (Tess[1].CellCrySym, &(*pFTess).CellCrySym);
if (Tess[MTess.TessQty].CellCrySym)
ut_string_string (Tess[MTess.TessQty].CellCrySym, &(*pFTess).CellCrySym);

(*pFTess).ScaleQty = MTess.LevelQty;
(*pFTess).ScaleCellId =
Expand Down
9 changes: 9 additions & 0 deletions src/neper_t/net_ori/net_ori1.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ net_ori (struct IN_T In, int level, struct MTESS MTess, struct TESS *Tess,
else if (!strncmp (parts[i], "odf", 3))
net_ori_odf ((*pSSet).Random, parts[i], OSets + i);

else if (!strncmp (parts[i], "parent", 6))
net_ori_parent (parts[i], SSet, dtess, dcell, OSets + i);

else if (!strncmp (parts[i], "ks", 2) || !strncmp (parts[i], "KS", 2))
net_ori_ks ((*pSSet).Random, parts[i], SSet, dtess, dcell, OSets + i);

else if (!strcmp (parts[i], "ti_beta2alpha"))
net_ori_ti_beta2alpha ((*pSSet).Random, parts[i], SSet, dtess, dcell, OSets + i);

else
net_ori_label (parts[i], SSet, dtess, dcell, OSets + i);

Expand Down
183 changes: 169 additions & 14 deletions src/neper_t/net_ori/net_ori2.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,39 +92,194 @@ net_ori_fiber (struct SEEDSET *SSet, int dtess, int dcell, long random,
}

void
net_ori_label (char *label, struct SEEDSET *SSet, int dtess, int dcell, struct OL_SET *pOSet)
net_ori_ks (long random, char *label, struct SEEDSET *SSet, int dtess, int dcell, struct OL_SET *pOSet)
{
unsigned int i;
int status, partqty;
int partqty;
double *q = ol_q_alloc ();
char **parts = NULL;
char *spread = NULL;
int status_parent, status_child;
double **X = ol_g_alloc ();
int n1;
double alpha_over_phi = 1.; // pow (2, 1. / 3);
double phi_over_alpha = 1. / alpha_over_phi;
double d = sqrt (6) * pow (phi_over_alpha, 3);
double *qX = ol_q_alloc ();
double *qtmp = ol_q_alloc ();
gsl_rng *r = NULL;

ut_list_break (label, NEUT_SEP_DEP, &parts, &partqty);

// After (Fortes, 1984)
if (strcmp (parts[0], "ks") && strcmp (parts[0], "KS"))
abort ();

// Checking crystal symmetries
status_parent = 0; // 1: warning, 2: error
status_child = 0; // 1: warning, 2: error
if (strcmp (SSet[dtess].crysym, "cubic") || strcmp ((*pOSet).crysym, "cubic"))
{
if (strcmp (SSet[dtess].crysym, "cubic"))
status_parent = (!strcmp (SSet[dtess].crysym, "triclinic")) ? 1 : 2;

if (strcmp ((*pOSet).crysym, "cubic"))
status_child = (!strcmp (SSet[dtess].crysym, "triclinic")) ? 1 : 2;
}

if (ut_num_max (status_parent, status_child) == 1)
ut_print_message (1, 2, "KS transformation assumes cubic parent and child phases.\n");
else if (ut_num_max (status_parent, status_child) == 2)
ut_print_message (2, 2, "KS transformation requires cubic parent and child phases.\n");

ut_array_1d_set_3 (X[0], 2 * d + 1, -1, d - 2);
ut_array_1d_set_3 (X[1], 1, 2 * d - 1, -d - 2);
ut_array_1d_set_3 (X[2], d - 2, d + 2, 4);
ut_array_2d_scale (X, 3, 3, 1. / pow (6 * d, 2. / 3));

ol_g_q (X, qX);

r = gsl_rng_alloc (gsl_rng_ranlxd2);
gsl_rng_set (r, random - 1);

ut_print_message (0, 2, "Applying KS...\n");

for (i = 0; i < (*pOSet).size; i++)
{
n1 = 1 + gsl_rng_uniform_int (r, 24);
ol_q_crysym (SSet[dtess].SeedOri[dcell], "cubic", n1, qtmp);
ol_q_q_q_cur (qtmp, qX, (*pOSet).q[i]);
}

ol_q_free (qX);
ol_q_free (qtmp);
gsl_rng_free (r);
ol_g_free (X);

if (partqty == 2)
ut_string_string (parts[1], &spread);
net_ori_addspread (parts[1], SSet[dtess].Random + dcell, pOSet);

status = 0;
if (!strcmp (parts[0], "parent"))
ol_q_memcpy (SSet[dtess].SeedOri[dcell], q);
else
status = ol_label_q (parts[0], q);
ol_q_free (q);
ut_free_2d_char (&parts, partqty);

if (!status)
return;
}

void
net_ori_ti_beta2alpha (long random, char *label, struct SEEDSET *SSet, int dtess, int dcell, struct OL_SET *pOSet)
{
unsigned int i;
int partqty;
double *q = ol_q_alloc ();
char **parts = NULL;
int status_parent, status_child;
int n1;
double **qX = ut_alloc_2d (13, 4);
double *qtmp = ol_q_alloc ();
gsl_rng *r = NULL;

ut_list_break (label, NEUT_SEP_DEP, &parts, &partqty);

// After (Fortes, 1984)
if (strcmp (parts[0], "ti_beta2alpha") && strcmp (parts[0], "Ti_beta2alpha"))
abort ();

// Checking crystal symmetries
status_parent = 0; // 1: warning, 2: error
status_child = 0; // 1: warning, 2: error
if (strcmp (SSet[dtess].crysym, "cubic") || strcmp ((*pOSet).crysym, "hexagonal"))
{
ol_set_misorispread (spread, 3, SSet[dtess].Random + dcell, pOSet);
if (strcmp (SSet[dtess].crysym, "cubic"))
status_parent = (!strcmp (SSet[dtess].crysym, "triclinic")) ? 1 : 2;

for (i = 0; i < (*pOSet).size; i++)
ol_q_q_q_ref (q, (*pOSet).q[i], (*pOSet).q[i]);
if (strcmp ((*pOSet).crysym, "hexagonal"))
status_child = (!strcmp (SSet[dtess].crysym, "triclinic")) ? 1 : 2;
}

if (ut_num_max (status_parent, status_child) == 1)
ut_print_message (1, 2, "beta2alpha transformation assumes cubic parent and hexagonal child phases.\n");
else if (ut_num_max (status_parent, status_child) == 2)
ut_print_message (2, 2, "beta2alpha transformation requires cubic parent and hexagonal child phases.\n");

ol_q_set_this (qX[1], 0.704416, 0.541675, -0.454519, -0.061628);
ol_q_set_this (qX[2], 0.901980, 0.082828, 0.373612, 0.199964);
ol_q_set_this (qX[3], 0.704416, 0.541675, 0.454519, 0.061628);
ol_q_set_this (qX[4], 0.901980, 0.082828, -0.373612, -0.199964);
ol_q_set_this (qX[5], 0.923000, 0.382319, -0.016692, 0.040299);
ol_q_set_this (qX[6], 0.704416, -0.541675, -0.454519, 0.061628);
ol_q_set_this (qX[7], 0.923000, -0.382319, -0.016692, -0.040299);
ol_q_set_this (qX[8], 0.704416, -0.541675, 0.454519, -0.061628);
ol_q_set_this (qX[9], 0.901980, -0.082828, 0.373612, -0.199964);
ol_q_set_this (qX[10], 0.923000, 0.382319, 0.016692, -0.040299);
ol_q_set_this (qX[11], 0.901980, -0.082828, -0.373612, 0.199964);
ol_q_set_this (qX[12], 0.923000, -0.382319, 0.016692, 0.040299);
for (i = 1; i <= 12; i++)
ol_q_set_unit (qX[i]);

r = gsl_rng_alloc (gsl_rng_ranlxd2);
gsl_rng_set (r, random - 1);

ut_print_message (0, 2, "Applying beta->alpha...\n");

for (i = 0; i < (*pOSet).size; i++)
{
n1 = 1 + gsl_rng_uniform_int (r, 12);
// ol_q_crysym (SSet[dtess].SeedOri[dcell], "cubic", n1, qtmp);
ol_q_q_q_cur (SSet[dtess].SeedOri[dcell], qX[n1], (*pOSet).q[i]);
}

ut_free_2d (&qX, 13);
ol_q_free (qtmp);
gsl_rng_free (r);

if (partqty == 2)
net_ori_addspread (parts[1], SSet[dtess].Random + dcell, pOSet);

ol_q_free (q);
ut_free_2d_char (&parts, partqty);

return;
}

void
net_ori_parent (char *string, struct SEEDSET *SSet, int dtess, int dcell, struct OL_SET *pOSet)
{
int i, partqty;
char **parts = NULL;

ut_list_break (string, NEUT_SEP_DEP, &parts, &partqty);

for (i = 0; i < (int) (*pOSet).size; i++)
ol_q_memcpy (SSet[dtess].SeedOri[dcell], (*pOSet).q[i]);

if (partqty == 2)
net_ori_addspread (parts[1], SSet[dtess].Random + dcell, pOSet);

ut_free_2d_char (&parts, partqty);

return;
}

void
net_ori_label (char *label, struct SEEDSET *SSet, int dtess, int dcell, struct OL_SET *pOSet)
{
int i, status, partqty;
double *q = ol_q_alloc ();
char **parts = NULL;

ut_list_break (label, NEUT_SEP_DEP, &parts, &partqty);

status = ol_label_q (parts[0], q);
if (status)
abort ();

for (i = 0; i < (int) (*pOSet).size; i++)
ol_q_memcpy (q, (*pOSet).q[i]);

if (partqty == 2)
net_ori_addspread (parts[1], SSet[dtess].Random + dcell, pOSet);

ol_q_free (q);
ut_free_2d_char (&parts, partqty);
ut_free_1d_char (&spread);

return;
}
Expand Down
16 changes: 16 additions & 0 deletions src/neper_t/net_ori/net_ori3.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ net_ori_odf_pre (char *odf, struct OL_SET *pOSet, struct ODF *pOdf)

return;
}

void
net_ori_addspread (char *spread, long random, struct OL_SET *pOSet)
{
int i;
struct OL_SET OSet2 = ol_set_alloc ((*pOSet).size, (*pOSet).crysym);

ol_set_misorispread (spread, 3, random, &OSet2);

for (i = 0; i < (int) (*pOSet).size; i++)
ol_q_q_q_ref ((*pOSet).q[i], OSet2.q[i], (*pOSet).q[i]);

ol_set_free (&OSet2);

return;
}
15 changes: 12 additions & 3 deletions src/neper_t/net_ori/net_ori_.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ extern void net_ori_qty (struct SEEDSET *pSSet, char **parts, int partqty, int *
extern void net_ori_fiber (struct SEEDSET *SSet, int dtess, int dcell, long random,
char *distrib, struct OL_SET *pOSet);

extern void net_ori_label (char *label, struct SEEDSET *SSet, int dtess, int dcell,
struct OL_SET *pOSet);

extern void net_ori_odf (long random, char *odf, struct OL_SET *pOSet);
extern void net_ori_odf_pre (char *odf, struct OL_SET *pOSet, struct ODF *pOdf);

Expand All @@ -42,3 +39,15 @@ extern int net_ori_mtess_randseed_rand (int *N, int *id, int *poly, int levelqty
extern void net_ori_orispread (char *orispread, struct SEEDSET *pSSet);

extern void net_orispread_file (char *orispread, struct SEEDSET *pSSet);

extern void net_ori_addspread (char *spread, long random, struct OL_SET *pOSet);

extern void net_ori_ks (long random, char *label, struct SEEDSET *SSet, int dtess, int dcell, struct OL_SET *pOSet);

extern void net_ori_ti_beta2alpha (long random, char *label, struct SEEDSET *SSet, int dtess, int dcell, struct OL_SET *pOSet);

extern void net_ori_parent (char *label, struct SEEDSET *SSet, int dtess, int dcell,
struct OL_SET *pOSet);

extern void net_ori_label (char *label, struct SEEDSET *SSet, int dtess, int dcell,
struct OL_SET *pOSet);
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ extern "C"
#endif

extern void net_tess3d_periodic (struct TESS *pTess);
extern void net_tess3d_periodic_ver_shrinkmaster (struct TESS *);
extern void net_tess3d_periodic_edge_shrinkmaster (struct TESS *);
extern void net_tess2d_periodic_edge_peredgeori (struct TESS *pTess);
extern void net_tess3d_periodic_edge_peredgeori (struct TESS *pTess);

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ extern void net_tess3d_periodic_face (struct TESS *pTess);
extern void net_tess3d_periodic_edge (struct TESS *pTess);
extern void net_tess3d_periodic_ver (struct TESS *pTess);

extern void net_tess3d_periodic_ver_shrinkmaster (struct TESS *);
extern void net_tess3d_periodic_edge_shrinkmaster (struct TESS *);
extern void net_tess3d_periodic_edge_peredgeori (struct TESS *pTess);

extern void net_tess3d_periodic_face_rodrigues (struct TESS *pTess);
extern void net_tess3d_periodic_edge_rodrigues (struct TESS *pTess);
extern void net_tess3d_periodic_ver_rodrigues (struct TESS *pTess);
Expand Down
Loading

0 comments on commit 7ad17ee

Please sign in to comment.