Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs Update: Tutorials Folder and Running on ReadTheDocs #94

Merged
merged 3 commits into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ temp_print_trace.*
*.plugin
*.outp
*.patch
*.txt
*.bib.bak
*.out
*.vtk
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ After installing MOOSE, make sure you have the following folder on your local ma

`git submodule update --init moose`

`mamba activate moose`

`make -jn`

where `n` is the number of logical processors on your computer.

**Step 3.**
Run tests to make sure CRANE is installed properly.

`./run_tests`
`./run_tests -jn`

If all the tests pass, CRANE has been successfully installed.

Expand Down
35 changes: 35 additions & 0 deletions docs/source/running.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
Running
=======

Running a CRANE input file follows the syntax

.. code-block:: bash

<path-from-intput-to-crane-opt> -i <input-file>

while in the MOOSE environment.
The file ``crane-opt`` is generated upon successful compilation of CRANE,
and is located alongside the MAKEFILE.
For example, to want to run ``argon_test.i`` located in ``crane/problems/argon_microdischarge``,
you would enter the following command while in ``argon_microdischarge`` directory:

.. code-block:: bash

../../crane-opt -i argon_test.i

Each set of ``../`` denotes a step up through the directories.
Since ``argon_microdischarge`` is within ``problems``, which is within ``crane``,
we need two sets of ``../`` to be in the directory in which ``crane-opt`` is located.

To run an input file on multiple processors,
one would add the following command before the path to `crane-opt``:

.. code-block:: bash

mpiexec -np n <path-from-intput-to-crane-opt> -i <input-file>

where ``n`` is the number of processors you wish to use. For the ``argon_microdischarge`` example,
you might run

.. code-block:: bash

mpiexec -np 4 ../../crane-opt -i argon_test.i

to run the input file using four cores.
28 changes: 28 additions & 0 deletions tutorials/ArgonMicrodischarge/argon_density_plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#* This file is part of Crane, an open-source
#* application for plasma chemistry and thermochemistry
#* https://github.com/lcpp-org/crane
#*
#* Crane is powered by the MOOSE Framework
#* https://www.mooseframework.org
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

filename = 'argon_test_out.csv'
data = pd.read_csv(filename)

fig, ax = plt.subplots()
ax.loglog(data['time'], data['e'], 'k', label='e')
ax.loglog(data['time'], data['Ar+'], 'g', label='Ar$^+$')
ax.loglog(data['time'], data['Ar2+'], 'r', label='Ar$_2^+$')
ax.loglog(data['time'], data['Ar*'], 'c', label='Ar$^*$')
ax.set_xlabel('Time (s)', fontsize=20)
ax.set_ylabel('Density (cm$^{-3}$)', fontsize=20)
ax.tick_params(axis='both', labelsize=15)
ax.legend(fontsize=15)
fig.savefig('argon_species.png', bbox_inches='tight')
plt.show()
211 changes: 211 additions & 0 deletions tutorials/ArgonMicrodischarge/argon_test.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
[Mesh]
type = GeneratedMesh
dim = 1
xmin = 0
xmax = 1
nx = 1
[]

[Variables]
# ODE variables
[./e]
family = SCALAR
order = FIRST
initial_condition = 1e6
# scaling = 1e-2
[../]

[./Ar+]
family = SCALAR
order = FIRST
initial_condition = 1e6
# scaling = 1e-2
[../]

[./Ar]
family = SCALAR
order = FIRST
initial_condition = 3.21883e18
#scaling = 1e-15
[../]

[./Ar*]
family = SCALAR
order = FIRST
initial_condition = 1e6
# scaling = 1e-2
[../]

[./Ar2+]
family = SCALAR
order = FIRST
initial_condition = 1
# scaling = 1e-2
[../]
[]

[ScalarKernels]
[./de_dt]
type = ODETimeDerivative
variable = e
[../]

[./dAr+_dt]
type = ODETimeDerivative
variable = Ar+
[../]

[./dAr_dt]
type = ODETimeDerivative
variable = Ar
[../]

[./dAr*_dt]
type = ODETimeDerivative
variable = Ar*
[../]

[./dAr2_dt]
type = ODETimeDerivative
variable = Ar2+
[../]
[]

[GlobalReactions]
[argon]
species = 'e Ar* Ar+ Ar Ar2+'
file_location = 'data'

# These are parameters required equation-based rate coefficients
equation_constants = 'Tgas J pi'
equation_values = '300 2.405 3.141'
equation_variables = 'Te'
sampling_variable = 'reduced_field'


reactions = 'e + Ar -> e + e + Ar+ : EEDF (Ar_ionization)
e + Ar -> Ar* + e : EEDF (Ar_excitation)
e + Ar* -> Ar + e : EEDF (Ar*_deexcitation)
e + Ar* -> Ar+ + e + e : EEDF (Ar*_ionization)
Ar2+ + e -> Ar* + Ar : {8.5e-7*((Te/1.5)*11600/300.0)^(-0.67)}
Ar2+ + Ar -> Ar+ + Ar + Ar : {(6.06e-6/Tgas)*exp(-15130.0/Tgas)}
Ar* + Ar* -> Ar2+ + e : 6.0e-10
Ar+ + e + e -> Ar + e : {8.75e-27*((Te/1.5)^(-4.5))}
Ar* + Ar + Ar -> Ar + Ar + Ar : 1.399e-32
Ar+ + Ar + Ar -> Ar2+ + Ar : {2.25e-31*(Tgas/300.0)^(-0.4)}
e -> W : {1.52*(760/100)*(Tgas/273.16)*(Te/1.5)*((J/0.4)^2 + (pi/0.4)^2)}
Ar+ -> W : {1.52*(760/100)*(Tgas/273.16)*(Te/1.5)*((J/0.4)^2 + (pi/0.4)^2)}
Ar2+ -> W : {1.52*(760/100)*(Tgas/273.16)*(Te/1.5)*((J/0.4)^2 + (pi/0.4)^2)}'
[]
[]

[AuxVariables]
[./reduced_field]
order = FIRST
family = SCALAR
initial_condition = 7.7667949e-20
[../]

[./mobility]
order = FIRST
family = SCALAR
[../]

[./Te]
order = FIRST
family = SCALAR
[../]

[./current]
order = FIRST
family = SCALAR
[../]
[]

[AuxScalarKernels]
[reduced_field_calculate]
type = ParsedAuxScalar
variable = reduced_field
constant_names = 'V d qe R'
constant_expressions = '1000 0.004 1.602e-19 1e5'
args = 'reduced_field Ar current'
function = 'V/(d+R*current/(reduced_field*Ar*1e6))/(Ar*1e6)'
execute_on = 'TIMESTEP_END'
[]

[e_drift]
type = ParsedAuxScalar
variable = current
constant_names = 'r pi'
constant_expressions = '0.004 3.1415926'
args = 'reduced_field mobility Ar e'
function = '(reduced_field * mobility * Ar*1e6) * 1.6e-19 * pi*(r^2.0) * (e*1e6)'
execute_on = 'TIMESTEP_BEGIN'
[]

[mobility_calculation]
type = ScalarLinearInterpolation
variable = mobility
sampler = reduced_field
property_file = 'data/electron_mobility.txt'
execute_on = 'INITIAL TIMESTEP_BEGIN'
[]

[temperature_calculation]
type = ScalarLinearInterpolation
variable = Te
sampler = reduced_field
property_file = 'data/electron_temperature.txt'
execute_on = 'INITIAL TIMESTEP_BEGIN'
[]
[]

[Debug]
show_var_residual_norms = true
[]

#[UserObjects]
# active = 'value_provider'
#
#[./value_provider]
# type = ValueProvider
# property_file = 'data/electron_temperature.txt'
#[../]
#[]

[Executioner]
type = Transient
end_time = 1e-3
solve_type = linear
dtmin = 1e-16
dtmax = 1e-6
line_search = none
steady_state_detection = true
[./TimeStepper]
type = IterationAdaptiveDT
cutback_factor = 0.9
dt = 1e-10
growth_factor = 1.01
[../]
#[TimeIntegrator]
# type = LStableDirk2
#[]
[]

[Preconditioning]
[./smp]
type = SMP
full = true
#ksp_norm = none
[../]
[]

[Outputs]
[out]
type = CSV
[]
[console]
type = Console
execute_scalars_on = 'none'
[]
[]
Loading