-
Notifications
You must be signed in to change notification settings - Fork 106
Add ability to use variables from grid file in input file expressions #3222
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
base: next
Are you sure you want to change the base?
Changes from all commits
ca7f727
f9c616b
4034481
aa963d6
4985b3c
47b852f
dc80694
259eff9
afae6cd
ae7b02c
4ab3578
cd31e42
daced86
854c379
7df04a7
8ebc0a0
d3b0ebe
1bfd9ad
3f15ddb
69ca85d
91854fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1356,7 +1356,8 @@ class ELMpb : public PhysicsModel { | |||||||||
| // Only update if simulation time has advanced | ||||||||||
| // Uses an exponential decay of the weighting of the value in the boundary | ||||||||||
| // so that the solution is well behaved for arbitrary steps | ||||||||||
| BoutReal const weight = exp(-(t - phi_boundary_last_update) / phi_boundary_timescale); | ||||||||||
| const BoutReal weight = | ||||||||||
| exp(-(t - phi_boundary_last_update) / phi_boundary_timescale); | ||||||||||
| phi_boundary_last_update = t; | ||||||||||
|
|
||||||||||
| if (mesh->firstX()) { | ||||||||||
|
|
@@ -1385,11 +1386,11 @@ class ELMpb : public PhysicsModel { | |||||||||
| } | ||||||||||
|
|
||||||||||
| // Old value of phi at boundary. Note: this is constant in Z | ||||||||||
| BoutReal const oldvalue = | ||||||||||
| const BoutReal oldvalue = | ||||||||||
| 0.5 * (phi(mesh->xstart - 1, j, 0) + phi(mesh->xstart, j, 0)); | ||||||||||
|
|
||||||||||
| // New value of phi at boundary, relaxing towards phivalue | ||||||||||
| BoutReal const newvalue = weight * oldvalue + (1. - weight) * phivalue; | ||||||||||
| const BoutReal newvalue = weight * oldvalue + (1. - weight) * phivalue; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
Suggested change
|
||||||||||
|
|
||||||||||
| // Set phi at the boundary to this value | ||||||||||
| for (int k = mesh->zstart; k <= mesh->zend; k++) { | ||||||||||
|
|
@@ -1412,7 +1413,7 @@ class ELMpb : public PhysicsModel { | |||||||||
| 0.5 * (phi(mesh->xend + 1, j, 0) + phi(mesh->xend, j, 0)); | ||||||||||
|
|
||||||||||
| // New value of phi at boundary, relaxing towards phivalue | ||||||||||
| BoutReal const newvalue = weight * oldvalue + (1. - weight) * phivalue; | ||||||||||
| const BoutReal newvalue = weight * oldvalue + (1. - weight) * phivalue; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
Suggested change
|
||||||||||
|
|
||||||||||
| // Set phi at the boundary to this value | ||||||||||
| for (int k = mesh->zstart; k <= mesh->zend; k++) { | ||||||||||
|
|
@@ -1625,7 +1626,7 @@ class ELMpb : public PhysicsModel { | |||||||||
| for (int jz = 0; jz < mesh->LocalNz; jz++) { | ||||||||||
|
|
||||||||||
| // Zero-gradient potential | ||||||||||
| BoutReal const phisheath = phi_fa(r.ind, mesh->ystart, jz); | ||||||||||
| const BoutReal phisheath = phi_fa(r.ind, mesh->ystart, jz); | ||||||||||
|
|
||||||||||
| BoutReal jsheath = -(sqrt(mi_me) / (2. * sqrt(PI))) * phisheath; | ||||||||||
|
|
||||||||||
|
|
@@ -1646,7 +1647,7 @@ class ELMpb : public PhysicsModel { | |||||||||
| for (int jz = 0; jz < mesh->LocalNz; jz++) { | ||||||||||
|
|
||||||||||
| // Zero-gradient potential | ||||||||||
| BoutReal const phisheath = phi_fa(r.ind, mesh->yend, jz); | ||||||||||
| const BoutReal phisheath = phi_fa(r.ind, mesh->yend, jz); | ||||||||||
|
|
||||||||||
| BoutReal jsheath = (sqrt(mi_me) / (2. * sqrt(PI))) * phisheath; | ||||||||||
|
|
||||||||||
|
|
@@ -2068,7 +2069,8 @@ class ELMpb : public PhysicsModel { | |||||||||
| ddt(P).applyBoundary("neumann"); | ||||||||||
|
|
||||||||||
| Field3D U1 = ddt(U); | ||||||||||
| U1 += (gamma * B0 * B0) * Grad_par(Jrhs, CELL_CENTRE) + (gamma * b0xcv) * Grad(ddt(P)); | ||||||||||
| U1 += | ||||||||||
| (gamma * B0 * B0) * Grad_par(Jrhs, CELL_CENTRE) + (gamma * b0xcv) * Grad(ddt(P)); | ||||||||||
|
|
||||||||||
| // Second matrix, solving Alfven wave dynamics | ||||||||||
| static std::unique_ptr<InvertPar> invU{nullptr}; | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -597,7 +597,7 @@ public: | |
| virtual int getLocalZIndexNoBoundaries(int zglobal) const = 0; | ||
|
|
||
| /// Size of the mesh on this processor including guard/boundary cells | ||
| int LocalNx, LocalNy, LocalNz; | ||
| int LocalNx{0}, LocalNy{0}, LocalNz{0}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: member variable 'LocalNx' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes] int LocalNx{0}, LocalNy{0}, LocalNz{0};
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: member variable 'LocalNy' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes] int LocalNx{0}, LocalNy{0}, LocalNz{0};
^
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: member variable 'LocalNz' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes] int LocalNx{0}, LocalNy{0}, LocalNz{0};
^ |
||
|
|
||
| /// Local ranges of data (inclusive), excluding guard cells | ||
| int xstart, xend, ystart, yend, zstart, zend; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]