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

Exodus Mesh, boundary condition, and block data transfer functionality implementation. #11

Merged
merged 7 commits into from
Sep 5, 2022
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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,10 @@ conf_vars.mk
*docker/**/*.tar.gz

# MFEM Joule outputs
*Joule_000*
*Joule_000*

# Ignoring all of OutputData
*/OutputData/

#Ignore output mfem meshes
*.mesh
4 changes: 3 additions & 1 deletion docker/apollo-ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ RUN cd /$WORKDIR && \
ln -s ../build/Linux-x86_64/libmetis/libmetis.so lib

# Install MUMPS
# Install MUMPS

RUN cd /$WORKDIR && \
git clone https://github.com/scivision/mumps && \
cd mumps/ && \
mkdir build && \
cd build && \
cmake --preset=build -DBUILD_SHARED_LIBS=on -Dscotch=true -Dintsize64=false -Darith="s;d;c;z" -Dautobuild=true \
cmake -DBUILD_SHARED_LIBS=on -Dscotch=true -Dintsize64=false -Darith="s;d;c;z" \
-DCMAKE_INSTALL_PREFIX=/usr/local/ .. && \
make && \
make install
Expand Down
Binary file added examples/MFEM/rod/cylinder-hex-q2.e
Binary file not shown.
75 changes: 75 additions & 0 deletions examples/MFEM/rod/joule_rod_coupled_mesh.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[Mesh]
type = ExclusiveMFEMMesh
file = ./cylinder-hex-q2.e
dim = 3
[]

[Problem]
type = MFEMProblem
formulation = Joule
order = 2
dt = 0.5
end_time = 2.5
[]

[Functions]
[./p_bc]
type = ParsedFunction
value = (z/abs(z))*cos(2.0*pi*freq*t)
vars = 'freq'
vals = '0.01666667'
[../]
[]

[BCs]
[./tangential_dEdt]
type = MFEMBoundaryCondition
variable = tangential_dEdt
boundary = '1 2 3'
[../]
[./thermal_flux]
type = MFEMBoundaryCondition
variable = thermal_flux
boundary = '1 2'
[]
[./electric_potential]
type = MFEMFunctionDirichletBC
variable = electric_potential
boundary = '1 2'
function = p_bc
[../]
[]

[Materials]
[./copper]
type = MFEMConductor
electrical_conductivity = 62.83185
thermal_conductivity = 0.01
heat_capacity = 1.0
block = 1
[../]
[./air]
type = MFEMConductor
electrical_conductivity = 62.83185e-6
thermal_conductivity = 1e4
heat_capacity = 1.0
block = 2
[../]
[]

[Executioner]
type = Steady
[]

[Outputs]
[VisItDataCollection]
type = MFEMVisItDataCollection
file_base = OutputData/JouleRodVisIt
[]
[ParaViewDataCollection]
type = MFEMParaViewDataCollection
file_base = OutputData/JouleRodParaView
refinements = 1
high_order_output = true
[]
[]
54 changes: 46 additions & 8 deletions include/mesh/CoupledMFEMMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,55 @@ class CoupledMFEMMesh : public ExclusiveMFEMMesh {

CoupledMFEMMesh(const InputParameters& parameters);

virtual ~CoupledMFEMMesh();

virtual std::unique_ptr<MooseMesh> safeClone() const override;

virtual void buildMesh() override;

void getElementInfo();

// Builds the corresponding MOOSE mesh
void buildRealMesh();
void getBdrLists(int** elem_ss, int** side_ss);

// Function that maps vtk element types to libmesh element types
int map_elems_vtk_to_libmesh(int VTKElemType);
int getNumSidesets();

void createMFEMMesh();

// Boolean value determining whether the user wants the corresponding MOOSE
// mesh built
bool CreateMOOSEMesh;
void create_ss_node_id(int** elem_ss, int** side_ss, int** ss_node_id);

virtual std::unique_ptr<MooseMesh> safeClone() const override;
protected:

int curved = 0;
int read_gf = 0;
bool topo = false;

unsigned int num_node_per_el;
int libmesh_element_type;
int libmesh_face_type;
int num_element_linear_nodes;
int num_face_nodes;
int num_face_linear_nodes;
int num_side_sets;
int bdrElems;
std::vector<int> num_sides_in_ss;

enum CubitFaceType {
FACE_EDGE2,
FACE_EDGE3,
FACE_TRI3,
FACE_TRI6,
FACE_QUAD4,
FACE_QUAD9
};

enum CubitElementType {
ELEMENT_TRI3,
ELEMENT_TRI6,
ELEMENT_QUAD4,
ELEMENT_QUAD9,
ELEMENT_TET4,
ELEMENT_TET10,
ELEMENT_HEX8,
ELEMENT_HEX27
};
};
3 changes: 2 additions & 1 deletion include/mesh/ExclusiveMFEMMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#pragma once
#include "FileMesh.h"
#include "MFEMMesh.h"
#include "memory"
#include "libmesh/elem.h"
#include "libmesh/enum_io_package.h"
#include "libmesh/equation_systems.h"
Expand Down Expand Up @@ -42,5 +43,5 @@ class ExclusiveMFEMMesh : public FileMesh {
void buildDummyMesh();

// The object holding our MFEM mesh. Needs renaming as to avoid confusion
MFEMMesh* mfem_mesh;
std::shared_ptr<MFEMMesh> mfem_mesh;
};
51 changes: 44 additions & 7 deletions include/mesh/MFEMMesh.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
#pragma once

#include "libmesh/elem.h"
#include "libmesh/enum_io_package.h"
#include "libmesh/exodusII_io.h"
#include "libmesh/nemesis_io.h"
#include "libmesh/node.h"
#include "libmesh/parallel_mesh.h"
#include "mfem.hpp"

class MFEMMesh : public mfem::Mesh {
public:
MFEMMesh(const mfem::Vector &points, const mfem::Array<int> &cell_data,
const mfem::Array<int> &cell_offsets,
const mfem::Array<int> &cell_types,
const mfem::Array<int> &cell_attributes, int &curved, int &read_gf,
bool &finalize_topo);
MFEMMesh(int num_elem, std::vector<double> &coordx,
std::vector<double> &coordy, std::vector<double> &coordz,
std::map<int, int> &cubitToMFEMVertMap,
std::vector<int> uniqueVertexID, int libmesh_element_type,
int libmesh_face_type, int **elem_blk, int num_el_blk,
int num_node_per_el, size_t *num_el_in_blk,
int num_element_linear_nodes, int num_face_nodes,
int num_face_linear_nodes, int num_side_sets,
std::vector<int> num_side_in_ss, int **ss_node_id,
int *eb_prop, int *ss_prop, int dim_num, int* start_of_block);

MFEMMesh(std::string afilename, int generate_edges = 0, int refine = 1,
bool fix_orientation = true);
MFEMMesh(std::string cpp_filename, int generate_edges = 0,
int refine = 1, bool fix_orientation = true);

void get_mesh_nodes();

Expand All @@ -21,8 +32,34 @@ class MFEMMesh : public mfem::Mesh {

int get_num_nodes();

void create_boundary(int **ss_node_id, int *num_sides_in_sidesets,
int num_side_sets,
std::vector<libMesh::boundary_id_type> ssprop,
int num_face_linear_nodes, int num_face_nodes,
int libmesh_face_type);

std::vector<int> connectivityVec;
std::vector<double> pointsVec;
std::vector<int> cellTypeVec;
std::vector<int> verticesVec;

enum CubitFaceType {
FACE_EDGE2,
FACE_EDGE3,
FACE_TRI3,
FACE_TRI6,
FACE_QUAD4,
FACE_QUAD9
};

enum CubitElementType {
ELEMENT_TRI3,
ELEMENT_TRI6,
ELEMENT_QUAD4,
ELEMENT_QUAD9,
ELEMENT_TET4,
ELEMENT_TET10,
ELEMENT_HEX8,
ELEMENT_HEX27
};
};
Loading