How to setup robin boundary condition

205 views
Skip to first unread message

Runlai Wan

unread,
May 17, 2016, 11:04:33 PM5/17/16
to moose-users
Hi, I just start learning MOOSE. I have this BC : du/dx = b * dv/dx, where u and v are both variables and b constant coefficient, so how to implement this Robin BC ( is this Robin BC? ) in MOOSE?
Thank you.

Runlai 

YananHe

unread,
May 17, 2016, 11:38:58 PM5/17/16
to moose-users
Hi Runlai

You can take a look at

CoupledConvectiveFlux BC.
 http://www.mooseframework.com/docs/doxygen/modules/classCoupledConvectiveFlux.html

May it help.

Yanan.


------------------ Original ------------------
From:  "Runlai Wan";<runl...@gmail.com>;
Date:  May 18, 2016
To:  "moose-users"<moose...@googlegroups.com>;
Subject:  How to setup robin boundary condition

Hi, I just start learning MOOSE. I have this BC : du/dx = b * dv/dx, where u and v are both variables and b constant coefficient, so how to implement this Robin BC ( is this Robin BC? ) in MOOSE?
Thank you.

Runlai 

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/346cea6f-169b-4a96-aa74-e6e807b6b8c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Runlai Wan

unread,
May 18, 2016, 10:20:06 AM5/18/16
to moose-users, 9722...@qq.com
Hi Yanan,

Thank you for your answer. I will look at that.

Runlai

在 2016年5月17日星期二 UTC-4下午11:38:58,YananHe写道:

Derek Gaston

unread,
May 18, 2016, 3:34:48 PM5/18/16
to moose-users, 9722...@qq.com
In general a Robin BC is implemented by inheriting from IntegratedBC and overriding computeQpResidual() and optionally computeQpJacobian() and ComputeQpOffDiagJacobian().

The example that shows how to do that (including how to couple to another variable) is here: https://github.com/idaholab/moose/blob/devel/examples/ex04_bcs/include/bcs/CoupledNeumannBC.h

You can read about IntegratedBCs here: http://mooseframework.org/wiki/MooseSystems/BCs/

Derek

Runlai Wan

unread,
May 18, 2016, 3:57:48 PM5/18/16
to moose-users, 9722...@qq.com
Hi Derek,

Thank you so much for the detailed information. I will look at the material and example first and see if I can implement the Robin BC.

Runlai

在 2016年5月18日星期三 UTC-4下午3:34:48,Derek Gaston写道:

Runlai Wan

unread,
May 18, 2016, 4:19:36 PM5/18/16
to moose-users, 9722...@qq.com
Hi Derek,

I just looked into ex04 CoupledNeumannBC. It seems simple to transform a coupledNeumannBC to a coupledRonbinBC as the one I mentioned above. What I need to do is replace the coupledValue() with a coupledGradient(), and then rewrite the computeQpResidual() as: return -_test[_i][_qp]*_alpha*_grad_some_variable[_qp];.Is my understanding correct?

Thank you.

Runlai


在 2016年5月18日星期三 UTC-4下午3:34:48,Derek Gaston写道:
In general a Robin BC is implemented by inheriting from IntegratedBC and overriding computeQpResidual() and optionally computeQpJacobian() and ComputeQpOffDiagJacobian().

Roma Gurung

unread,
May 18, 2016, 9:35:53 PM5/18/16
to moose-users, 9722...@qq.com
Hi Wan Runlai,
As tutorial, i am also learning RobinBCs and FunctionRobinBCs from the source provided by Derek.
The C++ source files can be found at:
https://github.com/anilkunwar/danphe/tree/master/src/bcs
and the corresponding header files are at:
https://github.com/anilkunwar/danphe/tree/master/include/bcs

Cheers.


Yours Sincerely,
Anil Kunwar

Cody Permann

unread,
May 18, 2016, 9:53:51 PM5/18/16
to moose-users, 9722...@qq.com
I think someone may have implemented one at some point. I'm on my phone or I'd look around for you. Check the modules/misc area.

Cody

Roma Gurung

unread,
May 18, 2016, 9:57:01 PM5/18/16
to moose-users, 9722...@qq.com
Hi,
For detailed references, you can see the source and header files for heat conduction modules BCs.
1. https://github.com/idaholab/moose/tree/devel/modules/heat_conduction/src/bcs
2. https://github.com/idaholab/moose/tree/devel/modules/heat_conduction/include/bcs

With best regards,
Anil

On Thursday, May 19, 2016 at 4:19:36 AM UTC+8, Runlai Wan wrote:

Runlai Wan

unread,
May 19, 2016, 12:11:24 PM5/19/16
to moose-users, 9722...@qq.com
Hi Anil,

Thank you so much. The links are very helpful.

Runlai

在 2016年5月18日星期三 UTC-4下午9:57:01,Roma Gurung写道:

Runlai Wan

unread,
May 19, 2016, 5:31:24 PM5/19/16
to moose-users, 9722...@qq.com
Hi,

When I was implementing the BC: du/dx = u * dv/dx, where u and v are variables, I got this error message:

error: no suitable conversioon from "libMesh::TypeVector<libMesh::Real={double}>" to "libMesh::Real={double}" exists
    return _test[_i][_qp]*(_u[_qp]*_grad_some_variable[_qp]);
              ^
 error: no suitable conversioon from "libMesh::TypeVector<libMesh::Real={double}>" to "libMesh::Real={double}" exists
    return _test[_i][_qp]*(_grad_some_variable[_qp]*_phi[_j][_qp]);
              ^
It seems _grad_some_variable[_qp] is vector while _u[_qp] and _phi[_j][_qp] are not. So how do I modify my codes (see below) to make it correct?


RobinBCS::RobinBCS(const InputParameters & parameters) :
    IntegratedBC(parameters),
    _grad_some_variable(coupledGradient("robin_variable"))

{}

Real RobinBCS::computeQpResidual()
{
  return _test[_i][_qp]*(_u[_qp]*_grad_some_variable[_qp]);
}

Real RobinBCS::computeQpJacobian()
{
  return _test[_i][_qp]*(_grad_some_variable[_qp]*_phi[_j][_qp]);
}


Thank you.
Runlai



在 2016年5月18日星期三 UTC-4下午9:57:01,Roma Gurung写道:
Hi,

Andrs, David

unread,
May 19, 2016, 6:19:55 PM5/19/16
to moose...@googlegroups.com, 9722...@qq.com
On Thu, May 19, 2016 at 3:31 PM, Runlai Wan <runl...@gmail.com> wrote:
Hi,

When I was implementing the BC: du/dx = u * dv/dx, where u and v are variables, I got this error message:

error: no suitable conversioon from "libMesh::TypeVector<libMesh::Real={double}>" to "libMesh::Real={double}" exists
    return _test[_i][_qp]*(_u[_qp]*_grad_some_variable[_qp]);
              ^
 error: no suitable conversioon from "libMesh::TypeVector<libMesh::Real={double}>" to "libMesh::Real={double}" exists
    return _test[_i][_qp]*(_grad_some_variable[_qp]*_phi[_j][_qp]);
              ^
It seems _grad_some_variable[_qp] is vector while _u[_qp] and _phi[_j][_qp] are not. So how do I modify my codes (see below) to make it correct?


​There is typically a normal in the surface integral, so you need to multiply the gradient by it.​..
--
David

 

Andrs, David

unread,
May 19, 2016, 6:22:35 PM5/19/16
to moose...@googlegroups.com, 9722...@qq.com
On Thu, May 19, 2016 at 4:19 PM, Andrs, David <david...@inl.gov> wrote:
On Thu, May 19, 2016 at 3:31 PM, Runlai Wan <runl...@gmail.com> wrote:
Hi,

When I was implementing the BC: du/dx = u * dv/dx, where u and v are variables, I got this error message:

error: no suitable conversioon from "libMesh::TypeVector<libMesh::Real={double}>" to "libMesh::Real={double}" exists
    return _test[_i][_qp]*(_u[_qp]*_grad_some_variable[_qp]);
              ^
 error: no suitable conversioon from "libMesh::TypeVector<libMesh::Real={double}>" to "libMesh::Real={double}" exists
    return _test[_i][_qp]*(_grad_some_variable[_qp]*_phi[_j][_qp]);
              ^
It seems _grad_some_variable[_qp] is vector while _u[_qp] and _phi[_j][_qp] are not. So how do I modify my codes (see below) to make it correct?


​There is typically a normal in the surface integral, so you need to multiply the gradient by it.​..

​Or, you pick out the component of the gradient by: _grad[_qp](component), where component is 0, 1, 2 for x, y, z.
--
David​

Runlai Wan

unread,
May 19, 2016, 8:03:23 PM5/19/16
to moose-users, 9722...@qq.com
That makes sense!

Thank you, David.

Runlai

在 2016年5月19日星期四 UTC-4下午6:22:35,david.andrs写道:
Reply all
Reply to author
Forward
0 new messages