Commit 7ab632ed authored by Christophe Geuzaine's avatar Christophe Geuzaine

Merge branch 'generalizeMHJacNL' into 'master'

Generalize MHJacNL

See merge request !24
parents 0ae8fe3e 8600e878
Pipeline #708 passed with stage
in 13 minutes and 23 seconds
......@@ -10,7 +10,7 @@ variables:
# Docker builds for all branches
# ------------------------------
linux64_docker:
linux64_docker_ci:
image: onelab/ubuntu16.04
script:
- mkdir build
......@@ -21,12 +21,14 @@ linux64_docker:
tags:
- linux64
- docker
except:
- tags
# ------------------------------------------
# Official Linux builds (master branch only)
# ------------------------------------------
linux64_official_petsc_complex:
.linux64_official_petsc_complex: &linux64_official_petsc_complex
only:
- master
script:
......@@ -40,7 +42,7 @@ linux64_official_petsc_complex:
- linux64
- official
linux64_official_petsc_real:
.linux64_official_petsc_real: &linux64_official_petsc_real
only:
- master
script:
......@@ -54,7 +56,7 @@ linux64_official_petsc_real:
- linux64
- official
linux64_official_petsc_real_mh:
.linux64_official_petsc_real_mh: &linux64_official_petsc_real_mh
only:
- master
script:
......@@ -68,11 +70,47 @@ linux64_official_petsc_real_mh:
- linux64
- official
linux64_official_petsc_complex_snapshot:
<<: *linux64_official_petsc_complex
except:
- tags
linux64_official_petsc_complex_release:
variables:
EXTRA_VERSION: ""
<<: *linux64_official_petsc_complex
only:
- /^getdp_.*$/
linux64_official_petsc_real_snapshot:
<<: *linux64_official_petsc_real
except:
- tags
linux64_official_petsc_real_release:
variables:
EXTRA_VERSION: ""
<<: *linux64_official_petsc_real
only:
- /^getdp_.*$/
linux64_official_petsc_real_mh_snapshot:
<<: *linux64_official_petsc_real_mh
except:
- tags
linux64_official_petsc_real_mh_release:
variables:
EXTRA_VERSION: ""
<<: *linux64_official_petsc_real_mh
only:
- /^getdp_.*$/
# --------------------------------------------
# Official Windows builds (master branch only)
# --------------------------------------------
.windows_official_petsc_complex: &ref_windows_official_petsc_complex
.windows_official_petsc_complex: &windows_official_petsc_complex
only:
- master
script:
......@@ -83,7 +121,7 @@ linux64_official_petsc_real_mh:
- bash -c "PKG=`ls getdp-*.zip`; /usr/bin/scp -o StrictHostKeyChecking=no -i /home/geuzaine/.ssh/id_rsa ${PKG} geuzaine@getdp.info:.wwwgetdp/bin/Windows/${PKG/\.zip/c\.zip}"
- bash -c "/usr/bin/ctest -D Experimental -j 1 --output-on-failure"
.windows_official_petsc_real: &ref_windows_official_petsc_real
.windows_official_petsc_real: &windows_official_petsc_real
only:
- master
script:
......@@ -94,7 +132,7 @@ linux64_official_petsc_real_mh:
- bash -c "PKG=`ls getdp-*.zip`; /usr/bin/scp -o StrictHostKeyChecking=no -i /home/geuzaine/.ssh/id_rsa ${PKG} geuzaine@getdp.info:.wwwgetdp/bin/Windows/${PKG/\.zip/r\.zip}"
- bash -c "/usr/bin/ctest -D Experimental -j 1 --output-on-failure"
.windows_official_petsc_real_mh: &ref_windows_official_petsc_real_mh
.windows_official_petsc_real_mh: &windows_official_petsc_real_mh
only:
- master
script:
......@@ -105,47 +143,119 @@ linux64_official_petsc_real_mh:
- bash -c "PKG=`ls getdp-*.zip`; /usr/bin/scp -o StrictHostKeyChecking=no -i /home/geuzaine/.ssh/id_rsa ${PKG} geuzaine@getdp.info:.wwwgetdp/bin/Windows/${PKG/\.zip/r-MH\.zip}"
- bash -c "/usr/bin/ctest -D Experimental -j 1 --output-on-failure"
windows64_official_petsc_complex:
<<: *ref_windows_official_petsc_complex
windows64_official_petsc_complex_snapshot:
<<: *windows_official_petsc_complex
tags:
- windows64
- official
except:
- tags
windows64_official_petsc_real:
<<: *ref_windows_official_petsc_real
windows64_official_petsc_complex_release:
variables:
EXTRA_VERSION: ""
<<: *windows_official_petsc_complex
tags:
- windows64
- official
only:
- /^getdp_.*$/
windows64_official_petsc_real_snapshot:
<<: *windows_official_petsc_real
tags:
- windows64
- official
except:
- tags
windows64_official_petsc_real_mh:
<<: *ref_windows_official_petsc_real_mh
windows64_official_petsc_real_release:
variables:
EXTRA_VERSION: ""
<<: *windows_official_petsc_real
tags:
- windows64
- official
only:
- /^getdp_.*$/
windows32_official_petsc_complex:
<<: *ref_windows_official_petsc_complex
windows64_official_petsc_real_mh_snapshot:
<<: *windows_official_petsc_real_mh
tags:
- windows64
- official
except:
- tags
windows64_official_petsc_real_mh_release:
variables:
EXTRA_VERSION: ""
<<: *windows_official_petsc_real_mh
tags:
- windows64
- official
only:
- /^getdp_.*$/
windows32_official_petsc_complex_snapshot:
<<: *windows_official_petsc_complex
tags:
- windows32
- official
except:
- tags
windows32_official_petsc_real:
<<: *ref_windows_official_petsc_real
windows32_official_petsc_complex_release:
variables:
EXTRA_VERSION: ""
<<: *windows_official_petsc_complex
tags:
- windows32
- official
only:
- /^getdp_.*$/
windows32_official_petsc_real_mh:
<<: *ref_windows_official_petsc_real_mh
windows32_official_petsc_real_snapshot:
<<: *windows_official_petsc_real
tags:
- windows32
- official
except:
- tags
windows32_official_petsc_real_release:
variables:
EXTRA_VERSION: ""
<<: *windows_official_petsc_real
tags:
- windows32
- official
only:
- /^getdp_.*$/
windows32_official_petsc_real_mh_snapshot:
<<: *windows_official_petsc_real_mh
tags:
- windows32
- official
except:
- tags
windows32_official_petsc_real_mh_release:
variables:
EXTRA_VERSION: ""
<<: *windows_official_petsc_real_mh
tags:
- windows32
- official
only:
- /^getdp_.*$/
# ------------------------------------------
# Official MacOS builds (master branch only)
# ------------------------------------------
macos64_official_petsc_complex:
.macos64_official_petsc_complex: &macos64_official_petsc_complex
only:
- master
script:
......@@ -163,7 +273,7 @@ macos64_official_petsc_complex:
- macos64
- official
macos64_official_petsc_real:
.macos64_official_petsc_real: &macos64_official_petsc_real
only:
- master
script:
......@@ -181,7 +291,7 @@ macos64_official_petsc_real:
- macos64
- official
macos64_official_petsc_real_mh:
.macos64_official_petsc_real_mh: &macos64_official_petsc_real_mh
only:
- master
script:
......@@ -199,11 +309,47 @@ macos64_official_petsc_real_mh:
- macos64
- official
macos64_official_petsc_complex_snapshot:
<<: *macos64_official_petsc_complex
except:
- tags
macos64_official_petsc_complex_release:
variables:
EXTRA_VERSION: ""
<<: *macos64_official_petsc_complex
only:
- /^getdp_.*$/
macos64_official_petsc_real_snapshot:
<<: *macos64_official_petsc_real
except:
- tags
macos64_official_petsc_real_release:
variables:
EXTRA_VERSION: ""
<<: *macos64_official_petsc_real
only:
- /^getdp_.*$/
macos64_official_petsc_real_mh_snapshot:
<<: *macos64_official_petsc_real_mh
except:
- tags
macos64_official_petsc_real_mh_release:
variables:
EXTRA_VERSION: ""
<<: *macos64_official_petsc_real_mh
only:
- /^getdp_.*$/
# ----------------------------------------------
# Official source snapshots (master branch only)
# ----------------------------------------------
source_official:
.source_official: &source_official
only:
- master
script:
......@@ -215,3 +361,15 @@ source_official:
tags:
- linux64
- official
source_official_snapshot:
<<: *source_official
except:
- tags
source_official_release:
variables:
EXTRA_VERSION: ""
<<: *source_official
only:
- /^getdp_.*$/
......@@ -516,11 +516,11 @@ void Print_WholeQuantity(List_T *WholeQuantity, List_T *DQ_L)
Message::Check(" ] ]{ %d }", (WQ+k)->Case.MHTransform.NbrPoints);
break;
case WQ_MHJACNL :
Message::Check(" MHJacNL[ ");
case WQ_MHBILINEAR :
Message::Check(" MHBilinear[ ");
Message::Check("%s",
Get_ExpressionName((WQ+k)->Case.MHJacNL.Index));
Message::Check("]{ %d, %d}", (WQ+k)->Case.MHJacNL.NbrPoints, (WQ+k)->Case.MHJacNL.FreqOffSet);
Get_ExpressionName((WQ+k)->Case.MHBilinear.Index));
Message::Check("]{ %d, %d}", (WQ+k)->Case.MHBilinear.NbrPoints, (WQ+k)->Case.MHBilinear.FreqOffSet);
break;
case WQ_TIMEDERIVATIVE :
......
......@@ -683,11 +683,10 @@ struct FemLocalTermActive {
struct IntegralQuantityActive IntegralQuantityActive;
int MHJacNL, MHJacNL_Index, MHJacNL_NbrPointsX, MHJacNL_HarOffSet;
int MHJacNL_NbrArguments;
double MHJacNL_Factor;
double **MHJacNL_H, ***MHJacNL_HH, *MHJacNL_t, *MHJacNL_w;
int MHBilinear, MHBilinear_Index, MHBilinear_NbrPointsX, MHBilinear_HarOffSet;
int MHBilinear_JacNL;
List_T *MHBilinear_WholeQuantity_L;
double **MHBilinear_H, ***MHBilinear_HH, *MHBilinear_t, *MHBilinear_w;
int Full_Matrix;
int NbrEqu, NbrHar, *NumEqu, *NumDof;
......@@ -849,7 +848,7 @@ struct WholeQuantity {
struct { char *SystemName; int DefineSystemIndex;
int DofNumber; } DofValue;
struct { List_T *WholeQuantity_L; int Index, NbrPoints; } MHTransform;
struct { int Index, FunctionType, NbrArguments, NbrParameters, NbrPoints, FreqOffSet; } MHJacNL;
struct { List_T *WholeQuantity_L; int Index, NbrPoints, FreqOffSet; } MHBilinear;
} Case;
};
......@@ -876,8 +875,7 @@ struct WholeQuantity {
#define WQ_MHTIMEINTEGRATION 19
#define WQ_MHTRANSFORM 20
#define WQ_SHOWVALUE 21
#define WQ_MHTIMEEVAL 22
#define WQ_MHJACNL 23
#define WQ_MHBILINEAR 23
#define WQ_POSTSAVE 24
#define WQ_ATANTERIORTIMESTEP 25
#define WQ_CHANGECURRENTPOSITION 26
......
......@@ -289,7 +289,9 @@ Log return tLog;
Log10 return tLog10;
LogSpace return tLogSpace;
MHJacNL return tMHJacNL;
MHBilinear return tMHBilinear;
MHJacNL return tMHBilinear;
MHLinear return tMHTransform;
MHTransform return tMHTransform;
MPI_Barrier return tBarrier;
MPI_BroadcastFields return tBroadcastFields;
......
This diff is collapsed.
......@@ -153,7 +153,7 @@
tDofValue = 369,
tRational = 370,
tMHTransform = 371,
tMHJacNL = 372,
tMHBilinear = 372,
tAppend = 373,
tGroup = 374,
tDefineGroup = 375,
......@@ -537,7 +537,7 @@
#define tDofValue 369
#define tRational 370
#define tMHTransform 371
#define tMHJacNL 372
#define tMHBilinear 372
#define tAppend 373
#define tGroup 374
#define tDefineGroup 375
......
......@@ -255,7 +255,7 @@ struct doubleXstring{
%token tAtan tAtan2 tSinh tCosh tTanh tFabs tFloor tCeil tRound tSign
%token tFmod tModulo tHypot tRand
%token tSolidAngle tTrace tOrder tCrossProduct tDofValue tRational
%token tMHTransform tMHJacNL
%token tMHTransform tMHBilinear
%token tAppend
......@@ -1590,87 +1590,25 @@ WholeQuantity_Single :
List_Add(Current_WholeQuantity_L, &WholeQuantity_S);
}
| tMHJacNL
'[' NameForFunction ArgumentsForFunction ParametersForFunction ']' '{' FExpr ',' FExpr '}'
| tMHBilinear
'[' NameForFunction
{ Last_DofIndexInWholeQuantity = Current_DofIndexInWholeQuantity; }
'[' RecursiveListOfWholeQuantityExpression ']' ']' '{' FExpr ',' FExpr '}'
{
int i;
if((i = List_ISearchSeq(Problem_S.Expression, $3,fcmp_Expression_Name)) >= 0){
WholeQuantity_S.Type = WQ_MHJACNL;
WholeQuantity_S.Case.MHJacNL.Index = i;
WholeQuantity_S.Case.MHJacNL.FunctionType = WQ_EXPRESSION;
WholeQuantity_S.Case.MHJacNL.NbrArguments = $4;
WholeQuantity_S.Case.MHJacNL.NbrParameters = List_Nbr($5);
if($4 < 0) vyyerror(0, "Uncompatible argument for Function (in MHJacNL): %s", $3);
}
/* Built in functions */
else {
Get_Function2NbrForString(F_Function, $3, &FlagError,
&WholeQuantity_S.Case.Function.Fct,
&WholeQuantity_S.Case.Function.NbrParameters,
&WholeQuantity_S.Case.Function.NbrArguments);
WholeQuantity_S.Case.Function.Active = NULL;
if(!FlagError) {
WholeQuantity_S.Type = WQ_MHJACNL;
// arguments
if($4 >= 0) {
if($4 == WholeQuantity_S.Case.Function.NbrArguments) {
WholeQuantity_S.Case.MHJacNL.FunctionType =WQ_BUILTINFUNCTION;
}
else if(WholeQuantity_S.Case.Function.NbrArguments == -1 ||
(WholeQuantity_S.Case.Function.NbrArguments == -2)) {
// && ($4)%2 == 0)) {
WholeQuantity_S.Case.MHJacNL.FunctionType = WQ_BUILTINFUNCTION ;
WholeQuantity_S.Case.Function.NbrArguments = $4;
}
else {
vyyerror(0, "Wrong number of arguments for Function (in MHJacNL) '%s' (%d instead of %d)",
$3, $4, WholeQuantity_S.Case.Function.NbrArguments);
}
}
else {
WholeQuantity_S.Case.MHJacNL.FunctionType = WQ_EXTERNBUILTINFUNCTION;
//WholeQuantity_S.Type = WQ_EXTERNBUILTINFUNCTION;
}
// parameters
WholeQuantity_S.Case.Function.Para = 0;
WholeQuantity_S.Case.Function.String = StringForParameter;
if(WholeQuantity_S.Case.Function.NbrParameters >= 0 &&
WholeQuantity_S.Case.Function.NbrParameters != List_Nbr($5)) {
vyyerror(0, "Wrong number of parameters for Function '%s' (%d instead of %d)",
$3, List_Nbr($5), WholeQuantity_S.Case.Function.NbrParameters);
}
else if(WholeQuantity_S.Case.Function.NbrParameters == -2 && List_Nbr($5)%2 != 0) {
vyyerror(0, "Wrong number of parameters for Function '%s' (%d is not even)",
$3, List_Nbr($5));
}
else {
WholeQuantity_S.Case.Function.NbrParameters = List_Nbr($5);
if(WholeQuantity_S.Case.Function.NbrParameters > 0) {
WholeQuantity_S.Case.Function.Para =
(double *)Malloc
(WholeQuantity_S.Case.Function.NbrParameters * sizeof(double));
for(int i = 0; i < WholeQuantity_S.Case.Function.NbrParameters; i++)
List_Read($5, i, &WholeQuantity_S.Case.Function.Para[i]);
}
}
}
else {
vyyerror(0, "Undefined function '%s' used in MHJacNL", $3);
}
}
WholeQuantity_S.Case.MHJacNL.NbrPoints = (int)$8;
WholeQuantity_S.Case.MHJacNL.FreqOffSet = (int)$10;
if((i = List_ISearchSeq(Problem_S.Expression, $3,fcmp_Expression_Name)) < 0)
vyyerror(0, "Undefined function '%s' used in MHBilinear", $3);
if(Current_DofIndexInWholeQuantity != Last_DofIndexInWholeQuantity)
vyyerror(0, "Dof{} definition cannot be used in MHBilinear");
WholeQuantity_S.Type = WQ_MHBILINEAR;
WholeQuantity_S.Case.MHBilinear.Index = i;
WholeQuantity_S.Case.MHBilinear.WholeQuantity_L = $6;
WholeQuantity_S.Case.MHBilinear.NbrPoints = (int)$10;
WholeQuantity_S.Case.MHBilinear.FreqOffSet = (int)$12;
List_Read(ListOfPointer_L, List_Nbr(ListOfPointer_L)-1, &Current_WholeQuantity_L);
List_Add(Current_WholeQuantity_L, &WholeQuantity_S);
List_Delete($5);
StringForParameter = 0;
}
| tSolidAngle '[' Quantity_Def ']'
{ WholeQuantity_S.Type = WQ_SOLIDANGLE;
WholeQuantity_S.Case.OperatorAndQuantity.Index = $3.Int2;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -281,8 +281,11 @@ void Cal_InitGalerkinTermOfFemEquation(struct EquationTerm * EquationTerm_P,
}
*/
/* initialisation of MHJacNL-term (nonlinear multi-harmonics) if necessary */
Cal_InitGalerkinTermOfFemEquation_MHJacNL(EquationTerm_P);
// TODO: if JACNL_, say to Cal_Init to assemble later in Jac, otherwise
// assemble in the system matrix
/* initialisation of MHBilinear-term (nonlinear multi-harmonics) if necessary */
Cal_InitGalerkinTermOfFemEquation_MHBilinear(EquationTerm_P);
/* Full_Matrix */
if (EquationTerm_P->Case.LocalTerm.Full_Matrix) {
......@@ -539,13 +542,13 @@ void Cal_GalerkinTermOfFemEquation(struct Element * Element,
FI = EquationTerm_P->Case.LocalTerm.Active ;
/* treatment of MHJacNL-term in separate routine */
if (FI->MHJacNL) {
/* treatment of MHBilinear-term in separate routine */
if (FI->MHBilinear) {
/* if only the RHS of the system is to be calculated
(in case of adaptive relaxation of the Newton-Raphson scheme)
the (expensive and redundant) calculation of this term can be skipped */
if (!Flag_RHS)
Cal_GalerkinTermOfFemEquation_MHJacNL(Element, EquationTerm_P, QuantityStorage_P0) ;
Cal_GalerkinTermOfFemEquation_MHBilinear(Element, EquationTerm_P, QuantityStorage_P0) ;
return;
}
......
......@@ -20,9 +20,9 @@ void Cal_GalerkinTermOfFemEquation(struct Element * Element,
void Cal_EndGalerkinTermOfFemEquation();
/* In F_MultiHar */
void Cal_InitGalerkinTermOfFemEquation_MHJacNL(struct EquationTerm * EquationTerm_P);
void Cal_GalerkinTermOfFemEquation_MHJacNL(struct Element * Element,
struct EquationTerm * EquationTerm_P,
struct QuantityStorage *QuantityStorage_P0);
void Cal_InitGalerkinTermOfFemEquation_MHBilinear(struct EquationTerm * EquationTerm_P);
void Cal_GalerkinTermOfFemEquation_MHBilinear(struct Element * Element,
struct EquationTerm * EquationTerm_P,
struct QuantityStorage *QuantityStorage_P0);
#endif
......@@ -64,25 +64,25 @@ void Cal_GlobalTermOfFemEquation(int Num_Region,
Element.Num = NO_ELEMENT ;
switch (EquationTerm_P->Case.GlobalTerm.Term.TypeTimeDerivative) {
case NODT_ : Function_AssembleTerm = Cal_AssembleTerm_NoDt ; break ;
case DTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDof ; break ;
case DT_ : Function_AssembleTerm = Cal_AssembleTerm_Dt ; break ;
case DTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDof ; break ;
case DTDT_ : Function_AssembleTerm = Cal_AssembleTerm_DtDt ; break ;
case DTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDof ; break ;
case DTDTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDof ; break ;
case DTDTDTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDtDof ; break ;
case NEVERDT_ : Function_AssembleTerm = Cal_AssembleTerm_NeverDt ; break ;
case JACNL_ : Function_AssembleTerm = Cal_AssembleTerm_JacNL ; break ;
case DTDOFJACNL_ : Function_AssembleTerm = Cal_AssembleTerm_DtDofJacNL ; break ;
case NODT_ : Function_AssembleTerm = Cal_AssembleTerm_NoDt ; break ;
case DTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDof ; break ;
case DT_ : Function_AssembleTerm = Cal_AssembleTerm_Dt ; break ;
case DTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDof ; break ;
case DTDT_ : Function_AssembleTerm = Cal_AssembleTerm_DtDt ; break ;
case DTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDof ; break ;
case DTDTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDof ; break ;
case DTDTDTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDtDof ; break ;
case NEVERDT_ : Function_AssembleTerm = Cal_AssembleTerm_NeverDt ; break ;
case JACNL_ : Function_AssembleTerm = Cal_AssembleTerm_JacNL ; break ;
case DTDOFJACNL_ : Function_AssembleTerm = Cal_AssembleTerm_DtDofJacNL ; break ;
// nleigchange
case NLEIG1DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig1Dof ; break ;
case NLEIG2DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig2Dof ; break ;
case NLEIG3DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig3Dof ; break ;
case NLEIG4DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig4Dof ; break ;
case NLEIG5DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig5Dof ; break ;
case NLEIG6DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig6Dof ; break ;
default : Message::Error("Unknown type of operator for Global term"); return;
case NLEIG1DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig1Dof ; break ;
case NLEIG2DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig2Dof ; break ;
case NLEIG3DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig3Dof ; break ;
case NLEIG4DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig4Dof ; break ;
case NLEIG5DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig5Dof ; break ;
case NLEIG6DOF_ : Function_AssembleTerm = Cal_AssembleTerm_NLEig6Dof ; break ;
default : Message::Error("Unknown type of operator for Global term"); return;
}
//+++ Num_Region, QuantityStorage_P0: not used any more
......@@ -94,60 +94,47 @@ void Cal_GlobalTermOfFemEquation(int Num_Region,
QuantityStorageDof_P->BasisFunction[0].Dof = DofForNoDof_P ;
}
/* search for MHJacNL-term(s) */
// search for MHBilinear-term(s)
WholeQuantity_L = EquationTerm_P->Case.GlobalTerm.Term.WholeQuantity ;
WholeQuantity_P0 = (struct WholeQuantity*)List_Pointer(WholeQuantity_L, 0) ;
i_WQ = 0 ; while ( i_WQ < List_Nbr(WholeQuantity_L) &&
(WholeQuantity_P0 + i_WQ)->Type != WQ_MHJACNL) i_WQ++ ;
(WholeQuantity_P0 + i_WQ)->Type != WQ_MHBILINEAR) i_WQ++ ;
if (i_WQ < List_Nbr(WholeQuantity_L) ) {
if (i_WQ < List_Nbr(WholeQuantity_L) ) { // Multi-harmonic case
if(Message::GetVerbosity() == 10)
Message::Info("MHJacNL in Global term");
Message::Info("MHBilinear in Global term");
if (QuantityStorageEqu_P != QuantityStorageDof_P){
Message::Error("Global term with MHJacNL is not symmetric ?!");
Message::Error("Global term with MHBilinear is not symmetric ?!");
return;
}
QuantityStorage_P = QuantityStorageEqu_P ;
if (List_Nbr(WholeQuantity_L) == 4){
if (i_WQ != 1 ||
EquationTerm_P->Case.GlobalTerm.Term.DofIndexInWholeQuantity != 2 ||
(WholeQuantity_P0 + 3)->Type != WQ_BINARYOPERATOR ||
(WholeQuantity_P0 + 3)->Case.Operator.TypeOperator != OP_TIME){
Message::Error("Not allowed expression in Global term with MHJacNL (case 1)");
if (List_Nbr(WholeQuantity_L) == 3){
if (i_WQ != 0 ||
EquationTerm_P->Case.GlobalTerm.Term.DofIndexInWholeQuantity != 1 ||
(WholeQuantity_P0 + 2)->Type != WQ_BINARYOPERATOR ||
(WholeQuantity_P0 + 2)->Case.Operator.TypeOperator != OP_TIME){
Message::Error("Not allowed expression in Global term with MHBilinear (case 1)");
return;
}
Factor = 1.;
}
else if (List_Nbr(WholeQuantity_L) == 6){
if ((WholeQuantity_P0 + 0)->Type != WQ_CONSTANT ||
i_WQ != 2 ||
(WholeQuantity_P0 + 3)->Type != WQ_BINARYOPERATOR ||
(WholeQuantity_P0 + 3)->Case.Operator.TypeOperator != OP_TIME ||
EquationTerm_P->Case.GlobalTerm.Term.DofIndexInWholeQuantity != 3 ||
(WholeQuantity_P0 + 5)->Type != WQ_BINARYOPERATOR ||
(WholeQuantity_P0 + 5)->Case.Operator.TypeOperator != OP_TIME){
Message::Error("Not allowed expression in Global term with MHJacNL (case 2)");
return;
}
Factor = WholeQuantity_P0->Case.Constant ;
}
else {
Message::Error("Not allowed expression in Global term with MHJacNL (%d terms) ",
Message::Error("Not allowed expression in Global term with MHBilinear (%d terms) ",
List_Nbr(WholeQuantity_L));
return;
}
if (EquationTerm_P->Case.GlobalTerm.Term.TypeTimeDerivative != JACNL_){
Message::Error("MHJacNL can only be used with JACNL") ;
Message::Error("MHBilinear can only be used with JACNL") ;
return;
}
Expression_P = (struct Expression *)List_Pointer
(Problem_S.Expression, (WholeQuantity_P0 + i_WQ)->Case.MHJacNL.Index) ;
(Problem_S.Expression, (WholeQuantity_P0 + i_WQ)->Case.MHBilinear.Index) ;
MH_Get_InitData(2, (WholeQuantity_P0 + i_WQ)->Case.MHJacNL.NbrPoints,
MH_Get_InitData(2, (WholeQuantity_P0 + i_WQ)->Case.MHBilinear.NbrPoints,
&NbrPointsX, &H, &HH,
&time, &weight) ;
......@@ -183,15 +170,15 @@ void Cal_GlobalTermOfFemEquation(int Num_Region,
for (iHar = 0 ; iHar < NbrHar ; iHar++)
t_Value.Val[0] += H[iTime][iHar] * Val_Dof[iHar] ;
// To generalize: Function in MHBilinear has 1 argument (e.g. Resistance[{Iz}])
Get_ValueOfExpression(Expression_P, QuantityStorage_P0,
Current.u, Current.v, Current.w, &t_Value, 1); //To generalize: Function in MHJacNL has 1 argument (e.g. Resistance[{Iz}])
Current.u, Current.v, Current.w, &t_Value, 1);
for (iHar = 0 ; iHar < NbrHar ; iHar++)
for (jHar = OFFSET ; jHar <= iHar ; jHar++)
E_D[iHar][jHar] += HH[iTime][iHar][jHar] * t_Value.Val[0] ;
} /* for i_IntPoint ... */
} // for i_IntPoint...
Current.NbrHar = NbrHar ;
......@@ -216,7 +203,7 @@ void Cal_GlobalTermOfFemEquation(int Num_Region,
}
}
else {
else { // standard (non multi-harmonic) bilinear term
vBFxDof[0].Type = SCALAR ; vBFxDof[0].Val[0] = 1. ;
if(Current.NbrHar > 1) Cal_SetHarmonicValue(&vBFxDof[0]) ;
......@@ -263,9 +250,9 @@ void Cal_GlobalTermOfFemEquation_old(int Num_Region,
case DT_ : Function_AssembleTerm = Cal_AssembleTerm_Dt ; break ;
case DTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDof ; break ;
case DTDT_ : Function_AssembleTerm = Cal_AssembleTerm_DtDt ; break ;
case DTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDof ; break ;
case DTDTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDof ; break ;
case DTDTDTDTDTDOF_: Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDtDof ; break ;
case DTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDof ; break ;
case DTDTDTDTDOF_ : Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDof ; break ;
case DTDTDTDTDTDOF_: Function_AssembleTerm = Cal_AssembleTerm_DtDtDtDtDtDof ; break ;
case NEVERDT_ : Function_AssembleTerm = Cal_AssembleTerm_NeverDt ; break ;
case JACNL_ : Function_AssembleTerm = Cal_AssembleTerm_JacNL ; break ;
case DTDOFJACNL_ : Function_AssembleTerm = Cal_AssembleTerm_DtDofJacNL ; break ;
......
......@@ -106,13 +106,13 @@ void Cal_SmallFemTermOfFemEquation(struct Element* Element,
struct FemLocalTermActive* FI = EquationTerm_P->Case.LocalTerm.Active;
Current.flagAssDiag = 0; /*+++prov*/
/* treatment of MHJacNL-term in separate routine */
if(FI->MHJacNL){
/* treatment of MHBilinear-term in separate routine */
if(FI->MHBilinear){