166 INTEGER(INTG),
INTENT(OUT) :: ERR
169 INTEGER(INTG) :: column_idx,dof_idx,LINEAR_MATRIX_START,matrix_idx,NUMBER_OF_ROWS,NUMBER_OF_GLOBAL_ROWS,row_idx, &
170 & TOTAL_NUMBER_OF_ROWS,variable_idx,variable_type
179 TYPE(
field_type),
POINTER :: DEPENDENT_FIELD,SOURCE_FIELD
183 enters(
"EQUATIONS_MAPPING_CALCULATE",err,error,*999)
185 IF(
ASSOCIATED(equations_mapping))
THEN 186 equations=>equations_mapping%EQUATIONS
187 IF(
ASSOCIATED(equations))
THEN 188 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
189 IF(
ASSOCIATED(create_values_cache))
THEN 190 equations_set=>equations%EQUATIONS_SET
191 IF(
ASSOCIATED(equations_set))
THEN 192 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
193 IF(
ASSOCIATED(dependent_field))
THEN 194 IF(create_values_cache%SOURCE_VARIABLE_TYPE/=0)
THEN 195 IF(
ASSOCIATED(equations_set%SOURCE))
THEN 196 source_field=>equations_set%SOURCE%SOURCE_FIELD
197 IF(.NOT.
ASSOCIATED(source_field))
THEN 198 CALL flagerror(
"Source field is not associated.",err,error,*999)
201 CALL flagerror(
"Equations set source is not associated.",err,error,*999)
205 linear_matrix_start=1
206 SELECT CASE(equations%TIME_DEPENDENCE)
208 SELECT CASE(equations%LINEARITY)
211 IF(create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES>=1)
THEN 212 linear_matrix_start=2
213 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(1))%PTR
215 CALL flagerror(
"The number of linear equations matrices must be at least one for a linear equations set.", &
221 IF(create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES>=1)
THEN 222 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%RESIDUAL_VARIABLE_TYPES(1))%PTR
224 CALL flagerror(
"The number of Jacobian matrices must be at least one for a nonlinear equations set.", &
228 local_error=
"The equations linearity type of "// &
230 CALL flagerror(local_error,err,error,*999)
233 SELECT CASE(equations%LINEARITY)
236 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%DYNAMIC_VARIABLE_TYPE)%PTR
239 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%RESIDUAL_VARIABLE_TYPES(1))%PTR
241 local_error=
"The equations linearity type of "// &
243 CALL flagerror(local_error,err,error,*999)
249 CALL flagerror(
"Not implemented.",err,error,*999)
251 local_error=
"The equations time dependence type of "// &
253 CALL flagerror(local_error,err,error,*999)
255 IF(
ASSOCIATED(dependent_variable))
THEN 256 number_of_rows=dependent_variable%NUMBER_OF_DOFS
257 total_number_of_rows=dependent_variable%TOTAL_NUMBER_OF_DOFS
258 equations_mapping%ROW_DOFS_MAPPING=>dependent_variable%DOMAIN_MAPPING
259 IF(
ASSOCIATED(equations_mapping%ROW_DOFS_MAPPING))
THEN 260 number_of_global_rows=equations_mapping%ROW_DOFS_MAPPING%NUMBER_OF_GLOBAL
262 CALL flagerror(
"Dependent variable domain mapping is not associated.",err,error,*999)
265 CALL flagerror(
"The dependent variable mapped to the first matrix is not associated.",err,error,*999)
268 DO matrix_idx=linear_matrix_start,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
269 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache% &
270 & linear_matrix_variable_types(matrix_idx))%PTR
271 IF(
ASSOCIATED(dependent_variable))
THEN 272 IF(dependent_variable%NUMBER_OF_DOFS/=number_of_rows)
THEN 273 local_error=
"Invalid equations set up. The number of rows in the equations set ("// &
275 &
") does not match the number of rows in equations linear matrix number "// &
278 CALL flagerror(local_error,err,error,*999)
280 IF(dependent_variable%TOTAL_NUMBER_OF_DOFS/=total_number_of_rows)
THEN 281 local_error=
"Invalid equations set up. The total number of rows in the equations set ("// &
283 &
") does not match the total number of rows in equations matrix number "// &
286 CALL flagerror(local_error,err,error,*999)
289 local_error=
"The dependent variable mapped to linear matrix number "// &
291 CALL flagerror(local_error,err,error,*999)
296 DO matrix_idx=1,create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES
297 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache% &
298 & residual_variable_types(matrix_idx))%PTR
299 IF(.NOT.
ASSOCIATED(dependent_variable))
THEN 300 local_error=
"The dependent variable mapped to Jacobian matrix number "// &
302 CALL flagerror(local_error,err,error,*999)
306 IF(create_values_cache%RHS_VARIABLE_TYPE/=0)
THEN 307 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%RHS_VARIABLE_TYPE)%PTR
308 IF(
ASSOCIATED(dependent_variable))
THEN 309 IF(dependent_variable%NUMBER_OF_DOFS/=number_of_rows)
THEN 310 local_error=
"Invalid equations set up. The number of rows in the equations set ("// &
312 &
") does not match the number of rows in the RHS vector ("// &
314 CALL flagerror(local_error,err,error,*999)
316 IF(dependent_variable%TOTAL_NUMBER_OF_DOFS/=total_number_of_rows)
THEN 317 local_error=
"Invalid equations set up. The total number of rows in the equations set ("// &
319 &
") does not match the total number of rows in the RHS vector ("// &
321 CALL flagerror(local_error,err,error,*999)
324 CALL flagerror(
"The dependent variable mapped to the RHS vector is not associated.",err,error,*999)
349 equations_mapping%NUMBER_OF_ROWS=number_of_rows
350 equations_mapping%TOTAL_NUMBER_OF_ROWS=total_number_of_rows
351 equations_mapping%NUMBER_OF_GLOBAL_ROWS=number_of_global_rows
353 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE/=0)
THEN 355 dynamic_mapping=>equations_mapping%DYNAMIC_MAPPING
356 IF(
ASSOCIATED(dynamic_mapping))
THEN 357 dynamic_mapping%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES
358 dynamic_mapping%STIFFNESS_MATRIX_NUMBER=create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER
359 dynamic_mapping%DAMPING_MATRIX_NUMBER=create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER
360 dynamic_mapping%MASS_MATRIX_NUMBER=create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER
362 ALLOCATE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(field_number_of_variable_types),stat=err)
363 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping variable to equations map.",err,error,*999)
364 DO variable_type=1,field_number_of_variable_types
366 & dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type),err,error,*999)
367 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE_INDEX=variable_type
368 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE_TYPE=variable_type
369 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE=>dependent_field% &
370 & variable_type_map(variable_type)%PTR
372 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(create_values_cache%DYNAMIC_VARIABLE_TYPE)% &
373 & number_of_equations_matrices=create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES
374 IF(create_values_cache%RHS_VARIABLE_TYPE/=0) dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS( &
375 & create_values_cache%RHS_VARIABLE_TYPE)%NUMBER_OF_EQUATIONS_MATRICES=-1
377 DO variable_type=1,field_number_of_variable_types
378 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(variable_type)%PTR
379 IF(
ASSOCIATED(dependent_variable))
THEN 380 IF(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES==-1)
THEN 382 ALLOCATE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP( &
383 & dependent_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
384 IF(err/=0)
CALL flagerror(
"Could not allocate variable to equations matrices maps dof to rows map.", &
386 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP=0
387 ELSE IF(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES>0)
THEN 388 ALLOCATE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS( &
389 & dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES),stat=err)
391 &
CALL flagerror(
"Could not allocate variable to equations matrices maps equations matrix numbers.", &
393 ALLOCATE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_COLUMNS_MAPS( &
394 & dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES),stat=err)
395 IF(err/=0)
CALL flagerror(
"Could not allocate variable to equations matrices maps dof to columns map.", &
397 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS=0
398 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE==variable_type)
THEN 399 IF(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER/=0)
THEN 400 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS( &
401 & create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER)=create_values_cache% &
402 & dynamic_stiffness_matrix_number
404 IF(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER/=0)
THEN 405 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS( &
406 & create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER)=create_values_cache% &
407 & dynamic_damping_matrix_number
409 IF(create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER/=0)
THEN 410 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS( &
411 & create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER)=create_values_cache% &
412 & dynamic_mass_matrix_number
414 DO matrix_idx=1,dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES
415 ALLOCATE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_COLUMNS_MAPS( &
416 & matrix_idx)%COLUMN_DOF(dependent_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
417 IF(err/=0)
CALL flagerror(
"Could not allocate variable dof to columns map column dof.", &
419 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
421 column_idx=dependent_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_idx)
422 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_COLUMNS_MAPS(matrix_idx)% &
423 & column_dof(dof_idx)=column_idx
426 ALLOCATE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP( &
427 & dependent_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
428 IF(err/=0)
CALL flagerror(
"Could not allocate variable to equations matrices maps dof to rows map.", &
430 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
433 dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP(dof_idx)=row_idx
440 ALLOCATE(dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(dynamic_mapping%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES), &
442 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping equations matrix to variable maps.", &
445 variable_type=create_values_cache%DYNAMIC_VARIABLE_TYPE
446 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(variable_type)%PTR
447 dynamic_mapping%DYNAMIC_VARIABLE_TYPE=variable_type
448 dynamic_mapping%DYNAMIC_VARIABLE=>dependent_variable
449 DO matrix_idx=1,dynamic_mapping%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES
451 & equations_matrix_to_var_maps(matrix_idx),err,error,*999)
452 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%MATRIX_NUMBER=matrix_idx
453 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%VARIABLE_TYPE=variable_type
454 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%VARIABLE=>dependent_variable
455 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_COLUMNS=dependent_variable% &
456 & domain_mapping%NUMBER_OF_GLOBAL
457 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%MATRIX_COEFFICIENT=create_values_cache% &
458 & dynamic_matrix_coefficients(matrix_idx)
459 ALLOCATE(dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP( &
460 & dependent_variable%DOMAIN_MAPPING%NUMBER_OF_GLOBAL),stat=err)
461 IF(err/=0)
CALL flagerror(
"Could not allocate equation matrix to variable map column to dof map.",&
463 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP=0
464 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
466 column_idx=dependent_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_idx)
467 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP(column_idx)=dof_idx
469 dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_DOFS_MAPPING=> &
470 & dependent_variable%DOMAIN_MAPPING
473 ALLOCATE(dynamic_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS(equations_mapping%TOTAL_NUMBER_OF_ROWS),stat=err)
474 IF(err/=0)
CALL flagerror(
"Could not allocate equations row to variable dof maps.",err,error,*999)
476 DO row_idx=1,equations_mapping%TOTAL_NUMBER_OF_ROWS
478 dynamic_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS(row_idx)=row_idx
481 CALL flagerror(
"Dynamic mapping is not associated.",err,error,*999)
485 IF(create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES>0)
THEN 487 linear_mapping=>equations_mapping%LINEAR_MAPPING
488 IF(
ASSOCIATED(linear_mapping))
THEN 489 linear_mapping%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
491 ALLOCATE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(field_number_of_variable_types),stat=err)
492 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping variable to equations map.",err,error,*999)
493 DO variable_type=1,field_number_of_variable_types
495 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type),err,error,*999)
496 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE_INDEX=variable_type
497 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE_TYPE=variable_type
498 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE=>dependent_field% &
499 & variable_type_map(variable_type)%PTR
502 DO matrix_idx=1,linear_mapping%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
503 variable_type=create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)
504 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES= &
505 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES+1
507 IF(create_values_cache%RHS_VARIABLE_TYPE/=0) linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS( &
508 & create_values_cache%RHS_VARIABLE_TYPE)%NUMBER_OF_EQUATIONS_MATRICES=-1
509 linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES=0
511 DO variable_type=1,field_number_of_variable_types
512 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(variable_type)%PTR
513 IF(
ASSOCIATED(dependent_variable))
THEN 514 IF(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)% &
515 & number_of_equations_matrices==-1)
THEN 517 ALLOCATE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP( &
518 & dependent_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
519 IF(err/=0)
CALL flagerror(
"Could not allocate variable to equations matrices maps dof to rows map.", &
521 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP=0
522 linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES=linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES+1
523 ELSE IF(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES>0)
THEN 524 ALLOCATE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS( &
525 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES),stat=err)
527 &
CALL flagerror(
"Could not allocate variable to equations matrices maps equations matrix numbers.", &
529 ALLOCATE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_COLUMNS_MAPS( &
530 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES),stat=err)
531 IF(err/=0)
CALL flagerror(
"Could not allocate variable to equations matrices maps dof to columns map.", &
533 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS=0
534 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES=0
535 DO matrix_idx=1,linear_mapping%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
536 IF(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)==variable_type)
THEN 537 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES= &
538 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES+1
539 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%EQUATIONS_MATRIX_NUMBERS( &
540 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES)= &
542 ALLOCATE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_COLUMNS_MAPS( &
543 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)% &
544 & number_of_equations_matrices)%COLUMN_DOF(dependent_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
545 IF(err/=0)
CALL flagerror(
"Could not allocate variable dof to columns map column dof.", &
547 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
549 column_idx=dependent_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_idx)
550 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_COLUMNS_MAPS( &
551 & linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)% &
552 & number_of_equations_matrices)%COLUMN_DOF(dof_idx)=column_idx
556 ALLOCATE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP( &
557 & dependent_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
558 IF(err/=0)
CALL flagerror(
"Could not allocate variable to equations matrices maps dof to rows map.", &
560 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
563 linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%DOF_TO_ROWS_MAP(dof_idx)=row_idx
565 linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES=linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES+1
570 ALLOCATE(linear_mapping%LINEAR_MATRIX_VARIABLE_TYPES(linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES),stat=err)
571 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping matrix variable types.",err,error,*999)
572 linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES=0
573 DO variable_type=1,field_number_of_variable_types
574 IF(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES>0)
THEN 575 linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES=linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES+1
576 linear_mapping%LINEAR_MATRIX_VARIABLE_TYPES(linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES)=variable_type
580 ALLOCATE(linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(linear_mapping%NUMBER_OF_LINEAR_EQUATIONS_MATRICES), &
582 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping equations matrix to variable maps.", &
585 DO matrix_idx=1,linear_mapping%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
586 variable_type=create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)
587 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(variable_type)%PTR
589 & equations_matrix_to_var_maps(matrix_idx),err,error,*999)
590 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%MATRIX_NUMBER=matrix_idx
591 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%VARIABLE_TYPE=variable_type
592 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%VARIABLE=>dependent_variable
593 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%NUMBER_OF_COLUMNS=dependent_variable% &
594 & domain_mapping%NUMBER_OF_GLOBAL
595 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%MATRIX_COEFFICIENT=equations_mapping% &
596 create_values_cache%LINEAR_MATRIX_COEFFICIENTS(matrix_idx)
597 ALLOCATE(linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP( &
598 & dependent_variable%DOMAIN_MAPPING%NUMBER_OF_GLOBAL),stat=err)
599 IF(err/=0)
CALL flagerror(
"Could not allocate equation matrix to variable map column to dof map.",&
601 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP=0
602 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
604 column_idx=dependent_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_idx)
605 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP(column_idx)=dof_idx
607 linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_DOFS_MAPPING=> &
608 & dependent_variable%DOMAIN_MAPPING
611 ALLOCATE(linear_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS(equations_mapping%TOTAL_NUMBER_OF_ROWS, &
612 & linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES),stat=err)
613 IF(err/=0)
CALL flagerror(
"Could not allocate equations row to variable dof maps.",err,error,*999)
615 DO variable_idx=1,linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES
616 DO row_idx=1,equations_mapping%TOTAL_NUMBER_OF_ROWS
618 linear_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS(row_idx,variable_idx)=row_idx
622 CALL flagerror(
"Linear mapping is not associated.",err,error,*999)
626 IF(create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES/=0)
THEN 628 nonlinear_mapping=>equations_mapping%NONLINEAR_MAPPING
629 IF(
ASSOCIATED(nonlinear_mapping))
THEN 630 nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES=create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES
631 ALLOCATE(nonlinear_mapping%VAR_TO_JACOBIAN_MAP(nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES),stat=err)
632 IF(err/=0)
CALL flagerror(
"Could not allocate variable to Jacobian maps.",err,error,*999)
633 ALLOCATE(nonlinear_mapping%JACOBIAN_TO_VAR_MAP(nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES),stat=err)
634 IF(err/=0)
CALL flagerror(
"Could not allocate Jacobian to variable maps.",err,error,*999)
635 ALLOCATE(nonlinear_mapping%RESIDUAL_VARIABLES(nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES),stat=err)
636 IF(err/=0)
CALL flagerror(
"Could not allocate nonlinear mapping residual variables.",err,error,*999)
637 DO matrix_idx=1,nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES
639 & var_to_jacobian_map(matrix_idx),err,error,*999)
640 nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%JACOBIAN_NUMBER=matrix_idx
641 nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%VARIABLE_TYPE= &
642 & create_values_cache%RESIDUAL_VARIABLE_TYPES(matrix_idx)
643 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache% &
644 & residual_variable_types(matrix_idx))%PTR
645 nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%VARIABLE=>dependent_variable
646 nonlinear_mapping%RESIDUAL_VARIABLES(matrix_idx)%PTR=>dependent_variable
648 IF(create_values_cache%RHS_VARIABLE_TYPE/=0)
THEN 649 row_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%RHS_VARIABLE_TYPE)%PTR
651 row_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%RESIDUAL_VARIABLE_TYPES(1))%PTR
654 ALLOCATE(nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%DOF_TO_COLUMNS_MAP(dependent_variable% &
655 & total_number_of_dofs),stat=err)
656 IF(err/=0)
CALL flagerror(
"Could not allocate variable to Jacobian map dof to columns map.",err,error,*999)
657 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
659 column_idx=dependent_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_idx)
660 nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%DOF_TO_COLUMNS_MAP(dof_idx)=column_idx
663 ALLOCATE(nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%DOF_TO_ROWS_MAP(row_variable% &
664 & total_number_of_dofs),stat=err)
665 IF(err/=0)
CALL flagerror(
"Could not allocate variable to Jacobian map dof to columns map.",err,error,*999)
666 DO dof_idx=1,row_variable%TOTAL_NUMBER_OF_DOFS
669 nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%DOF_TO_ROWS_MAP(dof_idx)=row_idx
672 & jacobian_to_var_map(matrix_idx),err,error,*999)
673 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%JACOBIAN_NUMBER=matrix_idx
674 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%VARIABLE_TYPE=create_values_cache% &
675 & residual_variable_types(matrix_idx)
676 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%VARIABLE=>dependent_variable
677 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%NUMBER_OF_COLUMNS= &
678 & dependent_variable%DOMAIN_MAPPING%NUMBER_OF_GLOBAL
679 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%JACOBIAN_COEFFICIENT=create_values_cache%RESIDUAL_COEFFICIENT
680 ALLOCATE(nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%EQUATIONS_COLUMN_TO_DOF_VARIABLE_MAP( &
681 & dependent_variable%DOMAIN_MAPPING%NUMBER_OF_GLOBAL),stat=err)
682 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%EQUATIONS_COLUMN_TO_DOF_VARIABLE_MAP=0
683 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
685 column_idx=dependent_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_idx)
686 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%EQUATIONS_COLUMN_TO_DOF_VARIABLE_MAP(column_idx)=dof_idx
688 nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%COLUMN_DOFS_MAPPING=>dependent_variable%DOMAIN_MAPPING
691 ALLOCATE(nonlinear_mapping%EQUATIONS_ROW_TO_RESIDUAL_DOF_MAP(total_number_of_rows),stat=err)
692 IF(err/=0)
CALL flagerror(
"Could not allocate equations row to residual dof map.",err,error,*999)
693 DO row_idx=1,total_number_of_rows
696 nonlinear_mapping%EQUATIONS_ROW_TO_RESIDUAL_DOF_MAP(row_idx)=dof_idx
699 CALL flagerror(
"Nonlinear mapping is not associated.",err,error,*999)
703 IF(create_values_cache%RHS_VARIABLE_TYPE/=0)
THEN 705 rhs_mapping=>equations_mapping%RHS_MAPPING
706 IF(
ASSOCIATED(rhs_mapping))
THEN 707 rhs_mapping%RHS_VARIABLE_TYPE=create_values_cache%RHS_VARIABLE_TYPE
708 dependent_variable=>dependent_field%VARIABLE_TYPE_MAP(create_values_cache%RHS_VARIABLE_TYPE)%PTR
709 rhs_mapping%RHS_VARIABLE=>dependent_variable
710 rhs_mapping%RHS_VARIABLE_MAPPING=>dependent_variable%DOMAIN_MAPPING
711 rhs_mapping%RHS_COEFFICIENT=create_values_cache%RHS_COEFFICIENT
713 ALLOCATE(rhs_mapping%RHS_DOF_TO_EQUATIONS_ROW_MAP(dependent_variable%TOTAL_NUMBER_OF_DOFS),stat=err)
714 IF(err/=0)
CALL flagerror(
"Could not allocate rhs dof to equations row map.",err,error,*999)
715 ALLOCATE(rhs_mapping%EQUATIONS_ROW_TO_RHS_DOF_MAP(total_number_of_rows),stat=err)
716 IF(err/=0)
CALL flagerror(
"Could not allocate equations row to dof map.",err,error,*999)
717 DO dof_idx=1,dependent_variable%TOTAL_NUMBER_OF_DOFS
720 rhs_mapping%RHS_DOF_TO_EQUATIONS_ROW_MAP(dof_idx)=row_idx
722 DO row_idx=1,total_number_of_rows
725 rhs_mapping%EQUATIONS_ROW_TO_RHS_DOF_MAP(row_idx)=dof_idx
728 CALL flagerror(
"RHS mapping is not associated.",err,error,*999)
732 IF(create_values_cache%SOURCE_VARIABLE_TYPE/=0)
THEN 734 source_mapping=>equations_mapping%SOURCE_MAPPING
735 IF(
ASSOCIATED(source_mapping))
THEN 736 source_mapping%SOURCE_VARIABLE_TYPE=create_values_cache%SOURCE_VARIABLE_TYPE
737 source_variable=>source_field%VARIABLE_TYPE_MAP(create_values_cache%SOURCE_VARIABLE_TYPE)%PTR
738 source_mapping%SOURCE_VARIABLE=>source_variable
757 CALL flagerror(
"Source mapping is not associated.",err,error,*999)
761 CALL flagerror(
"Equations set dependent field is not associated.",err,error,*999)
764 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
767 CALL flagerror(
"Equations mapping create values cache is not associated.",err,error,*999)
770 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
773 CALL flagerror(
"Equations mapping is not associated.",err,error,*999)
783 dynamic_mapping=>equations_mapping%DYNAMIC_MAPPING
784 IF(
ASSOCIATED(dynamic_mapping))
THEN 787 & number_of_dynamic_equations_matrices,err,error,*999)
789 & stiffness_matrix_number,err,error,*999)
791 & damping_matrix_number,err,error,*999)
793 & mass_matrix_number,err,error,*999)
795 & dynamic_variable_type,err,error,*999)
797 DO variable_type=1,field_number_of_variable_types
799 IF(
ASSOCIATED(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE))
THEN 801 & var_to_equations_matrices_maps(variable_type)%VARIABLE%TOTAL_NUMBER_OF_DOFS,err,error,*999)
803 & var_to_equations_matrices_maps(variable_type)%NUMBER_OF_EQUATIONS_MATRICES,err,error,*999)
804 IF(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES>0)
THEN 806 & number_of_equations_matrices,4,4,dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)% &
807 & equations_matrix_numbers,
'(" Matrix numbers :",4(X,I12))',
'(22X,4(X,I12))',err,error,*999)
809 DO matrix_idx=1,dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES
812 & variable_type)%VARIABLE%TOTAL_NUMBER_OF_DOFS,5,5,dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS( &
813 & variable_type)%DOF_TO_COLUMNS_MAPS(matrix_idx)%COLUMN_DOF, &
814 &
'(" Column numbers :",5(X,I13))',
'(24X,5(X,I13))',err,error,*999)
817 & variable%TOTAL_NUMBER_OF_DOFS,5,5,dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)% &
818 & dof_to_rows_map,
'(" DOF to row maps :",5(X,I13))',
'(24X,5(X,I13))',err,error,*999)
823 DO matrix_idx=1,dynamic_mapping%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES
826 & equations_matrix_to_var_maps(matrix_idx)%VARIABLE_TYPE,err,error,*999)
828 & equations_matrix_to_var_maps(matrix_idx)%NUMBER_OF_COLUMNS,err,error,*999)
830 & equations_matrix_to_var_maps(matrix_idx)%MATRIX_COEFFICIENT,err,error,*999)
832 & number_of_columns,5,5,dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP, &
833 &
'(" Column to DOF maps :",5(X,I13))',
'(28X,5(X,I13))',err,error,*999)
837 & dynamic_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS,
'(" Row to DOF maps :",5(X,I13))',
'(21X,5(X,I13))', &
840 linear_mapping=>equations_mapping%LINEAR_MAPPING
841 IF(
ASSOCIATED(linear_mapping))
THEN 844 & number_of_linear_equations_matrices,err,error,*999)
846 & number_of_linear_matrix_variables,err,error,*999)
848 & linear_mapping%LINEAR_MATRIX_VARIABLE_TYPES,
'(" Linear matrix variable types :",4(X,I12))',
'(27X,4(X,I12))', &
851 DO variable_type=1,field_number_of_variable_types
853 IF(
ASSOCIATED(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%VARIABLE))
THEN 855 & var_to_equations_matrices_maps(variable_type)%VARIABLE%TOTAL_NUMBER_OF_DOFS,err,error,*999)
857 & var_to_equations_matrices_maps(variable_type)%NUMBER_OF_EQUATIONS_MATRICES,err,error,*999)
858 IF(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES>0)
THEN 860 & number_of_equations_matrices,4,4,linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)% &
861 & equations_matrix_numbers,
'(" Matrix numbers :",4(X,I12))',
'(22X,4(X,I12))',err,error,*999)
863 DO matrix_idx=1,linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)%NUMBER_OF_EQUATIONS_MATRICES
866 & variable_type)%VARIABLE%TOTAL_NUMBER_OF_DOFS,5,5,linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS( &
867 & variable_type)%DOF_TO_COLUMNS_MAPS(matrix_idx)%COLUMN_DOF, &
868 &
'(" Column numbers :",5(X,I13))',
'(24X,5(X,I13))',err,error,*999)
871 & variable%TOTAL_NUMBER_OF_DOFS,5,5,linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS(variable_type)% &
872 & dof_to_rows_map,
'(" DOF to row maps :",5(X,I13))',
'(24X,5(X,I13))',err,error,*999)
877 DO matrix_idx=1,linear_mapping%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
880 & equations_matrix_to_var_maps(matrix_idx)%VARIABLE_TYPE,err,error,*999)
882 & equations_matrix_to_var_maps(matrix_idx)%NUMBER_OF_COLUMNS,err,error,*999)
884 & equations_matrix_to_var_maps(matrix_idx)%MATRIX_COEFFICIENT,err,error,*999)
886 & number_of_columns,5,5,linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS(matrix_idx)%COLUMN_TO_DOF_MAP, &
887 &
'(" Column to DOF maps :",5(X,I13))',
'(28X,5(X,I13))',err,error,*999)
890 DO variable_idx=1,linear_mapping%NUMBER_OF_LINEAR_MATRIX_VARIABLES
893 & linear_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS(:,variable_idx), &
894 &
'(" Row to DOF maps :",5(X,I13))',
'(21X,5(X,I13))',err,error,*999)
897 nonlinear_mapping=>equations_mapping%NONLINEAR_MAPPING
898 IF(
ASSOCIATED(nonlinear_mapping))
THEN 900 DO matrix_idx=1,nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES
903 & jacobian_to_var_map(matrix_idx)%VARIABLE_TYPE,err,error,*999)
905 & jacobian_to_var_map(matrix_idx)%VARIABLE%TOTAL_NUMBER_OF_DOFS,err,error,*999)
911 & nonlinear_mapping%EQUATIONS_ROW_TO_RESIDUAL_DOF_MAP,
'(" Row to DOF mappings :",5(X,I13))',
'(25X,5(X,I13))', &
915 DO matrix_idx=1,nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES
918 & var_to_jacobian_map(matrix_idx)%VARIABLE_TYPE,err,error,*999)
920 & var_to_jacobian_map(matrix_idx)%VARIABLE%TOTAL_NUMBER_OF_DOFS,err,error,*999)
922 & total_number_of_dofs,5,5,nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%DOF_TO_COLUMNS_MAP, &
923 &
'(" DOF to column map :",5(X,I13))',
'(26X,5(X,I13))',err,error,*999)
925 & total_number_of_dofs,5,5,nonlinear_mapping%VAR_TO_JACOBIAN_MAP(matrix_idx)%DOF_TO_ROWS_MAP, &
926 &
'(" DOF to row map :",5(X,I13))',
'(26X,5(X,I13))',err,error,*999)
929 & jacobian_to_var_map(matrix_idx)%VARIABLE_TYPE,err,error,*999)
931 & jacobian_to_var_map(matrix_idx)%NUMBER_OF_COLUMNS,err,error,*999)
933 & jacobian_to_var_map(matrix_idx)%JACOBIAN_COEFFICIENT,err,error,*999)
935 & 5,5,nonlinear_mapping%JACOBIAN_TO_VAR_MAP(matrix_idx)%EQUATIONS_COLUMN_TO_DOF_VARIABLE_MAP, &
936 &
'(" Column to DOF map :",5(X,I13))',
'(26X,5(X,I13))',err,error,*999)
939 rhs_mapping=>equations_mapping%RHS_MAPPING
940 IF(
ASSOCIATED(rhs_mapping))
THEN 944 & total_number_of_dofs,err,error,*999)
948 & rhs_mapping%RHS_DOF_TO_EQUATIONS_ROW_MAP,
'(" DOF to row mappings :",5(X,I13))',
'(25X,5(X,I13))',err,error,*999)
950 & rhs_mapping%EQUATIONS_ROW_TO_RHS_DOF_MAP,
'(" Row to DOF mappings :",5(X,I13))',
'(25X,5(X,I13))',err,error,*999)
952 source_mapping=>equations_mapping%SOURCE_MAPPING
953 IF(
ASSOCIATED(source_mapping))
THEN 958 & total_number_of_dofs,err,error,*999)
970 exits(
"EQUATIONS_MAPPING_CALCULATE")
972 999 errorsexits(
"EQUATIONS_MAPPING_CALCULATE",err,error)
985 INTEGER(INTG),
INTENT(OUT) :: ERR
988 INTEGER(INTG) :: matrix_idx
989 LOGICAL :: IS_RESIDUAL_TYPE
995 enters(
"EQUATIONS_MAPPING_CREATE_FINISH",err,error,*999)
997 IF(
ASSOCIATED(equations_mapping))
THEN 998 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 999 CALL flagerror(
"Equations mapping has already been finished.",err,error,*999)
1001 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
1002 IF(
ASSOCIATED(create_values_cache))
THEN 1003 equations=>equations_mapping%EQUATIONS
1004 IF(
ASSOCIATED(equations))
THEN 1005 equations_set=>equations%EQUATIONS_SET
1006 IF(
ASSOCIATED(equations_set))
THEN 1008 SELECT CASE(equations%TIME_DEPENDENCE)
1010 SELECT CASE(equations%LINEARITY)
1012 IF(create_values_cache%RHS_VARIABLE_TYPE==0.AND.create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES==0) &
1013 &
CALL flagerror(
"Invalid equations mapping. The RHS variable type must be set if there are no "// &
1014 &
"linear matrices.",err,error,*999)
1016 DO matrix_idx=1,create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES
1017 IF(create_values_cache%RESIDUAL_VARIABLE_TYPES(matrix_idx)==0)
THEN 1018 local_error=
"Invalid equations mapping. The residual variable type is not set for Jacobian number "// &
1020 CALL flagerror(local_error,err,error,*999)
1023 IF(create_values_cache%RHS_VARIABLE_TYPE==0.AND.create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES==0) &
1024 &
CALL flagerror(
"Invalid equations mapping. The RHS variable type must be set if there are no "// &
1025 &
"linear matrices.",err,error,*999)
1027 local_error=
"The equations linearity type of "// &
1029 CALL flagerror(local_error,err,error,*999)
1032 SELECT CASE(equations%LINEARITY)
1034 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE==0)
CALL flagerror(
"Invalid equations mapping. "// &
1035 &
"The dynamic variable type must be set for dynamic equations.", err,error,*999)
1036 IF(create_values_cache%RHS_VARIABLE_TYPE==0.AND.create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES==0) &
1037 &
CALL flagerror(
"Invalid equations mapping. The RHS variable type must be set if there are no "// &
1038 &
"linear matrices.",err,error,*999)
1042 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE==0)
CALL flagerror(
"Invalid equations mapping. "// &
1043 &
"The dynamic variable type must be set for dynamic equations.", err,error,*999)
1044 IF(create_values_cache%RHS_VARIABLE_TYPE==0.AND.create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES==0) &
1045 &
CALL flagerror(
"Invalid equations mapping. The RHS variable type must be set if there are no "// &
1046 &
"linear matrices.",err,error,*999)
1047 is_residual_type=.false.
1048 DO matrix_idx=1,create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES
1049 IF(create_values_cache%RESIDUAL_VARIABLE_TYPES(matrix_idx)==0)
THEN 1050 local_error=
"Invalid equations mapping. The residual variable type is not set for Jacobian number "// &
1052 CALL flagerror(local_error,err,error,*999)
1054 IF(create_values_cache%RESIDUAL_VARIABLE_TYPES(matrix_idx)==create_values_cache%DYNAMIC_VARIABLE_TYPE)
THEN 1055 is_residual_type=.true.
1058 IF(is_residual_type.EQV..false.)
THEN 1059 CALL flagerror(
"Invalid equations mapping. "//
"The residual variable type must correspond to the & 1060 & dynamic variable type for nonlinear dynamic equations.", err,error,*999)
1065 local_error=
"The equations linearity type of "// &
1067 CALL flagerror(local_error,err,error,*999)
1070 local_error=
"The equations time dependence type of "// &
1072 CALL flagerror(local_error,err,error,*999)
1075 DO matrix_idx=1,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
1076 IF(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)==0)
THEN 1077 local_error=
"Invalid equations mapping. The linear matrix variable type is not set for linear matrix number "//&
1079 CALL flagerror(local_error,err,error,*999)
1085 equations_mapping%EQUATIONS_MAPPING_FINISHED=.true.
1087 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
1090 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
1093 CALL flagerror(
"Equations mapping create values cache is not associated.",err,error,*999)
1097 CALL flagerror(
"Equations mapping is not associated.",err,error,*999)
1100 exits(
"EQUATIONS_MAPPING_CREATE_FINISH")
1102 999 errorsexits(
"EQUATIONS_MAPPING_CREATE_FINISH",err,error)
1116 INTEGER(INTG),
INTENT(OUT) :: ERR
1120 enters(
"EQUATIONS_MAPPING_CREATE_START",err,error,*999)
1122 IF(
ASSOCIATED(equations))
THEN 1123 IF(equations%EQUATIONS_FINISHED)
THEN 1124 IF(
ASSOCIATED(equations_mapping))
THEN 1125 CALL flagerror(
"Equations mapping is already associated.",err,error,*999)
1127 NULLIFY(equations_mapping)
1129 equations_mapping=>equations%EQUATIONS_MAPPING
1132 CALL flagerror(
"Equations has not been finished.",err,error,*999)
1135 CALL flagerror(
"Equations is not associated.",err,error,*999)
1138 exits(
"EQUATIONS_MAPPING_CREATE_START")
1140 999 errorsexits(
"EQUATIONS_MAPPING_CREATE_START",err,error)
1153 INTEGER(INTG),
INTENT(OUT) :: ERR
1157 enters(
"EquationsMapping_CreateValuesCacheFinalise",err,error,*999)
1159 IF(
ASSOCIATED(create_values_cache))
THEN 1160 IF(
ALLOCATED(create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS))
DEALLOCATE(create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS)
1161 IF(
ALLOCATED(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES))
DEALLOCATE(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES)
1162 IF(
ALLOCATED(create_values_cache%LINEAR_MATRIX_COEFFICIENTS))
DEALLOCATE(create_values_cache%LINEAR_MATRIX_COEFFICIENTS)
1163 IF(
ALLOCATED(create_values_cache%RESIDUAL_VARIABLE_TYPES))
DEALLOCATE(create_values_cache%RESIDUAL_VARIABLE_TYPES)
1164 DEALLOCATE(create_values_cache)
1167 exits(
"EquationsMapping_CreateValuesCacheFinalise")
1169 999 errorsexits(
"EquationsMapping_CreateValuesCacheFinalise",err,error)
1182 INTEGER(INTG),
INTENT(OUT) :: ERR
1185 INTEGER(INTG) :: DUMMY_ERR,matrix_idx,matrix_idx2,VARIABLE_NUMBER
1186 LOGICAL :: IS_RESIDUAL_TYPE
1192 enters(
"EquationsMapping_CreateValuesCacheInitialise",err,error,*998)
1194 IF(
ASSOCIATED(equations_mapping))
THEN 1195 IF(
ASSOCIATED(equations_mapping%CREATE_VALUES_CACHE))
THEN 1196 CALL flagerror(
"Equations mapping create values cache is already associated.",err,error,*998)
1198 equations=>equations_mapping%EQUATIONS
1199 IF(
ASSOCIATED(equations))
THEN 1200 equations_set=>equations%EQUATIONS_SET
1201 IF(
ASSOCIATED(equations_set))
THEN 1202 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
1203 IF(
ASSOCIATED(dependent_field))
THEN 1205 ALLOCATE(equations_mapping%CREATE_VALUES_CACHE,stat=err)
1206 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping create values cache.",err,error,*999)
1207 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=0
1208 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_VARIABLE_TYPE=0
1209 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_STIFFNESS_MATRIX_NUMBER=0
1210 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_DAMPING_MATRIX_NUMBER=0
1211 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_MASS_MATRIX_NUMBER=0
1212 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=0
1213 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_RESIDUAL_VARIABLES=0
1214 equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_COEFFICIENT=1.0_dp
1215 equations_mapping%CREATE_VALUES_CACHE%RHS_VARIABLE_TYPE=0
1216 equations_mapping%CREATE_VALUES_CACHE%RHS_COEFFICIENT=1.0_dp
1217 equations_mapping%CREATE_VALUES_CACHE%SOURCE_VARIABLE_TYPE=0
1218 equations_mapping%CREATE_VALUES_CACHE%SOURCE_COEFFICIENT=1.0_dp
1222 IF(dependent_field%NUMBER_OF_VARIABLES==1)
THEN 1223 SELECT CASE(equations%LINEARITY)
1225 CALL flagerror(
"Dependent field only has one variable which cannot be mapped to both an equations matrix "// &
1226 &
"and rhs vector.",err,error,*999)
1228 CALL flagerror(
"Dependent field only has one variable which cannot be mapped to both the residual "// &
1229 &
"and rhs vector.",err,error,*999)
1231 local_error=
"The equations linearity type of "// &
1233 CALL flagerror(local_error,err,error,*999)
1235 ELSE IF(dependent_field%NUMBER_OF_VARIABLES>1)
THEN 1236 SELECT CASE(equations%TIME_DEPENDENCE)
1238 SELECT CASE(equations%LINEARITY)
1240 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=dependent_field%NUMBER_OF_VARIABLES-1
1241 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(field_deludeln_variable_type)%PTR))
THEN 1242 equations_mapping%CREATE_VALUES_CACHE%RHS_VARIABLE_TYPE=dependent_field% &
1243 & variable_type_map(field_deludeln_variable_type)%PTR%VARIABLE_TYPE
1245 CALL flagerror(
"Not implemented.",err,error,*999)
1248 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=0
1249 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_RESIDUAL_VARIABLES=1
1250 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(field_deludeln_variable_type)%PTR))
THEN 1251 equations_mapping%CREATE_VALUES_CACHE%RHS_VARIABLE_TYPE=dependent_field% &
1252 & variable_type_map(field_deludeln_variable_type)%PTR%VARIABLE_TYPE
1254 CALL flagerror(
"Not implemented.",err,error,*999)
1257 local_error=
"The equations linearity type of "// &
1259 CALL flagerror(local_error,err,error,*999)
1262 SELECT CASE(equations%LINEARITY)
1265 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=2
1266 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_STIFFNESS_MATRIX_NUMBER=1
1267 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_DAMPING_MATRIX_NUMBER=2
1269 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=3
1270 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_STIFFNESS_MATRIX_NUMBER=1
1271 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_DAMPING_MATRIX_NUMBER=2
1272 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_MASS_MATRIX_NUMBER=3
1275 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=0
1276 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR))
THEN 1277 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_VARIABLE_TYPE=dependent_field% &
1278 & variable_type_map(field_u_variable_type)%PTR%VARIABLE_TYPE
1280 CALL flagerror(
"Not implemented.",err,error,*999)
1282 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(field_deludeln_variable_type)%PTR))
THEN 1283 equations_mapping%CREATE_VALUES_CACHE%RHS_VARIABLE_TYPE=dependent_field% &
1284 & variable_type_map(field_deludeln_variable_type)%PTR%VARIABLE_TYPE
1286 CALL flagerror(
"Not implemented.",err,error,*999)
1292 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=2
1293 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_STIFFNESS_MATRIX_NUMBER=1
1294 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_DAMPING_MATRIX_NUMBER=2
1296 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=3
1297 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_STIFFNESS_MATRIX_NUMBER=1
1298 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_DAMPING_MATRIX_NUMBER=2
1299 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_MASS_MATRIX_NUMBER=3
1301 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=0
1302 equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_RESIDUAL_VARIABLES=1
1303 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR))
THEN 1304 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_VARIABLE_TYPE=dependent_field% &
1305 & variable_type_map(field_u_variable_type)%PTR%VARIABLE_TYPE
1307 CALL flagerror(
"Not implemented.",err,error,*999)
1309 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(field_deludeln_variable_type)%PTR))
THEN 1310 equations_mapping%CREATE_VALUES_CACHE%RHS_VARIABLE_TYPE=dependent_field% &
1311 & variable_type_map(field_deludeln_variable_type)%PTR%VARIABLE_TYPE
1313 CALL flagerror(
"Not implemented.",err,error,*999)
1316 local_error=
"The equations linearity type of "// &
1318 CALL flagerror(local_error,err,error,*999)
1323 local_error=
"The equations time dependence type of "// &
1325 CALL flagerror(local_error,err,error,*999)
1328 local_error=
"The number of dependent field variables of "// &
1329 &
trim(
numbertovstring(dependent_field%NUMBER_OF_VARIABLES,
"*",err,error))//
" is invalid." 1330 CALL flagerror(local_error,err,error,*999)
1333 IF(equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES>0)
THEN 1334 ALLOCATE(equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_MATRIX_COEFFICIENTS(equations_mapping% &
1335 & create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES),stat=err)
1337 &
CALL flagerror(
"Could not allocate equations mapping create values cache dynamic matrix coefficients.", &
1339 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_MATRIX_COEFFICIENTS=1.0_dp
1342 IF(equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_RESIDUAL_VARIABLES>0)
THEN 1343 ALLOCATE(equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_VARIABLE_TYPES(equations_mapping% &
1344 & create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES),stat=err)
1345 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping create values cache residual variable types.", &
1347 equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_VARIABLE_TYPES=0
1348 DO matrix_idx=1,equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_RESIDUAL_VARIABLES
1350 DO WHILE(equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_VARIABLE_TYPES(matrix_idx)==0.AND. &
1351 & variable_number<=field_number_of_variable_types)
1352 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(variable_number)%PTR))
THEN 1353 IF(dependent_field%VARIABLE_TYPE_MAP(variable_number)%PTR%VARIABLE_TYPE/= &
1354 & equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_VARIABLE_TYPE)
THEN 1355 equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_VARIABLE_TYPES(matrix_idx)= &
1356 & dependent_field%VARIABLE_TYPE_MAP(variable_number)%PTR%VARIABLE_TYPE
1359 variable_number=variable_number+1
1362 IF(equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_VARIABLE_TYPES(equations_mapping% &
1363 & create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES)==0) &
1364 &
CALL flagerror(
"Invalid setup. All Jacobian matrices do not have a mapped dependent field variable.", &
1368 IF(equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_LINEAR_EQUATIONS_MATRICES>0)
THEN 1369 ALLOCATE(equations_mapping%CREATE_VALUES_CACHE%LINEAR_MATRIX_VARIABLE_TYPES(equations_mapping% &
1370 & create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES),stat=err)
1372 &
flag_error(
"Could not allocate equations mapping create values cache linear matrix variable types.", &
1374 ALLOCATE(equations_mapping%CREATE_VALUES_CACHE%LINEAR_MATRIX_COEFFICIENTS(equations_mapping% &
1375 & create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES),stat=err)
1376 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping create values cache linear matrix coefficients.", &
1379 equations_mapping%CREATE_VALUES_CACHE%LINEAR_MATRIX_VARIABLE_TYPES=0
1381 DO matrix_idx=1,equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
1382 DO WHILE(equations_mapping%CREATE_VALUES_CACHE%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)==0.AND. &
1383 & variable_number<=field_number_of_variable_types)
1384 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(variable_number)%PTR))
THEN 1385 IF(dependent_field%VARIABLE_TYPE_MAP(variable_number)%PTR%VARIABLE_TYPE/= &
1386 & equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_VARIABLE_TYPE)
THEN 1387 is_residual_type=.false.
1388 DO matrix_idx2=1,equations_mapping%CREATE_VALUES_CACHE%NUMBER_OF_RESIDUAL_VARIABLES
1389 IF(dependent_field%VARIABLE_TYPE_MAP(variable_number)%PTR%VARIABLE_TYPE== &
1390 & equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_VARIABLE_TYPES(matrix_idx2))
THEN 1391 is_residual_type=.true.
1394 IF(is_residual_type.EQV..false.)
THEN 1395 equations_mapping%CREATE_VALUES_CACHE%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)= &
1396 & dependent_field%VARIABLE_TYPE_MAP(variable_number)%PTR%VARIABLE_TYPE
1400 variable_number=variable_number+1
1403 IF(equations_mapping%CREATE_VALUES_CACHE%LINEAR_MATRIX_VARIABLE_TYPES(equations_mapping% &
1404 & create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)==0) &
1405 &
CALL flagerror(
"Invalid setup. All linear matrices do not have a mapped dependent field variable.", &
1407 equations_mapping%CREATE_VALUES_CACHE%LINEAR_MATRIX_COEFFICIENTS=1.0_dp
1410 CALL flagerror(
"Equations set dependent field is not associated.",err,error,*999)
1413 CALL flagerror(
"The equations equations set is not associated.",err,error,*998)
1416 CALL flagerror(
"The equations mapping equations is not associated.",err,error,*998)
1420 CALL flagerror(
"Equations mapping is not associated.",err,error,*998)
1423 exits(
"EquationsMapping_CreateValuesCacheInitialise")
1426 998
errors(
"EquationsMapping_CreateValuesCacheInitialise",err,error)
1427 exits(
"EquationsMapping_CreateValuesCacheInitialise")
1441 INTEGER(INTG),
INTENT(OUT) :: ERR
1445 enters(
"EQUATIONS_MAPPING_DESTROY",err,error,*999)
1447 IF(
ASSOCIATED(equations_mapping))
THEN 1450 CALL flagerror(
"Equations mapping is not associated.",err,error,*999)
1453 exits(
"EQUATIONS_MAPPING_DESTROY")
1455 999 errorsexits(
"EQUATIONS_MAPPING_DESTROY",err,error)
1469 INTEGER(INTG),
INTENT(OUT) :: ERR
1472 INTEGER(INTG) :: matrix_idx,variable_type
1474 enters(
"EQUATIONS_MAPPING_DYNAMIC_MAPPING_FINALISE",err,error,*999)
1476 IF(
ASSOCIATED(dynamic_mapping))
THEN 1477 IF(
ALLOCATED(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS))
THEN 1478 DO variable_type=1,
SIZE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS,1)
1480 & var_to_equations_matrices_maps(variable_type),err,error,*999)
1482 DEALLOCATE(dynamic_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS)
1484 IF(
ALLOCATED(dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS))
THEN 1485 DO matrix_idx=1,
SIZE(dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS,1)
1489 DEALLOCATE(dynamic_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS)
1491 IF(
ALLOCATED(dynamic_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS)) &
1492 &
DEALLOCATE(dynamic_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS)
1493 DEALLOCATE(dynamic_mapping)
1496 exits(
"EQUATIONS_MAPPING_DYNAMIC_MAPPING_FINALISE")
1498 999 errorsexits(
"EQUATIONS_MAPPING_DYNAMIC_MAPPING_FINALISE",err,error)
1512 INTEGER(INTG),
INTENT(OUT) :: ERR
1515 INTEGER(INTG) :: DUMMY_ERR
1518 enters(
"EquationsMapping_DynamicMappingInitialise",err,error,*998)
1520 IF(
ASSOCIATED(equations_mapping))
THEN 1521 IF(
ASSOCIATED(equations_mapping%DYNAMIC_MAPPING))
THEN 1522 CALL flagerror(
"Equations mapping dynamic mapping is already associated.",err,error,*998)
1524 ALLOCATE(equations_mapping%DYNAMIC_MAPPING,stat=err)
1525 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping dynamic mapping.",err,error,*999)
1526 equations_mapping%DYNAMIC_MAPPING%EQUATIONS_MAPPING=>equations_mapping
1527 equations_mapping%DYNAMIC_MAPPING%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=0
1528 equations_mapping%DYNAMIC_MAPPING%STIFFNESS_MATRIX_NUMBER=0
1529 equations_mapping%DYNAMIC_MAPPING%DAMPING_MATRIX_NUMBER=0
1530 equations_mapping%DYNAMIC_MAPPING%MASS_MATRIX_NUMBER=0
1531 equations_mapping%DYNAMIC_MAPPING%DYNAMIC_VARIABLE_TYPE=0
1532 NULLIFY(equations_mapping%DYNAMIC_MAPPING%DYNAMIC_VARIABLE)
1535 CALL flagerror(
"Equations mapping is not associated.",err,error,*998)
1538 exits(
"EquationsMapping_DynamicMappingInitialise")
1541 998 errorsexits(
"EquationsMapping_DynamicMappingInitialise",err,error)
1556 LOGICAL,
INTENT(IN) :: MASS_MATRIX
1557 LOGICAL,
INTENT(IN) :: DAMPING_MATRIX
1558 LOGICAL,
INTENT(IN) :: STIFFNESS_MATRIX
1559 INTEGER(INTG),
INTENT(OUT) :: ERR
1562 INTEGER(INTG) :: NEW_DYNAMIC_DAMPING_MATRIX_NUMBER,NEW_DYNAMIC_MASS_MATRIX_NUMBER,NEW_DYNAMIC_STIFFNESS_MATRIX_NUMBER, &
1563 & NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES
1564 REAL(DP),
ALLOCATABLE :: OLD_DYNAMIC_MATRIX_COEFFICIENTS(:)
1570 enters(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_ALL",err,error,*999)
1572 IF(
ASSOCIATED(equations_mapping))
THEN 1573 equations=>equations_mapping%EQUATIONS
1574 IF(
ASSOCIATED(equations))
THEN 1575 equations_set=>equations%EQUATIONS_SET
1576 IF(
ASSOCIATED(equations_set))
THEN 1577 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
1578 IF(
ASSOCIATED(create_values_cache))
THEN 1579 SELECT CASE(equations%LINEARITY)
1581 number_of_dynamic_equations_matrices=0
1582 new_dynamic_stiffness_matrix_number=0
1583 new_dynamic_damping_matrix_number=0
1584 new_dynamic_mass_matrix_number=0
1585 IF(stiffness_matrix)
THEN 1586 number_of_dynamic_equations_matrices=number_of_dynamic_equations_matrices+1
1587 new_dynamic_stiffness_matrix_number=number_of_dynamic_equations_matrices
1589 IF(damping_matrix)
THEN 1590 number_of_dynamic_equations_matrices=number_of_dynamic_equations_matrices+1
1591 new_dynamic_damping_matrix_number=number_of_dynamic_equations_matrices
1593 IF(mass_matrix)
THEN 1594 number_of_dynamic_equations_matrices=number_of_dynamic_equations_matrices+1
1595 new_dynamic_mass_matrix_number=number_of_dynamic_equations_matrices
1597 IF(number_of_dynamic_equations_matrices>0)
THEN 1598 ALLOCATE(old_dynamic_matrix_coefficients(create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES),stat=err)
1599 IF(err/=0)
CALL flagerror(
"Could not allocate old dynamic matrix coefficients.",err,error,*999)
1600 old_dynamic_matrix_coefficients(1:create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES)= &
1601 & create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(1:create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES)
1602 DEALLOCATE(create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS)
1603 ALLOCATE(create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(number_of_dynamic_equations_matrices),stat=err)
1604 IF(err/=0)
CALL flagerror(
"Could not allocate dynamic matrix coefficients.",err,error,*999)
1605 IF(new_dynamic_stiffness_matrix_number/=0)
THEN 1606 IF(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER==0)
THEN 1607 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_stiffness_matrix_number)=1.0_dp
1609 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_stiffness_matrix_number)= &
1610 & old_dynamic_matrix_coefficients(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER)
1613 IF(new_dynamic_damping_matrix_number/=0)
THEN 1614 IF(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER==0)
THEN 1615 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_damping_matrix_number)=1.0_dp
1617 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_damping_matrix_number)= &
1618 & old_dynamic_matrix_coefficients(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER)
1621 IF(new_dynamic_mass_matrix_number/=0)
THEN 1622 IF(create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER==0)
THEN 1623 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_mass_matrix_number)=1.0_dp
1625 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_mass_matrix_number)= &
1626 & old_dynamic_matrix_coefficients(create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER)
1629 create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=number_of_dynamic_equations_matrices
1630 create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER=new_dynamic_stiffness_matrix_number
1631 create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER=new_dynamic_damping_matrix_number
1632 create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER=new_dynamic_mass_matrix_number
1633 IF(
ALLOCATED(old_dynamic_matrix_coefficients))
DEALLOCATE(old_dynamic_matrix_coefficients)
1635 CALL flagerror(
"Invalid dynamic matrices set up. There are no dynamic equations matrices.",err,error,*999)
1640 number_of_dynamic_equations_matrices=0
1641 new_dynamic_stiffness_matrix_number=0
1642 new_dynamic_damping_matrix_number=0
1643 new_dynamic_mass_matrix_number=0
1644 IF(stiffness_matrix)
THEN 1645 number_of_dynamic_equations_matrices=number_of_dynamic_equations_matrices+1
1646 new_dynamic_stiffness_matrix_number=number_of_dynamic_equations_matrices
1648 IF(damping_matrix)
THEN 1649 number_of_dynamic_equations_matrices=number_of_dynamic_equations_matrices+1
1650 new_dynamic_damping_matrix_number=number_of_dynamic_equations_matrices
1652 IF(mass_matrix)
THEN 1653 number_of_dynamic_equations_matrices=number_of_dynamic_equations_matrices+1
1654 new_dynamic_mass_matrix_number=number_of_dynamic_equations_matrices
1656 IF(number_of_dynamic_equations_matrices>0)
THEN 1657 ALLOCATE(old_dynamic_matrix_coefficients(create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES),stat=err)
1658 IF(err/=0)
CALL flagerror(
"Could not allocate old dynamic matrix coefficients.",err,error,*999)
1659 old_dynamic_matrix_coefficients(1:create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES)= &
1660 & create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(1:create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES)
1661 DEALLOCATE(create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS)
1662 ALLOCATE(create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(number_of_dynamic_equations_matrices),stat=err)
1663 IF(err/=0)
CALL flagerror(
"Could not allocate dynamic matrix coefficients.",err,error,*999)
1664 IF(new_dynamic_stiffness_matrix_number/=0)
THEN 1665 IF(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER==0)
THEN 1666 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_stiffness_matrix_number)=1.0_dp
1668 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_stiffness_matrix_number)= &
1669 & old_dynamic_matrix_coefficients(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER)
1672 IF(new_dynamic_damping_matrix_number/=0)
THEN 1673 IF(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER==0)
THEN 1674 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_damping_matrix_number)=1.0_dp
1676 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_damping_matrix_number)= &
1677 & old_dynamic_matrix_coefficients(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER)
1680 IF(new_dynamic_mass_matrix_number/=0)
THEN 1681 IF(create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER==0)
THEN 1682 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_mass_matrix_number)=1.0_dp
1684 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(new_dynamic_mass_matrix_number)= &
1685 & old_dynamic_matrix_coefficients(create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER)
1688 create_values_cache%NUMBER_OF_DYNAMIC_EQUATIONS_MATRICES=number_of_dynamic_equations_matrices
1689 create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER=new_dynamic_stiffness_matrix_number
1690 create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER=new_dynamic_damping_matrix_number
1691 create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER=new_dynamic_mass_matrix_number
1692 IF(
ALLOCATED(old_dynamic_matrix_coefficients))
DEALLOCATE(old_dynamic_matrix_coefficients)
1694 CALL flagerror(
"Invalid dynamic matrices set up. There are no dynamic equations matrices.",err,error,*999)
1699 local_error=
"The equations linearity type of "//
trim(
numbertovstring(equations%LINEARITY,
"*",err,error))// &
1701 CALL flagerror(local_error,err,error,*999)
1704 CALL flagerror(
"Equations mapping create values cache is not associated.",err,error,*999)
1707 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
1710 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
1713 CALL flagerror(
"Equations is not associated.",err,error,*999)
1716 exits(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_ALL_ORDER")
1718 999
IF(
ALLOCATED(old_dynamic_matrix_coefficients))
DEALLOCATE(old_dynamic_matrix_coefficients)
1719 errorsexits(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_ALL",err,error)
1733 LOGICAL,
INTENT(IN) :: DAMPING_MATRIX
1734 LOGICAL,
INTENT(IN) :: STIFFNESS_MATRIX
1735 INTEGER(INTG),
INTENT(OUT) :: ERR
1741 enters(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_1",err,error,*999)
1743 IF(
ASSOCIATED(equations_mapping))
THEN 1744 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 1745 CALL flagerror(
"Equations mapping has already been finished.",err,error,*999)
1747 equations=>equations_mapping%EQUATIONS
1748 IF(
ASSOCIATED(equations))
THEN 1749 SELECT CASE(equations%TIME_DEPENDENCE)
1751 CALL flagerror(
"Can not set dynamic matrices for static equations.",err,error,*999)
1753 CALL flagerror(
"Can not set dynamic matrices for quasi-static equations.",err,error,*999)
1755 IF(.NOT.damping_matrix)
CALL flag_warning(
"No damping matrix for first order dynamic equations.",err,error,*999)
1759 CALL flagerror(
"Need to specify three matrices to set for second order dynamic equations.",err,error,*999)
1761 local_error=
"The equations time dependence type of "// &
1764 CALL flagerror(local_error,err,error,*999)
1767 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
1771 CALL flagerror(
"Equations is not associated.",err,error,*999)
1774 exits(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_1")
1776 999 errorsexits(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_1",err,error)
1791 LOGICAL,
INTENT(IN) :: MASS_MATRIX
1792 LOGICAL,
INTENT(IN) :: DAMPING_MATRIX
1793 LOGICAL,
INTENT(IN) :: STIFFNESS_MATRIX
1794 INTEGER(INTG),
INTENT(OUT) :: ERR
1800 enters(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_2",err,error,*999)
1802 IF(
ASSOCIATED(equations_mapping))
THEN 1803 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 1804 CALL flagerror(
"Equations mapping has already been finished.",err,error,*999)
1806 equations=>equations_mapping%EQUATIONS
1807 IF(
ASSOCIATED(equations))
THEN 1808 SELECT CASE(equations%TIME_DEPENDENCE)
1810 CALL flagerror(
"Can not set dynamic matrices for static equations.",err,error,*999)
1812 CALL flagerror(
"Can not set dynamic matrices for quasi-static equations.",err,error,*999)
1814 IF(mass_matrix)
THEN 1815 CALL flagerror(
"The mass matrix cannot be present for first order dynamic equations.",err,error,*999)
1817 IF(.NOT.damping_matrix)
CALL flag_warning(
"No damping matrix for a first order dynamic system.",err,error,*999)
1822 IF(.NOT.mass_matrix)
CALL flag_warning(
"No mass matrix for a second order dynamic system.",err,error,*999)
1824 & stiffness_matrix,err,error,*999)
1826 local_error=
"The equations time dependence type of "// &
1829 CALL flagerror(local_error,err,error,*999)
1832 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
1836 CALL flagerror(
"Equations is not associated.",err,error,*999)
1839 exits(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_2")
1841 999 errorsexits(
"EQUATIONS_MAPPING_DYNAMIC_MATRICES_SET_2",err,error)
1852 & stiffness_matrix_coefficient,err,error,*)
1856 REAL(DP),
INTENT(IN) :: DAMPING_MATRIX_COEFFICIENT
1857 REAL(DP),
INTENT(IN) :: STIFFNESS_MATRIX_COEFFICIENT
1858 INTEGER(INTG),
INTENT(OUT) :: ERR
1865 enters(
"EquationsMapping_DynamicMatricesCoeffsSet1",err,error,*999)
1867 IF(
ASSOCIATED(equations_mapping))
THEN 1868 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 1869 CALL flagerror(
"Equations mapping has already been finished.",err,error,*999)
1871 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
1872 IF(
ASSOCIATED(create_values_cache))
THEN 1873 equations=>equations_mapping%EQUATIONS
1874 IF(
ASSOCIATED(equations))
THEN 1875 SELECT CASE(equations%TIME_DEPENDENCE)
1877 CALL flagerror(
"Can not set dynamic matrix coefficients for static equations.",err,error,*999)
1879 CALL flagerror(
"Can not set dynamic matrix coefficients for quasi-static equations.",err,error,*999)
1881 IF(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER/=0)
THEN 1882 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER)= &
1883 & stiffness_matrix_coefficient
1885 IF(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER/=0)
THEN 1886 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER)= &
1887 & damping_matrix_coefficient
1890 CALL flagerror(
"Need to specify three matrix coefficients for second order dynamic equations.", &
1893 local_error=
"The equations time dependence type of "// &
1896 CALL flagerror(local_error,err,error,*999)
1899 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
1902 CALL flagerror(
"Equations mapping create values cache is not associated.",err,error,*999)
1906 CALL flagerror(
"Equations is not associated.",err,error,*999)
1909 exits(
"EquationsMapping_DynamicMatricesCoeffsSet1")
1911 999 errorsexits(
"EquationsMapping_DynamicMatricesCoeffsSet1",err,error)
1922 & damping_matrix_coefficient,stiffness_matrix_coefficient,err,error,*)
1926 REAL(DP),
INTENT(IN) :: MASS_MATRIX_COEFFICIENT
1927 REAL(DP),
INTENT(IN) :: DAMPING_MATRIX_COEFFICIENT
1928 REAL(DP),
INTENT(IN) :: STIFFNESS_MATRIX_COEFFICIENT
1929 INTEGER(INTG),
INTENT(OUT) :: ERR
1936 enters(
"EquationsMapping_DynamicMatricesCoeffsSet2",err,error,*999)
1938 IF(
ASSOCIATED(equations_mapping))
THEN 1939 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 1940 CALL flagerror(
"Equations mapping has already been finished.",err,error,*999)
1942 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
1943 IF(
ASSOCIATED(create_values_cache))
THEN 1944 equations=>equations_mapping%EQUATIONS
1945 IF(
ASSOCIATED(equations))
THEN 1946 SELECT CASE(equations%TIME_DEPENDENCE)
1948 CALL flagerror(
"Can not set dynamic matrices for static equations.",err,error,*999)
1950 CALL flagerror(
"Can not set dynamic matrices for quasi-static equations.",err,error,*999)
1952 CALL flagerror(
"Need to specify two matrix coefficients for second order dynamic equations.",err,error,*999)
1954 IF(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER/=0)
THEN 1955 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(create_values_cache%DYNAMIC_STIFFNESS_MATRIX_NUMBER)= &
1956 & stiffness_matrix_coefficient
1958 IF(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER/=0)
THEN 1959 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(create_values_cache%DYNAMIC_DAMPING_MATRIX_NUMBER)= &
1960 & damping_matrix_coefficient
1962 IF(create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER/=0)
THEN 1963 create_values_cache%DYNAMIC_MATRIX_COEFFICIENTS(create_values_cache%DYNAMIC_MASS_MATRIX_NUMBER)= &
1964 & mass_matrix_coefficient
1967 local_error=
"The equations time dependence type of "// &
1970 CALL flagerror(local_error,err,error,*999)
1973 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
1976 CALL flagerror(
"Equations mapping create values cache is not associated.",err,error,*999)
1980 CALL flagerror(
"Equations is not associated.",err,error,*999)
1983 exits(
"EquationsMapping_DynamicMatricesCoeffsSet2")
1985 999 errorsexits(
"EquationsMapping_DynamicMatricesCoeffsSet2",err,error)
1999 INTEGER(INTG),
INTENT(IN) :: DYNAMIC_VARIABLE_TYPE
2000 INTEGER(INTG),
INTENT(OUT) :: ERR
2003 INTEGER(INTG) :: matrix_idx
2009 LOGICAL :: IS_RESIDUAL_TYPE
2011 enters(
"EQUATIONS_MAPPING_DYNAMIC_VARIABLE_TYPE_SET",err,error,*999)
2013 IF(
ASSOCIATED(equations_mapping))
THEN 2014 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 2015 CALL flagerror(
"Equations mapping have been finished.",err,error,*999)
2017 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
2018 IF(
ASSOCIATED(create_values_cache))
THEN 2019 IF(dynamic_variable_type==0)
THEN 2020 create_values_cache%DYNAMIC_VARIABLE_TYPE=0
2022 equations=>equations_mapping%EQUATIONS
2023 IF(
ASSOCIATED(equations))
THEN 2024 equations_set=>equations%EQUATIONS_SET
2025 IF(
ASSOCIATED(equations_set))
THEN 2028 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
2029 IF(
ASSOCIATED(dependent_field))
THEN 2032 is_residual_type=.false.
2033 DO matrix_idx=1,create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES
2034 IF(create_values_cache%RESIDUAL_VARIABLE_TYPES(matrix_idx)==dynamic_variable_type)
THEN 2035 is_residual_type=.true.
2038 IF(is_residual_type.NEQV..true.)
THEN 2039 local_error=
"The specified dynamic variable type of "// &
2041 &
" is not the same as any residual variable type." 2042 CALL flagerror(local_error,err,error,*999)
2045 IF(create_values_cache%RHS_VARIABLE_TYPE==dynamic_variable_type)
THEN 2046 local_error=
"The specified dynamic variable type of "// &
2048 &
" is the same as the variable type for the RHS vector." 2049 CALL flagerror(local_error,err,error,*999)
2051 DO matrix_idx=1,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
2052 IF(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)==dynamic_variable_type)
THEN 2053 local_error=
"The specified dynamic variable type of "// &
2055 &
" is the same as the variable type for linear matrix number "// &
2057 CALL flagerror(local_error,err,error,*999)
2061 IF(dynamic_variable_type>=1.AND.dynamic_variable_type<=field_number_of_variable_types)
THEN 2062 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(dynamic_variable_type)%PTR))
THEN 2063 equations_mapping%CREATE_VALUES_CACHE%DYNAMIC_VARIABLE_TYPE=dynamic_variable_type
2065 local_error=
"The specified dynamic variable type of "// &
2067 &
" is not defined on the dependent field." 2068 CALL flagerror(local_error,err,error,*999)
2071 local_error=
"The specified dynamic variable type of "// &
2073 &
" is invalid. The number must either be zero or >= 1 and <= "// &
2075 CALL flagerror(local_error,err,error,*999)
2078 CALL flagerror(
"Dependent field is not associated",err,error,*999)
2081 CALL flagerror(
"The equations are not dynamic equations.",err,error,*999)
2084 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
2087 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
2091 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
2095 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
2098 exits(
"EQUATIONS_MAPPING_DYNAMIC_VARIABLE_TYPE_SET")
2100 999 errorsexits(
"EQUATIONS_MAPPING_DYNAMIC_VARIABLE_TYPE_SET",err,error)
2113 INTEGER(INTG),
INTENT(OUT) :: ERR
2117 enters(
"EquationsMapping_EquatsJacobianToVarMapFinalise",err,error,*999)
2119 IF(
ALLOCATED(equations_jacobian_to_var_map%EQUATIONS_COLUMN_TO_DOF_VARIABLE_MAP)) &
2120 &
DEALLOCATE(equations_jacobian_to_var_map%EQUATIONS_COLUMN_TO_DOF_VARIABLE_MAP)
2122 exits(
"EquationsMapping_EquatsJacobianToVarMapFinalise")
2124 999
errors(
"EquationsMapping_EquatsJacobianToVarMapFinalise",err,error)
2125 exits(
"EquationsMapping_EquatsJacobianToVarMapFinalise")
2139 INTEGER(INTG),
INTENT(OUT) :: ERR
2143 enters(
"EquationsMapping_EquatsJacobianToVarMapInitialise",err,error,*999)
2145 equations_jacobian_to_var_map%VARIABLE_TYPE=0
2146 NULLIFY(equations_jacobian_to_var_map%VARIABLE)
2147 NULLIFY(equations_jacobian_to_var_map%JACOBIAN)
2148 equations_jacobian_to_var_map%NUMBER_OF_COLUMNS=0
2149 equations_jacobian_to_var_map%JACOBIAN_COEFFICIENT=0
2150 NULLIFY(equations_jacobian_to_var_map%COLUMN_DOFS_MAPPING)
2152 exits(
"EquationsMapping_EquatsJacobianToVarMapInitialise")
2154 999
errors(
"EquationsMapping_EquatsJacobianToVarMapInitialise",err,error)
2155 exits(
"EquationsMapping_EquatsJacobianToVarMapInitialise")
2169 INTEGER(INTG),
INTENT(OUT) :: ERR
2173 enters(
"EquationsMapping_EquationsMatrixToVarMapFinalise",err,error,*999)
2175 IF(
ALLOCATED(equations_matrix_to_var_map%COLUMN_TO_DOF_MAP)) &
2176 &
DEALLOCATE(equations_matrix_to_var_map%COLUMN_TO_DOF_MAP)
2178 exits(
"EquationsMapping_EquationsMatrixToVarMapFinalise")
2180 999
errors(
"EquationsMapping_EquationsMatrixToVarMapFinalise",err,error)
2181 exits(
"EquationsMapping_EquationsMatrixToVarMapFinalise")
2195 INTEGER(INTG),
INTENT(OUT) :: ERR
2199 enters(
"EquationsMapping_EquatsMatrixToVarMapInitialise",err,error,*999)
2201 equations_matrix_to_var_map%MATRIX_NUMBER=0
2202 equations_matrix_to_var_map%VARIABLE_TYPE=0
2203 NULLIFY(equations_matrix_to_var_map%VARIABLE)
2204 equations_matrix_to_var_map%NUMBER_OF_COLUMNS=0
2205 equations_matrix_to_var_map%MATRIX_COEFFICIENT=1.0_dp
2206 NULLIFY(equations_matrix_to_var_map%COLUMN_DOFS_MAPPING)
2208 exits(
"EquationsMapping_EquatsMatrixToVarMapInitialise")
2210 999
errors(
"EquationsMapping_EquatsMatrixToVarMapInitialise",err,error)
2211 exits(
"EquationsMapping_EquatsMatrixToVarMapInitialise")
2225 INTEGER(INTG),
INTENT(OUT) :: ERR
2229 enters(
"EQUATIONS_MAPPING_FINALISE",err,error,*999)
2231 IF(
ASSOCIATED(equations_mapping))
THEN 2233 NULLIFY(equations_mapping%ROW_DOFS_MAPPING)
2240 DEALLOCATE(equations_mapping)
2243 exits(
"EQUATIONS_MAPPING_FINALISE")
2245 999 errorsexits(
"EQUATIONS_MAPPING_FINALISE",err,error)
2259 INTEGER(INTG),
INTENT(OUT) :: ERR
2262 INTEGER(INTG) :: DUMMY_ERR
2265 enters(
"EQUATIONS_MAPPING_INITIALISE",err,error,*998)
2267 IF(
ASSOCIATED(equations))
THEN 2268 IF(
ASSOCIATED(equations%EQUATIONS_MAPPING))
THEN 2269 CALL flagerror(
"Equations mapping is already associated.",err,error,*998)
2271 ALLOCATE(equations%EQUATIONS_MAPPING,stat=err)
2272 IF(err/=0)
CALL flagerror(
"Could not allocate equations equations mapping.",err,error,*999)
2273 equations%EQUATIONS_MAPPING%EQUATIONS=>equations
2274 equations%EQUATIONS_MAPPING%EQUATIONS_MAPPING_FINISHED=.false.
2275 NULLIFY(equations%EQUATIONS_MAPPING%ROW_DOFS_MAPPING)
2276 NULLIFY(equations%EQUATIONS_MAPPING%DYNAMIC_MAPPING)
2277 NULLIFY(equations%EQUATIONS_MAPPING%LINEAR_MAPPING)
2278 NULLIFY(equations%EQUATIONS_MAPPING%NONLINEAR_MAPPING)
2279 NULLIFY(equations%EQUATIONS_MAPPING%RHS_MAPPING)
2280 NULLIFY(equations%EQUATIONS_MAPPING%SOURCE_MAPPING)
2281 NULLIFY(equations%EQUATIONS_MAPPING%CREATE_VALUES_CACHE)
2285 CALL flagerror(
"Equations is not associated.",err,error,*998)
2288 exits(
"EQUATIONS_MAPPING_INITIALISE")
2291 998 errorsexits(
"EQUATIONS_MAPPING_INITIALISE",err,error)
2305 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_VARIABLES
2306 INTEGER(INTG),
INTENT(OUT) :: ERR
2309 INTEGER(INTG) :: PREVIOUS_NUMBER,MIN_NUMBER
2310 INTEGER(INTG),
ALLOCATABLE :: NEW_RESIDUAL_VARIABLE_TYPES(:)
2313 enters(
"EquationsMapping_ResidualVariablesNumberSet",err,error,*999)
2315 IF(
ASSOCIATED(equations_mapping))
THEN 2316 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 2317 CALL flagerror(
"Equations mapping have been finished.",err,error,*999)
2319 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
2320 IF(
ASSOCIATED(create_values_cache))
THEN 2321 previous_number=create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES
2322 IF(number_of_variables/=previous_number)
THEN 2324 min_number=min(number_of_variables,previous_number)
2325 ALLOCATE(new_residual_variable_types(number_of_variables),stat=err)
2326 IF(err/=0)
CALL flagerror(
"Could not allocate new residual variable types.",err,error,*999)
2327 new_residual_variable_types=0
2328 new_residual_variable_types(1:min_number)=create_values_cache%RESIDUAL_VARIABLE_TYPES(1:min_number)
2329 CALL move_alloc(new_residual_variable_types,create_values_cache%RESIDUAL_VARIABLE_TYPES)
2331 create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES=number_of_variables
2334 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
2338 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
2341 exits(
"EquationsMapping_ResidualVariablesNumberSet")
2343 999 errorsexits(
"EquationsMapping_ResidualVariablesNumberSet",err,error)
2357 INTEGER(INTG),
INTENT(OUT) :: ERR
2360 INTEGER(INTG) :: matrix_idx,variable_type
2362 enters(
"EQUATIONS_MAPPING_LINEAR_MAPPING_FINALISE",err,error,*999)
2364 IF(
ASSOCIATED(linear_mapping))
THEN 2365 IF(
ALLOCATED(linear_mapping%LINEAR_MATRIX_VARIABLE_TYPES))
DEALLOCATE(linear_mapping%LINEAR_MATRIX_VARIABLE_TYPES)
2366 IF(
ALLOCATED(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS))
THEN 2367 DO variable_type=1,
SIZE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS,1)
2369 & var_to_equations_matrices_maps(variable_type),err,error,*999)
2371 DEALLOCATE(linear_mapping%VAR_TO_EQUATIONS_MATRICES_MAPS)
2373 IF(
ALLOCATED(linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS))
THEN 2374 DO matrix_idx=1,
SIZE(linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS,1)
2376 & equations_matrix_to_var_maps(matrix_idx),err,error,*999)
2378 DEALLOCATE(linear_mapping%EQUATIONS_MATRIX_TO_VAR_MAPS)
2380 IF(
ALLOCATED(linear_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS))
DEALLOCATE(linear_mapping%EQUATIONS_ROW_TO_VARIABLE_DOF_MAPS)
2381 DEALLOCATE(linear_mapping)
2384 exits(
"EQUATIONS_MAPPING_LINEAR_MAPPING_FINALISE")
2386 999 errorsexits(
"EQUATIONS_MAPPING_LINEAR_MAPPING_INITIALISE",err,error)
2399 INTEGER(INTG),
INTENT(OUT) :: ERR
2402 INTEGER(INTG) :: DUMMY_ERR
2405 enters(
"EQUATIONS_MAPPING_LINEAR_MAPPING_INITIALISE",err,error,*998)
2407 IF(
ASSOCIATED(equations_mapping))
THEN 2408 IF(
ASSOCIATED(equations_mapping%LINEAR_MAPPING))
THEN 2409 CALL flagerror(
"Equations mapping linear mapping is already associated.",err,error,*998)
2411 ALLOCATE(equations_mapping%LINEAR_MAPPING,stat=err)
2412 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping linear mapping.",err,error,*999)
2413 equations_mapping%LINEAR_MAPPING%EQUATIONS_MAPPING=>equations_mapping
2414 equations_mapping%LINEAR_MAPPING%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=0
2415 equations_mapping%LINEAR_MAPPING%NUMBER_OF_LINEAR_MATRIX_VARIABLES=0
2418 CALL flagerror(
"Equations is not associated.",err,error,*998)
2421 exits(
"EQUATIONS_MAPPING_LINEAR_MAPPING_INITIALISE")
2424 998 errorsexits(
"EQUATIONS_MAPPING_LINEAR_MAPPING_INITIALISE",err,error)
2437 REAL(DP),
INTENT(IN) :: LINEAR_MATRIX_COEFFICIENTS(:)
2438 INTEGER(INTG),
INTENT(OUT) :: ERR
2444 enters(
"EquationsMapping_LinearMatricesCoeffsSet",err,error,*999)
2446 IF(
ASSOCIATED(equations_mapping))
THEN 2447 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 2448 CALL flagerror(
"Equations mapping is finished.",err,error,*999)
2450 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
2451 IF(
ASSOCIATED(create_values_cache))
THEN 2452 IF(
SIZE(linear_matrix_coefficients,1)==create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)
THEN 2453 create_values_cache%LINEAR_MATRIX_COEFFICIENTS(1:create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)= &
2454 & linear_matrix_coefficients(1:create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)
2456 local_error=
"Invalid size of linear matrix coefficeints. The size of the supplied array ("// &
2458 &
") must match the number of linear equations matrices ("// &
2460 & number_of_linear_equations_matrices,
"*",err,error))//
")." 2461 CALL flagerror(local_error,err,error,*999)
2464 CALL flagerror(
"Equations mapping create values cache is not associated.",err,error,*999)
2468 CALL flagerror(
"Equations matrices is not associated.",err,error,*999)
2471 exits(
"EquationsMapping_LinearMatricesCoeffsSet")
2473 999 errorsexits(
"EquationsMapping_LinearMatricesCoeffsSet",err,error)
2487 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_LINEAR_EQUATIONS_MATRICES
2488 INTEGER(INTG),
INTENT(OUT) :: ERR
2491 INTEGER(INTG) :: matrix_idx
2492 INTEGER(INTG),
ALLOCATABLE :: OLD_LINEAR_MATRIX_VARIABLE_TYPES(:)
2493 REAL(DP),
ALLOCATABLE :: OLD_LINEAR_MATRIX_COEFFICIENTS(:)
2500 enters(
"EquationsMapping_LinearMatricesNumberSet",err,error,*999)
2502 IF(
ASSOCIATED(equations_mapping))
THEN 2503 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 2504 CALL flagerror(
"Equations mapping has been finished",err,error,*999)
2506 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
2507 IF(
ASSOCIATED(create_values_cache))
THEN 2508 equations=>equations_mapping%EQUATIONS
2509 IF(
ASSOCIATED(equations))
THEN 2510 equations_set=>equations%EQUATIONS_SET
2511 IF(
ASSOCIATED(equations_set))
THEN 2513 SELECT CASE(equations%TIME_DEPENDENCE)
2515 SELECT CASE(equations%LINEARITY)
2517 IF(create_values_cache%RHS_VARIABLE_TYPE==0)
THEN 2518 IF(number_of_linear_equations_matrices<1)
THEN 2519 local_error=
"The specified number of linear matrices of "// &
2521 &
" is invalid. For non-dynamic linear problems without a equations set RHS the number must be "// &
2523 CALL flagerror(local_error,err,error,*999)
2526 IF(number_of_linear_equations_matrices<1)
THEN 2527 local_error=
"The specified number of linear matrices of "// &
2529 &
" is invalid. For non-dynamic linear problems with a equations set RHS the number "// &
2531 CALL flagerror(local_error,err,error,*999)
2535 IF(number_of_linear_equations_matrices<0.OR. &
2536 & number_of_linear_equations_matrices>field_number_of_variable_types-2)
THEN 2537 local_error=
"The specified number of linear matrices of "// &
2539 &
") is invalid. For non-dynamic non-linear problems the number must be between >= 0 and <= "// &
2541 CALL flagerror(local_error,err,error,*999)
2544 local_error=
"The equations linearity type of "// &
2546 CALL flagerror(local_error,err,error,*999)
2549 SELECT CASE(equations%LINEARITY)
2551 IF(create_values_cache%RHS_VARIABLE_TYPE==0)
THEN 2552 IF(number_of_linear_equations_matrices<1.OR. &
2553 & number_of_linear_equations_matrices>field_number_of_variable_types-1)
THEN 2554 local_error=
"The specified number of linear matrices of "// &
2556 &
" is invalid. For dynamic linear problems without a equations set RHS the number must be "// &
2557 &
"between >= 1 and <= "//
trim(
numbertovstring(field_number_of_variable_types-1,
"*",err,error))
2558 CALL flagerror(local_error,err,error,*999)
2561 IF(number_of_linear_equations_matrices<0)
THEN 2562 local_error=
"The specified number of linear matrices of "// &
2564 &
" is invalid. For dynamic linear problems with a equations set RHS the number "// &
2566 CALL flagerror(local_error,err,error,*999)
2570 CALL flagerror(
"Not implemented.",err,error,*999)
2572 local_error=
"The equations linearity type of "// &
2574 CALL flagerror(local_error,err,error,*999)
2577 local_error=
"The equations time dependence type of "// &
2579 CALL flagerror(local_error,err,error,*999)
2582 IF(number_of_linear_equations_matrices/=create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)
THEN 2583 IF(create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES>0)
THEN 2584 ALLOCATE(old_linear_matrix_variable_types(create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES),stat=err)
2585 IF(err/=0)
CALL flagerror(
"Could not allocate old linear matrix variable types.",err,error,*999)
2586 ALLOCATE(old_linear_matrix_coefficients(create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES),stat=err)
2587 IF(err/=0)
CALL flagerror(
"Could not allocate old linear matrix coefficients.",err,error,*999)
2588 old_linear_matrix_variable_types(1:create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)= &
2589 & create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(1:create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)
2590 old_linear_matrix_coefficients(1:create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)= &
2591 & create_values_cache%LINEAR_MATRIX_COEFFICIENTS(1:create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)
2593 IF(
ALLOCATED(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES)) &
2594 &
DEALLOCATE(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES)
2595 IF(
ALLOCATED(create_values_cache%LINEAR_MATRIX_COEFFICIENTS)) &
2596 &
DEALLOCATE(create_values_cache%LINEAR_MATRIX_COEFFICIENTS)
2597 ALLOCATE(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(number_of_linear_equations_matrices),stat=err)
2598 IF(err/=0)
CALL flagerror(
"Could not allocate linear matrix variable types.",err,error,*999)
2599 ALLOCATE(create_values_cache%LINEAR_MATRIX_COEFFICIENTS(number_of_linear_equations_matrices),stat=err)
2600 IF(err/=0)
CALL flagerror(
"Could not allocate linear matrix coefficients.",err,error,*999)
2601 IF(create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES>0)
THEN 2602 IF(number_of_linear_equations_matrices>create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)
THEN 2603 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(1:create_values_cache% &
2604 & number_of_linear_equations_matrices)=old_linear_matrix_variable_types
2605 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(create_values_cache% &
2606 & number_of_linear_equations_matrices+1:number_of_linear_equations_matrices)= &
2607 & old_linear_matrix_variable_types(1)
2608 create_values_cache%LINEAR_MATRIX_COEFFICIENTS(1:create_values_cache% &
2609 & number_of_linear_equations_matrices)=old_linear_matrix_coefficients
2610 create_values_cache%LINEAR_MATRIX_COEFFICIENTS(create_values_cache% &
2611 & number_of_linear_equations_matrices+1:number_of_linear_equations_matrices)= &
2612 & old_linear_matrix_coefficients(1)
2614 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(1:number_of_linear_equations_matrices)= &
2615 & old_linear_matrix_variable_types(1:number_of_linear_equations_matrices)
2616 create_values_cache%LINEAR_MATRIX_COEFFICIENTS(1:number_of_linear_equations_matrices)= &
2617 & old_linear_matrix_coefficients(1:number_of_linear_equations_matrices)
2620 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
2621 IF(
ASSOCIATED(dependent_field))
THEN 2622 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES=0
2623 SELECT CASE(equations%TIME_DEPENDENCE)
2625 SELECT CASE(equations%LINEARITY)
2627 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR))
THEN 2628 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(1)=dependent_field% &
2629 & variable_type_map(field_u_variable_type)%PTR%VARIABLE_TYPE
2631 CALL flagerror(
"Not implemented.",err,error,*999)
2633 DO matrix_idx=2,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
2634 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(matrix_idx+1)%PTR))
THEN 2635 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)= &
2636 & dependent_field%VARIABLE_TYPE_MAP(matrix_idx+1)%PTR%VARIABLE_TYPE
2638 CALL flagerror(
"Not implemented.",err,error,*999)
2642 DO matrix_idx=1,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
2643 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(matrix_idx+2)%PTR))
THEN 2644 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)= &
2645 & dependent_field%VARIABLE_TYPE_MAP(matrix_idx+2)%PTR%VARIABLE_TYPE
2647 CALL flagerror(
"Not implemented.",err,error,*999)
2651 local_error=
"The equations linearity type of "// &
2653 CALL flagerror(local_error,err,error,*999)
2656 SELECT CASE(equations%LINEARITY)
2658 DO matrix_idx=1,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
2659 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(matrix_idx+2)%PTR))
THEN 2660 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)= &
2661 & dependent_field%VARIABLE_TYPE_MAP(matrix_idx+2)%PTR%VARIABLE_TYPE
2663 CALL flagerror(
"Not implemented.",err,error,*999)
2667 CALL flagerror(
"Not implemented.",err,error,*999)
2669 local_error=
"The equations linearity type of "// &
2671 CALL flagerror(local_error,err,error,*999)
2674 local_error=
"The equations time dependence type of "// &
2676 CALL flagerror(local_error,err,error,*999)
2678 create_values_cache%LINEAR_MATRIX_COEFFICIENTS=1.0_dp
2680 CALL flagerror(
"Equations set dependent field is not associated.",err,error,*999)
2683 create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES=number_of_linear_equations_matrices
2684 IF(
ALLOCATED(old_linear_matrix_variable_types))
DEALLOCATE(old_linear_matrix_variable_types)
2685 IF(
ALLOCATED(old_linear_matrix_coefficients))
DEALLOCATE(old_linear_matrix_coefficients)
2688 CALL flagerror(
"Equations equations set is not associated",err,error,*999)
2691 CALL flagerror(
"Equations mapping equations is not associated",err,error,*999)
2694 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
2698 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
2701 exits(
"EquationsMapping_LinearMatricesNumberSet")
2703 999
IF(
ALLOCATED(old_linear_matrix_variable_types))
DEALLOCATE(old_linear_matrix_variable_types)
2704 IF(
ALLOCATED(old_linear_matrix_coefficients))
DEALLOCATE(old_linear_matrix_coefficients)
2705 errorsexits(
"EquationsMapping_LinearMatricesNumberSet",err,error)
2719 INTEGER(INTG),
INTENT(IN) :: LINEAR_MATRIX_VARIABLE_TYPES(:)
2720 INTEGER(INTG),
INTENT(OUT) :: ERR
2723 INTEGER(INTG) :: matrix_idx
2730 enters(
"EquationsMapping_LinearMatricesVariableTypesSet",err,error,*999)
2732 IF(
ASSOCIATED(equations_mapping))
THEN 2733 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 2734 CALL flagerror(
"Equations mapping has been finished.",err,error,*999)
2736 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
2737 IF(
ASSOCIATED(create_values_cache))
THEN 2738 IF(
SIZE(linear_matrix_variable_types,1)==create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES)
THEN 2739 equations=>equations_mapping%EQUATIONS
2740 IF(
ASSOCIATED(equations))
THEN 2741 equations_set=>equations%EQUATIONS_SET
2742 IF(
ASSOCIATED(equations_set))
THEN 2743 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
2744 IF(
ASSOCIATED(dependent_field))
THEN 2746 DO matrix_idx=1,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
2747 IF(linear_matrix_variable_types(matrix_idx)/=0)
THEN 2750 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE==linear_matrix_variable_types(matrix_idx))
THEN 2751 local_error=
"The specified linear matrix variable type of "// &
2754 &
" is the same as the variable type for the dynamic matrices." 2755 CALL flagerror(local_error,err,error,*999)
2757 IF(create_values_cache%RHS_VARIABLE_TYPE==linear_matrix_variable_types(matrix_idx))
THEN 2758 local_error=
"The specified linear matrix variable type of "// &
2761 &
" is the same as the variable type for the RHS vector." 2762 CALL flagerror(local_error,err,error,*999)
2765 IF(linear_matrix_variable_types(matrix_idx)>=1.OR. &
2766 & linear_matrix_variable_types(matrix_idx)<=field_number_of_variable_types)
THEN 2767 IF(.NOT.
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(linear_matrix_variable_types(matrix_idx))%PTR))
THEN 2768 local_error=
"The linear matrix variable type of "// &
2771 &
" is not defined on the dependent field." 2772 CALL flagerror(local_error,err,error,*999)
2775 local_error=
"The linear matrix variable type of "// &
2778 &
" is invalid. The variable types must be either zero or >= 1 and <= "// &
2780 CALL flagerror(local_error,err,error,*999)
2784 create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(1:
SIZE(linear_matrix_variable_types))= &
2785 & linear_matrix_variable_types(1:
SIZE(linear_matrix_variable_types))
2787 CALL flagerror(
"Dependent field is not associated.",err,error,*999)
2790 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
2793 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
2796 local_error=
"Invalid size of linear matrix variable types. The size of the supplied array ("// &
2798 &
") must match the number of linear equations matrices ("// &
2800 & number_of_linear_equations_matrices,
"*",err,error))//
")." 2801 CALL flagerror(local_error,err,error,*999)
2804 CALL flagerror(
"Equations mapping create values cache is not associated.",err,error,*999)
2808 CALL flagerror(
"Equations mapping is not associated.",err,error,*999)
2811 exits(
"EquationsMapping_LinearMatricesVariableTypesSet")
2813 999
errors(
"EquationsMapping_LinearMatricesVariableTypesSet",err,error)
2814 exits(
"EquationsMapping_LinearMatricesVariableTypesSet")
2828 INTEGER(INTG),
INTENT(OUT) :: ERR
2831 INTEGER(INTG) matrix_idx
2833 enters(
"EquationsMapping_NonlinearMappingFinalise",err,error,*999)
2835 IF(
ASSOCIATED(nonlinear_mapping))
THEN 2836 DO matrix_idx=1,nonlinear_mapping%NUMBER_OF_RESIDUAL_VARIABLES
2840 IF(
ALLOCATED(nonlinear_mapping%EQUATIONS_ROW_TO_RESIDUAL_DOF_MAP)) &
2841 &
DEALLOCATE(nonlinear_mapping%EQUATIONS_ROW_TO_RESIDUAL_DOF_MAP)
2842 IF(
ALLOCATED(nonlinear_mapping%RESIDUAL_VARIABLES)) &
2843 &
DEALLOCATE(nonlinear_mapping%RESIDUAL_VARIABLES)
2844 IF(
ALLOCATED(nonlinear_mapping%VAR_TO_JACOBIAN_MAP)) &
2845 &
DEALLOCATE(nonlinear_mapping%VAR_TO_JACOBIAN_MAP)
2846 IF(
ALLOCATED(nonlinear_mapping%JACOBIAN_TO_VAR_MAP)) &
2847 &
DEALLOCATE(nonlinear_mapping%JACOBIAN_TO_VAR_MAP)
2848 DEALLOCATE(nonlinear_mapping)
2851 exits(
"EquationsMapping_NonlinearMappingFinalise")
2853 999 errorsexits(
"EquationsMapping_NonlinearMappingFinalise",err,error)
2867 INTEGER(INTG),
INTENT(OUT) :: ERR
2870 INTEGER(INTG) :: DUMMY_ERR
2873 enters(
"EquationsMapping_NonlinearMappingInitialise",err,error,*998)
2875 IF(
ASSOCIATED(equations_mapping))
THEN 2876 IF(
ASSOCIATED(equations_mapping%NONLINEAR_MAPPING))
THEN 2877 CALL flagerror(
"Equations mapping nonlinear mapping is already associated.",err,error,*998)
2879 ALLOCATE(equations_mapping%NONLINEAR_MAPPING,stat=err)
2880 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping nonlinear mapping.",err,error,*999)
2881 equations_mapping%NONLINEAR_MAPPING%EQUATIONS_MAPPING=>equations_mapping
2882 equations_mapping%NONLINEAR_MAPPING%NUMBER_OF_RESIDUAL_VARIABLES=0
2883 equations_mapping%NONLINEAR_MAPPING%RESIDUAL_COEFFICIENT=1.0_dp
2886 CALL flagerror(
"Equations is not associated.",err,error,*998)
2889 exits(
"EquationsMapping_NonlinearMappingInitialise")
2892 998 errorsexits(
"EquationsMapping_NonlinearMappingInitialise",err,error)
2906 REAL(DP),
INTENT(IN) :: RESIDUAL_COEFFICIENT
2907 INTEGER(INTG),
INTENT(OUT) :: ERR
2911 enters(
"EQUATIONS_MAPPING_RESIDUAL_COEFF_SET",err,error,*999)
2913 IF(
ASSOCIATED(equations_mapping))
THEN 2914 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 2915 CALL flagerror(
"Equations mapping have been finished.",err,error,*999)
2917 IF(
ASSOCIATED(equations_mapping%CREATE_VALUES_CACHE))
THEN 2918 equations_mapping%CREATE_VALUES_CACHE%RESIDUAL_COEFFICIENT=residual_coefficient
2920 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
2924 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
2927 exits(
"EQUATIONS_MAPPING_RESIDUAL_COEFF_SET")
2929 999 errorsexits(
"EQUATIONS_MAPPING_RESIDUAL_COEFF_SET",err,error)
2942 INTEGER(INTG),
INTENT(IN) :: RESIDUAL_VARIABLE_TYPES(:)
2943 INTEGER(INTG),
INTENT(OUT) :: ERR
2946 INTEGER(INTG) :: matrix_idx,variable_idx,NUMBER_OF_RESIDUAL_VARIABLES,RESIDUAL_VARIABLE_TYPE
2953 enters(
"EquationsMapping_ResidualVariableTypesSet",err,error,*999)
2955 IF(
ASSOCIATED(equations_mapping))
THEN 2956 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 2957 CALL flagerror(
"Equations mapping have been finished.",err,error,*999)
2959 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
2960 IF(
ASSOCIATED(create_values_cache))
THEN 2961 number_of_residual_variables=
SIZE(residual_variable_types,1)
2962 IF(number_of_residual_variables==create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES)
THEN 2963 equations=>equations_mapping%EQUATIONS
2964 IF(
ASSOCIATED(equations))
THEN 2965 equations_set=>equations%EQUATIONS_SET
2966 IF(
ASSOCIATED(equations_set))
THEN 2968 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
2969 IF(
ASSOCIATED(dependent_field))
THEN 2971 DO variable_idx=1,number_of_residual_variables
2972 residual_variable_type=residual_variable_types(variable_idx)
2974 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE==residual_variable_type)
THEN 2975 local_error=
"The specified residual variable type of "// &
2977 &
" is the same as the variable type for the dynamic matrices." 2978 CALL flagerror(local_error,err,error,*999)
2982 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE/=residual_variable_type)
THEN 2983 local_error=
"The specified residual variable type of "// &
2985 &
" is not the same as the variable type for the dynamic matrices." 2986 CALL flagerror(local_error,err,error,*999)
2989 CALL flagerror(
"The equations set time dependence is not set.",err,error,*999)
2991 IF(create_values_cache%RHS_VARIABLE_TYPE==residual_variable_type)
THEN 2992 local_error=
"The specified residual variable type of "// &
2994 &
" is the same as the variable type for the RHS vector." 2995 CALL flagerror(local_error,err,error,*999)
2997 DO matrix_idx=1,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
2998 IF(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)==residual_variable_type)
THEN 2999 local_error=
"The specified residual variable type of "// &
3001 &
" is the same as the variable type for linear matrix number "// &
3003 CALL flagerror(local_error,err,error,*999)
3007 IF(residual_variable_type>=1.AND.residual_variable_type<=field_number_of_variable_types)
THEN 3008 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(residual_variable_type)%PTR))
THEN 3009 create_values_cache%RESIDUAL_VARIABLE_TYPES(variable_idx)=residual_variable_type
3011 local_error=
"The specified residual variable type of "// &
3013 &
" is not defined on the dependent field." 3014 CALL flagerror(local_error,err,error,*999)
3017 local_error=
"The specified residual variable type of "// &
3019 &
" is invalid. The variable type must either be zero or >= 1 and <= "// &
3021 CALL flagerror(local_error,err,error,*999)
3025 CALL flagerror(
"Dependent field is not associated",err,error,*999)
3028 CALL flagerror(
"The equations set is not a nonlinear equations set.",err,error,*999)
3031 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
3034 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
3037 local_error=
"Invalid number of variables. The number of residual variables " &
3039 & //
" should be "//
trim(
numbertovstring(create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES,
"*",err,error))
3040 CALL flagerror(local_error,err,error,*999)
3043 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
3047 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
3050 exits(
"EquationsMapping_ResidualVariableTypesSet")
3052 999 errorsexits(
"EquationsMapping_ResidualVariableTypesSet",err,error)
3066 REAL(DP),
INTENT(IN) :: RHS_COEFFICIENT
3067 INTEGER(INTG),
INTENT(OUT) :: ERR
3071 enters(
"EQUATIONS_MAPPING_RHS_COEFF_SET",err,error,*999)
3073 IF(
ASSOCIATED(equations_mapping))
THEN 3074 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 3075 CALL flagerror(
"Equations mapping has been finished.",err,error,*999)
3077 IF(
ASSOCIATED(equations_mapping%CREATE_VALUES_CACHE))
THEN 3078 IF(equations_mapping%CREATE_VALUES_CACHE%RHS_VARIABLE_TYPE/=0)
THEN 3079 equations_mapping%CREATE_VALUES_CACHE%RHS_COEFFICIENT=rhs_coefficient
3081 CALL flagerror(
"The equations mapping RHS variable type has not been set.",err,error,*999)
3084 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
3088 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
3091 exits(
"EQUATIONS_MAPPING_RHS_COEFF_SET")
3093 999 errorsexits(
"EQUATIONS_MAPPING_RHS_COEFF_SET",err,error)
3106 INTEGER(INTG),
INTENT(OUT) :: ERR
3110 enters(
"EQUATIONS_MAPPING_RHS_MAPPING_FINALISE",err,error,*999)
3112 IF(
ASSOCIATED(rhs_mapping))
THEN 3113 IF(
ALLOCATED(rhs_mapping%RHS_DOF_TO_EQUATIONS_ROW_MAP))
DEALLOCATE(rhs_mapping%RHS_DOF_TO_EQUATIONS_ROW_MAP)
3114 IF(
ALLOCATED(rhs_mapping%EQUATIONS_ROW_TO_RHS_DOF_MAP))
DEALLOCATE(rhs_mapping%EQUATIONS_ROW_TO_RHS_DOF_MAP)
3115 DEALLOCATE(rhs_mapping)
3118 exits(
"EQUATIONS_MAPPING_RHS_MAPPING_FINALISE")
3120 999 errorsexits(
"EQUATIONS_MAPPING_RHS_MAPPING_INITIALISE",err,error)
3133 INTEGER(INTG),
INTENT(OUT) :: ERR
3136 INTEGER(INTG) :: DUMMY_ERR
3139 enters(
"EQUATIONS_MAPPING_RHS_MAPPING_INITIALISE",err,error,*998)
3141 IF(
ASSOCIATED(equations_mapping))
THEN 3142 IF(
ASSOCIATED(equations_mapping%RHS_MAPPING))
THEN 3143 CALL flagerror(
"Equations mapping RHS mapping is already associated.",err,error,*998)
3145 ALLOCATE(equations_mapping%RHS_MAPPING,stat=err)
3146 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping RHS mapping.",err,error,*999)
3147 equations_mapping%RHS_MAPPING%EQUATIONS_MAPPING=>equations_mapping
3148 equations_mapping%RHS_MAPPING%RHS_VARIABLE_TYPE=0
3149 NULLIFY(equations_mapping%RHS_MAPPING%RHS_VARIABLE)
3150 NULLIFY(equations_mapping%RHS_MAPPING%RHS_VARIABLE_MAPPING)
3151 equations_mapping%RHS_MAPPING%RHS_COEFFICIENT=1.0_dp
3154 CALL flagerror(
"Equations mapping is not associated.",err,error,*998)
3157 exits(
"EQUATIONS_MAPPING_RHS_MAPPING_INITIALISE")
3160 998 errorsexits(
"EQUATIONS_MAPPING_RHS_MAPPING_INITIALISE",err,error)
3173 INTEGER(INTG),
INTENT(IN) :: RHS_VARIABLE_TYPE
3174 INTEGER(INTG),
INTENT(OUT) :: ERR
3177 INTEGER(INTG) :: matrix_idx
3184 enters(
"EQUATIONS_MAPPING_RHS_VARIABLE_TYPE_SET",err,error,*999)
3186 IF(
ASSOCIATED(equations_mapping))
THEN 3187 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 3188 CALL flagerror(
"Equations mapping has been finished.",err,error,*999)
3190 create_values_cache=>equations_mapping%CREATE_VALUES_CACHE
3191 IF(
ASSOCIATED(create_values_cache))
THEN 3192 IF(rhs_variable_type==0)
THEN 3193 create_values_cache%RHS_VARIABLE_TYPE=0
3195 equations=>equations_mapping%EQUATIONS
3196 IF(
ASSOCIATED(equations))
THEN 3197 equations_set=>equations%EQUATIONS_SET
3198 IF(
ASSOCIATED(equations_set))
THEN 3199 dependent_field=>equations_set%DEPENDENT%DEPENDENT_FIELD
3200 IF(
ASSOCIATED(dependent_field))
THEN 3202 IF(create_values_cache%DYNAMIC_VARIABLE_TYPE==rhs_variable_type)
THEN 3203 local_error=
"The specified RHS variable type of "// &
3205 &
" is the same as the variable type for the dynamic matrices." 3206 CALL flagerror(local_error,err,error,*999)
3208 DO matrix_idx=1,create_values_cache%NUMBER_OF_RESIDUAL_VARIABLES
3209 IF(create_values_cache%RESIDUAL_VARIABLE_TYPES(matrix_idx)==rhs_variable_type)
THEN 3210 local_error=
"The specified RHS variable type of "// &
3212 &
" is the same as the variable type for the residual vector." 3213 CALL flagerror(local_error,err,error,*999)
3216 DO matrix_idx=1,create_values_cache%NUMBER_OF_LINEAR_EQUATIONS_MATRICES
3217 IF(create_values_cache%LINEAR_MATRIX_VARIABLE_TYPES(matrix_idx)==rhs_variable_type)
THEN 3218 local_error=
"The specified RHS variable type of "// &
3220 &
" is the same as the variable type for linear matrix number "// &
3222 CALL flagerror(local_error,err,error,*999)
3226 IF(rhs_variable_type>=1.AND.rhs_variable_type<=field_number_of_variable_types)
THEN 3227 IF(
ASSOCIATED(dependent_field%VARIABLE_TYPE_MAP(rhs_variable_type)%PTR))
THEN 3228 create_values_cache%RHS_VARIABLE_TYPE=rhs_variable_type
3230 local_error=
"The specified RHS variable type of "// &
3232 &
" is not defined on the dependent field." 3233 CALL flagerror(local_error,err,error,*999)
3236 local_error=
"The specified RHS variable type of "//
trim(
numbertovstring(rhs_variable_type,
"*",err,error))// &
3237 &
" is invalid. The number must either be zero or >= 1 and <= "// &
3239 CALL flagerror(local_error,err,error,*999)
3242 CALL flagerror(
"Dependent field is not associated",err,error,*999)
3245 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
3248 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
3252 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
3256 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
3259 exits(
"EQUATIONS_MAPPING_RHS_VARIABLE_TYPE_SET")
3261 999 errorsexits(
"EQUATIONS_MAPPING_RHS_VARIABLE_TYPE_SET",err,error)
3274 REAL(DP),
INTENT(IN) :: SOURCE_COEFFICIENT
3275 INTEGER(INTG),
INTENT(OUT) :: ERR
3279 enters(
"EQUATIONS_MAPPING_SOURCE_COEFF_SET",err,error,*999)
3281 IF(
ASSOCIATED(equations_mapping))
THEN 3282 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 3283 CALL flagerror(
"Equations mapping has been finished.",err,error,*999)
3285 IF(
ASSOCIATED(equations_mapping%CREATE_VALUES_CACHE))
THEN 3286 IF(equations_mapping%CREATE_VALUES_CACHE%SOURCE_VARIABLE_TYPE/=0)
THEN 3287 equations_mapping%CREATE_VALUES_CACHE%SOURCE_COEFFICIENT=source_coefficient
3289 CALL flagerror(
"The equations mapping source variable type has not been set.",err,error,*999)
3292 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
3296 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
3299 exits(
"EQUATIONS_MAPPING_SOURCE_COEFF_SET")
3301 999 errorsexits(
"EQUATIONS_MAPPING_SOURCE_COEFF_SET",err,error)
3314 INTEGER(INTG),
INTENT(OUT) :: ERR
3318 enters(
"EQUATIONS_MAPPING_SOURCE_MAPPING_FINALISE",err,error,*999)
3320 IF(
ASSOCIATED(source_mapping))
THEN 3321 IF(
ALLOCATED(source_mapping%SOURCE_DOF_TO_EQUATIONS_ROW_MAP))
DEALLOCATE(source_mapping%SOURCE_DOF_TO_EQUATIONS_ROW_MAP)
3322 IF(
ALLOCATED(source_mapping%EQUATIONS_ROW_TO_SOURCE_DOF_MAP))
DEALLOCATE(source_mapping%EQUATIONS_ROW_TO_SOURCE_DOF_MAP)
3323 DEALLOCATE(source_mapping)
3326 exits(
"EQUATIONS_MAPPING_SOURCE_MAPPING_FINALISE")
3328 999 errorsexits(
"EQUATIONS_MAPPING_SOURCE_MAPPING_INITIALISE",err,error)
3341 INTEGER(INTG),
INTENT(OUT) :: ERR
3344 INTEGER(INTG) :: DUMMY_ERR
3347 enters(
"EQUATIONS_MAPPING_SOURCE_MAPPING_INITIALISE",err,error,*998)
3349 IF(
ASSOCIATED(equations_mapping))
THEN 3350 IF(
ASSOCIATED(equations_mapping%SOURCE_MAPPING))
THEN 3351 CALL flagerror(
"Equations mapping source mapping is already associated.",err,error,*998)
3353 ALLOCATE(equations_mapping%SOURCE_MAPPING,stat=err)
3354 IF(err/=0)
CALL flagerror(
"Could not allocate equations mapping source mapping.",err,error,*999)
3355 equations_mapping%SOURCE_MAPPING%EQUATIONS_MAPPING=>equations_mapping
3356 equations_mapping%SOURCE_MAPPING%SOURCE_VARIABLE_TYPE=0
3357 NULLIFY(equations_mapping%SOURCE_MAPPING%SOURCE_VARIABLE)
3358 NULLIFY(equations_mapping%SOURCE_MAPPING%SOURCE_VARIABLE_MAPPING)
3359 equations_mapping%SOURCE_MAPPING%SOURCE_COEFFICIENT=1.0_dp
3362 CALL flagerror(
"Equations is not associated.",err,error,*998)
3365 exits(
"EQUATIONS_MAPPING_SOURCE_MAPPING_INITIALISE")
3368 998 errorsexits(
"EQUATIONS_MAPPING_SOURCE_MAPPING_INITIALISE",err,error)
3381 INTEGER(INTG),
INTENT(IN) :: SOURCE_VARIABLE_TYPE
3382 INTEGER(INTG),
INTENT(OUT) :: ERR
3390 enters(
"EQUATIONS_MAPPING_SOURCE_VARIABLE_TYPE_SET",err,error,*999)
3392 IF(
ASSOCIATED(equations_mapping))
THEN 3393 IF(equations_mapping%EQUATIONS_MAPPING_FINISHED)
THEN 3394 CALL flagerror(
"Equations mapping have been finished.",err,error,*999)
3396 IF(
ASSOCIATED(equations_mapping%CREATE_VALUES_CACHE))
THEN 3397 IF(source_variable_type==0)
THEN 3398 equations_mapping%CREATE_VALUES_CACHE%SOURCE_VARIABLE_TYPE=0
3400 equations=>equations_mapping%EQUATIONS
3401 IF(
ASSOCIATED(equations))
THEN 3402 equations_set=>equations%EQUATIONS_SET
3403 IF(
ASSOCIATED(equations_set))
THEN 3404 IF(
ASSOCIATED(equations_set%SOURCE))
THEN 3405 source_field=>equations_set%SOURCE%SOURCE_FIELD
3406 IF(
ASSOCIATED(source_field))
THEN 3408 IF(source_variable_type>=1.AND.source_variable_type<=field_number_of_variable_types)
THEN 3409 IF(
ASSOCIATED(source_field%VARIABLE_TYPE_MAP(source_variable_type)%PTR))
THEN 3410 equations_mapping%CREATE_VALUES_CACHE%SOURCE_VARIABLE_TYPE=source_variable_type
3412 local_error=
"The specified source variable type of "// &
3414 &
" is not defined on the source field." 3415 CALL flagerror(local_error,err,error,*999)
3418 local_error=
"The specified source variable type of "// &
3420 &
" is invalid. The number must either be zero or >= 1 and <= "// &
3422 CALL flagerror(local_error,err,error,*999)
3425 CALL flagerror(
"Source field is not associated",err,error,*999)
3428 CALL flagerror(
"Equations set source is not associated.",err,error,*999)
3431 CALL flagerror(
"Equations equations set is not associated.",err,error,*999)
3434 CALL flagerror(
"Equations mapping equations is not associated.",err,error,*999)
3438 CALL flagerror(
"Equations mapping create values cache is not associated",err,error,*999)
3442 CALL flagerror(
"Equations mapping is not associated",err,error,*999)
3445 exits(
"EQUATIONS_MAPPING_SOURCE_VARIABLE_TYPE_SET")
3447 999 errorsexits(
"EQUATIONS_MAPPING_SOURCE_VARIABLE_TYPE_SET",err,error)
3460 INTEGER(INTG),
INTENT(OUT) :: ERR
3464 enters(
"EquationsMapping_VarToEquatsColumnMapFinalise",err,error,*999)
3466 IF(
ALLOCATED(var_to_equations_column_map%COLUMN_DOF)) &
3467 &
DEALLOCATE(var_to_equations_column_map%COLUMN_DOF)
3469 exits(
"EquationsMapping_VarToEquatsColumnMapFinalise")
3471 999
errors(
"EquationsMapping_VarToEquatsColumnMapFinalise",err,error)
3472 exits(
"EquationsMapping_VarToEquatsColumnMapFinalise")
3486 INTEGER(INTG),
INTENT(OUT) :: ERR
3490 enters(
"EquationsMapping_VarToEquatsJacobianMapFinalise",err,error,*999)
3492 IF(
ALLOCATED(var_to_equations_jacobian_map%DOF_TO_COLUMNS_MAP)) &
3493 &
DEALLOCATE(var_to_equations_jacobian_map%DOF_TO_COLUMNS_MAP)
3494 IF(
ALLOCATED(var_to_equations_jacobian_map%DOF_TO_ROWS_MAP)) &
3495 &
DEALLOCATE(var_to_equations_jacobian_map%DOF_TO_ROWS_MAP)
3497 exits(
"EquationsMapping_VarToEquatsJacobianMapFinalise")
3499 999
errors(
"EquationsMapping_VarToEquatsJacobianMapFinalise",err,error)
3500 exits(
"EquationsMapping_VarToEquatsJacobianMapFinalise")
3514 INTEGER(INTG),
INTENT(OUT) :: ERR
3518 enters(
"EquationsMapping_VarToEquatsJacobianMapInitialise",err,error,*999)
3520 var_to_equations_jacobian_map%VARIABLE_TYPE=0
3521 NULLIFY(var_to_equations_jacobian_map%VARIABLE)
3523 exits(
"EquationsMapping_VarToEquatsJacobianMapInitialise")
3525 999
errors(
"EquationsMapping_VarToEquatsJacobianMapInitialise",err,error)
3526 exits(
"EquationsMapping_VarToEquatsJacobianMapInitialise")
3540 INTEGER(INTG),
INTENT(OUT) :: ERR
3543 INTEGER(INTG) :: matrix_idx
3545 enters(
"EquationsMapping_VarToEquatsMatricesMapFinalise",err,error,*999)
3547 IF(
ALLOCATED(var_to_equations_matrices_map%EQUATIONS_MATRIX_NUMBERS)) &
3548 &
DEALLOCATE(var_to_equations_matrices_map%EQUATIONS_MATRIX_NUMBERS)
3549 IF(
ALLOCATED(var_to_equations_matrices_map%DOF_TO_COLUMNS_MAPS))
THEN 3550 DO matrix_idx=1,
SIZE(var_to_equations_matrices_map%DOF_TO_COLUMNS_MAPS,1)
3552 & matrix_idx),err,error,*999)
3554 DEALLOCATE(var_to_equations_matrices_map%DOF_TO_COLUMNS_MAPS)
3556 IF(
ALLOCATED(var_to_equations_matrices_map%DOF_TO_ROWS_MAP)) &
3557 &
DEALLOCATE(var_to_equations_matrices_map%DOF_TO_ROWS_MAP)
3559 exits(
"EquationsMapping_VarToEquatsMatricesMapFinalise")
3561 999
errors(
"EquationsMapping_VarToEquatsMatricesMapFinalise",err,error)
3562 exits(
"EquationsMapping_VarToEquatsMatricesMapFinalise")
3576 INTEGER(INTG),
INTENT(OUT) :: ERR
3580 enters(
"EquationsMapping_VarToEquatsMatricesMapInitialise",err,error,*999)
3582 var_to_equations_matrices_map%VARIABLE_INDEX=0
3583 var_to_equations_matrices_map%VARIABLE_TYPE=0
3584 NULLIFY(var_to_equations_matrices_map%VARIABLE)
3585 var_to_equations_matrices_map%NUMBER_OF_EQUATIONS_MATRICES=0
3587 exits(
"EquationsMapping_VarToEquatsMatricesMapInitialise")
3589 999
errors(
"EquationsMapping_VarToEquatsMatricesMapInitialise",err,error)
3590 exits(
"EquationsMapping_VarToEquatsMatricesMapInitialise")
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
subroutine, public equations_mapping_dynamic_variable_type_set(EQUATIONS_MAPPING, DYNAMIC_VARIABLE_TYPE, ERR, ERROR,)
Sets the mapping between a dependent field variable and the equations set dynamic matrices...
Contains information on the equations mapping i.e., how field variable DOFS are mapped to the rows an...
Contains information about the equations in an equations set.
subroutine equationsmapping_vartoequatsjacobianmapfinalise(VAR_TO_EQUATIONS_JACOBIAN_MAP, ERR, ERROR,)
Finalises a variable to equations Jacobian map and deallocates all memory.
subroutine equations_mapping_rhs_mapping_initialise(EQUATIONS_MAPPING, ERR, ERROR,)
Initialises the equations mapping RHS mapping.
subroutine equations_mapping_source_mapping_finalise(SOURCE_MAPPING, ERR, ERROR,)
Finalises the equations mapping source mapping and deallocates all memory.
subroutine, public equations_mapping_source_coeff_set(EQUATIONS_MAPPING, SOURCE_COEFFICIENT, ERR, ERROR,)
Sets the coefficient applied to the equations set source vector.
subroutine equations_mapping_initialise(EQUATIONS, ERR, ERROR,)
Initialises the equations mapping and deallocates all memory.
integer(intg), parameter equations_static
The equations are static and have no time dependence.
Contains information on an equations set.
This module contains all string manipulation and transformation routines.
subroutine equations_mapping_source_mapping_initialise(EQUATIONS_MAPPING, ERR, ERROR,)
Initialises the equations mapping source mapping.
subroutine equations_mapping_finalise(EQUATIONS_MAPPING, ERR, ERROR,)
Finalises the equations mapping and deallocates all memory.
Contains information for a field defined on a region.
Contains information for mapping an equations matrix to a field variable.
subroutine, public equations_mapping_rhs_variable_type_set(EQUATIONS_MAPPING, RHS_VARIABLE_TYPE, ERR, ERROR,)
Sets the mapping between a dependent field variable and the equations set rhs vector.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
subroutine equationsmapping_vartoequatsmatricesmapinitialise(VAR_TO_EQUATIONS_MATRICES_MAP, ERR, ERROR,)
Initialise an equations mapping equations matrix map.
Contains information on the create values cache for the equations mapping. Because we do not want to ...
Contains the information about the mapping of a variable DOF to an equations matrix column...
Contains information for mapping field variables to the dynamic matrices in the equations set of the ...
Flags a warning to the user.
subroutine, public equationsmapping_linearmatricesnumberset(EQUATIONS_MAPPING, NUMBER_OF_LINEAR_EQUATIONS_MATRICES, ERR, ERROR,)
Sets/changes the number of linear equations matrices.
subroutine equationsmapping_nonlinearmappingfinalise(NONLINEAR_MAPPING, ERR, ERROR,)
Finalises the equations mapping nonlinear mapping and deallocates all memory.
subroutine equationsmapping_createvaluescacheinitialise(EQUATIONS_MAPPING, ERR, ERROR,)
Initialises an equations mapping create values cache.
subroutine, public equationsmapping_linearmatricesvariabletypesset(EQUATIONS_MAPPING, LINEAR_MATRIX_VARIABLE_TYPES, ERR, ERROR,)
Sets the mapping between the dependent field variable types and the linear equations matrices...
subroutine equations_mapping_dynamic_matrices_set_1(EQUATIONS_MAPPING, DAMPING_MATRIX, STIFFNESS_MATRIX, ERR, ERROR,)
Sets/changes the matrices involved in a first order dynamic equations mapping.
integer(intg), parameter equations_second_order_dynamic
The equations are a second order dynamic.
integer(intg), parameter equations_first_order_dynamic
The equations are first order dynamic.
subroutine equationsmapping_dynamicmatricescoeffsset1(EQUATIONS_MAPPING, DAMPING_MATRIX_COEFFICIENT, STIFFNESS_MATRIX_COEFFICIENT, ERR, ERROR,)
Sets/changes the matrix coefficients in a first order dynamic equations mapping.
Contains information on the equations mapping for a source i.e., how a field variable is mapped to th...
subroutine equationsmapping_equatsmatrixtovarmapinitialise(EQUATIONS_MATRIX_TO_VAR_MAP, ERR, ERROR,)
Initialise an equations matrix to variable maps.
subroutine, public exits(NAME)
Records the exit out of the named procedure.
This module contains all type definitions in order to avoid cyclic module references.
subroutine equations_mapping_linear_mapping_finalise(LINEAR_MAPPING, ERR, ERROR,)
Finalises the equations mapping linear mapping and deallocates all memory.
Contains information on the equations mapping for nonlinear matrices i.e., how a field variable is ma...
Contains the mapping from the Jacobian back to the nonlinear residual variables.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
subroutine equations_mapping_dynamic_matrices_set_all(EQUATIONS_MAPPING, MASS_MATRIX, DAMPING_MATRIX, STIFFNESS_MATRIX, ERR, ERROR,)
Sets/changes the matrices involved in dynamic equations mapping.
Contains the mapping for a dependent variable type to the equations matrices.
subroutine, public equations_mapping_destroy(EQUATIONS_MAPPING, ERR, ERROR,)
Destroy an equations mapping.
subroutine equationsmapping_dynamicmatricescoeffsset2(EQUATIONS_MAPPING, MASS_MATRIX_COEFFICIENT, DAMPING_MATRIX_COEFFICIENT, STIFFNESS_MATRIX_COEFFICIENT, ERR, ERROR,)
Sets/changes the matrix coefficients in a second order dynamic equations mapping. ...
subroutine, public equations_mapping_create_finish(EQUATIONS_MAPPING, ERR, ERROR,)
Finishes the process of creating an equations mapping.
subroutine, public equationsmapping_linearmatricescoeffsset(EQUATIONS_MAPPING, LINEAR_MATRIX_COEFFICIENTS, ERR, ERROR,)
Sets the coefficients for the linear equations matrices in an equation set.
subroutine, public equations_mapping_source_variable_type_set(EQUATIONS_MAPPING, SOURCE_VARIABLE_TYPE, ERR, ERROR,)
Sets the mapping between a source field variable and the equations set source vector.
subroutine equations_mapping_dynamic_matrices_set_2(EQUATIONS_MAPPING, MASS_MATRIX, DAMPING_MATRIX, STIFFNESS_MATRIX, ERR, ERROR,)
Sets/changes the matrices involved in a second order dynamic equations mapping.
This module handles all domain mappings routines.
This module handles all equations mapping routines.
subroutine equations_mapping_dynamic_mapping_finalise(DYNAMIC_MAPPING, ERR, ERROR,)
Finalises the equations mapping dynamic mapping and deallocates all memory.
subroutine equationsmapping_equatsjacobiantovarmapfinalise(EQUATIONS_JACOBIAN_TO_VAR_MAP, ERR, ERROR,)
Finalises a variable to equations Jacobian map and deallocates all memory.
integer(intg), parameter equations_linear
The equations are linear.
subroutine equations_mapping_rhs_mapping_finalise(RHS_MAPPING, ERR, ERROR,)
Finalises the equations mapping RHS mapping and deallocates all memory.
logical, save, public diagnostics1
.TRUE. if level 1 diagnostic output is active in the current routine
subroutine equationsmapping_vartoequatsjacobianmapinitialise(VAR_TO_EQUATIONS_JACOBIAN_MAP, ERR, ERROR,)
Initialises a variable to equations Jacobian map.
subroutine equationsmapping_vartoequatscolumnmapfinalise(VAR_TO_EQUATIONS_COLUMN_MAP, ERR, ERROR,)
Finalise an equations mapping equations matrix map.
subroutine, public equations_mapping_create_start(EQUATIONS, EQUATIONS_MAPPING, ERR, ERROR,)
Finishes the process of creating an equations mapping for a equations set equations.
subroutine equationsmapping_dynamicmappinginitialise(EQUATIONS_MAPPING, ERR, ERROR,)
Initialises the equations mapping dynamic mapping.
subroutine equationsmapping_nonlinearmappinginitialise(EQUATIONS_MAPPING, ERR, ERROR,)
Initialises the equations mapping nonlinear mapping.
subroutine equations_mapping_linear_mapping_initialise(EQUATIONS_MAPPING, ERR, ERROR,)
Initialises the equations mapping linear mapping.
subroutine equationsmapping_equatsjacobiantovarmapinitialise(EQUATIONS_JACOBIAN_TO_VAR_MAP, ERR, ERROR,)
Initialises a variable to equations Jacobian map.
subroutine, public equationsmapping_residualvariablesnumberset(EQUATIONS_MAPPING, NUMBER_OF_VARIABLES, ERR, ERROR,)
Sets the mapping between a dependent field variable and the equations set residual vector...
integer(intg), parameter, public diagnostic_output_type
Diagnostic output type.
subroutine, public equations_mapping_residual_coeff_set(EQUATIONS_MAPPING, RESIDUAL_COEFFICIENT, ERR, ERROR,)
Sets the coefficient applied to the equations set residual vector.
Contains the mapping for a dependent variable type to the nonlinear Jacobian matrix.
Contains information for a field variable defined on a field.
subroutine equationsmapping_equationsmatrixtovarmapfinalise(EQUATIONS_MATRIX_TO_VAR_MAP, ERR, ERROR,)
Finalise an equations matrix to variable maps and deallocate all memory.
integer(intg), parameter equations_nonlinear_bcs
The equations have non-linear boundary conditions.
subroutine equations_mapping_calculate(EQUATIONS_MAPPING, ERR, ERROR,)
Calculates the equations/dofs mapping.
Contains information on the equations mapping for a RHS i.e., how a field variable is mapped to the R...
subroutine, public errors(NAME, ERR, ERROR)
Records the exiting error of the subroutine.
This module defines all constants shared across equations set routines.
Flags an error condition.
subroutine, public equationsmapping_residualvariabletypesset(EQUATIONS_MAPPING, RESIDUAL_VARIABLE_TYPES, ERR, ERROR,)
Sets the mapping between a dependent field variable and the equations set residual vector...
integer(intg), parameter equations_quasistatic
The equations are quasi-static.
Flags an error condition.
subroutine equationsmapping_vartoequatsmatricesmapfinalise(VAR_TO_EQUATIONS_MATRICES_MAP, ERR, ERROR,)
Finalises a variable to equations matrices map and deallocates all memory.
subroutine equationsmapping_createvaluescachefinalise(CREATE_VALUES_CACHE, ERR, ERROR,)
Finalises an equations mapping create values cache and deallocates all memory.
integer(intg), parameter equations_nonlinear
The equations are non-linear.
integer(intg), parameter equations_time_stepping
The equations are for time stepping.
Contains information for mapping field variables to the linear matrices in the equations set of the m...
This module contains all kind definitions.
subroutine, public equations_mapping_rhs_coeff_set(EQUATIONS_MAPPING, RHS_COEFFICIENT, ERR, ERROR,)
Sets the coefficient applied to the equations set RHS vector.