21using namespace common;
23namespace electromagnetics
36 std::map<int, real_t> sigmaAttMap,
37 std::map<int, real_t> TcapacityAttMap,
38 std::map<int, real_t> InvTcapAttMap,
39 std::map<int, real_t> 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; }
831 if (
curl != NULL ) {
delete curl; }
835 if (
grad != NULL ) {
delete grad; }
837 if (
a0 != NULL ) {
delete a0; }
838 if (
a1 != NULL ) {
delete a1; }
839 if (
a2 != NULL ) {
delete a2; }
840 if (
m1 != NULL ) {
delete m1; }
841 if (
m2 != NULL ) {
delete m2; }
842 if (
s1 != NULL ) {
delete s1; }
843 if (
s2 != NULL ) {
delete s2; }
845 if (
A0 != NULL ) {
delete A0; }
846 if (
X0 != NULL ) {
delete X0; }
847 if (
B0 != NULL ) {
delete B0; }
849 if (
A1 != NULL ) {
delete A1; }
850 if (
X1 != NULL ) {
delete X1; }
851 if (
B1 != NULL ) {
delete B1; }
853 if (
A2 != NULL ) {
delete A2; }
854 if (
X2 != NULL ) {
delete X2; }
855 if (
B2 != NULL ) {
delete B2; }
857 if (
v1 != NULL ) {
delete v1; }
858 if (
v2 != NULL ) {
delete v2; }
882 hypre_ParCSRMatrixPrint(*
A1,
"A1_");
890 hypre_ParCSRMatrixPrint(*
A2,
"A2_");
904 thisSigma = sigma.
Eval(T, ip);
905 return thisSigma*(E*E);
909 const std::map<int, real_t> &inputMap,
real_t scale)
913 materialMap =
new std::map<int, real_t>(inputMap);
922 materialMap =
new std::map<int, real_t>(*(cloneMe.materialMap));
923 scaleFactor = cloneMe.scaleFactor;
930 std::map<int, real_t>::iterator it;
933 it = materialMap->find(thisAtt);
934 if (it != materialMap->end())
941 std::cerr <<
"MeshDependentCoefficient attribute " << thisAtt
942 <<
" not found" << std::endl;
946 return value*scaleFactor;
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual void SetTime(real_t t)
Set the time for time dependent coefficients.
A coefficient that is constant across space and time.
Integrator for for Nedelec elements.
void AddDomainInterpolator(DiscreteInterpolator *di)
Adds a domain interpolator. Assumes ownership of di.
virtual void Assemble(int skip_zeros=1)
Construct the internal matrix representation of the discrete linear operator.
for Raviart-Thomas elements
Class for domain integration .
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
A general function coefficient.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
Class for grid function - Vector with associated FE space.
void ProjectBdrCoefficientNormal(VectorCoefficient &vcoeff, const Array< int > &bdr_attr)
The Auxiliary-space Divergence Solver in hypre.
The Auxiliary-space Maxwell Solver in hypre.
The BoomerAMG solver in hypre.
Jacobi preconditioner in hypre.
void SetPrintLevel(int print_lvl)
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
virtual void Mult(const HypreParVector &b, HypreParVector &x) const
Solve Ax=b with hypre's PCG.
void SetMaxIter(int max_iter)
Wrapper for hypre's ParCSR matrix class.
HYPRE_BigInt N() const
Returns the global number of columns.
HYPRE_BigInt * ColPart()
Returns the column partitioning.
MPI_Comm GetComm() const
MPI communicator.
Wrapper for hypre's parallel vector class.
void Print(const char *fname) const
Prints the locally owned rows in parallel.
Class for integration point with weight.
Abstract parallel finite element space.
void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const override
Class for parallel grid function.
void MakeRef(FiniteElementSpace *f, real_t *v) override
Make the ParGridFunction reference external data on a new FiniteElementSpace.
void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const override
void ProjectCoefficient(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, const Array< int > &bdr_attr) override
Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attri...
Base abstract class for first order time dependent operators.
virtual real_t GetTime() const
Read the currently set time.
Vector coefficient that is constant in space and time.
A general vector function coefficient.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
void Debug(const char *basefilename, real_t time)
void buildS1(real_t muInv)
Array< int > thermal_ess_bdr
void buildDiv(MeshDependentCoefficient &InvTcap)
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,...
ParFiniteElementSpace & L2FESpace
ParFiniteElementSpace & HGradFESpace
ParMixedBilinearForm * weakDivC
ParFiniteElementSpace & HCurlFESpace
void buildS2(MeshDependentCoefficient &alpha)
MeshDependentCoefficient * InvTcond
MeshDependentCoefficient * Tcapacity
void buildM2(MeshDependentCoefficient &alpha)
void buildM3(MeshDependentCoefficient &Tcap)
ParDiscreteLinearOperator * curl
void buildM1(MeshDependentCoefficient &sigma)
void GetJouleHeating(ParGridFunction &E_gf, ParGridFunction &w_gf) const
void buildA1(real_t muInv, MeshDependentCoefficient &sigma, real_t dt)
void SetTime(const real_t t_)
Set the current time.
ParDiscreteLinearOperator * grad
Array< int > poisson_ess_bdr
virtual void ImplicitSolve(const real_t dt, const Vector &x, Vector &k)
Solve the equation: k = f(x + dt k, t), for the unknown k at the current time t.
void buildA0(MeshDependentCoefficient &sigma)
real_t ElectricLosses(ParGridFunction &E_gf) const
void buildCurl(real_t muInv)
void buildA2(MeshDependentCoefficient &InvTcond, MeshDependentCoefficient &InvTcap, real_t dt)
virtual ~MagneticDiffusionEOperator()
ParMixedBilinearForm * weakCurl
MeshDependentCoefficient * InvTcap
MagneticDiffusionEOperator(int len, ParFiniteElementSpace &L2FES, ParFiniteElementSpace &HCurlFES, ParFiniteElementSpace &HDivFES, ParFiniteElementSpace &HGradFES, Array< int > &ess_bdr, Array< int > &thermal_ess_bdr, Array< int > &poisson_ess_bdr, real_t mu, std::map< int, real_t > sigmaAttMap, std::map< int, real_t > TcapacityAttMap, std::map< int, real_t > InvTcapAttMap, std::map< int, real_t > InvTcondAttMap)
ParFiniteElementSpace & HDivFESpace
ParMixedBilinearForm * weakDiv
MeshDependentCoefficient * sigma
MeshDependentCoefficient(const std::map< int, real_t > &inputMap, real_t scale=1.0)
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
void SetScaleFactor(const real_t &scale)
ScaledGFCoefficient(GridFunction *gf, MeshDependentCoefficient &input_mdc)
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient at ip.
real_t muInv(const Vector &x)
real_t p_bc(const Vector &x, real_t t)
void edot_bc(const Vector &x, Vector &E)
void mfem_error(const char *msg)