Comments (6)
Hello @YHDAUT, you can check the shifted
miniapp as an example. There we define our own integrators over the boundary. But the main idea is to create a class that inherits from BilinearFormIntegrator
(or LinearFormIntegrator
) and then you would overload the assemble function. For integrals on the domain, as in your case, you would need to overload the AssembleElementMatrix
function.
from mfem.
Hello @atallah727 . Many thanks. May I ask where I can see this shifted miniapp example. Are there any example defining own integrators over the domain? Your comments help me a lot. Thanks..
from mfem.
You can find the shifted miniapp in the miniapps
directory. For more details on writing domain integrators you can refer to this documentation page: https://mfem.org/integration/. Look for the section titled: Writing Custom Integrators .
from mfem.
Hi @atallah727 . Many thanks for your comments. This is really a great help to me. :)
from mfem.
Great. I will go ahead and close this issue. But please feel free to reopen it.
from mfem.
Hi @atallah727 it seems to me not trivial to implement the mixed bilinear form :
\partial_x u \partial_x v + \partial_y u \partial_y v - \partial_z u \partial_z v
I am trying to make this new bilinear form from the standard
diffusion integrator in MFEM.
However, is there any way/example to show how to
select derivative in each direction x, y, z
\partial_x u \partial_x v
\partial_y u \partial_y v
\partial_z u \partial_z v
Then perform summation or subtraction of these terms.
Thanks
void MyDiffusionIntegrator::AssembleElementMatrix2(
const FiniteElement &trial_fe, const FiniteElement &test_fe,
ElementTransformation &Trans, DenseMatrix &elmat)
{
int tr_nd = trial_fe.GetDof();
int te_nd = test_fe.GetDof();
dim = trial_fe.GetDim();
int spaceDim = Trans.GetSpaceDim();
bool square = (dim == spaceDim);
double w;
if (VQ)
{
MFEM_VERIFY(VQ->GetVDim() == spaceDim,
"Unexpected dimension for VectorCoefficient");
}
if (MQ)
{
MFEM_VERIFY(MQ->GetWidth() == spaceDim,
"Unexpected width for MatrixCoefficient");
MFEM_VERIFY(MQ->GetHeight() == spaceDim,
"Unexpected height for MatrixCoefficient");
}
#ifdef MFEM_THREAD_SAFE
DenseMatrix dshape(tr_nd, dim), dshapedxt(tr_nd, spaceDim);
DenseMatrix te_dshape(te_nd, dim), te_dshapedxt(te_nd, spaceDim);
DenseMatrix invdfdx(dim, spaceDim);
DenseMatrix dshapedxt_m(te_nd, MQ ? spaceDim : 0);
DenseMatrix M(MQ ? spaceDim : 0);
Vector D(VQ ? VQ->GetVDim() : 0);
#else
dshape.SetSize(tr_nd, dim);
dshapedxt.SetSize(tr_nd, spaceDim);
te_dshape.SetSize(te_nd, dim);
te_dshapedxt.SetSize(te_nd, spaceDim);
invdfdx.SetSize(dim, spaceDim);
dshapedxt_m.SetSize(te_nd, MQ ? spaceDim : 0);
M.SetSize(MQ ? spaceDim : 0);
D.SetSize(VQ ? VQ->GetVDim() : 0);
#endif
elmat.SetSize(te_nd, tr_nd);
const IntegrationRule *ir = IntRule ? IntRule : &GetRule(trial_fe, test_fe);
elmat = 0.0;
for (int i = 0; i < ir->GetNPoints(); i++)
{
const IntegrationPoint &ip = ir->IntPoint(i);
trial_fe.CalcDShape(ip, dshape);
test_fe.CalcDShape(ip, te_dshape);
Trans.SetIntPoint(&ip);
CalcAdjugate(Trans.Jacobian(), invdfdx);
w = Trans.Weight();
w = ip.weight / (square ? w : w*w*w);
Mult(dshape, invdfdx, dshapedxt);
Mult(te_dshape, invdfdx, te_dshapedxt);
// invdfdx, dshape, and te_dshape no longer needed
if (MQ)
{
MQ->Eval(M, Trans, ip);
M *= w;
Mult(te_dshapedxt, M, dshapedxt_m);
AddMultABt(dshapedxt_m, dshapedxt, elmat);
}
else if (VQ)
{
VQ->Eval(D, Trans, ip);
D *= w;
AddMultADAt(dshapedxt, D, elmat);
}
else
{
if (Q)
{
w *= Q->Eval(Trans, ip);
}
dshapedxt *= w;
AddMultABt(te_dshapedxt, dshapedxt, elmat);
}
}
}
from mfem.
Related Issues (20)
- Possible memory leakage of HypreParMatrix HOT 2
- Evaluating integrals of shape functions in neighboring elements HOT 13
- 【VectorDomainLFIntegrator does not provided enough constructors】 HOT 3
- Changes to `socketbuf` result in `SocketStream` objects returning true even if not connected (e.g., to GLVis) HOT 5
- 【Is PWFunctionCoefficient possible?】 HOT 1
- Strange failure in LOBPCG::Solve() HOT 5
- Coefficient Projection for IGA Spaces HOT 5
- Apply double cross of a function by normal vector for Nedelec space. HOT 1
- Fix the FMS unit test and the FMS example file `data/star-q3.fms`
- 3D electromagnetic proximity effect
- Implement AssemblePABoundary for VectorFEMassIntegrator HOT 2
- Suggested added feature: OptionsParser taking input from file
- HypreBoomerAMG preconditioner memory leaks HOT 7
- Error calling CUDA mfem::forall() with MFEM as a third party library HOT 3
- Maybe inconsistence of "domain_integes_marker" when construct a bilinearform with existed one
- Unit test "LOR AMS" failure with Umpire HOT 1
- parallel install error! HOT 9
- MFEM for helmoltz equation HOT 13
- MFEM for wave equation HOT 2
- Suggestion : Adding safe versions of `Operator` functions.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mfem.