-
Notifications
You must be signed in to change notification settings - Fork 47
3 d0 d coupling cap #381
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
3 d0 d coupling cap #381
Changes from all commits
262c857
338486e
dea38e0
5fbf4fb
73e71f6
dc877cd
7c4ab5f
59ed2da
31af55e
168a140
fca7f47
2665879
e0340ac
c7797cd
91802e1
f944e98
55af584
7945d6e
2bfc8b7
944b0c8
fa7f300
4be201c
276749c
18c5611
5b06340
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,9 @@ void add_bc_mul(FSILS_lhsType& lhs, const BcopType op_Type, const int dof, const | |
| Vector<double> coef(lhs.nFaces); | ||
| Array<double> v(dof,lhs.nNo); | ||
|
|
||
| //Setting coef depending on adding resistance to stiffness or | ||
| //computing preconditioner | ||
|
|
||
| if (op_Type == BcopType::BCOP_TYPE_ADD) { | ||
| for (int i = 0; i < lhs.nFaces; i++) { | ||
| coef(i) = lhs.face[i].res; | ||
|
|
@@ -70,6 +73,25 @@ void add_bc_mul(FSILS_lhsType& lhs, const BcopType op_Type, const int dof, const | |
|
|
||
| for (int faIn = 0; faIn < lhs.nFaces; faIn++) { | ||
| auto& face = lhs.face[faIn]; | ||
| // Cap faces do not contribute to the tangent matrix | ||
| if (face.isCap) { | ||
| continue; | ||
| } | ||
|
|
||
| // In the following calculations, we are computing the product of the | ||
| // coupled BC tangent contribution with the vector X (refer to Moghadam | ||
| // et al. 2013 eq. 27). This is computed by first constructing the vector | ||
| // v, which one of the integrals found in the expression, int{N_A * n_i} dGamma. | ||
| // Then, v is dotted with X to yield a quantity S. Then S is multiplied by | ||
| // by v again, and also multiplied by the appropriate coefficients in | ||
| // the expression. | ||
| // The calculations are complicated somewhat if there is a capping surface, | ||
| // but these complications are explained below. | ||
|
|
||
|
|
||
| // Calculating S, which is the inner product of the right integral (v) and | ||
| // the vector to be multiplied (X). | ||
|
|
||
dseyler marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| int nsd = std::min(face.dof, dof); | ||
|
|
||
| if (face.coupledFlag) { | ||
|
|
@@ -85,15 +107,32 @@ void add_bc_mul(FSILS_lhsType& lhs, const BcopType op_Type, const int dof, const | |
| } | ||
| // Computing S = coef * v^T * X | ||
| double S = coef(faIn) * dot::fsils_dot_v(dof, lhs.mynNo, lhs.commu, v, X); | ||
|
|
||
| // Add cap surface contribution to S | ||
| // Cap surfaces contribute to flow rate but not pressure | ||
| if (face.isCapped) { | ||
| int faInCap = face.faInCap; | ||
| auto& faceCap = lhs.face[faInCap]; | ||
|
|
||
| Array<double> vcap(dof,lhs.nNo); | ||
| vcap = 0.0; | ||
| for (int a = 0; a < faceCap.nNo; a++) { | ||
| int Ac = faceCap.glob(a); | ||
| for (int i = 0; i < nsd; i++) { | ||
| vcap(i,Ac) = faceCap.valM(i,a); | ||
| } | ||
| } | ||
| // Add capping surface contribution to S | ||
| S = S + coef(faIn) * dot::fsils_dot_v(dof, lhs.mynNo, lhs.commu, vcap, X); | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code in the |
||
|
|
||
| // Computing Y = Y + v * S | ||
| for (int a = 0; a < face.nNo; a++) { | ||
| int Ac = face.glob(a); | ||
| for (int i = 0; i < nsd; i++) { | ||
| Y(i,Ac) = Y(i,Ac) + v(i,Ac)*S; | ||
| } | ||
| } | ||
|
|
||
| } | ||
| // If face is not shared across procs | ||
| else { | ||
|
|
@@ -105,8 +144,29 @@ void add_bc_mul(FSILS_lhsType& lhs, const BcopType op_Type, const int dof, const | |
| S = S + face.valM(i,a)*X(i,Ac); | ||
| } | ||
| } | ||
| S = coef(faIn) * S; | ||
|
|
||
| // If capping surface is present add its contribution to S | ||
| if (face.isCapped) { | ||
| int faInCap = face.faInCap; | ||
| auto& faceCap = lhs.face[faInCap]; | ||
|
|
||
| if (!faceCap.coupledFlag) { | ||
| std::cerr << "ADDBCMUL(): Cap face is not coupled. Probably cap face has zero resistance." << std::endl; | ||
| throw std::runtime_error("FSILS: FATAL ERROR"); | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check this condition earlier ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also now checked in baf_ini |
||
|
|
||
| for (int a = 0; a < faceCap.nNo; a++) { | ||
| int Ac = faceCap.glob(a); | ||
| for (int i = 0; i < nsd; i++) { | ||
| S = S + faceCap.valM(i,a)*X(i,Ac); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Multiply S by the resistance or related quantity if | ||
| // preconditioning | ||
| S = coef(faIn) * S; | ||
|
|
||
| // Computing Y = Y + v * S | ||
| for (int a = 0; a < face.nNo; a++) { | ||
| int Ac = face.glob(a); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ namespace fsi_linear_solver { | |
| /// lhs.face[faIn].valM | ||
| // | ||
| void fsils_bc_create(FSILS_lhsType& lhs, int faIn, int nNo, int dof, BcType BC_type, const Vector<int>& gNodes, | ||
| const Array<double>& Val) | ||
| const Array<double>& Val, bool isCap) | ||
| { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a developer first sees the variable named If this has something do with a coupling cap then name it to reflect that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking of changing the name of the bool to isCapSurface and removing mentions of the word "virtual" so as not to confuse users |
||
| using namespace consts; | ||
|
|
||
|
|
@@ -60,6 +60,7 @@ void fsils_bc_create(FSILS_lhsType& lhs, int faIn, int nNo, int dof, BcType BC_t | |
| dmsg << "Val.size(): " << Val.size(); | ||
| dmsg << "Val.nrows: " << Val.nrows_; | ||
| dmsg << "Val.ncols: " << Val.ncols_; | ||
| dmsg << "isCap: " << isCap; | ||
| #endif | ||
|
|
||
| if (faIn >= lhs.nFaces) { | ||
|
|
@@ -71,9 +72,12 @@ void fsils_bc_create(FSILS_lhsType& lhs, int faIn, int nNo, int dof, BcType BC_t | |
| throw std::runtime_error("FSILS: faIn is smaller than zero"); | ||
| } | ||
|
|
||
| lhs.face[faIn].foC = true; | ||
| lhs.face[faIn].nNo = nNo; | ||
| lhs.face[faIn].dof = dof; | ||
| lhs.face[faIn].bGrp = BC_type; | ||
| // Set cap flag for face | ||
| lhs.face[faIn].isCap = isCap; | ||
|
|
||
| lhs.face[faIn].glob.resize(nNo); | ||
| lhs.face[faIn].val.resize(dof,nNo); | ||
|
|
@@ -116,7 +120,6 @@ void fsils_bc_create(FSILS_lhsType& lhs, int faIn, int nNo, int dof, BcType BC_t | |
| v(i,Ac) = lhs.face[faIn].val(i,a); | ||
| } | ||
| } | ||
|
|
||
| fsils_commuv(lhs, dof, v); | ||
|
|
||
| for (int a = 0; a < nNo; a++) { | ||
|
|
@@ -184,9 +187,8 @@ void fsils_bc_update(FSILS_lhsType& lhs, int faIn, int nNo, int dof, const Array | |
| } | ||
|
|
||
| // Communicate update among procs | ||
| if (lhs.face[faIn].sharedFlag){ | ||
| if (lhs.face[faIn].sharedFlag && !lhs.face[faIn].isCap) { | ||
| Array<double> v(dof,lhs.nNo); | ||
| v = 0.0; | ||
|
|
||
| for (int a = 0; a < nNo; a++) { | ||
| int Ac = lhs.face[faIn].glob(a); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.