21 using namespace common;
23 namespace electromagnetics
26 MagneticDiffusionEOperator::MagneticDiffusionEOperator(
36 std::map<int, double> sigmaAttMap,
37 std::map<int, double> TcapacityAttMap,
38 std::map<int, double> InvTcapAttMap,
39 std::map<int, double> InvTcondAttMap)
42 L2FESpace(L2FES), HCurlFESpace(HCurlFES), HDivFESpace(HDivFES),
43 HGradFESpace(HGradFES),
44 a0(NULL), a1(NULL), a2(NULL), m1(NULL), m2(NULL), m3(NULL),
45 s1(NULL), s2(NULL), grad(NULL), curl(NULL), weakDiv(NULL), weakDivC(NULL),
47 A0(NULL), A1(NULL), A2(NULL), M1(NULL), M2(NULL), M3(NULL),
48 X0(NULL), X1(NULL), X2(NULL), B0(NULL), B1(NULL), B2(NULL), B3(NULL),
49 v0(NULL), v1(NULL), v2(NULL),
50 amg_a0(NULL), pcg_a0(NULL), ads_a2(NULL), pcg_a2(NULL), ams_a1(NULL),
51 pcg_a1(NULL), dsp_m3(NULL),pcg_m3(NULL),
52 dsp_m1(NULL), pcg_m1(NULL), dsp_m2(NULL), pcg_m2(NULL),
53 mu(mu_coef), dt_A1(-1.0), dt_A2(-1.0)
56 for (
int i=0; i<ess_bdr_arg.
Size(); i++)
61 for (
int i=0; i<thermal_ess_bdr_arg.
Size(); i++)
66 for (
int i=0; i<poisson_ess_bdr_arg.
Size(); i++)
103 Vector zero_vec(3); zero_vec = 0.0;
122 true_offset[1] = true_offset[0] + Vsize_l2;
123 true_offset[2] = true_offset[1] + Vsize_rt;
124 true_offset[3] = true_offset[2] + Vsize_h1;
125 true_offset[4] = true_offset[3] + Vsize_nd;
126 true_offset[5] = true_offset[4] + Vsize_rt;
127 true_offset[6] = true_offset[5] + Vsize_l2;
181 true_offset[1] = true_offset[0] + Vsize_l2;
182 true_offset[2] = true_offset[1] + Vsize_rt;
183 true_offset[3] = true_offset[2] + Vsize_h1;
184 true_offset[4] = true_offset[3] + Vsize_nd;
185 true_offset[5] = true_offset[4] + Vsize_rt;
186 true_offset[6] = true_offset[5] + Vsize_l2;
314 Vector zero_vec(3); zero_vec = 0.0;
404 if (
A2 == NULL || fabs(dt-
dt_A2) > 1.0e-12*dt )
408 if (
A1 == NULL || fabs(dt-
dt_A1) > 1.0e-12*dt )
430 true_offset[1] = true_offset[0] + Vsize_l2;
431 true_offset[2] = true_offset[1] + Vsize_rt;
432 true_offset[3] = true_offset[2] + Vsize_h1;
433 true_offset[4] = true_offset[3] + Vsize_nd;
434 true_offset[5] = true_offset[4] + Vsize_rt;
435 true_offset[6] = true_offset[5] + Vsize_l2;
567 Vector zero_vec(3); zero_vec = 0.0;
644 if (
a0 != NULL ) {
delete a0; }
663 if (
a1 != NULL ) {
delete a1; }
685 if (
a2 != NULL ) {
delete a2; }
701 if (
m1 != NULL ) {
delete m1; }
712 if (
m2 != NULL ) {
delete m2; }
724 if (
m3 != NULL ) {
delete m3; }
736 if (
s1 != NULL ) {
delete s1; }
746 if (
s2 != NULL ) {
delete s2; }
756 if (
curl != NULL ) {
delete curl; }
789 if (
grad != NULL ) {
delete grad; }
803 MPI_Allreduce(&el, &global_el, 1, MPI_DOUBLE, MPI_SUM,
837 if (
curl != NULL ) {
delete curl; }
841 if (
grad != NULL ) {
delete grad; }
843 if (
a0 != NULL ) {
delete a0; }
844 if (
a1 != NULL ) {
delete a1; }
845 if (
a2 != NULL ) {
delete a2; }
846 if (
m1 != NULL ) {
delete m1; }
847 if (
m2 != NULL ) {
delete m2; }
848 if (
s1 != NULL ) {
delete s1; }
849 if (
s2 != NULL ) {
delete s2; }
851 if (
A0 != NULL ) {
delete A0; }
852 if (
X0 != NULL ) {
delete X0; }
853 if (
B0 != NULL ) {
delete B0; }
855 if (
A1 != NULL ) {
delete A1; }
856 if (
X1 != NULL ) {
delete X1; }
857 if (
B1 != NULL ) {
delete B1; }
859 if (
A2 != NULL ) {
delete A2; }
860 if (
X2 != NULL ) {
delete X2; }
861 if (
B2 != NULL ) {
delete B2; }
863 if (
v1 != NULL ) {
delete v1; }
864 if (
v2 != NULL ) {
delete v2; }
888 hypre_ParCSRMatrixPrint(*
A1,
"A1_");
896 hypre_ParCSRMatrixPrint(*
A2,
"A2_");
910 thisSigma = sigma.
Eval(T, ip);
911 return thisSigma*(E*E);
915 const std::map<int, double> &inputMap,
double scale)
919 materialMap =
new std::map<int, double>(inputMap);
928 materialMap =
new std::map<int, double>(*(cloneMe.materialMap));
929 scaleFactor = cloneMe.scaleFactor;
936 std::map<int, double>::iterator it;
939 it = materialMap->find(thisAtt);
940 if (it != materialMap->end())
947 std::cerr <<
"MeshDependentCoefficient attribute " << thisAtt
948 <<
" not found" << std::endl;
952 return value*scaleFactor;
969 #endif // MFEM_USE_MPI
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
ParFiniteElementSpace & L2FESpace
void buildDiv(MeshDependentCoefficient &InvTcap)
virtual double GetTime() const
Read the currently set time.
int Size() const
Return the logical size of the array.
Class for domain integration L(v) := (f, v)
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
MPI_Comm GetComm() const
MPI communicator.
void buildM2(MeshDependentCoefficient &alpha)
The Auxiliary-space Maxwell Solver in hypre.
Class for grid function - Vector with associated FE space.
The Auxiliary-space Divergence Solver in hypre.
A coefficient that is constant across space and time.
virtual ~MagneticDiffusionEOperator()
MeshDependentCoefficient * InvTcap
ParFiniteElementSpace & HDivFESpace
Integrator for (curl u, curl v) for Nedelec elements.
Base abstract class for first order time dependent operators.
Vector coefficient that is constant in space and time.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
void buildS1(double muInv)
virtual void ImplicitSolve(const double dt, const Vector &x, Vector &k)
Solve the equation: k = f(x + dt k, t), for the unknown k at the current time t.
Abstract parallel finite element space.
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
virtual void SetTime(double t)
Set the time for time dependent coefficients.
double * GetData() const
Return a pointer to the beginning of the Vector data.
(Q div u, div v) for RT elements
void SetPrintLevel(int print_lvl)
void AddDomainInterpolator(DiscreteInterpolator *di)
Adds a domain interpolator. Assumes ownership of di.
void Debug(const char *basefilename, double time)
HYPRE_BigInt N() const
Returns the global number of columns.
void GetJouleHeating(ParGridFunction &E_gf, ParGridFunction &w_gf) const
void Print(const char *fname) const
Prints the locally owned rows in parallel.
virtual void MakeRef(FiniteElementSpace *f, double *v)
Make the ParGridFunction reference external data on a new FiniteElementSpace.
void buildA1(double muInv, MeshDependentCoefficient &sigma, double dt)
ScaledGFCoefficient(GridFunction *gf, MeshDependentCoefficient &input_mdc)
double p_bc(const Vector &x, double t)
The BoomerAMG solver in hypre.
ParFiniteElementSpace & HCurlFESpace
void ProjectBdrCoefficientNormal(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
void buildS2(MeshDependentCoefficient &alpha)
ParDiscreteLinearOperator * curl
Array< int > thermal_ess_bdr
void buildM3(MeshDependentCoefficient &Tcap)
void SetScaleFactor(const double &scale)
Jacobi preconditioner in hypre.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
void buildM1(MeshDependentCoefficient &sigma)
double muInv(const Vector &x)
ParMixedBilinearForm * weakDivC
MeshDependentCoefficient * Tcapacity
void SetMaxIter(int max_iter)
A general vector function coefficient.
virtual void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const
Wrapper for hypre's parallel vector class.
ParDiscreteLinearOperator * grad
double ElectricLosses(ParGridFunction &E_gf) const
MeshDependentCoefficient(const std::map< int, double > &inputMap, double scale=1.0)
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void SetTime(const double t_)
Set the current time.
void buildA2(MeshDependentCoefficient &InvTcond, MeshDependentCoefficient &InvTcap, double dt)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
MeshDependentCoefficient * sigma
Array< int > poisson_ess_bdr
Class for integration point with weight.
ParFiniteElementSpace & HGradFESpace
HYPRE_BigInt * ColPart()
Returns the column partitioning.
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attri...
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
ParMixedBilinearForm * weakCurl
MeshDependentCoefficient * InvTcond
void edot_bc(const Vector &x, Vector &E)
A general function coefficient.
Class for parallel grid function.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
Wrapper for hypre's ParCSR matrix class.
virtual void Assemble(int skip_zeros=1)
Construct the internal matrix representation of the discrete linear operator.
virtual void Mult(const HypreParVector &b, HypreParVector &x) const
Solve Ax=b with hypre's PCG.
void buildCurl(double muInv)
void buildA0(MeshDependentCoefficient &sigma)
virtual void Mult(const Vector &vx, Vector &dvx_dt) const
Perform the action of the operator: y = k = f(x, t), where k solves the algebraic equation F(x...
ParMixedBilinearForm * weakDiv