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

Fix Field3D::setBoundaryTo for FCI methods #3030

Merged
merged 6 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
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
20 changes: 19 additions & 1 deletion src/field/field3d.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,25 @@ void Field3D::setBoundaryTo(const Field3D& f3d) {

allocate(); // Make sure data allocated

/// Loop over boundary regions
if (isFci()) {
// Set yup/ydown using midpoint values from f3d
ASSERT1(f3d.hasParallelSlices());
ASSERT1(hasParallelSlices());

for (auto& region : fieldmesh->getBoundariesPar()) {
for (const auto& pnt : *region) {
// Interpolate midpoint value in f3d
const BoutReal val = pnt.interpolate_sheath_o1(f3d);
// Set the same boundary value in this field
pnt.dirichlet_o2(*this, val);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should either take o2 twice, or o1 twice:

Suggested change
pnt.dirichlet_o2(*this, val);
pnt.dirichlet_o1(*this, val);

I think o1 should be sufficient, as f3d and *this should be close. But I am not sure what is more stable ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FA code also uses first order, so I have pushed a fixed based on that ...

}
}
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For hermes that might work, but should we not also copy the x-boundary conditions with FCI?

Suggested change
return;

}

// Non-FCI.
// Transform to field-aligned coordinates?
// Loop over boundary regions
for (const auto& reg : fieldmesh->getBoundaries()) {
/// Loop within each region
for (reg->first(); !reg->isDone(); reg->next()) {
Expand Down
Loading