Skip to content
Open
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
3 changes: 3 additions & 0 deletions include/base/foam/fvCFD_moose.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@
#include <functionObjects/field/wallHeatFlux/wallHeatFlux.H>
#include <functionObjects/field/wallShearStress/wallShearStress.H>

// FoamMappedInletBCBase.h
#include <meshSearch.H>

#undef NotImplemented
#undef FunctionName
58 changes: 58 additions & 0 deletions include/bcs/FoamMappedInletBCBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#pragma once

#include "FoamPostprocessorBCBase.h"
#include <UPstream.H>
#include <pointFieldsFwd.H>
#include <vector>

class FoamMappedInletBCBase : public FoamPostprocessorBCBase
{
public:
static InputParameters validParams();

FoamMappedInletBCBase(const InputParameters & params);

~FoamMappedInletBCBase() override { destroyCommunicator(_foam_comm); }

protected:
Foam::vector _offset;

std::map<int, std::vector<int>> _send_map;

std::map<int, std::vector<int>> _recv_map;

Foam::label _foam_comm;

MPI_Comm _mpi_comm;

const Foam::meshSearch & _mesh_searcher;

// get array from mapped plane on the inlet processes
template <typename T>
Foam::Field<T> getMappedArray(const Foam::word & name);

private:
// create send and receive information for mapping
void createPatchProcMap();

// check if bounding box intersects with rank
bool intersectMapPlane(const Foam::fvMesh & mesh, Real cart_bbox[6]);

// create/assign communicators for the transfers between map and inlet planes
void createMapComm(const Foam::fvMesh & mesh,
const Foam::vectorField & face_centres,
std::vector<int> & map_processes,
std::vector<int> & inlet_processes,
MPI_Comm comm);

// find indices of cells containing mapped inlet points or raise error if not found
std::vector<int> findIndices(const Foam::pointField & locations, MPI_Comm comm);

// handle creation of new communicators in parallel or serial
Foam::label createCommunicator(const Foam::label parent_comm,
const std::vector<int> & procs,
MPI_Comm & new_comm);

// free communicators if parallel run
void destroyCommunicator(Foam::label comm);
};
18 changes: 18 additions & 0 deletions include/bcs/FoamMassFlowRateMappedInletBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include "FoamMappedInletBCBase.h"
#include "MooseEnum.h"

class FoamMassFlowRateMappedInletBC : public FoamMappedInletBCBase
{
public:
static InputParameters validParams();

FoamMassFlowRateMappedInletBC(const InputParameters & params);

virtual void imposeBoundaryCondition() override;

protected:
MooseEnum _scale_method;

Real _scale_factor;
};
19 changes: 19 additions & 0 deletions include/bcs/FoamScalarBulkMappedInletBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once
#include "FoamMappedInletBCBase.h"
#include "MooseEnum.h"

class FoamScalarBulkMappedInletBC : public FoamMappedInletBCBase
{
public:
static InputParameters validParams();

FoamScalarBulkMappedInletBC(const InputParameters & params);

virtual void imposeBoundaryCondition() override;

protected:
MooseEnum _scale_method;

template <typename T>
T applyScaleMethod(T & var, const Real bulk_ref, const Real bulk);
};
Loading
Loading